aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-07-30 14:32:01 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-07-30 14:32:01 -0400
commitf64d6e2aaa79f0ad588fd7ad595a0a8eb8f04645 (patch)
tree3ee28acc12e4f58320bfabd146d86755be6236fd
parent1056c9bd2702ea1bb79abf9bd1e78c578589d247 (diff)
parent099c0cbd2025192f098e6da7f3c8118f6833dfe9 (diff)
Merge tag 'devicetree-for-4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux
Pull DeviceTree updates from Rob Herring: - remove most of_platform_populate() calls in arch code. Now the DT core code calls it in the default case and platforms only need to call it if they have special needs - use pr_fmt on all the DT core print statements - CoreSight binding doc improvements to block name descriptions - add dt_to_config script which can parse dts files and list corresponding kernel config options - fix memory leak hit with a PowerMac DT - correct a bunch of STMicro compatible strings to use the correct vendor prefix - fix DA9052 PMIC binding doc to match what is actually used in dts files * tag 'devicetree-for-4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux: (35 commits) documentation: da9052: Update regulator bindings names to match DA9052/53 DTS expectations xtensa: Partially Revert "xtensa: Remove unnecessary of_platform_populate with default match table" xtensa: Fix build error due to missing include file MIPS: ath79: Add missing include file Fix spelling errors in Documentation/devicetree ARM: dts: fix STMicroelectronics compatible strings powerpc/dts: fix STMicroelectronics compatible strings Documentation: dt: i2c: use correct STMicroelectronics vendor prefix scripts/dtc: dt_to_config - kernel config options for a devicetree of: fdt: mark unflattened tree as detached of: overlay: add resolver error prints coresight: document binding acronyms Documentation/devicetree: document cavium-pip rx-delay/tx-delay properties of: use pr_fmt prefix for all console printing of/irq: Mark initialised interrupt controllers as populated of: fix memory leak related to safe_name() Revert "of/platform: export of_default_bus_match_table" of: unittest: use of_platform_default_populate() to populate default bus memory: omap-gpmc: use of_platform_default_populate() to populate default bus bus: uniphier-system-bus: use of_platform_default_populate() to populate default bus ...
-rw-r--r--Documentation/devicetree/bindings/arm/coresight.txt35
-rw-r--r--Documentation/devicetree/bindings/arm/l2c2x0.txt4
-rw-r--r--Documentation/devicetree/bindings/i2c/trivial-devices.txt8
-rw-r--r--Documentation/devicetree/bindings/mfd/da9052-i2c.txt22
-rw-r--r--Documentation/devicetree/bindings/net/cavium-pip.txt6
-rw-r--r--Documentation/devicetree/bindings/net/dsa/dsa.txt2
-rw-r--r--Documentation/devicetree/bindings/powerpc/fsl/fman.txt4
-rw-r--r--Documentation/devicetree/bindings/regmap/regmap.txt2
-rw-r--r--Documentation/devicetree/bindings/serial/qcom,msm-uartdm.txt4
-rw-r--r--Documentation/devicetree/bindings/sound/simple-card.txt2
-rw-r--r--Documentation/devicetree/bindings/timer/allwinner,sun5i-a13-hstimer.txt2
-rw-r--r--arch/arc/kernel/setup.c7
-rw-r--r--arch/arm/boot/dts/imx28-m28.dtsi2
-rw-r--r--arch/arm/boot/dts/imx51-ts4800.dts2
-rw-r--r--arch/arm/boot/dts/imx53-m53.dtsi2
-rw-r--r--arch/arm/boot/dts/imx6q-dmo-edmqmx6.dts2
-rw-r--r--arch/arm/boot/dts/socfpga_cyclone5_socrates.dts2
-rw-r--r--arch/arm/kernel/setup.c8
-rw-r--r--arch/arm/mach-artpec/board-artpec6.c3
-rw-r--r--arch/arm/mach-at91/at91rm9200.c2
-rw-r--r--arch/arm/mach-at91/at91sam9.c2
-rw-r--r--arch/arm/mach-at91/sama5.c2
-rw-r--r--arch/arm/mach-bcm/board_bcm21664.c2
-rw-r--r--arch/arm/mach-bcm/board_bcm281xx.c2
-rw-r--r--arch/arm/mach-bcm/board_bcm2835.c10
-rw-r--r--arch/arm/mach-cns3xxx/core.c3
-rw-r--r--arch/arm/mach-exynos/exynos.c3
-rw-r--r--arch/arm/mach-highbank/highbank.c3
-rw-r--r--arch/arm/mach-imx/mach-imx51.c2
-rw-r--r--arch/arm/mach-imx/mach-imx53.c2
-rw-r--r--arch/arm/mach-imx/mach-imx6q.c2
-rw-r--r--arch/arm/mach-imx/mach-imx6sl.c2
-rw-r--r--arch/arm/mach-imx/mach-imx6sx.c2
-rw-r--r--arch/arm/mach-imx/mach-imx6ul.c1
-rw-r--r--arch/arm/mach-imx/mach-imx7d.c1
-rw-r--r--arch/arm/mach-integrator/integrator_ap.c3
-rw-r--r--arch/arm/mach-integrator/integrator_cp.c3
-rw-r--r--arch/arm/mach-keystone/keystone.c1
-rw-r--r--arch/arm/mach-lpc32xx/phy3250.c3
-rw-r--r--arch/arm/mach-mvebu/board-v7.c3
-rw-r--r--arch/arm/mach-mvebu/dove.c2
-rw-r--r--arch/arm/mach-mvebu/kirkwood.c2
-rw-r--r--arch/arm/mach-mxs/mach-mxs.c3
-rw-r--r--arch/arm/mach-nspire/nspire.c3
-rw-r--r--arch/arm/mach-orion5x/board-dt.c3
-rw-r--r--arch/arm/mach-picoxcell/common.c2
-rw-r--r--arch/arm/mach-rockchip/rockchip.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-s3c2416-dt.c2
-rw-r--r--arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c3
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7740.c3
-rw-r--r--arch/arm/mach-shmobile/setup-sh73a0.c2
-rw-r--r--arch/arm/mach-spear/spear1310.c2
-rw-r--r--arch/arm/mach-spear/spear1340.c1
-rw-r--r--arch/arm/mach-spear/spear300.c3
-rw-r--r--arch/arm/mach-spear/spear310.c3
-rw-r--r--arch/arm/mach-spear/spear320.c3
-rw-r--r--arch/arm/mach-spear/spear6xx.c3
-rw-r--r--arch/arm/mach-tegra/tegra.c2
-rw-r--r--arch/arm/mach-u300/core.c3
-rw-r--r--arch/arm/mach-versatile/versatile_dt.c3
-rw-r--r--arch/arm/mach-vt8500/vt8500.c3
-rw-r--r--arch/arm/mach-zynq/common.c2
-rw-r--r--arch/arm64/kernel/setup.c15
-rw-r--r--arch/c6x/platforms/Makefile2
-rw-r--r--arch/c6x/platforms/platform.c17
-rw-r--r--arch/cris/kernel/setup.c8
-rw-r--r--arch/metag/kernel/setup.c5
-rw-r--r--arch/mips/ath79/setup.c2
-rw-r--r--arch/mips/jz4740/setup.c8
-rw-r--r--arch/mips/mti-sead3/sead3-setup.c8
-rw-r--r--arch/mips/pic32/pic32mzda/init.c3
-rw-r--r--arch/mips/pistachio/init.c13
-rw-r--r--arch/mips/xilfpga/init.c13
-rw-r--r--arch/nios2/platform/platform.c4
-rw-r--r--arch/powerpc/boot/dts/ac14xx.dts2
-rw-r--r--arch/powerpc/boot/dts/akebono.dts2
-rw-r--r--arch/powerpc/boot/dts/bluestone.dts2
-rw-r--r--arch/powerpc/boot/dts/canyonlands.dts2
-rw-r--r--arch/powerpc/boot/dts/currituck.dts2
-rw-r--r--arch/powerpc/boot/dts/fsl/mpc8569mds.dts2
-rw-r--r--arch/powerpc/boot/dts/fsl/p1022rdk.dts2
-rw-r--r--arch/powerpc/boot/dts/glacier.dts2
-rw-r--r--arch/powerpc/boot/dts/icon.dts2
-rw-r--r--arch/powerpc/boot/dts/mpc5121ads.dts2
-rw-r--r--arch/powerpc/boot/dts/mpc8349emitx.dts2
-rw-r--r--arch/powerpc/boot/dts/mpc836x_rdk.dts2
-rw-r--r--arch/powerpc/boot/dts/pdm360ng.dts2
-rw-r--r--arch/powerpc/boot/dts/sam440ep.dts2
-rw-r--r--arch/powerpc/boot/dts/xcalibur1501.dts2
-rw-r--r--arch/powerpc/boot/dts/xpedite5200.dts2
-rw-r--r--arch/powerpc/boot/dts/xpedite5200_xmon.dts2
-rw-r--r--arch/powerpc/boot/dts/xpedite5301.dts2
-rw-r--r--arch/powerpc/boot/dts/xpedite5330.dts2
-rw-r--r--arch/powerpc/boot/dts/xpedite5370.dts2
-rw-r--r--arch/sh/boards/of-generic.c16
-rw-r--r--arch/xtensa/kernel/setup.c3
-rw-r--r--drivers/bus/imx-weim.c5
-rw-r--r--drivers/bus/uniphier-system-bus.c3
-rw-r--r--drivers/iommu/of_iommu.c5
-rw-r--r--drivers/memory/omap-gpmc.c3
-rw-r--r--drivers/of/address.c49
-rw-r--r--drivers/of/base.c41
-rw-r--r--drivers/of/dynamic.c49
-rw-r--r--drivers/of/fdt.c25
-rw-r--r--drivers/of/fdt_address.c35
-rw-r--r--drivers/of/irq.c4
-rw-r--r--drivers/of/of_pci.c6
-rw-r--r--drivers/of/of_private.h3
-rw-r--r--drivers/of/of_reserved_mem.c22
-rw-r--r--drivers/of/overlay.c43
-rw-r--r--drivers/of/platform.c37
-rw-r--r--drivers/of/resolver.c8
-rw-r--r--drivers/of/unittest.c5
-rw-r--r--include/linux/of_iommu.h2
-rwxr-xr-xscripts/dtc/dt_to_config1213
-rwxr-xr-xscripts/dtc/dtx_diff2
116 files changed, 1521 insertions, 423 deletions
diff --git a/Documentation/devicetree/bindings/arm/coresight.txt b/Documentation/devicetree/bindings/arm/coresight.txt
index 93147c0c8a0e..fcbae6a5e6c1 100644
--- a/Documentation/devicetree/bindings/arm/coresight.txt
+++ b/Documentation/devicetree/bindings/arm/coresight.txt
@@ -12,14 +12,33 @@ its hardware characteristcs.
12 12
13 * compatible: These have to be supplemented with "arm,primecell" as 13 * compatible: These have to be supplemented with "arm,primecell" as
14 drivers are using the AMBA bus interface. Possible values include: 14 drivers are using the AMBA bus interface. Possible values include:
15 - "arm,coresight-etb10", "arm,primecell"; 15 - Embedded Trace Buffer (version 1.0):
16 - "arm,coresight-tpiu", "arm,primecell"; 16 "arm,coresight-etb10", "arm,primecell";
17 - "arm,coresight-tmc", "arm,primecell"; 17
18 - "arm,coresight-funnel", "arm,primecell"; 18 - Trace Port Interface Unit:
19 - "arm,coresight-etm3x", "arm,primecell"; 19 "arm,coresight-tpiu", "arm,primecell";
20 - "arm,coresight-etm4x", "arm,primecell"; 20
21 - "qcom,coresight-replicator1x", "arm,primecell"; 21 - Trace Memory Controller, used for Embedded Trace Buffer(ETB),
22 - "arm,coresight-stm", "arm,primecell"; [1] 22 Embedded Trace FIFO(ETF) and Embedded Trace Router(ETR)
23 configuration. The configuration mode (ETB, ETF, ETR) is
24 discovered at boot time when the device is probed.
25 "arm,coresight-tmc", "arm,primecell";
26
27 - Trace Funnel:
28 "arm,coresight-funnel", "arm,primecell";
29
30 - Embedded Trace Macrocell (version 3.x) and
31 Program Flow Trace Macrocell:
32 "arm,coresight-etm3x", "arm,primecell";
33
34 - Embedded Trace Macrocell (version 4.x):
35 "arm,coresight-etm4x", "arm,primecell";
36
37 - Qualcomm Configurable Replicator (version 1.x):
38 "qcom,coresight-replicator1x", "arm,primecell";
39
40 - System Trace Macrocell:
41 "arm,coresight-stm", "arm,primecell"; [1]
23 42
24 * reg: physical base address and length of the register 43 * reg: physical base address and length of the register
25 set(s) of the component. 44 set(s) of the component.
diff --git a/Documentation/devicetree/bindings/arm/l2c2x0.txt b/Documentation/devicetree/bindings/arm/l2c2x0.txt
index c453ab5553cd..917199f17965 100644
--- a/Documentation/devicetree/bindings/arm/l2c2x0.txt
+++ b/Documentation/devicetree/bindings/arm/l2c2x0.txt
@@ -86,10 +86,10 @@ Optional properties:
86 firmware) 86 firmware)
87- arm,dynamic-clock-gating : L2 dynamic clock gating. Value: <0> (forcibly 87- arm,dynamic-clock-gating : L2 dynamic clock gating. Value: <0> (forcibly
88 disable), <1> (forcibly enable), property absent (OS specific behavior, 88 disable), <1> (forcibly enable), property absent (OS specific behavior,
89 preferrably retain firmware settings) 89 preferably retain firmware settings)
90- arm,standby-mode: L2 standby mode enable. Value <0> (forcibly disable), 90- arm,standby-mode: L2 standby mode enable. Value <0> (forcibly disable),
91 <1> (forcibly enable), property absent (OS specific behavior, 91 <1> (forcibly enable), property absent (OS specific behavior,
92 preferrably retain firmware settings) 92 preferably retain firmware settings)
93 93
94Example: 94Example:
95 95
diff --git a/Documentation/devicetree/bindings/i2c/trivial-devices.txt b/Documentation/devicetree/bindings/i2c/trivial-devices.txt
index a92d4f3e7044..5c70ce9c1954 100644
--- a/Documentation/devicetree/bindings/i2c/trivial-devices.txt
+++ b/Documentation/devicetree/bindings/i2c/trivial-devices.txt
@@ -146,10 +146,10 @@ samsung,24ad0xd1 S524AD0XF1 (128K/256K-bit Serial EEPROM for Low Power)
146sgx,vz89x SGX Sensortech VZ89X Sensors 146sgx,vz89x SGX Sensortech VZ89X Sensors
147sii,s35390a 2-wire CMOS real-time clock 147sii,s35390a 2-wire CMOS real-time clock
148skyworks,sky81452 Skyworks SKY81452: Six-Channel White LED Driver with Touch Panel Bias Supply 148skyworks,sky81452 Skyworks SKY81452: Six-Channel White LED Driver with Touch Panel Bias Supply
149st-micro,24c256 i2c serial eeprom (24cxx) 149st,24c256 i2c serial eeprom (24cxx)
150stm,m41t00 Serial Access TIMEKEEPER 150st,m41t00 Serial real-time clock (RTC)
151stm,m41t62 Serial real-time clock (RTC) with alarm 151st,m41t62 Serial real-time clock (RTC) with alarm
152stm,m41t80 M41T80 - SERIAL ACCESS RTC WITH ALARMS 152st,m41t80 M41T80 - SERIAL ACCESS RTC WITH ALARMS
153taos,tsl2550 Ambient Light Sensor with SMBUS/Two Wire Serial Interface 153taos,tsl2550 Ambient Light Sensor with SMBUS/Two Wire Serial Interface
154ti,ads7828 8-Channels, 12-bit ADC 154ti,ads7828 8-Channels, 12-bit ADC
155ti,ads7830 8-Channels, 8-bit ADC 155ti,ads7830 8-Channels, 8-bit ADC
diff --git a/Documentation/devicetree/bindings/mfd/da9052-i2c.txt b/Documentation/devicetree/bindings/mfd/da9052-i2c.txt
index 1857f4a6b9a9..9554292dc6cb 100644
--- a/Documentation/devicetree/bindings/mfd/da9052-i2c.txt
+++ b/Documentation/devicetree/bindings/mfd/da9052-i2c.txt
@@ -8,10 +8,13 @@ Sub-nodes:
8- regulators : Contain the regulator nodes. The DA9052/53 regulators are 8- regulators : Contain the regulator nodes. The DA9052/53 regulators are
9 bound using their names as listed below: 9 bound using their names as listed below:
10 10
11 buck0 : regulator BUCK0 11 buck1 : regulator BUCK CORE
12 buck1 : regulator BUCK1 12 buck2 : regulator BUCK PRO
13 buck2 : regulator BUCK2 13 buck3 : regulator BUCK MEM
14 buck3 : regulator BUCK3 14 buck4 : regulator BUCK PERI
15 ldo1 : regulator LDO1
16 ldo2 : regulator LDO2
17 ldo3 : regulator LDO3
15 ldo4 : regulator LDO4 18 ldo4 : regulator LDO4
16 ldo5 : regulator LDO5 19 ldo5 : regulator LDO5
17 ldo6 : regulator LDO6 20 ldo6 : regulator LDO6
@@ -19,9 +22,6 @@ Sub-nodes:
19 ldo8 : regulator LDO8 22 ldo8 : regulator LDO8
20 ldo9 : regulator LDO9 23 ldo9 : regulator LDO9
21 ldo10 : regulator LDO10 24 ldo10 : regulator LDO10
22 ldo11 : regulator LDO11
23 ldo12 : regulator LDO12
24 ldo13 : regulator LDO13
25 25
26 The bindings details of individual regulator device can be found in: 26 The bindings details of individual regulator device can be found in:
27 Documentation/devicetree/bindings/regulator/regulator.txt 27 Documentation/devicetree/bindings/regulator/regulator.txt
@@ -36,22 +36,22 @@ i2c@63fc8000 { /* I2C1 */
36 reg = <0x48>; 36 reg = <0x48>;
37 37
38 regulators { 38 regulators {
39 buck0 { 39 buck1 {
40 regulator-min-microvolt = <500000>; 40 regulator-min-microvolt = <500000>;
41 regulator-max-microvolt = <2075000>; 41 regulator-max-microvolt = <2075000>;
42 }; 42 };
43 43
44 buck1 { 44 buck2 {
45 regulator-min-microvolt = <500000>; 45 regulator-min-microvolt = <500000>;
46 regulator-max-microvolt = <2075000>; 46 regulator-max-microvolt = <2075000>;
47 }; 47 };
48 48
49 buck2 { 49 buck3 {
50 regulator-min-microvolt = <925000>; 50 regulator-min-microvolt = <925000>;
51 regulator-max-microvolt = <2500000>; 51 regulator-max-microvolt = <2500000>;
52 }; 52 };
53 53
54 buck3 { 54 buck4 {
55 regulator-min-microvolt = <925000>; 55 regulator-min-microvolt = <925000>;
56 regulator-max-microvolt = <2500000>; 56 regulator-max-microvolt = <2500000>;
57 }; 57 };
diff --git a/Documentation/devicetree/bindings/net/cavium-pip.txt b/Documentation/devicetree/bindings/net/cavium-pip.txt
index 7dbd158810d2..e3b8fe71762b 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:
37 37
38- phy-handle: Optional, see ethernet.txt file in the same directory. 38- phy-handle: Optional, see ethernet.txt file in the same directory.
39 39
40- rx-delay: Delay value for RGMII receive clock. Optional. Disabled if 0.
41 Value range is 1-31, and mapping to the actual delay varies depending on HW.
42
43- tx-delay: Delay value for RGMII transmit clock. Optional. Disabled if 0.
44 Value range is 1-31, and mapping to the actual delay varies depending on HW.
45
40Example: 46Example:
41 47
42 pip@11800a0000000 { 48 pip@11800a0000000 {
diff --git a/Documentation/devicetree/bindings/net/dsa/dsa.txt b/Documentation/devicetree/bindings/net/dsa/dsa.txt
index 9bbbe7f87d67..a4a570fb2494 100644
--- a/Documentation/devicetree/bindings/net/dsa/dsa.txt
+++ b/Documentation/devicetree/bindings/net/dsa/dsa.txt
@@ -317,7 +317,7 @@ Each port children node must have the following mandatory properties:
317Note that a port labelled "dsa" will imply checking for the uplink phandle 317Note that a port labelled "dsa" will imply checking for the uplink phandle
318described below. 318described below.
319 319
320Optionnal property: 320Optional property:
321- link : Should be a list of phandles to another switch's DSA port. 321- link : Should be a list of phandles to another switch's DSA port.
322 This property is only used when switches are being 322 This property is only used when switches are being
323 chained/cascaded together. This port is used as outgoing port 323 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 55c2c03fc81e..df873d1f3b7c 100644
--- a/Documentation/devicetree/bindings/powerpc/fsl/fman.txt
+++ b/Documentation/devicetree/bindings/powerpc/fsl/fman.txt
@@ -35,7 +35,7 @@ PROPERTIES
35 Definition: Specifies the index of the FMan unit. 35 Definition: Specifies the index of the FMan unit.
36 36
37 The cell-index value may be used by the SoC, to identify the 37 The cell-index value may be used by the SoC, to identify the
38 FMan unit in the SoC memory map. In the table bellow, 38 FMan unit in the SoC memory map. In the table below,
39 there's a description of the cell-index use in each SoC: 39 there's a description of the cell-index use in each SoC:
40 40
41 - P1023: 41 - P1023:
@@ -247,7 +247,7 @@ PROPERTIES
247 247
248 The cell-index value may be used by the FMan or the SoC, to 248 The cell-index value may be used by the FMan or the SoC, to
249 identify the MAC unit in the FMan (or SoC) memory map. 249 identify the MAC unit in the FMan (or SoC) memory map.
250 In the tables bellow there's a description of the cell-index 250 In the tables below there's a description of the cell-index
251 use, there are two tables, one describes the use of cell-index 251 use, there are two tables, one describes the use of cell-index
252 by the FMan, the second describes the use by the SoC: 252 by the FMan, the second describes the use by the SoC:
253 253
diff --git a/Documentation/devicetree/bindings/regmap/regmap.txt b/Documentation/devicetree/bindings/regmap/regmap.txt
index 0127be360fe8..873096be0278 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
14be marked that way in the devicetree. 14be marked that way in the devicetree.
15 15
16On SoCs that can be operated in both big-endian and little-endian 16On SoCs that can be operated in both big-endian and little-endian
17modes, with a single hardware switch controlling both the endianess 17modes, with a single hardware switch controlling both the endianness
18of the CPU and a byteswap for MMIO registers (e.g. many Broadcom MIPS 18of the CPU and a byteswap for MMIO registers (e.g. many Broadcom MIPS
19chips), "native-endian" is used to allow using the same device tree 19chips), "native-endian" is used to allow using the same device tree
20blob in both cases. 20blob in both cases.
diff --git a/Documentation/devicetree/bindings/serial/qcom,msm-uartdm.txt b/Documentation/devicetree/bindings/serial/qcom,msm-uartdm.txt
index 182777fac9a2..d5f73b8f614f 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:
28- dma-names: Should contain "tx" for transmit and "rx" for receive channels 28- dma-names: Should contain "tx" for transmit and "rx" for receive channels
29- qcom,tx-crci: Identificator <u32> for Client Rate Control Interface to be 29- qcom,tx-crci: Identificator <u32> for Client Rate Control Interface to be
30 used with TX DMA channel. Required when using DMA for transmission 30 used with TX DMA channel. Required when using DMA for transmission
31 with UARTDM v1.3 and bellow. 31 with UARTDM v1.3 and below.
32- qcom,rx-crci: Identificator <u32> for Client Rate Control Interface to be 32- qcom,rx-crci: Identificator <u32> for Client Rate Control Interface to be
33 used with RX DMA channel. Required when using DMA for reception 33 used with RX DMA channel. Required when using DMA for reception
34 with UARTDM v1.3 and bellow. 34 with UARTDM v1.3 and below.
35 35
36Note: Aliases may be defined to ensure the correct ordering of the UARTs. 36Note: Aliases may be defined to ensure the correct ordering of the UARTs.
37The alias serialN will result in the UART being assigned port N. If any 37The 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 cf3979eb3578..59d862801e59 100644
--- a/Documentation/devicetree/bindings/sound/simple-card.txt
+++ b/Documentation/devicetree/bindings/sound/simple-card.txt
@@ -30,7 +30,7 @@ Optional subnodes:
30 sub-nodes. This container may be 30 sub-nodes. This container may be
31 omitted when the card has only one 31 omitted when the card has only one
32 DAI link. See the examples and the 32 DAI link. See the examples and the
33 section bellow. 33 section below.
34 34
35Dai-link subnode properties and subnodes: 35Dai-link subnode properties and subnodes:
36 36
diff --git a/Documentation/devicetree/bindings/timer/allwinner,sun5i-a13-hstimer.txt b/Documentation/devicetree/bindings/timer/allwinner,sun5i-a13-hstimer.txt
index 27cfc7d7ccd7..8d6e4fd2468e 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:
9 one) 9 one)
10- clocks: phandle to the source clock (usually the AHB clock) 10- clocks: phandle to the source clock (usually the AHB clock)
11 11
12Optionnal properties: 12Optional properties:
13- resets: phandle to a reset controller asserting the timer 13- resets: phandle to a reset controller asserting the timer
14 14
15Example: 15Example:
diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c
index 5f8c0b47045a..a946400a86d0 100644
--- a/arch/arc/kernel/setup.c
+++ b/arch/arc/kernel/setup.c
@@ -15,7 +15,6 @@
15#include <linux/cpu.h> 15#include <linux/cpu.h>
16#include <linux/of_fdt.h> 16#include <linux/of_fdt.h>
17#include <linux/of.h> 17#include <linux/of.h>
18#include <linux/of_platform.h>
19#include <linux/cache.h> 18#include <linux/cache.h>
20#include <asm/sections.h> 19#include <asm/sections.h>
21#include <asm/arcregs.h> 20#include <asm/arcregs.h>
@@ -436,12 +435,6 @@ void __init setup_arch(char **cmdline_p)
436 435
437static int __init customize_machine(void) 436static int __init customize_machine(void)
438{ 437{
439 /*
440 * Traverses flattened DeviceTree - registering platform devices
441 * (if any) complete with their resources
442 */
443 of_platform_default_populate(NULL, NULL, NULL);
444
445 if (machine_desc->init_machine) 438 if (machine_desc->init_machine)
446 machine_desc->init_machine(); 439 machine_desc->init_machine();
447 440
diff --git a/arch/arm/boot/dts/imx28-m28.dtsi b/arch/arm/boot/dts/imx28-m28.dtsi
index 6cebaa6b8833..214bb1506b53 100644
--- a/arch/arm/boot/dts/imx28-m28.dtsi
+++ b/arch/arm/boot/dts/imx28-m28.dtsi
@@ -37,7 +37,7 @@
37 status = "okay"; 37 status = "okay";
38 38
39 rtc: rtc@68 { 39 rtc: rtc@68 {
40 compatible = "stm,m41t62"; 40 compatible = "st,m41t62";
41 reg = <0x68>; 41 reg = <0x68>;
42 }; 42 };
43 }; 43 };
diff --git a/arch/arm/boot/dts/imx51-ts4800.dts b/arch/arm/boot/dts/imx51-ts4800.dts
index 0ff76a1bc0f1..30f44b5565b9 100644
--- a/arch/arm/boot/dts/imx51-ts4800.dts
+++ b/arch/arm/boot/dts/imx51-ts4800.dts
@@ -102,7 +102,7 @@
102 status = "okay"; 102 status = "okay";
103 103
104 rtc: m41t00@68 { 104 rtc: m41t00@68 {
105 compatible = "stm,m41t00"; 105 compatible = "st,m41t00";
106 reg = <0x68>; 106 reg = <0x68>;
107 }; 107 };
108}; 108};
diff --git a/arch/arm/boot/dts/imx53-m53.dtsi b/arch/arm/boot/dts/imx53-m53.dtsi
index 87a7fc709c2d..d259f57bfd98 100644
--- a/arch/arm/boot/dts/imx53-m53.dtsi
+++ b/arch/arm/boot/dts/imx53-m53.dtsi
@@ -84,7 +84,7 @@
84 }; 84 };
85 85
86 rtc: rtc@68 { 86 rtc: rtc@68 {
87 compatible = "stm,m41t62"; 87 compatible = "st,m41t62";
88 reg = <0x68>; 88 reg = <0x68>;
89 }; 89 };
90}; 90};
diff --git a/arch/arm/boot/dts/imx6q-dmo-edmqmx6.dts b/arch/arm/boot/dts/imx6q-dmo-edmqmx6.dts
index 364578d707a5..905907325f3b 100644
--- a/arch/arm/boot/dts/imx6q-dmo-edmqmx6.dts
+++ b/arch/arm/boot/dts/imx6q-dmo-edmqmx6.dts
@@ -282,7 +282,7 @@
282 }; 282 };
283 283
284 rtc: m41t62@68 { 284 rtc: m41t62@68 {
285 compatible = "stm,m41t62"; 285 compatible = "st,m41t62";
286 reg = <0x68>; 286 reg = <0x68>;
287 }; 287 };
288}; 288};
diff --git a/arch/arm/boot/dts/socfpga_cyclone5_socrates.dts b/arch/arm/boot/dts/socfpga_cyclone5_socrates.dts
index e1a61f20873f..d79853775061 100644
--- a/arch/arm/boot/dts/socfpga_cyclone5_socrates.dts
+++ b/arch/arm/boot/dts/socfpga_cyclone5_socrates.dts
@@ -52,7 +52,7 @@
52 status = "okay"; 52 status = "okay";
53 53
54 rtc: rtc@68 { 54 rtc: rtc@68 {
55 compatible = "stm,m41t82"; 55 compatible = "st,m41t82";
56 reg = <0x68>; 56 reg = <0x68>;
57 }; 57 };
58}; 58};
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 85a0bcb1f7ca..da2f6c360f6b 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -19,7 +19,6 @@
19#include <linux/bootmem.h> 19#include <linux/bootmem.h>
20#include <linux/seq_file.h> 20#include <linux/seq_file.h>
21#include <linux/screen_info.h> 21#include <linux/screen_info.h>
22#include <linux/of_iommu.h>
23#include <linux/of_platform.h> 22#include <linux/of_platform.h>
24#include <linux/init.h> 23#include <linux/init.h>
25#include <linux/kexec.h> 24#include <linux/kexec.h>
@@ -903,14 +902,9 @@ static int __init customize_machine(void)
903 * machine from the device tree, if no callback is provided, 902 * machine from the device tree, if no callback is provided,
904 * otherwise we would always need an init_machine callback. 903 * otherwise we would always need an init_machine callback.
905 */ 904 */
906 of_iommu_init();
907 if (machine_desc->init_machine) 905 if (machine_desc->init_machine)
908 machine_desc->init_machine(); 906 machine_desc->init_machine();
909#ifdef CONFIG_OF 907
910 else
911 of_platform_populate(NULL, of_default_bus_match_table,
912 NULL, NULL);
913#endif
914 return 0; 908 return 0;
915} 909}
916arch_initcall(customize_machine); 910arch_initcall(customize_machine);
diff --git a/arch/arm/mach-artpec/board-artpec6.c b/arch/arm/mach-artpec/board-artpec6.c
index 71513df3374e..a0b1979c2c2c 100644
--- a/arch/arm/mach-artpec/board-artpec6.c
+++ b/arch/arm/mach-artpec/board-artpec6.c
@@ -13,7 +13,6 @@
13#include <linux/irqchip.h> 13#include <linux/irqchip.h>
14#include <linux/irqchip/arm-gic.h> 14#include <linux/irqchip/arm-gic.h>
15#include <linux/mfd/syscon.h> 15#include <linux/mfd/syscon.h>
16#include <linux/of_platform.h>
17#include <linux/of.h> 16#include <linux/of.h>
18#include <linux/of_address.h> 17#include <linux/of_address.h>
19#include <linux/clk-provider.h> 18#include <linux/clk-provider.h>
@@ -44,8 +43,6 @@ static void __init artpec6_init_machine(void)
44 regmap_write(regmap, ARTPEC6_DMACFG_REGNUM, 43 regmap_write(regmap, ARTPEC6_DMACFG_REGNUM,
45 ARTPEC6_DMACFG_UARTS_BURST); 44 ARTPEC6_DMACFG_UARTS_BURST);
46 }; 45 };
47
48 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
49} 46}
50 47
51static void artpec6_l2c310_write_sec(unsigned long val, unsigned reg) 48static void artpec6_l2c310_write_sec(unsigned long val, unsigned reg)
diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
index 63b4fa25b48a..d068ec3cd1f6 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)
30 if (soc != NULL) 30 if (soc != NULL)
31 soc_dev = soc_device_to_device(soc); 31 soc_dev = soc_device_to_device(soc);
32 32
33 of_platform_populate(NULL, of_default_bus_match_table, NULL, soc_dev); 33 of_platform_default_populate(NULL, NULL, soc_dev);
34 34
35 at91rm9200_pm_init(); 35 at91rm9200_pm_init();
36} 36}
diff --git a/arch/arm/mach-at91/at91sam9.c b/arch/arm/mach-at91/at91sam9.c
index cada2a6412b3..ba28e9cc584d 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)
61 if (soc != NULL) 61 if (soc != NULL)
62 soc_dev = soc_device_to_device(soc); 62 soc_dev = soc_device_to_device(soc);
63 63
64 of_platform_populate(NULL, of_default_bus_match_table, NULL, soc_dev); 64 of_platform_default_populate(NULL, NULL, soc_dev);
65} 65}
66 66
67static void __init at91sam9_dt_device_init(void) 67static void __init at91sam9_dt_device_init(void)
diff --git a/arch/arm/mach-at91/sama5.c b/arch/arm/mach-at91/sama5.c
index 922b85f07cd2..b272c45b400f 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)
68 if (soc != NULL) 68 if (soc != NULL)
69 soc_dev = soc_device_to_device(soc); 69 soc_dev = soc_device_to_device(soc);
70 70
71 of_platform_populate(NULL, of_default_bus_match_table, NULL, soc_dev); 71 of_platform_default_populate(NULL, NULL, soc_dev);
72 sama5_pm_init(); 72 sama5_pm_init();
73} 73}
74 74
diff --git a/arch/arm/mach-bcm/board_bcm21664.c b/arch/arm/mach-bcm/board_bcm21664.c
index 82ad5687771f..0d7034c57334 100644
--- a/arch/arm/mach-bcm/board_bcm21664.c
+++ b/arch/arm/mach-bcm/board_bcm21664.c
@@ -12,7 +12,6 @@
12 */ 12 */
13 13
14#include <linux/of_address.h> 14#include <linux/of_address.h>
15#include <linux/of_platform.h>
16#include <linux/io.h> 15#include <linux/io.h>
17 16
18#include <asm/mach/arch.h> 17#include <asm/mach/arch.h>
@@ -60,7 +59,6 @@ static void bcm21664_restart(enum reboot_mode mode, const char *cmd)
60 59
61static void __init bcm21664_init(void) 60static void __init bcm21664_init(void)
62{ 61{
63 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
64 kona_l2_cache_init(); 62 kona_l2_cache_init();
65} 63}
66 64
diff --git a/arch/arm/mach-bcm/board_bcm281xx.c b/arch/arm/mach-bcm/board_bcm281xx.c
index 2e367bd7c600..b81bb386951d 100644
--- a/arch/arm/mach-bcm/board_bcm281xx.c
+++ b/arch/arm/mach-bcm/board_bcm281xx.c
@@ -13,7 +13,6 @@
13 13
14#include <linux/clocksource.h> 14#include <linux/clocksource.h>
15#include <linux/of_address.h> 15#include <linux/of_address.h>
16#include <linux/of_platform.h>
17 16
18#include <asm/mach/arch.h> 17#include <asm/mach/arch.h>
19 18
@@ -58,7 +57,6 @@ static void bcm281xx_restart(enum reboot_mode mode, const char *cmd)
58 57
59static void __init bcm281xx_init(void) 58static void __init bcm281xx_init(void)
60{ 59{
61 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
62 kona_l2_cache_init(); 60 kona_l2_cache_init();
63} 61}
64 62
diff --git a/arch/arm/mach-bcm/board_bcm2835.c b/arch/arm/mach-bcm/board_bcm2835.c
index 834d67684e20..0c1edfc98696 100644
--- a/arch/arm/mach-bcm/board_bcm2835.c
+++ b/arch/arm/mach-bcm/board_bcm2835.c
@@ -15,7 +15,6 @@
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/irqchip.h> 16#include <linux/irqchip.h>
17#include <linux/of_address.h> 17#include <linux/of_address.h>
18#include <linux/of_platform.h>
19#include <linux/clk/bcm2835.h> 18#include <linux/clk/bcm2835.h>
20 19
21#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
@@ -23,16 +22,7 @@
23 22
24static void __init bcm2835_init(void) 23static void __init bcm2835_init(void)
25{ 24{
26 int ret;
27
28 bcm2835_init_clocks(); 25 bcm2835_init_clocks();
29
30 ret = of_platform_populate(NULL, of_default_bus_match_table, NULL,
31 NULL);
32 if (ret) {
33 pr_err("of_platform_populate failed: %d\n", ret);
34 BUG();
35 }
36} 26}
37 27
38static const char * const bcm2835_compat[] = { 28static const char * const bcm2835_compat[] = {
diff --git a/arch/arm/mach-cns3xxx/core.c b/arch/arm/mach-cns3xxx/core.c
index 9b1dc223d8d3..03da3813f1ab 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)
395 395
396 pm_power_off = cns3xxx_power_off; 396 pm_power_off = cns3xxx_power_off;
397 397
398 of_platform_populate(NULL, of_default_bus_match_table, 398 of_platform_default_populate(NULL, cns3xxx_auxdata, NULL);
399 cns3xxx_auxdata, NULL);
400} 399}
401 400
402static const char *const cns3xxx_dt_compat[] __initconst = { 401static const char *const cns3xxx_dt_compat[] __initconst = {
diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index 52ccf247e079..dea410adee7e 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -14,7 +14,6 @@
14#include <linux/of.h> 14#include <linux/of.h>
15#include <linux/of_address.h> 15#include <linux/of_address.h>
16#include <linux/of_fdt.h> 16#include <linux/of_fdt.h>
17#include <linux/of_platform.h>
18#include <linux/platform_device.h> 17#include <linux/platform_device.h>
19#include <linux/irqchip.h> 18#include <linux/irqchip.h>
20#include <linux/soc/samsung/exynos-regs-pmu.h> 19#include <linux/soc/samsung/exynos-regs-pmu.h>
@@ -217,8 +216,6 @@ static void __init exynos_dt_machine_init(void)
217 of_machine_is_compatible("samsung,exynos3250") || 216 of_machine_is_compatible("samsung,exynos3250") ||
218 of_machine_is_compatible("samsung,exynos5250")) 217 of_machine_is_compatible("samsung,exynos5250"))
219 platform_device_register(&exynos_cpuidle); 218 platform_device_register(&exynos_cpuidle);
220
221 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
222} 219}
223 220
224static char const *const exynos_dt_compat[] __initconst = { 221static char const *const exynos_dt_compat[] __initconst = {
diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c
index 6050a14faee6..07f60986dc2c 100644
--- a/arch/arm/mach-highbank/highbank.c
+++ b/arch/arm/mach-highbank/highbank.c
@@ -23,7 +23,6 @@
23#include <linux/pl320-ipc.h> 23#include <linux/pl320-ipc.h>
24#include <linux/of.h> 24#include <linux/of.h>
25#include <linux/of_irq.h> 25#include <linux/of_irq.h>
26#include <linux/of_platform.h>
27#include <linux/of_address.h> 26#include <linux/of_address.h>
28#include <linux/reboot.h> 27#include <linux/reboot.h>
29#include <linux/amba/bus.h> 28#include <linux/amba/bus.h>
@@ -163,8 +162,6 @@ static void __init highbank_init(void)
163 162
164 pl320_ipc_register_notifier(&hb_keys_nb); 163 pl320_ipc_register_notifier(&hb_keys_nb);
165 164
166 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
167
168 if (psci_ops.cpu_suspend) 165 if (psci_ops.cpu_suspend)
169 platform_device_register(&highbank_cpuidle_device); 166 platform_device_register(&highbank_cpuidle_device);
170} 167}
diff --git a/arch/arm/mach-imx/mach-imx51.c b/arch/arm/mach-imx/mach-imx51.c
index 10a82a4f1e58..ec64de611d90 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)
52{ 52{
53 imx51_ipu_mipi_setup(); 53 imx51_ipu_mipi_setup();
54 imx_src_init(); 54 imx_src_init();
55
56 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
57} 55}
58 56
59static void __init imx51_init_late(void) 57static 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 18b5c5c136db..68aec23be016 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)
32{ 32{
33 imx_src_init(); 33 imx_src_init();
34 34
35 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
36
37 imx_aips_allow_unprivileged_access("fsl,imx53-aipstz"); 35 imx_aips_allow_unprivileged_access("fsl,imx53-aipstz");
38} 36}
39 37
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index cb27d566d5ab..e3940707eeb8 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)
278 278
279 imx6q_enet_phy_init(); 279 imx6q_enet_phy_init();
280 280
281 of_platform_populate(NULL, of_default_bus_match_table, NULL, parent); 281 of_platform_default_populate(NULL, NULL, parent);
282 282
283 imx_anatop_init(); 283 imx_anatop_init();
284 cpu_is_imx6q() ? imx6q_pm_init() : imx6dl_pm_init(); 284 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 300326373166..37ae87d6e0e9 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)
52 if (parent == NULL) 52 if (parent == NULL)
53 pr_warn("failed to initialize soc device\n"); 53 pr_warn("failed to initialize soc device\n");
54 54
55 of_platform_populate(NULL, of_default_bus_match_table, NULL, parent); 55 of_platform_default_populate(NULL, NULL, parent);
56 56
57 imx6sl_fec_init(); 57 imx6sl_fec_init();
58 imx_anatop_init(); 58 imx_anatop_init();
diff --git a/arch/arm/mach-imx/mach-imx6sx.c b/arch/arm/mach-imx/mach-imx6sx.c
index 6a0b0614de29..107cfc15282b 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)
72 if (parent == NULL) 72 if (parent == NULL)
73 pr_warn("failed to initialize soc device\n"); 73 pr_warn("failed to initialize soc device\n");
74 74
75 of_platform_populate(NULL, of_default_bus_match_table, NULL, parent); 75 of_platform_default_populate(NULL, NULL, parent);
76 76
77 imx6sx_enet_init(); 77 imx6sx_enet_init();
78 imx_anatop_init(); 78 imx_anatop_init();
diff --git a/arch/arm/mach-imx/mach-imx6ul.c b/arch/arm/mach-imx/mach-imx6ul.c
index b56de4b8cdf2..5d9bfab279dd 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)
64 if (parent == NULL) 64 if (parent == NULL)
65 pr_warn("failed to initialize soc device\n"); 65 pr_warn("failed to initialize soc device\n");
66 66
67 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
68 imx6ul_enet_init(); 67 imx6ul_enet_init();
69 imx_anatop_init(); 68 imx_anatop_init();
70 imx6ul_pm_init(); 69 imx6ul_pm_init();
diff --git a/arch/arm/mach-imx/mach-imx7d.c b/arch/arm/mach-imx/mach-imx7d.c
index b450f525a670..f388e6bd46ec 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)
93 if (parent == NULL) 93 if (parent == NULL)
94 pr_warn("failed to initialize soc device\n"); 94 pr_warn("failed to initialize soc device\n");
95 95
96 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
97 imx_anatop_init(); 96 imx_anatop_init();
98 imx7d_enet_init(); 97 imx7d_enet_init();
99} 98}
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c
index 2b118f20c62c..c7bb83205f5b 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)
240 if (!ebi_base) 240 if (!ebi_base)
241 return; 241 return;
242 242
243 of_platform_populate(NULL, of_default_bus_match_table, 243 of_platform_default_populate(NULL, ap_auxdata_lookup, NULL);
244 ap_auxdata_lookup, NULL);
245 244
246 sc_dec = readl(ap_syscon_base + INTEGRATOR_SC_DEC_OFFSET); 245 sc_dec = readl(ap_syscon_base + INTEGRATOR_SC_DEC_OFFSET);
247 for (i = 0; i < 4; i++) { 246 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 6f6b051e81e0..825298349bf5 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)
231 if (!intcp_con_base) 231 if (!intcp_con_base)
232 return; 232 return;
233 233
234 of_platform_populate(NULL, of_default_bus_match_table, 234 of_platform_default_populate(NULL, intcp_auxdata_lookup, NULL);
235 intcp_auxdata_lookup, NULL);
236} 235}
237 236
238static const char * intcp_dt_board_compat[] = { 237static const char * intcp_dt_board_compat[] = {
diff --git a/arch/arm/mach-keystone/keystone.c b/arch/arm/mach-keystone/keystone.c
index a33a296b00dc..84613abf35a3 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)
60 bus_register_notifier(&platform_bus_type, &platform_nb); 60 bus_register_notifier(&platform_bus_type, &platform_nb);
61 } 61 }
62 keystone_pm_runtime_init(); 62 keystone_pm_runtime_init();
63 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
64} 63}
65 64
66static long long __init keystone_pv_fixup(void) 65static long long __init keystone_pv_fixup(void)
diff --git a/arch/arm/mach-lpc32xx/phy3250.c b/arch/arm/mach-lpc32xx/phy3250.c
index 81265e80302d..0e4cbbe980eb 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)
191 LPC32XX_CLKPWR_TESTCLK_TESTCLK2_EN, 191 LPC32XX_CLKPWR_TESTCLK_TESTCLK2_EN,
192 LPC32XX_CLKPWR_TEST_CLK_SEL); 192 LPC32XX_CLKPWR_TEST_CLK_SEL);
193 193
194 of_platform_populate(NULL, of_default_bus_match_table, 194 of_platform_default_populate(NULL, lpc32xx_auxdata_lookup, NULL);
195 lpc32xx_auxdata_lookup, NULL);
196} 195}
197 196
198static const char *const lpc32xx_dt_compat[] __initconst = { 197static const char *const lpc32xx_dt_compat[] __initconst = {
diff --git a/arch/arm/mach-mvebu/board-v7.c b/arch/arm/mach-mvebu/board-v7.c
index 1648edd515a2..ccca95173e17 100644
--- a/arch/arm/mach-mvebu/board-v7.c
+++ b/arch/arm/mach-mvebu/board-v7.c
@@ -16,7 +16,6 @@
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/of_address.h> 17#include <linux/of_address.h>
18#include <linux/of_fdt.h> 18#include <linux/of_fdt.h>
19#include <linux/of_platform.h>
20#include <linux/io.h> 19#include <linux/io.h>
21#include <linux/clocksource.h> 20#include <linux/clocksource.h>
22#include <linux/dma-mapping.h> 21#include <linux/dma-mapping.h>
@@ -144,8 +143,6 @@ static void __init mvebu_dt_init(void)
144{ 143{
145 if (of_machine_is_compatible("marvell,armadaxp")) 144 if (of_machine_is_compatible("marvell,armadaxp"))
146 i2c_quirk(); 145 i2c_quirk();
147
148 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
149} 146}
150 147
151static const char * const armada_370_xp_dt_compat[] __initconst = { 148static 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 1aebb82e3d7b..d076c5771adc 100644
--- a/arch/arm/mach-mvebu/dove.c
+++ b/arch/arm/mach-mvebu/dove.c
@@ -11,7 +11,6 @@
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/mbus.h> 12#include <linux/mbus.h>
13#include <linux/of.h> 13#include <linux/of.h>
14#include <linux/of_platform.h>
15#include <linux/soc/dove/pmu.h> 14#include <linux/soc/dove/pmu.h>
16#include <asm/hardware/cache-tauros2.h> 15#include <asm/hardware/cache-tauros2.h>
17#include <asm/mach/arch.h> 16#include <asm/mach/arch.h>
@@ -26,7 +25,6 @@ static void __init dove_init(void)
26#endif 25#endif
27 BUG_ON(mvebu_mbus_dt_init(false)); 26 BUG_ON(mvebu_mbus_dt_init(false));
28 dove_init_pmu(); 27 dove_init_pmu();
29 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
30} 28}
31 29
32static const char * const dove_dt_compat[] __initconst = { 30static const char * const dove_dt_compat[] __initconst = {
diff --git a/arch/arm/mach-mvebu/kirkwood.c b/arch/arm/mach-mvebu/kirkwood.c
index f9d8e1ea7183..8f459ee34e6f 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)
179 kirkwood_pm_init(); 179 kirkwood_pm_init();
180 kirkwood_dt_eth_fixup(); 180 kirkwood_dt_eth_fixup();
181 181
182 of_platform_populate(NULL, of_default_bus_match_table, auxdata, NULL); 182 of_platform_default_populate(NULL, auxdata, NULL);
183} 183}
184 184
185static const char * const kirkwood_dt_board_compat[] __initconst = { 185static 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 f1ea4700efcf..0b7fe74ff46d 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)
498 else if (of_machine_is_compatible("msr,m28cu3")) 498 else if (of_machine_is_compatible("msr,m28cu3"))
499 m28cu3_init(); 499 m28cu3_init();
500 500
501 of_platform_populate(NULL, of_default_bus_match_table, 501 of_platform_default_populate(NULL, NULL, parent);
502 NULL, parent);
503 502
504 mxs_restart_init(); 503 mxs_restart_init();
505 504
diff --git a/arch/arm/mach-nspire/nspire.c b/arch/arm/mach-nspire/nspire.c
index 34c2a1b32e7d..f0808fcc5acc 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 = {
57 57
58static void __init nspire_init(void) 58static void __init nspire_init(void)
59{ 59{
60 of_platform_populate(NULL, of_default_bus_match_table, 60 of_platform_default_populate(NULL, nspire_auxdata, NULL);
61 nspire_auxdata, NULL);
62} 61}
63 62
64static void nspire_restart(enum reboot_mode mode, const char *cmd) 63static 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 6f4c2c4ae2a5..3d36f1d95196 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)
63 if (of_machine_is_compatible("maxtor,shared-storage-2")) 63 if (of_machine_is_compatible("maxtor,shared-storage-2"))
64 mss2_init(); 64 mss2_init();
65 65
66 of_platform_populate(NULL, of_default_bus_match_table, 66 of_platform_default_populate(NULL, orion5x_auxdata_lookup, NULL);
67 orion5x_auxdata_lookup, NULL);
68} 67}
69 68
70static const char *orion5x_dt_compat[] = { 69static const char *orion5x_dt_compat[] = {
diff --git a/arch/arm/mach-picoxcell/common.c b/arch/arm/mach-picoxcell/common.c
index ec79fea82704..4e3d6d5c82cd 100644
--- a/arch/arm/mach-picoxcell/common.c
+++ b/arch/arm/mach-picoxcell/common.c
@@ -10,7 +10,6 @@
10#include <linux/delay.h> 10#include <linux/delay.h>
11#include <linux/of.h> 11#include <linux/of.h>
12#include <linux/of_address.h> 12#include <linux/of_address.h>
13#include <linux/of_platform.h>
14#include <linux/reboot.h> 13#include <linux/reboot.h>
15 14
16#include <asm/mach/arch.h> 15#include <asm/mach/arch.h>
@@ -54,7 +53,6 @@ static void __init picoxcell_map_io(void)
54 53
55static void __init picoxcell_init_machine(void) 54static void __init picoxcell_init_machine(void)
56{ 55{
57 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
58 picoxcell_setup_restart(); 56 picoxcell_setup_restart();
59} 57}
60 58
diff --git a/arch/arm/mach-rockchip/rockchip.c b/arch/arm/mach-rockchip/rockchip.c
index beb71da5d9c8..a7ab9ec141f8 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)
73static void __init rockchip_dt_init(void) 73static void __init rockchip_dt_init(void)
74{ 74{
75 rockchip_suspend_init(); 75 rockchip_suspend_init();
76 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
77} 76}
78 77
79static const char * const rockchip_board_dt_compat[] = { 78static 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 5f028ff84cfe..c83c076578dd 100644
--- a/arch/arm/mach-s3c24xx/mach-s3c2416-dt.c
+++ b/arch/arm/mach-s3c24xx/mach-s3c2416-dt.c
@@ -17,7 +17,6 @@
17 17
18#include <linux/clocksource.h> 18#include <linux/clocksource.h>
19#include <linux/irqchip.h> 19#include <linux/irqchip.h>
20#include <linux/of_platform.h>
21#include <linux/serial_s3c.h> 20#include <linux/serial_s3c.h>
22 21
23#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
@@ -35,7 +34,6 @@ static void __init s3c2416_dt_map_io(void)
35 34
36static void __init s3c2416_dt_machine_init(void) 35static void __init s3c2416_dt_machine_init(void)
37{ 36{
38 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
39 s3c_pm_init(); 37 s3c_pm_init();
40} 38}
41 39
diff --git a/arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c b/arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c
index bbf74edd3dd9..5bf9afae752d 100644
--- a/arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c
+++ b/arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c
@@ -8,8 +8,6 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9*/ 9*/
10 10
11#include <linux/of_platform.h>
12
13#include <asm/mach/arch.h> 11#include <asm/mach/arch.h>
14#include <asm/mach/map.h> 12#include <asm/mach/map.h>
15#include <asm/system_misc.h> 13#include <asm/system_misc.h>
@@ -48,7 +46,6 @@ static void __init s3c64xx_dt_map_io(void)
48static void __init s3c64xx_dt_init_machine(void) 46static void __init s3c64xx_dt_init_machine(void)
49{ 47{
50 samsung_wdt_reset_of_init(); 48 samsung_wdt_reset_of_init();
51 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
52} 49}
53 50
54static void s3c64xx_dt_restart(enum reboot_mode mode, const char *cmd) 51static 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 db6dbfbaf9f1..3849eef0d3a7 100644
--- a/arch/arm/mach-shmobile/setup-r8a7740.c
+++ b/arch/arm/mach-shmobile/setup-r8a7740.c
@@ -18,7 +18,6 @@
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/irqchip.h> 19#include <linux/irqchip.h>
20#include <linux/irqchip/arm-gic.h> 20#include <linux/irqchip/arm-gic.h>
21#include <linux/of_platform.h>
22 21
23#include <asm/mach/map.h> 22#include <asm/mach/map.h>
24#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
@@ -77,8 +76,6 @@ static void __init r8a7740_init_irq_of(void)
77static void __init r8a7740_generic_init(void) 76static void __init r8a7740_generic_init(void)
78{ 77{
79 r8a7740_meram_workaround(); 78 r8a7740_meram_workaround();
80
81 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
82} 79}
83 80
84static const char *const r8a7740_boards_compat_dt[] __initconst = { 81static 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 99a2004cac76..a25ff188e403 100644
--- a/arch/arm/mach-shmobile/setup-sh73a0.c
+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
@@ -18,7 +18,6 @@
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/irq.h> 20#include <linux/irq.h>
21#include <linux/of_platform.h>
22#include <linux/delay.h> 21#include <linux/delay.h>
23#include <linux/input.h> 22#include <linux/input.h>
24#include <linux/io.h> 23#include <linux/io.h>
@@ -55,7 +54,6 @@ static void __init sh73a0_generic_init(void)
55 /* Shared attribute override enable, 64K*8way */ 54 /* Shared attribute override enable, 64K*8way */
56 l2x0_init(IOMEM(0xf0100000), 0x00400000, 0xc20f0fff); 55 l2x0_init(IOMEM(0xf0100000), 0x00400000, 0xc20f0fff);
57#endif 56#endif
58 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
59} 57}
60 58
61static const char *const sh73a0_boards_compat_dt[] __initconst = { 59static 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 cd5d375d91f0..a7d4f136836f 100644
--- a/arch/arm/mach-spear/spear1310.c
+++ b/arch/arm/mach-spear/spear1310.c
@@ -14,7 +14,6 @@
14#define pr_fmt(fmt) "SPEAr1310: " fmt 14#define pr_fmt(fmt) "SPEAr1310: " fmt
15 15
16#include <linux/amba/pl022.h> 16#include <linux/amba/pl022.h>
17#include <linux/of_platform.h>
18#include <linux/pata_arasan_cf_data.h> 17#include <linux/pata_arasan_cf_data.h>
19#include <asm/mach/arch.h> 18#include <asm/mach/arch.h>
20#include <asm/mach/map.h> 19#include <asm/mach/map.h>
@@ -27,7 +26,6 @@
27 26
28static void __init spear1310_dt_init(void) 27static void __init spear1310_dt_init(void)
29{ 28{
30 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
31 platform_device_register_simple("spear-cpufreq", -1, NULL, 0); 29 platform_device_register_simple("spear-cpufreq", -1, NULL, 0);
32} 30}
33 31
diff --git a/arch/arm/mach-spear/spear1340.c b/arch/arm/mach-spear/spear1340.c
index 94594d5a446c..a212af90c0bc 100644
--- a/arch/arm/mach-spear/spear1340.c
+++ b/arch/arm/mach-spear/spear1340.c
@@ -19,7 +19,6 @@
19 19
20static void __init spear1340_dt_init(void) 20static void __init spear1340_dt_init(void)
21{ 21{
22 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
23 platform_device_register_simple("spear-cpufreq", -1, NULL, 0); 22 platform_device_register_simple("spear-cpufreq", -1, NULL, 0);
24} 23}
25 24
diff --git a/arch/arm/mach-spear/spear300.c b/arch/arm/mach-spear/spear300.c
index 5b32edda2276..325b89579be1 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)
194 pl080_plat_data.slave_channels = spear300_dma_info; 194 pl080_plat_data.slave_channels = spear300_dma_info;
195 pl080_plat_data.num_slave_channels = ARRAY_SIZE(spear300_dma_info); 195 pl080_plat_data.num_slave_channels = ARRAY_SIZE(spear300_dma_info);
196 196
197 of_platform_populate(NULL, of_default_bus_match_table, 197 of_platform_default_populate(NULL, spear300_auxdata_lookup, NULL);
198 spear300_auxdata_lookup, NULL);
199} 198}
200 199
201static const char * const spear300_dt_board_compat[] = { 200static const char * const spear300_dt_board_compat[] = {
diff --git a/arch/arm/mach-spear/spear310.c b/arch/arm/mach-spear/spear310.c
index 86a44ac7ff67..59e173dc85cf 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)
236 pl080_plat_data.slave_channels = spear310_dma_info; 236 pl080_plat_data.slave_channels = spear310_dma_info;
237 pl080_plat_data.num_slave_channels = ARRAY_SIZE(spear310_dma_info); 237 pl080_plat_data.num_slave_channels = ARRAY_SIZE(spear310_dma_info);
238 238
239 of_platform_populate(NULL, of_default_bus_match_table, 239 of_platform_default_populate(NULL, spear310_auxdata_lookup, NULL);
240 spear310_auxdata_lookup, NULL);
241} 240}
242 241
243static const char * const spear310_dt_board_compat[] = { 242static const char * const spear310_dt_board_compat[] = {
diff --git a/arch/arm/mach-spear/spear320.c b/arch/arm/mach-spear/spear320.c
index d45d751926c5..0958f68a21e2 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)
240 pl080_plat_data.slave_channels = spear320_dma_info; 240 pl080_plat_data.slave_channels = spear320_dma_info;
241 pl080_plat_data.num_slave_channels = ARRAY_SIZE(spear320_dma_info); 241 pl080_plat_data.num_slave_channels = ARRAY_SIZE(spear320_dma_info);
242 242
243 of_platform_populate(NULL, of_default_bus_match_table, 243 of_platform_default_populate(NULL, spear320_auxdata_lookup, NULL);
244 spear320_auxdata_lookup, NULL);
245} 244}
246 245
247static const char * const spear320_dt_board_compat[] = { 246static const char * const spear320_dt_board_compat[] = {
diff --git a/arch/arm/mach-spear/spear6xx.c b/arch/arm/mach-spear/spear6xx.c
index da26fa5b68d7..ccf3573b831c 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 = {
411 411
412static void __init spear600_dt_init(void) 412static void __init spear600_dt_init(void)
413{ 413{
414 of_platform_populate(NULL, of_default_bus_match_table, 414 of_platform_default_populate(NULL, spear6xx_auxdata_lookup, NULL);
415 spear6xx_auxdata_lookup, NULL);
416} 415}
417 416
418static const char *spear600_dt_board_compat[] = { 417static const char *spear600_dt_board_compat[] = {
diff --git a/arch/arm/mach-tegra/tegra.c b/arch/arm/mach-tegra/tegra.c
index 2378fa560a21..6745a657d261 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)
115 * devices 115 * devices
116 */ 116 */
117out: 117out:
118 of_platform_populate(NULL, of_default_bus_match_table, NULL, parent); 118 of_platform_default_populate(NULL, NULL, parent);
119} 119}
120 120
121static void __init paz00_init(void) 121static void __init paz00_init(void)
diff --git a/arch/arm/mach-u300/core.c b/arch/arm/mach-u300/core.c
index 546338bbacf8..a4910ea6811a 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)
391 pinctrl_register_mappings(u300_pinmux_map, 391 pinctrl_register_mappings(u300_pinmux_map,
392 ARRAY_SIZE(u300_pinmux_map)); 392 ARRAY_SIZE(u300_pinmux_map));
393 393
394 of_platform_populate(NULL, of_default_bus_match_table, 394 of_platform_default_populate(NULL, u300_auxdata_lookup, NULL);
395 u300_auxdata_lookup, NULL);
396 395
397 /* Enable SEMI self refresh */ 396 /* Enable SEMI self refresh */
398 val = readw(syscon_base + U300_SYSCON_SMCR) | 397 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 d643b9210dbd..3c8d39c12909 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)
344 344
345 versatile_dt_pci_init(); 345 versatile_dt_pci_init();
346 346
347 of_platform_populate(NULL, of_default_bus_match_table, 347 of_platform_default_populate(NULL, versatile_auxdata_lookup, NULL);
348 versatile_auxdata_lookup, NULL);
349} 348}
350 349
351static const char *const versatile_dt_match[] __initconst = { 350static const char *const versatile_dt_match[] __initconst = {
diff --git a/arch/arm/mach-vt8500/vt8500.c b/arch/arm/mach-vt8500/vt8500.c
index 3bc0dc9a4d69..773c04fdb746 100644
--- a/arch/arm/mach-vt8500/vt8500.c
+++ b/arch/arm/mach-vt8500/vt8500.c
@@ -30,7 +30,6 @@
30#include <linux/of.h> 30#include <linux/of.h>
31#include <linux/of_address.h> 31#include <linux/of_address.h>
32#include <linux/of_irq.h> 32#include <linux/of_irq.h>
33#include <linux/of_platform.h>
34 33
35#define LEGACY_GPIO_BASE 0xD8110000 34#define LEGACY_GPIO_BASE 0xD8110000
36#define LEGACY_PMC_BASE 0xD8130000 35#define LEGACY_PMC_BASE 0xD8130000
@@ -158,8 +157,6 @@ static void __init vt8500_init(void)
158 pm_power_off = &vt8500_power_off; 157 pm_power_off = &vt8500_power_off;
159 else 158 else
160 pr_err("%s: PMC Hibernation register could not be remapped, not enabling power off!\n", __func__); 159 pr_err("%s: PMC Hibernation register could not be remapped, not enabling power off!\n", __func__);
161
162 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
163} 160}
164 161
165static const char * const vt8500_dt_compat[] = { 162static const char * const vt8500_dt_compat[] = {
diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c
index da876d28ccbc..d12002cd63bc 100644
--- a/arch/arm/mach-zynq/common.c
+++ b/arch/arm/mach-zynq/common.c
@@ -141,7 +141,7 @@ out:
141 * Finished with the static registrations now; fill in the missing 141 * Finished with the static registrations now; fill in the missing
142 * devices 142 * devices
143 */ 143 */
144 of_platform_populate(NULL, of_default_bus_match_table, NULL, parent); 144 of_platform_default_populate(NULL, NULL, parent);
145 145
146 platform_device_register(&zynq_cpuidle_device); 146 platform_device_register(&zynq_cpuidle_device);
147} 147}
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index 2981f1bdd073..536dce22fe76 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -39,9 +39,7 @@
39#include <linux/fs.h> 39#include <linux/fs.h>
40#include <linux/proc_fs.h> 40#include <linux/proc_fs.h>
41#include <linux/memblock.h> 41#include <linux/memblock.h>
42#include <linux/of_iommu.h>
43#include <linux/of_fdt.h> 42#include <linux/of_fdt.h>
44#include <linux/of_platform.h>
45#include <linux/efi.h> 43#include <linux/efi.h>
46#include <linux/psci.h> 44#include <linux/psci.h>
47 45
@@ -303,19 +301,6 @@ void __init setup_arch(char **cmdline_p)
303 } 301 }
304} 302}
305 303
306static int __init arm64_device_init(void)
307{
308 if (of_have_populated_dt()) {
309 of_iommu_init();
310 of_platform_populate(NULL, of_default_bus_match_table,
311 NULL, NULL);
312 } else if (acpi_disabled) {
313 pr_crit("Device tree not populated\n");
314 }
315 return 0;
316}
317arch_initcall_sync(arm64_device_init);
318
319static int __init topology_init(void) 304static int __init topology_init(void)
320{ 305{
321 int i; 306 int i;
diff --git a/arch/c6x/platforms/Makefile b/arch/c6x/platforms/Makefile
index 9a95b9bca8d0..5f7d93468b6e 100644
--- a/arch/c6x/platforms/Makefile
+++ b/arch/c6x/platforms/Makefile
@@ -4,7 +4,7 @@
4# Copyright 2010, 2011 Texas Instruments Incorporated 4# Copyright 2010, 2011 Texas Instruments Incorporated
5# 5#
6 6
7obj-y = platform.o cache.o megamod-pic.o pll.o plldata.o timer64.o 7obj-y = cache.o megamod-pic.o pll.o plldata.o timer64.o
8obj-y += dscr.o 8obj-y += dscr.o
9 9
10# SoC objects 10# SoC objects
diff --git a/arch/c6x/platforms/platform.c b/arch/c6x/platforms/platform.c
deleted file mode 100644
index 26c1a355d600..000000000000
--- a/arch/c6x/platforms/platform.c
+++ /dev/null
@@ -1,17 +0,0 @@
1/*
2 * Copyright 2011 Texas Instruments Incorporated
3 *
4 * This file is licensed under the terms of the GNU General Public License
5 * version 2. This program is licensed "as is" without any warranty of any
6 * kind, whether express or implied.
7 */
8
9#include <linux/init.h>
10#include <linux/of_platform.h>
11
12static int __init c6x_device_probe(void)
13{
14 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
15 return 0;
16}
17core_initcall(c6x_device_probe);
diff --git a/arch/cris/kernel/setup.c b/arch/cris/kernel/setup.c
index bb12aa93201d..4b4853d914e2 100644
--- a/arch/cris/kernel/setup.c
+++ b/arch/cris/kernel/setup.c
@@ -21,7 +21,6 @@
21#include <linux/cpu.h> 21#include <linux/cpu.h>
22#include <linux/of.h> 22#include <linux/of.h>
23#include <linux/of_fdt.h> 23#include <linux/of_fdt.h>
24#include <linux/of_platform.h>
25#include <asm/setup.h> 24#include <asm/setup.h>
26#include <arch/system.h> 25#include <arch/system.h>
27 26
@@ -212,10 +211,3 @@ static int __init topology_init(void)
212} 211}
213 212
214subsys_initcall(topology_init); 213subsys_initcall(topology_init);
215
216static int __init cris_of_init(void)
217{
218 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
219 return 0;
220}
221core_initcall(cris_of_init);
diff --git a/arch/metag/kernel/setup.c b/arch/metag/kernel/setup.c
index 31cf53d0eba2..1166f1fbfd63 100644
--- a/arch/metag/kernel/setup.c
+++ b/arch/metag/kernel/setup.c
@@ -20,7 +20,6 @@
20#include <linux/memblock.h> 20#include <linux/memblock.h>
21#include <linux/mm.h> 21#include <linux/mm.h>
22#include <linux/of_fdt.h> 22#include <linux/of_fdt.h>
23#include <linux/of_platform.h>
24#include <linux/pfn.h> 23#include <linux/pfn.h>
25#include <linux/root_dev.h> 24#include <linux/root_dev.h>
26#include <linux/sched.h> 25#include <linux/sched.h>
@@ -414,9 +413,7 @@ static int __init customize_machine(void)
414 /* customizes platform devices, or adds new ones */ 413 /* customizes platform devices, or adds new ones */
415 if (machine_desc->init_machine) 414 if (machine_desc->init_machine)
416 machine_desc->init_machine(); 415 machine_desc->init_machine();
417 else 416
418 of_platform_populate(NULL, of_default_bus_match_table, NULL,
419 NULL);
420 return 0; 417 return 0;
421} 418}
422arch_initcall(customize_machine); 419arch_initcall(customize_machine);
diff --git a/arch/mips/ath79/setup.c b/arch/mips/ath79/setup.c
index 7adab180e0ca..3a0019deb7f7 100644
--- a/arch/mips/ath79/setup.c
+++ b/arch/mips/ath79/setup.c
@@ -18,7 +18,6 @@
18#include <linux/err.h> 18#include <linux/err.h>
19#include <linux/clk.h> 19#include <linux/clk.h>
20#include <linux/clk-provider.h> 20#include <linux/clk-provider.h>
21#include <linux/of_platform.h>
22#include <linux/of_fdt.h> 21#include <linux/of_fdt.h>
23 22
24#include <asm/bootinfo.h> 23#include <asm/bootinfo.h>
@@ -285,7 +284,6 @@ void __init plat_time_init(void)
285 284
286static int __init ath79_setup(void) 285static int __init ath79_setup(void)
287{ 286{
288 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
289 if (mips_machtype == ATH79_MACH_GENERIC_OF) 287 if (mips_machtype == ATH79_MACH_GENERIC_OF)
290 return 0; 288 return 0;
291 289
diff --git a/arch/mips/jz4740/setup.c b/arch/mips/jz4740/setup.c
index 510fc0d962f2..0914ef775b5f 100644
--- a/arch/mips/jz4740/setup.c
+++ b/arch/mips/jz4740/setup.c
@@ -20,7 +20,6 @@
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/libfdt.h> 21#include <linux/libfdt.h>
22#include <linux/of_fdt.h> 22#include <linux/of_fdt.h>
23#include <linux/of_platform.h>
24 23
25#include <asm/bootinfo.h> 24#include <asm/bootinfo.h>
26#include <asm/prom.h> 25#include <asm/prom.h>
@@ -74,13 +73,6 @@ void __init device_tree_init(void)
74 unflatten_and_copy_device_tree(); 73 unflatten_and_copy_device_tree();
75} 74}
76 75
77static int __init populate_machine(void)
78{
79 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
80 return 0;
81}
82arch_initcall(populate_machine);
83
84const char *get_system_type(void) 76const char *get_system_type(void)
85{ 77{
86 if (config_enabled(CONFIG_MACH_JZ4780)) 78 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 9f2f9b2b23ce..edfcaf06680d 100644
--- a/arch/mips/mti-sead3/sead3-setup.c
+++ b/arch/mips/mti-sead3/sead3-setup.c
@@ -8,7 +8,6 @@
8 */ 8 */
9#include <linux/init.h> 9#include <linux/init.h>
10#include <linux/libfdt.h> 10#include <linux/libfdt.h>
11#include <linux/of_platform.h>
12#include <linux/of_fdt.h> 11#include <linux/of_fdt.h>
13 12
14#include <asm/prom.h> 13#include <asm/prom.h>
@@ -107,10 +106,3 @@ void __init device_tree_init(void)
107 106
108 unflatten_and_copy_device_tree(); 107 unflatten_and_copy_device_tree();
109} 108}
110
111static int __init customize_machine(void)
112{
113 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
114 return 0;
115}
116arch_initcall(customize_machine);
diff --git a/arch/mips/pic32/pic32mzda/init.c b/arch/mips/pic32/pic32mzda/init.c
index 775ff90a9962..77ecf32ef3dc 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)
147 panic("Device tree not present"); 147 panic("Device tree not present");
148 148
149 pic32_of_prepare_platform_data(pic32_auxdata_lookup); 149 pic32_of_prepare_platform_data(pic32_auxdata_lookup);
150 if (of_platform_populate(NULL, of_default_bus_match_table, 150 if (of_platform_default_populate(NULL, pic32_auxdata_lookup, NULL))
151 pic32_auxdata_lookup, NULL))
152 panic("Failed to populate DT"); 151 panic("Failed to populate DT");
153 152
154 return 0; 153 return 0;
diff --git a/arch/mips/pistachio/init.c b/arch/mips/pistachio/init.c
index ab79828230ab..c50a670e60d2 100644
--- a/arch/mips/pistachio/init.c
+++ b/arch/mips/pistachio/init.c
@@ -14,7 +14,6 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/of_address.h> 15#include <linux/of_address.h>
16#include <linux/of_fdt.h> 16#include <linux/of_fdt.h>
17#include <linux/of_platform.h>
18 17
19#include <asm/cacheflush.h> 18#include <asm/cacheflush.h>
20#include <asm/dma-coherence.h> 19#include <asm/dma-coherence.h>
@@ -159,15 +158,3 @@ void __init device_tree_init(void)
159 158
160 unflatten_and_copy_device_tree(); 159 unflatten_and_copy_device_tree();
161} 160}
162
163static int __init plat_of_setup(void)
164{
165 if (!of_have_populated_dt())
166 panic("Device tree not present");
167
168 if (of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL))
169 panic("Failed to populate DT");
170
171 return 0;
172}
173arch_initcall(plat_of_setup);
diff --git a/arch/mips/xilfpga/init.c b/arch/mips/xilfpga/init.c
index ce2aee2169ac..602e384a26a2 100644
--- a/arch/mips/xilfpga/init.c
+++ b/arch/mips/xilfpga/init.c
@@ -10,7 +10,6 @@
10 */ 10 */
11 11
12#include <linux/of_fdt.h> 12#include <linux/of_fdt.h>
13#include <linux/of_platform.h>
14 13
15#include <asm/prom.h> 14#include <asm/prom.h>
16 15
@@ -43,15 +42,3 @@ void __init device_tree_init(void)
43 42
44 unflatten_and_copy_device_tree(); 43 unflatten_and_copy_device_tree();
45} 44}
46
47static int __init plat_of_setup(void)
48{
49 if (!of_have_populated_dt())
50 panic("Device tree not present");
51
52 if (of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL))
53 panic("Failed to populate DT");
54
55 return 0;
56}
57arch_initcall(plat_of_setup);
diff --git a/arch/nios2/platform/platform.c b/arch/nios2/platform/platform.c
index d478773f758a..2a35154ca153 100644
--- a/arch/nios2/platform/platform.c
+++ b/arch/nios2/platform/platform.c
@@ -9,7 +9,6 @@
9 */ 9 */
10 10
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/of_platform.h>
13#include <linux/of_address.h> 12#include <linux/of_address.h>
14#include <linux/of_fdt.h> 13#include <linux/of_fdt.h>
15#include <linux/err.h> 14#include <linux/err.h>
@@ -39,8 +38,7 @@ static int __init nios2_soc_device_init(void)
39 } 38 }
40 } 39 }
41 40
42 return of_platform_populate(NULL, of_default_bus_match_table, 41 return 0;
43 NULL, NULL);
44} 42}
45 43
46device_initcall(nios2_soc_device_init); 44device_initcall(nios2_soc_device_init);
diff --git a/arch/powerpc/boot/dts/ac14xx.dts b/arch/powerpc/boot/dts/ac14xx.dts
index a1b883730b31..27fcabc2f857 100644
--- a/arch/powerpc/boot/dts/ac14xx.dts
+++ b/arch/powerpc/boot/dts/ac14xx.dts
@@ -231,7 +231,7 @@
231 }; 231 };
232 232
233 rtc@68 { 233 rtc@68 {
234 compatible = "stm,m41t00"; 234 compatible = "st,m41t00";
235 reg = <0x68>; 235 reg = <0x68>;
236 }; 236 };
237 }; 237 };
diff --git a/arch/powerpc/boot/dts/akebono.dts b/arch/powerpc/boot/dts/akebono.dts
index f92ecfed3d2f..e61d5dc598c1 100644
--- a/arch/powerpc/boot/dts/akebono.dts
+++ b/arch/powerpc/boot/dts/akebono.dts
@@ -224,7 +224,7 @@
224 #address-cells = <1>; 224 #address-cells = <1>;
225 #size-cells = <0>; 225 #size-cells = <0>;
226 rtc@68 { 226 rtc@68 {
227 compatible = "stm,m41t80", "m41st85"; 227 compatible = "st,m41t80", "m41st85";
228 reg = <0x68>; 228 reg = <0x68>;
229 }; 229 };
230 }; 230 };
diff --git a/arch/powerpc/boot/dts/bluestone.dts b/arch/powerpc/boot/dts/bluestone.dts
index 7daaca324c01..b0b26d8d68a2 100644
--- a/arch/powerpc/boot/dts/bluestone.dts
+++ b/arch/powerpc/boot/dts/bluestone.dts
@@ -279,7 +279,7 @@
279 #address-cells = <1>; 279 #address-cells = <1>;
280 #size-cells = <0>; 280 #size-cells = <0>;
281 rtc@68 { 281 rtc@68 {
282 compatible = "stm,m41t80"; 282 compatible = "st,m41t80";
283 reg = <0x68>; 283 reg = <0x68>;
284 interrupt-parent = <&UIC0>; 284 interrupt-parent = <&UIC0>;
285 interrupts = <0x9 0x8>; 285 interrupts = <0x9 0x8>;
diff --git a/arch/powerpc/boot/dts/canyonlands.dts b/arch/powerpc/boot/dts/canyonlands.dts
index 549c24c4c388..0d6ac92d0f5e 100644
--- a/arch/powerpc/boot/dts/canyonlands.dts
+++ b/arch/powerpc/boot/dts/canyonlands.dts
@@ -319,7 +319,7 @@
319 #address-cells = <1>; 319 #address-cells = <1>;
320 #size-cells = <0>; 320 #size-cells = <0>;
321 rtc@68 { 321 rtc@68 {
322 compatible = "stm,m41t80"; 322 compatible = "st,m41t80";
323 reg = <0x68>; 323 reg = <0x68>;
324 interrupt-parent = <&UIC2>; 324 interrupt-parent = <&UIC2>;
325 interrupts = <0x19 0x8>; 325 interrupts = <0x19 0x8>;
diff --git a/arch/powerpc/boot/dts/currituck.dts b/arch/powerpc/boot/dts/currituck.dts
index d2c8a872308e..4191e1850ea1 100644
--- a/arch/powerpc/boot/dts/currituck.dts
+++ b/arch/powerpc/boot/dts/currituck.dts
@@ -116,7 +116,7 @@
116 #address-cells = <1>; 116 #address-cells = <1>;
117 #size-cells = <0>; 117 #size-cells = <0>;
118 rtc@68 { 118 rtc@68 {
119 compatible = "stm,m41t80", "m41st85"; 119 compatible = "st,m41t80", "m41st85";
120 reg = <0x68>; 120 reg = <0x68>;
121 }; 121 };
122 }; 122 };
diff --git a/arch/powerpc/boot/dts/fsl/mpc8569mds.dts b/arch/powerpc/boot/dts/fsl/mpc8569mds.dts
index a95ff7d2392c..8e94448f296c 100644
--- a/arch/powerpc/boot/dts/fsl/mpc8569mds.dts
+++ b/arch/powerpc/boot/dts/fsl/mpc8569mds.dts
@@ -232,7 +232,7 @@
232 mode = "cpu-qe"; 232 mode = "cpu-qe";
233 233
234 serial-flash@0 { 234 serial-flash@0 {
235 compatible = "stm,m25p40"; 235 compatible = "st,m25p40";
236 reg = <0>; 236 reg = <0>;
237 spi-max-frequency = <25000000>; 237 spi-max-frequency = <25000000>;
238 }; 238 };
diff --git a/arch/powerpc/boot/dts/fsl/p1022rdk.dts b/arch/powerpc/boot/dts/fsl/p1022rdk.dts
index d505d7c51903..29e8af1e3711 100644
--- a/arch/powerpc/boot/dts/fsl/p1022rdk.dts
+++ b/arch/powerpc/boot/dts/fsl/p1022rdk.dts
@@ -57,7 +57,7 @@
57 clock-frequency = <12288000>; 57 clock-frequency = <12288000>;
58 }; 58 };
59 rtc@68 { 59 rtc@68 {
60 compatible = "stm,m41t62"; 60 compatible = "st,m41t62";
61 reg = <0x68>; 61 reg = <0x68>;
62 }; 62 };
63 adt7461@4c{ 63 adt7461@4c{
diff --git a/arch/powerpc/boot/dts/glacier.dts b/arch/powerpc/boot/dts/glacier.dts
index 2000060386d7..a7a802f4ffdd 100644
--- a/arch/powerpc/boot/dts/glacier.dts
+++ b/arch/powerpc/boot/dts/glacier.dts
@@ -287,7 +287,7 @@
287 #address-cells = <1>; 287 #address-cells = <1>;
288 #size-cells = <0>; 288 #size-cells = <0>;
289 rtc@68 { 289 rtc@68 {
290 compatible = "stm,m41t80"; 290 compatible = "st,m41t80";
291 reg = <0x68>; 291 reg = <0x68>;
292 interrupt-parent = <&UIC2>; 292 interrupt-parent = <&UIC2>;
293 interrupts = <0x19 0x8>; 293 interrupts = <0x19 0x8>;
diff --git a/arch/powerpc/boot/dts/icon.dts b/arch/powerpc/boot/dts/icon.dts
index abcd0caeccae..9c94fd737f7c 100644
--- a/arch/powerpc/boot/dts/icon.dts
+++ b/arch/powerpc/boot/dts/icon.dts
@@ -256,7 +256,7 @@
256 #size-cells = <0>; 256 #size-cells = <0>;
257 257
258 rtc@68 { 258 rtc@68 {
259 compatible = "stm,m41t00"; 259 compatible = "st,m41t00";
260 reg = <0x68>; 260 reg = <0x68>;
261 }; 261 };
262 }; 262 };
diff --git a/arch/powerpc/boot/dts/mpc5121ads.dts b/arch/powerpc/boot/dts/mpc5121ads.dts
index c228a0a232a6..75888ce2c792 100644
--- a/arch/powerpc/boot/dts/mpc5121ads.dts
+++ b/arch/powerpc/boot/dts/mpc5121ads.dts
@@ -99,7 +99,7 @@
99 }; 99 };
100 100
101 rtc@68 { 101 rtc@68 {
102 compatible = "stm,m41t62"; 102 compatible = "st,m41t62";
103 reg = <0x68>; 103 reg = <0x68>;
104 }; 104 };
105 }; 105 };
diff --git a/arch/powerpc/boot/dts/mpc8349emitx.dts b/arch/powerpc/boot/dts/mpc8349emitx.dts
index cf8542401a3c..90aed3ac2f69 100644
--- a/arch/powerpc/boot/dts/mpc8349emitx.dts
+++ b/arch/powerpc/boot/dts/mpc8349emitx.dts
@@ -92,7 +92,7 @@
92 dfsrr; 92 dfsrr;
93 93
94 eeprom: at24@50 { 94 eeprom: at24@50 {
95 compatible = "st-micro,24c256"; 95 compatible = "st,24c256";
96 reg = <0x50>; 96 reg = <0x50>;
97 }; 97 };
98 98
diff --git a/arch/powerpc/boot/dts/mpc836x_rdk.dts b/arch/powerpc/boot/dts/mpc836x_rdk.dts
index daeacbdcf8b4..47c5fc64e433 100644
--- a/arch/powerpc/boot/dts/mpc836x_rdk.dts
+++ b/arch/powerpc/boot/dts/mpc836x_rdk.dts
@@ -416,7 +416,7 @@
416 gpios = <&qe_pio_e 18 0>; 416 gpios = <&qe_pio_e 18 0>;
417 417
418 flash { 418 flash {
419 compatible = "stm,nand512-a"; 419 compatible = "st,nand512-a";
420 }; 420 };
421 }; 421 };
422 422
diff --git a/arch/powerpc/boot/dts/pdm360ng.dts b/arch/powerpc/boot/dts/pdm360ng.dts
index 871c16d1ad5e..0cec7244abe7 100644
--- a/arch/powerpc/boot/dts/pdm360ng.dts
+++ b/arch/powerpc/boot/dts/pdm360ng.dts
@@ -103,7 +103,7 @@
103 }; 103 };
104 104
105 rtc@68 { 105 rtc@68 {
106 compatible = "stm,m41t00"; 106 compatible = "st,m41t00";
107 reg = <0x68>; 107 reg = <0x68>;
108 }; 108 };
109 }; 109 };
diff --git a/arch/powerpc/boot/dts/sam440ep.dts b/arch/powerpc/boot/dts/sam440ep.dts
index f0663be10421..088361cf4636 100644
--- a/arch/powerpc/boot/dts/sam440ep.dts
+++ b/arch/powerpc/boot/dts/sam440ep.dts
@@ -196,7 +196,7 @@
196 interrupt-parent = <&UIC0>; 196 interrupt-parent = <&UIC0>;
197 interrupts = <2 4>; 197 interrupts = <2 4>;
198 rtc@68 { 198 rtc@68 {
199 compatible = "stm,m41t80"; 199 compatible = "st,m41t80";
200 reg = <0x68>; 200 reg = <0x68>;
201 }; 201 };
202 }; 202 };
diff --git a/arch/powerpc/boot/dts/xcalibur1501.dts b/arch/powerpc/boot/dts/xcalibur1501.dts
index c409cbafb126..1f2952dce77d 100644
--- a/arch/powerpc/boot/dts/xcalibur1501.dts
+++ b/arch/powerpc/boot/dts/xcalibur1501.dts
@@ -238,7 +238,7 @@
238 }; 238 };
239 239
240 rtc@68 { 240 rtc@68 {
241 compatible = "stm,m41t00", 241 compatible = "st,m41t00",
242 "dallas,ds1338"; 242 "dallas,ds1338";
243 reg = <0x68>; 243 reg = <0x68>;
244 }; 244 };
diff --git a/arch/powerpc/boot/dts/xpedite5200.dts b/arch/powerpc/boot/dts/xpedite5200.dts
index 8fd7b7031357..5b10e56a1d8e 100644
--- a/arch/powerpc/boot/dts/xpedite5200.dts
+++ b/arch/powerpc/boot/dts/xpedite5200.dts
@@ -130,7 +130,7 @@
130 }; 130 };
131 131
132 rtc@68 { 132 rtc@68 {
133 compatible = "stm,m41t00", 133 compatible = "st,m41t00",
134 "dallas,ds1338"; 134 "dallas,ds1338";
135 reg = <0x68>; 135 reg = <0x68>;
136 }; 136 };
diff --git a/arch/powerpc/boot/dts/xpedite5200_xmon.dts b/arch/powerpc/boot/dts/xpedite5200_xmon.dts
index 0baa8283d08c..646acfbef0dd 100644
--- a/arch/powerpc/boot/dts/xpedite5200_xmon.dts
+++ b/arch/powerpc/boot/dts/xpedite5200_xmon.dts
@@ -134,7 +134,7 @@
134 }; 134 };
135 135
136 rtc@68 { 136 rtc@68 {
137 compatible = "stm,m41t00", 137 compatible = "st,m41t00",
138 "dallas,ds1338"; 138 "dallas,ds1338";
139 reg = <0x68>; 139 reg = <0x68>;
140 }; 140 };
diff --git a/arch/powerpc/boot/dts/xpedite5301.dts b/arch/powerpc/boot/dts/xpedite5301.dts
index 04cb410da48b..7bcc94ffe53d 100644
--- a/arch/powerpc/boot/dts/xpedite5301.dts
+++ b/arch/powerpc/boot/dts/xpedite5301.dts
@@ -231,7 +231,7 @@
231 }; 231 };
232 232
233 rtc@68 { 233 rtc@68 {
234 compatible = "stm,m41t00", 234 compatible = "st,m41t00",
235 "dallas,ds1338"; 235 "dallas,ds1338";
236 reg = <0x68>; 236 reg = <0x68>;
237 }; 237 };
diff --git a/arch/powerpc/boot/dts/xpedite5330.dts b/arch/powerpc/boot/dts/xpedite5330.dts
index 73f8620f1ce7..86df8bc6ebbd 100644
--- a/arch/powerpc/boot/dts/xpedite5330.dts
+++ b/arch/powerpc/boot/dts/xpedite5330.dts
@@ -267,7 +267,7 @@
267 }; 267 };
268 268
269 rtc@68 { 269 rtc@68 {
270 compatible = "stm,m41t00", 270 compatible = "st,m41t00",
271 "dallas,ds1338"; 271 "dallas,ds1338";
272 reg = <0x68>; 272 reg = <0x68>;
273 }; 273 };
diff --git a/arch/powerpc/boot/dts/xpedite5370.dts b/arch/powerpc/boot/dts/xpedite5370.dts
index cd0ea2b99362..b8ade094f932 100644
--- a/arch/powerpc/boot/dts/xpedite5370.dts
+++ b/arch/powerpc/boot/dts/xpedite5370.dts
@@ -229,7 +229,7 @@
229 }; 229 };
230 230
231 rtc@68 { 231 rtc@68 {
232 compatible = "stm,m41t00", 232 compatible = "st,m41t00",
233 "dallas,ds1338"; 233 "dallas,ds1338";
234 reg = <0x68>; 234 reg = <0x68>;
235 }; 235 };
diff --git a/arch/sh/boards/of-generic.c b/arch/sh/boards/of-generic.c
index bf3a166a5407..911ffb9f115b 100644
--- a/arch/sh/boards/of-generic.c
+++ b/arch/sh/boards/of-generic.c
@@ -9,9 +9,7 @@
9 */ 9 */
10 10
11#include <linux/of.h> 11#include <linux/of.h>
12#include <linux/of_platform.h>
13#include <linux/of_fdt.h> 12#include <linux/of_fdt.h>
14#include <linux/of_iommu.h>
15#include <linux/clocksource.h> 13#include <linux/clocksource.h>
16#include <linux/irqchip.h> 14#include <linux/irqchip.h>
17#include <linux/clk-provider.h> 15#include <linux/clk-provider.h>
@@ -180,17 +178,3 @@ void __init arch_init_clk_ops(struct sh_clk_ops **ops, int idx)
180void __init plat_irq_setup(void) 178void __init plat_irq_setup(void)
181{ 179{
182} 180}
183
184static int __init sh_of_device_init(void)
185{
186 pr_info("SH generic board support: populating platform devices\n");
187 if (of_have_populated_dt()) {
188 of_iommu_init();
189 of_platform_populate(NULL, of_default_bus_match_table,
190 NULL, NULL);
191 } else {
192 pr_crit("Device tree not populated\n");
193 }
194 return 0;
195}
196arch_initcall_sync(sh_of_device_init);
diff --git a/arch/xtensa/kernel/setup.c b/arch/xtensa/kernel/setup.c
index 9735691f37f1..143251ede897 100644
--- a/arch/xtensa/kernel/setup.c
+++ b/arch/xtensa/kernel/setup.c
@@ -24,8 +24,8 @@
24#include <linux/percpu.h> 24#include <linux/percpu.h>
25#include <linux/clk-provider.h> 25#include <linux/clk-provider.h>
26#include <linux/cpu.h> 26#include <linux/cpu.h>
27#include <linux/of.h>
27#include <linux/of_fdt.h> 28#include <linux/of_fdt.h>
28#include <linux/of_platform.h>
29 29
30#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE) 30#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE)
31# include <linux/console.h> 31# include <linux/console.h>
@@ -255,7 +255,6 @@ void __init early_init_devtree(void *params)
255static int __init xtensa_device_probe(void) 255static int __init xtensa_device_probe(void)
256{ 256{
257 of_clk_init(NULL); 257 of_clk_init(NULL);
258 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
259 return 0; 258 return 0;
260} 259}
261 260
diff --git a/drivers/bus/imx-weim.c b/drivers/bus/imx-weim.c
index 1827fc4d15c1..4bd361d64270 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,
163 } 163 }
164 164
165 if (have_child) 165 if (have_child)
166 ret = of_platform_populate(pdev->dev.of_node, 166 ret = of_platform_default_populate(pdev->dev.of_node,
167 of_default_bus_match_table, 167 NULL, &pdev->dev);
168 NULL, &pdev->dev);
169 if (ret) 168 if (ret)
170 dev_err(&pdev->dev, "%s fail to create devices.\n", 169 dev_err(&pdev->dev, "%s fail to create devices.\n",
171 pdev->dev.of_node->full_name); 170 pdev->dev.of_node->full_name);
diff --git a/drivers/bus/uniphier-system-bus.c b/drivers/bus/uniphier-system-bus.c
index 350b7309c26d..1e6e0269edcc 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)
257 uniphier_system_bus_set_reg(priv); 257 uniphier_system_bus_set_reg(priv);
258 258
259 /* Now, the bus is configured. Populate platform_devices below it */ 259 /* Now, the bus is configured. Populate platform_devices below it */
260 return of_platform_populate(dev->of_node, of_default_bus_match_table, 260 return of_platform_default_populate(dev->of_node, NULL, dev);
261 NULL, dev);
262} 261}
263 262
264static const struct of_device_id uniphier_system_bus_match[] = { 263static const struct of_device_id uniphier_system_bus_match[] = {
diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c
index af499aea0a1a..57f23eaaa2f9 100644
--- a/drivers/iommu/of_iommu.c
+++ b/drivers/iommu/of_iommu.c
@@ -174,7 +174,7 @@ err_put_node:
174 return NULL; 174 return NULL;
175} 175}
176 176
177void __init of_iommu_init(void) 177static int __init of_iommu_init(void)
178{ 178{
179 struct device_node *np; 179 struct device_node *np;
180 const struct of_device_id *match, *matches = &__iommu_of_table; 180 const struct of_device_id *match, *matches = &__iommu_of_table;
@@ -186,4 +186,7 @@ void __init of_iommu_init(void)
186 pr_err("Failed to initialise IOMMU %s\n", 186 pr_err("Failed to initialise IOMMU %s\n",
187 of_node_full_name(np)); 187 of_node_full_name(np));
188 } 188 }
189
190 return 0;
189} 191}
192postcore_initcall_sync(of_iommu_init);
diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
index 15508df24e5d..4721b591994f 100644
--- a/drivers/memory/omap-gpmc.c
+++ b/drivers/memory/omap-gpmc.c
@@ -2134,8 +2134,7 @@ no_timings:
2134 /* is child a common bus? */ 2134 /* is child a common bus? */
2135 if (of_match_node(of_default_bus_match_table, child)) 2135 if (of_match_node(of_default_bus_match_table, child))
2136 /* create children and other common bus children */ 2136 /* create children and other common bus children */
2137 if (of_platform_populate(child, of_default_bus_match_table, 2137 if (of_platform_default_populate(child, NULL, &pdev->dev))
2138 NULL, &pdev->dev))
2139 goto err_child_fail; 2138 goto err_child_fail;
2140 2139
2141 return 0; 2140 return 0;
diff --git a/drivers/of/address.c b/drivers/of/address.c
index 0a553c084a81..02b2903fe9d2 100644
--- a/drivers/of/address.c
+++ b/drivers/of/address.c
@@ -1,4 +1,6 @@
1 1
2#define pr_fmt(fmt) "OF: " fmt
3
2#include <linux/device.h> 4#include <linux/device.h>
3#include <linux/io.h> 5#include <linux/io.h>
4#include <linux/ioport.h> 6#include <linux/ioport.h>
@@ -24,10 +26,10 @@ static int __of_address_to_resource(struct device_node *dev,
24#ifdef DEBUG 26#ifdef DEBUG
25static void of_dump_addr(const char *s, const __be32 *addr, int na) 27static void of_dump_addr(const char *s, const __be32 *addr, int na)
26{ 28{
27 printk(KERN_DEBUG "%s", s); 29 pr_debug("%s", s);
28 while (na--) 30 while (na--)
29 printk(" %08x", be32_to_cpu(*(addr++))); 31 pr_cont(" %08x", be32_to_cpu(*(addr++)));
30 printk("\n"); 32 pr_cont("\n");
31} 33}
32#else 34#else
33static void of_dump_addr(const char *s, const __be32 *addr, int na) { } 35static 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,
68 s = of_read_number(range + na + pna, ns); 70 s = of_read_number(range + na + pna, ns);
69 da = of_read_number(addr, na); 71 da = of_read_number(addr, na);
70 72
71 pr_debug("OF: default map, cp=%llx, s=%llx, da=%llx\n", 73 pr_debug("default map, cp=%llx, s=%llx, da=%llx\n",
72 (unsigned long long)cp, (unsigned long long)s, 74 (unsigned long long)cp, (unsigned long long)s,
73 (unsigned long long)da); 75 (unsigned long long)da);
74 76
@@ -156,7 +158,7 @@ static u64 of_bus_pci_map(__be32 *addr, const __be32 *range, int na, int ns,
156 s = of_read_number(range + na + pna, ns); 158 s = of_read_number(range + na + pna, ns);
157 da = of_read_number(addr + 1, na - 1); 159 da = of_read_number(addr + 1, na - 1);
158 160
159 pr_debug("OF: PCI map, cp=%llx, s=%llx, da=%llx\n", 161 pr_debug("PCI map, cp=%llx, s=%llx, da=%llx\n",
160 (unsigned long long)cp, (unsigned long long)s, 162 (unsigned long long)cp, (unsigned long long)s,
161 (unsigned long long)da); 163 (unsigned long long)da);
162 164
@@ -381,7 +383,7 @@ static u64 of_bus_isa_map(__be32 *addr, const __be32 *range, int na, int ns,
381 s = of_read_number(range + na + pna, ns); 383 s = of_read_number(range + na + pna, ns);
382 da = of_read_number(addr + 1, na - 1); 384 da = of_read_number(addr + 1, na - 1);
383 385
384 pr_debug("OF: ISA map, cp=%llx, s=%llx, da=%llx\n", 386 pr_debug("ISA map, cp=%llx, s=%llx, da=%llx\n",
385 (unsigned long long)cp, (unsigned long long)s, 387 (unsigned long long)cp, (unsigned long long)s,
386 (unsigned long long)da); 388 (unsigned long long)da);
387 389
@@ -504,17 +506,17 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus,
504 */ 506 */
505 ranges = of_get_property(parent, rprop, &rlen); 507 ranges = of_get_property(parent, rprop, &rlen);
506 if (ranges == NULL && !of_empty_ranges_quirk(parent)) { 508 if (ranges == NULL && !of_empty_ranges_quirk(parent)) {
507 pr_debug("OF: no ranges; cannot translate\n"); 509 pr_debug("no ranges; cannot translate\n");
508 return 1; 510 return 1;
509 } 511 }
510 if (ranges == NULL || rlen == 0) { 512 if (ranges == NULL || rlen == 0) {
511 offset = of_read_number(addr, na); 513 offset = of_read_number(addr, na);
512 memset(addr, 0, pna * 4); 514 memset(addr, 0, pna * 4);
513 pr_debug("OF: empty ranges; 1:1 translation\n"); 515 pr_debug("empty ranges; 1:1 translation\n");
514 goto finish; 516 goto finish;
515 } 517 }
516 518
517 pr_debug("OF: walking ranges...\n"); 519 pr_debug("walking ranges...\n");
518 520
519 /* Now walk through the ranges */ 521 /* Now walk through the ranges */
520 rlen /= 4; 522 rlen /= 4;
@@ -525,14 +527,14 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus,
525 break; 527 break;
526 } 528 }
527 if (offset == OF_BAD_ADDR) { 529 if (offset == OF_BAD_ADDR) {
528 pr_debug("OF: not found !\n"); 530 pr_debug("not found !\n");
529 return 1; 531 return 1;
530 } 532 }
531 memcpy(addr, ranges + na, 4 * pna); 533 memcpy(addr, ranges + na, 4 * pna);
532 534
533 finish: 535 finish:
534 of_dump_addr("OF: parent translation for:", addr, pna); 536 of_dump_addr("parent translation for:", addr, pna);
535 pr_debug("OF: with offset: %llx\n", (unsigned long long)offset); 537 pr_debug("with offset: %llx\n", (unsigned long long)offset);
536 538
537 /* Translate it into parent bus space */ 539 /* Translate it into parent bus space */
538 return pbus->translate(addr, offset, pna); 540 return pbus->translate(addr, offset, pna);
@@ -557,7 +559,7 @@ static u64 __of_translate_address(struct device_node *dev,
557 int na, ns, pna, pns; 559 int na, ns, pna, pns;
558 u64 result = OF_BAD_ADDR; 560 u64 result = OF_BAD_ADDR;
559 561
560 pr_debug("OF: ** translation for device %s **\n", of_node_full_name(dev)); 562 pr_debug("** translation for device %s **\n", of_node_full_name(dev));
561 563
562 /* Increase refcount at current level */ 564 /* Increase refcount at current level */
563 of_node_get(dev); 565 of_node_get(dev);
@@ -571,14 +573,14 @@ static u64 __of_translate_address(struct device_node *dev,
571 /* Count address cells & copy address locally */ 573 /* Count address cells & copy address locally */
572 bus->count_cells(dev, &na, &ns); 574 bus->count_cells(dev, &na, &ns);
573 if (!OF_CHECK_COUNTS(na, ns)) { 575 if (!OF_CHECK_COUNTS(na, ns)) {
574 pr_debug("OF: Bad cell count for %s\n", of_node_full_name(dev)); 576 pr_debug("Bad cell count for %s\n", of_node_full_name(dev));
575 goto bail; 577 goto bail;
576 } 578 }
577 memcpy(addr, in_addr, na * 4); 579 memcpy(addr, in_addr, na * 4);
578 580
579 pr_debug("OF: bus is %s (na=%d, ns=%d) on %s\n", 581 pr_debug("bus is %s (na=%d, ns=%d) on %s\n",
580 bus->name, na, ns, of_node_full_name(parent)); 582 bus->name, na, ns, of_node_full_name(parent));
581 of_dump_addr("OF: translating address:", addr, na); 583 of_dump_addr("translating address:", addr, na);
582 584
583 /* Translate */ 585 /* Translate */
584 for (;;) { 586 for (;;) {
@@ -589,7 +591,7 @@ static u64 __of_translate_address(struct device_node *dev,
589 591
590 /* If root, we have finished */ 592 /* If root, we have finished */
591 if (parent == NULL) { 593 if (parent == NULL) {
592 pr_debug("OF: reached root node\n"); 594 pr_debug("reached root node\n");
593 result = of_read_number(addr, na); 595 result = of_read_number(addr, na);
594 break; 596 break;
595 } 597 }
@@ -598,12 +600,12 @@ static u64 __of_translate_address(struct device_node *dev,
598 pbus = of_match_bus(parent); 600 pbus = of_match_bus(parent);
599 pbus->count_cells(dev, &pna, &pns); 601 pbus->count_cells(dev, &pna, &pns);
600 if (!OF_CHECK_COUNTS(pna, pns)) { 602 if (!OF_CHECK_COUNTS(pna, pns)) {
601 pr_err("prom_parse: Bad cell count for %s\n", 603 pr_err("Bad cell count for %s\n",
602 of_node_full_name(dev)); 604 of_node_full_name(dev));
603 break; 605 break;
604 } 606 }
605 607
606 pr_debug("OF: parent bus is %s (na=%d, ns=%d) on %s\n", 608 pr_debug("parent bus is %s (na=%d, ns=%d) on %s\n",
607 pbus->name, pna, pns, of_node_full_name(parent)); 609 pbus->name, pna, pns, of_node_full_name(parent));
608 610
609 /* Apply bus translation */ 611 /* Apply bus translation */
@@ -615,7 +617,7 @@ static u64 __of_translate_address(struct device_node *dev,
615 ns = pns; 617 ns = pns;
616 bus = pbus; 618 bus = pbus;
617 619
618 of_dump_addr("OF: one level translation:", addr, na); 620 of_dump_addr("one level translation:", addr, na);
619 } 621 }
620 bail: 622 bail:
621 of_node_put(parent); 623 of_node_put(parent);
@@ -853,8 +855,7 @@ int of_dma_get_range(struct device_node *np, u64 *dma_addr, u64 *paddr, u64 *siz
853 } 855 }
854 856
855 if (!ranges) { 857 if (!ranges) {
856 pr_debug("%s: no dma-ranges found for node(%s)\n", 858 pr_debug("no dma-ranges found for node(%s)\n", np->full_name);
857 __func__, np->full_name);
858 ret = -ENODEV; 859 ret = -ENODEV;
859 goto out; 860 goto out;
860 } 861 }
@@ -871,8 +872,8 @@ int of_dma_get_range(struct device_node *np, u64 *dma_addr, u64 *paddr, u64 *siz
871 dmaaddr = of_read_number(ranges, naddr); 872 dmaaddr = of_read_number(ranges, naddr);
872 *paddr = of_translate_dma_address(np, ranges); 873 *paddr = of_translate_dma_address(np, ranges);
873 if (*paddr == OF_BAD_ADDR) { 874 if (*paddr == OF_BAD_ADDR) {
874 pr_err("%s: translation of DMA address(%pad) to CPU address failed node(%s)\n", 875 pr_err("translation of DMA address(%pad) to CPU address failed node(%s)\n",
875 __func__, dma_addr, np->full_name); 876 dma_addr, np->full_name);
876 ret = -EINVAL; 877 ret = -EINVAL;
877 goto out; 878 goto out;
878 } 879 }
diff --git a/drivers/of/base.c b/drivers/of/base.c
index ebf84e3b56d5..a4b608776c73 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -17,6 +17,9 @@
17 * as published by the Free Software Foundation; either version 17 * as published by the Free Software Foundation; either version
18 * 2 of the License, or (at your option) any later version. 18 * 2 of the License, or (at your option) any later version.
19 */ 19 */
20
21#define pr_fmt(fmt) "OF: " fmt
22
20#include <linux/console.h> 23#include <linux/console.h>
21#include <linux/ctype.h> 24#include <linux/ctype.h>
22#include <linux/cpu.h> 25#include <linux/cpu.h>
@@ -112,6 +115,7 @@ static ssize_t of_node_property_read(struct file *filp, struct kobject *kobj,
112 return memory_read_from_buffer(buf, count, &offset, pp->value, pp->length); 115 return memory_read_from_buffer(buf, count, &offset, pp->value, pp->length);
113} 116}
114 117
118/* always return newly allocated name, caller must free after use */
115static const char *safe_name(struct kobject *kobj, const char *orig_name) 119static const char *safe_name(struct kobject *kobj, const char *orig_name)
116{ 120{
117 const char *name = orig_name; 121 const char *name = orig_name;
@@ -126,9 +130,12 @@ static const char *safe_name(struct kobject *kobj, const char *orig_name)
126 name = kasprintf(GFP_KERNEL, "%s#%i", orig_name, ++i); 130 name = kasprintf(GFP_KERNEL, "%s#%i", orig_name, ++i);
127 } 131 }
128 132
129 if (name != orig_name) 133 if (name == orig_name) {
130 pr_warn("device-tree: Duplicate name in %s, renamed to \"%s\"\n", 134 name = kstrdup(orig_name, GFP_KERNEL);
135 } else {
136 pr_warn("Duplicate name in %s, renamed to \"%s\"\n",
131 kobject_name(kobj), name); 137 kobject_name(kobj), name);
138 }
132 return name; 139 return name;
133} 140}
134 141
@@ -159,6 +166,7 @@ int __of_add_property_sysfs(struct device_node *np, struct property *pp)
159int __of_attach_node_sysfs(struct device_node *np) 166int __of_attach_node_sysfs(struct device_node *np)
160{ 167{
161 const char *name; 168 const char *name;
169 struct kobject *parent;
162 struct property *pp; 170 struct property *pp;
163 int rc; 171 int rc;
164 172
@@ -171,15 +179,16 @@ int __of_attach_node_sysfs(struct device_node *np)
171 np->kobj.kset = of_kset; 179 np->kobj.kset = of_kset;
172 if (!np->parent) { 180 if (!np->parent) {
173 /* Nodes without parents are new top level trees */ 181 /* Nodes without parents are new top level trees */
174 rc = kobject_add(&np->kobj, NULL, "%s", 182 name = safe_name(&of_kset->kobj, "base");
175 safe_name(&of_kset->kobj, "base")); 183 parent = NULL;
176 } else { 184 } else {
177 name = safe_name(&np->parent->kobj, kbasename(np->full_name)); 185 name = safe_name(&np->parent->kobj, kbasename(np->full_name));
178 if (!name || !name[0]) 186 parent = &np->parent->kobj;
179 return -EINVAL;
180
181 rc = kobject_add(&np->kobj, &np->parent->kobj, "%s", name);
182 } 187 }
188 if (!name)
189 return -ENOMEM;
190 rc = kobject_add(&np->kobj, parent, "%s", name);
191 kfree(name);
183 if (rc) 192 if (rc)
184 return rc; 193 return rc;
185 194
@@ -198,7 +207,7 @@ void __init of_core_init(void)
198 of_kset = kset_create_and_add("devicetree", NULL, firmware_kobj); 207 of_kset = kset_create_and_add("devicetree", NULL, firmware_kobj);
199 if (!of_kset) { 208 if (!of_kset) {
200 mutex_unlock(&of_mutex); 209 mutex_unlock(&of_mutex);
201 pr_err("devicetree: failed to register existing nodes\n"); 210 pr_err("failed to register existing nodes\n");
202 return; 211 return;
203 } 212 }
204 for_each_of_allnodes(np) 213 for_each_of_allnodes(np)
@@ -1815,6 +1824,12 @@ int __of_remove_property(struct device_node *np, struct property *prop)
1815 return 0; 1824 return 0;
1816} 1825}
1817 1826
1827void __of_sysfs_remove_bin_file(struct device_node *np, struct property *prop)
1828{
1829 sysfs_remove_bin_file(&np->kobj, &prop->attr);
1830 kfree(prop->attr.attr.name);
1831}
1832
1818void __of_remove_property_sysfs(struct device_node *np, struct property *prop) 1833void __of_remove_property_sysfs(struct device_node *np, struct property *prop)
1819{ 1834{
1820 if (!IS_ENABLED(CONFIG_SYSFS)) 1835 if (!IS_ENABLED(CONFIG_SYSFS))
@@ -1822,7 +1837,7 @@ void __of_remove_property_sysfs(struct device_node *np, struct property *prop)
1822 1837
1823 /* at early boot, bail here and defer setup to of_init() */ 1838 /* at early boot, bail here and defer setup to of_init() */
1824 if (of_kset && of_node_is_attached(np)) 1839 if (of_kset && of_node_is_attached(np))
1825 sysfs_remove_bin_file(&np->kobj, &prop->attr); 1840 __of_sysfs_remove_bin_file(np, prop);
1826} 1841}
1827 1842
1828/** 1843/**
@@ -1895,7 +1910,7 @@ void __of_update_property_sysfs(struct device_node *np, struct property *newprop
1895 return; 1910 return;
1896 1911
1897 if (oldprop) 1912 if (oldprop)
1898 sysfs_remove_bin_file(&np->kobj, &oldprop->attr); 1913 __of_sysfs_remove_bin_file(np, oldprop);
1899 __of_add_property_sysfs(np, newprop); 1914 __of_add_property_sysfs(np, newprop);
1900} 1915}
1901 1916
@@ -2257,8 +2272,8 @@ struct device_node *of_graph_get_next_endpoint(const struct device_node *parent,
2257 of_node_put(node); 2272 of_node_put(node);
2258 2273
2259 if (!port) { 2274 if (!port) {
2260 pr_err("%s(): no port node found in %s\n", 2275 pr_err("graph: no port node found in %s\n",
2261 __func__, parent->full_name); 2276 parent->full_name);
2262 return NULL; 2277 return NULL;
2263 } 2278 }
2264 } else { 2279 } else {
diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c
index 3033fa3250dc..888fdbc09992 100644
--- a/drivers/of/dynamic.c
+++ b/drivers/of/dynamic.c
@@ -6,6 +6,8 @@
6 * device tree nodes. 6 * device tree nodes.
7 */ 7 */
8 8
9#define pr_fmt(fmt) "OF: " fmt
10
9#include <linux/of.h> 11#include <linux/of.h>
10#include <linux/spinlock.h> 12#include <linux/spinlock.h>
11#include <linux/slab.h> 13#include <linux/slab.h>
@@ -55,7 +57,7 @@ void __of_detach_node_sysfs(struct device_node *np)
55 /* only remove properties if on sysfs */ 57 /* only remove properties if on sysfs */
56 if (of_node_is_attached(np)) { 58 if (of_node_is_attached(np)) {
57 for_each_property_of_node(np, pp) 59 for_each_property_of_node(np, pp)
58 sysfs_remove_bin_file(&np->kobj, &pp->attr); 60 __of_sysfs_remove_bin_file(np, pp);
59 kobject_del(&np->kobj); 61 kobject_del(&np->kobj);
60 } 62 }
61 63
@@ -96,13 +98,13 @@ int of_reconfig_notify(unsigned long action, struct of_reconfig_data *p)
96 switch (action) { 98 switch (action) {
97 case OF_RECONFIG_ATTACH_NODE: 99 case OF_RECONFIG_ATTACH_NODE:
98 case OF_RECONFIG_DETACH_NODE: 100 case OF_RECONFIG_DETACH_NODE:
99 pr_debug("of/notify %-15s %s\n", action_names[action], 101 pr_debug("notify %-15s %s\n", action_names[action],
100 pr->dn->full_name); 102 pr->dn->full_name);
101 break; 103 break;
102 case OF_RECONFIG_ADD_PROPERTY: 104 case OF_RECONFIG_ADD_PROPERTY:
103 case OF_RECONFIG_REMOVE_PROPERTY: 105 case OF_RECONFIG_REMOVE_PROPERTY:
104 case OF_RECONFIG_UPDATE_PROPERTY: 106 case OF_RECONFIG_UPDATE_PROPERTY:
105 pr_debug("of/notify %-15s %s:%s\n", action_names[action], 107 pr_debug("notify %-15s %s:%s\n", action_names[action],
106 pr->dn->full_name, pr->prop->name); 108 pr->dn->full_name, pr->prop->name);
107 break; 109 break;
108 110
@@ -460,12 +462,12 @@ static void __of_changeset_entry_dump(struct of_changeset_entry *ce)
460 case OF_RECONFIG_ADD_PROPERTY: 462 case OF_RECONFIG_ADD_PROPERTY:
461 case OF_RECONFIG_REMOVE_PROPERTY: 463 case OF_RECONFIG_REMOVE_PROPERTY:
462 case OF_RECONFIG_UPDATE_PROPERTY: 464 case OF_RECONFIG_UPDATE_PROPERTY:
463 pr_debug("of/cset<%p> %-15s %s/%s\n", ce, action_names[ce->action], 465 pr_debug("cset<%p> %-15s %s/%s\n", ce, action_names[ce->action],
464 ce->np->full_name, ce->prop->name); 466 ce->np->full_name, ce->prop->name);
465 break; 467 break;
466 case OF_RECONFIG_ATTACH_NODE: 468 case OF_RECONFIG_ATTACH_NODE:
467 case OF_RECONFIG_DETACH_NODE: 469 case OF_RECONFIG_DETACH_NODE:
468 pr_debug("of/cset<%p> %-15s %s\n", ce, action_names[ce->action], 470 pr_debug("cset<%p> %-15s %s\n", ce, action_names[ce->action],
469 ce->np->full_name); 471 ce->np->full_name);
470 break; 472 break;
471 } 473 }
@@ -531,13 +533,13 @@ static void __of_changeset_entry_notify(struct of_changeset_entry *ce, bool reve
531 ret = of_property_notify(ce->action, ce->np, ce->prop, ce->old_prop); 533 ret = of_property_notify(ce->action, ce->np, ce->prop, ce->old_prop);
532 break; 534 break;
533 default: 535 default:
534 pr_err("%s: invalid devicetree changeset action: %i\n", __func__, 536 pr_err("invalid devicetree changeset action: %i\n",
535 (int)ce->action); 537 (int)ce->action);
536 return; 538 return;
537 } 539 }
538 540
539 if (ret) 541 if (ret)
540 pr_err("%s: notifier error @%s\n", __func__, ce->np->full_name); 542 pr_err("changeset notifier error @%s\n", ce->np->full_name);
541} 543}
542 544
543static int __of_changeset_entry_apply(struct of_changeset_entry *ce) 545static 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)
568 570
569 ret = __of_add_property(ce->np, ce->prop); 571 ret = __of_add_property(ce->np, ce->prop);
570 if (ret) { 572 if (ret) {
571 pr_err("%s: add_property failed @%s/%s\n", 573 pr_err("changeset: add_property failed @%s/%s\n",
572 __func__, ce->np->full_name, 574 ce->np->full_name,
573 ce->prop->name); 575 ce->prop->name);
574 break; 576 break;
575 } 577 }
@@ -577,8 +579,8 @@ static int __of_changeset_entry_apply(struct of_changeset_entry *ce)
577 case OF_RECONFIG_REMOVE_PROPERTY: 579 case OF_RECONFIG_REMOVE_PROPERTY:
578 ret = __of_remove_property(ce->np, ce->prop); 580 ret = __of_remove_property(ce->np, ce->prop);
579 if (ret) { 581 if (ret) {
580 pr_err("%s: remove_property failed @%s/%s\n", 582 pr_err("changeset: remove_property failed @%s/%s\n",
581 __func__, ce->np->full_name, 583 ce->np->full_name,
582 ce->prop->name); 584 ce->prop->name);
583 break; 585 break;
584 } 586 }
@@ -596,8 +598,8 @@ static int __of_changeset_entry_apply(struct of_changeset_entry *ce)
596 598
597 ret = __of_update_property(ce->np, ce->prop, &old_prop); 599 ret = __of_update_property(ce->np, ce->prop, &old_prop);
598 if (ret) { 600 if (ret) {
599 pr_err("%s: update_property failed @%s/%s\n", 601 pr_err("changeset: update_property failed @%s/%s\n",
600 __func__, ce->np->full_name, 602 ce->np->full_name,
601 ce->prop->name); 603 ce->prop->name);
602 break; 604 break;
603 } 605 }
@@ -677,24 +679,24 @@ int __of_changeset_apply(struct of_changeset *ocs)
677 int ret; 679 int ret;
678 680
679 /* perform the rest of the work */ 681 /* perform the rest of the work */
680 pr_debug("of_changeset: applying...\n"); 682 pr_debug("changeset: applying...\n");
681 list_for_each_entry(ce, &ocs->entries, node) { 683 list_for_each_entry(ce, &ocs->entries, node) {
682 ret = __of_changeset_entry_apply(ce); 684 ret = __of_changeset_entry_apply(ce);
683 if (ret) { 685 if (ret) {
684 pr_err("%s: Error applying changeset (%d)\n", __func__, ret); 686 pr_err("Error applying changeset (%d)\n", ret);
685 list_for_each_entry_continue_reverse(ce, &ocs->entries, node) 687 list_for_each_entry_continue_reverse(ce, &ocs->entries, node)
686 __of_changeset_entry_revert(ce); 688 __of_changeset_entry_revert(ce);
687 return ret; 689 return ret;
688 } 690 }
689 } 691 }
690 pr_debug("of_changeset: applied, emitting notifiers.\n"); 692 pr_debug("changeset: applied, emitting notifiers.\n");
691 693
692 /* drop the global lock while emitting notifiers */ 694 /* drop the global lock while emitting notifiers */
693 mutex_unlock(&of_mutex); 695 mutex_unlock(&of_mutex);
694 list_for_each_entry(ce, &ocs->entries, node) 696 list_for_each_entry(ce, &ocs->entries, node)
695 __of_changeset_entry_notify(ce, 0); 697 __of_changeset_entry_notify(ce, 0);
696 mutex_lock(&of_mutex); 698 mutex_lock(&of_mutex);
697 pr_debug("of_changeset: notifiers sent.\n"); 699 pr_debug("changeset: notifiers sent.\n");
698 700
699 return 0; 701 return 0;
700} 702}
@@ -728,24 +730,24 @@ int __of_changeset_revert(struct of_changeset *ocs)
728 struct of_changeset_entry *ce; 730 struct of_changeset_entry *ce;
729 int ret; 731 int ret;
730 732
731 pr_debug("of_changeset: reverting...\n"); 733 pr_debug("changeset: reverting...\n");
732 list_for_each_entry_reverse(ce, &ocs->entries, node) { 734 list_for_each_entry_reverse(ce, &ocs->entries, node) {
733 ret = __of_changeset_entry_revert(ce); 735 ret = __of_changeset_entry_revert(ce);
734 if (ret) { 736 if (ret) {
735 pr_err("%s: Error reverting changeset (%d)\n", __func__, ret); 737 pr_err("Error reverting changeset (%d)\n", ret);
736 list_for_each_entry_continue(ce, &ocs->entries, node) 738 list_for_each_entry_continue(ce, &ocs->entries, node)
737 __of_changeset_entry_apply(ce); 739 __of_changeset_entry_apply(ce);
738 return ret; 740 return ret;
739 } 741 }
740 } 742 }
741 pr_debug("of_changeset: reverted, emitting notifiers.\n"); 743 pr_debug("changeset: reverted, emitting notifiers.\n");
742 744
743 /* drop the global lock while emitting notifiers */ 745 /* drop the global lock while emitting notifiers */
744 mutex_unlock(&of_mutex); 746 mutex_unlock(&of_mutex);
745 list_for_each_entry_reverse(ce, &ocs->entries, node) 747 list_for_each_entry_reverse(ce, &ocs->entries, node)
746 __of_changeset_entry_notify(ce, 1); 748 __of_changeset_entry_notify(ce, 1);
747 mutex_lock(&of_mutex); 749 mutex_lock(&of_mutex);
748 pr_debug("of_changeset: notifiers sent.\n"); 750 pr_debug("changeset: notifiers sent.\n");
749 751
750 return 0; 752 return 0;
751} 753}
@@ -795,10 +797,9 @@ int of_changeset_action(struct of_changeset *ocs, unsigned long action,
795 struct of_changeset_entry *ce; 797 struct of_changeset_entry *ce;
796 798
797 ce = kzalloc(sizeof(*ce), GFP_KERNEL); 799 ce = kzalloc(sizeof(*ce), GFP_KERNEL);
798 if (!ce) { 800 if (!ce)
799 pr_err("%s: Failed to allocate\n", __func__);
800 return -ENOMEM; 801 return -ENOMEM;
801 } 802
802 /* get a reference to the node */ 803 /* get a reference to the node */
803 ce->action = action; 804 ce->action = action;
804 ce->np = of_node_get(np); 805 ce->np = of_node_get(np);
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 0e02947a8a7a..55f1b8391149 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -9,6 +9,8 @@
9 * version 2 as published by the Free Software Foundation. 9 * version 2 as published by the Free Software Foundation.
10 */ 10 */
11 11
12#define pr_fmt(fmt) "OF: fdt:" fmt
13
12#include <linux/crc32.h> 14#include <linux/crc32.h>
13#include <linux/kernel.h> 15#include <linux/kernel.h>
14#include <linux/initrd.h> 16#include <linux/initrd.h>
@@ -182,14 +184,12 @@ static void populate_properties(const void *blob,
182 184
183 val = fdt_getprop_by_offset(blob, cur, &pname, &sz); 185 val = fdt_getprop_by_offset(blob, cur, &pname, &sz);
184 if (!val) { 186 if (!val) {
185 pr_warn("%s: Cannot locate property at 0x%x\n", 187 pr_warn("Cannot locate property at 0x%x\n", cur);
186 __func__, cur);
187 continue; 188 continue;
188 } 189 }
189 190
190 if (!pname) { 191 if (!pname) {
191 pr_warn("%s: Cannot find property name at 0x%x\n", 192 pr_warn("Cannot find property name at 0x%x\n", cur);
192 __func__, cur);
193 continue; 193 continue;
194 } 194 }
195 195
@@ -439,7 +439,7 @@ static int unflatten_dt_nodes(const void *blob,
439 } 439 }
440 440
441 if (offset < 0 && offset != -FDT_ERR_NOTFOUND) { 441 if (offset < 0 && offset != -FDT_ERR_NOTFOUND) {
442 pr_err("%s: Error %d processing FDT\n", __func__, offset); 442 pr_err("Error %d processing FDT\n", offset);
443 return -EINVAL; 443 return -EINVAL;
444 } 444 }
445 445
@@ -472,7 +472,8 @@ static int unflatten_dt_nodes(const void *blob,
472static void *__unflatten_device_tree(const void *blob, 472static void *__unflatten_device_tree(const void *blob,
473 struct device_node *dad, 473 struct device_node *dad,
474 struct device_node **mynodes, 474 struct device_node **mynodes,
475 void *(*dt_alloc)(u64 size, u64 align)) 475 void *(*dt_alloc)(u64 size, u64 align),
476 bool detached)
476{ 477{
477 int size; 478 int size;
478 void *mem; 479 void *mem;
@@ -516,6 +517,11 @@ static void *__unflatten_device_tree(const void *blob,
516 pr_warning("End of tree marker overwritten: %08x\n", 517 pr_warning("End of tree marker overwritten: %08x\n",
517 be32_to_cpup(mem + size)); 518 be32_to_cpup(mem + size));
518 519
520 if (detached) {
521 of_node_set_flag(*mynodes, OF_DETACHED);
522 pr_debug("unflattened tree is detached\n");
523 }
524
519 pr_debug(" <- unflatten_device_tree()\n"); 525 pr_debug(" <- unflatten_device_tree()\n");
520 return mem; 526 return mem;
521} 527}
@@ -548,7 +554,8 @@ void *of_fdt_unflatten_tree(const unsigned long *blob,
548 void *mem; 554 void *mem;
549 555
550 mutex_lock(&of_fdt_unflatten_mutex); 556 mutex_lock(&of_fdt_unflatten_mutex);
551 mem = __unflatten_device_tree(blob, dad, mynodes, &kernel_tree_alloc); 557 mem = __unflatten_device_tree(blob, dad, mynodes, &kernel_tree_alloc,
558 true);
552 mutex_unlock(&of_fdt_unflatten_mutex); 559 mutex_unlock(&of_fdt_unflatten_mutex);
553 560
554 return mem; 561 return mem;
@@ -1237,7 +1244,7 @@ bool __init early_init_dt_scan(void *params)
1237void __init unflatten_device_tree(void) 1244void __init unflatten_device_tree(void)
1238{ 1245{
1239 __unflatten_device_tree(initial_boot_params, NULL, &of_root, 1246 __unflatten_device_tree(initial_boot_params, NULL, &of_root,
1240 early_init_dt_alloc_memory_arch); 1247 early_init_dt_alloc_memory_arch, false);
1241 1248
1242 /* Get pointer to "/chosen" and "/aliases" nodes for use everywhere */ 1249 /* Get pointer to "/chosen" and "/aliases" nodes for use everywhere */
1243 of_alias_scan(early_init_dt_alloc_memory_arch); 1250 of_alias_scan(early_init_dt_alloc_memory_arch);
@@ -1294,7 +1301,7 @@ static int __init of_fdt_raw_init(void)
1294 1301
1295 if (of_fdt_crc32 != crc32_be(~0, initial_boot_params, 1302 if (of_fdt_crc32 != crc32_be(~0, initial_boot_params,
1296 fdt_totalsize(initial_boot_params))) { 1303 fdt_totalsize(initial_boot_params))) {
1297 pr_warn("fdt: not creating '/sys/firmware/fdt': CRC check failed\n"); 1304 pr_warn("not creating '/sys/firmware/fdt': CRC check failed\n");
1298 return 0; 1305 return 0;
1299 } 1306 }
1300 of_fdt_raw_attr.size = fdt_totalsize(initial_boot_params); 1307 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 dca8f9b93745..843a542dac7d 100644
--- a/drivers/of/fdt_address.c
+++ b/drivers/of/fdt_address.c
@@ -12,6 +12,9 @@
12 * the Free Software Foundation; either version 2, or (at your option) 12 * the Free Software Foundation; either version 2, or (at your option)
13 * any later version. 13 * any later version.
14 */ 14 */
15
16#define pr_fmt(fmt) "OF: fdt: " fmt
17
15#include <linux/kernel.h> 18#include <linux/kernel.h>
16#include <linux/libfdt.h> 19#include <linux/libfdt.h>
17#include <linux/of.h> 20#include <linux/of.h>
@@ -30,7 +33,7 @@ static void __init of_dump_addr(const char *s, const __be32 *addr, int na)
30 pr_debug("%s", s); 33 pr_debug("%s", s);
31 while(na--) 34 while(na--)
32 pr_cont(" %08x", *(addr++)); 35 pr_cont(" %08x", *(addr++));
33 pr_debug("\n"); 36 pr_cont("\n");
34} 37}
35#else 38#else
36static void __init of_dump_addr(const char *s, const __be32 *addr, int na) { } 39static 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,
77 s = of_read_number(range + na + pna, ns); 80 s = of_read_number(range + na + pna, ns);
78 da = of_read_number(addr, na); 81 da = of_read_number(addr, na);
79 82
80 pr_debug("FDT: default map, cp=%llx, s=%llx, da=%llx\n", 83 pr_debug("default map, cp=%llx, s=%llx, da=%llx\n",
81 cp, s, da); 84 cp, s, da);
82 85
83 if (da < cp || da >= (cp + s)) 86 if (da < cp || da >= (cp + s))
@@ -123,11 +126,11 @@ static int __init fdt_translate_one(const void *blob, int parent,
123 if (rlen == 0) { 126 if (rlen == 0) {
124 offset = of_read_number(addr, na); 127 offset = of_read_number(addr, na);
125 memset(addr, 0, pna * 4); 128 memset(addr, 0, pna * 4);
126 pr_debug("FDT: empty ranges, 1:1 translation\n"); 129 pr_debug("empty ranges, 1:1 translation\n");
127 goto finish; 130 goto finish;
128 } 131 }
129 132
130 pr_debug("FDT: walking ranges...\n"); 133 pr_debug("walking ranges...\n");
131 134
132 /* Now walk through the ranges */ 135 /* Now walk through the ranges */
133 rlen /= 4; 136 rlen /= 4;
@@ -138,14 +141,14 @@ static int __init fdt_translate_one(const void *blob, int parent,
138 break; 141 break;
139 } 142 }
140 if (offset == OF_BAD_ADDR) { 143 if (offset == OF_BAD_ADDR) {
141 pr_debug("FDT: not found !\n"); 144 pr_debug("not found !\n");
142 return 1; 145 return 1;
143 } 146 }
144 memcpy(addr, ranges + na, 4 * pna); 147 memcpy(addr, ranges + na, 4 * pna);
145 148
146 finish: 149 finish:
147 of_dump_addr("FDT: parent translation for:", addr, pna); 150 of_dump_addr("parent translation for:", addr, pna);
148 pr_debug("FDT: with offset: %llx\n", offset); 151 pr_debug("with offset: %llx\n", offset);
149 152
150 /* Translate it into parent bus space */ 153 /* Translate it into parent bus space */
151 return pbus->translate(addr, offset, pna); 154 return pbus->translate(addr, offset, pna);
@@ -170,12 +173,12 @@ static u64 __init fdt_translate_address(const void *blob, int node_offset)
170 int na, ns, pna, pns; 173 int na, ns, pna, pns;
171 u64 result = OF_BAD_ADDR; 174 u64 result = OF_BAD_ADDR;
172 175
173 pr_debug("FDT: ** translation for device %s **\n", 176 pr_debug("** translation for device %s **\n",
174 fdt_get_name(blob, node_offset, NULL)); 177 fdt_get_name(blob, node_offset, NULL));
175 178
176 reg = fdt_getprop(blob, node_offset, "reg", &len); 179 reg = fdt_getprop(blob, node_offset, "reg", &len);
177 if (!reg) { 180 if (!reg) {
178 pr_err("FDT: warning: device tree node '%s' has no address.\n", 181 pr_err("warning: device tree node '%s' has no address.\n",
179 fdt_get_name(blob, node_offset, NULL)); 182 fdt_get_name(blob, node_offset, NULL));
180 goto bail; 183 goto bail;
181 } 184 }
@@ -189,15 +192,15 @@ static u64 __init fdt_translate_address(const void *blob, int node_offset)
189 /* Cound address cells & copy address locally */ 192 /* Cound address cells & copy address locally */
190 bus->count_cells(blob, parent, &na, &ns); 193 bus->count_cells(blob, parent, &na, &ns);
191 if (!OF_CHECK_COUNTS(na, ns)) { 194 if (!OF_CHECK_COUNTS(na, ns)) {
192 pr_err("FDT: Bad cell count for %s\n", 195 pr_err("Bad cell count for %s\n",
193 fdt_get_name(blob, node_offset, NULL)); 196 fdt_get_name(blob, node_offset, NULL));
194 goto bail; 197 goto bail;
195 } 198 }
196 memcpy(addr, reg, na * 4); 199 memcpy(addr, reg, na * 4);
197 200
198 pr_debug("FDT: bus (na=%d, ns=%d) on %s\n", 201 pr_debug("bus (na=%d, ns=%d) on %s\n",
199 na, ns, fdt_get_name(blob, parent, NULL)); 202 na, ns, fdt_get_name(blob, parent, NULL));
200 of_dump_addr("OF: translating address:", addr, na); 203 of_dump_addr("translating address:", addr, na);
201 204
202 /* Translate */ 205 /* Translate */
203 for (;;) { 206 for (;;) {
@@ -207,7 +210,7 @@ static u64 __init fdt_translate_address(const void *blob, int node_offset)
207 210
208 /* If root, we have finished */ 211 /* If root, we have finished */
209 if (parent < 0) { 212 if (parent < 0) {
210 pr_debug("FDT: reached root node\n"); 213 pr_debug("reached root node\n");
211 result = of_read_number(addr, na); 214 result = of_read_number(addr, na);
212 break; 215 break;
213 } 216 }
@@ -216,12 +219,12 @@ static u64 __init fdt_translate_address(const void *blob, int node_offset)
216 pbus = &of_busses[0]; 219 pbus = &of_busses[0];
217 pbus->count_cells(blob, parent, &pna, &pns); 220 pbus->count_cells(blob, parent, &pna, &pns);
218 if (!OF_CHECK_COUNTS(pna, pns)) { 221 if (!OF_CHECK_COUNTS(pna, pns)) {
219 pr_err("FDT: Bad cell count for %s\n", 222 pr_err("Bad cell count for %s\n",
220 fdt_get_name(blob, node_offset, NULL)); 223 fdt_get_name(blob, node_offset, NULL));
221 break; 224 break;
222 } 225 }
223 226
224 pr_debug("FDT: parent bus (na=%d, ns=%d) on %s\n", 227 pr_debug("parent bus (na=%d, ns=%d) on %s\n",
225 pna, pns, fdt_get_name(blob, parent, NULL)); 228 pna, pns, fdt_get_name(blob, parent, NULL));
226 229
227 /* Apply bus translation */ 230 /* Apply bus translation */
@@ -234,7 +237,7 @@ static u64 __init fdt_translate_address(const void *blob, int node_offset)
234 ns = pns; 237 ns = pns;
235 bus = pbus; 238 bus = pbus;
236 239
237 of_dump_addr("FDT: one level translation:", addr, na); 240 of_dump_addr("one level translation:", addr, na);
238 } 241 }
239 bail: 242 bail:
240 return result; 243 return result;
diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index 6ec743faabe8..89a71c6074fc 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -18,6 +18,8 @@
18 * driver. 18 * driver.
19 */ 19 */
20 20
21#define pr_fmt(fmt) "OF: " fmt
22
21#include <linux/device.h> 23#include <linux/device.h>
22#include <linux/errno.h> 24#include <linux/errno.h>
23#include <linux/list.h> 25#include <linux/list.h>
@@ -557,6 +559,8 @@ void __init of_irq_init(const struct of_device_id *matches)
557 * its children can get processed in a subsequent pass. 559 * its children can get processed in a subsequent pass.
558 */ 560 */
559 list_add_tail(&desc->list, &intc_parent_list); 561 list_add_tail(&desc->list, &intc_parent_list);
562
563 of_node_set_flag(desc->dev, OF_POPULATED);
560 } 564 }
561 565
562 /* Get the next pending parent that might have children */ 566 /* Get the next pending parent that might have children */
diff --git a/drivers/of/of_pci.c b/drivers/of/of_pci.c
index 13f4fed38048..589b30c68e14 100644
--- a/drivers/of/of_pci.c
+++ b/drivers/of/of_pci.c
@@ -1,3 +1,5 @@
1#define pr_fmt(fmt) "OF: PCI: " fmt
2
1#include <linux/kernel.h> 3#include <linux/kernel.h>
2#include <linux/export.h> 4#include <linux/export.h>
3#include <linux/of.h> 5#include <linux/of.h>
@@ -138,7 +140,7 @@ void of_pci_check_probe_only(void)
138 else 140 else
139 pci_clear_flags(PCI_PROBE_ONLY); 141 pci_clear_flags(PCI_PROBE_ONLY);
140 142
141 pr_info("PCI: PROBE_ONLY %sabled\n", val ? "en" : "dis"); 143 pr_info("PROBE_ONLY %sabled\n", val ? "en" : "dis");
142} 144}
143EXPORT_SYMBOL_GPL(of_pci_check_probe_only); 145EXPORT_SYMBOL_GPL(of_pci_check_probe_only);
144 146
@@ -181,7 +183,7 @@ int of_pci_get_host_bridge_resources(struct device_node *dev,
181 if (!bus_range) 183 if (!bus_range)
182 return -ENOMEM; 184 return -ENOMEM;
183 185
184 pr_info("PCI host bridge %s ranges:\n", dev->full_name); 186 pr_info("host bridge %s ranges:\n", dev->full_name);
185 187
186 err = of_pci_parse_bus_range(dev, bus_range); 188 err = of_pci_parse_bus_range(dev, bus_range);
187 if (err) { 189 if (err) {
diff --git a/drivers/of/of_private.h b/drivers/of/of_private.h
index 829469faeb23..18bbb4517e25 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);
83extern void __of_detach_node(struct device_node *np); 83extern void __of_detach_node(struct device_node *np);
84extern void __of_detach_node_sysfs(struct device_node *np); 84extern void __of_detach_node_sysfs(struct device_node *np);
85 85
86extern void __of_sysfs_remove_bin_file(struct device_node *np,
87 struct property *prop);
88
86/* iterators for transactions, used for overlays */ 89/* iterators for transactions, used for overlays */
87/* forward iterator */ 90/* forward iterator */
88#define for_each_transaction_entry(_oft, _te) \ 91#define for_each_transaction_entry(_oft, _te) \
diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
index 06af99f64ad8..366d8c3c7989 100644
--- a/drivers/of/of_reserved_mem.c
+++ b/drivers/of/of_reserved_mem.c
@@ -13,6 +13,8 @@
13 * License or (at your optional) any later version of the license. 13 * License or (at your optional) any later version of the license.
14 */ 14 */
15 15
16#define pr_fmt(fmt) "OF: reserved mem: " fmt
17
16#include <linux/err.h> 18#include <linux/err.h>
17#include <linux/of.h> 19#include <linux/of.h>
18#include <linux/of_fdt.h> 20#include <linux/of_fdt.h>
@@ -76,7 +78,7 @@ void __init fdt_reserved_mem_save_node(unsigned long node, const char *uname,
76 struct reserved_mem *rmem = &reserved_mem[reserved_mem_count]; 78 struct reserved_mem *rmem = &reserved_mem[reserved_mem_count];
77 79
78 if (reserved_mem_count == ARRAY_SIZE(reserved_mem)) { 80 if (reserved_mem_count == ARRAY_SIZE(reserved_mem)) {
79 pr_err("Reserved memory: not enough space all defined regions.\n"); 81 pr_err("not enough space all defined regions.\n");
80 return; 82 return;
81 } 83 }
82 84
@@ -109,8 +111,7 @@ static int __init __reserved_mem_alloc_size(unsigned long node,
109 return -EINVAL; 111 return -EINVAL;
110 112
111 if (len != dt_root_size_cells * sizeof(__be32)) { 113 if (len != dt_root_size_cells * sizeof(__be32)) {
112 pr_err("Reserved memory: invalid size property in '%s' node.\n", 114 pr_err("invalid size property in '%s' node.\n", uname);
113 uname);
114 return -EINVAL; 115 return -EINVAL;
115 } 116 }
116 size = dt_mem_next_cell(dt_root_size_cells, &prop); 117 size = dt_mem_next_cell(dt_root_size_cells, &prop);
@@ -120,7 +121,7 @@ static int __init __reserved_mem_alloc_size(unsigned long node,
120 prop = of_get_flat_dt_prop(node, "alignment", &len); 121 prop = of_get_flat_dt_prop(node, "alignment", &len);
121 if (prop) { 122 if (prop) {
122 if (len != dt_root_addr_cells * sizeof(__be32)) { 123 if (len != dt_root_addr_cells * sizeof(__be32)) {
123 pr_err("Reserved memory: invalid alignment property in '%s' node.\n", 124 pr_err("invalid alignment property in '%s' node.\n",
124 uname); 125 uname);
125 return -EINVAL; 126 return -EINVAL;
126 } 127 }
@@ -142,7 +143,7 @@ static int __init __reserved_mem_alloc_size(unsigned long node,
142 if (prop) { 143 if (prop) {
143 144
144 if (len % t_len != 0) { 145 if (len % t_len != 0) {
145 pr_err("Reserved memory: invalid alloc-ranges property in '%s', skipping node.\n", 146 pr_err("invalid alloc-ranges property in '%s', skipping node.\n",
146 uname); 147 uname);
147 return -EINVAL; 148 return -EINVAL;
148 } 149 }
@@ -157,7 +158,7 @@ static int __init __reserved_mem_alloc_size(unsigned long node,
157 ret = early_init_dt_alloc_reserved_memory_arch(size, 158 ret = early_init_dt_alloc_reserved_memory_arch(size,
158 align, start, end, nomap, &base); 159 align, start, end, nomap, &base);
159 if (ret == 0) { 160 if (ret == 0) {
160 pr_debug("Reserved memory: allocated memory for '%s' node: base %pa, size %ld MiB\n", 161 pr_debug("allocated memory for '%s' node: base %pa, size %ld MiB\n",
161 uname, &base, 162 uname, &base,
162 (unsigned long)size / SZ_1M); 163 (unsigned long)size / SZ_1M);
163 break; 164 break;
@@ -169,13 +170,12 @@ static int __init __reserved_mem_alloc_size(unsigned long node,
169 ret = early_init_dt_alloc_reserved_memory_arch(size, align, 170 ret = early_init_dt_alloc_reserved_memory_arch(size, align,
170 0, 0, nomap, &base); 171 0, 0, nomap, &base);
171 if (ret == 0) 172 if (ret == 0)
172 pr_debug("Reserved memory: allocated memory for '%s' node: base %pa, size %ld MiB\n", 173 pr_debug("allocated memory for '%s' node: base %pa, size %ld MiB\n",
173 uname, &base, (unsigned long)size / SZ_1M); 174 uname, &base, (unsigned long)size / SZ_1M);
174 } 175 }
175 176
176 if (base == 0) { 177 if (base == 0) {
177 pr_info("Reserved memory: failed to allocate memory for node '%s'\n", 178 pr_info("failed to allocate memory for node '%s'\n", uname);
178 uname);
179 return -ENOMEM; 179 return -ENOMEM;
180 } 180 }
181 181
@@ -204,7 +204,7 @@ static int __init __reserved_mem_init_node(struct reserved_mem *rmem)
204 continue; 204 continue;
205 205
206 if (initfn(rmem) == 0) { 206 if (initfn(rmem) == 0) {
207 pr_info("Reserved memory: initialized node %s, compatible id %s\n", 207 pr_info("initialized node %s, compatible id %s\n",
208 rmem->name, compat); 208 rmem->name, compat);
209 return 0; 209 return 0;
210 } 210 }
@@ -246,7 +246,7 @@ static void __init __rmem_check_for_overlap(void)
246 246
247 this_end = this->base + this->size; 247 this_end = this->base + this->size;
248 next_end = next->base + next->size; 248 next_end = next->base + next->size;
249 pr_err("Reserved memory: OVERLAP DETECTED!\n%s (%pa--%pa) overlaps with %s (%pa--%pa)\n", 249 pr_err("OVERLAP DETECTED!\n%s (%pa--%pa) overlaps with %s (%pa--%pa)\n",
250 this->name, &this->base, &this_end, 250 this->name, &this->base, &this_end,
251 next->name, &next->base, &next_end); 251 next->name, &next->base, &next_end);
252 } 252 }
diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c
index 82250815e9a5..318dbb51e7a2 100644
--- a/drivers/of/overlay.c
+++ b/drivers/of/overlay.c
@@ -8,7 +8,9 @@
8 * modify it under the terms of the GNU General Public License 8 * modify it under the terms of the GNU General Public License
9 * version 2 as published by the Free Software Foundation. 9 * version 2 as published by the Free Software Foundation.
10 */ 10 */
11#undef DEBUG 11
12#define pr_fmt(fmt) "OF: overlay: " fmt
13
12#include <linux/kernel.h> 14#include <linux/kernel.h>
13#include <linux/module.h> 15#include <linux/module.h>
14#include <linux/of.h> 16#include <linux/of.h>
@@ -137,8 +139,8 @@ static int of_overlay_apply_one(struct of_overlay *ov,
137 for_each_property_of_node(overlay, prop) { 139 for_each_property_of_node(overlay, prop) {
138 ret = of_overlay_apply_single_property(ov, target, prop); 140 ret = of_overlay_apply_single_property(ov, target, prop);
139 if (ret) { 141 if (ret) {
140 pr_err("%s: Failed to apply prop @%s/%s\n", 142 pr_err("Failed to apply prop @%s/%s\n",
141 __func__, target->full_name, prop->name); 143 target->full_name, prop->name);
142 return ret; 144 return ret;
143 } 145 }
144 } 146 }
@@ -146,9 +148,8 @@ static int of_overlay_apply_one(struct of_overlay *ov,
146 for_each_child_of_node(overlay, child) { 148 for_each_child_of_node(overlay, child) {
147 ret = of_overlay_apply_single_device_node(ov, target, child); 149 ret = of_overlay_apply_single_device_node(ov, target, child);
148 if (ret != 0) { 150 if (ret != 0) {
149 pr_err("%s: Failed to apply single node @%s/%s\n", 151 pr_err("Failed to apply single node @%s/%s\n",
150 __func__, target->full_name, 152 target->full_name, child->name);
151 child->name);
152 of_node_put(child); 153 of_node_put(child);
153 return ret; 154 return ret;
154 } 155 }
@@ -176,8 +177,7 @@ static int of_overlay_apply(struct of_overlay *ov)
176 177
177 err = of_overlay_apply_one(ov, ovinfo->target, ovinfo->overlay); 178 err = of_overlay_apply_one(ov, ovinfo->target, ovinfo->overlay);
178 if (err != 0) { 179 if (err != 0) {
179 pr_err("%s: overlay failed '%s'\n", 180 pr_err("apply failed '%s'\n", ovinfo->target->full_name);
180 __func__, ovinfo->target->full_name);
181 return err; 181 return err;
182 } 182 }
183 } 183 }
@@ -208,7 +208,7 @@ static struct device_node *find_target_node(struct device_node *info_node)
208 if (ret == 0) 208 if (ret == 0)
209 return of_find_node_by_path(path); 209 return of_find_node_by_path(path);
210 210
211 pr_err("%s: Failed to find target for node %p (%s)\n", __func__, 211 pr_err("Failed to find target for node %p (%s)\n",
212 info_node, info_node->name); 212 info_node, info_node->name);
213 213
214 return NULL; 214 return NULL;
@@ -355,8 +355,6 @@ int of_overlay_create(struct device_node *tree)
355 355
356 id = idr_alloc(&ov_idr, ov, 0, 0, GFP_KERNEL); 356 id = idr_alloc(&ov_idr, ov, 0, 0, GFP_KERNEL);
357 if (id < 0) { 357 if (id < 0) {
358 pr_err("%s: idr_alloc() failed for tree@%s\n",
359 __func__, tree->full_name);
360 err = id; 358 err = id;
361 goto err_destroy_trans; 359 goto err_destroy_trans;
362 } 360 }
@@ -365,26 +363,21 @@ int of_overlay_create(struct device_node *tree)
365 /* build the overlay info structures */ 363 /* build the overlay info structures */
366 err = of_build_overlay_info(ov, tree); 364 err = of_build_overlay_info(ov, tree);
367 if (err) { 365 if (err) {
368 pr_err("%s: of_build_overlay_info() failed for tree@%s\n", 366 pr_err("of_build_overlay_info() failed for tree@%s\n",
369 __func__, tree->full_name); 367 tree->full_name);
370 goto err_free_idr; 368 goto err_free_idr;
371 } 369 }
372 370
373 /* apply the overlay */ 371 /* apply the overlay */
374 err = of_overlay_apply(ov); 372 err = of_overlay_apply(ov);
375 if (err) { 373 if (err)
376 pr_err("%s: of_overlay_apply() failed for tree@%s\n",
377 __func__, tree->full_name);
378 goto err_abort_trans; 374 goto err_abort_trans;
379 }
380 375
381 /* apply the changeset */ 376 /* apply the changeset */
382 err = __of_changeset_apply(&ov->cset); 377 err = __of_changeset_apply(&ov->cset);
383 if (err) { 378 if (err)
384 pr_err("%s: __of_changeset_apply() failed for tree@%s\n",
385 __func__, tree->full_name);
386 goto err_revert_overlay; 379 goto err_revert_overlay;
387 } 380
388 381
389 /* add to the tail of the overlay list */ 382 /* add to the tail of the overlay list */
390 list_add_tail(&ov->node, &ov_list); 383 list_add_tail(&ov->node, &ov_list);
@@ -469,8 +462,7 @@ static int overlay_removal_is_ok(struct of_overlay *ov)
469 462
470 list_for_each_entry(ce, &ov->cset.entries, node) { 463 list_for_each_entry(ce, &ov->cset.entries, node) {
471 if (!overlay_is_topmost(ov, ce->np)) { 464 if (!overlay_is_topmost(ov, ce->np)) {
472 pr_err("%s: overlay #%d is not topmost\n", 465 pr_err("overlay #%d is not topmost\n", ov->id);
473 __func__, ov->id);
474 return 0; 466 return 0;
475 } 467 }
476 } 468 }
@@ -496,16 +488,13 @@ int of_overlay_destroy(int id)
496 ov = idr_find(&ov_idr, id); 488 ov = idr_find(&ov_idr, id);
497 if (ov == NULL) { 489 if (ov == NULL) {
498 err = -ENODEV; 490 err = -ENODEV;
499 pr_err("%s: Could not find overlay #%d\n", 491 pr_err("destroy: Could not find overlay #%d\n", id);
500 __func__, id);
501 goto out; 492 goto out;
502 } 493 }
503 494
504 /* check whether the overlay is safe to remove */ 495 /* check whether the overlay is safe to remove */
505 if (!overlay_removal_is_ok(ov)) { 496 if (!overlay_removal_is_ok(ov)) {
506 err = -EBUSY; 497 err = -EBUSY;
507 pr_err("%s: removal check failed for overlay #%d\n",
508 __func__, id);
509 goto out; 498 goto out;
510 } 499 }
511 500
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 16e8daffac06..765390e3ed8d 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -11,6 +11,9 @@
11 * 2 of the License, or (at your option) any later version. 11 * 2 of the License, or (at your option) any later version.
12 * 12 *
13 */ 13 */
14
15#define pr_fmt(fmt) "OF: " fmt
16
14#include <linux/errno.h> 17#include <linux/errno.h>
15#include <linux/module.h> 18#include <linux/module.h>
16#include <linux/amba/bus.h> 19#include <linux/amba/bus.h>
@@ -31,7 +34,6 @@ const struct of_device_id of_default_bus_match_table[] = {
31#endif /* CONFIG_ARM_AMBA */ 34#endif /* CONFIG_ARM_AMBA */
32 {} /* Empty terminated list */ 35 {} /* Empty terminated list */
33}; 36};
34EXPORT_SYMBOL(of_default_bus_match_table);
35 37
36static int of_dev_node_match(struct device *dev, void *data) 38static int of_dev_node_match(struct device *dev, void *data)
37{ 39{
@@ -234,11 +236,8 @@ static struct amba_device *of_amba_device_create(struct device_node *node,
234 return NULL; 236 return NULL;
235 237
236 dev = amba_device_alloc(NULL, 0, 0); 238 dev = amba_device_alloc(NULL, 0, 0);
237 if (!dev) { 239 if (!dev)
238 pr_err("%s(): amba_device_alloc() failed for %s\n",
239 __func__, node->full_name);
240 goto err_clear_flag; 240 goto err_clear_flag;
241 }
242 241
243 /* setup generic device info */ 242 /* setup generic device info */
244 dev->dev.of_node = of_node_get(node); 243 dev->dev.of_node = of_node_get(node);
@@ -261,15 +260,15 @@ static struct amba_device *of_amba_device_create(struct device_node *node,
261 260
262 ret = of_address_to_resource(node, 0, &dev->res); 261 ret = of_address_to_resource(node, 0, &dev->res);
263 if (ret) { 262 if (ret) {
264 pr_err("%s(): of_address_to_resource() failed (%d) for %s\n", 263 pr_err("amba: of_address_to_resource() failed (%d) for %s\n",
265 __func__, ret, node->full_name); 264 ret, node->full_name);
266 goto err_free; 265 goto err_free;
267 } 266 }
268 267
269 ret = amba_device_add(dev, &iomem_resource); 268 ret = amba_device_add(dev, &iomem_resource);
270 if (ret) { 269 if (ret) {
271 pr_err("%s(): amba_device_add() failed (%d) for %s\n", 270 pr_err("amba_device_add() failed (%d) for %s\n",
272 __func__, ret, node->full_name); 271 ret, node->full_name);
273 goto err_free; 272 goto err_free;
274 } 273 }
275 274
@@ -363,6 +362,12 @@ static int of_platform_bus_create(struct device_node *bus,
363 return 0; 362 return 0;
364 } 363 }
365 364
365 if (of_node_check_flag(bus, OF_POPULATED_BUS)) {
366 pr_debug("%s() - skipping %s, already populated\n",
367 __func__, bus->full_name);
368 return 0;
369 }
370
366 auxdata = of_dev_lookup(lookup, bus); 371 auxdata = of_dev_lookup(lookup, bus);
367 if (auxdata) { 372 if (auxdata) {
368 bus_id = auxdata->name; 373 bus_id = auxdata->name;
@@ -414,7 +419,7 @@ int of_platform_bus_probe(struct device_node *root,
414 if (!root) 419 if (!root)
415 return -EINVAL; 420 return -EINVAL;
416 421
417 pr_debug("of_platform_bus_probe()\n"); 422 pr_debug("%s()\n", __func__);
418 pr_debug(" starting at: %s\n", root->full_name); 423 pr_debug(" starting at: %s\n", root->full_name);
419 424
420 /* Do a self check of bus type, if there's a match, create children */ 425 /* Do a self check of bus type, if there's a match, create children */
@@ -466,6 +471,9 @@ int of_platform_populate(struct device_node *root,
466 if (!root) 471 if (!root)
467 return -EINVAL; 472 return -EINVAL;
468 473
474 pr_debug("%s()\n", __func__);
475 pr_debug(" starting at: %s\n", root->full_name);
476
469 for_each_child_of_node(root, child) { 477 for_each_child_of_node(root, child) {
470 rc = of_platform_bus_create(child, matches, lookup, parent, true); 478 rc = of_platform_bus_create(child, matches, lookup, parent, true);
471 if (rc) { 479 if (rc) {
@@ -489,6 +497,15 @@ int of_platform_default_populate(struct device_node *root,
489} 497}
490EXPORT_SYMBOL_GPL(of_platform_default_populate); 498EXPORT_SYMBOL_GPL(of_platform_default_populate);
491 499
500static int __init of_platform_default_populate_init(void)
501{
502 if (of_have_populated_dt())
503 of_platform_default_populate(NULL, NULL, NULL);
504
505 return 0;
506}
507arch_initcall_sync(of_platform_default_populate_init);
508
492static int of_platform_device_destroy(struct device *dev, void *data) 509static int of_platform_device_destroy(struct device *dev, void *data)
493{ 510{
494 /* Do not touch devices not populated from the device tree */ 511 /* Do not touch devices not populated from the device tree */
diff --git a/drivers/of/resolver.c b/drivers/of/resolver.c
index d313d492f278..46325d6394cf 100644
--- a/drivers/of/resolver.c
+++ b/drivers/of/resolver.c
@@ -9,6 +9,8 @@
9 * version 2 as published by the Free Software Foundation. 9 * version 2 as published by the Free Software Foundation.
10 */ 10 */
11 11
12#define pr_fmt(fmt) "OF: resolver: " fmt
13
12#include <linux/kernel.h> 14#include <linux/kernel.h>
13#include <linux/module.h> 15#include <linux/module.h>
14#include <linux/of.h> 16#include <linux/of.h>
@@ -313,6 +315,11 @@ int of_resolve_phandles(struct device_node *resolve)
313 phandle phandle, phandle_delta; 315 phandle phandle, phandle_delta;
314 int err; 316 int err;
315 317
318 if (!resolve)
319 pr_err("%s: null node\n", __func__);
320 if (resolve && !of_node_check_flag(resolve, OF_DETACHED))
321 pr_err("%s: node %s not detached\n", __func__,
322 resolve->full_name);
316 /* the resolve node must exist, and be detached */ 323 /* the resolve node must exist, and be detached */
317 if (!resolve || !of_node_check_flag(resolve, OF_DETACHED)) 324 if (!resolve || !of_node_check_flag(resolve, OF_DETACHED))
318 return -EINVAL; 325 return -EINVAL;
@@ -369,6 +376,7 @@ int of_resolve_phandles(struct device_node *resolve)
369 376
370 /* we need to fixup, but no root symbols... */ 377 /* we need to fixup, but no root symbols... */
371 if (!root_sym) { 378 if (!root_sym) {
379 pr_err("%s: no symbols in root of device tree.\n", __func__);
372 err = -EINVAL; 380 err = -EINVAL;
373 goto out; 381 goto out;
374 } 382 }
diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index f34ed9310323..53c83d66eb7e 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -771,7 +771,7 @@ static void __init of_unittest_platform_populate(void)
771 }; 771 };
772 772
773 np = of_find_node_by_path("/testcase-data"); 773 np = of_find_node_by_path("/testcase-data");
774 of_platform_populate(np, of_default_bus_match_table, NULL, NULL); 774 of_platform_default_populate(np, NULL, NULL);
775 775
776 /* Test that a missing irq domain returns -EPROBE_DEFER */ 776 /* Test that a missing irq domain returns -EPROBE_DEFER */
777 np = of_find_node_by_path("/testcase-data/testcase-device1"); 777 np = of_find_node_by_path("/testcase-data/testcase-device1");
@@ -1871,8 +1871,7 @@ static void __init of_unittest_overlay(void)
1871 goto out; 1871 goto out;
1872 } 1872 }
1873 1873
1874 ret = of_platform_populate(bus_np, of_default_bus_match_table, 1874 ret = of_platform_default_populate(bus_np, NULL, NULL);
1875 NULL, NULL);
1876 if (ret != 0) { 1875 if (ret != 0) {
1877 unittest(0, "could not populate bus @ \"%s\"\n", bus_path); 1876 unittest(0, "could not populate bus @ \"%s\"\n", bus_path);
1878 goto out; 1877 goto out;
diff --git a/include/linux/of_iommu.h b/include/linux/of_iommu.h
index bd02b44902d0..e80b9c762a03 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,
11 int index, unsigned long *busno, dma_addr_t *addr, 11 int index, unsigned long *busno, dma_addr_t *addr,
12 size_t *size); 12 size_t *size);
13 13
14extern void of_iommu_init(void);
15extern const struct iommu_ops *of_iommu_configure(struct device *dev, 14extern const struct iommu_ops *of_iommu_configure(struct device *dev,
16 struct device_node *master_np); 15 struct device_node *master_np);
17 16
@@ -24,7 +23,6 @@ static inline int of_get_dma_window(struct device_node *dn, const char *prefix,
24 return -EINVAL; 23 return -EINVAL;
25} 24}
26 25
27static inline void of_iommu_init(void) { }
28static inline const struct iommu_ops *of_iommu_configure(struct device *dev, 26static inline const struct iommu_ops *of_iommu_configure(struct device *dev,
29 struct device_node *master_np) 27 struct device_node *master_np)
30{ 28{
diff --git a/scripts/dtc/dt_to_config b/scripts/dtc/dt_to_config
new file mode 100755
index 000000000000..9a248b505c58
--- /dev/null
+++ b/scripts/dtc/dt_to_config
@@ -0,0 +1,1213 @@
1#!/usr/bin/perl
2
3# Copyright 2016 by Frank Rowand
4# Copyright 2016 by Gaurav Minocha
5#
6# This file is subject to the terms and conditions of the GNU General Public
7# License v2.
8
9use strict 'refs';
10use strict subs;
11
12use Getopt::Long;
13
14$VUFX = "160610a";
15
16$script_name = $0;
17$script_name =~ s|^.*/||;
18
19
20# ----- constants for print_flags()
21
22# Position in string $pr_flags. Range of 0..($num_pr_flags - 1).
23$pr_flag_pos_mcompatible = 0;
24$pr_flag_pos_driver = 1;
25$pr_flag_pos_mdriver = 2;
26$pr_flag_pos_config = 3;
27$pr_flag_pos_mconfig = 4;
28$pr_flag_pos_node_not_enabled = 5;
29$pr_flag_pos_white_list = 6;
30$pr_flag_pos_hard_coded = 7;
31$pr_flag_pos_config_hard_coded = 8;
32$pr_flag_pos_config_none = 9;
33$pr_flag_pos_config_m = 10;
34$pr_flag_pos_config_y = 11;
35$pr_flag_pos_config_test_fail = 12;
36
37$num_pr_flags = $pr_flag_pos_config_test_fail + 1;
38
39# flags in @pr_flag_value must be unique values to allow simple regular
40# expessions to work for --include_flags and --exclude_flags.
41# Convention: use upper case letters for potential issues or problems.
42
43@pr_flag_value = ('M', 'd', 'D', 'c', 'C', 'E', 'W', 'H', 'x', 'n', 'm', 'y', 'F');
44
45@pr_flag_help = (
46 "multiple compatibles found for this node",
47 "driver found for this compatible",
48 "multiple drivers found for this compatible",
49 "kernel config found for this driver",
50 "multiple config options found for this driver",
51 "node is not enabled",
52 "compatible is white listed",
53 "matching driver and/or kernel config is hard coded",
54 "kernel config hard coded in Makefile",
55 "one or more kernel config file options is not set",
56 "one or more kernel config file options is set to 'm'",
57 "one or more kernel config file options is set to 'y'",
58 "one of more kernel config file options fails to have correct value"
59);
60
61
62# -----
63
64%driver_config = (); # driver config array, indexed by driver source file
65%driver_count = (); # driver_cnt, indexed by compatible
66%compat_driver = (); # compatible driver array, indexed by compatible
67%existing_config = (); # existing config symbols present in given config file
68 # expected values are: "y", "m", a decimal number, a
69 # hex number, or a string
70
71# ----- magic compatibles, do not have a driver
72#
73# Will not search for drivers for these compatibles.
74
75%compat_white_list = (
76 'none' => '1',
77 'pci' => '1',
78 'simple-bus' => '1',
79);
80
81# Will not search for drivers for these compatibles.
82#
83# These compatibles have a very large number of false positives.
84#
85# 'hardcoded_no_driver' is a magic value. Other code knows this
86# magic value. Do not use 'no_driver' here!
87#
88# Revisit each 'hardcoded_no_driver' to see how the compatible
89# is used. Are there drivers that can be provided?
90
91%driver_hard_code_list = (
92 'cache' => ['hardcoded_no_driver'],
93 'eeprom' => ['hardcoded_no_driver'],
94 'gpio' => ['hardcoded_no_driver'],
95 'gpio-keys' => ['drivers/input/keyboard/gpio_keys.c'],
96 'i2c-gpio' => ['drivers/i2c/busses/i2c-gpio.c'],
97 'isa' => ['arch/mips/mti-malta/malta-dt.c',
98 'arch/x86/kernel/devicetree.c'],
99 'led' => ['hardcoded_no_driver'],
100 'm25p32' => ['hardcoded_no_driver'],
101 'm25p64' => ['hardcoded_no_driver'],
102 'm25p80' => ['hardcoded_no_driver'],
103 'mtd-ram' => ['drivers/mtd/maps/physmap_of.c'],
104 'pwm-backlight' => ['drivers/video/backlight/pwm_bl.c'],
105 'spidev' => ['hardcoded_no_driver'],
106 'syscon' => ['drivers/mfd/syscon.c'],
107 'tlv320aic23' => ['hardcoded_no_driver'],
108 'wm8731' => ['hardcoded_no_driver'],
109);
110
111# Use these config options instead of searching makefiles
112
113%driver_config_hard_code_list = (
114
115 # this one needed even if %driver_hard_code_list is empty
116 'no_driver' => ['no_config'],
117 'hardcoded_no_driver' => ['no_config'],
118
119 # drivers/usb/host/ehci-ppc-of.c
120 # drivers/usb/host/ehci-xilinx-of.c
121 # are included from:
122 # drivers/usb/host/ehci-hcd.c
123 # thus the search of Makefile for the included .c files is incorrect
124 # ehci-hcd.c wraps the includes with ifdef CONFIG_USB_EHCI_HCD_..._OF
125 #
126 # similar model for ohci-hcd.c (but no ohci-xilinx-of.c)
127 #
128 # similarly, uhci-hcd.c includes uhci-platform.c
129
130 'drivers/usb/host/ehci-ppc-of.c' => ['CONFIG_USB_EHCI_HCD',
131 'CONFIG_USB_EHCI_HCD_PPC_OF'],
132 'drivers/usb/host/ohci-ppc-of.c' => ['CONFIG_USB_OHCI_HCD',
133 'CONFIG_USB_OHCI_HCD_PPC_OF'],
134
135 'drivers/usb/host/ehci-xilinx-of.c' => ['CONFIG_USB_EHCI_HCD',
136 'CONFIG_USB_EHCI_HCD_XILINX'],
137
138 'drivers/usb/host/uhci-platform.c' => ['CONFIG_USB_UHCI_HCD',
139 'CONFIG_USB_UHCI_PLATFORM'],
140
141 # scan_makefile will find only one of these config options:
142 # ifneq ($(CONFIG_SOC_IMX6)$(CONFIG_SOC_LS1021A),)
143 'arch/arm/mach-imx/platsmp.c' => ['CONFIG_SOC_IMX6 && CONFIG_SMP',
144 'CONFIG_SOC_LS1021A && CONFIG_SMP'],
145);
146
147
148# 'virt/kvm/arm/.*' are controlled by makefiles in other directories,
149# using relative paths, such as 'KVM := ../../../virt/kvm'. Do not
150# add complexity to find_kconfig() to deal with this. There is a long
151# term intent to change the kvm related makefiles to the normal kernel
152# style. After that is done, this entry can be removed from the
153# black_list_driver.
154
155@black_list_driver = (
156 # kvm no longer a problem after commit 503a62862e8f in 4.7-rc1
157 # 'virt/kvm/arm/.*',
158);
159
160
161sub usage()
162{
163 print
164"
165Usage: $script_name [options] device-tree...
166
167 device_tree is: dts_file | dtb_file | proc_device-tree
168
169
170Valid options:
171 -c FILE Read kernel config options from FILE
172 --config FILE synonym for 'c'
173 --config-format config file friendly output format
174 --exclude-flag FLAG exclude entries with a matching flag
175 -h Display this message and exit
176 --help synonym for 'h'
177 --black-list-driver use driver black list
178 --white-list-config use config white list
179 --white-list-driver use driver white list
180 --include-flag FLAG include only entries with a matching flag
181 --include-suspect include only entries with an uppercase flag
182 --short-name do not show the path portion of the node name
183 --show-lists report of white and black lists
184 --version Display program version and exit
185
186
187 Report driver source files that match the compatibles in the device
188 tree file and the kernel config options that enable the driver source
189 files.
190
191 This program must be run in the root directory of a Linux kernel
192 source tree.
193
194 The default format is a report that is intended to be easily human
195 scannable.
196
197 An alternate format can be selected by --config-format. This will
198 create output that can easily be edited to create a fragment that can
199 be appended to the existing kernel config file. Each entry consists of
200 multiple lines. The first line reports flags, the node path, compatible
201 value, driver file matching the compatible, configuration options, and
202 current values of the configuration options. For each configuration
203 option, the following lines report the current value and the value that
204 is required for the driver file to be included in the kernel.
205
206 If a large number of drivers or config options is listed for a node,
207 and the '$pr_flag_value[$pr_flag_pos_hard_coded]' flag is set consider using --white-list-config and/or
208 --white-list-driver. If the white list option suppresses the correct
209 entry please report that as a bug.
210
211 CAUTION:
212 This program uses heuristics to guess which driver(s) support each
213 compatible string and which config option(s) enables the driver(s).
214 Do not believe that the reported information is fully correct.
215 This program is intended to aid the process of determining the
216 proper kernel configuration for a device tree, but this is not
217 a fully automated process -- human involvement may still be
218 required!
219
220 The driver match heuristic used is to search for source files
221 containing the compatible string enclosed in quotes.
222
223 This program might not be able to find all drivers matching a
224 compatible string.
225
226 Some makefiles are overly clever. This program was not made
227 complex enough to handle them. If no config option is listed
228 for a driver, look at the makefile for the driver source file.
229 Even if a config option is listed for a driver, some other
230 available config options may not be listed.
231
232 FLAG values:
233";
234
235 for ($k = 0; $k < $num_pr_flags; $k++) {
236 printf " %s %s\n", $pr_flag_value[$k], $pr_flag_help[$k];
237 }
238
239 print
240"
241 Upper case letters indicate potential issues or problems.
242
243 The flag:
244
245";
246
247 $k = $pr_flag_pos_hard_coded;
248 printf " %s %s\n", $pr_flag_value[$k], $pr_flag_help[$k];
249
250 print
251"
252 will be set if the config or driver is in the white lists, even if
253 --white-list-config and --white-list-driver are not specified.
254 This is a hint that 1) many of these reported lines are likely to
255 be incorrect, and 2) using those options will reduce the number of
256 drivers and/or config options reported.
257
258 --white-list-config and --white-list-driver may not be accurate if this
259 program is not well maintained. Use them with appropriate skepticism.
260 Use the --show-lists option to report the values in the list.
261
262 Return value:
263 0 if no error
264 1 error processing command line
265 2 unable to open or read kernel config file
266 3 unable to open or process input device tree file(s)
267
268 EXAMPLES:
269
270 dt_to_config arch/arm/boot/dts/my_dts_file.dts
271
272 Basic report.
273
274 dt_to_config \\
275 --config \${KBUILD_OUTPUT}/.config \\
276 arch/\${ARCH}/boot/dts/my_dts_file.dts
277
278 Full report, with config file issues noted.
279
280 dt_to_config --include-suspect \\
281 --config \${KBUILD_OUTPUT}/.config \\
282 arch/\${ARCH}/boot/dts/my_dts_file.dts
283
284 Report of node / compatible string / driver tuples that should
285 be further investigated. A node may have multiple compatible
286 strings. A compatible string may be matched by multiple drivers.
287 A driver may have config file issues noted. The compatible string
288 and/or driver may be in the white lists.
289
290 dt_to_config --include-suspect --config-format \\
291 --config ${KBUILD_OUTPUT}/.config \\
292 arch/\${ARCH}/boot/dts/my_dts_file.dts
293
294 Report of node / compatible string / driver tuples that should
295 be further investigated. The report can be edited to uncomment
296 the config options to select the desired tuple for a given node.
297 A node may have multiple compatible strings. A compatible string
298 may be matched by multiple drivers. A driver may have config file
299 issues noted. The compatible string and/or driver may be in the
300 white lists.
301
302";
303}
304
305sub set_flag()
306{
307 # pr_flags_ref is a reference to $pr_flags
308
309 my $pr_flags_ref = shift;
310 my $pos = shift;
311
312 substr $$pr_flags_ref, $pos, 1, $pr_flag_value[$pos];
313
314 return $pr_flags;
315}
316
317sub print_flags()
318{
319 # return 1 if anything printed, else 0
320
321 # some fields of pn_arg_ref might not be used in this function, but
322 # extract all of them anyway.
323 my $pn_arg_ref = shift;
324
325 my $compat = $pn_arg_ref->{compat};
326 my $compatible_cnt = $pn_arg_ref->{compatible_cnt};
327 my $config = $pn_arg_ref->{config};
328 my $config_cnt = $pn_arg_ref->{config_cnt};
329 my $driver = $pn_arg_ref->{driver};
330 my $driver_cnt = $pn_arg_ref->{driver_cnt};
331 my $full_node = $pn_arg_ref->{full_node};
332 my $node = $pn_arg_ref->{node};
333 my $node_enabled = $pn_arg_ref->{node_enabled};
334 my $white_list = $pn_arg_ref->{white_list};
335
336 my $pr_flags = '-' x $num_pr_flags;
337
338
339 # ----- set flags in $pr_flags
340
341 if ($compatible_cnt > 1) {
342 &set_flag(\$pr_flags, $pr_flag_pos_mcompatible);
343 }
344
345 if ($config_cnt > 1) {
346 &set_flag(\$pr_flags, $pr_flag_pos_mconfig);
347 }
348
349 if ($driver_cnt >= 1) {
350 &set_flag(\$pr_flags, $pr_flag_pos_driver);
351 }
352
353 if ($driver_cnt > 1) {
354 &set_flag(\$pr_flags, $pr_flag_pos_mdriver);
355 }
356
357 # These strings are the same way the linux kernel tests.
358 # The ePapr lists of values is slightly different.
359 if (!(
360 ($node_enabled eq "") ||
361 ($node_enabled eq "ok") ||
362 ($node_enabled eq "okay")
363 )) {
364 &set_flag(\$pr_flags, $pr_flag_pos_node_not_enabled);
365 }
366
367 if ($white_list) {
368 &set_flag(\$pr_flags, $pr_flag_pos_white_list);
369 }
370
371 if (exists($driver_hard_code_list{$compat}) ||
372 (exists($driver_config_hard_code_list{$driver}) &&
373 ($driver ne "no_driver"))) {
374 &set_flag(\$pr_flags, $pr_flag_pos_hard_coded);
375 }
376
377 my @configs = split(' && ', $config);
378 for $configs (@configs) {
379 $not = $configs =~ /^!/;
380 $configs =~ s/^!//;
381
382 if (($configs ne "no_config") && ($configs ne "no_makefile")) {
383 &set_flag(\$pr_flags, $pr_flag_pos_config);
384 }
385
386 if (($config_cnt >= 1) &&
387 ($configs !~ /CONFIG_/) &&
388 (($configs ne "no_config") && ($configs ne "no_makefile"))) {
389 &set_flag(\$pr_flags, $pr_flag_pos_config_hard_coded);
390 }
391
392 my $existing_config = $existing_config{$configs};
393 if ($existing_config eq "m") {
394 &set_flag(\$pr_flags, $pr_flag_pos_config_m);
395 # Possible fail, depends on whether built in or
396 # module is desired.
397 &set_flag(\$pr_flags, $pr_flag_pos_config_test_fail);
398 } elsif ($existing_config eq "y") {
399 &set_flag(\$pr_flags, $pr_flag_pos_config_y);
400 if ($not) {
401 &set_flag(\$pr_flags, $pr_flag_pos_config_test_fail);
402 }
403 } elsif (($config_file) && ($configs =~ /CONFIG_/)) {
404 &set_flag(\$pr_flags, $pr_flag_pos_config_none);
405 if (!$not) {
406 &set_flag(\$pr_flags, $pr_flag_pos_config_test_fail);
407 }
408 }
409 }
410
411 # ----- include / exclude filters
412
413 if ($include_flag_pattern && ($pr_flags !~ m/$include_flag_pattern/)) {
414 return 0;
415 }
416
417 if ($exclude_flag_pattern && ($pr_flags =~ m/$exclude_flag_pattern/)) {
418 return 0;
419 }
420
421 if ($config_format) {
422 print "# ";
423 }
424 print "$pr_flags : ";
425
426 return 1;
427}
428
429
430sub print_node()
431{
432 # return number of lines printed
433
434 # some fields of pn_arg_ref might not be used in this function, but
435 # extract all of them anyway.
436 my $pn_arg_ref = shift;
437
438 my $compat = $pn_arg_ref->{compat};
439 my $compatible_cnt = $pn_arg_ref->{compatible_cnt};
440 my $config = $pn_arg_ref->{config};
441 my $config_cnt = $pn_arg_ref->{config_cnt};
442 my $driver = $pn_arg_ref->{driver};
443 my $driver_cnt = $pn_arg_ref->{driver_cnt};
444 my $full_node = $pn_arg_ref->{full_node};
445 my $node = $pn_arg_ref->{node};
446 my $node_enabled = $pn_arg_ref->{node_enabled};
447 my $white_list = $pn_arg_ref->{white_list};
448
449 my $separator;
450
451 if (! &print_flags($pn_arg_ref)) {
452 return 0;
453 }
454
455
456 if ($short_name) {
457 print "$node";
458 } else {
459 print "$full_node";
460 }
461 print " : $compat : $driver : $config : ";
462
463 my @configs = split(' && ', $config);
464
465 if ($config_file) {
466 for $configs (@configs) {
467 $configs =~ s/^!//;
468 my $existing_config = $existing_config{$configs};
469 if (!$existing_config) {
470 # check for /-m/, /-y/, or /-objs/
471 if ($configs !~ /CONFIG_/) {
472 $existing_config = "x";
473 };
474 };
475 if ($existing_config) {
476 print "$separator", "$existing_config";
477 $separator = ", ";
478 } else {
479 print "$separator", "n";
480 $separator = ", ";
481 }
482 }
483 } else {
484 print "none";
485 }
486
487 print "\n";
488
489 if ($config_format) {
490 for $configs (@configs) {
491 $not = $configs =~ /^!/;
492 $configs =~ s/^!//;
493 my $existing_config = $existing_config{$configs};
494
495 if ($not) {
496 if ($configs !~ /CONFIG_/) {
497 print "# $configs\n";
498 } elsif ($existing_config eq "m") {
499 print "# $configs is m\n";
500 print "# $configs=n\n";
501 } elsif ($existing_config eq "y") {
502 print "# $configs is set\n";
503 print "# $configs=n\n";
504 } else {
505 print "# $configs is not set\n";
506 print "# $configs=n\n";
507 }
508
509 } else {
510 if ($configs !~ /CONFIG_/) {
511 print "# $configs\n";
512 } elsif ($existing_config eq "m") {
513 print "# $configs is m\n";
514 print "# $configs=y\n";
515 } elsif ($existing_config eq "y") {
516 print "# $configs is set\n";
517 print "# $configs=y\n";
518 } else {
519 print "# $configs is not set\n";
520 print "# $configs=y\n";
521 }
522 }
523 }
524 }
525
526 return 1;
527}
528
529
530sub scan_makefile
531{
532 my $pn_arg_ref = shift;
533 my $driver = shift;
534
535 # ----- Find Kconfig symbols that enable driver
536
537 my ($dir, $base) = $driver =~ m{(.*)/(.*).c};
538
539 my $makefile = $dir . "/Makefile";
540 if (! -r $makefile) {
541 $makefile = $dir . "/Kbuild";
542 }
543 if (! -r $makefile) {
544 my $config;
545
546 $config = 'no_makefile';
547 push @{ $driver_config{$driver} }, $config;
548 return;
549 }
550
551 if (!open(MAKEFILE_FILE, "<", "$makefile")) {
552 return;
553 }
554
555 my $line;
556 my @config;
557 my @if_config;
558 my @make_var;
559
560 NEXT_LINE:
561 while ($next_line = <MAKEFILE_FILE>) {
562 my $config;
563 my $if_config;
564 my $ifdef;
565 my $ifeq;
566 my $ifndef;
567 my $ifneq;
568 my $ifdef_config;
569 my $ifeq_config;
570 my $ifndef_config;
571 my $ifneq_config;
572
573 chomp($next_line);
574 $line = $line . $next_line;
575 if ($next_line =~ /\\$/) {
576 $line =~ s/\\$/ /;
577 next NEXT_LINE;
578 }
579 if ($line =~ /^\s*#/) {
580 $line = "";
581 next NEXT_LINE;
582 }
583
584 # ----- condition ... else ... endif
585
586 if ($line =~ /^([ ]\s*|)else\b/) {
587 $if_config = "!" . pop @if_config;
588 $if_config =~ s/^!!//;
589 push @if_config, $if_config;
590 $line =~ s/^([ ]\s*|)else\b//;
591 }
592
593 ($null, $ifeq_config, $ifeq_config_val ) = $line =~ /^([ ]\s*|)ifeq\b.*\b(CONFIG_[A-Za-z0-9_]*)(.*)/;
594 ($null, $ifneq_config, $ifneq_config_val) = $line =~ /^([ ]\s*|)ifneq\b.*\b(CONFIG_[A-Za-z0-9_]*)(.*)/;
595 ($null, $ifdef_config) = $line =~ /^([ ]\s*|)ifdef\b.*\b(CONFIG_[A-Za-z0-9_]*)/;
596 ($null, $ifndef_config) = $line =~ /^([ ]\s*|)ifndef\b.*\b(CONFIG_[A-Za-z0-9_]*)/;
597
598 ($null, $ifeq) = $line =~ /^([ ]\s*|)ifeq\b\s*(.*)/;
599 ($null, $ifneq) = $line =~ /^([ ]\s*|)ifneq\b\s*(.*)/;
600 ($null, $ifdef) = $line =~ /^([ ]\s*|)ifdef\b\s*(.*)/;
601 ($null, $ifndef) = $line =~ /^([ ]\s*|)ifndef\b\s*(.*)/;
602
603 # Order of tests is important. Prefer "CONFIG_*" regex match over
604 # less specific regex match.
605 if ($ifdef_config) {
606 $if_config = $ifdef_config;
607 } elsif ($ifeq_config) {
608 if ($ifeq_config_val =~ /y/) {
609 $if_config = $ifeq_config;
610 } else {
611 $if_config = "!" . $ifeq_config;
612 }
613 } elsif ($ifndef_config) {
614 $if_config = "!" . $ifndef_config;
615 } elsif ($ifneq_config) {
616 if ($ifneq_config_val =~ /y/) {
617 $if_config = "!" . $ifneq_config;
618 } else {
619 $if_config = $ifneq_config;
620 }
621 } elsif ($ifdef) {
622 $if_config = $ifdef;
623 } elsif ($ifeq) {
624 $if_config = $ifeq;
625 } elsif ($ifndef) {
626 $if_config = "!" . $ifndef;
627 } elsif ($ifneq) {
628 $if_config = "!" . $ifneq;
629 } else {
630 $if_config = "";
631 }
632 $if_config =~ s/^!!//;
633
634 if ($if_config) {
635 push @if_config, $if_config;
636 $line = "";
637 next NEXT_LINE;
638 }
639
640 if ($line =~ /^([ ]\s*|)endif\b/) {
641 pop @if_config;
642 $line = "";
643 next NEXT_LINE;
644 }
645
646 # ----- simple CONFIG_* = *.[co] or xxx [+:?]*= *.[co]
647 # Most makefiles select on *.o, but
648 # arch/powerpc/boot/Makefile selects on *.c
649
650 ($config) = $line =~ /(CONFIG_[A-Za-z0-9_]+).*\b$base.[co]\b/;
651
652 # ----- match a make variable instead of *.[co]
653 # Recursively expanded variables are not handled.
654
655 if (!$config) {
656 my $make_var;
657 ($make_var) = $line =~ /\s*(\S+?)\s*[+:\?]*=.*\b$base.[co]\b/;
658 if ($make_var) {
659 if ($make_var =~ /[a-zA-Z0-9]+-[ym]/) {
660 $config = $make_var;
661 } elsif ($make_var =~ /[a-zA-Z0-9]+-objs/) {
662 $config = $make_var;
663 } else {
664 push @make_var, $make_var;
665 }
666 }
667 }
668
669 if (!$config) {
670 for $make_var (@make_var) {
671 ($config) = $line =~ /(CONFIG_[A-Za-z0-9_]+).*\b$make_var\b/;
672 last if ($config);
673 }
674 }
675
676 if (!$config) {
677 for $make_var (@make_var) {
678 ($config) = $line =~ /\s*(\S+?)\s*[+:\?]*=.*\b$make_var\b/;
679 last if ($config);
680 }
681 }
682
683 # ----- next if no config found
684
685 if (!$config) {
686 $line = "";
687 next NEXT_LINE;
688 }
689
690 for $if_config (@if_config) {
691 $config = $if_config . " && " . $config;
692 }
693
694 push @{ $driver_config{$driver} }, $config;
695
696 $line = "";
697 }
698
699 close(MAKEFILE_FILE);
700
701}
702
703
704sub find_kconfig
705{
706 my $pn_arg_ref = shift;
707 my $driver = shift;
708
709 my $lines_printed = 0;
710 my @configs;
711
712 if (!@{ $driver_config{$driver} }) {
713 &scan_makefile($pn_arg_ref, $driver);
714 if (!@{ $driver_config{$driver} }) {
715 push @{ $driver_config{$driver} }, "no_config";
716 }
717 }
718
719 @configs = @{ $driver_config{$driver} };
720
721 $$pn_arg_ref{config_cnt} = $#configs + 1;
722 for my $config (@configs) {
723 $$pn_arg_ref{config} = $config;
724 $lines_printed += &print_node($pn_arg_ref);
725 }
726
727 return $lines_printed;
728}
729
730
731sub handle_compatible()
732{
733 my $full_node = shift;
734 my $node = shift;
735 my $compatible = shift;
736 my $node_enabled = shift;
737
738 my $compat;
739 my $lines_printed = 0;
740 my %pn_arg = ();
741
742 return if (!$node or !$compatible);
743
744 # Do not process compatible property of root node,
745 # it is used to match board, not to bind a driver.
746 return if ($node eq "/");
747
748 $pn_arg{full_node} = $full_node;
749 $pn_arg{node} = $node;
750 $pn_arg{node_enabled} = $node_enabled;
751
752 my @compatibles = split('", "', $compatible);
753
754 $compatibles[0] =~ s/^"//;
755 $compatibles[$#compatibles] =~ s/"$//;
756
757 $pn_arg{compatible_cnt} = $#compatibles + 1;
758
759 COMPAT:
760 for $compat (@compatibles) {
761
762 $pn_arg{compat} = $compat;
763 $pn_arg{driver_cnt} = 0;
764 $pn_arg{white_list} = 0;
765
766 if (exists($compat_white_list{$compat})) {
767 $pn_arg{white_list} = 1;
768 $pn_arg{driver} = "no_driver";
769 $pn_arg{config_cnt} = 1;
770 $pn_arg{config} = "no_config";
771 $lines_printed += &print_node(\%pn_arg);
772 next COMPAT;
773 }
774
775 # ----- if compat previously seen, use cached info
776
777 if (exists($compat_driver{$compat})) {
778 for my $driver (@{ $compat_driver{$compat} }) {
779 $pn_arg{driver} = $driver;
780 $pn_arg{driver_cnt} = $driver_count{$compat};
781 $pn_arg{config_cnt} = $#{ $driver_config{$driver}} + 1;
782
783 for my $config (@{ $driver_config{$driver} }) {
784 $pn_arg{config} = $config;
785 $lines_printed += &print_node(\%pn_arg);
786 }
787
788 if (!@{ $driver_config{$driver} }) {
789 # no config cached yet
790 # $driver in %driver_hard_code_list
791 # but not %driver_config_hard_code_list
792 $lines_printed += &find_kconfig(\%pn_arg, $driver);
793 }
794 }
795 next COMPAT;
796 }
797
798
799 # ----- Find drivers (source files that contain compatible)
800
801 # this will miss arch/sparc/include/asm/parport.h
802 # It is better to move the compatible out of the .h
803 # than to add *.h. to the files list, because *.h generates
804 # a lot of false negatives.
805 my $files = '"*.c"';
806 my $drivers = `git grep -l '"$compat"' -- $files`;
807 chomp($drivers);
808 if ($drivers eq "") {
809 $pn_arg{driver} = "no_driver";
810 $pn_arg{config_cnt} = 1;
811 $pn_arg{config} = "no_config";
812 push @{ $compat_driver{$compat} }, "no_driver";
813 $lines_printed += &print_node(\%pn_arg);
814 next COMPAT;
815 }
816
817 my @drivers = split("\n", $drivers);
818 $driver_count{$compat} = $#drivers + 1;
819 $pn_arg{driver_cnt} = $#drivers + 1;
820
821 DRIVER:
822 for my $driver (@drivers) {
823 push @{ $compat_driver{$compat} }, $driver;
824 $pn_arg{driver} = $driver;
825
826 # ----- if driver previously seen, use cached info
827
828 $pn_arg{config_cnt} = $#{ $driver_config{$driver} } + 1;
829 for my $config (@{ $driver_config{$driver} }) {
830 $pn_arg{config} = $config;
831 $lines_printed += &print_node(\%pn_arg);
832 }
833 if (@{ $driver_config{$driver} }) {
834 next DRIVER;
835 }
836
837 if ($black_list_driver) {
838 for $black (@black_list_driver) {
839 next DRIVER if ($driver =~ /^$black$/);
840 }
841 }
842
843
844 # ----- Find Kconfig symbols that enable driver
845
846 $lines_printed += &find_kconfig(\%pn_arg, $driver);
847
848 }
849 }
850
851 # White space (line) between nodes for readability.
852 # Each node may report several compatibles.
853 # For each compatible, multiple drivers may be reported.
854 # For each driver, multiple CONFIG_ options may be reported.
855 if ($lines_printed) {
856 print "\n";
857 }
858}
859
860sub read_dts()
861{
862 my $file = shift;
863
864 my $compatible = "";
865 my $line;
866 my $node = "";
867 my $node_enabled = "";
868
869 if (! -r $file) {
870 print STDERR "file '$file' is not readable or does not exist\n";
871 exit 3;
872 }
873
874 if (!open(DT_FILE, "-|", "$dtx_diff $file")) {
875 print STDERR "\n";
876 print STDERR "shell command failed:\n";
877 print STDERR " $dtx_diff $file\n";
878 print STDERR "\n";
879 exit 3;
880 }
881
882 FILE:
883 while ($line = <DT_FILE>) {
884 chomp($line);
885
886 if ($line =~ /{/) {
887
888 &handle_compatible($full_node, $node, $compatible,
889 $node_enabled);
890
891 while ($end_node_count-- > 0) {
892 pop @full_node;
893 };
894 $end_node_count = 0;
895 $full_node = @full_node[-1];
896
897 $node = $line;
898 $node =~ s/^\s*(.*)\s+\{.*/$1/;
899 $node =~ s/.*: //;
900 if ($node eq '/' ) {
901 $full_node = '/';
902 } elsif ($full_node ne '/') {
903 $full_node = $full_node . '/' . $node;
904 } else {
905 $full_node = '/' . $node;
906 }
907 push @full_node, $full_node;
908
909 $compatible = "";
910 $node_enabled = "";
911 next FILE;
912 }
913
914 if ($line =~ /}/) {
915 $end_node_count++;
916 }
917
918 if ($line =~ /(\s+|^)status =/) {
919 $node_enabled = $line;
920 $node_enabled =~ s/^\t*//;
921 $node_enabled =~ s/^status = "//;
922 $node_enabled =~ s/";$//;
923 next FILE;
924 }
925
926 if ($line =~ /(\s+|^)compatible =/) {
927 # Extract all compatible entries for this device
928 # White space matching here and in handle_compatible() is
929 # precise, because input format is the output of dtc,
930 # which is invoked by dtx_diff.
931 $compatible = $line;
932 $compatible =~ s/^\t*//;
933 $compatible =~ s/^compatible = //;
934 $compatible =~ s/;$//;
935 }
936 }
937
938 &handle_compatible($full_node, $node, $compatible, $node_enabled);
939
940 close(DT_FILE);
941}
942
943
944sub read_config_file()
945{
946 if (! -r $config_file) {
947 print STDERR "file '$config_file' is not readable or does not exist\n";
948 exit 2;
949 }
950
951 if (!open(CONFIG_FILE, "<", "$config_file")) {
952 print STDERR "open $config_file failed\n";
953 exit 2;
954 }
955
956 my @line;
957
958 LINE:
959 while ($line = <CONFIG_FILE>) {
960 chomp($line);
961 next LINE if ($line =~ /^\s*#/);
962 next LINE if ($line =~ /^\s*$/);
963 @line = split /=/, $line;
964 $existing_config{@line[0]} = @line[1];
965 }
966
967 close(CONFIG_FILE);
968}
969
970
971sub cmd_line_err()
972{
973 my $msg = shift;
974
975 print STDERR "\n";
976 print STDERR " ERROR processing command line options\n";
977 print STDERR " $msg\n" if ($msg ne "");
978 print STDERR "\n";
979 print STDERR " For help, type '$script_name --help'\n";
980 print STDERR "\n";
981}
982
983
984# -----------------------------------------------------------------------------
985# program entry point
986
987Getopt::Long::Configure("no_ignore_case", "bundling");
988
989if (!GetOptions(
990 "c=s" => \$config_file,
991 "config=s" => \$config_file,
992 "config-format" => \$config_format,
993 "exclude-flag=s" => \@exclude_flag,
994 "h" => \$help,
995 "help" => \$help,
996 "black-list-driver" => \$black_list_driver,
997 "white-list-config" => \$white_list_config,
998 "white-list-driver" => \$white_list_driver,
999 "include-flag=s" => \@include_flag,
1000 "include-suspect" => \$include_suspect,
1001 "short-name" => \$short_name,
1002 "show-lists" => \$show_lists,
1003 "version" => \$version,
1004 )) {
1005
1006 &cmd_line_err();
1007
1008 exit 1;
1009}
1010
1011
1012my $exit_after_messages = 0;
1013
1014if ($version) {
1015 print STDERR "\n$script_name $VUFX\n\n";
1016 $exit_after_messages = 1;
1017}
1018
1019
1020if ($help) {
1021 &usage;
1022 $exit_after_messages = 1;
1023}
1024
1025
1026if ($show_lists) {
1027
1028 print "\n";
1029 print "These compatibles are hard coded to have no driver.\n";
1030 print "\n";
1031 for my $compat (sort keys %compat_white_list) {
1032 print " $compat\n";
1033 }
1034
1035
1036 print "\n\n";
1037 print "The driver for these compatibles is hard coded (white list).\n";
1038 print "\n";
1039 my $max_compat_len = 0;
1040 for my $compat (sort keys %driver_hard_code_list) {
1041 if (length $compat > $max_compat_len) {
1042 $max_compat_len = length $compat;
1043 }
1044 }
1045 for my $compat (sort keys %driver_hard_code_list) {
1046 if (($driver ne "hardcoded_no_driver") && ($driver ne "no_driver")) {
1047 my $first = 1;
1048 for my $driver (@{ $driver_hard_code_list{$compat} }) {
1049 if ($first) {
1050 print " $compat";
1051 print " " x ($max_compat_len - length $compat);
1052 $first = 0;
1053 } else {
1054 print " ", " " x $max_compat_len;
1055 }
1056 print " $driver\n";
1057 }
1058 }
1059 }
1060
1061
1062 print "\n\n";
1063 print "The configuration option for these drivers is hard coded (white list).\n";
1064 print "\n";
1065 my $max_driver_len = 0;
1066 for my $driver (sort keys %driver_config_hard_code_list) {
1067 if (length $driver > $max_driver_len) {
1068 $max_driver_len = length $driver;
1069 }
1070 }
1071 for my $driver (sort keys %driver_config_hard_code_list) {
1072 if (($driver ne "hardcoded_no_driver") && ($driver ne "no_driver")) {
1073 my $first = 1;
1074 for my $config (@{ $driver_config_hard_code_list{$driver} }) {
1075 if ($first) {
1076 print " $driver";
1077 print " " x ($max_driver_len - length $driver);
1078 $first = 0;
1079 } else {
1080 print " ", " " x $max_driver_len;
1081 }
1082 print " $config\n";
1083 }
1084 }
1085 }
1086
1087
1088 print "\n\n";
1089 print "These drivers are black listed.\n";
1090 print "\n";
1091 for my $driver (@black_list_driver) {
1092 print " $driver\n";
1093 }
1094
1095 print "\n";
1096
1097 $exit_after_messages = 1;
1098}
1099
1100
1101if ($exit_after_messages) {
1102 exit 0;
1103}
1104
1105
1106$exclude_flag_pattern = "[";
1107for my $exclude_flag (@exclude_flag) {
1108 $exclude_flag_pattern = $exclude_flag_pattern . $exclude_flag;
1109}
1110$exclude_flag_pattern = $exclude_flag_pattern . "]";
1111# clean up if empty
1112$exclude_flag_pattern =~ s/^\[\]$//;
1113
1114
1115$include_flag_pattern = "[";
1116for my $include_flag (@include_flag) {
1117 $include_flag_pattern = $include_flag_pattern . $include_flag;
1118}
1119$include_flag_pattern = $include_flag_pattern . "]";
1120# clean up if empty
1121$include_flag_pattern =~ s/^\[\]$//;
1122
1123
1124if ($exclude_flag_pattern) {
1125 my $found = 0;
1126 for $pr_flag_value (@pr_flag_value) {
1127 if ($exclude_flag_pattern =~ m/$pr_flag_value/) {
1128 $found = 1;
1129 }
1130 }
1131 if (!$found) {
1132 &cmd_line_err("invalid value for FLAG in --exclude-flag\n");
1133 exit 1
1134 }
1135}
1136
1137if ($include_flag_pattern) {
1138 my $found = 0;
1139 for $pr_flag_value (@pr_flag_value) {
1140 if ($include_flag_pattern =~ m/$pr_flag_value/) {
1141 $found = 1;
1142 }
1143 }
1144 if (!$found) {
1145 &cmd_line_err("invalid value for FLAG in --include-flag\n");
1146 exit 1
1147 }
1148}
1149
1150if ($include_suspect) {
1151 $include_flag_pattern =~ s/\[//;
1152 $include_flag_pattern =~ s/\]//;
1153 $include_flag_pattern = "[" . $include_flag_pattern . "A-Z]";
1154}
1155
1156if ($exclude_flag_pattern =~ m/$include_flag_pattern/) {
1157 &cmd_line_err("the same flag appears in both --exclude-flag and --include-flag or --include-suspect\n");
1158 exit 1
1159}
1160
1161
1162# ($#ARGV < 0) is valid for --help, --version
1163if ($#ARGV < 0) {
1164 &cmd_line_err("device-tree... is required");
1165 exit 1
1166}
1167
1168
1169if ($config_file) {
1170 &read_config_file();
1171}
1172
1173
1174# avoid pushing duplicates for this value
1175$driver = "hardcoded_no_driver";
1176for $config ( @{ $driver_config_hard_code_list{$driver} } ) {
1177 push @{ $driver_config{$driver} }, $config;
1178}
1179
1180if ($white_list_driver) {
1181 for my $compat (keys %driver_hard_code_list) {
1182 for my $driver (@{ $driver_hard_code_list{$compat} }) {
1183 push @{ $compat_driver{$compat} }, $driver;
1184 if ($driver ne "hardcoded_no_driver") {
1185 $driver_count{$compat} = scalar @{ $compat_driver{$compat} };
1186 }
1187 }
1188 }
1189}
1190
1191if ($white_list_config) {
1192 for my $driver (keys %driver_config_hard_code_list) {
1193 if ($driver ne "hardcoded_no_driver") {
1194 for $config ( @{ $driver_config_hard_code_list{$driver} } ) {
1195 push @{ $driver_config{$driver} }, $config;
1196 }
1197 }
1198 }
1199}
1200
1201if (-x "scripts/dtc/dtx_diff") {
1202 $dtx_diff = "scripts/dtc/dtx_diff";
1203} else {
1204
1205 print STDERR "\n";
1206 print STDERR "$script_name must be run from the root directory of a Linux kernel tree\n";
1207 print STDERR "\n";
1208 exit 3;
1209}
1210
1211for $file (@ARGV) {
1212 &read_dts($file);
1213}
diff --git a/scripts/dtc/dtx_diff b/scripts/dtc/dtx_diff
index 959ab2646d38..ec47f95991a3 100755
--- a/scripts/dtc/dtx_diff
+++ b/scripts/dtc/dtx_diff
@@ -266,7 +266,7 @@ DTC="${__KBUILD_OUTPUT}/scripts/dtc/dtc"
266 266
267if [ ! -x ${DTC} ] ; then 267if [ ! -x ${DTC} ] ; then
268 __DTC="dtc" 268 __DTC="dtc"
269 if grep -q "^CONFIG_DTC=y" ${__KBUILD_OUTPUT}/.config ; then 269 if grep -q "^CONFIG_DTC=y" ${__KBUILD_OUTPUT}/.config 2>/dev/null; then
270 make_command=' 270 make_command='
271 make scripts' 271 make scripts'
272 else 272 else