* [PATCH 1/8] of/fdt.c: use architecture-independent ALIGN macro, defined in kernel.h [not found] ` <1279304021-22216-1-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> @ 2010-07-16 18:13 ` Stephen Neuendorffer [not found] ` <f2cebad3-5fb1-4984-800f-ef847e388e65-RaUQJvECHitZbvUCbuG1mrjjLBE8jN/0@public.gmane.org> 0 siblings, 1 reply; 36+ messages in thread From: Stephen Neuendorffer @ 2010-07-16 18:13 UTC (permalink / raw) To: grant.likely-s3s/WqlpOiPyB63q8FvJNQ, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ This removes an architecture dependency, making the code more generic. --- drivers/of/fdt.c | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index b6987bb..d61fda8 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -69,9 +69,9 @@ int __init of_scan_flat_dt(int (*it)(unsigned long node, u32 sz = be32_to_cpup((__be32 *)p); p += 8; if (be32_to_cpu(initial_boot_params->version) < 0x10) - p = _ALIGN(p, sz >= 8 ? 8 : 4); + p = ALIGN(p, sz >= 8 ? 8 : 4); p += sz; - p = _ALIGN(p, 4); + p = ALIGN(p, 4); continue; } if (tag != OF_DT_BEGIN_NODE) { @@ -80,7 +80,7 @@ int __init of_scan_flat_dt(int (*it)(unsigned long node, } depth++; pathp = (char *)p; - p = _ALIGN(p + strlen(pathp) + 1, 4); + p = ALIGN(p + strlen(pathp) + 1, 4); if ((*pathp) == '/') { char *lp, *np; for (lp = NULL, np = pathp; *np; np++) @@ -109,7 +109,7 @@ unsigned long __init of_get_flat_dt_root(void) p += 4; BUG_ON(be32_to_cpup((__be32 *)p) != OF_DT_BEGIN_NODE); p += 4; - return _ALIGN(p + strlen((char *)p) + 1, 4); + return ALIGN(p + strlen((char *)p) + 1, 4); } /** @@ -138,7 +138,7 @@ void *__init of_get_flat_dt_prop(unsigned long node, const char *name, noff = be32_to_cpup((__be32 *)(p + 4)); p += 8; if (be32_to_cpu(initial_boot_params->version) < 0x10) - p = _ALIGN(p, sz >= 8 ? 8 : 4); + p = ALIGN(p, sz >= 8 ? 8 : 4); nstr = find_flat_dt_string(noff); if (nstr == NULL) { @@ -151,7 +151,7 @@ void *__init of_get_flat_dt_prop(unsigned long node, const char *name, return (void *)p; } p += sz; - p = _ALIGN(p, 4); + p = ALIGN(p, 4); } while (1); } @@ -184,7 +184,7 @@ static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size, { void *res; - *mem = _ALIGN(*mem, align); + *mem = ALIGN(*mem, align); res = (void *)*mem; *mem += size; @@ -220,7 +220,7 @@ unsigned long __init unflatten_dt_node(unsigned long mem, *p += 4; pathp = (char *)*p; l = allocl = strlen(pathp) + 1; - *p = _ALIGN(*p + l, 4); + *p = ALIGN(*p + l, 4); /* version 0x10 has a more compact unit name here instead of the full * path. we accumulate the full path size using "fpsize", we'll rebuild @@ -299,7 +299,7 @@ unsigned long __init unflatten_dt_node(unsigned long mem, noff = be32_to_cpup((__be32 *)((*p) + 4)); *p += 8; if (be32_to_cpu(initial_boot_params->version) < 0x10) - *p = _ALIGN(*p, sz >= 8 ? 8 : 4); + *p = ALIGN(*p, sz >= 8 ? 8 : 4); pname = find_flat_dt_string(noff); if (pname == NULL) { @@ -333,7 +333,7 @@ unsigned long __init unflatten_dt_node(unsigned long mem, *prev_pp = pp; prev_pp = &pp->next; } - *p = _ALIGN((*p) + sz, 4); + *p = ALIGN((*p) + sz, 4); } /* with version 0x10 we may not have the name property, recreate * it here from the unit name if absent -- 1.5.6.6 This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately. ^ permalink raw reply related [flat|nested] 36+ messages in thread
[parent not found: <f2cebad3-5fb1-4984-800f-ef847e388e65-RaUQJvECHitZbvUCbuG1mrjjLBE8jN/0@public.gmane.org>]
* Re: [PATCH 1/8] of/fdt.c: use architecture-independent ALIGN macro, defined in kernel.h [not found] ` <f2cebad3-5fb1-4984-800f-ef847e388e65-RaUQJvECHitZbvUCbuG1mrjjLBE8jN/0@public.gmane.org> @ 2010-07-16 18:29 ` Grant Likely [not found] ` <AANLkTin8GUuMjAVI-r2KNXBoH7DjsQWfTjC1inQTlD6V-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 36+ messages in thread From: Grant Likely @ 2010-07-16 18:29 UTC (permalink / raw) To: Stephen Neuendorffer; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ On Fri, Jul 16, 2010 at 12:13 PM, Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote: > This removes an architecture dependency, making the code more generic. A similar change will be in linux-next today. :-) I've recently updated my next-devicetree and test-devicetree branches if you would like to rebase. g. > --- > drivers/of/fdt.c | 20 ++++++++++---------- > 1 files changed, 10 insertions(+), 10 deletions(-) > > diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c > index b6987bb..d61fda8 100644 > --- a/drivers/of/fdt.c > +++ b/drivers/of/fdt.c > @@ -69,9 +69,9 @@ int __init of_scan_flat_dt(int (*it)(unsigned long node, > u32 sz = be32_to_cpup((__be32 *)p); > p += 8; > if (be32_to_cpu(initial_boot_params->version) < 0x10) > - p = _ALIGN(p, sz >= 8 ? 8 : 4); > + p = ALIGN(p, sz >= 8 ? 8 : 4); > p += sz; > - p = _ALIGN(p, 4); > + p = ALIGN(p, 4); > continue; > } > if (tag != OF_DT_BEGIN_NODE) { > @@ -80,7 +80,7 @@ int __init of_scan_flat_dt(int (*it)(unsigned long node, > } > depth++; > pathp = (char *)p; > - p = _ALIGN(p + strlen(pathp) + 1, 4); > + p = ALIGN(p + strlen(pathp) + 1, 4); > if ((*pathp) == '/') { > char *lp, *np; > for (lp = NULL, np = pathp; *np; np++) > @@ -109,7 +109,7 @@ unsigned long __init of_get_flat_dt_root(void) > p += 4; > BUG_ON(be32_to_cpup((__be32 *)p) != OF_DT_BEGIN_NODE); > p += 4; > - return _ALIGN(p + strlen((char *)p) + 1, 4); > + return ALIGN(p + strlen((char *)p) + 1, 4); > } > > /** > @@ -138,7 +138,7 @@ void *__init of_get_flat_dt_prop(unsigned long node, const char *name, > noff = be32_to_cpup((__be32 *)(p + 4)); > p += 8; > if (be32_to_cpu(initial_boot_params->version) < 0x10) > - p = _ALIGN(p, sz >= 8 ? 8 : 4); > + p = ALIGN(p, sz >= 8 ? 8 : 4); > > nstr = find_flat_dt_string(noff); > if (nstr == NULL) { > @@ -151,7 +151,7 @@ void *__init of_get_flat_dt_prop(unsigned long node, const char *name, > return (void *)p; > } > p += sz; > - p = _ALIGN(p, 4); > + p = ALIGN(p, 4); > } while (1); > } > > @@ -184,7 +184,7 @@ static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size, > { > void *res; > > - *mem = _ALIGN(*mem, align); > + *mem = ALIGN(*mem, align); > res = (void *)*mem; > *mem += size; > > @@ -220,7 +220,7 @@ unsigned long __init unflatten_dt_node(unsigned long mem, > *p += 4; > pathp = (char *)*p; > l = allocl = strlen(pathp) + 1; > - *p = _ALIGN(*p + l, 4); > + *p = ALIGN(*p + l, 4); > > /* version 0x10 has a more compact unit name here instead of the full > * path. we accumulate the full path size using "fpsize", we'll rebuild > @@ -299,7 +299,7 @@ unsigned long __init unflatten_dt_node(unsigned long mem, > noff = be32_to_cpup((__be32 *)((*p) + 4)); > *p += 8; > if (be32_to_cpu(initial_boot_params->version) < 0x10) > - *p = _ALIGN(*p, sz >= 8 ? 8 : 4); > + *p = ALIGN(*p, sz >= 8 ? 8 : 4); > > pname = find_flat_dt_string(noff); > if (pname == NULL) { > @@ -333,7 +333,7 @@ unsigned long __init unflatten_dt_node(unsigned long mem, > *prev_pp = pp; > prev_pp = &pp->next; > } > - *p = _ALIGN((*p) + sz, 4); > + *p = ALIGN((*p) + sz, 4); > } > /* with version 0x10 we may not have the name property, recreate > * it here from the unit name if absent > -- > 1.5.6.6 > > > > This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately. > > > -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. ^ permalink raw reply [flat|nested] 36+ messages in thread
[parent not found: <AANLkTin8GUuMjAVI-r2KNXBoH7DjsQWfTjC1inQTlD6V-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* RE: [PATCH 1/8] of/fdt.c: use architecture-independent ALIGN macro, defined in kernel.h [not found] ` <AANLkTin8GUuMjAVI-r2KNXBoH7DjsQWfTjC1inQTlD6V-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2010-07-16 18:45 ` Stephen Neuendorffer 2010-07-19 18:34 ` Stephen Neuendorffer 1 sibling, 0 replies; 36+ messages in thread From: Stephen Neuendorffer @ 2010-07-16 18:45 UTC (permalink / raw) To: Grant Likely; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ > -----Original Message----- > From: glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org [mailto:glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org] On Behalf Of Grant Likely > Sent: Friday, July 16, 2010 11:30 AM > To: Stephen Neuendorffer > Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org > Subject: Re: [PATCH 1/8] of/fdt.c: use architecture-independent ALIGN macro, defined in kernel.h > > On Fri, Jul 16, 2010 at 12:13 PM, Stephen Neuendorffer > <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote: > > This removes an architecture dependency, making the code more generic. > > A similar change will be in linux-next today. :-) I've recently > updated my next-devicetree and test-devicetree branches if you would > like to rebase. I will.. Looks like this cleans up alot of the junky stuff! :) Steve > > g. > > > --- > > drivers/of/fdt.c | 20 ++++++++++---------- > > 1 files changed, 10 insertions(+), 10 deletions(-) > > > > diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c > > index b6987bb..d61fda8 100644 > > --- a/drivers/of/fdt.c > > +++ b/drivers/of/fdt.c > > @@ -69,9 +69,9 @@ int __init of_scan_flat_dt(int (*it)(unsigned long node, > > u32 sz = be32_to_cpup((__be32 *)p); > > p += 8; > > if (be32_to_cpu(initial_boot_params->version) < 0x10) > > - p = _ALIGN(p, sz >= 8 ? 8 : 4); > > + p = ALIGN(p, sz >= 8 ? 8 : 4); > > p += sz; > > - p = _ALIGN(p, 4); > > + p = ALIGN(p, 4); > > continue; > > } > > if (tag != OF_DT_BEGIN_NODE) { > > @@ -80,7 +80,7 @@ int __init of_scan_flat_dt(int (*it)(unsigned long node, > > } > > depth++; > > pathp = (char *)p; > > - p = _ALIGN(p + strlen(pathp) + 1, 4); > > + p = ALIGN(p + strlen(pathp) + 1, 4); > > if ((*pathp) == '/') { > > char *lp, *np; > > for (lp = NULL, np = pathp; *np; np++) > > @@ -109,7 +109,7 @@ unsigned long __init of_get_flat_dt_root(void) > > p += 4; > > BUG_ON(be32_to_cpup((__be32 *)p) != OF_DT_BEGIN_NODE); > > p += 4; > > - return _ALIGN(p + strlen((char *)p) + 1, 4); > > + return ALIGN(p + strlen((char *)p) + 1, 4); > > } > > > > /** > > @@ -138,7 +138,7 @@ void *__init of_get_flat_dt_prop(unsigned long node, const char *name, > > noff = be32_to_cpup((__be32 *)(p + 4)); > > p += 8; > > if (be32_to_cpu(initial_boot_params->version) < 0x10) > > - p = _ALIGN(p, sz >= 8 ? 8 : 4); > > + p = ALIGN(p, sz >= 8 ? 8 : 4); > > > > nstr = find_flat_dt_string(noff); > > if (nstr == NULL) { > > @@ -151,7 +151,7 @@ void *__init of_get_flat_dt_prop(unsigned long node, const char *name, > > return (void *)p; > > } > > p += sz; > > - p = _ALIGN(p, 4); > > + p = ALIGN(p, 4); > > } while (1); > > } > > > > @@ -184,7 +184,7 @@ static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size, > > { > > void *res; > > > > - *mem = _ALIGN(*mem, align); > > + *mem = ALIGN(*mem, align); > > res = (void *)*mem; > > *mem += size; > > > > @@ -220,7 +220,7 @@ unsigned long __init unflatten_dt_node(unsigned long mem, > > *p += 4; > > pathp = (char *)*p; > > l = allocl = strlen(pathp) + 1; > > - *p = _ALIGN(*p + l, 4); > > + *p = ALIGN(*p + l, 4); > > > > /* version 0x10 has a more compact unit name here instead of the full > > * path. we accumulate the full path size using "fpsize", we'll rebuild > > @@ -299,7 +299,7 @@ unsigned long __init unflatten_dt_node(unsigned long mem, > > noff = be32_to_cpup((__be32 *)((*p) + 4)); > > *p += 8; > > if (be32_to_cpu(initial_boot_params->version) < 0x10) > > - *p = _ALIGN(*p, sz >= 8 ? 8 : 4); > > + *p = ALIGN(*p, sz >= 8 ? 8 : 4); > > > > pname = find_flat_dt_string(noff); > > if (pname == NULL) { > > @@ -333,7 +333,7 @@ unsigned long __init unflatten_dt_node(unsigned long mem, > > *prev_pp = pp; > > prev_pp = &pp->next; > > } > > - *p = _ALIGN((*p) + sz, 4); > > + *p = ALIGN((*p) + sz, 4); > > } > > /* with version 0x10 we may not have the name property, recreate > > * it here from the unit name if absent > > -- > > 1.5.6.6 > > > > > > > > This email and any attachments are intended for the sole use of the named recipient(s) and > contain(s) confidential information that may be proprietary, privileged or copyrighted under > applicable law. If you are not the intended recipient, do not read, copy, or forward this email > message or any attachments. Delete this email message and any attachments immediately. > > > > > > > > > > -- > Grant Likely, B.Sc., P.Eng. > Secret Lab Technologies Ltd. This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately. ^ permalink raw reply [flat|nested] 36+ messages in thread
* RE: [PATCH 1/8] of/fdt.c: use architecture-independent ALIGN macro, defined in kernel.h [not found] ` <AANLkTin8GUuMjAVI-r2KNXBoH7DjsQWfTjC1inQTlD6V-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2010-07-16 18:45 ` Stephen Neuendorffer @ 2010-07-19 18:34 ` Stephen Neuendorffer 1 sibling, 0 replies; 36+ messages in thread From: Stephen Neuendorffer @ 2010-07-19 18:34 UTC (permalink / raw) To: Grant Likely; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ > -----Original Message----- > From: glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org [mailto:glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org] On Behalf Of Grant Likely > Sent: Friday, July 16, 2010 11:30 AM > To: Stephen Neuendorffer > Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org > Subject: Re: [PATCH 1/8] of/fdt.c: use architecture-independent ALIGN macro, defined in kernel.h > > On Fri, Jul 16, 2010 at 12:13 PM, Stephen Neuendorffer > <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote: > > This removes an architecture dependency, making the code more generic. > > A similar change will be in linux-next today. :-) I've recently > updated my next-devicetree and test-devicetree branches if you would > like to rebase. > > g. FYI: I tried rebasing, but I get boot problems on my x86 box. I haven't determined if this is related to rc3+, or my additional patches yet... Steve This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately. ^ permalink raw reply [flat|nested] 36+ messages in thread
[parent not found: <1279304021-22216-2-git-send-email-stephen.neuendorffer@xilinx.com>]
[parent not found: <1279304021-22216-2-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>]
* [PATCH 2/8] drivers/of: Make device tree code work on any arch. [not found] ` <1279304021-22216-2-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> @ 2010-07-16 18:13 ` Stephen Neuendorffer [not found] ` <592c6c35-556d-4874-8b75-2ebf0acf00e9-+Ck8Kgl/v0+Da4789yZHSLjjLBE8jN/0@public.gmane.org> 0 siblings, 1 reply; 36+ messages in thread From: Stephen Neuendorffer @ 2010-07-16 18:13 UTC (permalink / raw) To: grant.likely-s3s/WqlpOiPyB63q8FvJNQ, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> --- I'm not sure what the right way to abstract these functions is. of_node_to_nid seems specific to those platforms which have a root device tree. pci_address_to_pio seems to probably have a useful implementation, but I'm not sure what it's trying to do. Perhaps someone can shed some light? --- drivers/of/address.c | 5 +++++ drivers/of/device.c | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletions(-) diff --git a/drivers/of/address.c b/drivers/of/address.c index fcadb72..61e652b 100644 --- a/drivers/of/address.c +++ b/drivers/of/address.c @@ -539,7 +539,12 @@ static int __of_address_to_resource(struct device_node *dev, const u32 *addrp, memset(r, 0, sizeof(struct resource)); if (flags & IORESOURCE_IO) { unsigned long port; + // FIXME: utter hack... +#if defined(CONFIG_MICROBLAZE) || defined(CONFIG_POWERPC) port = pci_address_to_pio(taddr); +#else + port = -1; +#endif if (port == (unsigned long)-1) return -EINVAL; r->start = port; diff --git a/drivers/of/device.c b/drivers/of/device.c index 5282a20..27a65fc 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c @@ -107,8 +107,13 @@ int of_device_register(struct of_device *ofdev) /* device_add will assume that this device is on the same node as * the parent. If there is no parent defined, set the node * explicitly */ - if (!ofdev->dev.parent) + if (!ofdev->dev.parent) { +#if defined(CONFIG_MICROBLAZE) || defined(CONFIG_POWERPC) || defined(CONFIG_SPARC) set_dev_node(&ofdev->dev, of_node_to_nid(ofdev->dev.of_node)); +#else + set_dev_node(&ofdev->dev, -1); +#endif + } return device_add(&ofdev->dev); } -- 1.5.6.6 This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately. ^ permalink raw reply related [flat|nested] 36+ messages in thread
[parent not found: <592c6c35-556d-4874-8b75-2ebf0acf00e9-+Ck8Kgl/v0+Da4789yZHSLjjLBE8jN/0@public.gmane.org>]
* Re: [PATCH 2/8] drivers/of: Make device tree code work on any arch. [not found] ` <592c6c35-556d-4874-8b75-2ebf0acf00e9-+Ck8Kgl/v0+Da4789yZHSLjjLBE8jN/0@public.gmane.org> @ 2010-07-16 18:31 ` Grant Likely [not found] ` <AANLkTimW3tsllx82F-cKtAEHGxVXwG4ESbtYWBzS17Wb-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 36+ messages in thread From: Grant Likely @ 2010-07-16 18:31 UTC (permalink / raw) To: Stephen Neuendorffer; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ On Fri, Jul 16, 2010 at 12:13 PM, Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote: > Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> > > --- > > I'm not sure what the right way to abstract these functions is. > of_node_to_nid seems specific to those platforms which have a root > device tree. pci_address_to_pio seems to probably have a useful > implementation, but I'm not sure what it's trying to do. Perhaps > someone can shed some light? Right now I'm making each arch implement the pci_address_to_pio() and of_node_to_nid() hooks. Not sure if I'll retain that in the long term. pci_address_to_pio() will probably become common code eventually. > --- > drivers/of/address.c | 5 +++++ > drivers/of/device.c | 7 ++++++- > 2 files changed, 11 insertions(+), 1 deletions(-) > > diff --git a/drivers/of/address.c b/drivers/of/address.c > index fcadb72..61e652b 100644 > --- a/drivers/of/address.c > +++ b/drivers/of/address.c > @@ -539,7 +539,12 @@ static int __of_address_to_resource(struct device_node *dev, const u32 *addrp, > memset(r, 0, sizeof(struct resource)); > if (flags & IORESOURCE_IO) { > unsigned long port; > + // FIXME: utter hack... > +#if defined(CONFIG_MICROBLAZE) || defined(CONFIG_POWERPC) > port = pci_address_to_pio(taddr); > +#else > + port = -1; > +#endif > if (port == (unsigned long)-1) > return -EINVAL; > r->start = port; > diff --git a/drivers/of/device.c b/drivers/of/device.c > index 5282a20..27a65fc 100644 > --- a/drivers/of/device.c > +++ b/drivers/of/device.c > @@ -107,8 +107,13 @@ int of_device_register(struct of_device *ofdev) > /* device_add will assume that this device is on the same node as > * the parent. If there is no parent defined, set the node > * explicitly */ > - if (!ofdev->dev.parent) > + if (!ofdev->dev.parent) { > +#if defined(CONFIG_MICROBLAZE) || defined(CONFIG_POWERPC) || defined(CONFIG_SPARC) > set_dev_node(&ofdev->dev, of_node_to_nid(ofdev->dev.of_node)); > +#else > + set_dev_node(&ofdev->dev, -1); > +#endif > + } > > return device_add(&ofdev->dev); > } > -- > 1.5.6.6 > > > > This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately. > > > -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. ^ permalink raw reply [flat|nested] 36+ messages in thread
[parent not found: <AANLkTimW3tsllx82F-cKtAEHGxVXwG4ESbtYWBzS17Wb-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* RE: [PATCH 2/8] drivers/of: Make device tree code work on any arch. [not found] ` <AANLkTimW3tsllx82F-cKtAEHGxVXwG4ESbtYWBzS17Wb-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2010-07-16 18:34 ` Stephen Neuendorffer [not found] ` <686f0008-74c9-4ee5-bfb3-b4920835b765-RaUQJvECHitEus+KprP3J7jjLBE8jN/0@public.gmane.org> 0 siblings, 1 reply; 36+ messages in thread From: Stephen Neuendorffer @ 2010-07-16 18:34 UTC (permalink / raw) To: Grant Likely; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ > -----Original Message----- > From: glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org [mailto:glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org] On Behalf Of Grant Likely > Sent: Friday, July 16, 2010 11:32 AM > To: Stephen Neuendorffer > Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org > Subject: Re: [PATCH 2/8] drivers/of: Make device tree code work on any arch. > > On Fri, Jul 16, 2010 at 12:13 PM, Stephen Neuendorffer > <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote: > > Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> > > > > --- > > > > I'm not sure what the right way to abstract these functions is. > > of_node_to_nid seems specific to those platforms which have a root > > device tree. pci_address_to_pio seems to probably have a useful > > implementation, but I'm not sure what it's trying to do. Perhaps > > someone can shed some light? > > Right now I'm making each arch implement the pci_address_to_pio() and > of_node_to_nid() hooks. Not sure if I'll retain that in the long > term. pci_address_to_pio() will probably become common code > eventually. One thought that I had was to factor those archs/platforms that have a root device tree (and probably have a useful of_node_to_nid), from those that don't. This would also simplify some of the #ifdefs in drivers/of/fdt.c which pick out MICROBLAZE, POWERPC and SPARC for the early_device_tree stuff. Steve This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately. ^ permalink raw reply [flat|nested] 36+ messages in thread
[parent not found: <686f0008-74c9-4ee5-bfb3-b4920835b765-RaUQJvECHitEus+KprP3J7jjLBE8jN/0@public.gmane.org>]
* Re: [PATCH 2/8] drivers/of: Make device tree code work on any arch. [not found] ` <686f0008-74c9-4ee5-bfb3-b4920835b765-RaUQJvECHitEus+KprP3J7jjLBE8jN/0@public.gmane.org> @ 2010-07-16 18:55 ` Grant Likely 0 siblings, 0 replies; 36+ messages in thread From: Grant Likely @ 2010-07-16 18:55 UTC (permalink / raw) To: Stephen Neuendorffer; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ On Fri, Jul 16, 2010 at 12:34 PM, Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote: > > >> -----Original Message----- >> From: glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org [mailto:glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org] On Behalf Of Grant Likely >> Sent: Friday, July 16, 2010 11:32 AM >> To: Stephen Neuendorffer >> Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org >> Subject: Re: [PATCH 2/8] drivers/of: Make device tree code work on any arch. >> >> On Fri, Jul 16, 2010 at 12:13 PM, Stephen Neuendorffer >> <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote: >> > Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> >> > >> > --- >> > >> > I'm not sure what the right way to abstract these functions is. >> > of_node_to_nid seems specific to those platforms which have a root >> > device tree. pci_address_to_pio seems to probably have a useful >> > implementation, but I'm not sure what it's trying to do. Perhaps >> > someone can shed some light? >> >> Right now I'm making each arch implement the pci_address_to_pio() and >> of_node_to_nid() hooks. Not sure if I'll retain that in the long >> term. pci_address_to_pio() will probably become common code >> eventually. > > One thought that I had was to factor those archs/platforms that have a root device tree > (and probably have a useful of_node_to_nid), from those that don't. This would also simplify > some of the #ifdefs in drivers/of/fdt.c which pick out MICROBLAZE, POWERPC and SPARC for > the early_device_tree stuff. And what about the platforms that have both root and non-root device trees? This includes x86 by the way. I've received patches to add OLPC device tree support. OLPC is currently x86, but the 1.75 hardware will be ARM. Both run open firmware. g. ^ permalink raw reply [flat|nested] 36+ messages in thread
[parent not found: <1279304021-22216-3-git-send-email-stephen.neuendorffer@xilinx.com>]
[parent not found: <1279304021-22216-3-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>]
* [PATCH 3/8] of/fdt: Add unflatten_partial_device_tree [not found] ` <1279304021-22216-3-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> @ 2010-07-16 18:13 ` Stephen Neuendorffer [not found] ` <91a7e060-e748-47d5-aa7d-4fc45343d212-RaUQJvECHitEus+KprP3J7jjLBE8jN/0@public.gmane.org> 0 siblings, 1 reply; 36+ messages in thread From: Stephen Neuendorffer @ 2010-07-16 18:13 UTC (permalink / raw) To: grant.likely-s3s/WqlpOiPyB63q8FvJNQ, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ This code allows a user to parse a partial device tree blob, which is structurally independent of any toplevel blob. Previously, this code assumed that the blob comes from initial_boot_params. Now, unflatten_partial_device_tree can take a blob from an arbitrary position, and the location of the blob gets passed around to the various support functions. Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> --- drivers/of/fdt.c | 169 +++++++++++++++++++++++++++++++++-------------- include/linux/of_fdt.h | 11 ++- 2 files changed, 126 insertions(+), 54 deletions(-) diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index d61fda8..89fb1f3 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -11,10 +11,12 @@ #include <linux/kernel.h> #include <linux/initrd.h> +#include <linux/module.h> #include <linux/of.h> #include <linux/of_fdt.h> #include <linux/string.h> #include <linux/errno.h> +#include <linux/slab.h> #ifdef CONFIG_PPC #include <asm/machdep.h> @@ -22,15 +24,19 @@ #include <asm/page.h> -int __initdata dt_root_addr_cells; -int __initdata dt_root_size_cells; +int dt_root_addr_cells; +int dt_root_size_cells; struct boot_param_header *initial_boot_params; -char *find_flat_dt_string(u32 offset) +void __unflatten_device_tree(unsigned long *blob, struct device_node **mynodes, + unsigned long (*dt_alloc)(u64 size, u64 align)); + +char *find_flat_dt_string(u32 offset, + struct boot_param_header *blob) { - return ((char *)initial_boot_params) + - be32_to_cpu(initial_boot_params->off_dt_strings) + offset; + return ((char *)blob) + + be32_to_cpu(blob->off_dt_strings) + offset; } /** @@ -118,8 +124,9 @@ unsigned long __init of_get_flat_dt_root(void) * This function can be used within scan_flattened_dt callback to get * access to properties */ -void *__init of_get_flat_dt_prop(unsigned long node, const char *name, - unsigned long *size) +void * __init of_get_flat_dt_prop(unsigned long node, const char *name, + unsigned long *size, + struct boot_param_header *blob) { unsigned long p = node; @@ -140,7 +147,7 @@ void *__init of_get_flat_dt_prop(unsigned long node, const char *name, if (be32_to_cpu(initial_boot_params->version) < 0x10) p = ALIGN(p, sz >= 8 ? 8 : 4); - nstr = find_flat_dt_string(noff); + nstr = find_flat_dt_string(noff, blob); if (nstr == NULL) { pr_warning("Can't find property index name !\n"); return NULL; @@ -160,12 +167,13 @@ void *__init of_get_flat_dt_prop(unsigned long node, const char *name, * @node: node to test * @compat: compatible string to compare with compatible list. */ -int __init of_flat_dt_is_compatible(unsigned long node, const char *compat) +int of_flat_dt_is_compatible(unsigned long node, const char *compat, + struct boot_param_header *blob) { const char *cp; unsigned long cplen, l; - cp = of_get_flat_dt_prop(node, "compatible", &cplen); + cp = of_get_flat_dt_prop(node, "compatible", &cplen, blob); if (cp == NULL) return 0; while (cplen > 0) { @@ -179,7 +187,7 @@ int __init of_flat_dt_is_compatible(unsigned long node, const char *compat) return 0; } -static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size, +static void *unflatten_dt_alloc(unsigned long *mem, unsigned long size, unsigned long align) { void *res; @@ -198,11 +206,12 @@ static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size, * @allnextpp: pointer to ->allnext from last allocated device_node * @fpsize: Size of the node path up at the current depth. */ -unsigned long __init unflatten_dt_node(unsigned long mem, - unsigned long *p, - struct device_node *dad, - struct device_node ***allnextpp, - unsigned long fpsize) +unsigned long unflatten_dt_node(unsigned long mem, + unsigned long *p, + struct device_node *dad, + struct device_node ***allnextpp, + unsigned long fpsize, + struct boot_param_header *blob) { struct device_node *np; struct property *pp, **prev_pp = NULL; @@ -298,10 +307,10 @@ unsigned long __init unflatten_dt_node(unsigned long mem, sz = be32_to_cpup((__be32 *)(*p)); noff = be32_to_cpup((__be32 *)((*p) + 4)); *p += 8; - if (be32_to_cpu(initial_boot_params->version) < 0x10) + if (be32_to_cpu(blob->version) < 0x10) *p = ALIGN(*p, sz >= 8 ? 8 : 4); - pname = find_flat_dt_string(noff); + pname = find_flat_dt_string(noff, blob); if (pname == NULL) { pr_info("Can't find property name in list !\n"); break; @@ -380,7 +389,8 @@ unsigned long __init unflatten_dt_node(unsigned long mem, if (tag == OF_DT_NOP) *p += 4; else - mem = unflatten_dt_node(mem, p, np, allnextpp, fpsize); + mem = unflatten_dt_node(mem, p, np, allnextpp, + fpsize, blob); tag = be32_to_cpup((__be32 *)(*p)); } if (tag != OF_DT_END_NODE) { @@ -391,6 +401,8 @@ unsigned long __init unflatten_dt_node(unsigned long mem, return mem; } +#if defined(CONFIG_MICROBLAZE) || defined(CONFIG_POWERPC) || defined(CONFIG_SPARC) + #ifdef CONFIG_BLK_DEV_INITRD /** * early_init_dt_check_for_initrd - Decode initrd location from flat tree @@ -403,12 +415,14 @@ void __init early_init_dt_check_for_initrd(unsigned long node) pr_debug("Looking for initrd properties... "); - prop = of_get_flat_dt_prop(node, "linux,initrd-start", &len); + prop = of_get_flat_dt_prop(node, "linux,initrd-start", + &len, initial_boot_params); if (!prop) return; start = of_read_ulong(prop, len/4); - prop = of_get_flat_dt_prop(node, "linux,initrd-end", &len); + prop = of_get_flat_dt_prop(node, "linux,initrd-end", + &len, initial_boot_params); if (!prop) return; end = of_read_ulong(prop, len/4); @@ -436,12 +450,14 @@ int __init early_init_dt_scan_root(unsigned long node, const char *uname, dt_root_size_cells = OF_ROOT_NODE_SIZE_CELLS_DEFAULT; dt_root_addr_cells = OF_ROOT_NODE_ADDR_CELLS_DEFAULT; - prop = of_get_flat_dt_prop(node, "#size-cells", NULL); + prop = of_get_flat_dt_prop(node, "#size-cells", + NULL, initial_boot_params); if (prop) dt_root_size_cells = be32_to_cpup(prop); pr_debug("dt_root_size_cells = %x\n", dt_root_size_cells); - prop = of_get_flat_dt_prop(node, "#address-cells", NULL); + prop = of_get_flat_dt_prop(node, "#address-cells", + NULL, initial_boot_params); if (prop) dt_root_addr_cells = be32_to_cpup(prop); pr_debug("dt_root_addr_cells = %x\n", dt_root_addr_cells); @@ -450,7 +466,7 @@ int __init early_init_dt_scan_root(unsigned long node, const char *uname, return 1; } -u64 __init dt_mem_next_cell(int s, __be32 **cellp) +u64 dt_mem_next_cell(int s, __be32 **cellp) { __be32 *p = *cellp; @@ -464,7 +480,8 @@ u64 __init dt_mem_next_cell(int s, __be32 **cellp) int __init early_init_dt_scan_memory(unsigned long node, const char *uname, int depth, void *data) { - char *type = of_get_flat_dt_prop(node, "device_type", NULL); + char *type = of_get_flat_dt_prop(node, "device_type", + NULL, initial_boot_params); __be32 *reg, *endp; unsigned long l; @@ -479,9 +496,10 @@ int __init early_init_dt_scan_memory(unsigned long node, const char *uname, } else if (strcmp(type, "memory") != 0) return 0; - reg = of_get_flat_dt_prop(node, "linux,usable-memory", &l); + reg = of_get_flat_dt_prop(node, "linux,usable-memory", + &l, initial_boot_params); if (reg == NULL) - reg = of_get_flat_dt_prop(node, "reg", &l); + reg = of_get_flat_dt_prop(node, "reg", &l, initial_boot_params); if (reg == NULL) return 0; @@ -521,12 +539,12 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, early_init_dt_check_for_initrd(node); +#ifdef CONFIG_CMDLINE /* Retreive command line */ - p = of_get_flat_dt_prop(node, "bootargs", &l); + p = of_get_flat_dt_prop(node, "bootargs", &l, initial_boot_params); if (p != NULL && l > 0) strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE)); -#ifdef CONFIG_CMDLINE #ifndef CONFIG_CMDLINE_FORCE if (p == NULL || l == 0 || (l == 1 && (*p) == 0)) #endif @@ -535,12 +553,21 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, early_init_dt_scan_chosen_arch(node); +#ifdef CONFIG_CMDLINE pr_debug("Command line is: %s\n", cmd_line); +#endif /* CONFIG_CMDLINE */ /* break now */ return 1; } + +static unsigned long early_device_tree_alloc(u64 size, u64 align) +{ + unsigned long mem = early_init_dt_alloc_memory_arch(size, align); + return (unsigned long) __va(mem); +} + /** * unflatten_device_tree - create tree of device_nodes from flat blob * @@ -551,58 +578,98 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, */ void __init unflatten_device_tree(void) { + __unflatten_device_tree(initial_boot_params, &allnodes, + early_device_tree_alloc); + + /* Get pointer to OF "/chosen" node for use everywhere */ + of_chosen = of_find_node_by_path("/chosen"); + if (of_chosen == NULL) + of_chosen = of_find_node_by_path("/chosen@0"); +} + +#endif + +static unsigned long kernel_tree_alloc(u64 size, u64 align) +{ + return (unsigned long) kzalloc(size, GFP_KERNEL); +} + +/** + * unflatten_partial_device_tree - create tree of device_nodes from flat blob + * + * unflattens the device-tree passed by the firmware, creating the + * tree of struct device_node. It also fills the "name" and "type" + * pointers of the nodes so the normal device-tree walking functions + * can be used. + */ +void unflatten_partial_device_tree(unsigned long *blob, + struct device_node **mynodes) +{ + __unflatten_device_tree(blob, mynodes, &kernel_tree_alloc); +} +EXPORT_SYMBOL(unflatten_partial_device_tree); + +/** + * __unflatten_device_tree - create tree of device_nodes from flat blob + * + * unflattens the device-tree passed by the firmware, creating the + * tree of struct device_node. It also fills the "name" and "type" + * pointers of the nodes so the normal device-tree walking functions + * can be used. Memory is allocated using the given function. + */ +void __unflatten_device_tree(unsigned long *blob, struct device_node **mynodes, + unsigned long (*dt_alloc)(u64 size, u64 align)) +{ + struct boot_param_header *device_tree = + (struct boot_param_header *)blob; unsigned long start, mem, size; - struct device_node **allnextp = &allnodes; + struct device_node **allnextp = mynodes; pr_debug(" -> unflatten_device_tree()\n"); - if (!initial_boot_params) { + if (!device_tree) { pr_debug("No device tree pointer\n"); return; } pr_debug("Unflattening device tree:\n"); - pr_debug("magic: %08x\n", be32_to_cpu(initial_boot_params->magic)); - pr_debug("size: %08x\n", be32_to_cpu(initial_boot_params->totalsize)); - pr_debug("version: %08x\n", be32_to_cpu(initial_boot_params->version)); + pr_debug("magic: %08x\n", be32_to_cpu(device_tree->magic)); + pr_debug("size: %08x\n", be32_to_cpu(device_tree->totalsize)); + pr_debug("version: %08x\n", be32_to_cpu(device_tree->version)); - if (be32_to_cpu(initial_boot_params->magic) != OF_DT_HEADER) { - pr_err("Invalid device tree blob header\n"); + if (be32_to_cpu(device_tree->magic) != OF_DT_HEADER) { + pr_err("Invalid device tree blob header %x\n", + be32_to_cpu(device_tree->magic)); return; } /* First pass, scan for size */ - start = ((unsigned long)initial_boot_params) + - be32_to_cpu(initial_boot_params->off_dt_struct); - size = unflatten_dt_node(0, &start, NULL, NULL, 0); + start = ((unsigned long)device_tree) + + be32_to_cpu(device_tree->off_dt_struct); + size = unflatten_dt_node(0, &start, NULL, NULL, 0, device_tree); size = (size | 3) + 1; pr_debug(" size is %lx, allocating...\n", size); /* Allocate memory for the expanded device tree */ - mem = early_init_dt_alloc_memory_arch(size + 4, - __alignof__(struct device_node)); - mem = (unsigned long) __va(mem); + mem = (unsigned long) dt_alloc(size + 4, + __alignof__(struct device_node)); ((__be32 *)mem)[size / 4] = cpu_to_be32(0xdeadbeef); pr_debug(" unflattening %lx...\n", mem); /* Second pass, do actual unflattening */ - start = ((unsigned long)initial_boot_params) + - be32_to_cpu(initial_boot_params->off_dt_struct); - unflatten_dt_node(mem, &start, NULL, &allnextp, 0); + start = ((unsigned long)device_tree) + + be32_to_cpu(device_tree->off_dt_struct); + unflatten_dt_node(mem, &start, NULL, &allnextp, 0, device_tree); if (be32_to_cpup((__be32 *)start) != OF_DT_END) - pr_warning("Weird tag at end of tree: %08x\n", *((u32 *)start)); + pr_warning("Weird tag at end of tree: %08x\n", + *((u32 *)start)); if (be32_to_cpu(((__be32 *)mem)[size / 4]) != 0xdeadbeef) pr_warning("End of tree marker overwritten: %08x\n", be32_to_cpu(((__be32 *)mem)[size / 4])); *allnextp = NULL; - /* Get pointer to OF "/chosen" node for use everywhere */ - of_chosen = of_find_node_by_path("/chosen"); - if (of_chosen == NULL) - of_chosen = of_find_node_by_path("/chosen@0"); - pr_debug(" <- unflatten_device_tree()\n"); } diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h index 71e1a91..2bc0754 100644 --- a/include/linux/of_fdt.h +++ b/include/linux/of_fdt.h @@ -64,13 +64,16 @@ extern int __initdata dt_root_size_cells; extern struct boot_param_header *initial_boot_params; /* For scanning the flat device-tree at boot time */ -extern char *find_flat_dt_string(u32 offset); +extern char *find_flat_dt_string(u32 offset, + struct boot_param_header *blob); extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname, int depth, void *data), void *data); extern void *of_get_flat_dt_prop(unsigned long node, const char *name, - unsigned long *size); -extern int of_flat_dt_is_compatible(unsigned long node, const char *name); + unsigned long *size, + struct boot_param_header *blob); +extern int of_flat_dt_is_compatible(unsigned long node, const char *name, + struct boot_param_header *blob); extern unsigned long of_get_flat_dt_root(void); extern void early_init_dt_scan_chosen_arch(unsigned long node); extern int early_init_dt_scan_chosen(unsigned long node, const char *uname, @@ -98,6 +101,8 @@ extern int early_init_dt_scan_root(unsigned long node, const char *uname, /* Other Prototypes */ extern void unflatten_device_tree(void); +extern void unflatten_partial_device_tree(unsigned long *blob, + struct device_node **mynodes); extern void early_init_devtree(void *); #else /* CONFIG_OF_FLATTREE */ static inline void unflatten_device_tree(void) {} -- 1.5.6.6 This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately. ^ permalink raw reply related [flat|nested] 36+ messages in thread
[parent not found: <91a7e060-e748-47d5-aa7d-4fc45343d212-RaUQJvECHitEus+KprP3J7jjLBE8jN/0@public.gmane.org>]
* Re: [PATCH 3/8] of/fdt: Add unflatten_partial_device_tree [not found] ` <91a7e060-e748-47d5-aa7d-4fc45343d212-RaUQJvECHitEus+KprP3J7jjLBE8jN/0@public.gmane.org> @ 2010-07-16 19:25 ` Grant Likely [not found] ` <AANLkTikbhjZshaetoTX6kXHwt_SobYUG69cuDZd0gArF-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 36+ messages in thread From: Grant Likely @ 2010-07-16 19:25 UTC (permalink / raw) To: Stephen Neuendorffer; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ On Fri, Jul 16, 2010 at 12:13 PM, Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote: > This code allows a user to parse a partial device tree blob, which is > structurally independent of any toplevel blob. > Previously, this code assumed that the blob comes from initial_boot_params. > Now, unflatten_partial_device_tree can take a blob from an arbitrary position, > and the location of the blob gets passed around to the various support functions. > > Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> > --- > drivers/of/fdt.c | 169 +++++++++++++++++++++++++++++++++-------------- > include/linux/of_fdt.h | 11 ++- > 2 files changed, 126 insertions(+), 54 deletions(-) > > diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c > index d61fda8..89fb1f3 100644 > --- a/drivers/of/fdt.c > +++ b/drivers/of/fdt.c > @@ -11,10 +11,12 @@ > > #include <linux/kernel.h> > #include <linux/initrd.h> > +#include <linux/module.h> > #include <linux/of.h> > #include <linux/of_fdt.h> > #include <linux/string.h> > #include <linux/errno.h> > +#include <linux/slab.h> > > #ifdef CONFIG_PPC > #include <asm/machdep.h> > @@ -22,15 +24,19 @@ > > #include <asm/page.h> > > -int __initdata dt_root_addr_cells; > -int __initdata dt_root_size_cells; > +int dt_root_addr_cells; > +int dt_root_size_cells; The fact that these are still here looks wrong. The code cannot depend on global symbols, particularly global symbols that it modified, when it is changed to support processing non-rooted trees. More rework will be needed here. > > struct boot_param_header *initial_boot_params; > > -char *find_flat_dt_string(u32 offset) > +void __unflatten_device_tree(unsigned long *blob, struct device_node **mynodes, > + unsigned long (*dt_alloc)(u64 size, u64 align)); > + > +char *find_flat_dt_string(u32 offset, > + struct boot_param_header *blob) > { > - return ((char *)initial_boot_params) + > - be32_to_cpu(initial_boot_params->off_dt_strings) + offset; > + return ((char *)blob) + > + be32_to_cpu(blob->off_dt_strings) + offset; > } > > /** > @@ -118,8 +124,9 @@ unsigned long __init of_get_flat_dt_root(void) > * This function can be used within scan_flattened_dt callback to get > * access to properties > */ > -void *__init of_get_flat_dt_prop(unsigned long node, const char *name, > - unsigned long *size) > +void * __init of_get_flat_dt_prop(unsigned long node, const char *name, > + unsigned long *size, > + struct boot_param_header *blob) > { > unsigned long p = node; > > @@ -140,7 +147,7 @@ void *__init of_get_flat_dt_prop(unsigned long node, const char *name, > if (be32_to_cpu(initial_boot_params->version) < 0x10) > p = ALIGN(p, sz >= 8 ? 8 : 4); > > - nstr = find_flat_dt_string(noff); > + nstr = find_flat_dt_string(noff, blob); > if (nstr == NULL) { > pr_warning("Can't find property index name !\n"); > return NULL; > @@ -160,12 +167,13 @@ void *__init of_get_flat_dt_prop(unsigned long node, const char *name, > * @node: node to test > * @compat: compatible string to compare with compatible list. > */ > -int __init of_flat_dt_is_compatible(unsigned long node, const char *compat) > +int of_flat_dt_is_compatible(unsigned long node, const char *compat, > + struct boot_param_header *blob) > { > const char *cp; > unsigned long cplen, l; > > - cp = of_get_flat_dt_prop(node, "compatible", &cplen); > + cp = of_get_flat_dt_prop(node, "compatible", &cplen, blob); > if (cp == NULL) > return 0; > while (cplen > 0) { > @@ -179,7 +187,7 @@ int __init of_flat_dt_is_compatible(unsigned long node, const char *compat) > return 0; > } > > -static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size, > +static void *unflatten_dt_alloc(unsigned long *mem, unsigned long size, > unsigned long align) > { > void *res; > @@ -198,11 +206,12 @@ static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size, > * @allnextpp: pointer to ->allnext from last allocated device_node > * @fpsize: Size of the node path up at the current depth. > */ > -unsigned long __init unflatten_dt_node(unsigned long mem, > - unsigned long *p, > - struct device_node *dad, > - struct device_node ***allnextpp, > - unsigned long fpsize) > +unsigned long unflatten_dt_node(unsigned long mem, > + unsigned long *p, > + struct device_node *dad, > + struct device_node ***allnextpp, > + unsigned long fpsize, > + struct boot_param_header *blob) > { > struct device_node *np; > struct property *pp, **prev_pp = NULL; > @@ -298,10 +307,10 @@ unsigned long __init unflatten_dt_node(unsigned long mem, > sz = be32_to_cpup((__be32 *)(*p)); > noff = be32_to_cpup((__be32 *)((*p) + 4)); > *p += 8; > - if (be32_to_cpu(initial_boot_params->version) < 0x10) > + if (be32_to_cpu(blob->version) < 0x10) > *p = ALIGN(*p, sz >= 8 ? 8 : 4); > > - pname = find_flat_dt_string(noff); > + pname = find_flat_dt_string(noff, blob); > if (pname == NULL) { > pr_info("Can't find property name in list !\n"); > break; > @@ -380,7 +389,8 @@ unsigned long __init unflatten_dt_node(unsigned long mem, > if (tag == OF_DT_NOP) > *p += 4; > else > - mem = unflatten_dt_node(mem, p, np, allnextpp, fpsize); > + mem = unflatten_dt_node(mem, p, np, allnextpp, > + fpsize, blob); > tag = be32_to_cpup((__be32 *)(*p)); > } > if (tag != OF_DT_END_NODE) { > @@ -391,6 +401,8 @@ unsigned long __init unflatten_dt_node(unsigned long mem, > return mem; > } > > +#if defined(CONFIG_MICROBLAZE) || defined(CONFIG_POWERPC) || defined(CONFIG_SPARC) > + Rather hacky.. There's got to be a better way. Might be better to add a new Kconfig symbol. Also, the test is wrong. ARM is going to want this. OLPC x86 might want it. SPARC doesn't use it. > #ifdef CONFIG_BLK_DEV_INITRD > /** > * early_init_dt_check_for_initrd - Decode initrd location from flat tree > @@ -403,12 +415,14 @@ void __init early_init_dt_check_for_initrd(unsigned long node) > > pr_debug("Looking for initrd properties... "); > > - prop = of_get_flat_dt_prop(node, "linux,initrd-start", &len); > + prop = of_get_flat_dt_prop(node, "linux,initrd-start", > + &len, initial_boot_params); > if (!prop) > return; > start = of_read_ulong(prop, len/4); > > - prop = of_get_flat_dt_prop(node, "linux,initrd-end", &len); > + prop = of_get_flat_dt_prop(node, "linux,initrd-end", > + &len, initial_boot_params); > if (!prop) > return; > end = of_read_ulong(prop, len/4); > @@ -436,12 +450,14 @@ int __init early_init_dt_scan_root(unsigned long node, const char *uname, > dt_root_size_cells = OF_ROOT_NODE_SIZE_CELLS_DEFAULT; > dt_root_addr_cells = OF_ROOT_NODE_ADDR_CELLS_DEFAULT; > > - prop = of_get_flat_dt_prop(node, "#size-cells", NULL); > + prop = of_get_flat_dt_prop(node, "#size-cells", > + NULL, initial_boot_params); > if (prop) > dt_root_size_cells = be32_to_cpup(prop); > pr_debug("dt_root_size_cells = %x\n", dt_root_size_cells); > > - prop = of_get_flat_dt_prop(node, "#address-cells", NULL); > + prop = of_get_flat_dt_prop(node, "#address-cells", > + NULL, initial_boot_params); > if (prop) > dt_root_addr_cells = be32_to_cpup(prop); > pr_debug("dt_root_addr_cells = %x\n", dt_root_addr_cells); This is the update to the static globals I was mentioning that must not be done. > @@ -450,7 +466,7 @@ int __init early_init_dt_scan_root(unsigned long node, const char *uname, > return 1; > } > > -u64 __init dt_mem_next_cell(int s, __be32 **cellp) > +u64 dt_mem_next_cell(int s, __be32 **cellp) > { > __be32 *p = *cellp; > > @@ -464,7 +480,8 @@ u64 __init dt_mem_next_cell(int s, __be32 **cellp) > int __init early_init_dt_scan_memory(unsigned long node, const char *uname, > int depth, void *data) > { > - char *type = of_get_flat_dt_prop(node, "device_type", NULL); > + char *type = of_get_flat_dt_prop(node, "device_type", > + NULL, initial_boot_params); > __be32 *reg, *endp; > unsigned long l; > > @@ -479,9 +496,10 @@ int __init early_init_dt_scan_memory(unsigned long node, const char *uname, > } else if (strcmp(type, "memory") != 0) > return 0; > > - reg = of_get_flat_dt_prop(node, "linux,usable-memory", &l); > + reg = of_get_flat_dt_prop(node, "linux,usable-memory", > + &l, initial_boot_params); > if (reg == NULL) > - reg = of_get_flat_dt_prop(node, "reg", &l); > + reg = of_get_flat_dt_prop(node, "reg", &l, initial_boot_params); > if (reg == NULL) > return 0; > > @@ -521,12 +539,12 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, > > early_init_dt_check_for_initrd(node); > > +#ifdef CONFIG_CMDLINE > /* Retreive command line */ > - p = of_get_flat_dt_prop(node, "bootargs", &l); > + p = of_get_flat_dt_prop(node, "bootargs", &l, initial_boot_params); > if (p != NULL && l > 0) > strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE)); > > -#ifdef CONFIG_CMDLINE Why is this being changed? > #ifndef CONFIG_CMDLINE_FORCE > if (p == NULL || l == 0 || (l == 1 && (*p) == 0)) > #endif > @@ -535,12 +553,21 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, > > early_init_dt_scan_chosen_arch(node); > > +#ifdef CONFIG_CMDLINE > pr_debug("Command line is: %s\n", cmd_line); > +#endif /* CONFIG_CMDLINE */ > > /* break now */ > return 1; > } > > + > +static unsigned long early_device_tree_alloc(u64 size, u64 align) > +{ > + unsigned long mem = early_init_dt_alloc_memory_arch(size, align); > + return (unsigned long) __va(mem); > +} > + > /** > * unflatten_device_tree - create tree of device_nodes from flat blob > * > @@ -551,58 +578,98 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, > */ > void __init unflatten_device_tree(void) > { > + __unflatten_device_tree(initial_boot_params, &allnodes, > + early_device_tree_alloc); > + > + /* Get pointer to OF "/chosen" node for use everywhere */ > + of_chosen = of_find_node_by_path("/chosen"); > + if (of_chosen == NULL) > + of_chosen = of_find_node_by_path("/chosen@0"); > +} > + > +#endif > + > +static unsigned long kernel_tree_alloc(u64 size, u64 align) > +{ > + return (unsigned long) kzalloc(size, GFP_KERNEL); > +} > + > +/** > + * unflatten_partial_device_tree - create tree of device_nodes from flat blob > + * > + * unflattens the device-tree passed by the firmware, creating the > + * tree of struct device_node. It also fills the "name" and "type" > + * pointers of the nodes so the normal device-tree walking functions > + * can be used. > + */ > +void unflatten_partial_device_tree(unsigned long *blob, > + struct device_node **mynodes) > +{ > + __unflatten_device_tree(blob, mynodes, &kernel_tree_alloc); > +} > +EXPORT_SYMBOL(unflatten_partial_device_tree); unflatten_partial_device_tree and unflatten_device_tree should be defined *below* __unflatten_device_tree(). > + > +/** > + * __unflatten_device_tree - create tree of device_nodes from flat blob > + * > + * unflattens the device-tree passed by the firmware, creating the > + * tree of struct device_node. It also fills the "name" and "type" > + * pointers of the nodes so the normal device-tree walking functions > + * can be used. Memory is allocated using the given function. > + */ > +void __unflatten_device_tree(unsigned long *blob, struct device_node **mynodes, > + unsigned long (*dt_alloc)(u64 size, u64 align)) > +{ > + struct boot_param_header *device_tree = > + (struct boot_param_header *)blob; > unsigned long start, mem, size; > - struct device_node **allnextp = &allnodes; > + struct device_node **allnextp = mynodes; > > pr_debug(" -> unflatten_device_tree()\n"); > > - if (!initial_boot_params) { > + if (!device_tree) { > pr_debug("No device tree pointer\n"); > return; > } > > pr_debug("Unflattening device tree:\n"); > - pr_debug("magic: %08x\n", be32_to_cpu(initial_boot_params->magic)); > - pr_debug("size: %08x\n", be32_to_cpu(initial_boot_params->totalsize)); > - pr_debug("version: %08x\n", be32_to_cpu(initial_boot_params->version)); > + pr_debug("magic: %08x\n", be32_to_cpu(device_tree->magic)); > + pr_debug("size: %08x\n", be32_to_cpu(device_tree->totalsize)); > + pr_debug("version: %08x\n", be32_to_cpu(device_tree->version)); > > - if (be32_to_cpu(initial_boot_params->magic) != OF_DT_HEADER) { > - pr_err("Invalid device tree blob header\n"); > + if (be32_to_cpu(device_tree->magic) != OF_DT_HEADER) { > + pr_err("Invalid device tree blob header %x\n", > + be32_to_cpu(device_tree->magic)); > return; > } > > /* First pass, scan for size */ > - start = ((unsigned long)initial_boot_params) + > - be32_to_cpu(initial_boot_params->off_dt_struct); > - size = unflatten_dt_node(0, &start, NULL, NULL, 0); > + start = ((unsigned long)device_tree) + > + be32_to_cpu(device_tree->off_dt_struct); > + size = unflatten_dt_node(0, &start, NULL, NULL, 0, device_tree); > size = (size | 3) + 1; > > pr_debug(" size is %lx, allocating...\n", size); > > /* Allocate memory for the expanded device tree */ > - mem = early_init_dt_alloc_memory_arch(size + 4, > - __alignof__(struct device_node)); > - mem = (unsigned long) __va(mem); > + mem = (unsigned long) dt_alloc(size + 4, > + __alignof__(struct device_node)); > > ((__be32 *)mem)[size / 4] = cpu_to_be32(0xdeadbeef); > > pr_debug(" unflattening %lx...\n", mem); > > /* Second pass, do actual unflattening */ > - start = ((unsigned long)initial_boot_params) + > - be32_to_cpu(initial_boot_params->off_dt_struct); > - unflatten_dt_node(mem, &start, NULL, &allnextp, 0); > + start = ((unsigned long)device_tree) + > + be32_to_cpu(device_tree->off_dt_struct); > + unflatten_dt_node(mem, &start, NULL, &allnextp, 0, device_tree); > if (be32_to_cpup((__be32 *)start) != OF_DT_END) > - pr_warning("Weird tag at end of tree: %08x\n", *((u32 *)start)); > + pr_warning("Weird tag at end of tree: %08x\n", > + *((u32 *)start)); > if (be32_to_cpu(((__be32 *)mem)[size / 4]) != 0xdeadbeef) > pr_warning("End of tree marker overwritten: %08x\n", > be32_to_cpu(((__be32 *)mem)[size / 4])); > *allnextp = NULL; > > - /* Get pointer to OF "/chosen" node for use everywhere */ > - of_chosen = of_find_node_by_path("/chosen"); > - if (of_chosen == NULL) > - of_chosen = of_find_node_by_path("/chosen@0"); > - > pr_debug(" <- unflatten_device_tree()\n"); > } > diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h > index 71e1a91..2bc0754 100644 > --- a/include/linux/of_fdt.h > +++ b/include/linux/of_fdt.h > @@ -64,13 +64,16 @@ extern int __initdata dt_root_size_cells; > extern struct boot_param_header *initial_boot_params; > > /* For scanning the flat device-tree at boot time */ > -extern char *find_flat_dt_string(u32 offset); > +extern char *find_flat_dt_string(u32 offset, > + struct boot_param_header *blob); Well, fdt.c is the only user of this. I think this line can be removed. > extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname, > int depth, void *data), > void *data); > extern void *of_get_flat_dt_prop(unsigned long node, const char *name, > - unsigned long *size); > -extern int of_flat_dt_is_compatible(unsigned long node, const char *name); > + unsigned long *size, > + struct boot_param_header *blob); > +extern int of_flat_dt_is_compatible(unsigned long node, const char *name, > + struct boot_param_header *blob); Need to fix this. The prototypes for of_get_flat_dt_prop() and of_flat_dt_is_compatible are changed, but there are users in the microblaze and powerpc trees which are not updated. > extern unsigned long of_get_flat_dt_root(void); > extern void early_init_dt_scan_chosen_arch(unsigned long node); > extern int early_init_dt_scan_chosen(unsigned long node, const char *uname, > @@ -98,6 +101,8 @@ extern int early_init_dt_scan_root(unsigned long node, const char *uname, > > /* Other Prototypes */ > extern void unflatten_device_tree(void); > +extern void unflatten_partial_device_tree(unsigned long *blob, > + struct device_node **mynodes); > extern void early_init_devtree(void *); > #else /* CONFIG_OF_FLATTREE */ > static inline void unflatten_device_tree(void) {} > -- > 1.5.6.6 > > > > This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately. > > > -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. ^ permalink raw reply [flat|nested] 36+ messages in thread
[parent not found: <AANLkTikbhjZshaetoTX6kXHwt_SobYUG69cuDZd0gArF-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* RE: [PATCH 3/8] of/fdt: Add unflatten_partial_device_tree [not found] ` <AANLkTikbhjZshaetoTX6kXHwt_SobYUG69cuDZd0gArF-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2010-07-23 22:10 ` Stephen Neuendorffer [not found] ` <58c8fb4d-50d9-45bb-9a09-9cd04033a912-RaUQJvECHiusiP+nND6G/7jjLBE8jN/0@public.gmane.org> 0 siblings, 1 reply; 36+ messages in thread From: Stephen Neuendorffer @ 2010-07-23 22:10 UTC (permalink / raw) To: Grant Likely; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ > -----Original Message----- > From: glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org [mailto:glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org] On Behalf Of Grant Likely > Sent: Friday, July 16, 2010 12:25 PM > To: Stephen Neuendorffer > Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org > Subject: Re: [PATCH 3/8] of/fdt: Add unflatten_partial_device_tree > > On Fri, Jul 16, 2010 at 12:13 PM, Stephen Neuendorffer > <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote: > > This code allows a user to parse a partial device tree blob, which is > > structurally independent of any toplevel blob. > > Previously, this code assumed that the blob comes from initial_boot_params. > > Now, unflatten_partial_device_tree can take a blob from an arbitrary position, > > and the location of the blob gets passed around to the various support functions. > > > > Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> > > --- > > drivers/of/fdt.c | 169 +++++++++++++++++++++++++++++++++-------------- > > include/linux/of_fdt.h | 11 ++- > > 2 files changed, 126 insertions(+), 54 deletions(-) > > > > diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c > > index d61fda8..89fb1f3 100644 > > --- a/drivers/of/fdt.c > > +++ b/drivers/of/fdt.c > > @@ -11,10 +11,12 @@ > > > > #include <linux/kernel.h> > > #include <linux/initrd.h> > > +#include <linux/module.h> > > #include <linux/of.h> > > #include <linux/of_fdt.h> > > #include <linux/string.h> > > #include <linux/errno.h> > > +#include <linux/slab.h> > > > > #ifdef CONFIG_PPC > > #include <asm/machdep.h> > > @@ -22,15 +24,19 @@ > > > > #include <asm/page.h> > > > > -int __initdata dt_root_addr_cells; > > -int __initdata dt_root_size_cells; > > +int dt_root_addr_cells; > > +int dt_root_size_cells; > > The fact that these are still here looks wrong. The code cannot > depend on global symbols, particularly global symbols that it > modified, when it is changed to support processing non-rooted trees. > More rework will be needed here. Agreed. I'll fix it. > > > > struct boot_param_header *initial_boot_params; > > > > -char *find_flat_dt_string(u32 offset) > > +void __unflatten_device_tree(unsigned long *blob, struct device_node **mynodes, > > + unsigned long (*dt_alloc)(u64 size, u64 align)); > > + > > +char *find_flat_dt_string(u32 offset, > > + struct boot_param_header *blob) > > { > > - return ((char *)initial_boot_params) + > > - be32_to_cpu(initial_boot_params->off_dt_strings) + offset; > > + return ((char *)blob) + > > + be32_to_cpu(blob->off_dt_strings) + offset; > > } > > > > /** > > @@ -118,8 +124,9 @@ unsigned long __init of_get_flat_dt_root(void) > > * This function can be used within scan_flattened_dt callback to get > > * access to properties > > */ > > -void *__init of_get_flat_dt_prop(unsigned long node, const char *name, > > - unsigned long *size) > > +void * __init of_get_flat_dt_prop(unsigned long node, const char *name, > > + unsigned long *size, > > + struct boot_param_header *blob) > > { > > unsigned long p = node; > > > > @@ -140,7 +147,7 @@ void *__init of_get_flat_dt_prop(unsigned long node, const char *name, > > if (be32_to_cpu(initial_boot_params->version) < 0x10) > > p = ALIGN(p, sz >= 8 ? 8 : 4); > > > > - nstr = find_flat_dt_string(noff); > > + nstr = find_flat_dt_string(noff, blob); > > if (nstr == NULL) { > > pr_warning("Can't find property index name !\n"); > > return NULL; > > @@ -160,12 +167,13 @@ void *__init of_get_flat_dt_prop(unsigned long node, const char *name, > > * @node: node to test > > * @compat: compatible string to compare with compatible list. > > */ > > -int __init of_flat_dt_is_compatible(unsigned long node, const char *compat) > > +int of_flat_dt_is_compatible(unsigned long node, const char *compat, > > + struct boot_param_header *blob) > > { > > const char *cp; > > unsigned long cplen, l; > > > > - cp = of_get_flat_dt_prop(node, "compatible", &cplen); > > + cp = of_get_flat_dt_prop(node, "compatible", &cplen, blob); > > if (cp == NULL) > > return 0; > > while (cplen > 0) { > > @@ -179,7 +187,7 @@ int __init of_flat_dt_is_compatible(unsigned long node, const char *compat) > > return 0; > > } > > > > -static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size, > > +static void *unflatten_dt_alloc(unsigned long *mem, unsigned long size, > > unsigned long align) > > { > > void *res; > > @@ -198,11 +206,12 @@ static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size, > > * @allnextpp: pointer to ->allnext from last allocated device_node > > * @fpsize: Size of the node path up at the current depth. > > */ > > -unsigned long __init unflatten_dt_node(unsigned long mem, > > - unsigned long *p, > > - struct device_node *dad, > > - struct device_node ***allnextpp, > > - unsigned long fpsize) > > +unsigned long unflatten_dt_node(unsigned long mem, > > + unsigned long *p, > > + struct device_node *dad, > > + struct device_node ***allnextpp, > > + unsigned long fpsize, > > + struct boot_param_header *blob) > > { > > struct device_node *np; > > struct property *pp, **prev_pp = NULL; > > @@ -298,10 +307,10 @@ unsigned long __init unflatten_dt_node(unsigned long mem, > > sz = be32_to_cpup((__be32 *)(*p)); > > noff = be32_to_cpup((__be32 *)((*p) + 4)); > > *p += 8; > > - if (be32_to_cpu(initial_boot_params->version) < 0x10) > > + if (be32_to_cpu(blob->version) < 0x10) > > *p = ALIGN(*p, sz >= 8 ? 8 : 4); > > > > - pname = find_flat_dt_string(noff); > > + pname = find_flat_dt_string(noff, blob); > > if (pname == NULL) { > > pr_info("Can't find property name in list !\n"); > > break; > > @@ -380,7 +389,8 @@ unsigned long __init unflatten_dt_node(unsigned long mem, > > if (tag == OF_DT_NOP) > > *p += 4; > > else > > - mem = unflatten_dt_node(mem, p, np, allnextpp, fpsize); > > + mem = unflatten_dt_node(mem, p, np, allnextpp, > > + fpsize, blob); > > tag = be32_to_cpup((__be32 *)(*p)); > > } > > if (tag != OF_DT_END_NODE) { > > @@ -391,6 +401,8 @@ unsigned long __init unflatten_dt_node(unsigned long mem, > > return mem; > > } > > > > +#if defined(CONFIG_MICROBLAZE) || defined(CONFIG_POWERPC) || defined(CONFIG_SPARC) > > + > > Rather hacky.. There's got to be a better way. Might be better to add > a new Kconfig symbol. > > Also, the test is wrong. ARM is going to want this. OLPC x86 might > want it. SPARC doesn't use it. I think the right thing is to factor the __init/early related things into a separate file. Sound reasonable? Then whoever wants it can select it. > > #ifdef CONFIG_BLK_DEV_INITRD > > /** > > * early_init_dt_check_for_initrd - Decode initrd location from flat tree > > @@ -403,12 +415,14 @@ void __init early_init_dt_check_for_initrd(unsigned long node) > > > > pr_debug("Looking for initrd properties... "); > > > > - prop = of_get_flat_dt_prop(node, "linux,initrd-start", &len); > > + prop = of_get_flat_dt_prop(node, "linux,initrd-start", > > + &len, initial_boot_params); > > if (!prop) > > return; > > start = of_read_ulong(prop, len/4); > > > > - prop = of_get_flat_dt_prop(node, "linux,initrd-end", &len); > > + prop = of_get_flat_dt_prop(node, "linux,initrd-end", > > + &len, initial_boot_params); > > if (!prop) > > return; > > end = of_read_ulong(prop, len/4); > > @@ -436,12 +450,14 @@ int __init early_init_dt_scan_root(unsigned long node, const char *uname, > > dt_root_size_cells = OF_ROOT_NODE_SIZE_CELLS_DEFAULT; > > dt_root_addr_cells = OF_ROOT_NODE_ADDR_CELLS_DEFAULT; > > > > - prop = of_get_flat_dt_prop(node, "#size-cells", NULL); > > + prop = of_get_flat_dt_prop(node, "#size-cells", > > + NULL, initial_boot_params); > > if (prop) > > dt_root_size_cells = be32_to_cpup(prop); > > pr_debug("dt_root_size_cells = %x\n", dt_root_size_cells); > > > > - prop = of_get_flat_dt_prop(node, "#address-cells", NULL); > > + prop = of_get_flat_dt_prop(node, "#address-cells", > > + NULL, initial_boot_params); > > if (prop) > > dt_root_addr_cells = be32_to_cpup(prop); > > pr_debug("dt_root_addr_cells = %x\n", dt_root_addr_cells); > > This is the update to the static globals I was mentioning that must not be done. > > > @@ -450,7 +466,7 @@ int __init early_init_dt_scan_root(unsigned long node, const char *uname, > > return 1; > > } > > > > -u64 __init dt_mem_next_cell(int s, __be32 **cellp) > > +u64 dt_mem_next_cell(int s, __be32 **cellp) > > { > > __be32 *p = *cellp; > > > > @@ -464,7 +480,8 @@ u64 __init dt_mem_next_cell(int s, __be32 **cellp) > > int __init early_init_dt_scan_memory(unsigned long node, const char *uname, > > int depth, void *data) > > { > > - char *type = of_get_flat_dt_prop(node, "device_type", NULL); > > + char *type = of_get_flat_dt_prop(node, "device_type", > > + NULL, initial_boot_params); > > __be32 *reg, *endp; > > unsigned long l; > > > > @@ -479,9 +496,10 @@ int __init early_init_dt_scan_memory(unsigned long node, const char *uname, > > } else if (strcmp(type, "memory") != 0) > > return 0; > > > > - reg = of_get_flat_dt_prop(node, "linux,usable-memory", &l); > > + reg = of_get_flat_dt_prop(node, "linux,usable-memory", > > + &l, initial_boot_params); > > if (reg == NULL) > > - reg = of_get_flat_dt_prop(node, "reg", &l); > > + reg = of_get_flat_dt_prop(node, "reg", &l, initial_boot_params); > > if (reg == NULL) > > return 0; > > > > @@ -521,12 +539,12 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, > > > > early_init_dt_check_for_initrd(node); > > > > +#ifdef CONFIG_CMDLINE > > /* Retreive command line */ > > - p = of_get_flat_dt_prop(node, "bootargs", &l); > > + p = of_get_flat_dt_prop(node, "bootargs", &l, initial_boot_params); > > if (p != NULL && l > 0) > > strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE)); > > > > -#ifdef CONFIG_CMDLINE > > Why is this being changed? Because it requires a cmd_line global, which all architectures (especially x86) don't seem to have) Probably if the early stuff get's factored out, then this problem goes away. > > #ifndef CONFIG_CMDLINE_FORCE > > if (p == NULL || l == 0 || (l == 1 && (*p) == 0)) > > #endif > > @@ -535,12 +553,21 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, > > > > early_init_dt_scan_chosen_arch(node); > > > > +#ifdef CONFIG_CMDLINE > > pr_debug("Command line is: %s\n", cmd_line); > > +#endif /* CONFIG_CMDLINE */ > > > > /* break now */ > > return 1; > > } > > > > + > > +static unsigned long early_device_tree_alloc(u64 size, u64 align) > > +{ > > + unsigned long mem = early_init_dt_alloc_memory_arch(size, align); > > + return (unsigned long) __va(mem); > > +} > > + > > /** > > * unflatten_device_tree - create tree of device_nodes from flat blob > > * > > @@ -551,58 +578,98 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, > > */ > > void __init unflatten_device_tree(void) > > { > > + __unflatten_device_tree(initial_boot_params, &allnodes, > > + early_device_tree_alloc); > > + > > + /* Get pointer to OF "/chosen" node for use everywhere */ > > + of_chosen = of_find_node_by_path("/chosen"); > > + if (of_chosen == NULL) > > + of_chosen = of_find_node_by_path("/chosen@0"); > > +} > > + > > +#endif > > + > > +static unsigned long kernel_tree_alloc(u64 size, u64 align) > > +{ > > + return (unsigned long) kzalloc(size, GFP_KERNEL); > > +} > > + > > +/** > > + * unflatten_partial_device_tree - create tree of device_nodes from flat blob > > + * > > + * unflattens the device-tree passed by the firmware, creating the > > + * tree of struct device_node. It also fills the "name" and "type" > > + * pointers of the nodes so the normal device-tree walking functions > > + * can be used. > > + */ > > +void unflatten_partial_device_tree(unsigned long *blob, > > + struct device_node **mynodes) > > +{ > > + __unflatten_device_tree(blob, mynodes, &kernel_tree_alloc); > > +} > > +EXPORT_SYMBOL(unflatten_partial_device_tree); > > unflatten_partial_device_tree and unflatten_device_tree should be > defined *below* __unflatten_device_tree(). Well, I wanted to avoid that, because it made the ordering requirements in the file more nasty and it makes the #ifdefs more complex. > > + > > +/** > > + * __unflatten_device_tree - create tree of device_nodes from flat blob > > + * > > + * unflattens the device-tree passed by the firmware, creating the > > + * tree of struct device_node. It also fills the "name" and "type" > > + * pointers of the nodes so the normal device-tree walking functions > > + * can be used. Memory is allocated using the given function. > > + */ > > +void __unflatten_device_tree(unsigned long *blob, struct device_node **mynodes, > > + unsigned long (*dt_alloc)(u64 size, u64 align)) > > +{ > > + struct boot_param_header *device_tree = > > + (struct boot_param_header *)blob; > > unsigned long start, mem, size; > > - struct device_node **allnextp = &allnodes; > > + struct device_node **allnextp = mynodes; > > > > pr_debug(" -> unflatten_device_tree()\n"); > > > > - if (!initial_boot_params) { > > + if (!device_tree) { > > pr_debug("No device tree pointer\n"); > > return; > > } > > > > pr_debug("Unflattening device tree:\n"); > > - pr_debug("magic: %08x\n", be32_to_cpu(initial_boot_params->magic)); > > - pr_debug("size: %08x\n", be32_to_cpu(initial_boot_params->totalsize)); > > - pr_debug("version: %08x\n", be32_to_cpu(initial_boot_params->version)); > > + pr_debug("magic: %08x\n", be32_to_cpu(device_tree->magic)); > > + pr_debug("size: %08x\n", be32_to_cpu(device_tree->totalsize)); > > + pr_debug("version: %08x\n", be32_to_cpu(device_tree->version)); > > > > - if (be32_to_cpu(initial_boot_params->magic) != OF_DT_HEADER) { > > - pr_err("Invalid device tree blob header\n"); > > + if (be32_to_cpu(device_tree->magic) != OF_DT_HEADER) { > > + pr_err("Invalid device tree blob header %x\n", > > + be32_to_cpu(device_tree->magic)); > > return; > > } > > > > /* First pass, scan for size */ > > - start = ((unsigned long)initial_boot_params) + > > - be32_to_cpu(initial_boot_params->off_dt_struct); > > - size = unflatten_dt_node(0, &start, NULL, NULL, 0); > > + start = ((unsigned long)device_tree) + > > + be32_to_cpu(device_tree->off_dt_struct); > > + size = unflatten_dt_node(0, &start, NULL, NULL, 0, device_tree); > > size = (size | 3) + 1; > > > > pr_debug(" size is %lx, allocating...\n", size); > > > > /* Allocate memory for the expanded device tree */ > > - mem = early_init_dt_alloc_memory_arch(size + 4, > > - __alignof__(struct device_node)); > > - mem = (unsigned long) __va(mem); > > + mem = (unsigned long) dt_alloc(size + 4, > > + __alignof__(struct device_node)); > > > > ((__be32 *)mem)[size / 4] = cpu_to_be32(0xdeadbeef); > > > > pr_debug(" unflattening %lx...\n", mem); > > > > /* Second pass, do actual unflattening */ > > - start = ((unsigned long)initial_boot_params) + > > - be32_to_cpu(initial_boot_params->off_dt_struct); > > - unflatten_dt_node(mem, &start, NULL, &allnextp, 0); > > + start = ((unsigned long)device_tree) + > > + be32_to_cpu(device_tree->off_dt_struct); > > + unflatten_dt_node(mem, &start, NULL, &allnextp, 0, device_tree); > > if (be32_to_cpup((__be32 *)start) != OF_DT_END) > > - pr_warning("Weird tag at end of tree: %08x\n", *((u32 *)start)); > > + pr_warning("Weird tag at end of tree: %08x\n", > > + *((u32 *)start)); > > if (be32_to_cpu(((__be32 *)mem)[size / 4]) != 0xdeadbeef) > > pr_warning("End of tree marker overwritten: %08x\n", > > be32_to_cpu(((__be32 *)mem)[size / 4])); > > *allnextp = NULL; > > > > - /* Get pointer to OF "/chosen" node for use everywhere */ > > - of_chosen = of_find_node_by_path("/chosen"); > > - if (of_chosen == NULL) > > - of_chosen = of_find_node_by_path("/chosen@0"); > > - > > pr_debug(" <- unflatten_device_tree()\n"); > > } > > diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h > > index 71e1a91..2bc0754 100644 > > --- a/include/linux/of_fdt.h > > +++ b/include/linux/of_fdt.h > > @@ -64,13 +64,16 @@ extern int __initdata dt_root_size_cells; > > extern struct boot_param_header *initial_boot_params; > > > > /* For scanning the flat device-tree at boot time */ > > -extern char *find_flat_dt_string(u32 offset); > > +extern char *find_flat_dt_string(u32 offset, > > + struct boot_param_header *blob); > > Well, fdt.c is the only user of this. I think this line can be removed. > > > extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname, > > int depth, void *data), > > void *data); > > extern void *of_get_flat_dt_prop(unsigned long node, const char *name, > > - unsigned long *size); > > -extern int of_flat_dt_is_compatible(unsigned long node, const char *name); > > + unsigned long *size, > > + struct boot_param_header *blob); > > +extern int of_flat_dt_is_compatible(unsigned long node, const char *name, > > + struct boot_param_header *blob); > > Need to fix this. The prototypes for of_get_flat_dt_prop() and > of_flat_dt_is_compatible are changed, but there are users in the > microblaze and powerpc trees which are not updated. Good point. > > extern unsigned long of_get_flat_dt_root(void); > > extern void early_init_dt_scan_chosen_arch(unsigned long node); > > extern int early_init_dt_scan_chosen(unsigned long node, const char *uname, > > @@ -98,6 +101,8 @@ extern int early_init_dt_scan_root(unsigned long node, const char *uname, > > > > /* Other Prototypes */ > > extern void unflatten_device_tree(void); > > +extern void unflatten_partial_device_tree(unsigned long *blob, > > + struct device_node **mynodes); > > extern void early_init_devtree(void *); > > #else /* CONFIG_OF_FLATTREE */ > > static inline void unflatten_device_tree(void) {} > > -- > > 1.5.6.6 > > > > > > > > This email and any attachments are intended for the sole use of the named recipient(s) and > contain(s) confidential information that may be proprietary, privileged or copyrighted under > applicable law. If you are not the intended recipient, do not read, copy, or forward this email > message or any attachments. Delete this email message and any attachments immediately. > > > > > > > > > > -- > Grant Likely, B.Sc., P.Eng. > Secret Lab Technologies Ltd. This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately. ^ permalink raw reply [flat|nested] 36+ messages in thread
[parent not found: <58c8fb4d-50d9-45bb-9a09-9cd04033a912-RaUQJvECHiusiP+nND6G/7jjLBE8jN/0@public.gmane.org>]
* Re: [PATCH 3/8] of/fdt: Add unflatten_partial_device_tree [not found] ` <58c8fb4d-50d9-45bb-9a09-9cd04033a912-RaUQJvECHiusiP+nND6G/7jjLBE8jN/0@public.gmane.org> @ 2010-08-10 17:53 ` Grant Likely [not found] ` <AANLkTimE=YjDsr5em8ttAJkRzjZ6XMF_Hts0w0EpPzqx-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 36+ messages in thread From: Grant Likely @ 2010-08-10 17:53 UTC (permalink / raw) To: Stephen Neuendorffer; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ On Fri, Jul 23, 2010 at 4:10 PM, Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote: > > >> -----Original Message----- >> From: glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org [mailto:glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org] On Behalf Of Grant Likely >> Sent: Friday, July 16, 2010 12:25 PM >> To: Stephen Neuendorffer >> Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org >> Subject: Re: [PATCH 3/8] of/fdt: Add unflatten_partial_device_tree >> >> On Fri, Jul 16, 2010 at 12:13 PM, Stephen Neuendorffer >> <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote: >> > @@ -391,6 +401,8 @@ unsigned long __init unflatten_dt_node(unsigned long mem, >> > return mem; >> > } >> > >> > +#if defined(CONFIG_MICROBLAZE) || defined(CONFIG_POWERPC) || defined(CONFIG_SPARC) >> > + >> >> Rather hacky.. There's got to be a better way. Might be better to add >> a new Kconfig symbol. >> >> Also, the test is wrong. ARM is going to want this. OLPC x86 might >> want it. SPARC doesn't use it. > > I think the right thing is to factor the __init/early related things into a separate file. > Sound reasonable? Then whoever wants it can select it. Heh, I forgot about this converation we had earlier. I wouldn't bother with a separate file (but I don't know, give it a try and see what it looks like), but a separate 'def_bool n' config symbol sounds best. > >> > #ifdef CONFIG_BLK_DEV_INITRD >> > /** >> > * early_init_dt_check_for_initrd - Decode initrd location from flat tree >> > @@ -403,12 +415,14 @@ void __init early_init_dt_check_for_initrd(unsigned long node) >> > >> > pr_debug("Looking for initrd properties... "); >> > >> > - prop = of_get_flat_dt_prop(node, "linux,initrd-start", &len); >> > + prop = of_get_flat_dt_prop(node, "linux,initrd-start", >> > + &len, initial_boot_params); >> > if (!prop) >> > return; >> > start = of_read_ulong(prop, len/4); >> > >> > - prop = of_get_flat_dt_prop(node, "linux,initrd-end", &len); >> > + prop = of_get_flat_dt_prop(node, "linux,initrd-end", >> > + &len, initial_boot_params); >> > if (!prop) >> > return; >> > end = of_read_ulong(prop, len/4); >> > @@ -436,12 +450,14 @@ int __init early_init_dt_scan_root(unsigned long node, const char *uname, >> > dt_root_size_cells = OF_ROOT_NODE_SIZE_CELLS_DEFAULT; >> > dt_root_addr_cells = OF_ROOT_NODE_ADDR_CELLS_DEFAULT; >> > >> > - prop = of_get_flat_dt_prop(node, "#size-cells", NULL); >> > + prop = of_get_flat_dt_prop(node, "#size-cells", >> > + NULL, initial_boot_params); >> > if (prop) >> > dt_root_size_cells = be32_to_cpup(prop); >> > pr_debug("dt_root_size_cells = %x\n", dt_root_size_cells); >> > >> > - prop = of_get_flat_dt_prop(node, "#address-cells", NULL); >> > + prop = of_get_flat_dt_prop(node, "#address-cells", >> > + NULL, initial_boot_params); >> > if (prop) >> > dt_root_addr_cells = be32_to_cpup(prop); >> > pr_debug("dt_root_addr_cells = %x\n", dt_root_addr_cells); >> >> This is the update to the static globals I was mentioning that must not be done. >> >> > @@ -450,7 +466,7 @@ int __init early_init_dt_scan_root(unsigned long node, const char *uname, >> > return 1; >> > } >> > >> > -u64 __init dt_mem_next_cell(int s, __be32 **cellp) >> > +u64 dt_mem_next_cell(int s, __be32 **cellp) >> > { >> > __be32 *p = *cellp; >> > >> > @@ -464,7 +480,8 @@ u64 __init dt_mem_next_cell(int s, __be32 **cellp) >> > int __init early_init_dt_scan_memory(unsigned long node, const char *uname, >> > int depth, void *data) >> > { >> > - char *type = of_get_flat_dt_prop(node, "device_type", NULL); >> > + char *type = of_get_flat_dt_prop(node, "device_type", >> > + NULL, initial_boot_params); >> > __be32 *reg, *endp; >> > unsigned long l; >> > >> > @@ -479,9 +496,10 @@ int __init early_init_dt_scan_memory(unsigned long node, const char *uname, >> > } else if (strcmp(type, "memory") != 0) >> > return 0; >> > >> > - reg = of_get_flat_dt_prop(node, "linux,usable-memory", &l); >> > + reg = of_get_flat_dt_prop(node, "linux,usable-memory", >> > + &l, initial_boot_params); >> > if (reg == NULL) >> > - reg = of_get_flat_dt_prop(node, "reg", &l); >> > + reg = of_get_flat_dt_prop(node, "reg", &l, initial_boot_params); >> > if (reg == NULL) >> > return 0; >> > >> > @@ -521,12 +539,12 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, >> > >> > early_init_dt_check_for_initrd(node); >> > >> > +#ifdef CONFIG_CMDLINE >> > /* Retreive command line */ >> > - p = of_get_flat_dt_prop(node, "bootargs", &l); >> > + p = of_get_flat_dt_prop(node, "bootargs", &l, initial_boot_params); >> > if (p != NULL && l > 0) >> > strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE)); >> > >> > -#ifdef CONFIG_CMDLINE >> >> Why is this being changed? > > Because it requires a cmd_line global, which all architectures (especially x86) don't seem to have) > Probably if the early stuff get's factored out, then this problem goes away. I'm considering changing this so that cmd_line is set with an arch-specific callback. > >> > #ifndef CONFIG_CMDLINE_FORCE >> > if (p == NULL || l == 0 || (l == 1 && (*p) == 0)) >> > #endif >> > @@ -535,12 +553,21 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, >> > >> > early_init_dt_scan_chosen_arch(node); >> > >> > +#ifdef CONFIG_CMDLINE >> > pr_debug("Command line is: %s\n", cmd_line); >> > +#endif /* CONFIG_CMDLINE */ >> > >> > /* break now */ >> > return 1; >> > } >> > >> > + >> > +static unsigned long early_device_tree_alloc(u64 size, u64 align) >> > +{ >> > + unsigned long mem = early_init_dt_alloc_memory_arch(size, align); >> > + return (unsigned long) __va(mem); >> > +} >> > + >> > /** >> > * unflatten_device_tree - create tree of device_nodes from flat blob >> > * >> > @@ -551,58 +578,98 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, >> > */ >> > void __init unflatten_device_tree(void) >> > { >> > + __unflatten_device_tree(initial_boot_params, &allnodes, >> > + early_device_tree_alloc); >> > + >> > + /* Get pointer to OF "/chosen" node for use everywhere */ >> > + of_chosen = of_find_node_by_path("/chosen"); >> > + if (of_chosen == NULL) >> > + of_chosen = of_find_node_by_path("/chosen@0"); >> > +} >> > + >> > +#endif >> > + >> > +static unsigned long kernel_tree_alloc(u64 size, u64 align) >> > +{ >> > + return (unsigned long) kzalloc(size, GFP_KERNEL); >> > +} >> > + >> > +/** >> > + * unflatten_partial_device_tree - create tree of device_nodes from flat blob >> > + * >> > + * unflattens the device-tree passed by the firmware, creating the >> > + * tree of struct device_node. It also fills the "name" and "type" >> > + * pointers of the nodes so the normal device-tree walking functions >> > + * can be used. >> > + */ >> > +void unflatten_partial_device_tree(unsigned long *blob, >> > + struct device_node **mynodes) >> > +{ >> > + __unflatten_device_tree(blob, mynodes, &kernel_tree_alloc); >> > +} >> > +EXPORT_SYMBOL(unflatten_partial_device_tree); >> >> unflatten_partial_device_tree and unflatten_device_tree should be >> defined *below* __unflatten_device_tree(). > > Well, I wanted to avoid that, because it made the ordering requirements in the file more nasty > and it makes the #ifdefs more complex. Shouldn't be. The #ifdefs are trivial (once you add the new CONFIG symbol), and there are only two references to __unflatten_device_tree(). Cheers, g. ^ permalink raw reply [flat|nested] 36+ messages in thread
[parent not found: <AANLkTimE=YjDsr5em8ttAJkRzjZ6XMF_Hts0w0EpPzqx-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* RE: [PATCH 3/8] of/fdt: Add unflatten_partial_device_tree [not found] ` <AANLkTimE=YjDsr5em8ttAJkRzjZ6XMF_Hts0w0EpPzqx-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2010-11-17 0:44 ` Stephen Neuendorffer [not found] ` <db162abd-e702-4d34-ac3a-ee6ce512f98d-+Ck8Kgl/v0/TR3wEnDZ30LjjLBE8jN/0@public.gmane.org> 0 siblings, 1 reply; 36+ messages in thread From: Stephen Neuendorffer @ 2010-11-17 0:44 UTC (permalink / raw) To: Grant Likely; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ > >> > @@ -521,12 +539,12 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, > >> > > >> > early_init_dt_check_for_initrd(node); > >> > > >> > +#ifdef CONFIG_CMDLINE > >> > /* Retreive command line */ > >> > - p = of_get_flat_dt_prop(node, "bootargs", &l); > >> > + p = of_get_flat_dt_prop(node, "bootargs", &l, initial_boot_params); > >> > if (p != NULL && l > 0) > >> > strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE)); > >> > > >> > -#ifdef CONFIG_CMDLINE > >> > >> Why is this being changed? > > > > Because it requires a cmd_line global, which all architectures (especially x86) don't seem to have) > > Probably if the early stuff get's factored out, then this problem goes away. > > I'm considering changing this so that cmd_line is set with an > arch-specific callback. I don't think I ever saw a patch for this. Have you done more than think about this? Steve This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately. ^ permalink raw reply [flat|nested] 36+ messages in thread
[parent not found: <db162abd-e702-4d34-ac3a-ee6ce512f98d-+Ck8Kgl/v0/TR3wEnDZ30LjjLBE8jN/0@public.gmane.org>]
* Re: [PATCH 3/8] of/fdt: Add unflatten_partial_device_tree [not found] ` <db162abd-e702-4d34-ac3a-ee6ce512f98d-+Ck8Kgl/v0/TR3wEnDZ30LjjLBE8jN/0@public.gmane.org> @ 2010-11-17 1:48 ` Grant Likely 0 siblings, 0 replies; 36+ messages in thread From: Grant Likely @ 2010-11-17 1:48 UTC (permalink / raw) To: Stephen Neuendorffer; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ On Tue, Nov 16, 2010 at 5:44 PM, Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote: > >> >> > @@ -521,12 +539,12 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, >> >> > >> >> > early_init_dt_check_for_initrd(node); >> >> > >> >> > +#ifdef CONFIG_CMDLINE >> >> > /* Retreive command line */ >> >> > - p = of_get_flat_dt_prop(node, "bootargs", &l); >> >> > + p = of_get_flat_dt_prop(node, "bootargs", &l, initial_boot_params); >> >> > if (p != NULL && l > 0) >> >> > strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE)); >> >> > >> >> > -#ifdef CONFIG_CMDLINE >> >> >> >> Why is this being changed? >> > >> > Because it requires a cmd_line global, which all architectures (especially x86) don't seem to have) >> > Probably if the early stuff get's factored out, then this problem goes away. >> >> I'm considering changing this so that cmd_line is set with an >> arch-specific callback. > > I don't think I ever saw a patch for this. Have you done more than think about this? Nope! g. ^ permalink raw reply [flat|nested] 36+ messages in thread
[parent not found: <1279304021-22216-4-git-send-email-stephen.neuendorffer@xilinx.com>]
[parent not found: <1279304021-22216-4-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>]
* [PATCH 4/8] of/base.c: export property access/modification functions [not found] ` <1279304021-22216-4-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> @ 2010-07-16 18:13 ` Stephen Neuendorffer [not found] ` <01cb5edd-5330-40ba-b410-6732e44f0954-+Ck8Kgl/v0+Da4789yZHSLjjLBE8jN/0@public.gmane.org> 0 siblings, 1 reply; 36+ messages in thread From: Stephen Neuendorffer @ 2010-07-16 18:13 UTC (permalink / raw) To: grant.likely-s3s/WqlpOiPyB63q8FvJNQ, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ These functions can be usefully used by device drivers. Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> --- drivers/of/base.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index e3f7af8..9ee27f6 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -763,6 +763,7 @@ int prom_add_property(struct device_node *np, struct property *prop) return 0; } +EXPORT_SYMBOL(prom_add_property); /** * prom_remove_property - Remove a property from a node. @@ -804,6 +805,7 @@ int prom_remove_property(struct device_node *np, struct property *prop) return 0; } +EXPORT_SYMBOL(prom_remove_property); /* * prom_update_property - Update a property in a node. @@ -848,6 +850,7 @@ int prom_update_property(struct device_node *np, return 0; } +EXPORT_SYMBOL(prom_update_property); #if defined(CONFIG_OF_DYNAMIC) /* -- 1.5.6.6 This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately. ^ permalink raw reply related [flat|nested] 36+ messages in thread
[parent not found: <01cb5edd-5330-40ba-b410-6732e44f0954-+Ck8Kgl/v0+Da4789yZHSLjjLBE8jN/0@public.gmane.org>]
* Re: [PATCH 4/8] of/base.c: export property access/modification functions [not found] ` <01cb5edd-5330-40ba-b410-6732e44f0954-+Ck8Kgl/v0+Da4789yZHSLjjLBE8jN/0@public.gmane.org> @ 2010-07-16 18:33 ` Grant Likely [not found] ` <AANLkTikwtfpH5qyG5cbsLYPHLSaAmBcHaSJT3zbt4s35-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 36+ messages in thread From: Grant Likely @ 2010-07-16 18:33 UTC (permalink / raw) To: Stephen Neuendorffer; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ On Fri, Jul 16, 2010 at 12:13 PM, Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote: > These functions can be usefully used by device drivers. I'd like a little more description of the intended use case. What are the circumstances where a driver needs to modify the data (this information should be part of the patch description)? g. > > Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> > --- > drivers/of/base.c | 3 +++ > 1 files changed, 3 insertions(+), 0 deletions(-) > > diff --git a/drivers/of/base.c b/drivers/of/base.c > index e3f7af8..9ee27f6 100644 > --- a/drivers/of/base.c > +++ b/drivers/of/base.c > @@ -763,6 +763,7 @@ int prom_add_property(struct device_node *np, struct property *prop) > > return 0; > } > +EXPORT_SYMBOL(prom_add_property); > > /** > * prom_remove_property - Remove a property from a node. > @@ -804,6 +805,7 @@ int prom_remove_property(struct device_node *np, struct property *prop) > > return 0; > } > +EXPORT_SYMBOL(prom_remove_property); > > /* > * prom_update_property - Update a property in a node. > @@ -848,6 +850,7 @@ int prom_update_property(struct device_node *np, > > return 0; > } > +EXPORT_SYMBOL(prom_update_property); > > #if defined(CONFIG_OF_DYNAMIC) > /* > -- > 1.5.6.6 > > > > This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately. > > > -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. ^ permalink raw reply [flat|nested] 36+ messages in thread
[parent not found: <AANLkTikwtfpH5qyG5cbsLYPHLSaAmBcHaSJT3zbt4s35-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* RE: [PATCH 4/8] of/base.c: export property access/modification functions [not found] ` <AANLkTikwtfpH5qyG5cbsLYPHLSaAmBcHaSJT3zbt4s35-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2010-07-16 18:38 ` Stephen Neuendorffer [not found] ` <e198df81-5939-4b82-9d27-952d9781ec05-+Ck8Kgl/v09CYczPSvLbDrjjLBE8jN/0@public.gmane.org> 0 siblings, 1 reply; 36+ messages in thread From: Stephen Neuendorffer @ 2010-07-16 18:38 UTC (permalink / raw) To: Grant Likely; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ > -----Original Message----- > From: glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org [mailto:glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org] On Behalf Of Grant Likely > Sent: Friday, July 16, 2010 11:34 AM > To: Stephen Neuendorffer > Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org > Subject: Re: [PATCH 4/8] of/base.c: export property access/modification functions > > On Fri, Jul 16, 2010 at 12:13 PM, Stephen Neuendorffer > <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote: > > These functions can be usefully used by device drivers. > > I'd like a little more description of the intended use case. What are > the circumstances where a driver needs to modify the data (this > information should be part of the patch description)? The PCIPR driver code needs to stuff the ranges property using these calls... I admit I'm somewhat nervous about making changes to the device tree after struct device objects are generated, but don't see a way to go about what needs to be done simply without these EXPORTS. Steve This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately. ^ permalink raw reply [flat|nested] 36+ messages in thread
[parent not found: <e198df81-5939-4b82-9d27-952d9781ec05-+Ck8Kgl/v09CYczPSvLbDrjjLBE8jN/0@public.gmane.org>]
* Re: [PATCH 4/8] of/base.c: export property access/modification functions [not found] ` <e198df81-5939-4b82-9d27-952d9781ec05-+Ck8Kgl/v09CYczPSvLbDrjjLBE8jN/0@public.gmane.org> @ 2010-07-16 18:57 ` Grant Likely [not found] ` <AANLkTilXmgTkJ2N0dTYsV99ElqssZAXwOgtKPBENZoX8-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 36+ messages in thread From: Grant Likely @ 2010-07-16 18:57 UTC (permalink / raw) To: Stephen Neuendorffer; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ On Fri, Jul 16, 2010 at 12:38 PM, Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote: > > >> -----Original Message----- >> From: glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org [mailto:glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org] On Behalf Of > Grant Likely >> Sent: Friday, July 16, 2010 11:34 AM >> To: Stephen Neuendorffer >> Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org >> Subject: Re: [PATCH 4/8] of/base.c: export property > access/modification functions >> >> On Fri, Jul 16, 2010 at 12:13 PM, Stephen Neuendorffer >> <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote: >> > These functions can be usefully used by device drivers. >> >> I'd like a little more description of the intended use case. What are >> the circumstances where a driver needs to modify the data (this >> information should be part of the patch description)? > > The PCIPR driver code needs to stuff the ranges property using these > calls... I'd rather change the translation code to give you an intermediary value (an offset from a bar), and then use non-OF code to translate that into a physical address. g. -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. ^ permalink raw reply [flat|nested] 36+ messages in thread
[parent not found: <AANLkTilXmgTkJ2N0dTYsV99ElqssZAXwOgtKPBENZoX8-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* RE: [PATCH 4/8] of/base.c: export property access/modification functions [not found] ` <AANLkTilXmgTkJ2N0dTYsV99ElqssZAXwOgtKPBENZoX8-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2010-07-16 20:07 ` Stephen Neuendorffer [not found] ` <41b1b87c-a391-493d-8235-a9304562a6e4-RaUQJvECHis6W+Ha+8ZLibjjLBE8jN/0@public.gmane.org> 0 siblings, 1 reply; 36+ messages in thread From: Stephen Neuendorffer @ 2010-07-16 20:07 UTC (permalink / raw) To: Grant Likely; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ > -----Original Message----- > From: glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org [mailto:glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org] On Behalf Of Grant Likely > Sent: Friday, July 16, 2010 11:57 AM > To: Stephen Neuendorffer > Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org > Subject: Re: [PATCH 4/8] of/base.c: export property access/modification functions > > On Fri, Jul 16, 2010 at 12:38 PM, Stephen Neuendorffer > <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote: > > > > > >> -----Original Message----- > >> From: glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org [mailto:glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org] On Behalf Of > > Grant Likely > >> Sent: Friday, July 16, 2010 11:34 AM > >> To: Stephen Neuendorffer > >> Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org > >> Subject: Re: [PATCH 4/8] of/base.c: export property > > access/modification functions > >> > >> On Fri, Jul 16, 2010 at 12:13 PM, Stephen Neuendorffer > >> <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote: > >> > These functions can be usefully used by device drivers. > >> > >> I'd like a little more description of the intended use case. What are > >> the circumstances where a driver needs to modify the data (this > >> information should be part of the patch description)? > > > > The PCIPR driver code needs to stuff the ranges property using these > > calls... > > I'd rather change the translation code to give you an intermediary > value (an offset from a bar), and then use non-OF code to translate > that into a physical address. I don't see how that will work, since there is no callback from the device-tree code behind platform_get_resource/of_address_to_resource back into the pcipr driver to do the last translation bit. I considered having a new 'bus_type' registered in the address translation code that would take care of it, but it seemed to still require the information from somewhere and it wasn't clear where to get it. Steve This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately. ^ permalink raw reply [flat|nested] 36+ messages in thread
[parent not found: <41b1b87c-a391-493d-8235-a9304562a6e4-RaUQJvECHis6W+Ha+8ZLibjjLBE8jN/0@public.gmane.org>]
* Re: [PATCH 4/8] of/base.c: export property access/modification functions [not found] ` <41b1b87c-a391-493d-8235-a9304562a6e4-RaUQJvECHis6W+Ha+8ZLibjjLBE8jN/0@public.gmane.org> @ 2010-07-16 21:43 ` Grant Likely [not found] ` <AANLkTinlTNa0TEnqk27Jv2Yy8sZ1Vx3V89YJvcs-jULM-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 36+ messages in thread From: Grant Likely @ 2010-07-16 21:43 UTC (permalink / raw) To: Stephen Neuendorffer; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ On Fri, Jul 16, 2010 at 2:07 PM, Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote: > > >> -----Original Message----- >> From: glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org [mailto:glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org] On Behalf Of Grant Likely >> Sent: Friday, July 16, 2010 11:57 AM >> To: Stephen Neuendorffer >> Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org >> Subject: Re: [PATCH 4/8] of/base.c: export property access/modification functions >> >> On Fri, Jul 16, 2010 at 12:38 PM, Stephen Neuendorffer >> <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote: >> > >> > >> >> -----Original Message----- >> >> From: glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org [mailto:glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org] On Behalf Of >> > Grant Likely >> >> Sent: Friday, July 16, 2010 11:34 AM >> >> To: Stephen Neuendorffer >> >> Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org >> >> Subject: Re: [PATCH 4/8] of/base.c: export property >> > access/modification functions >> >> >> >> On Fri, Jul 16, 2010 at 12:13 PM, Stephen Neuendorffer >> >> <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote: >> >> > These functions can be usefully used by device drivers. >> >> >> >> I'd like a little more description of the intended use case. What are >> >> the circumstances where a driver needs to modify the data (this >> >> information should be part of the patch description)? >> > >> > The PCIPR driver code needs to stuff the ranges property using these >> > calls... >> >> I'd rather change the translation code to give you an intermediary >> value (an offset from a bar), and then use non-OF code to translate >> that into a physical address. > > I don't see how that will work, since there is no callback from the device-tree > code behind platform_get_resource/of_address_to_resource back into the pcipr driver to > do the last translation bit. I considered having a new 'bus_type' registered in the > address translation code that would take care of it, but it seemed to still require > the information from somewhere and it wasn't clear where to get it. You get the information from the PCI device instance. We can change the bus_type infrastructure to allow instance specific data if need be. Alternately, the translation could be done at device registration time. With the changes being made to the of code, of_devices are going away, and being replaced with normal platform_devices which have a resource structure. We could do the translation at device registration time so that drivers only need to look at the resource structure. This will require some changes to the current of_platform_drivers, but in the long run I think it is the right thing to do. g. ^ permalink raw reply [flat|nested] 36+ messages in thread
[parent not found: <AANLkTinlTNa0TEnqk27Jv2Yy8sZ1Vx3V89YJvcs-jULM-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* RE: [PATCH 4/8] of/base.c: export property access/modification functions [not found] ` <AANLkTinlTNa0TEnqk27Jv2Yy8sZ1Vx3V89YJvcs-jULM-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2010-07-16 22:03 ` Stephen Neuendorffer 0 siblings, 0 replies; 36+ messages in thread From: Stephen Neuendorffer @ 2010-07-16 22:03 UTC (permalink / raw) To: Grant Likely; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ > -----Original Message----- > From: glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org [mailto:glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org] On Behalf Of Grant Likely > Sent: Friday, July 16, 2010 2:44 PM > To: Stephen Neuendorffer > Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org > Subject: Re: [PATCH 4/8] of/base.c: export property access/modification functions > > On Fri, Jul 16, 2010 at 2:07 PM, Stephen Neuendorffer > <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote: > > > > > >> -----Original Message----- > >> From: glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org [mailto:glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org] On Behalf Of Grant Likely > >> Sent: Friday, July 16, 2010 11:57 AM > >> To: Stephen Neuendorffer > >> Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org > >> Subject: Re: [PATCH 4/8] of/base.c: export property access/modification functions > >> > >> On Fri, Jul 16, 2010 at 12:38 PM, Stephen Neuendorffer > >> <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote: > >> > > >> > > >> >> -----Original Message----- > >> >> From: glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org [mailto:glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org] On Behalf Of > >> > Grant Likely > >> >> Sent: Friday, July 16, 2010 11:34 AM > >> >> To: Stephen Neuendorffer > >> >> Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org > >> >> Subject: Re: [PATCH 4/8] of/base.c: export property > >> > access/modification functions > >> >> > >> >> On Fri, Jul 16, 2010 at 12:13 PM, Stephen Neuendorffer > >> >> <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote: > >> >> > These functions can be usefully used by device drivers. > >> >> > >> >> I'd like a little more description of the intended use case. What are > >> >> the circumstances where a driver needs to modify the data (this > >> >> information should be part of the patch description)? > >> > > >> > The PCIPR driver code needs to stuff the ranges property using these > >> > calls... > >> > >> I'd rather change the translation code to give you an intermediary > >> value (an offset from a bar), and then use non-OF code to translate > >> that into a physical address. > > > > I don't see how that will work, since there is no callback from the device-tree > > code behind platform_get_resource/of_address_to_resource back into the pcipr driver to > > do the last translation bit. I considered having a new 'bus_type' registered in the > > address translation code that would take care of it, but it seemed to still require > > the information from somewhere and it wasn't clear where to get it. > > You get the information from the PCI device instance. We can change > the bus_type infrastructure to allow instance specific data if need > be. > > Alternately, the translation could be done at device registration > time. With the changes being made to the of code, of_devices are > going away, and being replaced with normal platform_devices which have > a resource structure. We could do the translation at device > registration time so that drivers only need to look at the resource > structure. This will require some changes to the current > of_platform_drivers, but in the long run I think it is the right thing > to do. OK, perhaps I'm being a little dense, but I don't see how to proceed here. Can you make this more concrete? Steve This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately. ^ permalink raw reply [flat|nested] 36+ messages in thread
[parent not found: <1279304021-22216-5-git-send-email-stephen.neuendorffer@xilinx.com>]
[parent not found: <1279304021-22216-5-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>]
* [PATCH 5/8] arch/x86: Add support for device tree code. [not found] ` <1279304021-22216-5-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> @ 2010-07-16 18:13 ` Stephen Neuendorffer [not found] ` <961e55b7-170c-45ac-a491-628797a0aa5e-+Ck8Kgl/v0/5op9OF0Koj7jjLBE8jN/0@public.gmane.org> 0 siblings, 1 reply; 36+ messages in thread From: Stephen Neuendorffer @ 2010-07-16 18:13 UTC (permalink / raw) To: grant.likely-s3s/WqlpOiPyB63q8FvJNQ, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ A few support device-tree related support functions that x86 didn't have before. Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> ---- I have no idea if continuing to add these functions to every arch is a good thing or whether they should (for instance) be weak symbols with a generic definition. --- arch/x86/include/asm/device.h | 6 ++++ arch/x86/include/asm/irq.h | 4 ++ arch/x86/kernel/Makefile | 1 + arch/x86/kernel/device_tree.c | 63 +++++++++++++++++++++++++++++++++++++++++ drivers/of/platform.c | 2 + include/linux/of_irq.h | 1 + 6 files changed, 77 insertions(+), 0 deletions(-) create mode 100644 arch/x86/kernel/device_tree.c diff --git a/arch/x86/include/asm/device.h b/arch/x86/include/asm/device.h index 029f230..01414f2 100644 --- a/arch/x86/include/asm/device.h +++ b/arch/x86/include/asm/device.h @@ -14,6 +14,12 @@ struct dma_map_ops *dma_ops; }; struct pdev_archdata { +#ifdef CONFIG_OF + u64 dma_mask; +#endif }; +/* Don't override the default bus id behaviour */ +#define of_device_make_bus_id __of_device_make_bus_id + #endif /* _ASM_X86_DEVICE_H */ diff --git a/arch/x86/include/asm/irq.h b/arch/x86/include/asm/irq.h index 5458380..6c61992 100644 --- a/arch/x86/include/asm/irq.h +++ b/arch/x86/include/asm/irq.h @@ -10,6 +10,10 @@ #include <asm/apicdef.h> #include <asm/irq_vectors.h> +#define NO_IRQ (-1) + +#define irq_dispose_mapping(...) + static inline int irq_canonicalize(int irq) { return ((irq == 2) ? 9 : irq); diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile index e77b220..a5c20e8 100644 --- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile @@ -105,6 +105,7 @@ scx200-y += scx200_32.o obj-$(CONFIG_OLPC) += olpc.o obj-$(CONFIG_X86_MRST) += mrst.o +obj-$(CONFIG_OF) += device_tree.o microcode-y := microcode_core.o microcode-$(CONFIG_MICROCODE_INTEL) += microcode_intel.o diff --git a/arch/x86/kernel/device_tree.c b/arch/x86/kernel/device_tree.c new file mode 100644 index 0000000..f6d27f6 --- /dev/null +++ b/arch/x86/kernel/device_tree.c @@ -0,0 +1,63 @@ +#undef DEBUG + +#include <linux/kernel.h> +#include <linux/string.h> +#include <linux/pci_regs.h> +#include <linux/module.h> +#include <linux/ioport.h> +#include <linux/etherdevice.h> +#include <linux/of.h> +#include <linux/of_device.h> +#include <linux/of_platform.h> +#include <linux/of_address.h> +#include <linux/of_irq.h> + +struct bus_type of_platform_bus_type = { + .uevent = of_device_uevent, +}; +EXPORT_SYMBOL(of_platform_bus_type); + +static int __init of_bus_driver_init(void) +{ + return of_bus_type_init(&of_platform_bus_type, "of_platform"); +} +postcore_initcall(of_bus_driver_init); + +/* + * The list of OF IDs below is used for matching bus types in the + * system whose devices are to be exposed as of_platform_devices. + * + * This is the default list valid for most platforms. This file provides + * functions who can take an explicit list if necessary though + * + * The search is always performed recursively looking for children of + * the provided device_node and recursively if such a children matches + * a bus type in the list + */ + +const struct of_device_id of_default_bus_ids[] = { + { .type = "soc", }, + { .compatible = "soc", }, + { .compatible = "simple-bus", }, + { .type = "plb5", }, + { .type = "plb4", }, + { .type = "opb", }, + { .type = "simple", }, + {}, +}; + +/* + * Interrupt remapper + */ + +struct device_node *of_irq_find_parent_by_phandle(phandle p) +{ + return of_find_node_by_phandle(p); +} + +unsigned int irq_create_of_mapping(struct device_node *controller, + const u32 *intspec, unsigned int intsize) +{ + return intspec[0]; +} +EXPORT_SYMBOL_GPL(irq_create_of_mapping); diff --git a/drivers/of/platform.c b/drivers/of/platform.c index 125f2bc..3ec3147 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -18,6 +18,8 @@ #include <linux/slab.h> #include <linux/of_device.h> #include <linux/of_platform.h> +#include <linux/of_address.h> +#include <linux/of_irq.h> extern struct device_attribute of_platform_device_attrs[]; diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h index 5929781..25fc90d 100644 --- a/include/linux/of_irq.h +++ b/include/linux/of_irq.h @@ -7,6 +7,7 @@ struct of_irq; #include <linux/errno.h> #include <linux/ioport.h> #include <linux/of.h> +#include <linux/irq.h> /* * irq_of_parse_and_map() is used ba all OF enabled platforms; but SPARC -- 1.5.6.6 This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately. ^ permalink raw reply related [flat|nested] 36+ messages in thread
[parent not found: <961e55b7-170c-45ac-a491-628797a0aa5e-+Ck8Kgl/v0/5op9OF0Koj7jjLBE8jN/0@public.gmane.org>]
* Re: [PATCH 5/8] arch/x86: Add support for device tree code. [not found] ` <961e55b7-170c-45ac-a491-628797a0aa5e-+Ck8Kgl/v0/5op9OF0Koj7jjLBE8jN/0@public.gmane.org> @ 2010-07-16 18:39 ` Grant Likely [not found] ` <AANLkTinPIY4N9Gv_J7Ief7Scd57c0KEY6WtHsvQTBrzb-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 36+ messages in thread From: Grant Likely @ 2010-07-16 18:39 UTC (permalink / raw) To: Stephen Neuendorffer; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ On Fri, Jul 16, 2010 at 12:13 PM, Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote: > A few support device-tree related support functions that x86 didn't > have before. > > Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> > > ---- > > I have no idea if continuing to add these functions to every arch is > a good thing or whether they should (for instance) be weak symbols > with a generic definition. > --- > arch/x86/include/asm/device.h | 6 ++++ > arch/x86/include/asm/irq.h | 4 ++ > arch/x86/kernel/Makefile | 1 + > arch/x86/kernel/device_tree.c | 63 +++++++++++++++++++++++++++++++++++++++++ > drivers/of/platform.c | 2 + > include/linux/of_irq.h | 1 + > 6 files changed, 77 insertions(+), 0 deletions(-) > create mode 100644 arch/x86/kernel/device_tree.c > > diff --git a/arch/x86/include/asm/device.h b/arch/x86/include/asm/device.h > index 029f230..01414f2 100644 > --- a/arch/x86/include/asm/device.h > +++ b/arch/x86/include/asm/device.h > @@ -14,6 +14,12 @@ struct dma_map_ops *dma_ops; > }; > > struct pdev_archdata { > +#ifdef CONFIG_OF > + u64 dma_mask; > +#endif This hunk (probably) isn't necessary anymore > }; > > +/* Don't override the default bus id behaviour */ > +#define of_device_make_bus_id __of_device_make_bus_id > + > #endif /* _ASM_X86_DEVICE_H */ > diff --git a/arch/x86/include/asm/irq.h b/arch/x86/include/asm/irq.h > index 5458380..6c61992 100644 > --- a/arch/x86/include/asm/irq.h > +++ b/arch/x86/include/asm/irq.h > @@ -10,6 +10,10 @@ > #include <asm/apicdef.h> > #include <asm/irq_vectors.h> > > +#define NO_IRQ (-1) > + no. irq 0 means no irq, and all patches adding #define NO_IRQ to x86 have been nacked. (Basically, all architectures using -1 to mean no irq are considered broken. ARM is one of the few (albeit large) holdouts. I've got a patch kicking around to change microblaze to use 0 for no_irq too. > +#define irq_dispose_mapping(...) > + > static inline int irq_canonicalize(int irq) > { > return ((irq == 2) ? 9 : irq); > diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile > index e77b220..a5c20e8 100644 > --- a/arch/x86/kernel/Makefile > +++ b/arch/x86/kernel/Makefile > @@ -105,6 +105,7 @@ scx200-y += scx200_32.o > > obj-$(CONFIG_OLPC) += olpc.o > obj-$(CONFIG_X86_MRST) += mrst.o > +obj-$(CONFIG_OF) += device_tree.o > > microcode-y := microcode_core.o > microcode-$(CONFIG_MICROCODE_INTEL) += microcode_intel.o > diff --git a/arch/x86/kernel/device_tree.c b/arch/x86/kernel/device_tree.c > new file mode 100644 > index 0000000..f6d27f6 > --- /dev/null > +++ b/arch/x86/kernel/device_tree.c > @@ -0,0 +1,63 @@ > +#undef DEBUG > + > +#include <linux/kernel.h> > +#include <linux/string.h> > +#include <linux/pci_regs.h> > +#include <linux/module.h> > +#include <linux/ioport.h> > +#include <linux/etherdevice.h> > +#include <linux/of.h> > +#include <linux/of_device.h> > +#include <linux/of_platform.h> > +#include <linux/of_address.h> > +#include <linux/of_irq.h> > + > +struct bus_type of_platform_bus_type = { > + .uevent = of_device_uevent, > +}; > +EXPORT_SYMBOL(of_platform_bus_type); > + > +static int __init of_bus_driver_init(void) > +{ > + return of_bus_type_init(&of_platform_bus_type, "of_platform"); > +} > +postcore_initcall(of_bus_driver_init); of_platform_bus_type is going away, and besides it is currently defined in common code. You shouldn't need this in arch code. > + > +/* > + * The list of OF IDs below is used for matching bus types in the > + * system whose devices are to be exposed as of_platform_devices. > + * > + * This is the default list valid for most platforms. This file provides > + * functions who can take an explicit list if necessary though > + * > + * The search is always performed recursively looking for children of > + * the provided device_node and recursively if such a children matches > + * a bus type in the list > + */ > + > +const struct of_device_id of_default_bus_ids[] = { > + { .type = "soc", }, > + { .compatible = "soc", }, > + { .compatible = "simple-bus", }, > + { .type = "plb5", }, > + { .type = "plb4", }, > + { .type = "opb", }, > + { .type = "simple", }, > + {}, > +}; > + > +/* > + * Interrupt remapper > + */ > + > +struct device_node *of_irq_find_parent_by_phandle(phandle p) > +{ > + return of_find_node_by_phandle(p); > +} IIRC, this hook shouldn't be necessary anymore either. > +unsigned int irq_create_of_mapping(struct device_node *controller, > + const u32 *intspec, unsigned int intsize) > +{ > + return intspec[0]; > +} > +EXPORT_SYMBOL_GPL(irq_create_of_mapping); return intspec[0] + 1; ... at least until I've got proper cross-platform devicetree to virtual irq mapping code implemented. > diff --git a/drivers/of/platform.c b/drivers/of/platform.c > index 125f2bc..3ec3147 100644 > --- a/drivers/of/platform.c > +++ b/drivers/of/platform.c > @@ -18,6 +18,8 @@ > #include <linux/slab.h> > #include <linux/of_device.h> > #include <linux/of_platform.h> > +#include <linux/of_address.h> > +#include <linux/of_irq.h> > > extern struct device_attribute of_platform_device_attrs[]; > > diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h > index 5929781..25fc90d 100644 > --- a/include/linux/of_irq.h > +++ b/include/linux/of_irq.h > @@ -7,6 +7,7 @@ struct of_irq; > #include <linux/errno.h> > #include <linux/ioport.h> > #include <linux/of.h> > +#include <linux/irq.h> > > /* > * irq_of_parse_and_map() is used ba all OF enabled platforms; but SPARC > -- > 1.5.6.6 > > > > This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately. > > > -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. ^ permalink raw reply [flat|nested] 36+ messages in thread
[parent not found: <AANLkTinPIY4N9Gv_J7Ief7Scd57c0KEY6WtHsvQTBrzb-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* RE: [PATCH 5/8] arch/x86: Add support for device tree code. [not found] ` <AANLkTinPIY4N9Gv_J7Ief7Scd57c0KEY6WtHsvQTBrzb-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2010-07-16 18:42 ` Stephen Neuendorffer [not found] ` <a33ca228-cb2c-4044-bf63-c653642415a0-RaUQJvECHitEus+KprP3J7jjLBE8jN/0@public.gmane.org> 0 siblings, 1 reply; 36+ messages in thread From: Stephen Neuendorffer @ 2010-07-16 18:42 UTC (permalink / raw) To: Grant Likely; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ > -----Original Message----- > From: glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org [mailto:glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org] On Behalf Of Grant Likely > Sent: Friday, July 16, 2010 11:40 AM > To: Stephen Neuendorffer > Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org > Subject: Re: [PATCH 5/8] arch/x86: Add support for device tree code. > > On Fri, Jul 16, 2010 at 12:13 PM, Stephen Neuendorffer > <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote: > > A few support device-tree related support functions that x86 didn't > > have before. > > > > Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> > > > > ---- > > > > I have no idea if continuing to add these functions to every arch is > > a good thing or whether they should (for instance) be weak symbols > > with a generic definition. > > --- > > arch/x86/include/asm/device.h | 6 ++++ > > arch/x86/include/asm/irq.h | 4 ++ > > arch/x86/kernel/Makefile | 1 + > > arch/x86/kernel/device_tree.c | 63 +++++++++++++++++++++++++++++++++++++++++ > > drivers/of/platform.c | 2 + > > include/linux/of_irq.h | 1 + > > 6 files changed, 77 insertions(+), 0 deletions(-) > > create mode 100644 arch/x86/kernel/device_tree.c > > > > diff --git a/arch/x86/include/asm/device.h b/arch/x86/include/asm/device.h > > index 029f230..01414f2 100644 > > --- a/arch/x86/include/asm/device.h > > +++ b/arch/x86/include/asm/device.h > > @@ -14,6 +14,12 @@ struct dma_map_ops *dma_ops; > > }; > > > > struct pdev_archdata { > > +#ifdef CONFIG_OF > > + u64 dma_mask; > > +#endif > > This hunk (probably) isn't necessary anymore Doesn't compile without it because the code in fdt.c initializes it. > > }; > > > > +/* Don't override the default bus id behaviour */ > > +#define of_device_make_bus_id __of_device_make_bus_id > > + > > #endif /* _ASM_X86_DEVICE_H */ > > diff --git a/arch/x86/include/asm/irq.h b/arch/x86/include/asm/irq.h > > index 5458380..6c61992 100644 > > --- a/arch/x86/include/asm/irq.h > > +++ b/arch/x86/include/asm/irq.h > > @@ -10,6 +10,10 @@ > > #include <asm/apicdef.h> > > #include <asm/irq_vectors.h> > > > > +#define NO_IRQ (-1) > > + > > no. irq 0 means no irq, and all patches adding #define NO_IRQ to x86 > have been nacked. (Basically, all architectures using -1 to mean no > irq are considered broken. ARM is one of the few (albeit large) > holdouts. I've got a patch kicking around to change microblaze to use > 0 for no_irq too. OK, bogon there.. The question is: how to get rid of it, since the generic of/irq.c code references it? > > > +#define irq_dispose_mapping(...) > > + > > static inline int irq_canonicalize(int irq) > > { > > return ((irq == 2) ? 9 : irq); > > diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile > > index e77b220..a5c20e8 100644 > > --- a/arch/x86/kernel/Makefile > > +++ b/arch/x86/kernel/Makefile > > @@ -105,6 +105,7 @@ scx200-y += scx200_32.o > > > > obj-$(CONFIG_OLPC) += olpc.o > > obj-$(CONFIG_X86_MRST) += mrst.o > > +obj-$(CONFIG_OF) += device_tree.o > > > > microcode-y := microcode_core.o > > microcode-$(CONFIG_MICROCODE_INTEL) += microcode_intel.o > > diff --git a/arch/x86/kernel/device_tree.c b/arch/x86/kernel/device_tree.c > > new file mode 100644 > > index 0000000..f6d27f6 > > --- /dev/null > > +++ b/arch/x86/kernel/device_tree.c > > @@ -0,0 +1,63 @@ > > +#undef DEBUG > > + > > +#include <linux/kernel.h> > > +#include <linux/string.h> > > +#include <linux/pci_regs.h> > > +#include <linux/module.h> > > +#include <linux/ioport.h> > > +#include <linux/etherdevice.h> > > +#include <linux/of.h> > > +#include <linux/of_device.h> > > +#include <linux/of_platform.h> > > +#include <linux/of_address.h> > > +#include <linux/of_irq.h> > > + > > +struct bus_type of_platform_bus_type = { > > + .uevent = of_device_uevent, > > +}; > > +EXPORT_SYMBOL(of_platform_bus_type); > > + > > +static int __init of_bus_driver_init(void) > > +{ > > + return of_bus_type_init(&of_platform_bus_type, "of_platform"); > > +} > > +postcore_initcall(of_bus_driver_init); > > of_platform_bus_type is going away, and besides it is currently > defined in common code. You shouldn't need this in arch code. > > > + > > +/* > > + * The list of OF IDs below is used for matching bus types in the > > + * system whose devices are to be exposed as of_platform_devices. > > + * > > + * This is the default list valid for most platforms. This file provides > > + * functions who can take an explicit list if necessary though > > + * > > + * The search is always performed recursively looking for children of > > + * the provided device_node and recursively if such a children matches > > + * a bus type in the list > > + */ > > + > > +const struct of_device_id of_default_bus_ids[] = { > > + { .type = "soc", }, > > + { .compatible = "soc", }, > > + { .compatible = "simple-bus", }, > > + { .type = "plb5", }, > > + { .type = "plb4", }, > > + { .type = "opb", }, > > + { .type = "simple", }, > > + {}, > > +}; > > + > > +/* > > + * Interrupt remapper > > + */ > > + > > +struct device_node *of_irq_find_parent_by_phandle(phandle p) > > +{ > > + return of_find_node_by_phandle(p); > > +} > > IIRC, this hook shouldn't be necessary anymore either. > > > +unsigned int irq_create_of_mapping(struct device_node *controller, > > + const u32 *intspec, unsigned int intsize) > > +{ > > + return intspec[0]; > > +} > > +EXPORT_SYMBOL_GPL(irq_create_of_mapping); > > return intspec[0] + 1; ... at least until I've got proper > cross-platform devicetree to virtual irq mapping code implemented. > > > diff --git a/drivers/of/platform.c b/drivers/of/platform.c > > index 125f2bc..3ec3147 100644 > > --- a/drivers/of/platform.c > > +++ b/drivers/of/platform.c > > @@ -18,6 +18,8 @@ > > #include <linux/slab.h> > > #include <linux/of_device.h> > > #include <linux/of_platform.h> > > +#include <linux/of_address.h> > > +#include <linux/of_irq.h> > > > > extern struct device_attribute of_platform_device_attrs[]; > > > > diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h > > index 5929781..25fc90d 100644 > > --- a/include/linux/of_irq.h > > +++ b/include/linux/of_irq.h > > @@ -7,6 +7,7 @@ struct of_irq; > > #include <linux/errno.h> > > #include <linux/ioport.h> > > #include <linux/of.h> > > +#include <linux/irq.h> > > > > /* > > * irq_of_parse_and_map() is used ba all OF enabled platforms; but SPARC > > -- > > 1.5.6.6 > > > > > > > > This email and any attachments are intended for the sole use of the named recipient(s) and > contain(s) confidential information that may be proprietary, privileged or copyrighted under > applicable law. If you are not the intended recipient, do not read, copy, or forward this email > message or any attachments. Delete this email message and any attachments immediately. > > > > > > > > > > -- > Grant Likely, B.Sc., P.Eng. > Secret Lab Technologies Ltd. This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately. ^ permalink raw reply [flat|nested] 36+ messages in thread
[parent not found: <a33ca228-cb2c-4044-bf63-c653642415a0-RaUQJvECHitEus+KprP3J7jjLBE8jN/0@public.gmane.org>]
* Re: [PATCH 5/8] arch/x86: Add support for device tree code. [not found] ` <a33ca228-cb2c-4044-bf63-c653642415a0-RaUQJvECHitEus+KprP3J7jjLBE8jN/0@public.gmane.org> @ 2010-07-16 18:59 ` Grant Likely [not found] ` <AANLkTinVIf2A_OVAXlqjHY5J3jvaraPlJySnyEKbhlqA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 36+ messages in thread From: Grant Likely @ 2010-07-16 18:59 UTC (permalink / raw) To: Stephen Neuendorffer; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ On Fri, Jul 16, 2010 at 12:42 PM, Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote: > > >> -----Original Message----- >> From: glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org [mailto:glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org] On Behalf Of Grant Likely >> Sent: Friday, July 16, 2010 11:40 AM >> To: Stephen Neuendorffer >> Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org >> Subject: Re: [PATCH 5/8] arch/x86: Add support for device tree code. >> >> On Fri, Jul 16, 2010 at 12:13 PM, Stephen Neuendorffer >> <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote: >> > A few support device-tree related support functions that x86 didn't >> > have before. >> > >> > Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> >> > >> > ---- >> > >> > I have no idea if continuing to add these functions to every arch is >> > a good thing or whether they should (for instance) be weak symbols >> > with a generic definition. >> > --- >> > arch/x86/include/asm/device.h | 6 ++++ >> > arch/x86/include/asm/irq.h | 4 ++ >> > arch/x86/kernel/Makefile | 1 + >> > arch/x86/kernel/device_tree.c | 63 +++++++++++++++++++++++++++++++++++++++++ >> > drivers/of/platform.c | 2 + >> > include/linux/of_irq.h | 1 + >> > 6 files changed, 77 insertions(+), 0 deletions(-) >> > create mode 100644 arch/x86/kernel/device_tree.c >> > >> > diff --git a/arch/x86/include/asm/device.h b/arch/x86/include/asm/device.h >> > index 029f230..01414f2 100644 >> > --- a/arch/x86/include/asm/device.h >> > +++ b/arch/x86/include/asm/device.h >> > @@ -14,6 +14,12 @@ struct dma_map_ops *dma_ops; >> > }; >> > >> > struct pdev_archdata { >> > +#ifdef CONFIG_OF >> > + u64 dma_mask; >> > +#endif >> >> This hunk (probably) isn't necessary anymore > > Doesn't compile without it because the code in fdt.c initializes it. Fixed in current next-devicetree. >> > diff --git a/arch/x86/include/asm/irq.h b/arch/x86/include/asm/irq.h >> > index 5458380..6c61992 100644 >> > --- a/arch/x86/include/asm/irq.h >> > +++ b/arch/x86/include/asm/irq.h >> > @@ -10,6 +10,10 @@ >> > #include <asm/apicdef.h> >> > #include <asm/irq_vectors.h> >> > >> > +#define NO_IRQ (-1) >> > + >> >> no. irq 0 means no irq, and all patches adding #define NO_IRQ to x86 >> have been nacked. (Basically, all architectures using -1 to mean no >> irq are considered broken. ARM is one of the few (albeit large) >> holdouts. I've got a patch kicking around to change microblaze to use >> 0 for no_irq too. > > OK, bogon there.. The question is: how to get rid of it, since the generic of/irq.c > code references it? Fix microblaze, then NO_IRQ references can be removed from of/irq.c g. ^ permalink raw reply [flat|nested] 36+ messages in thread
[parent not found: <AANLkTinVIf2A_OVAXlqjHY5J3jvaraPlJySnyEKbhlqA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* RE: [PATCH 5/8] arch/x86: Add support for device tree code. [not found] ` <AANLkTinVIf2A_OVAXlqjHY5J3jvaraPlJySnyEKbhlqA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2010-07-16 20:11 ` Stephen Neuendorffer [not found] ` <a52173ec-5c74-47ce-9121-f2e90958b05d-RaUQJvECHiuJ1bAq5m18RLjjLBE8jN/0@public.gmane.org> 0 siblings, 1 reply; 36+ messages in thread From: Stephen Neuendorffer @ 2010-07-16 20:11 UTC (permalink / raw) To: Grant Likely, Michal Simek; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ > >> > diff --git a/arch/x86/include/asm/irq.h b/arch/x86/include/asm/irq.h > >> > index 5458380..6c61992 100644 > >> > --- a/arch/x86/include/asm/irq.h > >> > +++ b/arch/x86/include/asm/irq.h > >> > @@ -10,6 +10,10 @@ > >> > #include <asm/apicdef.h> > >> > #include <asm/irq_vectors.h> > >> > > >> > +#define NO_IRQ (-1) > >> > + > >> > >> no. irq 0 means no irq, and all patches adding #define NO_IRQ to x86 > >> have been nacked. (Basically, all architectures using -1 to mean no > >> irq are considered broken. ARM is one of the few (albeit large) > >> holdouts. I've got a patch kicking around to change microblaze to use > >> 0 for no_irq too. > > > > OK, bogon there.. The question is: how to get rid of it, since the generic of/irq.c > > code references it? > > Fix microblaze, then NO_IRQ references can be removed from of/irq.c > > g. OK... Michal: I see you were against this patch... What is your current thinking? Steve This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately. ^ permalink raw reply [flat|nested] 36+ messages in thread
[parent not found: <a52173ec-5c74-47ce-9121-f2e90958b05d-RaUQJvECHiuJ1bAq5m18RLjjLBE8jN/0@public.gmane.org>]
* Re: [PATCH 5/8] arch/x86: Add support for device tree code. [not found] ` <a52173ec-5c74-47ce-9121-f2e90958b05d-RaUQJvECHiuJ1bAq5m18RLjjLBE8jN/0@public.gmane.org> @ 2010-07-16 20:28 ` Grant Likely 0 siblings, 0 replies; 36+ messages in thread From: Grant Likely @ 2010-07-16 20:28 UTC (permalink / raw) To: Stephen Neuendorffer; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ On Fri, Jul 16, 2010 at 2:11 PM, Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote: > >> >> > diff --git a/arch/x86/include/asm/irq.h b/arch/x86/include/asm/irq.h >> >> > index 5458380..6c61992 100644 >> >> > --- a/arch/x86/include/asm/irq.h >> >> > +++ b/arch/x86/include/asm/irq.h >> >> > @@ -10,6 +10,10 @@ >> >> > #include <asm/apicdef.h> >> >> > #include <asm/irq_vectors.h> >> >> > >> >> > +#define NO_IRQ (-1) >> >> > + >> >> >> >> no. irq 0 means no irq, and all patches adding #define NO_IRQ to x86 >> >> have been nacked. (Basically, all architectures using -1 to mean no >> >> irq are considered broken. ARM is one of the few (albeit large) >> >> holdouts. I've got a patch kicking around to change microblaze to use >> >> 0 for no_irq too. >> > >> > OK, bogon there.. The question is: how to get rid of it, since the generic of/irq.c >> > code references it? >> >> Fix microblaze, then NO_IRQ references can be removed from of/irq.c >> >> g. > > OK... Michal: I see you were against this patch... > What is your current thinking? John Williams reluctantly agreed that going to NO_IRQ == 0 was the right thing to do. Last we left it I was going to respin my patch, but I haven't had a chance to do so yet. g. ^ permalink raw reply [flat|nested] 36+ messages in thread
[parent not found: <1279304021-22216-6-git-send-email-stephen.neuendorffer@xilinx.com>]
[parent not found: <1279304021-22216-6-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>]
* [PATCH 6/8] [Xilinx] xilinx_pcipr: Added Xilinx reconfigurable PCI endpoint driver. [not found] ` <1279304021-22216-6-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> @ 2010-07-16 18:13 ` Stephen Neuendorffer [not found] ` <19f2f30b-1b43-4729-a079-da1df0b04609-RaUQJvECHitZbvUCbuG1mrjjLBE8jN/0@public.gmane.org> 0 siblings, 1 reply; 36+ messages in thread From: Stephen Neuendorffer @ 2010-07-16 18:13 UTC (permalink / raw) To: grant.likely-s3s/WqlpOiPyB63q8FvJNQ, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ This device has an internal bus which contains multiple devices, which are described in a device tree. Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> ---- This is probably still preliminary, although it actually works now. 1) It should probably correctly deallocate and free all the contained devices. 2) It should probably handle different device trees for multiple boards in the same system. How to do this? --- drivers/pci/Kconfig | 9 ++ drivers/pci/Makefile | 2 + drivers/pci/xilinx_pcipr.c | 197 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 208 insertions(+), 0 deletions(-) create mode 100644 drivers/pci/xilinx_pcipr.c diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig index 34ef70d..ec9b25d 100644 --- a/drivers/pci/Kconfig +++ b/drivers/pci/Kconfig @@ -65,3 +65,12 @@ config PCI_IOAPIC depends on ACPI depends on HOTPLUG default y + +config XILINX_PCIPR + tristate "Xilinx OF-based PCI endpoint" + depends on PCI + select OF + select OF_FLATTREE + select OF_DEVICE + help + Enable support for Xilinx PCIPR endpoint \ No newline at end of file diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile index 0b51857..ec44c21 100644 --- a/drivers/pci/Makefile +++ b/drivers/pci/Makefile @@ -62,6 +62,8 @@ obj-$(CONFIG_PCI_SYSCALL) += syscall.o obj-$(CONFIG_PCI_STUB) += pci-stub.o +obj-$(CONFIG_XILINX_PCIPR) += xilinx_pcipr.o + ifeq ($(CONFIG_PCI_DEBUG),y) EXTRA_CFLAGS += -DDEBUG endif diff --git a/drivers/pci/xilinx_pcipr.c b/drivers/pci/xilinx_pcipr.c new file mode 100644 index 0000000..80f8f1a --- /dev/null +++ b/drivers/pci/xilinx_pcipr.c @@ -0,0 +1,197 @@ +/* + * Copyright 2010 Xilinx, Inc. + * + */ + +#include <linux/module.h> +#include <linux/types.h> +#include <linux/kernel.h> +#include <linux/pci.h> +#include <linux/ide.h> +#include <linux/init.h> +#include <linux/dmi.h> +#include <linux/firmware.h> + +#include <linux/of.h> +#include <linux/of_fdt.h> +#include <linux/of_platform.h> + +#include <linux/io.h> + +#define DRV_NAME "xilinx_pcipr" + +struct xilinx_pcipr_drvdata { + struct device_node *child_nodes; + struct firmware *fw_entry; +}; + +/** + * xilinx_pcipr_probe - Setup the endpoint + * @dev: PCI device to set up + */ +static int __devinit xilinx_pcipr_probe(struct pci_dev *pdev, + const struct pci_device_id *id) +{ + int ret; + struct xilinx_pcipr_drvdata *drvdata; + resource_size_t start, len; + struct property *ranges_prop; + unsigned long *value; + struct device_node *bus_node; + + dev_dbg(&pdev->dev, "xilinx_pcipr_probe\n"); + + drvdata = kzalloc(sizeof(struct xilinx_pcipr_drvdata), GFP_KERNEL); + if (!drvdata) { + dev_err(&pdev->dev, + "Couldn't allocate device private record\n"); + ret = -ENOMEM; + goto out; + } + + dev_set_drvdata(&pdev->dev, (void *)drvdata); + + /* + * Do some basic sanity checking.. + */ + if (pci_enable_device(pdev)) { + ret = -EBUSY; + goto free; + } + + /* Enable the board to bus master. */ + pci_set_master(pdev); + + if (request_firmware(&drvdata->fw_entry, + "xilinx_pcipr.dtb", &pdev->dev)) { + dev_err(&pdev->dev, "Couldn't get dtb\n"); + ret = -ENODEV; + goto disable; + } + + + ret = pci_request_regions(pdev, "xilinx_pcipr"); + if (ret) + goto release_dtb; + + if (!pci_resource_start(pdev, 0)) { + dev_printk(KERN_ERR, &pdev->dev, "No cardbus resource!\n"); + ret = -ENODEV; + goto release; + } + + + /* + * report the subsystem vendor and device for help debugging + * the irq stuff... + */ + dev_printk(KERN_INFO, &pdev->dev, + "Xilinx PCIPR bridge found [%04x:%04x]\n", + pdev->subsystem_vendor, pdev->subsystem_device); + + /* Stuff the ranges property into the toplevel bus of the device + tree, according to how the BARs are programmed */ + start = pci_resource_start(pdev, 0); + len = pci_resource_len(pdev, 0); + + dev_printk(KERN_INFO, &pdev->dev, + "Xilinx PCIPR bridge range %llx %llx", + (unsigned long long) start, (unsigned long long) len); + + ranges_prop = kzalloc(sizeof(struct property), GFP_KERNEL); + ranges_prop->value = kzalloc(sizeof(unsigned long) * 3, GFP_KERNEL); + ranges_prop->name = "ranges"; + ranges_prop->length = sizeof(unsigned long) * 3; + value = (unsigned long *)ranges_prop->value; + /* FIXME: gotta get this from the bridge */ + value[0] = cpu_to_be32(0x80000000); + value[1] = cpu_to_be32(start); + value[2] = cpu_to_be32(len); + + unflatten_partial_device_tree((unsigned long *)drvdata->fw_entry->data, + &drvdata->child_nodes); + of_node_get(drvdata->child_nodes); + bus_node = of_find_node_by_name(drvdata->child_nodes, "plb"); + prom_add_property(bus_node, ranges_prop); + + /* Generate child devices from the device tree */ + of_platform_bus_probe(drvdata->child_nodes, NULL, &pdev->dev); + + pci_release_regions(pdev); + + goto out; /* Success */ + + release: + pci_release_regions(pdev); + + release_dtb: + release_firmware(drvdata->fw_entry); + + disable: + pci_disable_device(pdev); + free: + kfree(drvdata); + dev_set_drvdata(&pdev->dev, NULL); + out: + return ret; +} + +static int __devexit xilinx_pcipr_remove(struct pci_dev *pdev) +{ + struct device *dev = &pdev->dev; + struct xilinx_pcipr_drvdata *drvdata = dev_get_drvdata(dev); + + /* FIXME: Release the contained devices. There should probably +be a device-tree method to free a whole tree of devices, essentially +the inverse of of_platform_bus_probe + */ + + release_firmware(drvdata->fw_entry); + pci_disable_device(pdev); + kfree(drvdata); + dev_set_drvdata(dev, NULL); + return 0; +} + + +static const struct pci_device_id xilinx_pcipr_ids[] = { + { PCI_VDEVICE(XILINX, 0x0505), 0 }, + { 0, }, +}; +MODULE_DEVICE_TABLE(pci, xilinx_pcipr_ids); + +pci_ers_result_t *xilinx_pcipr_error_detected(struct pci_dev *pdev, + enum pci_channel_state error) { + dev_printk(KERN_INFO, &pdev->dev, "Error detected!\n"); + return PCI_ERS_RESULT_NEED_RESET; +} + +static struct pci_error_handlers xilinx_pcipr_error_handlers = { + /* PCI bus error detected on this device */ + .error_detected = xilinx_pcipr_error_detected, +}; + +static struct pci_driver xilinx_pcipr_driver = { + .name = "XILINX_PCIPR", + .id_table = xilinx_pcipr_ids, + .probe = xilinx_pcipr_probe, + .remove = __devexit_p(xilinx_pcipr_remove), + .err_handler = &xilinx_pcipr_error_handlers, +}; + +static int __init xilinx_pcipr_init(void) +{ + return ide_pci_register_driver(&xilinx_pcipr_driver); +} + +static void __exit xilinx_pcipr_exit(void) +{ + pci_unregister_driver(&xilinx_pcipr_driver); +} + +module_init(xilinx_pcipr_init); +module_exit(xilinx_pcipr_exit); + +MODULE_AUTHOR("Xilinx Research Labs"); +MODULE_DESCRIPTION("PCI driver for PCI reconfigurable endpoint"); +MODULE_LICENSE("GPL"); -- 1.5.6.6 This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately. ^ permalink raw reply related [flat|nested] 36+ messages in thread
[parent not found: <19f2f30b-1b43-4729-a079-da1df0b04609-RaUQJvECHitZbvUCbuG1mrjjLBE8jN/0@public.gmane.org>]
* Re: [PATCH 6/8] [Xilinx] xilinx_pcipr: Added Xilinx reconfigurable PCI endpoint driver. [not found] ` <19f2f30b-1b43-4729-a079-da1df0b04609-RaUQJvECHitZbvUCbuG1mrjjLBE8jN/0@public.gmane.org> @ 2010-07-16 18:43 ` Grant Likely 0 siblings, 0 replies; 36+ messages in thread From: Grant Likely @ 2010-07-16 18:43 UTC (permalink / raw) To: Stephen Neuendorffer; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ On Fri, Jul 16, 2010 at 12:13 PM, Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote: > This device has an internal bus which contains multiple devices, which > are described in a device tree. > > Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> Looks sane to me. A few comments below. > > ---- > > This is probably still preliminary, although it actually works now. > 1) It should probably correctly deallocate and free all the contained > devices. > 2) It should probably handle different device trees for multiple boards > in the same system. How to do this? > --- > drivers/pci/Kconfig | 9 ++ > drivers/pci/Makefile | 2 + > drivers/pci/xilinx_pcipr.c | 197 ++++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 208 insertions(+), 0 deletions(-) > create mode 100644 drivers/pci/xilinx_pcipr.c > > diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig > index 34ef70d..ec9b25d 100644 > --- a/drivers/pci/Kconfig > +++ b/drivers/pci/Kconfig > @@ -65,3 +65,12 @@ config PCI_IOAPIC > depends on ACPI > depends on HOTPLUG > default y > + > +config XILINX_PCIPR > + tristate "Xilinx OF-based PCI endpoint" > + depends on PCI > + select OF > + select OF_FLATTREE > + select OF_DEVICE OF_DEVICE is automatically enabled now. You don't need to select it. It also looks like your patch has whitespace inconsistencies. > + help > + Enable support for Xilinx PCIPR endpoint > \ No newline at end of file > diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile > index 0b51857..ec44c21 100644 > --- a/drivers/pci/Makefile > +++ b/drivers/pci/Makefile > @@ -62,6 +62,8 @@ obj-$(CONFIG_PCI_SYSCALL) += syscall.o > > obj-$(CONFIG_PCI_STUB) += pci-stub.o > > +obj-$(CONFIG_XILINX_PCIPR) += xilinx_pcipr.o > + > ifeq ($(CONFIG_PCI_DEBUG),y) > EXTRA_CFLAGS += -DDEBUG > endif > diff --git a/drivers/pci/xilinx_pcipr.c b/drivers/pci/xilinx_pcipr.c > new file mode 100644 > index 0000000..80f8f1a > --- /dev/null > +++ b/drivers/pci/xilinx_pcipr.c > @@ -0,0 +1,197 @@ > +/* > + * Copyright 2010 Xilinx, Inc. > + * > + */ > + > +#include <linux/module.h> > +#include <linux/types.h> > +#include <linux/kernel.h> > +#include <linux/pci.h> > +#include <linux/ide.h> > +#include <linux/init.h> > +#include <linux/dmi.h> > +#include <linux/firmware.h> > + > +#include <linux/of.h> > +#include <linux/of_fdt.h> > +#include <linux/of_platform.h> > + > +#include <linux/io.h> > + > +#define DRV_NAME "xilinx_pcipr" > + > +struct xilinx_pcipr_drvdata { > + struct device_node *child_nodes; > + struct firmware *fw_entry; > +}; > + > +/** > + * xilinx_pcipr_probe - Setup the endpoint > + * @dev: PCI device to set up > + */ > +static int __devinit xilinx_pcipr_probe(struct pci_dev *pdev, > + const struct pci_device_id *id) > +{ > + int ret; > + struct xilinx_pcipr_drvdata *drvdata; > + resource_size_t start, len; > + struct property *ranges_prop; > + unsigned long *value; > + struct device_node *bus_node; > + > + dev_dbg(&pdev->dev, "xilinx_pcipr_probe\n"); > + > + drvdata = kzalloc(sizeof(struct xilinx_pcipr_drvdata), GFP_KERNEL); > + if (!drvdata) { > + dev_err(&pdev->dev, > + "Couldn't allocate device private record\n"); > + ret = -ENOMEM; > + goto out; > + } > + > + dev_set_drvdata(&pdev->dev, (void *)drvdata); > + > + /* > + * Do some basic sanity checking.. > + */ > + if (pci_enable_device(pdev)) { > + ret = -EBUSY; > + goto free; > + } > + > + /* Enable the board to bus master. */ > + pci_set_master(pdev); > + > + if (request_firmware(&drvdata->fw_entry, > + "xilinx_pcipr.dtb", &pdev->dev)) { > + dev_err(&pdev->dev, "Couldn't get dtb\n"); > + ret = -ENODEV; > + goto disable; > + } > + > + > + ret = pci_request_regions(pdev, "xilinx_pcipr"); > + if (ret) > + goto release_dtb; > + > + if (!pci_resource_start(pdev, 0)) { > + dev_printk(KERN_ERR, &pdev->dev, "No cardbus resource!\n"); > + ret = -ENODEV; > + goto release; > + } > + > + > + /* > + * report the subsystem vendor and device for help debugging > + * the irq stuff... > + */ > + dev_printk(KERN_INFO, &pdev->dev, > + "Xilinx PCIPR bridge found [%04x:%04x]\n", > + pdev->subsystem_vendor, pdev->subsystem_device); > + > + /* Stuff the ranges property into the toplevel bus of the device > + tree, according to how the BARs are programmed */ > + start = pci_resource_start(pdev, 0); > + len = pci_resource_len(pdev, 0); > + > + dev_printk(KERN_INFO, &pdev->dev, > + "Xilinx PCIPR bridge range %llx %llx", > + (unsigned long long) start, (unsigned long long) len); > + > + ranges_prop = kzalloc(sizeof(struct property), GFP_KERNEL); > + ranges_prop->value = kzalloc(sizeof(unsigned long) * 3, GFP_KERNEL); > + ranges_prop->name = "ranges"; > + ranges_prop->length = sizeof(unsigned long) * 3; > + value = (unsigned long *)ranges_prop->value; > + /* FIXME: gotta get this from the bridge */ > + value[0] = cpu_to_be32(0x80000000); > + value[1] = cpu_to_be32(start); > + value[2] = cpu_to_be32(len); > + > + unflatten_partial_device_tree((unsigned long *)drvdata->fw_entry->data, > + &drvdata->child_nodes); > + of_node_get(drvdata->child_nodes); > + bus_node = of_find_node_by_name(drvdata->child_nodes, "plb"); > + prom_add_property(bus_node, ranges_prop); > + > + /* Generate child devices from the device tree */ > + of_platform_bus_probe(drvdata->child_nodes, NULL, &pdev->dev); > + > + pci_release_regions(pdev); > + > + goto out; /* Success */ > + > + release: > + pci_release_regions(pdev); > + > + release_dtb: > + release_firmware(drvdata->fw_entry); > + > + disable: > + pci_disable_device(pdev); > + free: > + kfree(drvdata); > + dev_set_drvdata(&pdev->dev, NULL); > + out: > + return ret; > +} > + > +static int __devexit xilinx_pcipr_remove(struct pci_dev *pdev) > +{ > + struct device *dev = &pdev->dev; > + struct xilinx_pcipr_drvdata *drvdata = dev_get_drvdata(dev); > + > + /* FIXME: Release the contained devices. There should probably > +be a device-tree method to free a whole tree of devices, essentially > +the inverse of of_platform_bus_probe > + */ > + > + release_firmware(drvdata->fw_entry); > + pci_disable_device(pdev); > + kfree(drvdata); > + dev_set_drvdata(dev, NULL); > + return 0; > +} > + > + > +static const struct pci_device_id xilinx_pcipr_ids[] = { > + { PCI_VDEVICE(XILINX, 0x0505), 0 }, > + { 0, }, > +}; > +MODULE_DEVICE_TABLE(pci, xilinx_pcipr_ids); > + > +pci_ers_result_t *xilinx_pcipr_error_detected(struct pci_dev *pdev, > + enum pci_channel_state error) { > + dev_printk(KERN_INFO, &pdev->dev, "Error detected!\n"); > + return PCI_ERS_RESULT_NEED_RESET; > +} > + > +static struct pci_error_handlers xilinx_pcipr_error_handlers = { > + /* PCI bus error detected on this device */ > + .error_detected = xilinx_pcipr_error_detected, > +}; > + > +static struct pci_driver xilinx_pcipr_driver = { > + .name = "XILINX_PCIPR", > + .id_table = xilinx_pcipr_ids, > + .probe = xilinx_pcipr_probe, > + .remove = __devexit_p(xilinx_pcipr_remove), > + .err_handler = &xilinx_pcipr_error_handlers, > +}; > + > +static int __init xilinx_pcipr_init(void) > +{ > + return ide_pci_register_driver(&xilinx_pcipr_driver); > +} > + > +static void __exit xilinx_pcipr_exit(void) > +{ > + pci_unregister_driver(&xilinx_pcipr_driver); > +} > + > +module_init(xilinx_pcipr_init); > +module_exit(xilinx_pcipr_exit); > + > +MODULE_AUTHOR("Xilinx Research Labs"); > +MODULE_DESCRIPTION("PCI driver for PCI reconfigurable endpoint"); > +MODULE_LICENSE("GPL"); > -- > 1.5.6.6 > > > > This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately. > > > -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. ^ permalink raw reply [flat|nested] 36+ messages in thread
[parent not found: <1279304021-22216-7-git-send-email-stephen.neuendorffer@xilinx.com>]
[parent not found: <1279304021-22216-7-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>]
* [PATCH 7/8] [Xilinx] xilinx_hwicap: Update driver to use generic io accessors [not found] ` <1279304021-22216-7-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> @ 2010-07-16 18:13 ` Stephen Neuendorffer 0 siblings, 0 replies; 36+ messages in thread From: Stephen Neuendorffer @ 2010-07-16 18:13 UTC (permalink / raw) To: grant.likely-s3s/WqlpOiPyB63q8FvJNQ, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ out_be32 and in_be32 are mainly powerpc-isms. Switch to using ioread32be and iowrite32be instead. This allows the code to be used on x86 or ARM, for instance. signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> --- drivers/char/xilinx_hwicap/buffer_icap.c | 16 +++++----- drivers/char/xilinx_hwicap/fifo_icap.c | 39 +++++++++++++-------------- drivers/char/xilinx_hwicap/xilinx_hwicap.c | 1 + drivers/char/xilinx_hwicap/xilinx_hwicap.h | 1 + 4 files changed, 29 insertions(+), 28 deletions(-) diff --git a/drivers/char/xilinx_hwicap/buffer_icap.c b/drivers/char/xilinx_hwicap/buffer_icap.c index 05d8977..bc361fc 100644 --- a/drivers/char/xilinx_hwicap/buffer_icap.c +++ b/drivers/char/xilinx_hwicap/buffer_icap.c @@ -87,7 +87,7 @@ **/ u32 buffer_icap_get_status(struct hwicap_drvdata *drvdata) { - return in_be32(drvdata->base_address + XHI_STATUS_REG_OFFSET); + return ioread32be(drvdata->base_address + XHI_STATUS_REG_OFFSET); } /** @@ -101,7 +101,7 @@ u32 buffer_icap_get_status(struct hwicap_drvdata *drvdata) static inline u32 buffer_icap_get_bram(void __iomem *base_address, u32 offset) { - return in_be32(base_address + (offset << 2)); + return ioread32be(base_address + (offset << 2)); } /** @@ -114,7 +114,7 @@ static inline u32 buffer_icap_get_bram(void __iomem *base_address, **/ static inline bool buffer_icap_busy(void __iomem *base_address) { - u32 status = in_be32(base_address + XHI_STATUS_REG_OFFSET); + u32 status = ioread32be(base_address + XHI_STATUS_REG_OFFSET); return (status & 1) == XHI_NOT_FINISHED; } @@ -129,7 +129,7 @@ static inline bool buffer_icap_busy(void __iomem *base_address) static inline void buffer_icap_set_size(void __iomem *base_address, u32 data) { - out_be32(base_address + XHI_SIZE_REG_OFFSET, data); + iowrite32be(data, base_address + XHI_SIZE_REG_OFFSET); } /** @@ -143,7 +143,7 @@ static inline void buffer_icap_set_size(void __iomem *base_address, static inline void buffer_icap_set_offset(void __iomem *base_address, u32 data) { - out_be32(base_address + XHI_BRAM_OFFSET_REG_OFFSET, data); + iowrite32be(data, base_address + XHI_BRAM_OFFSET_REG_OFFSET); } /** @@ -159,7 +159,7 @@ static inline void buffer_icap_set_offset(void __iomem *base_address, static inline void buffer_icap_set_rnc(void __iomem *base_address, u32 data) { - out_be32(base_address + XHI_RNC_REG_OFFSET, data); + iowrite32be(data, base_address + XHI_RNC_REG_OFFSET); } /** @@ -174,7 +174,7 @@ static inline void buffer_icap_set_rnc(void __iomem *base_address, static inline void buffer_icap_set_bram(void __iomem *base_address, u32 offset, u32 data) { - out_be32(base_address + (offset << 2), data); + iowrite32be(data, base_address + (offset << 2)); } /** @@ -255,7 +255,7 @@ static int buffer_icap_device_write(struct hwicap_drvdata *drvdata, **/ void buffer_icap_reset(struct hwicap_drvdata *drvdata) { - out_be32(drvdata->base_address + XHI_STATUS_REG_OFFSET, 0xFEFE); + iowrite32be(0xFEFE, drvdata->base_address + XHI_STATUS_REG_OFFSET); } /** diff --git a/drivers/char/xilinx_hwicap/fifo_icap.c b/drivers/char/xilinx_hwicap/fifo_icap.c index 02225eb..062df1d 100644 --- a/drivers/char/xilinx_hwicap/fifo_icap.c +++ b/drivers/char/xilinx_hwicap/fifo_icap.c @@ -94,7 +94,7 @@ static inline void fifo_icap_fifo_write(struct hwicap_drvdata *drvdata, u32 data) { dev_dbg(drvdata->dev, "fifo_write: %x\n", data); - out_be32(drvdata->base_address + XHI_WF_OFFSET, data); + iowrite32be(data, drvdata->base_address + XHI_WF_OFFSET); } /** @@ -105,7 +105,7 @@ static inline void fifo_icap_fifo_write(struct hwicap_drvdata *drvdata, **/ static inline u32 fifo_icap_fifo_read(struct hwicap_drvdata *drvdata) { - u32 data = in_be32(drvdata->base_address + XHI_RF_OFFSET); + u32 data = ioread32be(drvdata->base_address + XHI_RF_OFFSET); dev_dbg(drvdata->dev, "fifo_read: %x\n", data); return data; } @@ -118,7 +118,7 @@ static inline u32 fifo_icap_fifo_read(struct hwicap_drvdata *drvdata) static inline void fifo_icap_set_read_size(struct hwicap_drvdata *drvdata, u32 data) { - out_be32(drvdata->base_address + XHI_SZ_OFFSET, data); + iowrite32be(data, drvdata->base_address + XHI_SZ_OFFSET); } /** @@ -127,7 +127,7 @@ static inline void fifo_icap_set_read_size(struct hwicap_drvdata *drvdata, **/ static inline void fifo_icap_start_config(struct hwicap_drvdata *drvdata) { - out_be32(drvdata->base_address + XHI_CR_OFFSET, XHI_CR_WRITE_MASK); + iowrite32be(XHI_CR_WRITE_MASK, drvdata->base_address + XHI_CR_OFFSET); dev_dbg(drvdata->dev, "configuration started\n"); } @@ -137,7 +137,7 @@ static inline void fifo_icap_start_config(struct hwicap_drvdata *drvdata) **/ static inline void fifo_icap_start_readback(struct hwicap_drvdata *drvdata) { - out_be32(drvdata->base_address + XHI_CR_OFFSET, XHI_CR_READ_MASK); + iowrite32be(XHI_CR_READ_MASK, drvdata->base_address + XHI_CR_OFFSET); dev_dbg(drvdata->dev, "readback started\n"); } @@ -159,7 +159,7 @@ static inline void fifo_icap_start_readback(struct hwicap_drvdata *drvdata) **/ u32 fifo_icap_get_status(struct hwicap_drvdata *drvdata) { - u32 status = in_be32(drvdata->base_address + XHI_SR_OFFSET); + u32 status = ioread32be(drvdata->base_address + XHI_SR_OFFSET); dev_dbg(drvdata->dev, "Getting status = %x\n", status); return status; } @@ -170,7 +170,7 @@ u32 fifo_icap_get_status(struct hwicap_drvdata *drvdata) **/ static inline u32 fifo_icap_busy(struct hwicap_drvdata *drvdata) { - u32 status = in_be32(drvdata->base_address + XHI_SR_OFFSET); + u32 status = ioread32be(drvdata->base_address + XHI_SR_OFFSET); return (status & XHI_SR_DONE_MASK) ? 0 : 1; } @@ -183,7 +183,7 @@ static inline u32 fifo_icap_busy(struct hwicap_drvdata *drvdata) static inline u32 fifo_icap_write_fifo_vacancy( struct hwicap_drvdata *drvdata) { - return in_be32(drvdata->base_address + XHI_WFV_OFFSET); + return ioread32be(drvdata->base_address + XHI_WFV_OFFSET); } /** @@ -195,7 +195,7 @@ static inline u32 fifo_icap_write_fifo_vacancy( static inline u32 fifo_icap_read_fifo_occupancy( struct hwicap_drvdata *drvdata) { - return in_be32(drvdata->base_address + XHI_RFO_OFFSET); + return ioread32be(drvdata->base_address + XHI_RFO_OFFSET); } /** @@ -361,13 +361,12 @@ void fifo_icap_reset(struct hwicap_drvdata *drvdata) * Reset the device by setting/clearing the RESET bit in the * Control Register. */ - reg_data = in_be32(drvdata->base_address + XHI_CR_OFFSET); + reg_data = ioread32be(drvdata->base_address + XHI_CR_OFFSET); - out_be32(drvdata->base_address + XHI_CR_OFFSET, - reg_data | XHI_CR_SW_RESET_MASK); - - out_be32(drvdata->base_address + XHI_CR_OFFSET, - reg_data & (~XHI_CR_SW_RESET_MASK)); + iowrite32be(reg_data | XHI_CR_SW_RESET_MASK, + drvdata->base_address + XHI_CR_OFFSET); + iowrite32be(reg_data & (~XHI_CR_SW_RESET_MASK), + drvdata->base_address + XHI_CR_OFFSET); } @@ -382,12 +381,12 @@ void fifo_icap_flush_fifo(struct hwicap_drvdata *drvdata) * Flush the FIFO by setting/clearing the FIFO Clear bit in the * Control Register. */ - reg_data = in_be32(drvdata->base_address + XHI_CR_OFFSET); + reg_data = ioread32be(drvdata->base_address + XHI_CR_OFFSET); - out_be32(drvdata->base_address + XHI_CR_OFFSET, - reg_data | XHI_CR_FIFO_CLR_MASK); + iowrite32be(reg_data | XHI_CR_FIFO_CLR_MASK, + drvdata->base_address + XHI_CR_OFFSET); - out_be32(drvdata->base_address + XHI_CR_OFFSET, - reg_data & (~XHI_CR_FIFO_CLR_MASK)); + iowrite32be(reg_data & (~XHI_CR_FIFO_CLR_MASK), + drvdata->base_address + XHI_CR_OFFSET); } diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c index ed8a9ce..0c5a3d5 100644 --- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c +++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c @@ -96,6 +96,7 @@ /* For open firmware. */ #include <linux/of_device.h> #include <linux/of_platform.h> +#include <linux/of_address.h> #endif #include "xilinx_hwicap.h" diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.h b/drivers/char/xilinx_hwicap/xilinx_hwicap.h index 8cca119..09449f3 100644 --- a/drivers/char/xilinx_hwicap/xilinx_hwicap.h +++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.h @@ -38,6 +38,7 @@ #include <linux/platform_device.h> #include <asm/io.h> +#include <asm/iomap.h> struct hwicap_drvdata { u32 write_buffer_in_use; /* Always in [0,3] */ -- 1.5.6.6 This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately. ^ permalink raw reply related [flat|nested] 36+ messages in thread
[parent not found: <1279304021-22216-8-git-send-email-stephen.neuendorffer@xilinx.com>]
[parent not found: <1279304021-22216-8-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>]
* [PATCH 8/8] [Xilinx] xilinx_hwicap: Enable whenever OF/device trees are available. [not found] ` <1279304021-22216-8-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> @ 2010-07-16 18:13 ` Stephen Neuendorffer [not found] ` <a10f704f-cc4b-4ca2-bd06-a9c4fa2853d4-+Ck8Kgl/v086W+Ha+8ZLibjjLBE8jN/0@public.gmane.org> 0 siblings, 1 reply; 36+ messages in thread From: Stephen Neuendorffer @ 2010-07-16 18:13 UTC (permalink / raw) To: grant.likely-s3s/WqlpOiPyB63q8FvJNQ, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> --- drivers/char/Kconfig | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index 7cfcc62..f445f2f 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig @@ -909,7 +909,7 @@ config DTLK config XILINX_HWICAP tristate "Xilinx HWICAP Support" - depends on XILINX_VIRTEX || MICROBLAZE + depends on OF help This option enables support for Xilinx Internal Configuration Access Port (ICAP) driver. The ICAP is used on Xilinx Virtex -- 1.5.6.6 This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately. ^ permalink raw reply related [flat|nested] 36+ messages in thread
[parent not found: <a10f704f-cc4b-4ca2-bd06-a9c4fa2853d4-+Ck8Kgl/v086W+Ha+8ZLibjjLBE8jN/0@public.gmane.org>]
* Re: [PATCH 8/8] [Xilinx] xilinx_hwicap: Enable whenever OF/device trees are available. [not found] ` <a10f704f-cc4b-4ca2-bd06-a9c4fa2853d4-+Ck8Kgl/v086W+Ha+8ZLibjjLBE8jN/0@public.gmane.org> @ 2010-07-16 18:45 ` Grant Likely [not found] ` <AANLkTilMVutoM9wH-67nqR2r3Lv-hq_aEKntjLk7_dgA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 36+ messages in thread From: Grant Likely @ 2010-07-16 18:45 UTC (permalink / raw) To: Stephen Neuendorffer; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ On Fri, Jul 16, 2010 at 12:13 PM, Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote: > signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> > --- > drivers/char/Kconfig | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig > index 7cfcc62..f445f2f 100644 > --- a/drivers/char/Kconfig > +++ b/drivers/char/Kconfig > @@ -909,7 +909,7 @@ config DTLK > > config XILINX_HWICAP > tristate "Xilinx HWICAP Support" > - depends on XILINX_VIRTEX || MICROBLAZE > + depends on OF I'll throw this and patch 7 into my experimental branch to see if they break SPARC or PPC64. g. ^ permalink raw reply [flat|nested] 36+ messages in thread
[parent not found: <AANLkTilMVutoM9wH-67nqR2r3Lv-hq_aEKntjLk7_dgA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* RE: [PATCH 8/8] [Xilinx] xilinx_hwicap: Enable whenever OF/device trees are available. [not found] ` <AANLkTilMVutoM9wH-67nqR2r3Lv-hq_aEKntjLk7_dgA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2010-07-16 18:46 ` Stephen Neuendorffer 2010-07-16 18:47 ` Grant Likely 2010-07-22 16:05 ` Grant Likely 2 siblings, 0 replies; 36+ messages in thread From: Stephen Neuendorffer @ 2010-07-16 18:46 UTC (permalink / raw) To: Grant Likely; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ > -----Original Message----- > From: glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org [mailto:glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org] On Behalf Of Grant Likely > Sent: Friday, July 16, 2010 11:45 AM > To: Stephen Neuendorffer > Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org > Subject: Re: [PATCH 8/8] [Xilinx] xilinx_hwicap: Enable whenever OF/device trees are available. > > On Fri, Jul 16, 2010 at 12:13 PM, Stephen Neuendorffer > <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote: > > signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> > > --- > > drivers/char/Kconfig | 2 +- > > 1 files changed, 1 insertions(+), 1 deletions(-) > > > > diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig > > index 7cfcc62..f445f2f 100644 > > --- a/drivers/char/Kconfig > > +++ b/drivers/char/Kconfig > > @@ -909,7 +909,7 @@ config DTLK > > > > config XILINX_HWICAP > > tristate "Xilinx HWICAP Support" > > - depends on XILINX_VIRTEX || MICROBLAZE > > + depends on OF > > I'll throw this and patch 7 into my experimental branch to see if they > break SPARC or PPC64. Thanks! Steve This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately. ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 8/8] [Xilinx] xilinx_hwicap: Enable whenever OF/device trees are available. [not found] ` <AANLkTilMVutoM9wH-67nqR2r3Lv-hq_aEKntjLk7_dgA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2010-07-16 18:46 ` Stephen Neuendorffer @ 2010-07-16 18:47 ` Grant Likely 2010-07-22 16:05 ` Grant Likely 2 siblings, 0 replies; 36+ messages in thread From: Grant Likely @ 2010-07-16 18:47 UTC (permalink / raw) To: Stephen Neuendorffer; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ On Fri, Jul 16, 2010 at 12:45 PM, Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> wrote: > On Fri, Jul 16, 2010 at 12:13 PM, Stephen Neuendorffer > <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote: >> signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> > > I'll throw this and patch 7 into my experimental branch to see if they > break SPARC or PPC64. Oh, and "Signed-off-by:" starts with a capital 'S'. g. ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 8/8] [Xilinx] xilinx_hwicap: Enable whenever OF/device trees are available. [not found] ` <AANLkTilMVutoM9wH-67nqR2r3Lv-hq_aEKntjLk7_dgA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2010-07-16 18:46 ` Stephen Neuendorffer 2010-07-16 18:47 ` Grant Likely @ 2010-07-22 16:05 ` Grant Likely [not found] ` <AANLkTimm9hxxaj5ir2SynudRu1o4LKXnHy1AnJ1C_ii7-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2 siblings, 1 reply; 36+ messages in thread From: Grant Likely @ 2010-07-22 16:05 UTC (permalink / raw) To: Stephen Neuendorffer; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ On Fri, Jul 16, 2010 at 12:45 PM, Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> wrote: > On Fri, Jul 16, 2010 at 12:13 PM, Stephen Neuendorffer > <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote: >> signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> >> --- >> drivers/char/Kconfig | 2 +- >> 1 files changed, 1 insertions(+), 1 deletions(-) >> >> diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig >> index 7cfcc62..f445f2f 100644 >> --- a/drivers/char/Kconfig >> +++ b/drivers/char/Kconfig >> @@ -909,7 +909,7 @@ config DTLK >> >> config XILINX_HWICAP >> tristate "Xilinx HWICAP Support" >> - depends on XILINX_VIRTEX || MICROBLAZE >> + depends on OF > > I'll throw this and patch 7 into my experimental branch to see if they > break SPARC or PPC64. It broke. http://kisskb.ellerman.id.au/kisskb/buildresult/2946239/ g. ^ permalink raw reply [flat|nested] 36+ messages in thread
[parent not found: <AANLkTimm9hxxaj5ir2SynudRu1o4LKXnHy1AnJ1C_ii7-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* RE: [PATCH 8/8] [Xilinx] xilinx_hwicap: Enable whenever OF/device trees are available. [not found] ` <AANLkTimm9hxxaj5ir2SynudRu1o4LKXnHy1AnJ1C_ii7-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2010-07-22 18:25 ` Stephen Neuendorffer 0 siblings, 0 replies; 36+ messages in thread From: Stephen Neuendorffer @ 2010-07-22 18:25 UTC (permalink / raw) To: Grant Likely; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ > -----Original Message----- > From: glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org [mailto:glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org] On Behalf Of Grant Likely > Sent: Thursday, July 22, 2010 9:05 AM > To: Stephen Neuendorffer > Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org > Subject: Re: [PATCH 8/8] [Xilinx] xilinx_hwicap: Enable whenever OF/device trees are available. > > On Fri, Jul 16, 2010 at 12:45 PM, Grant Likely > <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> wrote: > > On Fri, Jul 16, 2010 at 12:13 PM, Stephen Neuendorffer > > <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote: > >> signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> > >> --- > >> drivers/char/Kconfig | 2 +- > >> 1 files changed, 1 insertions(+), 1 deletions(-) > >> > >> diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig > >> index 7cfcc62..f445f2f 100644 > >> --- a/drivers/char/Kconfig > >> +++ b/drivers/char/Kconfig > >> @@ -909,7 +909,7 @@ config DTLK > >> > >> config XILINX_HWICAP > >> tristate "Xilinx HWICAP Support" > >> - depends on XILINX_VIRTEX || MICROBLAZE > >> + depends on OF > > > > I'll throw this and patch 7 into my experimental branch to see if they > > break SPARC or PPC64. > > It broke. > > http://kisskb.ellerman.id.au/kisskb/buildresult/2946239/ > > g. It looks like it can just use linux/io.h. I'll spin the patches. Steve This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately. ^ permalink raw reply [flat|nested] 36+ messages in thread
end of thread, other threads:[~2010-11-17 1:48 UTC | newest]
Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1279304021-22216-1-git-send-email-stephen.neuendorffer@xilinx.com>
[not found] ` <1279304021-22216-1-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2010-07-16 18:13 ` [PATCH 1/8] of/fdt.c: use architecture-independent ALIGN macro, defined in kernel.h Stephen Neuendorffer
[not found] ` <f2cebad3-5fb1-4984-800f-ef847e388e65-RaUQJvECHitZbvUCbuG1mrjjLBE8jN/0@public.gmane.org>
2010-07-16 18:29 ` Grant Likely
[not found] ` <AANLkTin8GUuMjAVI-r2KNXBoH7DjsQWfTjC1inQTlD6V-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-07-16 18:45 ` Stephen Neuendorffer
2010-07-19 18:34 ` Stephen Neuendorffer
[not found] ` <1279304021-22216-2-git-send-email-stephen.neuendorffer@xilinx.com>
[not found] ` <1279304021-22216-2-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2010-07-16 18:13 ` [PATCH 2/8] drivers/of: Make device tree code work on any arch Stephen Neuendorffer
[not found] ` <592c6c35-556d-4874-8b75-2ebf0acf00e9-+Ck8Kgl/v0+Da4789yZHSLjjLBE8jN/0@public.gmane.org>
2010-07-16 18:31 ` Grant Likely
[not found] ` <AANLkTimW3tsllx82F-cKtAEHGxVXwG4ESbtYWBzS17Wb-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-07-16 18:34 ` Stephen Neuendorffer
[not found] ` <686f0008-74c9-4ee5-bfb3-b4920835b765-RaUQJvECHitEus+KprP3J7jjLBE8jN/0@public.gmane.org>
2010-07-16 18:55 ` Grant Likely
[not found] ` <1279304021-22216-3-git-send-email-stephen.neuendorffer@xilinx.com>
[not found] ` <1279304021-22216-3-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2010-07-16 18:13 ` [PATCH 3/8] of/fdt: Add unflatten_partial_device_tree Stephen Neuendorffer
[not found] ` <91a7e060-e748-47d5-aa7d-4fc45343d212-RaUQJvECHitEus+KprP3J7jjLBE8jN/0@public.gmane.org>
2010-07-16 19:25 ` Grant Likely
[not found] ` <AANLkTikbhjZshaetoTX6kXHwt_SobYUG69cuDZd0gArF-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-07-23 22:10 ` Stephen Neuendorffer
[not found] ` <58c8fb4d-50d9-45bb-9a09-9cd04033a912-RaUQJvECHiusiP+nND6G/7jjLBE8jN/0@public.gmane.org>
2010-08-10 17:53 ` Grant Likely
[not found] ` <AANLkTimE=YjDsr5em8ttAJkRzjZ6XMF_Hts0w0EpPzqx-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-11-17 0:44 ` Stephen Neuendorffer
[not found] ` <db162abd-e702-4d34-ac3a-ee6ce512f98d-+Ck8Kgl/v0/TR3wEnDZ30LjjLBE8jN/0@public.gmane.org>
2010-11-17 1:48 ` Grant Likely
[not found] ` <1279304021-22216-4-git-send-email-stephen.neuendorffer@xilinx.com>
[not found] ` <1279304021-22216-4-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2010-07-16 18:13 ` [PATCH 4/8] of/base.c: export property access/modification functions Stephen Neuendorffer
[not found] ` <01cb5edd-5330-40ba-b410-6732e44f0954-+Ck8Kgl/v0+Da4789yZHSLjjLBE8jN/0@public.gmane.org>
2010-07-16 18:33 ` Grant Likely
[not found] ` <AANLkTikwtfpH5qyG5cbsLYPHLSaAmBcHaSJT3zbt4s35-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-07-16 18:38 ` Stephen Neuendorffer
[not found] ` <e198df81-5939-4b82-9d27-952d9781ec05-+Ck8Kgl/v09CYczPSvLbDrjjLBE8jN/0@public.gmane.org>
2010-07-16 18:57 ` Grant Likely
[not found] ` <AANLkTilXmgTkJ2N0dTYsV99ElqssZAXwOgtKPBENZoX8-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-07-16 20:07 ` Stephen Neuendorffer
[not found] ` <41b1b87c-a391-493d-8235-a9304562a6e4-RaUQJvECHis6W+Ha+8ZLibjjLBE8jN/0@public.gmane.org>
2010-07-16 21:43 ` Grant Likely
[not found] ` <AANLkTinlTNa0TEnqk27Jv2Yy8sZ1Vx3V89YJvcs-jULM-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-07-16 22:03 ` Stephen Neuendorffer
[not found] ` <1279304021-22216-5-git-send-email-stephen.neuendorffer@xilinx.com>
[not found] ` <1279304021-22216-5-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2010-07-16 18:13 ` [PATCH 5/8] arch/x86: Add support for device tree code Stephen Neuendorffer
[not found] ` <961e55b7-170c-45ac-a491-628797a0aa5e-+Ck8Kgl/v0/5op9OF0Koj7jjLBE8jN/0@public.gmane.org>
2010-07-16 18:39 ` Grant Likely
[not found] ` <AANLkTinPIY4N9Gv_J7Ief7Scd57c0KEY6WtHsvQTBrzb-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-07-16 18:42 ` Stephen Neuendorffer
[not found] ` <a33ca228-cb2c-4044-bf63-c653642415a0-RaUQJvECHitEus+KprP3J7jjLBE8jN/0@public.gmane.org>
2010-07-16 18:59 ` Grant Likely
[not found] ` <AANLkTinVIf2A_OVAXlqjHY5J3jvaraPlJySnyEKbhlqA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-07-16 20:11 ` Stephen Neuendorffer
[not found] ` <a52173ec-5c74-47ce-9121-f2e90958b05d-RaUQJvECHiuJ1bAq5m18RLjjLBE8jN/0@public.gmane.org>
2010-07-16 20:28 ` Grant Likely
[not found] ` <1279304021-22216-6-git-send-email-stephen.neuendorffer@xilinx.com>
[not found] ` <1279304021-22216-6-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2010-07-16 18:13 ` [PATCH 6/8] [Xilinx] xilinx_pcipr: Added Xilinx reconfigurable PCI endpoint driver Stephen Neuendorffer
[not found] ` <19f2f30b-1b43-4729-a079-da1df0b04609-RaUQJvECHitZbvUCbuG1mrjjLBE8jN/0@public.gmane.org>
2010-07-16 18:43 ` Grant Likely
[not found] ` <1279304021-22216-7-git-send-email-stephen.neuendorffer@xilinx.com>
[not found] ` <1279304021-22216-7-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2010-07-16 18:13 ` [PATCH 7/8] [Xilinx] xilinx_hwicap: Update driver to use generic io accessors Stephen Neuendorffer
[not found] ` <1279304021-22216-8-git-send-email-stephen.neuendorffer@xilinx.com>
[not found] ` <1279304021-22216-8-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2010-07-16 18:13 ` [PATCH 8/8] [Xilinx] xilinx_hwicap: Enable whenever OF/device trees are available Stephen Neuendorffer
[not found] ` <a10f704f-cc4b-4ca2-bd06-a9c4fa2853d4-+Ck8Kgl/v086W+Ha+8ZLibjjLBE8jN/0@public.gmane.org>
2010-07-16 18:45 ` Grant Likely
[not found] ` <AANLkTilMVutoM9wH-67nqR2r3Lv-hq_aEKntjLk7_dgA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-07-16 18:46 ` Stephen Neuendorffer
2010-07-16 18:47 ` Grant Likely
2010-07-22 16:05 ` Grant Likely
[not found] ` <AANLkTimm9hxxaj5ir2SynudRu1o4LKXnHy1AnJ1C_ii7-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-07-22 18:25 ` Stephen Neuendorffer
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox