Device tree auxdata handling fix that allows a match based on the

compatible string if no exact match based on the IO address is found.
 
 This leaves out the need to patch auxdata for each driver when adding
 new SoCs. And it also reprotedly fixes the issue of passing auxdata
 to a child if the parent instantiates the child from DT as discussed
 in the "[PATCH] of/platform: Allow secondary compatible match in
 of_dev_lookup" mailing list thread.
 
 As a minimal use case, let's also convert omap pinctrl auxdatato
 use a generic match.
 
 There is no need to get this in to the v4.6-rc cycle and it can wait
 for v4.7 merge window. Note that these changes have now been sitting
 in Linux next for about two weeks so far as I wanted to make sure no
 new issues are popping up.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJXKjVmAAoJEBvUPslcq6VzNaIQAKBW4SoVCpUnz8U7Vb6drVmk
 kNuXn317CJQIJSPYuncQkmnPPDqvRBB16offmWI2z31R2p8azuf4kTkroqGrIP2+
 ZuXyuxNc3IczxMiWjVN3SKA7/h4fRM+J8IN8AHHf/DAcFOc0Dz1muMhkEX3otT+/
 qFn85iBreeAaNnW9eViZ+lvz6wSYlhrHAPrW3jHJM1Q11OTi45vymS82iU4ztcXo
 zotDxSLaMcQJNAb6wF553JhzwL8G1bM9Ab1b5+vsOVQ/y/wWY+b/maGePUQCWiVX
 cggYoa/0gDmBGAUdLq1GvVTg4HHIEaO0ysrioMlHmOkTf7KXXiKITZTX98FE39rL
 xH/2nkechWV8yWPwhZktjASzcImqItcMdS3axFgdHnV7fpho2an/80Ekod401/Bh
 wIJ48gZxPAyshjr+e8xhyHRdEauVmUYvdiUS/Gv8dEvJJnBqVFYcLd/FNCp43j5X
 G7RQITG0pK7i0xwX+9vNOrD5CzfWCSLYw6iMnMnReMdnw9PUwbYLaiWTuoyC6Pmd
 B9zMkqOzdael6fFuQvRi9ZOEoSK5A3EpLWrvXzrS4nXy1dOa2eDpuxoRkAKACVMf
 wyANAn3YK1pQwtnoGRsdNk98zjMX2o8H1G0XKB0QewNa0zlNhGIUsAiZYX4H/drg
 taAbzAUSLloDcHnyQgis
 =T39l
 -----END PGP SIGNATURE-----

Merge tag 'omap-for-v4.7/auxdata-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into next/fixes-non-critical

Merge "non urgent auxdata fix for v4.7 merge window" from Tony Lindgren:

Device tree auxdata handling fix that allows a match based on the
compatible string if no exact match based on the IO address is found.

This leaves out the need to patch auxdata for each driver when adding
new SoCs. And it also reprotedly fixes the issue of passing auxdata
to a child if the parent instantiates the child from DT as discussed
in the "[PATCH] of/platform: Allow secondary compatible match in
of_dev_lookup" mailing list thread.

As a minimal use case, let's also convert omap pinctrl auxdatato
use a generic match.

There is no need to get this in to the v4.6-rc cycle and it can wait
for v4.7 merge window. Note that these changes have now been sitting
in Linux next for about two weeks so far as I wanted to make sure no
new issues are popping up.

* tag 'omap-for-v4.7/auxdata-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap:
  ARM: OMAP2+: Simplify auxdata by using the generic match
  of/platform: Allow secondary compatible match in of_dev_lookup
This commit is contained in:
Arnd Bergmann 2016-05-09 16:42:14 +02:00
commit ff628a4dbd
2 changed files with 25 additions and 20 deletions

View File

