aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2016-05-09 10:42:14 -0400
committerArnd Bergmann <arnd@arndb.de>2016-05-09 10:42:14 -0400
commitff628a4dbdc4867ef9706b306fb1e8b1abbe8062 (patch)
tree5c6d823f4360eaa6d8723bbc0b4da4c01e57b42e
parent11c3aead82879448943a1d1795b9d2e52a7bb669 (diff)
parentd4f414e559caf36d811213e56b56e9b6957caab1 (diff)
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
-rw-r--r--arch/arm/mach-omap2/pdata-quirks.c17
-rw-r--r--drivers/of/platform.c28
2 files changed, 25 insertions, 20 deletions
diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c
index ea3a7d550ea9..6571ad959908 100644
--- a/arch/arm/mach-omap2/pdata-quirks.c
+++ b/arch/arm/mach-omap2/pdata-quirks.c
@@ -528,9 +528,6 @@ static struct of_dev_auxdata omap_auxdata_lookup[] __initdata = {
528 OF_DEV_AUXDATA("tlv320aic3x", 0x18, "2-0018", &n810_aic33_data), 528 OF_DEV_AUXDATA("tlv320aic3x", 0x18, "2-0018", &n810_aic33_data),
529#endif 529#endif
530#ifdef CONFIG_ARCH_OMAP3 530#ifdef CONFIG_ARCH_OMAP3
531 OF_DEV_AUXDATA("ti,omap3-padconf", 0x48002030, "48002030.pinmux", &pcs_pdata),
532 OF_DEV_AUXDATA("ti,omap3-padconf", 0x480025a0, "480025a0.pinmux", &pcs_pdata),
533 OF_DEV_AUXDATA("ti,omap3-padconf", 0x48002a00, "48002a00.pinmux", &pcs_pdata),
534 OF_DEV_AUXDATA("ti,omap2-iommu", 0x5d000000, "5d000000.mmu", 531 OF_DEV_AUXDATA("ti,omap2-iommu", 0x5d000000, "5d000000.mmu",
535 &omap3_iommu_pdata), 532 &omap3_iommu_pdata),
536 OF_DEV_AUXDATA("ti,omap3-hsmmc", 0x4809c000, "4809c000.mmc", &mmc_pdata[0]), 533 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 = {
544 OF_DEV_AUXDATA("ti,am3352-wkup-m3", 0x44d00000, "44d00000.wkup_m3", 541 OF_DEV_AUXDATA("ti,am3352-wkup-m3", 0x44d00000, "44d00000.wkup_m3",
545 &wkup_m3_data), 542 &wkup_m3_data),
546#endif 543#endif
547#ifdef CONFIG_ARCH_OMAP4
548 OF_DEV_AUXDATA("ti,omap4-padconf", 0x4a100040, "4a100040.pinmux", &pcs_pdata),
549 OF_DEV_AUXDATA("ti,omap4-padconf", 0x4a31e040, "4a31e040.pinmux", &pcs_pdata),
550#endif
551#ifdef CONFIG_SOC_OMAP5
552 OF_DEV_AUXDATA("ti,omap5-padconf", 0x4a002840, "4a002840.pinmux", &pcs_pdata),
553 OF_DEV_AUXDATA("ti,omap5-padconf", 0x4ae0c840, "4ae0c840.pinmux", &pcs_pdata),
554#endif
555#ifdef CONFIG_SOC_DRA7XX
556 OF_DEV_AUXDATA("ti,dra7-padconf", 0x4a003400, "4a003400.pinmux", &pcs_pdata),
557#endif
558#ifdef CONFIG_SOC_AM43XX 544#ifdef CONFIG_SOC_AM43XX
559 OF_DEV_AUXDATA("ti,am437-padconf", 0x44e10800, "44e10800.pinmux", &pcs_pdata),
560 OF_DEV_AUXDATA("ti,am4372-wkup-m3", 0x44d00000, "44d00000.wkup_m3", 545 OF_DEV_AUXDATA("ti,am4372-wkup-m3", 0x44d00000, "44d00000.wkup_m3",
561 &wkup_m3_data), 546 &wkup_m3_data),
562#endif 547#endif
@@ -569,6 +554,8 @@ static struct of_dev_auxdata omap_auxdata_lookup[] __initdata = {
569 OF_DEV_AUXDATA("ti,omap4-iommu", 0x55082000, "55082000.mmu", 554 OF_DEV_AUXDATA("ti,omap4-iommu", 0x55082000, "55082000.mmu",
570 &omap4_iommu_pdata), 555 &omap4_iommu_pdata),
571#endif 556#endif
557 /* Common auxdata */
558 OF_DEV_AUXDATA("pinctrl-single", 0, NULL, &pcs_pdata),
572 { /* sentinel */ }, 559 { /* sentinel */ },
573}; 560};
574 561
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 8d103e4968be..16e8daffac06 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -297,19 +297,37 @@ static struct amba_device *of_amba_device_create(struct device_node *node,
297static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *lookup, 297static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *lookup,
298 struct device_node *np) 298 struct device_node *np)
299{ 299{
300 const struct of_dev_auxdata *auxdata;
300 struct resource res; 301 struct resource res;
302 int compatible = 0;
301 303
302 if (!lookup) 304 if (!lookup)
303 return NULL; 305 return NULL;
304 306
305 for(; lookup->compatible != NULL; lookup++) { 307 auxdata = lookup;
306 if (!of_device_is_compatible(np, lookup->compatible)) 308 for (; auxdata->compatible; auxdata++) {
309 if (!of_device_is_compatible(np, auxdata->compatible))
307 continue; 310 continue;
311 compatible++;
308 if (!of_address_to_resource(np, 0, &res)) 312 if (!of_address_to_resource(np, 0, &res))
309 if (res.start != lookup->phys_addr) 313 if (res.start != auxdata->phys_addr)
310 continue; 314 continue;
311 pr_debug("%s: devname=%s\n", np->full_name, lookup->name); 315 pr_debug("%s: devname=%s\n", np->full_name, auxdata->name);
312 return lookup; 316 return auxdata;
317 }
318
319 if (!compatible)
320 return NULL;
321
322 /* Try compatible match if no phys_addr and name are specified */
323 auxdata = lookup;
324 for (; auxdata->compatible; auxdata++) {
325 if (!of_device_is_compatible(np, auxdata->compatible))
326 continue;
327 if (!auxdata->phys_addr && !auxdata->name) {
328 pr_debug("%s: compatible match\n", np->full_name);
329 return auxdata;
330 }
313 } 331 }
314 332
315 return NULL; 333 return NULL;