Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'devicetree-for-4.7' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux

Pull devicetree updates from Rob Herring:

- Rewrite of the unflattening code to avoid recursion and lessen the
stack usage.

- Rewrite of the phandle args parsing code to get rid of the fixed args
size. This is needed for IOMMU code.

- Sync to latest dtc which adds more dts style checking. These
warnings are enabled with "W=1" compiles.

- Tegra documentation updates related to the above warnings.

- A bunch of spelling and other doc fixes.

- Various vendor prefix additions.

* tag 'devicetree-for-4.7' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux: (52 commits)
devicetree: Add Creative Technology vendor id
gpio: dt-bindings: add ibm,ppc4xx-gpio binding
of/unittest: Remove unnecessary module.h header inclusion
drivers/of: Fix build warning in populate_node()
drivers/of: Fix depth when unflattening devicetree
of: dynamic: changeset prop-update revert fix
drivers/of: Export of_detach_node()
drivers/of: Return allocated memory from of_fdt_unflatten_tree()
drivers/of: Specify parent node in of_fdt_unflatten_tree()
drivers/of: Rename unflatten_dt_node()
drivers/of: Avoid recursively calling unflatten_dt_node()
drivers/of: Split unflatten_dt_node()
of: include errno.h in of_graph.h
of: document refcount incrementation of of_get_cpu_node()
Documentation: dt: soc: fix spelling mistakes
Documentation: dt: power: fix spelling mistake
Documentation: dt: pinctrl: fix spelling mistake
Documentation: dt: opp: fix spelling mistake
Documentation: dt: net: fix spelling mistakes
Documentation: dt: mtd: fix spelling mistake
...