@ -528,9 +528,6 @@ static struct of_dev_auxdata omap_auxdata_lookup[] __initdata = {
OF_DEV_AUXDATA("tlv320aic3x", 0x18, "2-0018", &n810_aic33_data),
#endif
#ifdef CONFIG_ARCH_OMAP3
OF_DEV_AUXDATA("ti,omap3-padconf", 0x48002030, "48002030.pinmux", &pcs_pdata),
OF_DEV_AUXDATA("ti,omap3-padconf", 0x480025a0, "480025a0.pinmux", &pcs_pdata),
OF_DEV_AUXDATA("ti,omap3-padconf", 0x48002a00, "48002a00.pinmux", &pcs_pdata),
OF_DEV_AUXDATA("ti,omap2-iommu", 0x5d000000, "5d000000.mmu",
&omap3_iommu_pdata),
OF_DEV_AUXDATA("ti,omap3-hsmmc", 0x4809c000, "4809c000.mmc", &mmc_pdata[0]),
@ -544,19 +541,7 @@ static struct of_dev_auxdata omap_auxdata_lookup[] __initdata = {
OF_DEV_AUXDATA("ti,am3352-wkup-m3", 0x44d00000, "44d00000.wkup_m3",
&wkup_m3_data),
#endif
#ifdef CONFIG_ARCH_OMAP4
OF_DEV_AUXDATA("ti,omap4-padconf", 0x4a100040, "4a100040.pinmux", &pcs_pdata),
OF_DEV_AUXDATA("ti,omap4-padconf", 0x4a31e040, "4a31e040.pinmux", &pcs_pdata),
#endif
#ifdef CONFIG_SOC_OMAP5
OF_DEV_AUXDATA("ti,omap5-padconf", 0x4a002840, "4a002840.pinmux", &pcs_pdata),
OF_DEV_AUXDATA("ti,omap5-padconf", 0x4ae0c840, "4ae0c840.pinmux", &pcs_pdata),
#endif
#ifdef CONFIG_SOC_DRA7XX
OF_DEV_AUXDATA("ti,dra7-padconf", 0x4a003400, "4a003400.pinmux", &pcs_pdata),
#endif
#ifdef CONFIG_SOC_AM43XX
OF_DEV_AUXDATA("ti,am437-padconf", 0x44e10800, "44e10800.pinmux", &pcs_pdata),
OF_DEV_AUXDATA("ti,am4372-wkup-m3", 0x44d00000, "44d00000.wkup_m3",
&wkup_m3_data),
#endif
@ -569,6 +554,8 @@ static struct of_dev_auxdata omap_auxdata_lookup[] __initdata = {
OF_DEV_AUXDATA("ti,omap4-iommu", 0x55082000, "55082000.mmu",
&omap4_iommu_pdata),
#endif
/* Common auxdata */
OF_DEV_AUXDATA("pinctrl-single", 0, NULL, &pcs_pdata),
{ /* sentinel */ },
};

View File

@ -297,19 +297,37 @@ static struct amba_device *of_amba_device_create(struct device_node *node,
static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *lookup,
struct device_node *np)
{
const struct of_dev_auxdata *auxdata;
struct resource res;
int compatible = 0;
if (!lookup)
return NULL;
for(; lookup->compatible != NULL; lookup++) {
if (!of_device_is_compatible(np, lookup->compatible))
auxdata = lookup;
for (; auxdata->compatible; auxdata++) {
if (!of_device_is_compatible(np, auxdata->compatible))
continue;
compatible++;
if (!of_address_to_resource(np, 0, &res))
if (res.start != lookup->phys_addr)
if (res.start != auxdata->phys_addr)
continue;
pr_debug("%s: devname=%s\n", np->full_name, lookup->name);
return lookup;
pr_debug("%s: devname=%s\n", np->full_name, auxdata->name);
return auxdata;
}
if (!compatible)
return NULL;
/* Try compatible match if no phys_addr and name are specified */
auxdata = lookup;
for (; auxdata->compatible; auxdata++) {
if (!of_device_is_compatible(np, auxdata->compatible))
continue;
if (!auxdata->phys_addr && !auxdata->name) {
pr_debug("%s: compatible match\n", np->full_name);
return auxdata;
}
}
return NULL;