From bb8e15d60462a84a25a3bf33e8bc29b46c6d470a Mon Sep 17 00:00:00 2001 From: Kefeng Wang Date: Wed, 1 Jun 2016 14:06:15 +0800 Subject: of: iommu: make of_iommu_init() postcore_initcall_sync The of_iommu_init() is called multiple times by arch code, make it postcore_initcall_sync, then we can drop relevant calls fully. Note, the IOMMUs should have a chance to perform some basic initialisation before we start adding masters to them. So postcore_initcall_sync is good choice, it ensures of_iommu_init() called before of_platform_populate. Acked-by: Rich Felker Tested-by: Marek Szyprowski Cc: Arnd Bergmann Cc: Catalin Marinas Cc: Marek Szyprowski Cc: Rich Felker Cc: Rob Herring Cc: Robin Murphy Cc: Will Deacon Signed-off-by: Kefeng Wang Acked-by: Joerg Roedel Signed-off-by: Rob Herring diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 7b53500..7e455339 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -903,7 +902,6 @@ static int __init customize_machine(void) * machine from the device tree, if no callback is provided, * otherwise we would always need an init_machine callback. */ - of_iommu_init(); if (machine_desc->init_machine) machine_desc->init_machine(); #ifdef CONFIG_OF diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c index 3279def..8412520 100644 --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c @@ -39,7 +39,6 @@ #include #include #include -#include #include #include #include @@ -305,7 +304,6 @@ void __init setup_arch(char **cmdline_p) static int __init arm64_device_init(void) { if (of_have_populated_dt()) { - of_iommu_init(); of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); } else if (acpi_disabled) { diff --git a/arch/sh/boards/of-generic.c b/arch/sh/boards/of-generic.c index bf3a166..b4d4313 100644 --- a/arch/sh/boards/of-generic.c +++ b/arch/sh/boards/of-generic.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -185,7 +184,6 @@ static int __init sh_of_device_init(void) { pr_info("SH generic board support: populating platform devices\n"); if (of_have_populated_dt()) { - of_iommu_init(); of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); } else { diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c index af499ae..57f23ea 100644 --- a/drivers/iommu/of_iommu.c +++ b/drivers/iommu/of_iommu.c @@ -174,7 +174,7 @@ err_put_node: return NULL; } -void __init of_iommu_init(void) +static int __init of_iommu_init(void) { struct device_node *np; const struct of_device_id *match, *matches = &__iommu_of_table; @@ -186,4 +186,7 @@ void __init of_iommu_init(void) pr_err("Failed to initialise IOMMU %s\n", of_node_full_name(np)); } + + return 0; } +postcore_initcall_sync(of_iommu_init); diff --git a/include/linux/of_iommu.h b/include/linux/of_iommu.h index bd02b44..e80b9c7 100644 --- a/include/linux/of_iommu.h +++ b/include/linux/of_iommu.h @@ -11,7 +11,6 @@ extern int of_get_dma_window(struct device_node *dn, const char *prefix, int index, unsigned long *busno, dma_addr_t *addr, size_t *size); -extern void of_iommu_init(void); extern const struct iommu_ops *of_iommu_configure(struct device *dev, struct device_node *master_np); @@ -24,7 +23,6 @@ static inline int of_get_dma_window(struct device_node *dn, const char *prefix, return -EINVAL; } -static inline void of_iommu_init(void) { } static inline const struct iommu_ops *of_iommu_configure(struct device *dev, struct device_node *master_np) { -- cgit v0.10.2 From 44a7185c2ae6383c88ff5b1ef2e2969f35d7b8b7 Mon Sep 17 00:00:00 2001 From: Kefeng Wang Date: Wed, 1 Jun 2016 14:52:54 +0800 Subject: of/platform: Add common method to populate default bus The arch code calls of_platform_populate() with default match table when it wants to populate default bus. This patch introduce a new of_platform_default_populate_init() and make it arch_initcall_sync(it should be later than some iommu configration, eg, of_iommu_init() and swiotlb_late_init in arm64), then we can finish above job in common method. In order to avoid the default bus being populated twice, simply checking the flag of bus node whether has be set OF_POPULATED_BUS or not. After that, we can safely remove the caller in arch code. Btw, add debug print in of_platform_populate(), and use __func__ to print function's name of of_platform_bus_create(). Cc: Rob Herring Cc: Frank Rowand Cc: Grant Likely Signed-off-by: Kefeng Wang Signed-off-by: Rob Herring diff --git a/drivers/of/platform.c b/drivers/of/platform.c index 16e8daf..c559ef8 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -363,6 +363,12 @@ static int of_platform_bus_create(struct device_node *bus, return 0; } + if (of_node_check_flag(bus, OF_POPULATED_BUS)) { + pr_debug("%s() - skipping %s, already populated\n", + __func__, bus->full_name); + return 0; + } + auxdata = of_dev_lookup(lookup, bus); if (auxdata) { bus_id = auxdata->name; @@ -414,7 +420,7 @@ int of_platform_bus_probe(struct device_node *root, if (!root) return -EINVAL; - pr_debug("of_platform_bus_probe()\n"); + pr_debug("%s()\n", __func__); pr_debug(" starting at: %s\n", root->full_name); /* Do a self check of bus type, if there's a match, create children */ @@ -466,6 +472,9 @@ int of_platform_populate(struct device_node *root, if (!root) return -EINVAL; + pr_debug("%s()\n", __func__); + pr_debug(" starting at: %s\n", root->full_name); + for_each_child_of_node(root, child) { rc = of_platform_bus_create(child, matches, lookup, parent, true); if (rc) { @@ -489,6 +498,15 @@ int of_platform_default_populate(struct device_node *root, } EXPORT_SYMBOL_GPL(of_platform_default_populate); +static int __init of_platform_default_populate_init(void) +{ + if (of_have_populated_dt()) + of_platform_default_populate(NULL, NULL, NULL); + + return 0; +} +arch_initcall_sync(of_platform_default_populate_init); + static int of_platform_device_destroy(struct device *dev, void *data) { /* Do not touch devices not populated from the device tree */ -- cgit v0.10.2 From 61c78644e7f1bd9445b3d7ddc3d35989a38985ee Mon Sep 17 00:00:00 2001 From: Kefeng Wang Date: Wed, 1 Jun 2016 14:52:55 +0800 Subject: arc: Remove unnecessary of_platform_populate with default match table After patch "of/platform: Add common method to populate default bus", it is possible for arch code to remove unnecessary callers of of_platform_populate with default match table. Acked-by: Vineet Gupta Cc: Vineet Gupta Signed-off-by: Kefeng Wang Signed-off-by: Rob Herring diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c index 2ee7a4d..584c5f0 100644 --- a/arch/arc/kernel/setup.c +++ b/arch/arc/kernel/setup.c @@ -14,7 +14,6 @@ #include #include #include -#include #include #include #include @@ -435,12 +434,6 @@ void __init setup_arch(char **cmdline_p) static int __init customize_machine(void) { - /* - * Traverses flattened DeviceTree - registering platform devices - * (if any) complete with their resources - */ - of_platform_default_populate(NULL, NULL, NULL); - if (machine_desc->init_machine) machine_desc->init_machine(); -- cgit v0.10.2 From 850bea2335e42780a0752a75860d3fbcc3d12d6e Mon Sep 17 00:00:00 2001 From: Kefeng Wang Date: Wed, 1 Jun 2016 14:52:56 +0800 Subject: arm: Remove unnecessary of_platform_populate with default match table After patch "of/platform: Add common method to populate default bus", it is possible for arch code to remove unnecessary callers of of_platform_populate with default match table. Acked-by: Viresh Kumar Cc: Nicolas Ferre Cc: Ray Jui Cc: Lee Jones Cc: Krzysztof Halasa Cc: Kukjin Kim Cc: Rob Herring Cc: Shawn Guo Cc: Santosh Shilimkar Cc: Roland Stigge Cc: Jason Cooper Cc: Haojian Zhuang Cc: Heiko Stuebner Cc: Viresh Kumar Cc: Shiraz Hashim Cc: Tony Prisk Cc: Arnd Bergmann Cc: Russell King Signed-off-by: Kefeng Wang Signed-off-by: Rob Herring diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 7e455339..2273acb 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -904,11 +904,7 @@ static int __init customize_machine(void) */ if (machine_desc->init_machine) machine_desc->init_machine(); -#ifdef CONFIG_OF - else - of_platform_populate(NULL, of_default_bus_match_table, - NULL, NULL); -#endif + return 0; } arch_initcall(customize_machine); diff --git a/arch/arm/mach-artpec/board-artpec6.c b/arch/arm/mach-artpec/board-artpec6.c index 71513df..a0b1979 100644 --- a/arch/arm/mach-artpec/board-artpec6.c +++ b/arch/arm/mach-artpec/board-artpec6.c @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include @@ -44,8 +43,6 @@ static void __init artpec6_init_machine(void) regmap_write(regmap, ARTPEC6_DMACFG_REGNUM, ARTPEC6_DMACFG_UARTS_BURST); }; - - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); } static void artpec6_l2c310_write_sec(unsigned long val, unsigned reg) diff --git a/arch/arm/mach-bcm/board_bcm21664.c b/arch/arm/mach-bcm/board_bcm21664.c index 82ad568..0d7034c 100644 --- a/arch/arm/mach-bcm/board_bcm21664.c +++ b/arch/arm/mach-bcm/board_bcm21664.c @@ -12,7 +12,6 @@ */ #include -#include #include #include @@ -60,7 +59,6 @@ static void bcm21664_restart(enum reboot_mode mode, const char *cmd) static void __init bcm21664_init(void) { - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); kona_l2_cache_init(); } diff --git a/arch/arm/mach-bcm/board_bcm281xx.c b/arch/arm/mach-bcm/board_bcm281xx.c index 2e367bd..b81bb38 100644 --- a/arch/arm/mach-bcm/board_bcm281xx.c +++ b/arch/arm/mach-bcm/board_bcm281xx.c @@ -13,7 +13,6 @@ #include #include -#include #include @@ -58,7 +57,6 @@ static void bcm281xx_restart(enum reboot_mode mode, const char *cmd) static void __init bcm281xx_init(void) { - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); kona_l2_cache_init(); } diff --git a/arch/arm/mach-bcm/board_bcm2835.c b/arch/arm/mach-bcm/board_bcm2835.c index 834d676..0c1edfc 100644 --- a/arch/arm/mach-bcm/board_bcm2835.c +++ b/arch/arm/mach-bcm/board_bcm2835.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #include @@ -23,16 +22,7 @@ static void __init bcm2835_init(void) { - int ret; - bcm2835_init_clocks(); - - ret = of_platform_populate(NULL, of_default_bus_match_table, NULL, - NULL); - if (ret) { - pr_err("of_platform_populate failed: %d\n", ret); - BUG(); - } } static const char * const bcm2835_compat[] = { diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c index 52ccf24..dea410a 100644 --- a/arch/arm/mach-exynos/exynos.c +++ b/arch/arm/mach-exynos/exynos.c @@ -14,7 +14,6 @@ #include #include #include -#include #include #include #include @@ -217,8 +216,6 @@ static void __init exynos_dt_machine_init(void) of_machine_is_compatible("samsung,exynos3250") || of_machine_is_compatible("samsung,exynos5250")) platform_device_register(&exynos_cpuidle); - - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); } static char const *const exynos_dt_compat[] __initconst = { diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c index 6050a14..07f6098 100644 --- a/arch/arm/mach-highbank/highbank.c +++ b/arch/arm/mach-highbank/highbank.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -163,8 +162,6 @@ static void __init highbank_init(void) pl320_ipc_register_notifier(&hb_keys_nb); - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); - if (psci_ops.cpu_suspend) platform_device_register(&highbank_cpuidle_device); } diff --git a/arch/arm/mach-imx/mach-imx51.c b/arch/arm/mach-imx/mach-imx51.c index 10a82a4..ec64de6 100644 --- a/arch/arm/mach-imx/mach-imx51.c +++ b/arch/arm/mach-imx/mach-imx51.c @@ -52,8 +52,6 @@ static void __init imx51_dt_init(void) { imx51_ipu_mipi_setup(); imx_src_init(); - - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); } static void __init imx51_init_late(void) diff --git a/arch/arm/mach-imx/mach-imx53.c b/arch/arm/mach-imx/mach-imx53.c index 18b5c5c13..68aec23 100644 --- a/arch/arm/mach-imx/mach-imx53.c +++ b/arch/arm/mach-imx/mach-imx53.c @@ -32,8 +32,6 @@ static void __init imx53_dt_init(void) { imx_src_init(); - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); - imx_aips_allow_unprivileged_access("fsl,imx53-aipstz"); } diff --git a/arch/arm/mach-imx/mach-imx6ul.c b/arch/arm/mach-imx/mach-imx6ul.c index a38b16b..4078b1c 100644 --- a/arch/arm/mach-imx/mach-imx6ul.c +++ b/arch/arm/mach-imx/mach-imx6ul.c @@ -64,7 +64,6 @@ static void __init imx6ul_init_machine(void) if (parent == NULL) pr_warn("failed to initialize soc device\n"); - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); imx6ul_enet_init(); imx_anatop_init(); imx6ul_pm_init(); diff --git a/arch/arm/mach-imx/mach-imx7d.c b/arch/arm/mach-imx/mach-imx7d.c index b450f52..f388e6b 100644 --- a/arch/arm/mach-imx/mach-imx7d.c +++ b/arch/arm/mach-imx/mach-imx7d.c @@ -93,7 +93,6 @@ static void __init imx7d_init_machine(void) if (parent == NULL) pr_warn("failed to initialize soc device\n"); - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); imx_anatop_init(); imx7d_enet_init(); } diff --git a/arch/arm/mach-keystone/keystone.c b/arch/arm/mach-keystone/keystone.c index a33a296..84613ab 100644 --- a/arch/arm/mach-keystone/keystone.c +++ b/arch/arm/mach-keystone/keystone.c @@ -60,7 +60,6 @@ static void __init keystone_init(void) bus_register_notifier(&platform_bus_type, &platform_nb); } keystone_pm_runtime_init(); - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); } static long long __init keystone_pv_fixup(void) diff --git a/arch/arm/mach-mvebu/board-v7.c b/arch/arm/mach-mvebu/board-v7.c index 1648edd..ccca951 100644 --- a/arch/arm/mach-mvebu/board-v7.c +++ b/arch/arm/mach-mvebu/board-v7.c @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include @@ -144,8 +143,6 @@ static void __init mvebu_dt_init(void) { if (of_machine_is_compatible("marvell,armadaxp")) i2c_quirk(); - - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); } static const char * const armada_370_xp_dt_compat[] __initconst = { diff --git a/arch/arm/mach-mvebu/dove.c b/arch/arm/mach-mvebu/dove.c index 1aebb82..d076c57 100644 --- a/arch/arm/mach-mvebu/dove.c +++ b/arch/arm/mach-mvebu/dove.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -26,7 +25,6 @@ static void __init dove_init(void) #endif BUG_ON(mvebu_mbus_dt_init(false)); dove_init_pmu(); - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); } static const char * const dove_dt_compat[] __initconst = { diff --git a/arch/arm/mach-picoxcell/common.c b/arch/arm/mach-picoxcell/common.c index ec79fea..4e3d6d5 100644 --- a/arch/arm/mach-picoxcell/common.c +++ b/arch/arm/mach-picoxcell/common.c @@ -10,7 +10,6 @@ #include #include #include -#include #include #include @@ -54,7 +53,6 @@ static void __init picoxcell_map_io(void) static void __init picoxcell_init_machine(void) { - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); picoxcell_setup_restart(); } diff --git a/arch/arm/mach-rockchip/rockchip.c b/arch/arm/mach-rockchip/rockchip.c index beb71da..a7ab9ec 100644 --- a/arch/arm/mach-rockchip/rockchip.c +++ b/arch/arm/mach-rockchip/rockchip.c @@ -73,7 +73,6 @@ static void __init rockchip_timer_init(void) static void __init rockchip_dt_init(void) { rockchip_suspend_init(); - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); } static const char * const rockchip_board_dt_compat[] = { diff --git a/arch/arm/mach-s3c24xx/mach-s3c2416-dt.c b/arch/arm/mach-s3c24xx/mach-s3c2416-dt.c index 5f028ff..c83c076 100644 --- a/arch/arm/mach-s3c24xx/mach-s3c2416-dt.c +++ b/arch/arm/mach-s3c24xx/mach-s3c2416-dt.c @@ -17,7 +17,6 @@ #include #include -#include #include #include @@ -35,7 +34,6 @@ static void __init s3c2416_dt_map_io(void) static void __init s3c2416_dt_machine_init(void) { - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); s3c_pm_init(); } diff --git a/arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c b/arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c index bbf74ed..5bf9afa 100644 --- a/arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c +++ b/arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c @@ -8,8 +8,6 @@ * published by the Free Software Foundation. */ -#include - #include #include #include @@ -48,7 +46,6 @@ static void __init s3c64xx_dt_map_io(void) static void __init s3c64xx_dt_init_machine(void) { samsung_wdt_reset_of_init(); - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); } static void s3c64xx_dt_restart(enum reboot_mode mode, const char *cmd) diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c index db6dbfb..3849eef 100644 --- a/arch/arm/mach-shmobile/setup-r8a7740.c +++ b/arch/arm/mach-shmobile/setup-r8a7740.c @@ -18,7 +18,6 @@ #include #include #include -#include #include #include @@ -77,8 +76,6 @@ static void __init r8a7740_init_irq_of(void) static void __init r8a7740_generic_init(void) { r8a7740_meram_workaround(); - - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); } static const char *const r8a7740_boards_compat_dt[] __initconst = { diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c index 99a2004..a25ff18 100644 --- a/arch/arm/mach-shmobile/setup-sh73a0.c +++ b/arch/arm/mach-shmobile/setup-sh73a0.c @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include @@ -55,7 +54,6 @@ static void __init sh73a0_generic_init(void) /* Shared attribute override enable, 64K*8way */ l2x0_init(IOMEM(0xf0100000), 0x00400000, 0xc20f0fff); #endif - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); } static const char *const sh73a0_boards_compat_dt[] __initconst = { diff --git a/arch/arm/mach-spear/spear1310.c b/arch/arm/mach-spear/spear1310.c index cd5d375..a7d4f13 100644 --- a/arch/arm/mach-spear/spear1310.c +++ b/arch/arm/mach-spear/spear1310.c @@ -14,7 +14,6 @@ #define pr_fmt(fmt) "SPEAr1310: " fmt #include -#include #include #include #include @@ -27,7 +26,6 @@ static void __init spear1310_dt_init(void) { - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); platform_device_register_simple("spear-cpufreq", -1, NULL, 0); } diff --git a/arch/arm/mach-spear/spear1340.c b/arch/arm/mach-spear/spear1340.c index 94594d5..a212af9 100644 --- a/arch/arm/mach-spear/spear1340.c +++ b/arch/arm/mach-spear/spear1340.c @@ -19,7 +19,6 @@ static void __init spear1340_dt_init(void) { - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); platform_device_register_simple("spear-cpufreq", -1, NULL, 0); } diff --git a/arch/arm/mach-vt8500/vt8500.c b/arch/arm/mach-vt8500/vt8500.c index 3bc0dc9..773c04f 100644 --- a/arch/arm/mach-vt8500/vt8500.c +++ b/arch/arm/mach-vt8500/vt8500.c @@ -30,7 +30,6 @@ #include #include #include -#include #define LEGACY_GPIO_BASE 0xD8110000 #define LEGACY_PMC_BASE 0xD8130000 @@ -158,8 +157,6 @@ static void __init vt8500_init(void) pm_power_off = &vt8500_power_off; else pr_err("%s: PMC Hibernation register could not be remapped, not enabling power off!\n", __func__); - - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); } static const char * const vt8500_dt_compat[] = { -- cgit v0.10.2 From 9a4ef881d25957f149864bd46a2099e92ec9c53c Mon Sep 17 00:00:00 2001 From: Kefeng Wang Date: Wed, 1 Jun 2016 14:52:57 +0800 Subject: arm64: Remove unnecessary of_platform_populate with default match table After patch "of/platform: Add common method to populate default bus", it is possible for arch code to remove unnecessary callers of of_platform_populate with default match table. Acked-by: Catalin Marinas Cc: Will Deacon Cc: Arnd Bergmann Signed-off-by: Kefeng Wang Signed-off-by: Rob Herring diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c index 8412520..c907e2f 100644 --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c @@ -40,7 +40,6 @@ #include #include #include -#include #include #include @@ -301,18 +300,6 @@ void __init setup_arch(char **cmdline_p) } } -static int __init arm64_device_init(void) -{ - if (of_have_populated_dt()) { - of_platform_populate(NULL, of_default_bus_match_table, - NULL, NULL); - } else if (acpi_disabled) { - pr_crit("Device tree not populated\n"); - } - return 0; -} -arch_initcall_sync(arm64_device_init); - static int __init topology_init(void) { int i; -- cgit v0.10.2 From d8fcfb6dbba2229b29dd6b672ac6c6081c37e48c Mon Sep 17 00:00:00 2001 From: Kefeng Wang Date: Wed, 1 Jun 2016 14:52:58 +0800 Subject: c6x: Remove unnecessary of_platform_populate with default match table After patch "of/platform: Add common method to populate default bus", it is possible for arch code to remove unnecessary callers of of_platform_populate with default match table. Cc: Mikael Starvik Cc: Jesper Nilsson Signed-off-by: Kefeng Wang Signed-off-by: Rob Herring diff --git a/arch/c6x/platforms/Makefile b/arch/c6x/platforms/Makefile index 9a95b9b..5f7d934 100644 --- a/arch/c6x/platforms/Makefile +++ b/arch/c6x/platforms/Makefile @@ -4,7 +4,7 @@ # Copyright 2010, 2011 Texas Instruments Incorporated # -obj-y = platform.o cache.o megamod-pic.o pll.o plldata.o timer64.o +obj-y = cache.o megamod-pic.o pll.o plldata.o timer64.o obj-y += dscr.o # SoC objects diff --git a/arch/c6x/platforms/platform.c b/arch/c6x/platforms/platform.c deleted file mode 100644 index 26c1a35..0000000 --- a/arch/c6x/platforms/platform.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2011 Texas Instruments Incorporated - * - * This file is licensed under the terms of the GNU General Public License - * version 2. This program is licensed "as is" without any warranty of any - * kind, whether express or implied. - */ - -#include -#include - -static int __init c6x_device_probe(void) -{ - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); - return 0; -} -core_initcall(c6x_device_probe); -- cgit v0.10.2 From db41252cf8b58c8a57226204e113b9dffaebf693 Mon Sep 17 00:00:00 2001 From: Kefeng Wang Date: Wed, 1 Jun 2016 14:52:59 +0800 Subject: cris: Remove unnecessary of_platform_populate with default match table After patch "of/platform: Add common method to populate default bus", it is possible for arch code to remove unnecessary callers of of_platform_populate with default match table. Acked-by: Jesper Nilsson Cc: Mikael Starvik Cc: Jesper Nilsson Signed-off-by: Kefeng Wang Signed-off-by: Rob Herring diff --git a/arch/cris/kernel/setup.c b/arch/cris/kernel/setup.c index bb12aa9..4b4853d 100644 --- a/arch/cris/kernel/setup.c +++ b/arch/cris/kernel/setup.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include @@ -212,10 +211,3 @@ static int __init topology_init(void) } subsys_initcall(topology_init); - -static int __init cris_of_init(void) -{ - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); - return 0; -} -core_initcall(cris_of_init); -- cgit v0.10.2 From 17033917ce7b59fdc07f579693b083b39f08ff93 Mon Sep 17 00:00:00 2001 From: Kefeng Wang Date: Wed, 1 Jun 2016 14:53:00 +0800 Subject: metag: Remove unnecessary of_platform_populate with default match table After patch "of/platform: Add common method to populate default bus", it is possible for arch code to remove unnecessary callers of of_platform_populate with default match table. Cc: James Hogan Signed-off-by: Kefeng Wang Signed-off-by: Rob Herring diff --git a/arch/metag/kernel/setup.c b/arch/metag/kernel/setup.c index 31cf53d..1166f1f 100644 --- a/arch/metag/kernel/setup.c +++ b/arch/metag/kernel/setup.c @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include @@ -414,9 +413,7 @@ static int __init customize_machine(void) /* customizes platform devices, or adds new ones */ if (machine_desc->init_machine) machine_desc->init_machine(); - else - of_platform_populate(NULL, of_default_bus_match_table, NULL, - NULL); + return 0; } arch_initcall(customize_machine); -- cgit v0.10.2 From ddd0ce87bfdebbc92c639286a2bf1241f335e6c8 Mon Sep 17 00:00:00 2001 From: Kefeng Wang Date: Wed, 1 Jun 2016 14:53:01 +0800 Subject: mips: Remove unnecessary of_platform_populate with default match table After patch "of/platform: Add common method to populate default bus", it is possible for arch code to remove unnecessary callers of of_platform_populate with default match table. Cc: Ralf Baechle Cc: Alban Bedel Cc: Paul Burton Cc: James Hogan Cc: Joshua Henderson Cc: Zubair Lutfullah Kakakhel Signed-off-by: Kefeng Wang Signed-off-by: Rob Herring diff --git a/arch/mips/ath79/setup.c b/arch/mips/ath79/setup.c index 7adab18..8887eb1 100644 --- a/arch/mips/ath79/setup.c +++ b/arch/mips/ath79/setup.c @@ -17,8 +17,6 @@ #include #include #include -#include -#include #include #include @@ -285,7 +283,6 @@ void __init plat_time_init(void) static int __init ath79_setup(void) { - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); if (mips_machtype == ATH79_MACH_GENERIC_OF) return 0; diff --git a/arch/mips/jz4740/setup.c b/arch/mips/jz4740/setup.c index 510fc0d..0914ef7 100644 --- a/arch/mips/jz4740/setup.c +++ b/arch/mips/jz4740/setup.c @@ -20,7 +20,6 @@ #include #include #include -#include #include #include @@ -74,13 +73,6 @@ void __init device_tree_init(void) unflatten_and_copy_device_tree(); } -static int __init populate_machine(void) -{ - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); - return 0; -} -arch_initcall(populate_machine); - const char *get_system_type(void) { if (config_enabled(CONFIG_MACH_JZ4780)) diff --git a/arch/mips/mti-sead3/sead3-setup.c b/arch/mips/mti-sead3/sead3-setup.c index 9f2f9b2..edfcaf0 100644 --- a/arch/mips/mti-sead3/sead3-setup.c +++ b/arch/mips/mti-sead3/sead3-setup.c @@ -8,7 +8,6 @@ */ #include #include -#include #include #include @@ -107,10 +106,3 @@ void __init device_tree_init(void) unflatten_and_copy_device_tree(); } - -static int __init customize_machine(void) -{ - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); - return 0; -} -arch_initcall(customize_machine); diff --git a/arch/mips/pistachio/init.c b/arch/mips/pistachio/init.c index ab79828..c50a670 100644 --- a/arch/mips/pistachio/init.c +++ b/arch/mips/pistachio/init.c @@ -14,7 +14,6 @@ #include #include #include -#include #include #include @@ -159,15 +158,3 @@ void __init device_tree_init(void) unflatten_and_copy_device_tree(); } - -static int __init plat_of_setup(void) -{ - if (!of_have_populated_dt()) - panic("Device tree not present"); - - if (of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL)) - panic("Failed to populate DT"); - - return 0; -} -arch_initcall(plat_of_setup); diff --git a/arch/mips/xilfpga/init.c b/arch/mips/xilfpga/init.c index ce2aee2..602e384 100644 --- a/arch/mips/xilfpga/init.c +++ b/arch/mips/xilfpga/init.c @@ -10,7 +10,6 @@ */ #include -#include #include @@ -43,15 +42,3 @@ void __init device_tree_init(void) unflatten_and_copy_device_tree(); } - -static int __init plat_of_setup(void) -{ - if (!of_have_populated_dt()) - panic("Device tree not present"); - - if (of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL)) - panic("Failed to populate DT"); - - return 0; -} -arch_initcall(plat_of_setup); -- cgit v0.10.2 From 623e9ef636726280635d7bcc8f6b71794d05a57e Mon Sep 17 00:00:00 2001 From: Kefeng Wang Date: Wed, 1 Jun 2016 14:53:02 +0800 Subject: nios2: Remove unnecessary of_platform_populate with default match table After patch "of/platform: Add common method to populate default bus", it is possible for arch code to remove unnecessary callers of of_platform_populate with default match table. Cc: Ley Foon Tan Signed-off-by: Kefeng Wang Signed-off-by: Rob Herring diff --git a/arch/nios2/platform/platform.c b/arch/nios2/platform/platform.c index d478773..2a35154 100644 --- a/arch/nios2/platform/platform.c +++ b/arch/nios2/platform/platform.c @@ -9,7 +9,6 @@ */ #include -#include #include #include #include @@ -39,8 +38,7 @@ static int __init nios2_soc_device_init(void) } } - return of_platform_populate(NULL, of_default_bus_match_table, - NULL, NULL); + return 0; } device_initcall(nios2_soc_device_init); -- cgit v0.10.2 From 2b658932356c54155dfec227316eaf81b3f17d83 Mon Sep 17 00:00:00 2001 From: Kefeng Wang Date: Wed, 1 Jun 2016 14:53:03 +0800 Subject: sh: Remove unnecessary of_platform_populate with default match table After patch "of/platform: Add common method to populate default bus", it is possible for arch code to remove unnecessary callers of of_platform_populate with default match table. Cc: Yoshinori Sato Cc: Rich Felker Signed-off-by: Kefeng Wang Signed-off-by: Rob Herring diff --git a/arch/sh/boards/of-generic.c b/arch/sh/boards/of-generic.c index b4d4313..911ffb9 100644 --- a/arch/sh/boards/of-generic.c +++ b/arch/sh/boards/of-generic.c @@ -9,7 +9,6 @@ */ #include -#include #include #include #include @@ -179,16 +178,3 @@ void __init arch_init_clk_ops(struct sh_clk_ops **ops, int idx) void __init plat_irq_setup(void) { } - -static int __init sh_of_device_init(void) -{ - pr_info("SH generic board support: populating platform devices\n"); - if (of_have_populated_dt()) { - of_platform_populate(NULL, of_default_bus_match_table, - NULL, NULL); - } else { - pr_crit("Device tree not populated\n"); - } - return 0; -} -arch_initcall_sync(sh_of_device_init); -- cgit v0.10.2 From 69d99e6c0d621febb2b6a22e27c4035da970e589 Mon Sep 17 00:00:00 2001 From: Kefeng Wang Date: Wed, 1 Jun 2016 14:53:04 +0800 Subject: xtensa: Remove unnecessary of_platform_populate with default match table After patch "of/platform: Add common method to populate default bus", it is possible for arch code to remove unnecessary callers of of_platform_populate with default match table. Move of_clk_init() into time_init(), then drop xtensa_device_probe() fully. Cc: Chris Zankel Cc: Max Filippov Signed-off-by: Kefeng Wang Signed-off-by: Rob Herring diff --git a/arch/xtensa/kernel/setup.c b/arch/xtensa/kernel/setup.c index 9735691..18af563 100644 --- a/arch/xtensa/kernel/setup.c +++ b/arch/xtensa/kernel/setup.c @@ -22,10 +22,8 @@ #include #include #include -#include #include #include -#include #if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE) # include @@ -252,15 +250,6 @@ void __init early_init_devtree(void *params) strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE); } -static int __init xtensa_device_probe(void) -{ - of_clk_init(NULL); - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); - return 0; -} - -device_initcall(xtensa_device_probe); - #endif /* CONFIG_OF */ /* diff --git a/arch/xtensa/kernel/time.c b/arch/xtensa/kernel/time.c index b9ad9fe..6ec73c9 100644 --- a/arch/xtensa/kernel/time.c +++ b/arch/xtensa/kernel/time.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -148,6 +149,7 @@ void __init time_init(void) local_timer_setup(0); setup_irq(this_cpu_ptr(&ccount_timer)->evt.irq, &timer_irqaction); sched_clock_register(ccount_sched_clock_read, 32, ccount_freq); + of_clk_init(NULL); clocksource_probe(); } -- cgit v0.10.2 From 435ebcbc9fee4e8af037d293c89de60be3605c66 Mon Sep 17 00:00:00 2001 From: Kefeng Wang Date: Wed, 1 Jun 2016 14:53:05 +0800 Subject: arm: use of_platform_default_populate() to populate Use helper of_platform_default_populate() in linux/of_platform when possible, instead of calling of_platform_populate() with the default match table. Acked-by: Viresh Kumar Acked-by: Nicolas Ferre Cc: Nicolas Ferre Cc: Krzysztof Halasa Cc: Sekhar Nori Cc: Shawn Guo Cc: Russell King Cc: Roland Stigge Cc: Jason Cooper Cc: Ray Jui Cc: Viresh Kumar Cc: Stephen Warren Cc: Rob Herring Cc: Michal Simek Signed-off-by: Kefeng Wang Signed-off-by: Rob Herring diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c index 63b4fa2..d068ec3 100644 --- a/arch/arm/mach-at91/at91rm9200.c +++ b/arch/arm/mach-at91/at91rm9200.c @@ -30,7 +30,7 @@ static void __init at91rm9200_dt_device_init(void) if (soc != NULL) soc_dev = soc_device_to_device(soc); - of_platform_populate(NULL, of_default_bus_match_table, NULL, soc_dev); + of_platform_default_populate(NULL, NULL, soc_dev); at91rm9200_pm_init(); } diff --git a/arch/arm/mach-at91/at91sam9.c b/arch/arm/mach-at91/at91sam9.c index cada2a6..ba28e9c 100644 --- a/arch/arm/mach-at91/at91sam9.c +++ b/arch/arm/mach-at91/at91sam9.c @@ -61,7 +61,7 @@ static void __init at91sam9_common_init(void) if (soc != NULL) soc_dev = soc_device_to_device(soc); - of_platform_populate(NULL, of_default_bus_match_table, NULL, soc_dev); + of_platform_default_populate(NULL, NULL, soc_dev); } static void __init at91sam9_dt_device_init(void) diff --git a/arch/arm/mach-at91/sama5.c b/arch/arm/mach-at91/sama5.c index 922b85f..b272c45 100644 --- a/arch/arm/mach-at91/sama5.c +++ b/arch/arm/mach-at91/sama5.c @@ -68,7 +68,7 @@ static void __init sama5_dt_device_init(void) if (soc != NULL) soc_dev = soc_device_to_device(soc); - of_platform_populate(NULL, of_default_bus_match_table, NULL, soc_dev); + of_platform_default_populate(NULL, NULL, soc_dev); sama5_pm_init(); } diff --git a/arch/arm/mach-cns3xxx/core.c b/arch/arm/mach-cns3xxx/core.c index 9b1dc22..03da381 100644 --- a/arch/arm/mach-cns3xxx/core.c +++ b/arch/arm/mach-cns3xxx/core.c @@ -395,8 +395,7 @@ static void __init cns3xxx_init(void) pm_power_off = cns3xxx_power_off; - of_platform_populate(NULL, of_default_bus_match_table, - cns3xxx_auxdata, NULL); + of_platform_default_populate(NULL, cns3xxx_auxdata, NULL); } static const char *const cns3xxx_dt_compat[] __initconst = { diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c index cb27d56..e394070 100644 --- a/arch/arm/mach-imx/mach-imx6q.c +++ b/arch/arm/mach-imx/mach-imx6q.c @@ -278,7 +278,7 @@ static void __init imx6q_init_machine(void) imx6q_enet_phy_init(); - of_platform_populate(NULL, of_default_bus_match_table, NULL, parent); + of_platform_default_populate(NULL, NULL, parent); imx_anatop_init(); cpu_is_imx6q() ? imx6q_pm_init() : imx6dl_pm_init(); diff --git a/arch/arm/mach-imx/mach-imx6sl.c b/arch/arm/mach-imx/mach-imx6sl.c index 3003263..37ae87d 100644 --- a/arch/arm/mach-imx/mach-imx6sl.c +++ b/arch/arm/mach-imx/mach-imx6sl.c @@ -52,7 +52,7 @@ static void __init imx6sl_init_machine(void) if (parent == NULL) pr_warn("failed to initialize soc device\n"); - of_platform_populate(NULL, of_default_bus_match_table, NULL, parent); + of_platform_default_populate(NULL, NULL, parent); imx6sl_fec_init(); imx_anatop_init(); diff --git a/arch/arm/mach-imx/mach-imx6sx.c b/arch/arm/mach-imx/mach-imx6sx.c index 6a0b061..107cfc1 100644 --- a/arch/arm/mach-imx/mach-imx6sx.c +++ b/arch/arm/mach-imx/mach-imx6sx.c @@ -72,7 +72,7 @@ static void __init imx6sx_init_machine(void) if (parent == NULL) pr_warn("failed to initialize soc device\n"); - of_platform_populate(NULL, of_default_bus_match_table, NULL, parent); + of_platform_default_populate(NULL, NULL, parent); imx6sx_enet_init(); imx_anatop_init(); diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c index 2b118f2..c7bb832 100644 --- a/arch/arm/mach-integrator/integrator_ap.c +++ b/arch/arm/mach-integrator/integrator_ap.c @@ -240,8 +240,7 @@ static void __init ap_init_of(void) if (!ebi_base) return; - of_platform_populate(NULL, of_default_bus_match_table, - ap_auxdata_lookup, NULL); + of_platform_default_populate(NULL, ap_auxdata_lookup, NULL); sc_dec = readl(ap_syscon_base + INTEGRATOR_SC_DEC_OFFSET); for (i = 0; i < 4; i++) { diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c index 6f6b051..8252983 100644 --- a/arch/arm/mach-integrator/integrator_cp.c +++ b/arch/arm/mach-integrator/integrator_cp.c @@ -231,8 +231,7 @@ static void __init intcp_init_of(void) if (!intcp_con_base) return; - of_platform_populate(NULL, of_default_bus_match_table, - intcp_auxdata_lookup, NULL); + of_platform_default_populate(NULL, intcp_auxdata_lookup, NULL); } static const char * intcp_dt_board_compat[] = { diff --git a/arch/arm/mach-lpc32xx/phy3250.c b/arch/arm/mach-lpc32xx/phy3250.c index 81265e8..0e4cbbe 100644 --- a/arch/arm/mach-lpc32xx/phy3250.c +++ b/arch/arm/mach-lpc32xx/phy3250.c @@ -191,8 +191,7 @@ static void __init lpc3250_machine_init(void) LPC32XX_CLKPWR_TESTCLK_TESTCLK2_EN, LPC32XX_CLKPWR_TEST_CLK_SEL); - of_platform_populate(NULL, of_default_bus_match_table, - lpc32xx_auxdata_lookup, NULL); + of_platform_default_populate(NULL, lpc32xx_auxdata_lookup, NULL); } static const char *const lpc32xx_dt_compat[] __initconst = { diff --git a/arch/arm/mach-mvebu/kirkwood.c b/arch/arm/mach-mvebu/kirkwood.c index f9d8e1e..8f459ee 100644 --- a/arch/arm/mach-mvebu/kirkwood.c +++ b/arch/arm/mach-mvebu/kirkwood.c @@ -179,7 +179,7 @@ static void __init kirkwood_dt_init(void) kirkwood_pm_init(); kirkwood_dt_eth_fixup(); - of_platform_populate(NULL, of_default_bus_match_table, auxdata, NULL); + of_platform_default_populate(NULL, auxdata, NULL); } static const char * const kirkwood_dt_board_compat[] __initconst = { diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c index f1ea470..0b7fe74 100644 --- a/arch/arm/mach-mxs/mach-mxs.c +++ b/arch/arm/mach-mxs/mach-mxs.c @@ -498,8 +498,7 @@ static void __init mxs_machine_init(void) else if (of_machine_is_compatible("msr,m28cu3")) m28cu3_init(); - of_platform_populate(NULL, of_default_bus_match_table, - NULL, parent); + of_platform_default_populate(NULL, NULL, parent); mxs_restart_init(); diff --git a/arch/arm/mach-nspire/nspire.c b/arch/arm/mach-nspire/nspire.c index 34c2a1b3..f0808fc 100644 --- a/arch/arm/mach-nspire/nspire.c +++ b/arch/arm/mach-nspire/nspire.c @@ -57,8 +57,7 @@ static struct of_dev_auxdata nspire_auxdata[] __initdata = { static void __init nspire_init(void) { - of_platform_populate(NULL, of_default_bus_match_table, - nspire_auxdata, NULL); + of_platform_default_populate(NULL, nspire_auxdata, NULL); } static void nspire_restart(enum reboot_mode mode, const char *cmd) diff --git a/arch/arm/mach-orion5x/board-dt.c b/arch/arm/mach-orion5x/board-dt.c index 6f4c2c4..3d36f1d 100644 --- a/arch/arm/mach-orion5x/board-dt.c +++ b/arch/arm/mach-orion5x/board-dt.c @@ -63,8 +63,7 @@ static void __init orion5x_dt_init(void) if (of_machine_is_compatible("maxtor,shared-storage-2")) mss2_init(); - of_platform_populate(NULL, of_default_bus_match_table, - orion5x_auxdata_lookup, NULL); + of_platform_default_populate(NULL, orion5x_auxdata_lookup, NULL); } static const char *orion5x_dt_compat[] = { diff --git a/arch/arm/mach-spear/spear300.c b/arch/arm/mach-spear/spear300.c index 5b32edd..325b895 100644 --- a/arch/arm/mach-spear/spear300.c +++ b/arch/arm/mach-spear/spear300.c @@ -194,8 +194,7 @@ static void __init spear300_dt_init(void) pl080_plat_data.slave_channels = spear300_dma_info; pl080_plat_data.num_slave_channels = ARRAY_SIZE(spear300_dma_info); - of_platform_populate(NULL, of_default_bus_match_table, - spear300_auxdata_lookup, NULL); + of_platform_default_populate(NULL, spear300_auxdata_lookup, NULL); } static const char * const spear300_dt_board_compat[] = { diff --git a/arch/arm/mach-spear/spear310.c b/arch/arm/mach-spear/spear310.c index 86a44ac..59e173d 100644 --- a/arch/arm/mach-spear/spear310.c +++ b/arch/arm/mach-spear/spear310.c @@ -236,8 +236,7 @@ static void __init spear310_dt_init(void) pl080_plat_data.slave_channels = spear310_dma_info; pl080_plat_data.num_slave_channels = ARRAY_SIZE(spear310_dma_info); - of_platform_populate(NULL, of_default_bus_match_table, - spear310_auxdata_lookup, NULL); + of_platform_default_populate(NULL, spear310_auxdata_lookup, NULL); } static const char * const spear310_dt_board_compat[] = { diff --git a/arch/arm/mach-spear/spear320.c b/arch/arm/mach-spear/spear320.c index d45d751..0958f68 100644 --- a/arch/arm/mach-spear/spear320.c +++ b/arch/arm/mach-spear/spear320.c @@ -240,8 +240,7 @@ static void __init spear320_dt_init(void) pl080_plat_data.slave_channels = spear320_dma_info; pl080_plat_data.num_slave_channels = ARRAY_SIZE(spear320_dma_info); - of_platform_populate(NULL, of_default_bus_match_table, - spear320_auxdata_lookup, NULL); + of_platform_default_populate(NULL, spear320_auxdata_lookup, NULL); } static const char * const spear320_dt_board_compat[] = { diff --git a/arch/arm/mach-spear/spear6xx.c b/arch/arm/mach-spear/spear6xx.c index da26fa5b..ccf3573 100644 --- a/arch/arm/mach-spear/spear6xx.c +++ b/arch/arm/mach-spear/spear6xx.c @@ -411,8 +411,7 @@ struct of_dev_auxdata spear6xx_auxdata_lookup[] __initdata = { static void __init spear600_dt_init(void) { - of_platform_populate(NULL, of_default_bus_match_table, - spear6xx_auxdata_lookup, NULL); + of_platform_default_populate(NULL, spear6xx_auxdata_lookup, NULL); } static const char *spear600_dt_board_compat[] = { diff --git a/arch/arm/mach-tegra/tegra.c b/arch/arm/mach-tegra/tegra.c index 2378fa56..6745a65 100644 --- a/arch/arm/mach-tegra/tegra.c +++ b/arch/arm/mach-tegra/tegra.c @@ -115,7 +115,7 @@ static void __init tegra_dt_init(void) * devices */ out: - of_platform_populate(NULL, of_default_bus_match_table, NULL, parent); + of_platform_default_populate(NULL, NULL, parent); } static void __init paz00_init(void) diff --git a/arch/arm/mach-u300/core.c b/arch/arm/mach-u300/core.c index 546338b..a4910ea 100644 --- a/arch/arm/mach-u300/core.c +++ b/arch/arm/mach-u300/core.c @@ -391,8 +391,7 @@ static void __init u300_init_machine_dt(void) pinctrl_register_mappings(u300_pinmux_map, ARRAY_SIZE(u300_pinmux_map)); - of_platform_populate(NULL, of_default_bus_match_table, - u300_auxdata_lookup, NULL); + of_platform_default_populate(NULL, u300_auxdata_lookup, NULL); /* Enable SEMI self refresh */ val = readw(syscon_base + U300_SYSCON_SMCR) | diff --git a/arch/arm/mach-versatile/versatile_dt.c b/arch/arm/mach-versatile/versatile_dt.c index d643b92..3c8d39c 100644 --- a/arch/arm/mach-versatile/versatile_dt.c +++ b/arch/arm/mach-versatile/versatile_dt.c @@ -344,8 +344,7 @@ static void __init versatile_dt_init(void) versatile_dt_pci_init(); - of_platform_populate(NULL, of_default_bus_match_table, - versatile_auxdata_lookup, NULL); + of_platform_default_populate(NULL, versatile_auxdata_lookup, NULL); } static const char *const versatile_dt_match[] __initconst = { diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c index da876d2..d12002c 100644 --- a/arch/arm/mach-zynq/common.c +++ b/arch/arm/mach-zynq/common.c @@ -141,7 +141,7 @@ out: * Finished with the static registrations now; fill in the missing * devices */ - of_platform_populate(NULL, of_default_bus_match_table, NULL, parent); + of_platform_default_populate(NULL, NULL, parent); platform_device_register(&zynq_cpuidle_device); } -- cgit v0.10.2 From 1a1d2f9968660e016883b21c499158c08d9c87bf Mon Sep 17 00:00:00 2001 From: Kefeng Wang Date: Wed, 1 Jun 2016 14:53:06 +0800 Subject: mips: use of_platform_default_populate() to populate default bus Use helper of_platform_default_populate() in linux/of_platform when possible, instead of calling of_platform_populate() with the default match table. Cc: Joshua Henderson Cc: Ralf Baechle Signed-off-by: Kefeng Wang Signed-off-by: Rob Herring diff --git a/arch/mips/pic32/pic32mzda/init.c b/arch/mips/pic32/pic32mzda/init.c index 775ff90..77ecf32 100644 --- a/arch/mips/pic32/pic32mzda/init.c +++ b/arch/mips/pic32/pic32mzda/init.c @@ -147,8 +147,7 @@ static int __init plat_of_setup(void) panic("Device tree not present"); pic32_of_prepare_platform_data(pic32_auxdata_lookup); - if (of_platform_populate(NULL, of_default_bus_match_table, - pic32_auxdata_lookup, NULL)) + if (of_platform_default_populate(NULL, pic32_auxdata_lookup, NULL)) panic("Failed to populate DT"); return 0; -- cgit v0.10.2 From 39ec8d3809fdf5228f9cb9fa3d3f2bfb4ee57956 Mon Sep 17 00:00:00 2001 From: Kefeng Wang Date: Wed, 1 Jun 2016 14:53:07 +0800 Subject: bus: imx-weim: use of_platform_default_populate() to populate default bus Use helper of_platform_default_populate() in linux/of_platform when possible, instead of calling of_platform_populate() with the default match table. Acked-by: Shawn Guo Cc: Signed-off-by: Huang Shijie Cc: Shawn Guo Signed-off-by: Kefeng Wang Signed-off-by: Rob Herring diff --git a/drivers/bus/imx-weim.c b/drivers/bus/imx-weim.c index 1827fc4..4bd361d 100644 --- a/drivers/bus/imx-weim.c +++ b/drivers/bus/imx-weim.c @@ -163,9 +163,8 @@ static int __init weim_parse_dt(struct platform_device *pdev, } if (have_child) - ret = of_platform_populate(pdev->dev.of_node, - of_default_bus_match_table, - NULL, &pdev->dev); + ret = of_platform_default_populate(pdev->dev.of_node, + NULL, &pdev->dev); if (ret) dev_err(&pdev->dev, "%s fail to create devices.\n", pdev->dev.of_node->full_name); -- cgit v0.10.2 From 2cf669243ecb6c1bf0d39e54710c4c24ef0ab4da Mon Sep 17 00:00:00 2001 From: Kefeng Wang Date: Wed, 1 Jun 2016 14:53:08 +0800 Subject: bus: uniphier-system-bus: use of_platform_default_populate() to populate default bus Use helper of_platform_default_populate() in linux/of_platform when possible, instead of calling of_platform_populate() with the default match table. Acked-by: Masahiro Yamada Cc: Masahiro Yamada Signed-off-by: Kefeng Wang Signed-off-by: Rob Herring diff --git a/drivers/bus/uniphier-system-bus.c b/drivers/bus/uniphier-system-bus.c index 350b730..1e6e0269 100644 --- a/drivers/bus/uniphier-system-bus.c +++ b/drivers/bus/uniphier-system-bus.c @@ -257,8 +257,7 @@ static int uniphier_system_bus_probe(struct platform_device *pdev) uniphier_system_bus_set_reg(priv); /* Now, the bus is configured. Populate platform_devices below it */ - return of_platform_populate(dev->of_node, of_default_bus_match_table, - NULL, dev); + return of_platform_default_populate(dev->of_node, NULL, dev); } static const struct of_device_id uniphier_system_bus_match[] = { -- cgit v0.10.2 From 9f2c519c9f27d804b54422afd31a17335b32a556 Mon Sep 17 00:00:00 2001 From: Kefeng Wang Date: Wed, 1 Jun 2016 14:53:09 +0800 Subject: memory: omap-gpmc: use of_platform_default_populate() to populate default bus Use helper of_platform_default_populate() in linux/of_platform when possible, instead of calling of_platform_populate() with the default match table. Acked-by: Roger Quadros Cc: Roger Quadros Cc: Tony Lindgren Signed-off-by: Kefeng Wang Signed-off-by: Rob Herring diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c index af4884b..4b1913a 100644 --- a/drivers/memory/omap-gpmc.c +++ b/drivers/memory/omap-gpmc.c @@ -2134,8 +2134,7 @@ no_timings: /* is child a common bus? */ if (of_match_node(of_default_bus_match_table, child)) /* create children and other common bus children */ - if (of_platform_populate(child, of_default_bus_match_table, - NULL, &pdev->dev)) + if (of_platform_default_populate(child, NULL, &pdev->dev)) goto err_child_fail; return 0; -- cgit v0.10.2 From 146dedbcabd89461faaa85a82e50b2fdd6b24683 Mon Sep 17 00:00:00 2001 From: Kefeng Wang Date: Wed, 1 Jun 2016 14:53:10 +0800 Subject: of: unittest: use of_platform_default_populate() to populate default bus Use helper of_platform_default_populate() in linux/of_platform when possible, instead of calling of_platform_populate() with the default match table. Cc: Rob Herring Cc: Frank Rowand Cc: Grant Likely Signed-off-by: Kefeng Wang Signed-off-by: Rob Herring diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c index f34ed93..53c83d6 100644 --- a/drivers/of/unittest.c +++ b/drivers/of/unittest.c @@ -771,7 +771,7 @@ static void __init of_unittest_platform_populate(void) }; np = of_find_node_by_path("/testcase-data"); - of_platform_populate(np, of_default_bus_match_table, NULL, NULL); + of_platform_default_populate(np, NULL, NULL); /* Test that a missing irq domain returns -EPROBE_DEFER */ np = of_find_node_by_path("/testcase-data/testcase-device1"); @@ -1871,8 +1871,7 @@ static void __init of_unittest_overlay(void) goto out; } - ret = of_platform_populate(bus_np, of_default_bus_match_table, - NULL, NULL); + ret = of_platform_default_populate(bus_np, NULL, NULL); if (ret != 0) { unittest(0, "could not populate bus @ \"%s\"\n", bus_path); goto out; -- cgit v0.10.2 From e1bcbee6f95301197e1039b4e4104cbdc4a332a6 Mon Sep 17 00:00:00 2001 From: Kefeng Wang Date: Wed, 1 Jun 2016 14:53:11 +0800 Subject: Revert "of/platform: export of_default_bus_match_table" This reverts commit b80443c2211c7daaabd20fbbe9e7beb3fa3408e0. After covering to use helper of_platform_default_populate() to populate the default bus, no need to export of_default_bus_match_table anymore. Reviewed-by: Masahiro Yamada Cc: Masahiro Yamada Cc: Rob Herring Cc: Frank Rowand Cc: Grant Likely Signed-off-by: Kefeng Wang Signed-off-by: Rob Herring diff --git a/drivers/of/platform.c b/drivers/of/platform.c index c559ef8..153dbe1 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -31,7 +31,6 @@ const struct of_device_id of_default_bus_match_table[] = { #endif /* CONFIG_ARM_AMBA */ {} /* Empty terminated list */ }; -EXPORT_SYMBOL(of_default_bus_match_table); static int of_dev_node_match(struct device *dev, void *data) { -- cgit v0.10.2 From d9fc880723321dbf16b2981e3f3e916b73942210 Mon Sep 17 00:00:00 2001 From: Frank Rowand Date: Thu, 16 Jun 2016 10:51:46 -0700 Subject: of: fix memory leak related to safe_name() Fix a memory leak resulting from memory allocation in safe_name(). This patch fixes all call sites of safe_name(). Mathieu Malaterre reported the memory leak on boot: On my PowerMac device-tree would generate a duplicate name: [ 0.023043] device-tree: Duplicate name in PowerPC,G4@0, renamed to "l2-cache#1" in this case a newly allocated name is generated by `safe_name`. However in this case it is never deallocated. The bug was found using kmemleak reported as: unreferenced object 0xdf532e60 (size 32): comm "swapper", pid 1, jiffies 4294892300 (age 1993.532s) hex dump (first 32 bytes): 6c 32 2d 63 61 63 68 65 23 31 00 dd e4 dd 1e c2 l2-cache#1...... ec d4 ba ce 04 ec cc de 8e 85 e9 ca c4 ec cc 9e ................ backtrace: [] kvasprintf+0x64/0xc8 [] kasprintf+0x4c/0x5c [] safe_name.isra.1+0x80/0xc4 [] __of_attach_node_sysfs+0x6c/0x11c [] of_core_init+0x8c/0xf8 [] kernel_init_freeable+0xd4/0x208 [] kernel_init+0x24/0x11c [] ret_from_kernel_thread+0x5c/0x64 Link: https://bugzilla.kernel.org/show_bug.cgi?id=120331 Signed-off-by: Frank Rowand Reported-by: mathieu.malaterre@gmail.com Tested-by: Mathieu Malaterre Cc: stable@vger.kernel.org Signed-off-by: Rob Herring diff --git a/drivers/of/base.c b/drivers/of/base.c index ebf84e3..8bb3d1a 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -112,6 +112,7 @@ static ssize_t of_node_property_read(struct file *filp, struct kobject *kobj, return memory_read_from_buffer(buf, count, &offset, pp->value, pp->length); } +/* always return newly allocated name, caller must free after use */ static const char *safe_name(struct kobject *kobj, const char *orig_name) { const char *name = orig_name; @@ -126,9 +127,12 @@ static const char *safe_name(struct kobject *kobj, const char *orig_name) name = kasprintf(GFP_KERNEL, "%s#%i", orig_name, ++i); } - if (name != orig_name) + if (name == orig_name) { + name = kstrdup(orig_name, GFP_KERNEL); + } else { pr_warn("device-tree: Duplicate name in %s, renamed to \"%s\"\n", kobject_name(kobj), name); + } return name; } @@ -159,6 +163,7 @@ int __of_add_property_sysfs(struct device_node *np, struct property *pp) int __of_attach_node_sysfs(struct device_node *np) { const char *name; + struct kobject *parent; struct property *pp; int rc; @@ -171,15 +176,16 @@ int __of_attach_node_sysfs(struct device_node *np) np->kobj.kset = of_kset; if (!np->parent) { /* Nodes without parents are new top level trees */ - rc = kobject_add(&np->kobj, NULL, "%s", - safe_name(&of_kset->kobj, "base")); + name = safe_name(&of_kset->kobj, "base"); + parent = NULL; } else { name = safe_name(&np->parent->kobj, kbasename(np->full_name)); - if (!name || !name[0]) - return -EINVAL; - - rc = kobject_add(&np->kobj, &np->parent->kobj, "%s", name); + parent = &np->parent->kobj; } + if (!name) + return -ENOMEM; + rc = kobject_add(&np->kobj, parent, "%s", name); + kfree(name); if (rc) return rc; @@ -1815,6 +1821,12 @@ int __of_remove_property(struct device_node *np, struct property *prop) return 0; } +void __of_sysfs_remove_bin_file(struct device_node *np, struct property *prop) +{ + sysfs_remove_bin_file(&np->kobj, &prop->attr); + kfree(prop->attr.attr.name); +} + void __of_remove_property_sysfs(struct device_node *np, struct property *prop) { if (!IS_ENABLED(CONFIG_SYSFS)) @@ -1822,7 +1834,7 @@ void __of_remove_property_sysfs(struct device_node *np, struct property *prop) /* at early boot, bail here and defer setup to of_init() */ if (of_kset && of_node_is_attached(np)) - sysfs_remove_bin_file(&np->kobj, &prop->attr); + __of_sysfs_remove_bin_file(np, prop); } /** @@ -1895,7 +1907,7 @@ void __of_update_property_sysfs(struct device_node *np, struct property *newprop return; if (oldprop) - sysfs_remove_bin_file(&np->kobj, &oldprop->attr); + __of_sysfs_remove_bin_file(np, oldprop); __of_add_property_sysfs(np, newprop); } diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c index 3033fa3..a201559 100644 --- a/drivers/of/dynamic.c +++ b/drivers/of/dynamic.c @@ -55,7 +55,7 @@ void __of_detach_node_sysfs(struct device_node *np) /* only remove properties if on sysfs */ if (of_node_is_attached(np)) { for_each_property_of_node(np, pp) - sysfs_remove_bin_file(&np->kobj, &pp->attr); + __of_sysfs_remove_bin_file(np, pp); kobject_del(&np->kobj); } diff --git a/drivers/of/of_private.h b/drivers/of/of_private.h index 829469f..18bbb451 100644 --- a/drivers/of/of_private.h +++ b/drivers/of/of_private.h @@ -83,6 +83,9 @@ extern int __of_attach_node_sysfs(struct device_node *np); extern void __of_detach_node(struct device_node *np); extern void __of_detach_node_sysfs(struct device_node *np); +extern void __of_sysfs_remove_bin_file(struct device_node *np, + struct property *prop); + /* iterators for transactions, used for overlays */ /* forward iterator */ #define for_each_transaction_entry(_oft, _te) \ -- cgit v0.10.2 From 15cc2ed6dcf91a8658e084be4e140147161819d7 Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Mon, 20 Jun 2016 14:49:18 +0100 Subject: of/irq: Mark initialised interrupt controllers as populated For interrupt controllers successfully initialised early via device-tree, mark these interrupt controllers as populated so we don't unnecessarily create a device and populate any platform data later on in the boot sequence when we populate all the various platform devices. Signed-off-by: Jon Hunter Signed-off-by: Rob Herring diff --git a/drivers/of/irq.c b/drivers/of/irq.c index 6ec743f..1b58cd5 100644 --- a/drivers/of/irq.c +++ b/drivers/of/irq.c @@ -557,6 +557,8 @@ void __init of_irq_init(const struct of_device_id *matches) * its children can get processed in a subsequent pass. */ list_add_tail(&desc->list, &intc_parent_list); + + of_node_set_flag(desc->dev, OF_POPULATED); } /* Get the next pending parent that might have children */ -- cgit v0.10.2 From 606ad42aa3b1fe8bb122305bef5aea79a6cef54b Mon Sep 17 00:00:00 2001 From: Rob Herring Date: Wed, 15 Jun 2016 08:32:18 -0500 Subject: of: use pr_fmt prefix for all console printing Clean-up all the DT printk functions to use common pr_fmt prefix. Some print statements such as kmalloc errors were redundant, so just drop those. Cc: Frank Rowand Cc: Pantelis Antoniou Reviewed-by: Frank Rowand Signed-off-by: Rob Herring diff --git a/drivers/of/address.c b/drivers/of/address.c index 0a553c0..02b2903 100644 --- a/drivers/of/address.c +++ b/drivers/of/address.c @@ -1,4 +1,6 @@ +#define pr_fmt(fmt) "OF: " fmt + #include #include #include @@ -24,10 +26,10 @@ static int __of_address_to_resource(struct device_node *dev, #ifdef DEBUG static void of_dump_addr(const char *s, const __be32 *addr, int na) { - printk(KERN_DEBUG "%s", s); + pr_debug("%s", s); while (na--) - printk(" %08x", be32_to_cpu(*(addr++))); - printk("\n"); + pr_cont(" %08x", be32_to_cpu(*(addr++))); + pr_cont("\n"); } #else static void of_dump_addr(const char *s, const __be32 *addr, int na) { } @@ -68,7 +70,7 @@ static u64 of_bus_default_map(__be32 *addr, const __be32 *range, s = of_read_number(range + na + pna, ns); da = of_read_number(addr, na); - pr_debug("OF: default map, cp=%llx, s=%llx, da=%llx\n", + pr_debug("default map, cp=%llx, s=%llx, da=%llx\n", (unsigned long long)cp, (unsigned long long)s, (unsigned long long)da); @@ -156,7 +158,7 @@ static u64 of_bus_pci_map(__be32 *addr, const __be32 *range, int na, int ns, s = of_read_number(range + na + pna, ns); da = of_read_number(addr + 1, na - 1); - pr_debug("OF: PCI map, cp=%llx, s=%llx, da=%llx\n", + pr_debug("PCI map, cp=%llx, s=%llx, da=%llx\n", (unsigned long long)cp, (unsigned long long)s, (unsigned long long)da); @@ -381,7 +383,7 @@ static u64 of_bus_isa_map(__be32 *addr, const __be32 *range, int na, int ns, s = of_read_number(range + na + pna, ns); da = of_read_number(addr + 1, na - 1); - pr_debug("OF: ISA map, cp=%llx, s=%llx, da=%llx\n", + pr_debug("ISA map, cp=%llx, s=%llx, da=%llx\n", (unsigned long long)cp, (unsigned long long)s, (unsigned long long)da); @@ -504,17 +506,17 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus, */ ranges = of_get_property(parent, rprop, &rlen); if (ranges == NULL && !of_empty_ranges_quirk(parent)) { - pr_debug("OF: no ranges; cannot translate\n"); + pr_debug("no ranges; cannot translate\n"); return 1; } if (ranges == NULL || rlen == 0) { offset = of_read_number(addr, na); memset(addr, 0, pna * 4); - pr_debug("OF: empty ranges; 1:1 translation\n"); + pr_debug("empty ranges; 1:1 translation\n"); goto finish; } - pr_debug("OF: walking ranges...\n"); + pr_debug("walking ranges...\n"); /* Now walk through the ranges */ rlen /= 4; @@ -525,14 +527,14 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus, break; } if (offset == OF_BAD_ADDR) { - pr_debug("OF: not found !\n"); + pr_debug("not found !\n"); return 1; } memcpy(addr, ranges + na, 4 * pna); finish: - of_dump_addr("OF: parent translation for:", addr, pna); - pr_debug("OF: with offset: %llx\n", (unsigned long long)offset); + of_dump_addr("parent translation for:", addr, pna); + pr_debug("with offset: %llx\n", (unsigned long long)offset); /* Translate it into parent bus space */ return pbus->translate(addr, offset, pna); @@ -557,7 +559,7 @@ static u64 __of_translate_address(struct device_node *dev, int na, ns, pna, pns; u64 result = OF_BAD_ADDR; - pr_debug("OF: ** translation for device %s **\n", of_node_full_name(dev)); + pr_debug("** translation for device %s **\n", of_node_full_name(dev)); /* Increase refcount at current level */ of_node_get(dev); @@ -571,14 +573,14 @@ static u64 __of_translate_address(struct device_node *dev, /* Count address cells & copy address locally */ bus->count_cells(dev, &na, &ns); if (!OF_CHECK_COUNTS(na, ns)) { - pr_debug("OF: Bad cell count for %s\n", of_node_full_name(dev)); + pr_debug("Bad cell count for %s\n", of_node_full_name(dev)); goto bail; } memcpy(addr, in_addr, na * 4); - pr_debug("OF: bus is %s (na=%d, ns=%d) on %s\n", + pr_debug("bus is %s (na=%d, ns=%d) on %s\n", bus->name, na, ns, of_node_full_name(parent)); - of_dump_addr("OF: translating address:", addr, na); + of_dump_addr("translating address:", addr, na); /* Translate */ for (;;) { @@ -589,7 +591,7 @@ static u64 __of_translate_address(struct device_node *dev, /* If root, we have finished */ if (parent == NULL) { - pr_debug("OF: reached root node\n"); + pr_debug("reached root node\n"); result = of_read_number(addr, na); break; } @@ -598,12 +600,12 @@ static u64 __of_translate_address(struct device_node *dev, pbus = of_match_bus(parent); pbus->count_cells(dev, &pna, &pns); if (!OF_CHECK_COUNTS(pna, pns)) { - pr_err("prom_parse: Bad cell count for %s\n", + pr_err("Bad cell count for %s\n", of_node_full_name(dev)); break; } - pr_debug("OF: parent bus is %s (na=%d, ns=%d) on %s\n", + pr_debug("parent bus is %s (na=%d, ns=%d) on %s\n", pbus->name, pna, pns, of_node_full_name(parent)); /* Apply bus translation */ @@ -615,7 +617,7 @@ static u64 __of_translate_address(struct device_node *dev, ns = pns; bus = pbus; - of_dump_addr("OF: one level translation:", addr, na); + of_dump_addr("one level translation:", addr, na); } bail: of_node_put(parent); @@ -853,8 +855,7 @@ int of_dma_get_range(struct device_node *np, u64 *dma_addr, u64 *paddr, u64 *siz } if (!ranges) { - pr_debug("%s: no dma-ranges found for node(%s)\n", - __func__, np->full_name); + pr_debug("no dma-ranges found for node(%s)\n", np->full_name); ret = -ENODEV; goto out; } @@ -871,8 +872,8 @@ int of_dma_get_range(struct device_node *np, u64 *dma_addr, u64 *paddr, u64 *siz dmaaddr = of_read_number(ranges, naddr); *paddr = of_translate_dma_address(np, ranges); if (*paddr == OF_BAD_ADDR) { - pr_err("%s: translation of DMA address(%pad) to CPU address failed node(%s)\n", - __func__, dma_addr, np->full_name); + pr_err("translation of DMA address(%pad) to CPU address failed node(%s)\n", + dma_addr, np->full_name); ret = -EINVAL; goto out; } diff --git a/drivers/of/base.c b/drivers/of/base.c index 8bb3d1a..a4b6087 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -17,6 +17,9 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ + +#define pr_fmt(fmt) "OF: " fmt + #include #include #include @@ -130,7 +133,7 @@ static const char *safe_name(struct kobject *kobj, const char *orig_name) if (name == orig_name) { name = kstrdup(orig_name, GFP_KERNEL); } else { - pr_warn("device-tree: Duplicate name in %s, renamed to \"%s\"\n", + pr_warn("Duplicate name in %s, renamed to \"%s\"\n", kobject_name(kobj), name); } return name; @@ -204,7 +207,7 @@ void __init of_core_init(void) of_kset = kset_create_and_add("devicetree", NULL, firmware_kobj); if (!of_kset) { mutex_unlock(&of_mutex); - pr_err("devicetree: failed to register existing nodes\n"); + pr_err("failed to register existing nodes\n"); return; } for_each_of_allnodes(np) @@ -2269,8 +2272,8 @@ struct device_node *of_graph_get_next_endpoint(const struct device_node *parent, of_node_put(node); if (!port) { - pr_err("%s(): no port node found in %s\n", - __func__, parent->full_name); + pr_err("graph: no port node found in %s\n", + parent->full_name); return NULL; } } else { diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c index a201559..888fdbc 100644 --- a/drivers/of/dynamic.c +++ b/drivers/of/dynamic.c @@ -6,6 +6,8 @@ * device tree nodes. */ +#define pr_fmt(fmt) "OF: " fmt + #include #include #include @@ -96,13 +98,13 @@ int of_reconfig_notify(unsigned long action, struct of_reconfig_data *p) switch (action) { case OF_RECONFIG_ATTACH_NODE: case OF_RECONFIG_DETACH_NODE: - pr_debug("of/notify %-15s %s\n", action_names[action], + pr_debug("notify %-15s %s\n", action_names[action], pr->dn->full_name); break; case OF_RECONFIG_ADD_PROPERTY: case OF_RECONFIG_REMOVE_PROPERTY: case OF_RECONFIG_UPDATE_PROPERTY: - pr_debug("of/notify %-15s %s:%s\n", action_names[action], + pr_debug("notify %-15s %s:%s\n", action_names[action], pr->dn->full_name, pr->prop->name); break; @@ -460,12 +462,12 @@ static void __of_changeset_entry_dump(struct of_changeset_entry *ce) case OF_RECONFIG_ADD_PROPERTY: case OF_RECONFIG_REMOVE_PROPERTY: case OF_RECONFIG_UPDATE_PROPERTY: - pr_debug("of/cset<%p> %-15s %s/%s\n", ce, action_names[ce->action], + pr_debug("cset<%p> %-15s %s/%s\n", ce, action_names[ce->action], ce->np->full_name, ce->prop->name); break; case OF_RECONFIG_ATTACH_NODE: case OF_RECONFIG_DETACH_NODE: - pr_debug("of/cset<%p> %-15s %s\n", ce, action_names[ce->action], + pr_debug("cset<%p> %-15s %s\n", ce, action_names[ce->action], ce->np->full_name); break; } @@ -531,13 +533,13 @@ static void __of_changeset_entry_notify(struct of_changeset_entry *ce, bool reve ret = of_property_notify(ce->action, ce->np, ce->prop, ce->old_prop); break; default: - pr_err("%s: invalid devicetree changeset action: %i\n", __func__, + pr_err("invalid devicetree changeset action: %i\n", (int)ce->action); return; } if (ret) - pr_err("%s: notifier error @%s\n", __func__, ce->np->full_name); + pr_err("changeset notifier error @%s\n", ce->np->full_name); } static int __of_changeset_entry_apply(struct of_changeset_entry *ce) @@ -568,8 +570,8 @@ static int __of_changeset_entry_apply(struct of_changeset_entry *ce) ret = __of_add_property(ce->np, ce->prop); if (ret) { - pr_err("%s: add_property failed @%s/%s\n", - __func__, ce->np->full_name, + pr_err("changeset: add_property failed @%s/%s\n", + ce->np->full_name, ce->prop->name); break; } @@ -577,8 +579,8 @@ static int __of_changeset_entry_apply(struct of_changeset_entry *ce) case OF_RECONFIG_REMOVE_PROPERTY: ret = __of_remove_property(ce->np, ce->prop); if (ret) { - pr_err("%s: remove_property failed @%s/%s\n", - __func__, ce->np->full_name, + pr_err("changeset: remove_property failed @%s/%s\n", + ce->np->full_name, ce->prop->name); break; } @@ -596,8 +598,8 @@ static int __of_changeset_entry_apply(struct of_changeset_entry *ce) ret = __of_update_property(ce->np, ce->prop, &old_prop); if (ret) { - pr_err("%s: update_property failed @%s/%s\n", - __func__, ce->np->full_name, + pr_err("changeset: update_property failed @%s/%s\n", + ce->np->full_name, ce->prop->name); break; } @@ -677,24 +679,24 @@ int __of_changeset_apply(struct of_changeset *ocs) int ret; /* perform the rest of the work */ - pr_debug("of_changeset: applying...\n"); + pr_debug("changeset: applying...\n"); list_for_each_entry(ce, &ocs->entries, node) { ret = __of_changeset_entry_apply(ce); if (ret) { - pr_err("%s: Error applying changeset (%d)\n", __func__, ret); + pr_err("Error applying changeset (%d)\n", ret); list_for_each_entry_continue_reverse(ce, &ocs->entries, node) __of_changeset_entry_revert(ce); return ret; } } - pr_debug("of_changeset: applied, emitting notifiers.\n"); + pr_debug("changeset: applied, emitting notifiers.\n"); /* drop the global lock while emitting notifiers */ mutex_unlock(&of_mutex); list_for_each_entry(ce, &ocs->entries, node) __of_changeset_entry_notify(ce, 0); mutex_lock(&of_mutex); - pr_debug("of_changeset: notifiers sent.\n"); + pr_debug("changeset: notifiers sent.\n"); return 0; } @@ -728,24 +730,24 @@ int __of_changeset_revert(struct of_changeset *ocs) struct of_changeset_entry *ce; int ret; - pr_debug("of_changeset: reverting...\n"); + pr_debug("changeset: reverting...\n"); list_for_each_entry_reverse(ce, &ocs->entries, node) { ret = __of_changeset_entry_revert(ce); if (ret) { - pr_err("%s: Error reverting changeset (%d)\n", __func__, ret); + pr_err("Error reverting changeset (%d)\n", ret); list_for_each_entry_continue(ce, &ocs->entries, node) __of_changeset_entry_apply(ce); return ret; } } - pr_debug("of_changeset: reverted, emitting notifiers.\n"); + pr_debug("changeset: reverted, emitting notifiers.\n"); /* drop the global lock while emitting notifiers */ mutex_unlock(&of_mutex); list_for_each_entry_reverse(ce, &ocs->entries, node) __of_changeset_entry_notify(ce, 1); mutex_lock(&of_mutex); - pr_debug("of_changeset: notifiers sent.\n"); + pr_debug("changeset: notifiers sent.\n"); return 0; } @@ -795,10 +797,9 @@ int of_changeset_action(struct of_changeset *ocs, unsigned long action, struct of_changeset_entry *ce; ce = kzalloc(sizeof(*ce), GFP_KERNEL); - if (!ce) { - pr_err("%s: Failed to allocate\n", __func__); + if (!ce) return -ENOMEM; - } + /* get a reference to the node */ ce->action = action; ce->np = of_node_get(np); diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 33daffc..a0a7b76 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -9,6 +9,8 @@ * version 2 as published by the Free Software Foundation. */ +#define pr_fmt(fmt) "OF: fdt:" fmt + #include #include #include @@ -182,14 +184,12 @@ static void populate_properties(const void *blob, val = fdt_getprop_by_offset(blob, cur, &pname, &sz); if (!val) { - pr_warn("%s: Cannot locate property at 0x%x\n", - __func__, cur); + pr_warn("Cannot locate property at 0x%x\n", cur); continue; } if (!pname) { - pr_warn("%s: Cannot find property name at 0x%x\n", - __func__, cur); + pr_warn("Cannot find property name at 0x%x\n", cur); continue; } @@ -439,7 +439,7 @@ static int unflatten_dt_nodes(const void *blob, } if (offset < 0 && offset != -FDT_ERR_NOTFOUND) { - pr_err("%s: Error %d processing FDT\n", __func__, offset); + pr_err("Error %d processing FDT\n", offset); return -EINVAL; } @@ -1281,7 +1281,7 @@ static int __init of_fdt_raw_init(void) if (of_fdt_crc32 != crc32_be(~0, initial_boot_params, fdt_totalsize(initial_boot_params))) { - pr_warn("fdt: not creating '/sys/firmware/fdt': CRC check failed\n"); + pr_warn("not creating '/sys/firmware/fdt': CRC check failed\n"); return 0; } of_fdt_raw_attr.size = fdt_totalsize(initial_boot_params); diff --git a/drivers/of/fdt_address.c b/drivers/of/fdt_address.c index dca8f9b..843a542 100644 --- a/drivers/of/fdt_address.c +++ b/drivers/of/fdt_address.c @@ -12,6 +12,9 @@ * the Free Software Foundation; either version 2, or (at your option) * any later version. */ + +#define pr_fmt(fmt) "OF: fdt: " fmt + #include #include #include @@ -30,7 +33,7 @@ static void __init of_dump_addr(const char *s, const __be32 *addr, int na) pr_debug("%s", s); while(na--) pr_cont(" %08x", *(addr++)); - pr_debug("\n"); + pr_cont("\n"); } #else static void __init of_dump_addr(const char *s, const __be32 *addr, int na) { } @@ -77,7 +80,7 @@ static u64 __init fdt_bus_default_map(__be32 *addr, const __be32 *range, s = of_read_number(range + na + pna, ns); da = of_read_number(addr, na); - pr_debug("FDT: default map, cp=%llx, s=%llx, da=%llx\n", + pr_debug("default map, cp=%llx, s=%llx, da=%llx\n", cp, s, da); if (da < cp || da >= (cp + s)) @@ -123,11 +126,11 @@ static int __init fdt_translate_one(const void *blob, int parent, if (rlen == 0) { offset = of_read_number(addr, na); memset(addr, 0, pna * 4); - pr_debug("FDT: empty ranges, 1:1 translation\n"); + pr_debug("empty ranges, 1:1 translation\n"); goto finish; } - pr_debug("FDT: walking ranges...\n"); + pr_debug("walking ranges...\n"); /* Now walk through the ranges */ rlen /= 4; @@ -138,14 +141,14 @@ static int __init fdt_translate_one(const void *blob, int parent, break; } if (offset == OF_BAD_ADDR) { - pr_debug("FDT: not found !\n"); + pr_debug("not found !\n"); return 1; } memcpy(addr, ranges + na, 4 * pna); finish: - of_dump_addr("FDT: parent translation for:", addr, pna); - pr_debug("FDT: with offset: %llx\n", offset); + of_dump_addr("parent translation for:", addr, pna); + pr_debug("with offset: %llx\n", offset); /* Translate it into parent bus space */ return pbus->translate(addr, offset, pna); @@ -170,12 +173,12 @@ static u64 __init fdt_translate_address(const void *blob, int node_offset) int na, ns, pna, pns; u64 result = OF_BAD_ADDR; - pr_debug("FDT: ** translation for device %s **\n", + pr_debug("** translation for device %s **\n", fdt_get_name(blob, node_offset, NULL)); reg = fdt_getprop(blob, node_offset, "reg", &len); if (!reg) { - pr_err("FDT: warning: device tree node '%s' has no address.\n", + pr_err("warning: device tree node '%s' has no address.\n", fdt_get_name(blob, node_offset, NULL)); goto bail; } @@ -189,15 +192,15 @@ static u64 __init fdt_translate_address(const void *blob, int node_offset) /* Cound address cells & copy address locally */ bus->count_cells(blob, parent, &na, &ns); if (!OF_CHECK_COUNTS(na, ns)) { - pr_err("FDT: Bad cell count for %s\n", + pr_err("Bad cell count for %s\n", fdt_get_name(blob, node_offset, NULL)); goto bail; } memcpy(addr, reg, na * 4); - pr_debug("FDT: bus (na=%d, ns=%d) on %s\n", + pr_debug("bus (na=%d, ns=%d) on %s\n", na, ns, fdt_get_name(blob, parent, NULL)); - of_dump_addr("OF: translating address:", addr, na); + of_dump_addr("translating address:", addr, na); /* Translate */ for (;;) { @@ -207,7 +210,7 @@ static u64 __init fdt_translate_address(const void *blob, int node_offset) /* If root, we have finished */ if (parent < 0) { - pr_debug("FDT: reached root node\n"); + pr_debug("reached root node\n"); result = of_read_number(addr, na); break; } @@ -216,12 +219,12 @@ static u64 __init fdt_translate_address(const void *blob, int node_offset) pbus = &of_busses[0]; pbus->count_cells(blob, parent, &pna, &pns); if (!OF_CHECK_COUNTS(pna, pns)) { - pr_err("FDT: Bad cell count for %s\n", + pr_err("Bad cell count for %s\n", fdt_get_name(blob, node_offset, NULL)); break; } - pr_debug("FDT: parent bus (na=%d, ns=%d) on %s\n", + pr_debug("parent bus (na=%d, ns=%d) on %s\n", pna, pns, fdt_get_name(blob, parent, NULL)); /* Apply bus translation */ @@ -234,7 +237,7 @@ static u64 __init fdt_translate_address(const void *blob, int node_offset) ns = pns; bus = pbus; - of_dump_addr("FDT: one level translation:", addr, na); + of_dump_addr("one level translation:", addr, na); } bail: return result; diff --git a/drivers/of/irq.c b/drivers/of/irq.c index 1b58cd5..89a71c6 100644 --- a/drivers/of/irq.c +++ b/drivers/of/irq.c @@ -18,6 +18,8 @@ * driver. */ +#define pr_fmt(fmt) "OF: " fmt + #include #include #include diff --git a/drivers/of/of_pci.c b/drivers/of/of_pci.c index 13f4fed..589b30c 100644 --- a/drivers/of/of_pci.c +++ b/drivers/of/of_pci.c @@ -1,3 +1,5 @@ +#define pr_fmt(fmt) "OF: PCI: " fmt + #include #include #include @@ -138,7 +140,7 @@ void of_pci_check_probe_only(void) else pci_clear_flags(PCI_PROBE_ONLY); - pr_info("PCI: PROBE_ONLY %sabled\n", val ? "en" : "dis"); + pr_info("PROBE_ONLY %sabled\n", val ? "en" : "dis"); } EXPORT_SYMBOL_GPL(of_pci_check_probe_only); @@ -181,7 +183,7 @@ int of_pci_get_host_bridge_resources(struct device_node *dev, if (!bus_range) return -ENOMEM; - pr_info("PCI host bridge %s ranges:\n", dev->full_name); + pr_info("host bridge %s ranges:\n", dev->full_name); err = of_pci_parse_bus_range(dev, bus_range); if (err) { diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c index 2166482..eed7886 100644 --- a/drivers/of/of_reserved_mem.c +++ b/drivers/of/of_reserved_mem.c @@ -13,6 +13,8 @@ * License or (at your optional) any later version of the license. */ +#define pr_fmt(fmt) "OF: reserved mem: " fmt + #include #include #include @@ -75,7 +77,7 @@ void __init fdt_reserved_mem_save_node(unsigned long node, const char *uname, struct reserved_mem *rmem = &reserved_mem[reserved_mem_count]; if (reserved_mem_count == ARRAY_SIZE(reserved_mem)) { - pr_err("Reserved memory: not enough space all defined regions.\n"); + pr_err("not enough space all defined regions.\n"); return; } @@ -108,8 +110,7 @@ static int __init __reserved_mem_alloc_size(unsigned long node, return -EINVAL; if (len != dt_root_size_cells * sizeof(__be32)) { - pr_err("Reserved memory: invalid size property in '%s' node.\n", - uname); + pr_err("invalid size property in '%s' node.\n", uname); return -EINVAL; } size = dt_mem_next_cell(dt_root_size_cells, &prop); @@ -119,7 +120,7 @@ static int __init __reserved_mem_alloc_size(unsigned long node, prop = of_get_flat_dt_prop(node, "alignment", &len); if (prop) { if (len != dt_root_addr_cells * sizeof(__be32)) { - pr_err("Reserved memory: invalid alignment property in '%s' node.\n", + pr_err("invalid alignment property in '%s' node.\n", uname); return -EINVAL; } @@ -141,7 +142,7 @@ static int __init __reserved_mem_alloc_size(unsigned long node, if (prop) { if (len % t_len != 0) { - pr_err("Reserved memory: invalid alloc-ranges property in '%s', skipping node.\n", + pr_err("invalid alloc-ranges property in '%s', skipping node.\n", uname); return -EINVAL; } @@ -156,7 +157,7 @@ static int __init __reserved_mem_alloc_size(unsigned long node, ret = early_init_dt_alloc_reserved_memory_arch(size, align, start, end, nomap, &base); if (ret == 0) { - pr_debug("Reserved memory: allocated memory for '%s' node: base %pa, size %ld MiB\n", + pr_debug("allocated memory for '%s' node: base %pa, size %ld MiB\n", uname, &base, (unsigned long)size / SZ_1M); break; @@ -168,13 +169,12 @@ static int __init __reserved_mem_alloc_size(unsigned long node, ret = early_init_dt_alloc_reserved_memory_arch(size, align, 0, 0, nomap, &base); if (ret == 0) - pr_debug("Reserved memory: allocated memory for '%s' node: base %pa, size %ld MiB\n", + pr_debug("allocated memory for '%s' node: base %pa, size %ld MiB\n", uname, &base, (unsigned long)size / SZ_1M); } if (base == 0) { - pr_info("Reserved memory: failed to allocate memory for node '%s'\n", - uname); + pr_info("failed to allocate memory for node '%s'\n", uname); return -ENOMEM; } @@ -203,7 +203,7 @@ static int __init __reserved_mem_init_node(struct reserved_mem *rmem) continue; if (initfn(rmem) == 0) { - pr_info("Reserved memory: initialized node %s, compatible id %s\n", + pr_info("initialized node %s, compatible id %s\n", rmem->name, compat); return 0; } @@ -245,7 +245,7 @@ static void __init __rmem_check_for_overlap(void) this_end = this->base + this->size; next_end = next->base + next->size; - pr_err("Reserved memory: OVERLAP DETECTED!\n%s (%pa--%pa) overlaps with %s (%pa--%pa)\n", + pr_err("OVERLAP DETECTED!\n%s (%pa--%pa) overlaps with %s (%pa--%pa)\n", this->name, &this->base, &this_end, next->name, &next->base, &next_end); } diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c index 8225081..318dbb5 100644 --- a/drivers/of/overlay.c +++ b/drivers/of/overlay.c @@ -8,7 +8,9 @@ * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. */ -#undef DEBUG + +#define pr_fmt(fmt) "OF: overlay: " fmt + #include #include #include @@ -137,8 +139,8 @@ static int of_overlay_apply_one(struct of_overlay *ov, for_each_property_of_node(overlay, prop) { ret = of_overlay_apply_single_property(ov, target, prop); if (ret) { - pr_err("%s: Failed to apply prop @%s/%s\n", - __func__, target->full_name, prop->name); + pr_err("Failed to apply prop @%s/%s\n", + target->full_name, prop->name); return ret; } } @@ -146,9 +148,8 @@ static int of_overlay_apply_one(struct of_overlay *ov, for_each_child_of_node(overlay, child) { ret = of_overlay_apply_single_device_node(ov, target, child); if (ret != 0) { - pr_err("%s: Failed to apply single node @%s/%s\n", - __func__, target->full_name, - child->name); + pr_err("Failed to apply single node @%s/%s\n", + target->full_name, child->name); of_node_put(child); return ret; } @@ -176,8 +177,7 @@ static int of_overlay_apply(struct of_overlay *ov) err = of_overlay_apply_one(ov, ovinfo->target, ovinfo->overlay); if (err != 0) { - pr_err("%s: overlay failed '%s'\n", - __func__, ovinfo->target->full_name); + pr_err("apply failed '%s'\n", ovinfo->target->full_name); return err; } } @@ -208,7 +208,7 @@ static struct device_node *find_target_node(struct device_node *info_node) if (ret == 0) return of_find_node_by_path(path); - pr_err("%s: Failed to find target for node %p (%s)\n", __func__, + pr_err("Failed to find target for node %p (%s)\n", info_node, info_node->name); return NULL; @@ -355,8 +355,6 @@ int of_overlay_create(struct device_node *tree) id = idr_alloc(&ov_idr, ov, 0, 0, GFP_KERNEL); if (id < 0) { - pr_err("%s: idr_alloc() failed for tree@%s\n", - __func__, tree->full_name); err = id; goto err_destroy_trans; } @@ -365,26 +363,21 @@ int of_overlay_create(struct device_node *tree) /* build the overlay info structures */ err = of_build_overlay_info(ov, tree); if (err) { - pr_err("%s: of_build_overlay_info() failed for tree@%s\n", - __func__, tree->full_name); + pr_err("of_build_overlay_info() failed for tree@%s\n", + tree->full_name); goto err_free_idr; } /* apply the overlay */ err = of_overlay_apply(ov); - if (err) { - pr_err("%s: of_overlay_apply() failed for tree@%s\n", - __func__, tree->full_name); + if (err) goto err_abort_trans; - } /* apply the changeset */ err = __of_changeset_apply(&ov->cset); - if (err) { - pr_err("%s: __of_changeset_apply() failed for tree@%s\n", - __func__, tree->full_name); + if (err) goto err_revert_overlay; - } + /* add to the tail of the overlay list */ list_add_tail(&ov->node, &ov_list); @@ -469,8 +462,7 @@ static int overlay_removal_is_ok(struct of_overlay *ov) list_for_each_entry(ce, &ov->cset.entries, node) { if (!overlay_is_topmost(ov, ce->np)) { - pr_err("%s: overlay #%d is not topmost\n", - __func__, ov->id); + pr_err("overlay #%d is not topmost\n", ov->id); return 0; } } @@ -496,16 +488,13 @@ int of_overlay_destroy(int id) ov = idr_find(&ov_idr, id); if (ov == NULL) { err = -ENODEV; - pr_err("%s: Could not find overlay #%d\n", - __func__, id); + pr_err("destroy: Could not find overlay #%d\n", id); goto out; } /* check whether the overlay is safe to remove */ if (!overlay_removal_is_ok(ov)) { err = -EBUSY; - pr_err("%s: removal check failed for overlay #%d\n", - __func__, id); goto out; } diff --git a/drivers/of/platform.c b/drivers/of/platform.c index 153dbe1..765390e 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -11,6 +11,9 @@ * 2 of the License, or (at your option) any later version. * */ + +#define pr_fmt(fmt) "OF: " fmt + #include #include #include @@ -233,11 +236,8 @@ static struct amba_device *of_amba_device_create(struct device_node *node, return NULL; dev = amba_device_alloc(NULL, 0, 0); - if (!dev) { - pr_err("%s(): amba_device_alloc() failed for %s\n", - __func__, node->full_name); + if (!dev) goto err_clear_flag; - } /* setup generic device info */ dev->dev.of_node = of_node_get(node); @@ -260,15 +260,15 @@ static struct amba_device *of_amba_device_create(struct device_node *node, ret = of_address_to_resource(node, 0, &dev->res); if (ret) { - pr_err("%s(): of_address_to_resource() failed (%d) for %s\n", - __func__, ret, node->full_name); + pr_err("amba: of_address_to_resource() failed (%d) for %s\n", + ret, node->full_name); goto err_free; } ret = amba_device_add(dev, &iomem_resource); if (ret) { - pr_err("%s(): amba_device_add() failed (%d) for %s\n", - __func__, ret, node->full_name); + pr_err("amba_device_add() failed (%d) for %s\n", + ret, node->full_name); goto err_free; } diff --git a/drivers/of/resolver.c b/drivers/of/resolver.c index d313d49..7414611 100644 --- a/drivers/of/resolver.c +++ b/drivers/of/resolver.c @@ -9,6 +9,8 @@ * version 2 as published by the Free Software Foundation. */ +#define pr_fmt(fmt) "OF: resolver: " fmt + #include #include #include -- cgit v0.10.2 From 0102788f3c44e6a4bdfc6346d4f025d2a3a0d795 Mon Sep 17 00:00:00 2001 From: Aaro Koskinen Date: Thu, 9 Jun 2016 23:37:28 +0300 Subject: Documentation/devicetree: document cavium-pip rx-delay/tx-delay properties Document cavium-pip rx-delay/tx-delay properties. Currently the board specific values need to be hardcoded in the platform code, which we want to avoid when moving to DT-only booting. Signed-off-by: Aaro Koskinen Acked-by: Rob Herring Signed-off-by: Rob Herring diff --git a/Documentation/devicetree/bindings/net/cavium-pip.txt b/Documentation/devicetree/bindings/net/cavium-pip.txt index 7dbd158..e3b8fe71 100644 --- a/Documentation/devicetree/bindings/net/cavium-pip.txt +++ b/Documentation/devicetree/bindings/net/cavium-pip.txt @@ -37,6 +37,12 @@ Properties for PIP port which is a child the PIP interface: - phy-handle: Optional, see ethernet.txt file in the same directory. +- rx-delay: Delay value for RGMII receive clock. Optional. Disabled if 0. + Value range is 1-31, and mapping to the actual delay varies depending on HW. + +- tx-delay: Delay value for RGMII transmit clock. Optional. Disabled if 0. + Value range is 1-31, and mapping to the actual delay varies depending on HW. + Example: pip@11800a0000000 { -- cgit v0.10.2 From 4b681efc027821ad601fc76b6cdb25e95575449f Mon Sep 17 00:00:00 2001 From: "mathieu.poirier@linaro.org" Date: Wed, 22 Jun 2016 09:01:03 -0600 Subject: coresight: document binding acronyms It can be hard for people not familiar with the CoreSight IP blocks to make sense of the acronyms found in the current bindings. As such this patch expands each acronym in the hope of providing a better description of the IP block they represent. Signed-off-by: Mathieu Poirier Acked-by: Sudeep Holla Reviewed-by: Suzuki K Poulose Signed-off-by: Rob Herring diff --git a/Documentation/devicetree/bindings/arm/coresight.txt b/Documentation/devicetree/bindings/arm/coresight.txt index 93147c0c..fcbae6a 100644 --- a/Documentation/devicetree/bindings/arm/coresight.txt +++ b/Documentation/devicetree/bindings/arm/coresight.txt @@ -12,14 +12,33 @@ its hardware characteristcs. * compatible: These have to be supplemented with "arm,primecell" as drivers are using the AMBA bus interface. Possible values include: - - "arm,coresight-etb10", "arm,primecell"; - - "arm,coresight-tpiu", "arm,primecell"; - - "arm,coresight-tmc", "arm,primecell"; - - "arm,coresight-funnel", "arm,primecell"; - - "arm,coresight-etm3x", "arm,primecell"; - - "arm,coresight-etm4x", "arm,primecell"; - - "qcom,coresight-replicator1x", "arm,primecell"; - - "arm,coresight-stm", "arm,primecell"; [1] + - Embedded Trace Buffer (version 1.0): + "arm,coresight-etb10", "arm,primecell"; + + - Trace Port Interface Unit: + "arm,coresight-tpiu", "arm,primecell"; + + - Trace Memory Controller, used for Embedded Trace Buffer(ETB), + Embedded Trace FIFO(ETF) and Embedded Trace Router(ETR) + configuration. The configuration mode (ETB, ETF, ETR) is + discovered at boot time when the device is probed. + "arm,coresight-tmc", "arm,primecell"; + + - Trace Funnel: + "arm,coresight-funnel", "arm,primecell"; + + - Embedded Trace Macrocell (version 3.x) and + Program Flow Trace Macrocell: + "arm,coresight-etm3x", "arm,primecell"; + + - Embedded Trace Macrocell (version 4.x): + "arm,coresight-etm4x", "arm,primecell"; + + - Qualcomm Configurable Replicator (version 1.x): + "qcom,coresight-replicator1x", "arm,primecell"; + + - System Trace Macrocell: + "arm,coresight-stm", "arm,primecell"; [1] * reg: physical base address and length of the register set(s) of the component. -- cgit v0.10.2 From 5de3bbc8501b637eb753e4ee18a2cccb233cfe41 Mon Sep 17 00:00:00 2001 From: Michal Suchanek Date: Sun, 26 Jun 2016 22:11:58 +0200 Subject: of: overlay: add resolver error prints Applying overlay fails silently in case of an error. Add error prints. Most notably the lack of symbols in the live tree is not reported. Signed-off-by: Michal Suchanek Signed-off-by: Rob Herring diff --git a/drivers/of/resolver.c b/drivers/of/resolver.c index 7414611..46325d6 100644 --- a/drivers/of/resolver.c +++ b/drivers/of/resolver.c @@ -315,6 +315,11 @@ int of_resolve_phandles(struct device_node *resolve) phandle phandle, phandle_delta; int err; + if (!resolve) + pr_err("%s: null node\n", __func__); + if (resolve && !of_node_check_flag(resolve, OF_DETACHED)) + pr_err("%s: node %s not detached\n", __func__, + resolve->full_name); /* the resolve node must exist, and be detached */ if (!resolve || !of_node_check_flag(resolve, OF_DETACHED)) return -EINVAL; @@ -371,6 +376,7 @@ int of_resolve_phandles(struct device_node *resolve) /* we need to fixup, but no root symbols... */ if (!root_sym) { + pr_err("%s: no symbols in root of device tree.\n", __func__); err = -EINVAL; goto out; } -- cgit v0.10.2 From 1d1bde550ea3b08a95bd9b6b3adb6d7cd3781870 Mon Sep 17 00:00:00 2001 From: Michal Suchanek Date: Tue, 19 Jul 2016 00:01:12 +0200 Subject: of: fdt: mark unflattened tree as detached The tree returned from of_fdt_unflatten_tree cannot be attached to the live tree because it is not marked as detached so mark it as such. The dt resolver checks the flag and refuses to process the tree otherwise. Signed-off-by: Michal Suchanek Signed-off-by: Rob Herring diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index a0a7b76..ae4d07b 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -472,7 +472,8 @@ static int unflatten_dt_nodes(const void *blob, static void *__unflatten_device_tree(const void *blob, struct device_node *dad, struct device_node **mynodes, - void *(*dt_alloc)(u64 size, u64 align)) + void *(*dt_alloc)(u64 size, u64 align), + bool detached) { int size; void *mem; @@ -516,6 +517,11 @@ static void *__unflatten_device_tree(const void *blob, pr_warning("End of tree marker overwritten: %08x\n", be32_to_cpup(mem + size)); + if (detached) { + of_node_set_flag(*mynodes, OF_DETACHED); + pr_debug("unflattened tree is detached\n"); + } + pr_debug(" <- unflatten_device_tree()\n"); return mem; } @@ -548,7 +554,8 @@ void *of_fdt_unflatten_tree(const unsigned long *blob, void *mem; mutex_lock(&of_fdt_unflatten_mutex); - mem = __unflatten_device_tree(blob, dad, mynodes, &kernel_tree_alloc); + mem = __unflatten_device_tree(blob, dad, mynodes, &kernel_tree_alloc, + true); mutex_unlock(&of_fdt_unflatten_mutex); return mem; @@ -1224,7 +1231,7 @@ bool __init early_init_dt_scan(void *params) void __init unflatten_device_tree(void) { __unflatten_device_tree(initial_boot_params, NULL, &of_root, - early_init_dt_alloc_memory_arch); + early_init_dt_alloc_memory_arch, false); /* Get pointer to "/chosen" and "/aliases" nodes for use everywhere */ of_alias_scan(early_init_dt_alloc_memory_arch); -- cgit v0.10.2 From ca0cd118a15f9a1e25fa6086543ab49ddd96df99 Mon Sep 17 00:00:00 2001 From: Gaurav Minocha Date: Tue, 19 Jul 2016 19:37:44 -0700 Subject: scripts/dtc: dt_to_config - kernel config options for a devicetree Determining which kernel config options need to be enabled for a given devicetree can be a painful process. Create a new tool to find the drivers that may match a devicetree node compatible, find the kernel config options that enable the driver, and optionally report whether the kernel config option is enabled. Signed-off-by: Gaurav Minocha Signed-off-by: Frank Rowand Signed-off-by: Rob Herring diff --git a/scripts/dtc/dt_to_config b/scripts/dtc/dt_to_config new file mode 100755 index 0000000..9a248b5 --- /dev/null +++ b/scripts/dtc/dt_to_config @@ -0,0 +1,1213 @@ +#!/usr/bin/perl + +# Copyright 2016 by Frank Rowand +# Copyright 2016 by Gaurav Minocha +# +# This file is subject to the terms and conditions of the GNU General Public +# License v2. + +use strict 'refs'; +use strict subs; + +use Getopt::Long; + +$VUFX = "160610a"; + +$script_name = $0; +$script_name =~ s|^.*/||; + + +# ----- constants for print_flags() + +# Position in string $pr_flags. Range of 0..($num_pr_flags - 1). +$pr_flag_pos_mcompatible = 0; +$pr_flag_pos_driver = 1; +$pr_flag_pos_mdriver = 2; +$pr_flag_pos_config = 3; +$pr_flag_pos_mconfig = 4; +$pr_flag_pos_node_not_enabled = 5; +$pr_flag_pos_white_list = 6; +$pr_flag_pos_hard_coded = 7; +$pr_flag_pos_config_hard_coded = 8; +$pr_flag_pos_config_none = 9; +$pr_flag_pos_config_m = 10; +$pr_flag_pos_config_y = 11; +$pr_flag_pos_config_test_fail = 12; + +$num_pr_flags = $pr_flag_pos_config_test_fail + 1; + +# flags in @pr_flag_value must be unique values to allow simple regular +# expessions to work for --include_flags and --exclude_flags. +# Convention: use upper case letters for potential issues or problems. + +@pr_flag_value = ('M', 'd', 'D', 'c', 'C', 'E', 'W', 'H', 'x', 'n', 'm', 'y', 'F'); + +@pr_flag_help = ( + "multiple compatibles found for this node", + "driver found for this compatible", + "multiple drivers found for this compatible", + "kernel config found for this driver", + "multiple config options found for this driver", + "node is not enabled", + "compatible is white listed", + "matching driver and/or kernel config is hard coded", + "kernel config hard coded in Makefile", + "one or more kernel config file options is not set", + "one or more kernel config file options is set to 'm'", + "one or more kernel config file options is set to 'y'", + "one of more kernel config file options fails to have correct value" +); + + +# ----- + +%driver_config = (); # driver config array, indexed by driver source file +%driver_count = (); # driver_cnt, indexed by compatible +%compat_driver = (); # compatible driver array, indexed by compatible +%existing_config = (); # existing config symbols present in given config file + # expected values are: "y", "m", a decimal number, a + # hex number, or a string + +# ----- magic compatibles, do not have a driver +# +# Will not search for drivers for these compatibles. + +%compat_white_list = ( + 'none' => '1', + 'pci' => '1', + 'simple-bus' => '1', +); + +# Will not search for drivers for these compatibles. +# +# These compatibles have a very large number of false positives. +# +# 'hardcoded_no_driver' is a magic value. Other code knows this +# magic value. Do not use 'no_driver' here! +# +# Revisit each 'hardcoded_no_driver' to see how the compatible +# is used. Are there drivers that can be provided? + +%driver_hard_code_list = ( + 'cache' => ['hardcoded_no_driver'], + 'eeprom' => ['hardcoded_no_driver'], + 'gpio' => ['hardcoded_no_driver'], + 'gpio-keys' => ['drivers/input/keyboard/gpio_keys.c'], + 'i2c-gpio' => ['drivers/i2c/busses/i2c-gpio.c'], + 'isa' => ['arch/mips/mti-malta/malta-dt.c', + 'arch/x86/kernel/devicetree.c'], + 'led' => ['hardcoded_no_driver'], + 'm25p32' => ['hardcoded_no_driver'], + 'm25p64' => ['hardcoded_no_driver'], + 'm25p80' => ['hardcoded_no_driver'], + 'mtd-ram' => ['drivers/mtd/maps/physmap_of.c'], + 'pwm-backlight' => ['drivers/video/backlight/pwm_bl.c'], + 'spidev' => ['hardcoded_no_driver'], + 'syscon' => ['drivers/mfd/syscon.c'], + 'tlv320aic23' => ['hardcoded_no_driver'], + 'wm8731' => ['hardcoded_no_driver'], +); + +# Use these config options instead of searching makefiles + +%driver_config_hard_code_list = ( + + # this one needed even if %driver_hard_code_list is empty + 'no_driver' => ['no_config'], + 'hardcoded_no_driver' => ['no_config'], + + # drivers/usb/host/ehci-ppc-of.c + # drivers/usb/host/ehci-xilinx-of.c + # are included from: + # drivers/usb/host/ehci-hcd.c + # thus the search of Makefile for the included .c files is incorrect + # ehci-hcd.c wraps the includes with ifdef CONFIG_USB_EHCI_HCD_..._OF + # + # similar model for ohci-hcd.c (but no ohci-xilinx-of.c) + # + # similarly, uhci-hcd.c includes uhci-platform.c + + 'drivers/usb/host/ehci-ppc-of.c' => ['CONFIG_USB_EHCI_HCD', + 'CONFIG_USB_EHCI_HCD_PPC_OF'], + 'drivers/usb/host/ohci-ppc-of.c' => ['CONFIG_USB_OHCI_HCD', + 'CONFIG_USB_OHCI_HCD_PPC_OF'], + + 'drivers/usb/host/ehci-xilinx-of.c' => ['CONFIG_USB_EHCI_HCD', + 'CONFIG_USB_EHCI_HCD_XILINX'], + + 'drivers/usb/host/uhci-platform.c' => ['CONFIG_USB_UHCI_HCD', + 'CONFIG_USB_UHCI_PLATFORM'], + + # scan_makefile will find only one of these config options: + # ifneq ($(CONFIG_SOC_IMX6)$(CONFIG_SOC_LS1021A),) + 'arch/arm/mach-imx/platsmp.c' => ['CONFIG_SOC_IMX6 && CONFIG_SMP', + 'CONFIG_SOC_LS1021A && CONFIG_SMP'], +); + + +# 'virt/kvm/arm/.*' are controlled by makefiles in other directories, +# using relative paths, such as 'KVM := ../../../virt/kvm'. Do not +# add complexity to find_kconfig() to deal with this. There is a long +# term intent to change the kvm related makefiles to the normal kernel +# style. After that is done, this entry can be removed from the +# black_list_driver. + +@black_list_driver = ( + # kvm no longer a problem after commit 503a62862e8f in 4.7-rc1 + # 'virt/kvm/arm/.*', +); + + +sub usage() +{ + print +" +Usage: $script_name [options] device-tree... + + device_tree is: dts_file | dtb_file | proc_device-tree + + +Valid options: + -c FILE Read kernel config options from FILE + --config FILE synonym for 'c' + --config-format config file friendly output format + --exclude-flag FLAG exclude entries with a matching flag + -h Display this message and exit + --help synonym for 'h' + --black-list-driver use driver black list + --white-list-config use config white list + --white-list-driver use driver white list + --include-flag FLAG include only entries with a matching flag + --include-suspect include only entries with an uppercase flag + --short-name do not show the path portion of the node name + --show-lists report of white and black lists + --version Display program version and exit + + + Report driver source files that match the compatibles in the device + tree file and the kernel config options that enable the driver source + files. + + This program must be run in the root directory of a Linux kernel + source tree. + + The default format is a report that is intended to be easily human + scannable. + + An alternate format can be selected by --config-format. This will + create output that can easily be edited to create a fragment that can + be appended to the existing kernel config file. Each entry consists of + multiple lines. The first line reports flags, the node path, compatible + value, driver file matching the compatible, configuration options, and + current values of the configuration options. For each configuration + option, the following lines report the current value and the value that + is required for the driver file to be included in the kernel. + + If a large number of drivers or config options is listed for a node, + and the '$pr_flag_value[$pr_flag_pos_hard_coded]' flag is set consider using --white-list-config and/or + --white-list-driver. If the white list option suppresses the correct + entry please report that as a bug. + + CAUTION: + This program uses heuristics to guess which driver(s) support each + compatible string and which config option(s) enables the driver(s). + Do not believe that the reported information is fully correct. + This program is intended to aid the process of determining the + proper kernel configuration for a device tree, but this is not + a fully automated process -- human involvement may still be + required! + + The driver match heuristic used is to search for source files + containing the compatible string enclosed in quotes. + + This program might not be able to find all drivers matching a + compatible string. + + Some makefiles are overly clever. This program was not made + complex enough to handle them. If no config option is listed + for a driver, look at the makefile for the driver source file. + Even if a config option is listed for a driver, some other + available config options may not be listed. + + FLAG values: +"; + + for ($k = 0; $k < $num_pr_flags; $k++) { + printf " %s %s\n", $pr_flag_value[$k], $pr_flag_help[$k]; + } + + print +" + Upper case letters indicate potential issues or problems. + + The flag: + +"; + + $k = $pr_flag_pos_hard_coded; + printf " %s %s\n", $pr_flag_value[$k], $pr_flag_help[$k]; + + print +" + will be set if the config or driver is in the white lists, even if + --white-list-config and --white-list-driver are not specified. + This is a hint that 1) many of these reported lines are likely to + be incorrect, and 2) using those options will reduce the number of + drivers and/or config options reported. + + --white-list-config and --white-list-driver may not be accurate if this + program is not well maintained. Use them with appropriate skepticism. + Use the --show-lists option to report the values in the list. + + Return value: + 0 if no error + 1 error processing command line + 2 unable to open or read kernel config file + 3 unable to open or process input device tree file(s) + + EXAMPLES: + + dt_to_config arch/arm/boot/dts/my_dts_file.dts + + Basic report. + + dt_to_config \\ + --config \${KBUILD_OUTPUT}/.config \\ + arch/\${ARCH}/boot/dts/my_dts_file.dts + + Full report, with config file issues noted. + + dt_to_config --include-suspect \\ + --config \${KBUILD_OUTPUT}/.config \\ + arch/\${ARCH}/boot/dts/my_dts_file.dts + + Report of node / compatible string / driver tuples that should + be further investigated. A node may have multiple compatible + strings. A compatible string may be matched by multiple drivers. + A driver may have config file issues noted. The compatible string + and/or driver may be in the white lists. + + dt_to_config --include-suspect --config-format \\ + --config ${KBUILD_OUTPUT}/.config \\ + arch/\${ARCH}/boot/dts/my_dts_file.dts + + Report of node / compatible string / driver tuples that should + be further investigated. The report can be edited to uncomment + the config options to select the desired tuple for a given node. + A node may have multiple compatible strings. A compatible string + may be matched by multiple drivers. A driver may have config file + issues noted. The compatible string and/or driver may be in the + white lists. + +"; +} + +sub set_flag() +{ + # pr_flags_ref is a reference to $pr_flags + + my $pr_flags_ref = shift; + my $pos = shift; + + substr $$pr_flags_ref, $pos, 1, $pr_flag_value[$pos]; + + return $pr_flags; +} + +sub print_flags() +{ + # return 1 if anything printed, else 0 + + # some fields of pn_arg_ref might not be used in this function, but + # extract all of them anyway. + my $pn_arg_ref = shift; + + my $compat = $pn_arg_ref->{compat}; + my $compatible_cnt = $pn_arg_ref->{compatible_cnt}; + my $config = $pn_arg_ref->{config}; + my $config_cnt = $pn_arg_ref->{config_cnt}; + my $driver = $pn_arg_ref->{driver}; + my $driver_cnt = $pn_arg_ref->{driver_cnt}; + my $full_node = $pn_arg_ref->{full_node}; + my $node = $pn_arg_ref->{node}; + my $node_enabled = $pn_arg_ref->{node_enabled}; + my $white_list = $pn_arg_ref->{white_list}; + + my $pr_flags = '-' x $num_pr_flags; + + + # ----- set flags in $pr_flags + + if ($compatible_cnt > 1) { + &set_flag(\$pr_flags, $pr_flag_pos_mcompatible); + } + + if ($config_cnt > 1) { + &set_flag(\$pr_flags, $pr_flag_pos_mconfig); + } + + if ($driver_cnt >= 1) { + &set_flag(\$pr_flags, $pr_flag_pos_driver); + } + + if ($driver_cnt > 1) { + &set_flag(\$pr_flags, $pr_flag_pos_mdriver); + } + + # These strings are the same way the linux kernel tests. + # The ePapr lists of values is slightly different. + if (!( + ($node_enabled eq "") || + ($node_enabled eq "ok") || + ($node_enabled eq "okay") + )) { + &set_flag(\$pr_flags, $pr_flag_pos_node_not_enabled); + } + + if ($white_list) { + &set_flag(\$pr_flags, $pr_flag_pos_white_list); + } + + if (exists($driver_hard_code_list{$compat}) || + (exists($driver_config_hard_code_list{$driver}) && + ($driver ne "no_driver"))) { + &set_flag(\$pr_flags, $pr_flag_pos_hard_coded); + } + + my @configs = split(' && ', $config); + for $configs (@configs) { + $not = $configs =~ /^!/; + $configs =~ s/^!//; + + if (($configs ne "no_config") && ($configs ne "no_makefile")) { + &set_flag(\$pr_flags, $pr_flag_pos_config); + } + + if (($config_cnt >= 1) && + ($configs !~ /CONFIG_/) && + (($configs ne "no_config") && ($configs ne "no_makefile"))) { + &set_flag(\$pr_flags, $pr_flag_pos_config_hard_coded); + } + + my $existing_config = $existing_config{$configs}; + if ($existing_config eq "m") { + &set_flag(\$pr_flags, $pr_flag_pos_config_m); + # Possible fail, depends on whether built in or + # module is desired. + &set_flag(\$pr_flags, $pr_flag_pos_config_test_fail); + } elsif ($existing_config eq "y") { + &set_flag(\$pr_flags, $pr_flag_pos_config_y); + if ($not) { + &set_flag(\$pr_flags, $pr_flag_pos_config_test_fail); + } + } elsif (($config_file) && ($configs =~ /CONFIG_/)) { + &set_flag(\$pr_flags, $pr_flag_pos_config_none); + if (!$not) { + &set_flag(\$pr_flags, $pr_flag_pos_config_test_fail); + } + } + } + + # ----- include / exclude filters + + if ($include_flag_pattern && ($pr_flags !~ m/$include_flag_pattern/)) { + return 0; + } + + if ($exclude_flag_pattern && ($pr_flags =~ m/$exclude_flag_pattern/)) { + return 0; + } + + if ($config_format) { + print "# "; + } + print "$pr_flags : "; + + return 1; +} + + +sub print_node() +{ + # return number of lines printed + + # some fields of pn_arg_ref might not be used in this function, but + # extract all of them anyway. + my $pn_arg_ref = shift; + + my $compat = $pn_arg_ref->{compat}; + my $compatible_cnt = $pn_arg_ref->{compatible_cnt}; + my $config = $pn_arg_ref->{config}; + my $config_cnt = $pn_arg_ref->{config_cnt}; + my $driver = $pn_arg_ref->{driver}; + my $driver_cnt = $pn_arg_ref->{driver_cnt}; + my $full_node = $pn_arg_ref->{full_node}; + my $node = $pn_arg_ref->{node}; + my $node_enabled = $pn_arg_ref->{node_enabled}; + my $white_list = $pn_arg_ref->{white_list}; + + my $separator; + + if (! &print_flags($pn_arg_ref)) { + return 0; + } + + + if ($short_name) { + print "$node"; + } else { + print "$full_node"; + } + print " : $compat : $driver : $config : "; + + my @configs = split(' && ', $config); + + if ($config_file) { + for $configs (@configs) { + $configs =~ s/^!//; + my $existing_config = $existing_config{$configs}; + if (!$existing_config) { + # check for /-m/, /-y/, or /-objs/ + if ($configs !~ /CONFIG_/) { + $existing_config = "x"; + }; + }; + if ($existing_config) { + print "$separator", "$existing_config"; + $separator = ", "; + } else { + print "$separator", "n"; + $separator = ", "; + } + } + } else { + print "none"; + } + + print "\n"; + + if ($config_format) { + for $configs (@configs) { + $not = $configs =~ /^!/; + $configs =~ s/^!//; + my $existing_config = $existing_config{$configs}; + + if ($not) { + if ($configs !~ /CONFIG_/) { + print "# $configs\n"; + } elsif ($existing_config eq "m") { + print "# $configs is m\n"; + print "# $configs=n\n"; + } elsif ($existing_config eq "y") { + print "# $configs is set\n"; + print "# $configs=n\n"; + } else { + print "# $configs is not set\n"; + print "# $configs=n\n"; + } + + } else { + if ($configs !~ /CONFIG_/) { + print "# $configs\n"; + } elsif ($existing_config eq "m") { + print "# $configs is m\n"; + print "# $configs=y\n"; + } elsif ($existing_config eq "y") { + print "# $configs is set\n"; + print "# $configs=y\n"; + } else { + print "# $configs is not set\n"; + print "# $configs=y\n"; + } + } + } + } + + return 1; +} + + +sub scan_makefile +{ + my $pn_arg_ref = shift; + my $driver = shift; + + # ----- Find Kconfig symbols that enable driver + + my ($dir, $base) = $driver =~ m{(.*)/(.*).c}; + + my $makefile = $dir . "/Makefile"; + if (! -r $makefile) { + $makefile = $dir . "/Kbuild"; + } + if (! -r $makefile) { + my $config; + + $config = 'no_makefile'; + push @{ $driver_config{$driver} }, $config; + return; + } + + if (!open(MAKEFILE_FILE, "<", "$makefile")) { + return; + } + + my $line; + my @config; + my @if_config; + my @make_var; + + NEXT_LINE: + while ($next_line = ) { + my $config; + my $if_config; + my $ifdef; + my $ifeq; + my $ifndef; + my $ifneq; + my $ifdef_config; + my $ifeq_config; + my $ifndef_config; + my $ifneq_config; + + chomp($next_line); + $line = $line . $next_line; + if ($next_line =~ /\\$/) { + $line =~ s/\\$/ /; + next NEXT_LINE; + } + if ($line =~ /^\s*#/) { + $line = ""; + next NEXT_LINE; + } + + # ----- condition ... else ... endif + + if ($line =~ /^([ ]\s*|)else\b/) { + $if_config = "!" . pop @if_config; + $if_config =~ s/^!!//; + push @if_config, $if_config; + $line =~ s/^([ ]\s*|)else\b//; + } + + ($null, $ifeq_config, $ifeq_config_val ) = $line =~ /^([ ]\s*|)ifeq\b.*\b(CONFIG_[A-Za-z0-9_]*)(.*)/; + ($null, $ifneq_config, $ifneq_config_val) = $line =~ /^([ ]\s*|)ifneq\b.*\b(CONFIG_[A-Za-z0-9_]*)(.*)/; + ($null, $ifdef_config) = $line =~ /^([ ]\s*|)ifdef\b.*\b(CONFIG_[A-Za-z0-9_]*)/; + ($null, $ifndef_config) = $line =~ /^([ ]\s*|)ifndef\b.*\b(CONFIG_[A-Za-z0-9_]*)/; + + ($null, $ifeq) = $line =~ /^([ ]\s*|)ifeq\b\s*(.*)/; + ($null, $ifneq) = $line =~ /^([ ]\s*|)ifneq\b\s*(.*)/; + ($null, $ifdef) = $line =~ /^([ ]\s*|)ifdef\b\s*(.*)/; + ($null, $ifndef) = $line =~ /^([ ]\s*|)ifndef\b\s*(.*)/; + + # Order of tests is important. Prefer "CONFIG_*" regex match over + # less specific regex match. + if ($ifdef_config) { + $if_config = $ifdef_config; + } elsif ($ifeq_config) { + if ($ifeq_config_val =~ /y/) { + $if_config = $ifeq_config; + } else { + $if_config = "!" . $ifeq_config; + } + } elsif ($ifndef_config) { + $if_config = "!" . $ifndef_config; + } elsif ($ifneq_config) { + if ($ifneq_config_val =~ /y/) { + $if_config = "!" . $ifneq_config; + } else { + $if_config = $ifneq_config; + } + } elsif ($ifdef) { + $if_config = $ifdef; + } elsif ($ifeq) { + $if_config = $ifeq; + } elsif ($ifndef) { + $if_config = "!" . $ifndef; + } elsif ($ifneq) { + $if_config = "!" . $ifneq; + } else { + $if_config = ""; + } + $if_config =~ s/^!!//; + + if ($if_config) { + push @if_config, $if_config; + $line = ""; + next NEXT_LINE; + } + + if ($line =~ /^([ ]\s*|)endif\b/) { + pop @if_config; + $line = ""; + next NEXT_LINE; + } + + # ----- simple CONFIG_* = *.[co] or xxx [+:?]*= *.[co] + # Most makefiles select on *.o, but + # arch/powerpc/boot/Makefile selects on *.c + + ($config) = $line =~ /(CONFIG_[A-Za-z0-9_]+).*\b$base.[co]\b/; + + # ----- match a make variable instead of *.[co] + # Recursively expanded variables are not handled. + + if (!$config) { + my $make_var; + ($make_var) = $line =~ /\s*(\S+?)\s*[+:\?]*=.*\b$base.[co]\b/; + if ($make_var) { + if ($make_var =~ /[a-zA-Z0-9]+-[ym]/) { + $config = $make_var; + } elsif ($make_var =~ /[a-zA-Z0-9]+-objs/) { + $config = $make_var; + } else { + push @make_var, $make_var; + } + } + } + + if (!$config) { + for $make_var (@make_var) { + ($config) = $line =~ /(CONFIG_[A-Za-z0-9_]+).*\b$make_var\b/; + last if ($config); + } + } + + if (!$config) { + for $make_var (@make_var) { + ($config) = $line =~ /\s*(\S+?)\s*[+:\?]*=.*\b$make_var\b/; + last if ($config); + } + } + + # ----- next if no config found + + if (!$config) { + $line = ""; + next NEXT_LINE; + } + + for $if_config (@if_config) { + $config = $if_config . " && " . $config; + } + + push @{ $driver_config{$driver} }, $config; + + $line = ""; + } + + close(MAKEFILE_FILE); + +} + + +sub find_kconfig +{ + my $pn_arg_ref = shift; + my $driver = shift; + + my $lines_printed = 0; + my @configs; + + if (!@{ $driver_config{$driver} }) { + &scan_makefile($pn_arg_ref, $driver); + if (!@{ $driver_config{$driver} }) { + push @{ $driver_config{$driver} }, "no_config"; + } + } + + @configs = @{ $driver_config{$driver} }; + + $$pn_arg_ref{config_cnt} = $#configs + 1; + for my $config (@configs) { + $$pn_arg_ref{config} = $config; + $lines_printed += &print_node($pn_arg_ref); + } + + return $lines_printed; +} + + +sub handle_compatible() +{ + my $full_node = shift; + my $node = shift; + my $compatible = shift; + my $node_enabled = shift; + + my $compat; + my $lines_printed = 0; + my %pn_arg = (); + + return if (!$node or !$compatible); + + # Do not process compatible property of root node, + # it is used to match board, not to bind a driver. + return if ($node eq "/"); + + $pn_arg{full_node} = $full_node; + $pn_arg{node} = $node; + $pn_arg{node_enabled} = $node_enabled; + + my @compatibles = split('", "', $compatible); + + $compatibles[0] =~ s/^"//; + $compatibles[$#compatibles] =~ s/"$//; + + $pn_arg{compatible_cnt} = $#compatibles + 1; + + COMPAT: + for $compat (@compatibles) { + + $pn_arg{compat} = $compat; + $pn_arg{driver_cnt} = 0; + $pn_arg{white_list} = 0; + + if (exists($compat_white_list{$compat})) { + $pn_arg{white_list} = 1; + $pn_arg{driver} = "no_driver"; + $pn_arg{config_cnt} = 1; + $pn_arg{config} = "no_config"; + $lines_printed += &print_node(\%pn_arg); + next COMPAT; + } + + # ----- if compat previously seen, use cached info + + if (exists($compat_driver{$compat})) { + for my $driver (@{ $compat_driver{$compat} }) { + $pn_arg{driver} = $driver; + $pn_arg{driver_cnt} = $driver_count{$compat}; + $pn_arg{config_cnt} = $#{ $driver_config{$driver}} + 1; + + for my $config (@{ $driver_config{$driver} }) { + $pn_arg{config} = $config; + $lines_printed += &print_node(\%pn_arg); + } + + if (!@{ $driver_config{$driver} }) { + # no config cached yet + # $driver in %driver_hard_code_list + # but not %driver_config_hard_code_list + $lines_printed += &find_kconfig(\%pn_arg, $driver); + } + } + next COMPAT; + } + + + # ----- Find drivers (source files that contain compatible) + + # this will miss arch/sparc/include/asm/parport.h + # It is better to move the compatible out of the .h + # than to add *.h. to the files list, because *.h generates + # a lot of false negatives. + my $files = '"*.c"'; + my $drivers = `git grep -l '"$compat"' -- $files`; + chomp($drivers); + if ($drivers eq "") { + $pn_arg{driver} = "no_driver"; + $pn_arg{config_cnt} = 1; + $pn_arg{config} = "no_config"; + push @{ $compat_driver{$compat} }, "no_driver"; + $lines_printed += &print_node(\%pn_arg); + next COMPAT; + } + + my @drivers = split("\n", $drivers); + $driver_count{$compat} = $#drivers + 1; + $pn_arg{driver_cnt} = $#drivers + 1; + + DRIVER: + for my $driver (@drivers) { + push @{ $compat_driver{$compat} }, $driver; + $pn_arg{driver} = $driver; + + # ----- if driver previously seen, use cached info + + $pn_arg{config_cnt} = $#{ $driver_config{$driver} } + 1; + for my $config (@{ $driver_config{$driver} }) { + $pn_arg{config} = $config; + $lines_printed += &print_node(\%pn_arg); + } + if (@{ $driver_config{$driver} }) { + next DRIVER; + } + + if ($black_list_driver) { + for $black (@black_list_driver) { + next DRIVER if ($driver =~ /^$black$/); + } + } + + + # ----- Find Kconfig symbols that enable driver + + $lines_printed += &find_kconfig(\%pn_arg, $driver); + + } + } + + # White space (line) between nodes for readability. + # Each node may report several compatibles. + # For each compatible, multiple drivers may be reported. + # For each driver, multiple CONFIG_ options may be reported. + if ($lines_printed) { + print "\n"; + } +} + +sub read_dts() +{ + my $file = shift; + + my $compatible = ""; + my $line; + my $node = ""; + my $node_enabled = ""; + + if (! -r $file) { + print STDERR "file '$file' is not readable or does not exist\n"; + exit 3; + } + + if (!open(DT_FILE, "-|", "$dtx_diff $file")) { + print STDERR "\n"; + print STDERR "shell command failed:\n"; + print STDERR " $dtx_diff $file\n"; + print STDERR "\n"; + exit 3; + } + + FILE: + while ($line = ) { + chomp($line); + + if ($line =~ /{/) { + + &handle_compatible($full_node, $node, $compatible, + $node_enabled); + + while ($end_node_count-- > 0) { + pop @full_node; + }; + $end_node_count = 0; + $full_node = @full_node[-1]; + + $node = $line; + $node =~ s/^\s*(.*)\s+\{.*/$1/; + $node =~ s/.*: //; + if ($node eq '/' ) { + $full_node = '/'; + } elsif ($full_node ne '/') { + $full_node = $full_node . '/' . $node; + } else { + $full_node = '/' . $node; + } + push @full_node, $full_node; + + $compatible = ""; + $node_enabled = ""; + next FILE; + } + + if ($line =~ /}/) { + $end_node_count++; + } + + if ($line =~ /(\s+|^)status =/) { + $node_enabled = $line; + $node_enabled =~ s/^\t*//; + $node_enabled =~ s/^status = "//; + $node_enabled =~ s/";$//; + next FILE; + } + + if ($line =~ /(\s+|^)compatible =/) { + # Extract all compatible entries for this device + # White space matching here and in handle_compatible() is + # precise, because input format is the output of dtc, + # which is invoked by dtx_diff. + $compatible = $line; + $compatible =~ s/^\t*//; + $compatible =~ s/^compatible = //; + $compatible =~ s/;$//; + } + } + + &handle_compatible($full_node, $node, $compatible, $node_enabled); + + close(DT_FILE); +} + + +sub read_config_file() +{ + if (! -r $config_file) { + print STDERR "file '$config_file' is not readable or does not exist\n"; + exit 2; + } + + if (!open(CONFIG_FILE, "<", "$config_file")) { + print STDERR "open $config_file failed\n"; + exit 2; + } + + my @line; + + LINE: + while ($line = ) { + chomp($line); + next LINE if ($line =~ /^\s*#/); + next LINE if ($line =~ /^\s*$/); + @line = split /=/, $line; + $existing_config{@line[0]} = @line[1]; + } + + close(CONFIG_FILE); +} + + +sub cmd_line_err() +{ + my $msg = shift; + + print STDERR "\n"; + print STDERR " ERROR processing command line options\n"; + print STDERR " $msg\n" if ($msg ne ""); + print STDERR "\n"; + print STDERR " For help, type '$script_name --help'\n"; + print STDERR "\n"; +} + + +# ----------------------------------------------------------------------------- +# program entry point + +Getopt::Long::Configure("no_ignore_case", "bundling"); + +if (!GetOptions( + "c=s" => \$config_file, + "config=s" => \$config_file, + "config-format" => \$config_format, + "exclude-flag=s" => \@exclude_flag, + "h" => \$help, + "help" => \$help, + "black-list-driver" => \$black_list_driver, + "white-list-config" => \$white_list_config, + "white-list-driver" => \$white_list_driver, + "include-flag=s" => \@include_flag, + "include-suspect" => \$include_suspect, + "short-name" => \$short_name, + "show-lists" => \$show_lists, + "version" => \$version, + )) { + + &cmd_line_err(); + + exit 1; +} + + +my $exit_after_messages = 0; + +if ($version) { + print STDERR "\n$script_name $VUFX\n\n"; + $exit_after_messages = 1; +} + + +if ($help) { + &usage; + $exit_after_messages = 1; +} + + +if ($show_lists) { + + print "\n"; + print "These compatibles are hard coded to have no driver.\n"; + print "\n"; + for my $compat (sort keys %compat_white_list) { + print " $compat\n"; + } + + + print "\n\n"; + print "The driver for these compatibles is hard coded (white list).\n"; + print "\n"; + my $max_compat_len = 0; + for my $compat (sort keys %driver_hard_code_list) { + if (length $compat > $max_compat_len) { + $max_compat_len = length $compat; + } + } + for my $compat (sort keys %driver_hard_code_list) { + if (($driver ne "hardcoded_no_driver") && ($driver ne "no_driver")) { + my $first = 1; + for my $driver (@{ $driver_hard_code_list{$compat} }) { + if ($first) { + print " $compat"; + print " " x ($max_compat_len - length $compat); + $first = 0; + } else { + print " ", " " x $max_compat_len; + } + print " $driver\n"; + } + } + } + + + print "\n\n"; + print "The configuration option for these drivers is hard coded (white list).\n"; + print "\n"; + my $max_driver_len = 0; + for my $driver (sort keys %driver_config_hard_code_list) { + if (length $driver > $max_driver_len) { + $max_driver_len = length $driver; + } + } + for my $driver (sort keys %driver_config_hard_code_list) { + if (($driver ne "hardcoded_no_driver") && ($driver ne "no_driver")) { + my $first = 1; + for my $config (@{ $driver_config_hard_code_list{$driver} }) { + if ($first) { + print " $driver"; + print " " x ($max_driver_len - length $driver); + $first = 0; + } else { + print " ", " " x $max_driver_len; + } + print " $config\n"; + } + } + } + + + print "\n\n"; + print "These drivers are black listed.\n"; + print "\n"; + for my $driver (@black_list_driver) { + print " $driver\n"; + } + + print "\n"; + + $exit_after_messages = 1; +} + + +if ($exit_after_messages) { + exit 0; +} + + +$exclude_flag_pattern = "["; +for my $exclude_flag (@exclude_flag) { + $exclude_flag_pattern = $exclude_flag_pattern . $exclude_flag; +} +$exclude_flag_pattern = $exclude_flag_pattern . "]"; +# clean up if empty +$exclude_flag_pattern =~ s/^\[\]$//; + + +$include_flag_pattern = "["; +for my $include_flag (@include_flag) { + $include_flag_pattern = $include_flag_pattern . $include_flag; +} +$include_flag_pattern = $include_flag_pattern . "]"; +# clean up if empty +$include_flag_pattern =~ s/^\[\]$//; + + +if ($exclude_flag_pattern) { + my $found = 0; + for $pr_flag_value (@pr_flag_value) { + if ($exclude_flag_pattern =~ m/$pr_flag_value/) { + $found = 1; + } + } + if (!$found) { + &cmd_line_err("invalid value for FLAG in --exclude-flag\n"); + exit 1 + } +} + +if ($include_flag_pattern) { + my $found = 0; + for $pr_flag_value (@pr_flag_value) { + if ($include_flag_pattern =~ m/$pr_flag_value/) { + $found = 1; + } + } + if (!$found) { + &cmd_line_err("invalid value for FLAG in --include-flag\n"); + exit 1 + } +} + +if ($include_suspect) { + $include_flag_pattern =~ s/\[//; + $include_flag_pattern =~ s/\]//; + $include_flag_pattern = "[" . $include_flag_pattern . "A-Z]"; +} + +if ($exclude_flag_pattern =~ m/$include_flag_pattern/) { + &cmd_line_err("the same flag appears in both --exclude-flag and --include-flag or --include-suspect\n"); + exit 1 +} + + +# ($#ARGV < 0) is valid for --help, --version +if ($#ARGV < 0) { + &cmd_line_err("device-tree... is required"); + exit 1 +} + + +if ($config_file) { + &read_config_file(); +} + + +# avoid pushing duplicates for this value +$driver = "hardcoded_no_driver"; +for $config ( @{ $driver_config_hard_code_list{$driver} } ) { + push @{ $driver_config{$driver} }, $config; +} + +if ($white_list_driver) { + for my $compat (keys %driver_hard_code_list) { + for my $driver (@{ $driver_hard_code_list{$compat} }) { + push @{ $compat_driver{$compat} }, $driver; + if ($driver ne "hardcoded_no_driver") { + $driver_count{$compat} = scalar @{ $compat_driver{$compat} }; + } + } + } +} + +if ($white_list_config) { + for my $driver (keys %driver_config_hard_code_list) { + if ($driver ne "hardcoded_no_driver") { + for $config ( @{ $driver_config_hard_code_list{$driver} } ) { + push @{ $driver_config{$driver} }, $config; + } + } + } +} + +if (-x "scripts/dtc/dtx_diff") { + $dtx_diff = "scripts/dtc/dtx_diff"; +} else { + + print STDERR "\n"; + print STDERR "$script_name must be run from the root directory of a Linux kernel tree\n"; + print STDERR "\n"; + exit 3; +} + +for $file (@ARGV) { + &read_dts($file); +} diff --git a/scripts/dtc/dtx_diff b/scripts/dtc/dtx_diff index 959ab26..ec47f95 100755 --- a/scripts/dtc/dtx_diff +++ b/scripts/dtc/dtx_diff @@ -266,7 +266,7 @@ DTC="${__KBUILD_OUTPUT}/scripts/dtc/dtc" if [ ! -x ${DTC} ] ; then __DTC="dtc" - if grep -q "^CONFIG_DTC=y" ${__KBUILD_OUTPUT}/.config ; then + if grep -q "^CONFIG_DTC=y" ${__KBUILD_OUTPUT}/.config 2>/dev/null; then make_command=' make scripts' else -- cgit v0.10.2 From 0e13f99d3a4816a3996a69721388b4cf1a982cf8 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Sun, 26 Jun 2016 02:34:04 -0700 Subject: Documentation: dt: i2c: use correct STMicroelectronics vendor prefix The documentation currently uses the non-standard vendor prefix stm and st-micro for STMicroelectronics. The drivers do not specify the vendor prefixes since the I2C Core strips them away from the DT provided compatible string. Therefor, changing documentation and existing device trees does not have any impact on device detection. Signed-off-by: Stefan Agner Acked-by: Wolfram Sang Signed-off-by: Rob Herring diff --git a/Documentation/devicetree/bindings/i2c/trivial-devices.txt b/Documentation/devicetree/bindings/i2c/trivial-devices.txt index 53987449..8db3384 100644 --- a/Documentation/devicetree/bindings/i2c/trivial-devices.txt +++ b/Documentation/devicetree/bindings/i2c/trivial-devices.txt @@ -81,10 +81,10 @@ samsung,24ad0xd1 S524AD0XF1 (128K/256K-bit Serial EEPROM for Low Power) sgx,vz89x SGX Sensortech VZ89X Sensors sii,s35390a 2-wire CMOS real-time clock skyworks,sky81452 Skyworks SKY81452: Six-Channel White LED Driver with Touch Panel Bias Supply -st-micro,24c256 i2c serial eeprom (24cxx) -stm,m41t00 Serial Access TIMEKEEPER -stm,m41t62 Serial real-time clock (RTC) with alarm -stm,m41t80 M41T80 - SERIAL ACCESS RTC WITH ALARMS +st,24c256 i2c serial eeprom (24cxx) +st,m41t00 Serial real-time clock (RTC) +st,m41t62 Serial real-time clock (RTC) with alarm +st,m41t80 M41T80 - SERIAL ACCESS RTC WITH ALARMS taos,tsl2550 Ambient Light Sensor with SMBUS/Two Wire Serial Interface ti,ads7828 8-Channels, 12-bit ADC ti,ads7830 8-Channels, 8-bit ADC -- cgit v0.10.2 From 5edc2aae16bcea00bedddfadad94313de3d5dff1 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Sun, 26 Jun 2016 02:34:05 -0700 Subject: powerpc/dts: fix STMicroelectronics compatible strings Replace the non-standard vendor prefix stm and st-micro with st for STMicroelectronics. The drivers do not specify the vendor prefixes since the I2C Core strips them away from the DT provided compatible string. Therefore, changing existing device trees does not have any impact on device detection. Signed-off-by: Stefan Agner Signed-off-by: Rob Herring diff --git a/arch/powerpc/boot/dts/ac14xx.dts b/arch/powerpc/boot/dts/ac14xx.dts index a1b8837..27fcabc 100644 --- a/arch/powerpc/boot/dts/ac14xx.dts +++ b/arch/powerpc/boot/dts/ac14xx.dts @@ -231,7 +231,7 @@ }; rtc@68 { - compatible = "stm,m41t00"; + compatible = "st,m41t00"; reg = <0x68>; }; }; diff --git a/arch/powerpc/boot/dts/akebono.dts b/arch/powerpc/boot/dts/akebono.dts index f92ecfe..e61d5dc 100644 --- a/arch/powerpc/boot/dts/akebono.dts +++ b/arch/powerpc/boot/dts/akebono.dts @@ -224,7 +224,7 @@ #address-cells = <1>; #size-cells = <0>; rtc@68 { - compatible = "stm,m41t80", "m41st85"; + compatible = "st,m41t80", "m41st85"; reg = <0x68>; }; }; diff --git a/arch/powerpc/boot/dts/bluestone.dts b/arch/powerpc/boot/dts/bluestone.dts index 7daaca3..b0b26d8 100644 --- a/arch/powerpc/boot/dts/bluestone.dts +++ b/arch/powerpc/boot/dts/bluestone.dts @@ -279,7 +279,7 @@ #address-cells = <1>; #size-cells = <0>; rtc@68 { - compatible = "stm,m41t80"; + compatible = "st,m41t80"; reg = <0x68>; interrupt-parent = <&UIC0>; interrupts = <0x9 0x8>; diff --git a/arch/powerpc/boot/dts/canyonlands.dts b/arch/powerpc/boot/dts/canyonlands.dts index 549c24c..0d6ac92 100644 --- a/arch/powerpc/boot/dts/canyonlands.dts +++ b/arch/powerpc/boot/dts/canyonlands.dts @@ -319,7 +319,7 @@ #address-cells = <1>; #size-cells = <0>; rtc@68 { - compatible = "stm,m41t80"; + compatible = "st,m41t80"; reg = <0x68>; interrupt-parent = <&UIC2>; interrupts = <0x19 0x8>; diff --git a/arch/powerpc/boot/dts/currituck.dts b/arch/powerpc/boot/dts/currituck.dts index d2c8a87..4191e18 100644 --- a/arch/powerpc/boot/dts/currituck.dts +++ b/arch/powerpc/boot/dts/currituck.dts @@ -116,7 +116,7 @@ #address-cells = <1>; #size-cells = <0>; rtc@68 { - compatible = "stm,m41t80", "m41st85"; + compatible = "st,m41t80", "m41st85"; reg = <0x68>; }; }; diff --git a/arch/powerpc/boot/dts/fsl/mpc8569mds.dts b/arch/powerpc/boot/dts/fsl/mpc8569mds.dts index a95ff7d..8e94448 100644 --- a/arch/powerpc/boot/dts/fsl/mpc8569mds.dts +++ b/arch/powerpc/boot/dts/fsl/mpc8569mds.dts @@ -232,7 +232,7 @@ mode = "cpu-qe"; serial-flash@0 { - compatible = "stm,m25p40"; + compatible = "st,m25p40"; reg = <0>; spi-max-frequency = <25000000>; }; diff --git a/arch/powerpc/boot/dts/fsl/p1022rdk.dts b/arch/powerpc/boot/dts/fsl/p1022rdk.dts index d505d7c..29e8af1 100644 --- a/arch/powerpc/boot/dts/fsl/p1022rdk.dts +++ b/arch/powerpc/boot/dts/fsl/p1022rdk.dts @@ -57,7 +57,7 @@ clock-frequency = <12288000>; }; rtc@68 { - compatible = "stm,m41t62"; + compatible = "st,m41t62"; reg = <0x68>; }; adt7461@4c{ diff --git a/arch/powerpc/boot/dts/glacier.dts b/arch/powerpc/boot/dts/glacier.dts index 2000060..a7a802f 100644 --- a/arch/powerpc/boot/dts/glacier.dts +++ b/arch/powerpc/boot/dts/glacier.dts @@ -287,7 +287,7 @@ #address-cells = <1>; #size-cells = <0>; rtc@68 { - compatible = "stm,m41t80"; + compatible = "st,m41t80"; reg = <0x68>; interrupt-parent = <&UIC2>; interrupts = <0x19 0x8>; diff --git a/arch/powerpc/boot/dts/icon.dts b/arch/powerpc/boot/dts/icon.dts index abcd0ca..9c94fd7 100644 --- a/arch/powerpc/boot/dts/icon.dts +++ b/arch/powerpc/boot/dts/icon.dts @@ -256,7 +256,7 @@ #size-cells = <0>; rtc@68 { - compatible = "stm,m41t00"; + compatible = "st,m41t00"; reg = <0x68>; }; }; diff --git a/arch/powerpc/boot/dts/mpc5121ads.dts b/arch/powerpc/boot/dts/mpc5121ads.dts index c228a0a..75888ce 100644 --- a/arch/powerpc/boot/dts/mpc5121ads.dts +++ b/arch/powerpc/boot/dts/mpc5121ads.dts @@ -99,7 +99,7 @@ }; rtc@68 { - compatible = "stm,m41t62"; + compatible = "st,m41t62"; reg = <0x68>; }; }; diff --git a/arch/powerpc/boot/dts/mpc8349emitx.dts b/arch/powerpc/boot/dts/mpc8349emitx.dts index cf85424..90aed3a 100644 --- a/arch/powerpc/boot/dts/mpc8349emitx.dts +++ b/arch/powerpc/boot/dts/mpc8349emitx.dts @@ -92,7 +92,7 @@ dfsrr; eeprom: at24@50 { - compatible = "st-micro,24c256"; + compatible = "st,24c256"; reg = <0x50>; }; diff --git a/arch/powerpc/boot/dts/mpc836x_rdk.dts b/arch/powerpc/boot/dts/mpc836x_rdk.dts index daeacbd..47c5fc6 100644 --- a/arch/powerpc/boot/dts/mpc836x_rdk.dts +++ b/arch/powerpc/boot/dts/mpc836x_rdk.dts @@ -416,7 +416,7 @@ gpios = <&qe_pio_e 18 0>; flash { - compatible = "stm,nand512-a"; + compatible = "st,nand512-a"; }; }; diff --git a/arch/powerpc/boot/dts/pdm360ng.dts b/arch/powerpc/boot/dts/pdm360ng.dts index 871c16d..0cec724 100644 --- a/arch/powerpc/boot/dts/pdm360ng.dts +++ b/arch/powerpc/boot/dts/pdm360ng.dts @@ -103,7 +103,7 @@ }; rtc@68 { - compatible = "stm,m41t00"; + compatible = "st,m41t00"; reg = <0x68>; }; }; diff --git a/arch/powerpc/boot/dts/sam440ep.dts b/arch/powerpc/boot/dts/sam440ep.dts index f0663be..088361c 100644 --- a/arch/powerpc/boot/dts/sam440ep.dts +++ b/arch/powerpc/boot/dts/sam440ep.dts @@ -196,7 +196,7 @@ interrupt-parent = <&UIC0>; interrupts = <2 4>; rtc@68 { - compatible = "stm,m41t80"; + compatible = "st,m41t80"; reg = <0x68>; }; }; diff --git a/arch/powerpc/boot/dts/xcalibur1501.dts b/arch/powerpc/boot/dts/xcalibur1501.dts index c409cba..1f2952d 100644 --- a/arch/powerpc/boot/dts/xcalibur1501.dts +++ b/arch/powerpc/boot/dts/xcalibur1501.dts @@ -238,7 +238,7 @@ }; rtc@68 { - compatible = "stm,m41t00", + compatible = "st,m41t00", "dallas,ds1338"; reg = <0x68>; }; diff --git a/arch/powerpc/boot/dts/xpedite5200.dts b/arch/powerpc/boot/dts/xpedite5200.dts index 8fd7b70..5b10e56 100644 --- a/arch/powerpc/boot/dts/xpedite5200.dts +++ b/arch/powerpc/boot/dts/xpedite5200.dts @@ -130,7 +130,7 @@ }; rtc@68 { - compatible = "stm,m41t00", + compatible = "st,m41t00", "dallas,ds1338"; reg = <0x68>; }; diff --git a/arch/powerpc/boot/dts/xpedite5200_xmon.dts b/arch/powerpc/boot/dts/xpedite5200_xmon.dts index 0baa828..646acfb 100644 --- a/arch/powerpc/boot/dts/xpedite5200_xmon.dts +++ b/arch/powerpc/boot/dts/xpedite5200_xmon.dts @@ -134,7 +134,7 @@ }; rtc@68 { - compatible = "stm,m41t00", + compatible = "st,m41t00", "dallas,ds1338"; reg = <0x68>; }; diff --git a/arch/powerpc/boot/dts/xpedite5301.dts b/arch/powerpc/boot/dts/xpedite5301.dts index 04cb410..7bcc94f 100644 --- a/arch/powerpc/boot/dts/xpedite5301.dts +++ b/arch/powerpc/boot/dts/xpedite5301.dts @@ -231,7 +231,7 @@ }; rtc@68 { - compatible = "stm,m41t00", + compatible = "st,m41t00", "dallas,ds1338"; reg = <0x68>; }; diff --git a/arch/powerpc/boot/dts/xpedite5330.dts b/arch/powerpc/boot/dts/xpedite5330.dts index 73f8620..86df8bc 100644 --- a/arch/powerpc/boot/dts/xpedite5330.dts +++ b/arch/powerpc/boot/dts/xpedite5330.dts @@ -267,7 +267,7 @@ }; rtc@68 { - compatible = "stm,m41t00", + compatible = "st,m41t00", "dallas,ds1338"; reg = <0x68>; }; diff --git a/arch/powerpc/boot/dts/xpedite5370.dts b/arch/powerpc/boot/dts/xpedite5370.dts index cd0ea2b..b8ade09 100644 --- a/arch/powerpc/boot/dts/xpedite5370.dts +++ b/arch/powerpc/boot/dts/xpedite5370.dts @@ -229,7 +229,7 @@ }; rtc@68 { - compatible = "stm,m41t00", + compatible = "st,m41t00", "dallas,ds1338"; reg = <0x68>; }; -- cgit v0.10.2 From 0a6f366a82420d0b0cc32d4c4288ff02cde75457 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Sun, 26 Jun 2016 02:34:06 -0700 Subject: ARM: dts: fix STMicroelectronics compatible strings Replace the non-standard vendor prefix stm with st for STMicroelectronics. The drivers do not specify the vendor prefixes since the I2C Core strips them away from the DT provided compatible string. Therefore, changing existing device trees does not have any impact on device detection. Signed-off-by: Stefan Agner Signed-off-by: Rob Herring diff --git a/arch/arm/boot/dts/imx28-m28.dtsi b/arch/arm/boot/dts/imx28-m28.dtsi index 6cebaa6..214bb15 100644 --- a/arch/arm/boot/dts/imx28-m28.dtsi +++ b/arch/arm/boot/dts/imx28-m28.dtsi @@ -37,7 +37,7 @@ status = "okay"; rtc: rtc@68 { - compatible = "stm,m41t62"; + compatible = "st,m41t62"; reg = <0x68>; }; }; diff --git a/arch/arm/boot/dts/imx51-ts4800.dts b/arch/arm/boot/dts/imx51-ts4800.dts index 0ff76a1..30f44b5 100644 --- a/arch/arm/boot/dts/imx51-ts4800.dts +++ b/arch/arm/boot/dts/imx51-ts4800.dts @@ -102,7 +102,7 @@ status = "okay"; rtc: m41t00@68 { - compatible = "stm,m41t00"; + compatible = "st,m41t00"; reg = <0x68>; }; }; diff --git a/arch/arm/boot/dts/imx53-m53.dtsi b/arch/arm/boot/dts/imx53-m53.dtsi index 87a7fc7..d259f57 100644 --- a/arch/arm/boot/dts/imx53-m53.dtsi +++ b/arch/arm/boot/dts/imx53-m53.dtsi @@ -84,7 +84,7 @@ }; rtc: rtc@68 { - compatible = "stm,m41t62"; + compatible = "st,m41t62"; reg = <0x68>; }; }; diff --git a/arch/arm/boot/dts/imx6q-dmo-edmqmx6.dts b/arch/arm/boot/dts/imx6q-dmo-edmqmx6.dts index 364578d..9059073 100644 --- a/arch/arm/boot/dts/imx6q-dmo-edmqmx6.dts +++ b/arch/arm/boot/dts/imx6q-dmo-edmqmx6.dts @@ -282,7 +282,7 @@ }; rtc: m41t62@68 { - compatible = "stm,m41t62"; + compatible = "st,m41t62"; reg = <0x68>; }; }; diff --git a/arch/arm/boot/dts/socfpga_cyclone5_socrates.dts b/arch/arm/boot/dts/socfpga_cyclone5_socrates.dts index e1a61f2..d798537 100644 --- a/arch/arm/boot/dts/socfpga_cyclone5_socrates.dts +++ b/arch/arm/boot/dts/socfpga_cyclone5_socrates.dts @@ -52,7 +52,7 @@ status = "okay"; rtc: rtc@68 { - compatible = "stm,m41t82"; + compatible = "st,m41t82"; reg = <0x68>; }; }; -- cgit v0.10.2 From 7587eb18fa9d7c3c227d48d27a18dcb3042d7e17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Otto=20Kek=C3=A4l=C3=A4inen?= Date: Wed, 13 Jul 2016 21:08:07 +0300 Subject: Fix spelling errors in Documentation/devicetree MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Otto Kekäläinen Signed-off-by: Rob Herring diff --git a/Documentation/devicetree/bindings/arm/l2c2x0.txt b/Documentation/devicetree/bindings/arm/l2c2x0.txt index c453ab5..917199f 100644 --- a/Documentation/devicetree/bindings/arm/l2c2x0.txt +++ b/Documentation/devicetree/bindings/arm/l2c2x0.txt @@ -86,10 +86,10 @@ Optional properties: firmware) - arm,dynamic-clock-gating : L2 dynamic clock gating. Value: <0> (forcibly disable), <1> (forcibly enable), property absent (OS specific behavior, - preferrably retain firmware settings) + preferably retain firmware settings) - arm,standby-mode: L2 standby mode enable. Value <0> (forcibly disable), <1> (forcibly enable), property absent (OS specific behavior, - preferrably retain firmware settings) + preferably retain firmware settings) Example: diff --git a/Documentation/devicetree/bindings/net/dsa/dsa.txt b/Documentation/devicetree/bindings/net/dsa/dsa.txt index 9f4807f..eb13eaf 100644 --- a/Documentation/devicetree/bindings/net/dsa/dsa.txt +++ b/Documentation/devicetree/bindings/net/dsa/dsa.txt @@ -43,7 +43,7 @@ Each port children node must have the following mandatory properties: Note that a port labelled "dsa" will imply checking for the uplink phandle described below. -Optionnal property: +Optional property: - link : Should be a list of phandles to another switch's DSA port. This property is only used when switches are being chained/cascaded together. This port is used as outgoing port diff --git a/Documentation/devicetree/bindings/powerpc/fsl/fman.txt b/Documentation/devicetree/bindings/powerpc/fsl/fman.txt index 55c2c03..df873d1 100644 --- a/Documentation/devicetree/bindings/powerpc/fsl/fman.txt +++ b/Documentation/devicetree/bindings/powerpc/fsl/fman.txt @@ -35,7 +35,7 @@ PROPERTIES Definition: Specifies the index of the FMan unit. The cell-index value may be used by the SoC, to identify the - FMan unit in the SoC memory map. In the table bellow, + FMan unit in the SoC memory map. In the table below, there's a description of the cell-index use in each SoC: - P1023: @@ -247,7 +247,7 @@ PROPERTIES The cell-index value may be used by the FMan or the SoC, to identify the MAC unit in the FMan (or SoC) memory map. - In the tables bellow there's a description of the cell-index + In the tables below there's a description of the cell-index use, there are two tables, one describes the use of cell-index by the FMan, the second describes the use by the SoC: diff --git a/Documentation/devicetree/bindings/regmap/regmap.txt b/Documentation/devicetree/bindings/regmap/regmap.txt index 0127be3..873096b 100644 --- a/Documentation/devicetree/bindings/regmap/regmap.txt +++ b/Documentation/devicetree/bindings/regmap/regmap.txt @@ -14,7 +14,7 @@ architectures that typically run big-endian operating systems be marked that way in the devicetree. On SoCs that can be operated in both big-endian and little-endian -modes, with a single hardware switch controlling both the endianess +modes, with a single hardware switch controlling both the endianness of the CPU and a byteswap for MMIO registers (e.g. many Broadcom MIPS chips), "native-endian" is used to allow using the same device tree blob in both cases. diff --git a/Documentation/devicetree/bindings/serial/qcom,msm-uartdm.txt b/Documentation/devicetree/bindings/serial/qcom,msm-uartdm.txt index 182777f..d5f73b8 100644 --- a/Documentation/devicetree/bindings/serial/qcom,msm-uartdm.txt +++ b/Documentation/devicetree/bindings/serial/qcom,msm-uartdm.txt @@ -28,10 +28,10 @@ Optional properties: - dma-names: Should contain "tx" for transmit and "rx" for receive channels - qcom,tx-crci: Identificator for Client Rate Control Interface to be used with TX DMA channel. Required when using DMA for transmission - with UARTDM v1.3 and bellow. + with UARTDM v1.3 and below. - qcom,rx-crci: Identificator for Client Rate Control Interface to be used with RX DMA channel. Required when using DMA for reception - with UARTDM v1.3 and bellow. + with UARTDM v1.3 and below. Note: Aliases may be defined to ensure the correct ordering of the UARTs. The alias serialN will result in the UART being assigned port N. If any diff --git a/Documentation/devicetree/bindings/sound/simple-card.txt b/Documentation/devicetree/bindings/sound/simple-card.txt index cf3979e..59d8628 100644 --- a/Documentation/devicetree/bindings/sound/simple-card.txt +++ b/Documentation/devicetree/bindings/sound/simple-card.txt @@ -30,7 +30,7 @@ Optional subnodes: sub-nodes. This container may be omitted when the card has only one DAI link. See the examples and the - section bellow. + section below. Dai-link subnode properties and subnodes: diff --git a/Documentation/devicetree/bindings/spi/ti_qspi.txt b/Documentation/devicetree/bindings/spi/ti_qspi.txt index 50b14f6..e65fde4 100644 --- a/Documentation/devicetree/bindings/spi/ti_qspi.txt +++ b/Documentation/devicetree/bindings/spi/ti_qspi.txt @@ -20,7 +20,7 @@ Optional properties: chipselect register and offset of that register. NOTE: TI QSPI controller requires different pinmux and IODelay -paramaters for Mode-0 and Mode-3 operations, which needs to be set up by +parameters for Mode-0 and Mode-3 operations, which needs to be set up by the bootloader (U-Boot). Default configuration only supports Mode-0 operation. Hence, "spi-cpol" and "spi-cpha" DT properties cannot be specified in the slave nodes of TI QSPI controller without appropriate diff --git a/Documentation/devicetree/bindings/timer/allwinner,sun5i-a13-hstimer.txt b/Documentation/devicetree/bindings/timer/allwinner,sun5i-a13-hstimer.txt index 27cfc7d..8d6e4fd 100644 --- a/Documentation/devicetree/bindings/timer/allwinner,sun5i-a13-hstimer.txt +++ b/Documentation/devicetree/bindings/timer/allwinner,sun5i-a13-hstimer.txt @@ -9,7 +9,7 @@ Required properties: one) - clocks: phandle to the source clock (usually the AHB clock) -Optionnal properties: +Optional properties: - resets: phandle to a reset controller asserting the timer Example: -- cgit v0.10.2 From 20ff3ada476b2fdc2e50f55686a5267526fca605 Mon Sep 17 00:00:00 2001 From: Guenter Roeck Date: Sat, 23 Jul 2016 17:00:15 -0700 Subject: MIPS: ath79: Add missing include file Commit ddd0ce87bfde ("mips: Remove unnecessary of_platform_populate with default match table") dropped the include of linux/clk-provider.h from arch/mips/ath79/setup.c. This results in the following build error. arch/mips/ath79/setup.c: In function 'ath79_of_plat_time_init': arch/mips/ath79/setup.c:232:2: error: implicit declaration of function 'of_clk_init' Fixes: ddd0ce87bfde ("mips: Remove unnecessary of_platform_populate with default match table") Cc: Rob Herring Cc: Kefeng Wang Signed-off-by: Guenter Roeck Signed-off-by: Rob Herring diff --git a/arch/mips/ath79/setup.c b/arch/mips/ath79/setup.c index 8887eb1..3a0019d 100644 --- a/arch/mips/ath79/setup.c +++ b/arch/mips/ath79/setup.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include -- cgit v0.10.2 From d02014b2b764f058366b2f9dd425915fb900687c Mon Sep 17 00:00:00 2001 From: Guenter Roeck Date: Sat, 23 Jul 2016 17:24:55 -0700 Subject: xtensa: Fix build error due to missing include file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit 69d99e6c0d621f ("xtensa: Remove unnecessary of_platform_populate with default match table") dropped various include files from arch/xtensa/kernel/setup.c. This results in the following build error. arch/xtensa/kernel/setup.c: In function ‘xtensa_dt_io_area’: arch/xtensa/kernel/setup.c:213:2: error: implicit declaration of function ‘of_read_ulong’ Fixes: 69d99e6c0d621f ("xtensa: Remove unnecessary of_platform_populate with default match table") Cc: Kefeng Wang Cc: Rob Herring Signed-off-by: Guenter Roeck Acked-by: Max Filippov Signed-off-by: Rob Herring diff --git a/arch/xtensa/kernel/setup.c b/arch/xtensa/kernel/setup.c index 18af563..6f68c60 100644 --- a/arch/xtensa/kernel/setup.c +++ b/arch/xtensa/kernel/setup.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE) -- cgit v0.10.2 From e973f4ec130ac0eefb9e69b5139ed8a2768250aa Mon Sep 17 00:00:00 2001 From: Rob Herring Date: Tue, 26 Jul 2016 11:46:30 -0500 Subject: xtensa: Partially Revert "xtensa: Remove unnecessary of_platform_populate with default match table" This partially reverts commit 69d99e6c0d62 keeping only the main purpose of the original commit which is the removal of of_platform_populate() call. The moving of of_clk_init() caused changes in the initialization order breaking booting. Fixes: 69d99e6c0d621f ("xtensa: Remove unnecessary of_platform_populate with default match table") Cc: Kefeng Wang Cc: Guenter Roeck Tested-by: Max Filippov Signed-off-by: Rob Herring diff --git a/arch/xtensa/kernel/setup.c b/arch/xtensa/kernel/setup.c index 6f68c60..143251e 100644 --- a/arch/xtensa/kernel/setup.c +++ b/arch/xtensa/kernel/setup.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -251,6 +252,14 @@ void __init early_init_devtree(void *params) strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE); } +static int __init xtensa_device_probe(void) +{ + of_clk_init(NULL); + return 0; +} + +device_initcall(xtensa_device_probe); + #endif /* CONFIG_OF */ /* diff --git a/arch/xtensa/kernel/time.c b/arch/xtensa/kernel/time.c index 6ec73c9..b9ad9fe 100644 --- a/arch/xtensa/kernel/time.c +++ b/arch/xtensa/kernel/time.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include @@ -149,7 +148,6 @@ void __init time_init(void) local_timer_setup(0); setup_irq(this_cpu_ptr(&ccount_timer)->evt.irq, &timer_irqaction); sched_clock_register(ccount_sched_clock_read, 32, ccount_freq); - of_clk_init(NULL); clocksource_probe(); } -- cgit v0.10.2 From 099c0cbd2025192f098e6da7f3c8118f6833dfe9 Mon Sep 17 00:00:00 2001 From: Steve Twiss Date: Mon, 25 Jul 2016 16:20:54 +0100 Subject: documentation: da9052: Update regulator bindings names to match DA9052/53 DTS expectations Buck and LDO binding name changes. The binding names for the regulators have been changed to match the current expectation from existing device tree source files. This fix rectifies the disparity between what currently exists in some .dts[i] board files and what is listed in this binding document. This change re-aligns those differences and also brings the binding document in-line with the expectations of the product datasheet from Dialog Semiconductor. Bucks and LDOs now follow the expected notation: { buck1, buck2, buck3, buck4 } { ldo1, ldo2, ldo3, ldo4, ldo5, ldo6, ldo7, ldo8, ldo9, ldo10 } Signed-off-by: Steve Twiss Signed-off-by: Rob Herring diff --git a/Documentation/devicetree/bindings/mfd/da9052-i2c.txt b/Documentation/devicetree/bindings/mfd/da9052-i2c.txt index 1857f4a..9554292 100644 --- a/Documentation/devicetree/bindings/mfd/da9052-i2c.txt +++ b/Documentation/devicetree/bindings/mfd/da9052-i2c.txt @@ -8,10 +8,13 @@ Sub-nodes: - regulators : Contain the regulator nodes. The DA9052/53 regulators are bound using their names as listed below: - buck0 : regulator BUCK0 - buck1 : regulator BUCK1 - buck2 : regulator BUCK2 - buck3 : regulator BUCK3 + buck1 : regulator BUCK CORE + buck2 : regulator BUCK PRO + buck3 : regulator BUCK MEM + buck4 : regulator BUCK PERI + ldo1 : regulator LDO1 + ldo2 : regulator LDO2 + ldo3 : regulator LDO3 ldo4 : regulator LDO4 ldo5 : regulator LDO5 ldo6 : regulator LDO6 @@ -19,9 +22,6 @@ Sub-nodes: ldo8 : regulator LDO8 ldo9 : regulator LDO9 ldo10 : regulator LDO10 - ldo11 : regulator LDO11 - ldo12 : regulator LDO12 - ldo13 : regulator LDO13 The bindings details of individual regulator device can be found in: Documentation/devicetree/bindings/regulator/regulator.txt @@ -36,22 +36,22 @@ i2c@63fc8000 { /* I2C1 */ reg = <0x48>; regulators { - buck0 { + buck1 { regulator-min-microvolt = <500000>; regulator-max-microvolt = <2075000>; }; - buck1 { + buck2 { regulator-min-microvolt = <500000>; regulator-max-microvolt = <2075000>; }; - buck2 { + buck3 { regulator-min-microvolt = <925000>; regulator-max-microvolt = <2500000>; }; - buck3 { + buck4 { regulator-min-microvolt = <925000>; regulator-max-microvolt = <2500000>; }; -- cgit v0.10.2