+603 -298
+1 -1
Documentation/devicetree/bindings/arm/cci.txt
··· 100 100 "arm,cci-400-pmu,r0" 101 101 "arm,cci-400-pmu,r1" 102 102 "arm,cci-400-pmu" - DEPRECATED, permitted only where OS has 103 - secure acces to CCI registers 103 + secure access to CCI registers 104 104 "arm,cci-500-pmu,r0" 105 105 "arm,cci-550-pmu,r0" 106 106 - reg:
+2 -1
Documentation/devicetree/bindings/arm/omap/crossbar.txt
··· 42 42 Consumer: 43 43 ======== 44 44 See Documentation/devicetree/bindings/interrupt-controller/interrupts.txt and 45 - Documentation/devicetree/bindings/arm/gic.txt for further details. 45 + Documentation/devicetree/bindings/interrupt-controller/arm,gic.txt for 46 + further details. 46 47 47 48 An interrupt consumer on an SoC using crossbar will use: 48 49 interrupts = <GIC_SPI request_number interrupt_level>
+1 -1
Documentation/devicetree/bindings/arm/spear-misc.txt
··· 6 6 misc node required properties: 7 7 8 8 - compatible Should be "st,spear1340-misc", "syscon". 9 - - reg: Address range of misc space upto 8K 9 + - reg: Address range of misc space up to 8K
+1 -1
Documentation/devicetree/bindings/arm/ux500/boards.txt
··· 23 23 see binding for arm/scu.txt 24 24 25 25 interrupt-controller: 26 - see binding for arm/gic.txt 26 + see binding for interrupt-controller/arm,gic.txt 27 27 28 28 timer: 29 29 see binding for arm/twd.txt
Documentation/devicetree/bindings/ata/tegra-sata.txt Documentation/devicetree/bindings/ata/nvidia,tegra124-ahci.txt
+1 -1
Documentation/devicetree/bindings/clock/nvidia,tegra124-dfll.txt
··· 50 50 51 51 Example: 52 52 53 - clock@0,70110000 { 53 + clock@70110000 { 54 54 compatible = "nvidia,tegra124-dfll"; 55 55 reg = <0 0x70110000 0 0x100>, /* DFLL control */ 56 56 <0 0x70110000 0 0x100>, /* I2C output control */
+1 -1
Documentation/devicetree/bindings/clock/rockchip,rk3188-cru.txt
··· 16 16 Optional Properties: 17 17 18 18 - rockchip,grf: phandle to the syscon managing the "general register files" 19 - If missing pll rates are not changable, due to the missing pll lock status. 19 + If missing pll rates are not changeable, due to the missing pll lock status. 20 20 21 21 Each clock is assigned an identifier and client nodes can use this identifier 22 22 to specify the clock which they consume. All available clocks are defined as
+1 -1
Documentation/devicetree/bindings/clock/rockchip,rk3288-cru.txt
··· 15 15 Optional Properties: 16 16 17 17 - rockchip,grf: phandle to the syscon managing the "general register files" 18 - If missing pll rates are not changable, due to the missing pll lock status. 18 + If missing pll rates are not changeable, due to the missing pll lock status. 19 19 20 20 Each clock is assigned an identifier and client nodes can use this identifier 21 21 to specify the clock which they consume. All available clocks are defined as
+1 -1
Documentation/devicetree/bindings/clock/st/st,clkgen.txt
··· 40 40 }; 41 41 42 42 This binding uses the common clock binding[1]. 43 - Each subnode should use the binding discribe in [2]..[7] 43 + Each subnode should use the binding described in [2]..[7] 44 44 45 45 [1] Documentation/devicetree/bindings/clock/clock-bindings.txt 46 46 [2] Documentation/devicetree/bindings/clock/st,clkgen-divmux.txt
Documentation/devicetree/bindings/cpufreq/tegra124-cpufreq.txt Documentation/devicetree/bindings/cpufreq/nvidia,tegra124-cpufreq.txt
+1 -1
Documentation/devicetree/bindings/display/exynos/exynos_dsim.txt
··· 41 41 endpoint node connected from mic node (reg = 0): 42 42 - remote-endpoint: specifies the endpoint in mic node. This node is required 43 43 for Exynos5433 mipi dsi. So mic can access to panel node 44 - thoughout this dsi node. 44 + throughout this dsi node. 45 45 endpoint node connected to panel node (reg = 1): 46 46 - remote-endpoint: specifies the endpoint in panel node. This node is 47 47 required in all kinds of exynos mipi dsi to represent
Documentation/devicetree/bindings/dma/tegra20-apbdma.txt Documentation/devicetree/bindings/dma/nvidia,tegra20-apbdma.txt
+1 -1
Documentation/devicetree/bindings/dma/xilinx/xilinx_dma.txt
··· 7 7 - compatible: Should be "xlnx,axi-dma-1.00.a" 8 8 - #dma-cells: Should be <1>, see "dmas" property below 9 9 - reg: Should contain DMA registers location and length. 10 - - dma-channel child node: Should have atleast one channel and can have upto 10 + - dma-channel child node: Should have at least one channel and can have up to 11 11 two channels per device. This node specifies the properties of each 12 12 DMA channel (see child node properties below). 13 13
+24
Documentation/devicetree/bindings/gpio/ibm,ppc4xx-gpio.txt
··· 1 + * IBM/AMCC/APM GPIO Controller for PowerPC 4XX series and compatible SoCs 2 + 3 + All GPIOs are pin-shared with other functions. DCRs control whether a 4 + particular pin that has GPIO capabilities acts as a GPIO or is used for 5 + another purpose. GPIO outputs are separately programmable to emulate 6 + an open-drain driver. 7 + 8 + Required properties: 9 + - compatible: must be "ibm,ppc4xx-gpio" 10 + - reg: address and length of the register set for the device 11 + - #gpio-cells: must be set to 2. The first cell is the pin number 12 + and the second cell is used to specify the gpio polarity: 13 + 0 = active high 14 + 1 = active low 15 + - gpio-controller: marks the device node as a gpio controller. 16 + 17 + Example: 18 + 19 + GPIO0: gpio@ef600b00 { 20 + compatible = "ibm,ppc4xx-gpio"; 21 + reg = <0xef600b00 0x00000048>; 22 + #gpio-cells = <2>; 23 + gpio-controller; 24 + };
+1 -1
Documentation/devicetree/bindings/input/ads7846.txt
··· 29 29 ti,vref-delay-usecs vref supply delay in usecs, 0 for 30 30 external vref (u16). 31 31 ti,vref-mv The VREF voltage, in millivolts (u16). 32 - Set to 0 to use internal refernce 32 + Set to 0 to use internal references 33 33 (ADS7846). 34 34 ti,keep-vref-on set to keep vref on for differential 35 35 measurements as well
+1 -1
Documentation/devicetree/bindings/input/touchscreen/fsl-mx25-tcq.txt
··· 15 15 - fsl,pen-debounce-ns: Pen debounce time in nanoseconds. 16 16 - fsl,pen-threshold: Pen-down threshold for the touchscreen. This is a value 17 17 between 1 and 4096. It is the ratio between the internal reference voltage 18 - and the measured voltage after the plate was precharged. Resistence between 18 + and the measured voltage after the plate was precharged. Resistance between 19 19 plates and therefore the voltage decreases with pressure so that a smaller 20 20 value is equivalent to a higher pressure. 21 21 - fsl,settling-time-ns: Settling time in nanoseconds. The settling time is before
+1 -2
Documentation/devicetree/bindings/interrupt-controller/mediatek,sysirq.txt
··· 16 16 "mediatek,mt6577-sysirq" 17 17 "mediatek,mt2701-sysirq" 18 18 - interrupt-controller : Identifies the node as an interrupt controller 19 - - #interrupt-cells : Use the same format as specified by GIC in 20 - Documentation/devicetree/bindings/arm/gic.txt 19 + - #interrupt-cells : Use the same format as specified by GIC in arm,gic.txt. 21 20 - interrupt-parent: phandle of irq parent for sysirq. The parent must 22 21 use the same interrupt-cells format as GIC. 23 22 - reg: Physical base address of the intpol registers and length of memory
Documentation/devicetree/bindings/interrupt-controller/nvidia,tegra-ictlr.txt Documentation/devicetree/bindings/interrupt-controller/nvidia,tegra20-ictlr.txt
+2 -2
Documentation/devicetree/bindings/interrupt-controller/ti,omap4-wugen-mpu
··· 4 4 routes interrupts to the GIC, and also serves as a wakeup source. It 5 5 is also referred to as "WUGEN-MPU", hence the name of the binding. 6 6 7 - Reguired properties: 7 + Required properties: 8 8 9 9 - compatible : should contain at least "ti,omap4-wugen-mpu" or 10 10 "ti,omap5-wugen-mpu" ··· 20 20 - Because this HW ultimately routes interrupts to the GIC, the 21 21 interrupt specifier must be that of the GIC. 22 22 - Only SPIs can use the WUGEN as an interrupt parent. SGIs and PPIs 23 - are explicitly forbiden. 23 + are explicitly forbidden. 24 24 25 25 Example: 26 26
+3 -3
Documentation/devicetree/bindings/memory-controllers/nvidia,tegra-mc.txt Documentation/devicetree/bindings/memory-controllers/nvidia,tegra30-mc.txt
··· 61 61 Example SoC include file: 62 62 63 63 / { 64 - mc: memory-controller@0,70019000 { 64 + mc: memory-controller@70019000 { 65 65 compatible = "nvidia,tegra124-mc"; 66 66 reg = <0x0 0x70019000 0x0 0x1000>; 67 67 clocks = <&tegra_car TEGRA124_CLK_MC>; ··· 72 72 #iommu-cells = <1>; 73 73 }; 74 74 75 - sdhci@0,700b0000 { 75 + sdhci@700b0000 { 76 76 compatible = "nvidia,tegra124-sdhci"; 77 77 ... 78 78 iommus = <&mc TEGRA_SWGROUP_SDMMC1A>; ··· 82 82 Example board file: 83 83 84 84 / { 85 - memory-controller@0,70019000 { 85 + memory-controller@70019000 { 86 86 emc-timings-3 { 87 87 nvidia,ram-code = <3>; 88 88
+2 -2
Documentation/devicetree/bindings/memory-controllers/tegra-emc.txt Documentation/devicetree/bindings/memory-controllers/nvidia,tegra124-emc.txt
··· 190 190 Example SoC include file: 191 191 192 192 / { 193 - emc@0,7001b000 { 193 + emc@7001b000 { 194 194 compatible = "nvidia,tegra124-emc"; 195 195 reg = <0x0 0x7001b000 0x0 0x1000>; 196 196 ··· 201 201 Example board file: 202 202 203 203 / { 204 - emc@0,7001b000 { 204 + emc@7001b000 { 205 205 emc-timings-3 { 206 206 nvidia,ram-code = <3>; 207 207
+2 -2
Documentation/devicetree/bindings/mfd/qcom-rpm.txt
··· 178 178 - qcom,force-mode: 179 179 Usage: optional (default if no other qcom,force-mode is specified) 180 180 Value type: <u32> 181 - Defintion: indicates that the regulator should be forced to a 181 + Definition: indicates that the regulator should be forced to a 182 182 particular mode, valid values are: 183 183 QCOM_RPM_FORCE_MODE_NONE - do not force any mode 184 184 QCOM_RPM_FORCE_MODE_LPM - force into low power mode ··· 204 204 - qcom,force-mode: 205 205 Usage: optional 206 206 Value type: <u32> 207 - Defintion: indicates that the regulator should not be forced to any 207 + Definition: indicates that the regulator should not be forced to any 208 208 particular mode, valid values are: 209 209 QCOM_RPM_FORCE_MODE_NONE - do not force any mode 210 210 QCOM_RPM_FORCE_MODE_LPM - force into low power mode
+1 -1
Documentation/devicetree/bindings/mmc/mmc-pwrseq-emmc.txt
··· 1 1 * The simple eMMC hardware reset provider 2 2 3 3 The purpose of this driver is to perform standard eMMC hw reset 4 - procedure, as descibed by Jedec 4.4 specification. This procedure is 4 + procedure, as described by Jedec 4.4 specification. This procedure is 5 5 performed just after MMC core enabled power to the given mmc host (to 6 6 fix possible issues if bootloader has left eMMC card in initialized or 7 7 unknown state), and before performing complete system reboot (also in
+1 -1
Documentation/devicetree/bindings/mtd/brcm,brcmnand.txt
··· 52 52 v7.0. Use this property to describe the rare 53 53 earlier versions of this core that include WP 54 54 55 - -- Additonal SoC-specific NAND controller properties -- 55 + -- Additional SoC-specific NAND controller properties -- 56 56 57 57 The NAND controller is integrated differently on the variety of SoCs on which it 58 58 is found. Part of this integration involves providing status and enable bits
+1 -1
Documentation/devicetree/bindings/net/hisilicon-hns-nic.txt
··· 8 8 specifies a reference to the associating hardware driver node. 9 9 see Documentation/devicetree/bindings/net/hisilicon-hns-dsaf.txt 10 10 - port-id: is the index of port provided by DSAF (the accelerator). DSAF can 11 - connect to 8 PHYs. Port 0 to 1 are both used for adminstration purpose. They 11 + connect to 8 PHYs. Port 0 to 1 are both used for administration purpose. They 12 12 are called debug ports. 13 13 14 14 The remaining 6 PHYs are taken according to the mode of DSAF.
+2 -2
Documentation/devicetree/bindings/net/stmmac.txt
··· 51 51 AXI register inside the DMA module: 52 52 - snps,lpi_en: enable Low Power Interface 53 53 - snps,xit_frm: unlock on WoL 54 - - snps,wr_osr_lmt: max write oustanding req. limit 55 - - snps,rd_osr_lmt: max read oustanding req. limit 54 + - snps,wr_osr_lmt: max write outstanding req. limit 55 + - snps,rd_osr_lmt: max read outstanding req. limit 56 56 - snps,kbbe: do not cross 1KiB boundary. 57 57 - snps,axi_all: align address 58 58 - snps,blen: this is a vector of supported burst length.
+1 -1
Documentation/devicetree/bindings/net/ti,dp83867.txt
··· 2 2 3 3 Required properties: 4 4 - reg - The ID number for the phy, usually a small integer 5 - - ti,rx-internal-delay - RGMII Recieve Clock Delay - see dt-bindings/net/ti-dp83867.h 5 + - ti,rx-internal-delay - RGMII Receive Clock Delay - see dt-bindings/net/ti-dp83867.h 6 6 for applicable values 7 7 - ti,tx-internal-delay - RGMII Transmit Clock Delay - see dt-bindings/net/ti-dp83867.h 8 8 for applicable values
+1 -1
Documentation/devicetree/bindings/opp/opp.txt
··· 45 45 phandle to a OPP table in their DT node. The OPP core will use this phandle to 46 46 find the operating points for the device. 47 47 48 - If required, this can be extended for SoC vendor specfic bindings. Such bindings 48 + If required, this can be extended for SoC vendor specific bindings. Such bindings 49 49 should be documented as Documentation/devicetree/bindings/power/<vendor>-opp.txt 50 50 and should have a compatible description like: "operating-points-v2-<vendor>". 51 51
+1 -1
Documentation/devicetree/bindings/pci/designware-pcie.txt
··· 31 31 32 32 Example configuration: 33 33 34 - pcie: pcie@0xdffff000 { 34 + pcie: pcie@dffff000 { 35 35 compatible = "snps,dw-pcie"; 36 36 reg = <0xdffff000 0x1000>, /* Controller registers */ 37 37 <0xd0000000 0x2000>; /* PCI config space */
+6 -6
Documentation/devicetree/bindings/pci/hisilicon-pcie.txt
··· 34 34 ranges = <0x82000000 0 0x00000000 0x220 0x00000000 0 0x10000000>; 35 35 num-lanes = <8>; 36 36 port-id = <1>; 37 - #interrupts-cells = <1>; 38 - interrupts-map-mask = <0xf800 0 0 7>; 39 - interrupts-map = <0x0 0 0 1 &mbigen_pcie 1 10 40 - 0x0 0 0 2 &mbigen_pcie 2 11 41 - 0x0 0 0 3 &mbigen_pcie 3 12 42 - 0x0 0 0 4 &mbigen_pcie 4 13>; 37 + #interrupt-cells = <1>; 38 + interrupt-map-mask = <0xf800 0 0 7>; 39 + interrupt-map = <0x0 0 0 1 &mbigen_pcie 1 10 40 + 0x0 0 0 2 &mbigen_pcie 2 11 41 + 0x0 0 0 3 &mbigen_pcie 3 12 42 + 0x0 0 0 4 &mbigen_pcie 4 13>; 43 43 status = "ok"; 44 44 };
+1 -1
Documentation/devicetree/bindings/phy/phy-stih41x-usb.txt
··· 17 17 18 18 usb2_phy: usb2phy@0 { 19 19 compatible = "st,stih416-usb-phy"; 20 - #phy-cell = <0>; 20 + #phy-cells = <0>; 21 21 st,syscfg = <&syscfg_rear>; 22 22 clocks = <&clk_sysin>; 23 23 clock-names = "osc_phy";
+3 -3
Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-xusb-padctl.txt
··· 85 85 SoC file extract: 86 86 ----------------- 87 87 88 - padctl@0,7009f000 { 88 + padctl@7009f000 { 89 89 compatible = "nvidia,tegra124-xusb-padctl"; 90 90 reg = <0x0 0x7009f000 0x0 0x1000>; 91 91 resets = <&tegra_car 142>; ··· 97 97 Board file extract: 98 98 ------------------- 99 99 100 - pcie-controller@0,01003000 { 100 + pcie-controller@01003000 { 101 101 ... 102 102 103 103 phys = <&padctl 0>; ··· 108 108 109 109 ... 110 110 111 - padctl: padctl@0,7009f000 { 111 + padctl: padctl@7009f000 { 112 112 pinctrl-0 = <&padctl_default>; 113 113 pinctrl-names = "default"; 114 114
+1 -1
Documentation/devicetree/bindings/pinctrl/qcom,pmic-gpio.txt
··· 122 122 2: 1.5uA (PMIC_GPIO_PULL_UP_1P5) 123 123 3: 31.5uA (PMIC_GPIO_PULL_UP_31P5) 124 124 4: 1.5uA + 30uA boost (PMIC_GPIO_PULL_UP_1P5_30) 125 - If this property is ommited 30uA strength will be used if 125 + If this property is omitted 30uA strength will be used if 126 126 pull up is selected 127 127 128 128 - bias-high-impedance:
+1 -1
Documentation/devicetree/bindings/power/qcom,coincell-charger.txt
··· 29 29 - qcom,charger-disable: 30 30 Usage: optional 31 31 Value type: <boolean> 32 - Definition: definining this property disables charging 32 + Definition: defining this property disables charging 33 33 34 34 This charger is a sub-node of one of the 8941 PMIC blocks, and is specified 35 35 as a child node in DTS of that node. See ../mfd/qcom,spmi-pmic.txt and
+8
Documentation/devicetree/bindings/regulator/palmas-pmic.txt
··· 1 1 * palmas regulator IP block devicetree bindings 2 2 3 + The tps659038 for the AM57x class have OTP spins that 4 + have different part numbers but the same functionality. There 5 + is not a need to add the OTP spins to the palmas driver. The 6 + spin devices should use the tps659038 as it's compatible value. 7 + This is the list of those devices: 8 + tps659037 9 + 3 10 Required properties: 4 11 - compatible : Should be from the list 5 12 ti,twl6035-pmic ··· 15 8 ti,tps65913-pmic 16 9 ti,tps65914-pmic 17 10 ti,tps65917-pmic 11 + ti,tps659038-pmic 18 12 and also the generic series names 19 13 ti,palmas-pmic 20 14 - interrupt-parent : The parent interrupt controller which is palmas.
+3 -3
Documentation/devicetree/bindings/rtc/rtc-palmas.txt
··· 15 15 battery is chargeable or not. If charging battery then driver can 16 16 enable the charging. 17 17 - ti,backup-battery-charge-high-current: Enable high current charging in 18 - backup battery. Device supports the < 100mA and > 100mA charging. 19 - The high current will be > 100mA. Absence of this property will 20 - charge battery to lower current i.e. < 100mA. 18 + backup battery. Device supports the < 100uA and > 100uA charging. 19 + The high current will be > 100uA. Absence of this property will 20 + charge battery to lower current i.e. < 100uA. 21 21 22 22 Example: 23 23 palmas: tps65913@58 {
+3 -3
Documentation/devicetree/bindings/soc/ti/keystone-navigator-qmss.txt
··· 42 42 - queue-pools : child node classifying the queue ranges into pools. 43 43 Queue ranges are grouped into 3 type of pools: 44 44 - qpend : pool of qpend(interruptible) queues 45 - - general-purpose : pool of general queues, primarly used 45 + - general-purpose : pool of general queues, primarily used 46 46 as free descriptor queues or the 47 47 transmit DMA queues. 48 48 - accumulator : pool of queues on PDSP accumulator channel ··· 50 50 -- qrange : number of queues to use per queue range, specified as 51 51 <"base queue #" "# of queues">. 52 52 -- interrupts : Optional property to specify the interrupt mapping 53 - for interruptible queues. The driver additionaly sets 53 + for interruptible queues. The driver additionally sets 54 54 the interrupt affinity hint based on the cpu mask. 55 55 -- qalloc-by-id : Optional property to specify that the queues in this 56 56 range can only be allocated by queue id. ··· 80 80 latency : time to delay the interrupt, specified 81 81 in microseconds. 82 82 -- multi-queue : Optional property to specify that the channel has to 83 - monitor upto 32 queues starting at the base queue #. 83 + monitor up to 32 queues starting at the base queue #. 84 84 - descriptor-regions : child node describing the memory regions for keystone 85 85 navigator packet DMA descriptors. The memory for 86 86 descriptors will be allocated by the driver.
+1 -1
Documentation/devicetree/bindings/sound/nvidia,tegra30-hda.txt
··· 15 15 16 16 Example: 17 17 18 - hda@0,70030000 { 18 + hda@70030000 { 19 19 compatible = "nvidia,tegra124-hda", "nvidia,tegra30-hda"; 20 20 reg = <0x0 0x70030000 0x0 0x10000>; 21 21 interrupts = <GIC_SPI 81 IRQ_TYPE_LEVEL_HIGH>;
+1 -1
Documentation/devicetree/bindings/sram/sram.txt
··· 51 51 compatible = "mmio-sram"; 52 52 reg = <0x5c000000 0x40000>; /* 256 KiB SRAM at address 0x5c000000 */ 53 53 54 - #adress-cells = <1>; 54 + #address-cells = <1>; 55 55 #size-cells = <1>; 56 56 ranges = <0 0x5c000000 0x40000>; 57 57
+1 -1
Documentation/devicetree/bindings/thermal/tegra-soctherm.txt Documentation/devicetree/bindings/thermal/nvidia,tegra124-soctherm.txt
··· 29 29 30 30 Example : 31 31 32 - soctherm@0,700e2000 { 32 + soctherm@700e2000 { 33 33 compatible = "nvidia,tegra124-soctherm"; 34 34 reg = <0x0 0x700e2000 0x0 0x1000>; 35 35 interrupts = <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>;
Documentation/devicetree/bindings/tty/serial/mvebu-uart.txt Documentation/devicetree/bindings/serial/mvebu-uart.txt
+4
Documentation/devicetree/bindings/vendor-prefixes.txt
··· 28 28 arasan Arasan Chip Systems 29 29 arm ARM Ltd. 30 30 armadeus ARMadeus Systems SARL 31 + arrow Arrow Electronics 31 32 artesyn Artesyn Embedded Technologies Inc. 32 33 asahi-kasei Asahi Kasei Corp. 33 34 aspeed ASPEED Technology Inc. ··· 61 60 compulab CompuLab Ltd. 62 61 cortina Cortina Systems, Inc. 63 62 cosmic Cosmic Circuits 63 + creative Creative Technology Ltd 64 64 crystalfontz Crystalfontz America, Inc. 65 65 cubietech Cubietech, Ltd. 66 66 cypress Cypress Semiconductor Corporation ··· 81 79 edt Emerging Display Technologies 82 80 eeti eGalax_eMPIA Technology Inc 83 81 elan Elan Microelectronic Corp. 82 + embest Shenzhen Embest Technology Co., Ltd. 84 83 emmicro EM Microelectronic 85 84 energymicro Silicon Laboratories (formerly Energy Micro AS) 86 85 epcos EPCOS AG ··· 127 124 ifi Ingenieurburo Fur Ic-Technologie (I/F/I) 128 125 iom Iomega Corporation 129 126 img Imagination Technologies Ltd. 127 + inforce Inforce Computing 130 128 ingenic Ingenic Semiconductor 131 129 innolux Innolux Corporation 132 130 intel Intel Corporation
+1 -1
drivers/gpu/drm/tilcdc/tilcdc_slave_compat.c
··· 157 157 if (!overlay_data || kfree_table_add(kft, overlay_data)) 158 158 return NULL; 159 159 160 - of_fdt_unflatten_tree(overlay_data, &overlay); 160 + of_fdt_unflatten_tree(overlay_data, NULL, &overlay); 161 161 if (!overlay) { 162 162 pr_warn("%s: Unfattening overlay tree failed\n", __func__); 163 163 return NULL;
+30 -8
drivers/iommu/arm-smmu.c
··· 50 50 #include "io-pgtable.h" 51 51 52 52 /* Maximum number of stream IDs assigned to a single device */ 53 - #define MAX_MASTER_STREAMIDS MAX_PHANDLE_ARGS 53 + #define MAX_MASTER_STREAMIDS 128 54 54 55 55 /* Maximum number of context banks per SMMU */ 56 56 #define ARM_SMMU_MAX_CBS 128 ··· 397 397 struct iommu_domain domain; 398 398 }; 399 399 400 + struct arm_smmu_phandle_args { 401 + struct device_node *np; 402 + int args_count; 403 + uint32_t args[MAX_MASTER_STREAMIDS]; 404 + }; 405 + 400 406 static DEFINE_SPINLOCK(arm_smmu_devices_lock); 401 407 static LIST_HEAD(arm_smmu_devices); 402 408 ··· 512 506 513 507 static int register_smmu_master(struct arm_smmu_device *smmu, 514 508 struct device *dev, 515 - struct of_phandle_args *masterspec) 509 + struct arm_smmu_phandle_args *masterspec) 516 510 { 517 511 int i; 518 512 struct arm_smmu_master *master; ··· 1881 1875 struct arm_smmu_device *smmu; 1882 1876 struct device *dev = &pdev->dev; 1883 1877 struct rb_node *node; 1884 - struct of_phandle_args masterspec; 1878 + struct of_phandle_iterator it; 1879 + struct arm_smmu_phandle_args *masterspec; 1885 1880 int num_irqs, i, err; 1886 1881 1887 1882 smmu = devm_kzalloc(dev, sizeof(*smmu), GFP_KERNEL); ··· 1945 1938 1946 1939 i = 0; 1947 1940 smmu->masters = RB_ROOT; 1948 - while (!of_parse_phandle_with_args(dev->of_node, "mmu-masters", 1949 - "#stream-id-cells", i, 1950 - &masterspec)) { 1951 - err = register_smmu_master(smmu, dev, &masterspec); 1941 + 1942 + err = -ENOMEM; 1943 + /* No need to zero the memory for masterspec */ 1944 + masterspec = kmalloc(sizeof(*masterspec), GFP_KERNEL); 1945 + if (!masterspec) 1946 + goto out_put_masters; 1947 + 1948 + of_for_each_phandle(&it, err, dev->of_node, 1949 + "mmu-masters", "#stream-id-cells", 0) { 1950 + int count = of_phandle_iterator_args(&it, masterspec->args, 1951 + MAX_MASTER_STREAMIDS); 1952 + masterspec->np = of_node_get(it.node); 1953 + masterspec->args_count = count; 1954 + 1955 + err = register_smmu_master(smmu, dev, masterspec); 1952 1956 if (err) { 1953 1957 dev_err(dev, "failed to add master %s\n", 1954 - masterspec.np->name); 1958 + masterspec->np->name); 1959 + kfree(masterspec); 1955 1960 goto out_put_masters; 1956 1961 } 1957 1962 1958 1963 i++; 1959 1964 } 1965 + 1960 1966 dev_notice(dev, "registered %d master devices\n", i); 1967 + 1968 + kfree(masterspec); 1961 1969 1962 1970 parse_driver_options(smmu); 1963 1971
+143 -82
drivers/of/base.c
··· 394 394 * before booting secondary cores. This function uses arch_match_cpu_phys_id 395 395 * which can be overridden by architecture specific implementation. 396 396 * 397 - * Returns a node pointer for the logical cpu if found, else NULL. 397 + * Returns a node pointer for the logical cpu with refcount incremented, use 398 + * of_node_put() on it when done. Returns NULL if not found. 398 399 */ 399 400 struct device_node *of_get_cpu_node(int cpu, unsigned int *thread) 400 401 { ··· 1441 1440 printk("\n"); 1442 1441 } 1443 1442 1443 + int of_phandle_iterator_init(struct of_phandle_iterator *it, 1444 + const struct device_node *np, 1445 + const char *list_name, 1446 + const char *cells_name, 1447 + int cell_count) 1448 + { 1449 + const __be32 *list; 1450 + int size; 1451 + 1452 + memset(it, 0, sizeof(*it)); 1453 + 1454 + list = of_get_property(np, list_name, &size); 1455 + if (!list) 1456 + return -ENOENT; 1457 + 1458 + it->cells_name = cells_name; 1459 + it->cell_count = cell_count; 1460 + it->parent = np; 1461 + it->list_end = list + size / sizeof(*list); 1462 + it->phandle_end = list; 1463 + it->cur = list; 1464 + 1465 + return 0; 1466 + } 1467 + 1468 + int of_phandle_iterator_next(struct of_phandle_iterator *it) 1469 + { 1470 + uint32_t count = 0; 1471 + 1472 + if (it->node) { 1473 + of_node_put(it->node); 1474 + it->node = NULL; 1475 + } 1476 + 1477 + if (!it->cur || it->phandle_end >= it->list_end) 1478 + return -ENOENT; 1479 + 1480 + it->cur = it->phandle_end; 1481 + 1482 + /* If phandle is 0, then it is an empty entry with no arguments. */ 1483 + it->phandle = be32_to_cpup(it->cur++); 1484 + 1485 + if (it->phandle) { 1486 + 1487 + /* 1488 + * Find the provider node and parse the #*-cells property to 1489 + * determine the argument length. 1490 + */ 1491 + it->node = of_find_node_by_phandle(it->phandle); 1492 + 1493 + if (it->cells_name) { 1494 + if (!it->node) { 1495 + pr_err("%s: could not find phandle\n", 1496 + it->parent->full_name); 1497 + goto err; 1498 + } 1499 + 1500 + if (of_property_read_u32(it->node, it->cells_name, 1501 + &count)) { 1502 + pr_err("%s: could not get %s for %s\n", 1503 + it->parent->full_name, 1504 + it->cells_name, 1505 + it->node->full_name); 1506 + goto err; 1507 + } 1508 + } else { 1509 + count = it->cell_count; 1510 + } 1511 + 1512 + /* 1513 + * Make sure that the arguments actually fit in the remaining 1514 + * property data length 1515 + */ 1516 + if (it->cur + count > it->list_end) { 1517 + pr_err("%s: arguments longer than property\n", 1518 + it->parent->full_name); 1519 + goto err; 1520 + } 1521 + } 1522 + 1523 + it->phandle_end = it->cur + count; 1524 + it->cur_count = count; 1525 + 1526 + return 0; 1527 + 1528 + err: 1529 + if (it->node) { 1530 + of_node_put(it->node); 1531 + it->node = NULL; 1532 + } 1533 + 1534 + return -EINVAL; 1535 + } 1536 + 1537 + int of_phandle_iterator_args(struct of_phandle_iterator *it, 1538 + uint32_t *args, 1539 + int size) 1540 + { 1541 + int i, count; 1542 + 1543 + count = it->cur_count; 1544 + 1545 + if (WARN_ON(size < count)) 1546 + count = size; 1547 + 1548 + for (i = 0; i < count; i++) 1549 + args[i] = be32_to_cpup(it->cur++); 1550 + 1551 + return count; 1552 + } 1553 + 1444 1554 static int __of_parse_phandle_with_args(const struct device_node *np, 1445 1555 const char *list_name, 1446 1556 const char *cells_name, 1447 1557 int cell_count, int index, 1448 1558 struct of_phandle_args *out_args) 1449 1559 { 1450 - const __be32 *list, *list_end; 1451 - int rc = 0, size, cur_index = 0; 1452 - uint32_t count = 0; 1453 - struct device_node *node = NULL; 1454 - phandle phandle; 1455 - 1456 - /* Retrieve the phandle list property */ 1457 - list = of_get_property(np, list_name, &size); 1458 - if (!list) 1459 - return -ENOENT; 1460 - list_end = list + size / sizeof(*list); 1560 + struct of_phandle_iterator it; 1561 + int rc, cur_index = 0; 1461 1562 1462 1563 /* Loop over the phandles until all the requested entry is found */ 1463 - while (list < list_end) { 1464 - rc = -EINVAL; 1465 - count = 0; 1466 - 1564 + of_for_each_phandle(&it, rc, np, list_name, cells_name, cell_count) { 1467 1565 /* 1468 - * If phandle is 0, then it is an empty entry with no 1469 - * arguments. Skip forward to the next entry. 1470 - */ 1471 - phandle = be32_to_cpup(list++); 1472 - if (phandle) { 1473 - /* 1474 - * Find the provider node and parse the #*-cells 1475 - * property to determine the argument length. 1476 - * 1477 - * This is not needed if the cell count is hard-coded 1478 - * (i.e. cells_name not set, but cell_count is set), 1479 - * except when we're going to return the found node 1480 - * below. 1481 - */ 1482 - if (cells_name || cur_index == index) { 1483 - node = of_find_node_by_phandle(phandle); 1484 - if (!node) { 1485 - pr_err("%s: could not find phandle\n", 1486 - np->full_name); 1487 - goto err; 1488 - } 1489 - } 1490 - 1491 - if (cells_name) { 1492 - if (of_property_read_u32(node, cells_name, 1493 - &count)) { 1494 - pr_err("%s: could not get %s for %s\n", 1495 - np->full_name, cells_name, 1496 - node->full_name); 1497 - goto err; 1498 - } 1499 - } else { 1500 - count = cell_count; 1501 - } 1502 - 1503 - /* 1504 - * Make sure that the arguments actually fit in the 1505 - * remaining property data length 1506 - */ 1507 - if (list + count > list_end) { 1508 - pr_err("%s: arguments longer than property\n", 1509 - np->full_name); 1510 - goto err; 1511 - } 1512 - } 1513 - 1514 - /* 1515 - * All of the error cases above bail out of the loop, so at 1566 + * All of the error cases bail out of the loop, so at 1516 1567 * this point, the parsing is successful. If the requested 1517 1568 * index matches, then fill the out_args structure and return, 1518 1569 * or return -ENOENT for an empty entry. 1519 1570 */ 1520 1571 rc = -ENOENT; 1521 1572 if (cur_index == index) { 1522 - if (!phandle) 1573 + if (!it.phandle) 1523 1574 goto err; 1524 1575 1525 1576 if (out_args) { 1526 - int i; 1527 - if (WARN_ON(count > MAX_PHANDLE_ARGS)) 1528 - count = MAX_PHANDLE_ARGS; 1529 - out_args->np = node; 1530 - out_args->args_count = count; 1531 - for (i = 0; i < count; i++) 1532 - out_args->args[i] = be32_to_cpup(list++); 1577 + int c; 1578 + 1579 + c = of_phandle_iterator_args(&it, 1580 + out_args->args, 1581 + MAX_PHANDLE_ARGS); 1582 + out_args->np = it.node; 1583 + out_args->args_count = c; 1533 1584 } else { 1534 - of_node_put(node); 1585 + of_node_put(it.node); 1535 1586 } 1536 1587 1537 1588 /* Found it! return success */ 1538 1589 return 0; 1539 1590 } 1540 1591 1541 - of_node_put(node); 1542 - node = NULL; 1543 - list += count; 1544 1592 cur_index++; 1545 1593 } 1546 1594 ··· 1597 1547 * Unlock node before returning result; will be one of: 1598 1548 * -ENOENT : index is for empty phandle 1599 1549 * -EINVAL : parsing error on data 1600 - * [1..n] : Number of phandle (count mode; when index = -1) 1601 1550 */ 1602 - rc = index < 0 ? cur_index : -ENOENT; 1551 + 1603 1552 err: 1604 - if (node) 1605 - of_node_put(node); 1553 + if (it.node) 1554 + of_node_put(it.node); 1606 1555 return rc; 1607 1556 } 1608 1557 ··· 1733 1684 int of_count_phandle_with_args(const struct device_node *np, const char *list_name, 1734 1685 const char *cells_name) 1735 1686 { 1736 - return __of_parse_phandle_with_args(np, list_name, cells_name, 0, -1, 1737 - NULL); 1687 + struct of_phandle_iterator it; 1688 + int rc, cur_index = 0; 1689 + 1690 + rc = of_phandle_iterator_init(&it, np, list_name, cells_name, 0); 1691 + if (rc) 1692 + return rc; 1693 + 1694 + while ((rc = of_phandle_iterator_next(&it)) == 0) 1695 + cur_index += 1; 1696 + 1697 + if (rc != -ENOENT) 1698 + return rc; 1699 + 1700 + return cur_index; 1738 1701 } 1739 1702 EXPORT_SYMBOL(of_count_phandle_with_args); 1740 1703
+6
drivers/of/dynamic.c
··· 311 311 312 312 return rc; 313 313 } 314 + EXPORT_SYMBOL_GPL(of_detach_node); 314 315 315 316 /** 316 317 * of_node_release() - release a dynamically allocated node ··· 498 497 case OF_RECONFIG_UPDATE_PROPERTY: 499 498 rce->old_prop = ce->prop; 500 499 rce->prop = ce->old_prop; 500 + /* update was used but original property did not exist */ 501 + if (!rce->prop) { 502 + rce->action = OF_RECONFIG_REMOVE_PROPERTY; 503 + rce->prop = ce->prop; 504 + } 501 505 break; 502 506 } 503 507 }
+238 -144
drivers/of/fdt.c
··· 161 161 return res; 162 162 } 163 163 164 - /** 165 - * unflatten_dt_node - Alloc and populate a device_node from the flat tree 166 - * @blob: The parent device tree blob 167 - * @mem: Memory chunk to use for allocating device nodes and properties 168 - * @poffset: pointer to node in flat tree 169 - * @dad: Parent struct device_node 170 - * @nodepp: The device_node tree created by the call 171 - * @fpsize: Size of the node path up at the current depth. 172 - * @dryrun: If true, do not allocate device nodes but still calculate needed 173 - * memory size 174 - */ 175 - static void * unflatten_dt_node(const void *blob, 176 - void *mem, 177 - int *poffset, 178 - struct device_node *dad, 179 - struct device_node **nodepp, 180 - unsigned long fpsize, 164 + static void populate_properties(const void *blob, 165 + int offset, 166 + void **mem, 167 + struct device_node *np, 168 + const char *nodename, 181 169 bool dryrun) 182 170 { 183 - const __be32 *p; 171 + struct property *pp, **pprev = NULL; 172 + int cur; 173 + bool has_name = false; 174 + 175 + pprev = &np->properties; 176 + for (cur = fdt_first_property_offset(blob, offset); 177 + cur >= 0; 178 + cur = fdt_next_property_offset(blob, cur)) { 179 + const __be32 *val; 180 + const char *pname; 181 + u32 sz; 182 + 183 + val = fdt_getprop_by_offset(blob, cur, &pname, &sz); 184 + if (!val) { 185 + pr_warn("%s: Cannot locate property at 0x%x\n", 186 + __func__, cur); 187 + continue; 188 + } 189 + 190 + if (!pname) { 191 + pr_warn("%s: Cannot find property name at 0x%x\n", 192 + __func__, cur); 193 + continue; 194 + } 195 + 196 + if (!strcmp(pname, "name")) 197 + has_name = true; 198 + 199 + pp = unflatten_dt_alloc(mem, sizeof(struct property), 200 + __alignof__(struct property)); 201 + if (dryrun) 202 + continue; 203 + 204 + /* We accept flattened tree phandles either in 205 + * ePAPR-style "phandle" properties, or the 206 + * legacy "linux,phandle" properties. If both 207 + * appear and have different values, things 208 + * will get weird. Don't do that. 209 + */ 210 + if (!strcmp(pname, "phandle") || 211 + !strcmp(pname, "linux,phandle")) { 212 + if (!np->phandle) 213 + np->phandle = be32_to_cpup(val); 214 + } 215 + 216 + /* And we process the "ibm,phandle" property 217 + * used in pSeries dynamic device tree 218 + * stuff 219 + */ 220 + if (!strcmp(pname, "ibm,phandle")) 221 + np->phandle = be32_to_cpup(val); 222 + 223 + pp->name = (char *)pname; 224 + pp->length = sz; 225 + pp->value = (__be32 *)val; 226 + *pprev = pp; 227 + pprev = &pp->next; 228 + } 229 + 230 + /* With version 0x10 we may not have the name property, 231 + * recreate it here from the unit name if absent 232 + */ 233 + if (!has_name) { 234 + const char *p = nodename, *ps = p, *pa = NULL; 235 + int len; 236 + 237 + while (*p) { 238 + if ((*p) == '@') 239 + pa = p; 240 + else if ((*p) == '/') 241 + ps = p + 1; 242 + p++; 243 + } 244 + 245 + if (pa < ps) 246 + pa = p; 247 + len = (pa - ps) + 1; 248 + pp = unflatten_dt_alloc(mem, sizeof(struct property) + len, 249 + __alignof__(struct property)); 250 + if (!dryrun) { 251 + pp->name = "name"; 252 + pp->length = len; 253 + pp->value = pp + 1; 254 + *pprev = pp; 255 + pprev = &pp->next; 256 + memcpy(pp->value, ps, len - 1); 257 + ((char *)pp->value)[len - 1] = 0; 258 + pr_debug("fixed up name for %s -> %s\n", 259 + nodename, (char *)pp->value); 260 + } 261 + } 262 + 263 + if (!dryrun) 264 + *pprev = NULL; 265 + } 266 + 267 + static unsigned int populate_node(const void *blob, 268 + int offset, 269 + void **mem, 270 + struct device_node *dad, 271 + unsigned int fpsize, 272 + struct device_node **pnp, 273 + bool dryrun) 274 + { 184 275 struct device_node *np; 185 - struct property *pp, **prev_pp = NULL; 186 276 const char *pathp; 187 277 unsigned int l, allocl; 188 - static int depth; 189 - int old_depth; 190 - int offset; 191 - int has_name = 0; 192 278 int new_format = 0; 193 279 194 - pathp = fdt_get_name(blob, *poffset, &l); 195 - if (!pathp) 196 - return mem; 280 + pathp = fdt_get_name(blob, offset, &l); 281 + if (!pathp) { 282 + *pnp = NULL; 283 + return 0; 284 + } 197 285 198 286 allocl = ++l; 199 287 ··· 311 223 } 312 224 } 313 225 314 - np = unflatten_dt_alloc(&mem, sizeof(struct device_node) + allocl, 226 + np = unflatten_dt_alloc(mem, sizeof(struct device_node) + allocl, 315 227 __alignof__(struct device_node)); 316 228 if (!dryrun) { 317 229 char *fn; ··· 334 246 } 335 247 memcpy(fn, pathp, l); 336 248 337 - prev_pp = &np->properties; 338 249 if (dad != NULL) { 339 250 np->parent = dad; 340 251 np->sibling = dad->child; 341 252 dad->child = np; 342 253 } 343 254 } 344 - /* process properties */ 345 - for (offset = fdt_first_property_offset(blob, *poffset); 346 - (offset >= 0); 347 - (offset = fdt_next_property_offset(blob, offset))) { 348 - const char *pname; 349 - u32 sz; 350 255 351 - if (!(p = fdt_getprop_by_offset(blob, offset, &pname, &sz))) { 352 - offset = -FDT_ERR_INTERNAL; 353 - break; 354 - } 355 - 356 - if (pname == NULL) { 357 - pr_info("Can't find property name in list !\n"); 358 - break; 359 - } 360 - if (strcmp(pname, "name") == 0) 361 - has_name = 1; 362 - pp = unflatten_dt_alloc(&mem, sizeof(struct property), 363 - __alignof__(struct property)); 364 - if (!dryrun) { 365 - /* We accept flattened tree phandles either in 366 - * ePAPR-style "phandle" properties, or the 367 - * legacy "linux,phandle" properties. If both 368 - * appear and have different values, things 369 - * will get weird. Don't do that. */ 370 - if ((strcmp(pname, "phandle") == 0) || 371 - (strcmp(pname, "linux,phandle") == 0)) { 372 - if (np->phandle == 0) 373 - np->phandle = be32_to_cpup(p); 374 - } 375 - /* And we process the "ibm,phandle" property 376 - * used in pSeries dynamic device tree 377 - * stuff */ 378 - if (strcmp(pname, "ibm,phandle") == 0) 379 - np->phandle = be32_to_cpup(p); 380 - pp->name = (char *)pname; 381 - pp->length = sz; 382 - pp->value = (__be32 *)p; 383 - *prev_pp = pp; 384 - prev_pp = &pp->next; 385 - } 386 - } 387 - /* with version 0x10 we may not have the name property, recreate 388 - * it here from the unit name if absent 389 - */ 390 - if (!has_name) { 391 - const char *p1 = pathp, *ps = pathp, *pa = NULL; 392 - int sz; 393 - 394 - while (*p1) { 395 - if ((*p1) == '@') 396 - pa = p1; 397 - if ((*p1) == '/') 398 - ps = p1 + 1; 399 - p1++; 400 - } 401 - if (pa < ps) 402 - pa = p1; 403 - sz = (pa - ps) + 1; 404 - pp = unflatten_dt_alloc(&mem, sizeof(struct property) + sz, 405 - __alignof__(struct property)); 406 - if (!dryrun) { 407 - pp->name = "name"; 408 - pp->length = sz; 409 - pp->value = pp + 1; 410 - *prev_pp = pp; 411 - prev_pp = &pp->next; 412 - memcpy(pp->value, ps, sz - 1); 413 - ((char *)pp->value)[sz - 1] = 0; 414 - pr_debug("fixed up name for %s -> %s\n", pathp, 415 - (char *)pp->value); 416 - } 417 - } 256 + populate_properties(blob, offset, mem, np, pathp, dryrun); 418 257 if (!dryrun) { 419 - *prev_pp = NULL; 420 258 np->name = of_get_property(np, "name", NULL); 421 259 np->type = of_get_property(np, "device_type", NULL); 422 260 ··· 352 338 np->type = "<NULL>"; 353 339 } 354 340 355 - old_depth = depth; 356 - *poffset = fdt_next_node(blob, *poffset, &depth); 357 - if (depth < 0) 358 - depth = 0; 359 - while (*poffset > 0 && depth > old_depth) 360 - mem = unflatten_dt_node(blob, mem, poffset, np, NULL, 361 - fpsize, dryrun); 341 + *pnp = np; 342 + return fpsize; 343 + } 362 344 363 - if (*poffset < 0 && *poffset != -FDT_ERR_NOTFOUND) 364 - pr_err("unflatten: error %d processing FDT\n", *poffset); 345 + static void reverse_nodes(struct device_node *parent) 346 + { 347 + struct device_node *child, *next; 348 + 349 + /* In-depth first */ 350 + child = parent->child; 351 + while (child) { 352 + reverse_nodes(child); 353 + 354 + child = child->sibling; 355 + } 356 + 357 + /* Reverse the nodes in the child list */ 358 + child = parent->child; 359 + parent->child = NULL; 360 + while (child) { 361 + next = child->sibling; 362 + 363 + child->sibling = parent->child; 364 + parent->child = child; 365 + child = next; 366 + } 367 + } 368 + 369 + /** 370 + * unflatten_dt_nodes - Alloc and populate a device_node from the flat tree 371 + * @blob: The parent device tree blob 372 + * @mem: Memory chunk to use for allocating device nodes and properties 373 + * @dad: Parent struct device_node 374 + * @nodepp: The device_node tree created by the call 375 + * 376 + * It returns the size of unflattened device tree or error code 377 + */ 378 + static int unflatten_dt_nodes(const void *blob, 379 + void *mem, 380 + struct device_node *dad, 381 + struct device_node **nodepp) 382 + { 383 + struct device_node *root; 384 + int offset = 0, depth = 0; 385 + #define FDT_MAX_DEPTH 64 386 + unsigned int fpsizes[FDT_MAX_DEPTH]; 387 + struct device_node *nps[FDT_MAX_DEPTH]; 388 + void *base = mem; 389 + bool dryrun = !base; 390 + 391 + if (nodepp) 392 + *nodepp = NULL; 393 + 394 + root = dad; 395 + fpsizes[depth] = dad ? strlen(of_node_full_name(dad)) : 0; 396 + nps[depth] = dad; 397 + for (offset = 0; 398 + offset >= 0 && depth >= 0; 399 + offset = fdt_next_node(blob, offset, &depth)) { 400 + if (WARN_ON_ONCE(depth >= FDT_MAX_DEPTH)) 401 + continue; 402 + 403 + fpsizes[depth+1] = populate_node(blob, offset, &mem, 404 + nps[depth], 405 + fpsizes[depth], 406 + &nps[depth+1], dryrun); 407 + if (!fpsizes[depth+1]) 408 + return mem - base; 409 + 410 + if (!dryrun && nodepp && !*nodepp) 411 + *nodepp = nps[depth+1]; 412 + if (!dryrun && !root) 413 + root = nps[depth+1]; 414 + } 415 + 416 + if (offset < 0 && offset != -FDT_ERR_NOTFOUND) { 417 + pr_err("%s: Error %d processing FDT\n", __func__, offset); 418 + return -EINVAL; 419 + } 365 420 366 421 /* 367 422 * Reverse the child list. Some drivers assumes node order matches .dts 368 423 * node order 369 424 */ 370 - if (!dryrun && np->child) { 371 - struct device_node *child = np->child; 372 - np->child = NULL; 373 - while (child) { 374 - struct device_node *next = child->sibling; 375 - child->sibling = np->child; 376 - np->child = child; 377 - child = next; 378 - } 379 - } 425 + if (!dryrun) 426 + reverse_nodes(root); 380 427 381 - if (nodepp) 382 - *nodepp = np; 383 - 384 - return mem; 428 + return mem - base; 385 429 } 386 430 387 431 /** ··· 450 378 * pointers of the nodes so the normal device-tree walking functions 451 379 * can be used. 452 380 * @blob: The blob to expand 381 + * @dad: Parent device node 453 382 * @mynodes: The device_node tree created by the call 454 383 * @dt_alloc: An allocator that provides a virtual address to memory 455 384 * for the resulting tree 385 + * 386 + * Returns NULL on failure or the memory chunk containing the unflattened 387 + * device tree on success. 456 388 */ 457 - static void __unflatten_device_tree(const void *blob, 458 - struct device_node **mynodes, 459 - void * (*dt_alloc)(u64 size, u64 align)) 389 + static void *__unflatten_device_tree(const void *blob, 390 + struct device_node *dad, 391 + struct device_node **mynodes, 392 + void *(*dt_alloc)(u64 size, u64 align)) 460 393 { 461 - unsigned long size; 462 - int start; 394 + int size; 463 395 void *mem; 464 396 465 397 pr_debug(" -> unflatten_device_tree()\n"); 466 398 467 399 if (!blob) { 468 400 pr_debug("No device tree pointer\n"); 469 - return; 401 + return NULL; 470 402 } 471 403 472 404 pr_debug("Unflattening device tree:\n"); ··· 480 404 481 405 if (fdt_check_header(blob)) { 482 406 pr_err("Invalid device tree blob header\n"); 483 - return; 407 + return NULL; 484 408 } 485 409 486 410 /* First pass, scan for size */ 487 - start = 0; 488 - size = (unsigned long)unflatten_dt_node(blob, NULL, &start, NULL, NULL, 0, true); 489 - size = ALIGN(size, 4); 411 + size = unflatten_dt_nodes(blob, NULL, dad, NULL); 412 + if (size < 0) 413 + return NULL; 490 414 491 - pr_debug(" size is %lx, allocating...\n", size); 415 + size = ALIGN(size, 4); 416 + pr_debug(" size is %d, allocating...\n", size); 492 417 493 418 /* Allocate memory for the expanded device tree */ 494 419 mem = dt_alloc(size + 4, __alignof__(struct device_node)); ··· 500 423 pr_debug(" unflattening %p...\n", mem); 501 424 502 425 /* Second pass, do actual unflattening */ 503 - start = 0; 504 - unflatten_dt_node(blob, mem, &start, NULL, mynodes, 0, false); 426 + unflatten_dt_nodes(blob, mem, dad, mynodes); 505 427 if (be32_to_cpup(mem + size) != 0xdeadbeef) 506 428 pr_warning("End of tree marker overwritten: %08x\n", 507 429 be32_to_cpup(mem + size)); 508 430 509 431 pr_debug(" <- unflatten_device_tree()\n"); 432 + return mem; 510 433 } 511 434 512 435 static void *kernel_tree_alloc(u64 size, u64 align) ··· 518 441 519 442 /** 520 443 * of_fdt_unflatten_tree - create tree of device_nodes from flat blob 444 + * @blob: Flat device tree blob 445 + * @dad: Parent device node 446 + * @mynodes: The device tree created by the call 521 447 * 522 448 * unflattens the device-tree passed by the firmware, creating the 523 449 * tree of struct device_node. It also fills the "name" and "type" 524 450 * pointers of the nodes so the normal device-tree walking functions 525 451 * can be used. 452 + * 453 + * Returns NULL on failure or the memory chunk containing the unflattened 454 + * device tree on success. 526 455 */ 527 - void of_fdt_unflatten_tree(const unsigned long *blob, 528 - struct device_node **mynodes) 456 + void *of_fdt_unflatten_tree(const unsigned long *blob, 457 + struct device_node *dad, 458 + struct device_node **mynodes) 529 459 { 460 + void *mem; 461 + 530 462 mutex_lock(&of_fdt_unflatten_mutex); 531 - __unflatten_device_tree(blob, mynodes, &kernel_tree_alloc); 463 + mem = __unflatten_device_tree(blob, dad, mynodes, &kernel_tree_alloc); 532 464 mutex_unlock(&of_fdt_unflatten_mutex); 465 + 466 + return mem; 533 467 } 534 468 EXPORT_SYMBOL_GPL(of_fdt_unflatten_tree); 535 469 ··· 1057 969 * is set in which case we override whatever was found earlier. 1058 970 */ 1059 971 #ifdef CONFIG_CMDLINE 1060 - #ifndef CONFIG_CMDLINE_FORCE 972 + #if defined(CONFIG_CMDLINE_EXTEND) 973 + strlcat(data, " ", COMMAND_LINE_SIZE); 974 + strlcat(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE); 975 + #elif defined(CONFIG_CMDLINE_FORCE) 976 + strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE); 977 + #else 978 + /* No arguments from boot loader, use kernel's cmdl*/ 1061 979 if (!((char *)data)[0]) 1062 - #endif 1063 980 strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE); 981 + #endif 1064 982 #endif /* CONFIG_CMDLINE */ 1065 983 1066 984 pr_debug("Command line is: %s\n", (char*)data); ··· 1212 1118 */ 1213 1119 void __init unflatten_device_tree(void) 1214 1120 { 1215 - __unflatten_device_tree(initial_boot_params, &of_root, 1121 + __unflatten_device_tree(initial_boot_params, NULL, &of_root, 1216 1122 early_init_dt_alloc_memory_arch); 1217 1123 1218 1124 /* Get pointer to "/chosen" and "/aliases" nodes for use everywhere */
+1 -2
drivers/of/unittest.c
··· 8 8 #include <linux/err.h> 9 9 #include <linux/errno.h> 10 10 #include <linux/hashtable.h> 11 - #include <linux/module.h> 12 11 #include <linux/of.h> 13 12 #include <linux/of_fdt.h> 14 13 #include <linux/of_irq.h> ··· 920 921 "not running tests\n", __func__); 921 922 return -ENOMEM; 922 923 } 923 - of_fdt_unflatten_tree(unittest_data, &unittest_data_node); 924 + of_fdt_unflatten_tree(unittest_data, NULL, &unittest_data_node); 924 925 if (!unittest_data_node) { 925 926 pr_warn("%s: No tree to attach; not running tests\n", __func__); 926 927 return -ENODATA;
+56
include/linux/of.h
··· 75 75 uint32_t args[MAX_PHANDLE_ARGS]; 76 76 }; 77 77 78 + struct of_phandle_iterator { 79 + /* Common iterator information */ 80 + const char *cells_name; 81 + int cell_count; 82 + const struct device_node *parent; 83 + 84 + /* List size information */ 85 + const __be32 *list_end; 86 + const __be32 *phandle_end; 87 + 88 + /* Current position state */ 89 + const __be32 *cur; 90 + uint32_t cur_count; 91 + phandle phandle; 92 + struct device_node *node; 93 + }; 94 + 78 95 struct of_reconfig_data { 79 96 struct device_node *dn; 80 97 struct property *prop; ··· 350 333 struct of_phandle_args *out_args); 351 334 extern int of_count_phandle_with_args(const struct device_node *np, 352 335 const char *list_name, const char *cells_name); 336 + 337 + /* phandle iterator functions */ 338 + extern int of_phandle_iterator_init(struct of_phandle_iterator *it, 339 + const struct device_node *np, 340 + const char *list_name, 341 + const char *cells_name, 342 + int cell_count); 343 + 344 + extern int of_phandle_iterator_next(struct of_phandle_iterator *it); 345 + extern int of_phandle_iterator_args(struct of_phandle_iterator *it, 346 + uint32_t *args, 347 + int size); 353 348 354 349 extern void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)); 355 350 extern int of_alias_get_id(struct device_node *np, const char *stem); ··· 637 608 return -ENOSYS; 638 609 } 639 610 611 + static inline int of_phandle_iterator_init(struct of_phandle_iterator *it, 612 + const struct device_node *np, 613 + const char *list_name, 614 + const char *cells_name, 615 + int cell_count) 616 + { 617 + return -ENOSYS; 618 + } 619 + 620 + static inline int of_phandle_iterator_next(struct of_phandle_iterator *it) 621 + { 622 + return -ENOSYS; 623 + } 624 + 625 + static inline int of_phandle_iterator_args(struct of_phandle_iterator *it, 626 + uint32_t *args, 627 + int size) 628 + { 629 + return 0; 630 + } 631 + 640 632 static inline int of_alias_get_id(struct device_node *np, const char *stem) 641 633 { 642 634 return -ENOSYS; ··· 926 876 { 927 877 return of_property_read_u32(np, propname, (u32*) out_value); 928 878 } 879 + 880 + #define of_for_each_phandle(it, err, np, ln, cn, cc) \ 881 + for (of_phandle_iterator_init((it), (np), (ln), (cn), (cc)), \ 882 + err = of_phandle_iterator_next(it); \ 883 + err == 0; \ 884 + err = of_phandle_iterator_next(it)) 929 885 930 886 #define of_property_for_each_u32(np, propname, prop, p, u) \ 931 887 for (prop = of_find_property(np, propname, NULL), \
+3 -2
include/linux/of_fdt.h
··· 37 37 unsigned long node); 38 38 extern int of_fdt_match(const void *blob, unsigned long node, 39 39 const char *const *compat); 40 - extern void of_fdt_unflatten_tree(const unsigned long *blob, 41 - struct device_node **mynodes); 40 + extern void *of_fdt_unflatten_tree(const unsigned long *blob, 41 + struct device_node *dad, 42 + struct device_node **mynodes); 42 43 43 44 /* TBD: Temporary export of fdt globals - remove when code fully merged */ 44 45 extern int __initdata dt_root_addr_cells;
+1
include/linux/of_graph.h
··· 15 15 #define __LINUX_OF_GRAPH_H 16 16 17 17 #include <linux/types.h> 18 + #include <linux/errno.h> 18 19 19 20 /** 20 21 * struct of_endpoint - the OF graph endpoint data structure
+5
scripts/Makefile.lib
··· 277 277 # --------------------------------------------------------------------------- 278 278 DTC ?= $(objtree)/scripts/dtc/dtc 279 279 280 + # Disable noisy checks by default 281 + ifeq ($(KBUILD_ENABLE_EXTRA_GCC_CHECKS),) 282 + DTC_FLAGS += -Wno-unit_address_vs_reg 283 + endif 284 + 280 285 # Generate an assembly file to wrap the output of the device tree compiler 281 286 quiet_cmd_dt_S_dtb= DTB $@ 282 287 cmd_dt_S_dtb= \
+26
scripts/dtc/checks.c
··· 294 294 } 295 295 NODE_ERROR(node_name_format, NULL, &node_name_chars); 296 296 297 + static void check_unit_address_vs_reg(struct check *c, struct node *dt, 298 + struct node *node) 299 + { 300 + const char *unitname = get_unitname(node); 301 + struct property *prop = get_property(node, "reg"); 302 + 303 + if (!prop) { 304 + prop = get_property(node, "ranges"); 305 + if (prop && !prop->val.len) 306 + prop = NULL; 307 + } 308 + 309 + if (prop) { 310 + if (!unitname[0]) 311 + FAIL(c, "Node %s has a reg or ranges property, but no unit name", 312 + node->fullpath); 313 + } else { 314 + if (unitname[0]) 315 + FAIL(c, "Node %s has a unit name, but no reg property", 316 + node->fullpath); 317 + } 318 + } 319 + NODE_WARNING(unit_address_vs_reg, NULL); 320 + 297 321 static void check_property_name_chars(struct check *c, struct node *dt, 298 322 struct node *node, struct property *prop) 299 323 { ··· 690 666 &device_type_is_string, &model_is_string, &status_is_string, 691 667 692 668 &addr_size_cells, &reg_format, &ranges_format, 669 + 670 + &unit_address_vs_reg, 693 671 694 672 &avoid_default_addr_size, 695 673 &obsolete_chosen_interrupt_controller,
+2 -2
scripts/dtc/flattree.c
··· 889 889 890 890 if (version >= 3) { 891 891 uint32_t size_str = fdt32_to_cpu(fdt->size_dt_strings); 892 - if (off_str+size_str > totalsize) 892 + if ((off_str+size_str < off_str) || (off_str+size_str > totalsize)) 893 893 die("String table extends past total size\n"); 894 894 inbuf_init(&strbuf, blob + off_str, blob + off_str + size_str); 895 895 } else { ··· 898 898 899 899 if (version >= 17) { 900 900 size_dt = fdt32_to_cpu(fdt->size_dt_struct); 901 - if (off_dt+size_dt > totalsize) 901 + if ((off_dt+size_dt < off_dt) || (off_dt+size_dt > totalsize)) 902 902 die("Structure block extends past total size\n"); 903 903 } 904 904
+2 -4
scripts/dtc/libfdt/fdt_ro.c
··· 647 647 prop = fdt_getprop(fdt, nodeoffset, "compatible", &len); 648 648 if (!prop) 649 649 return len; 650 - if (fdt_stringlist_contains(prop, len, compatible)) 651 - return 0; 652 - else 653 - return 1; 650 + 651 + return !fdt_stringlist_contains(prop, len, compatible); 654 652 } 655 653 656 654 int fdt_node_offset_by_compatible(const void *fdt, int startoffset,
+1 -1
scripts/dtc/version_gen.h
··· 1 - #define DTC_VERSION "DTC 1.4.1-gb06e55c8" 1 + #define DTC_VERSION "DTC 1.4.1-g53bf130b"