diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-10-05 14:56:38 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-10-05 14:56:38 -0400 |
commit | 878fb5dc96b9dfae1de45be1b85aba40aca3356e (patch) | |
tree | 13dc5608989d399cd3ad7053ec24e7ca54a14949 | |
parent | 6a497e9d5828120cf55c2aea508176d94cf7f5ba (diff) | |
parent | 87e5fc99b0280b492724cc7f2d8d9ad37b980087 (diff) |
Merge tag 'devicetree-for-4.9' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux
Pull DeviceTree updates from Rob Herring:
- update changeset documentation on locking to reflect current code
- fix alphabetizing of vendor-prefixes.txt
- add various vendor prefixes
- add ESP8089 WiFi binding
- add new variable sized array parsing functions
* tag 'devicetree-for-4.9' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux: (21 commits)
DT: irqchip: renesas-irqc: document R8A7743/5 support
dt-bindings: Add Keith&Koep vendor prefix
dt-bindings: add vendor prefix for Auvidea GmbH
of: Add vendor prefix for Engicam s.r.l company
devicetree: Add vendor-prefix for Silead Inc.
devicetree: bindings: Add vendor prefix for Topeet.
dt-bindings: Add summit vendor id
of/platform: Initialise dev->fwnode appropriately
of: Add array read functions with min/max size limits
of: Make of_find_property_value_of_size take a length range
dt: net: enhance DWC EQoS binding to support Tegra186
bindings: PCI: artpec: correct pci binding example
Documentation: devicetree: Fix max77693 spelling errors
dt: bindings: Add binding for ESP8089 wifi chips
PCI: Xilinx NWL PCIe: Updating device tree documentation with prefetchable memory space
Documentation: devicetree: spi: fix wrong spi-bus documentation
dt-bindings: Add Japan Display Inc vendor id
dt-bindings: vendor-prefixes: Add Sierra Wireless
devicetree: Add vendor prefix for Shenzhen Sunchip Technology Co., Ltd
devicetree: Sort vendor prefixes in alphabetical order
...
-rw-r--r-- | Documentation/devicetree/bindings/interrupt-controller/renesas,irqc.txt | 4 | ||||
-rw-r--r-- | Documentation/devicetree/bindings/mfd/max77693.txt | 12 | ||||
-rw-r--r-- | Documentation/devicetree/bindings/net/snps,dwc-qos-ethernet.txt | 99 | ||||
-rw-r--r-- | Documentation/devicetree/bindings/net/wireless/esp,esp8089.txt | 31 | ||||
-rw-r--r-- | Documentation/devicetree/bindings/pci/axis,artpec6-pcie.txt | 7 | ||||
-rw-r--r-- | Documentation/devicetree/bindings/pci/xilinx-nwl-pcie.txt | 5 | ||||
-rw-r--r-- | Documentation/devicetree/bindings/spi/spi-bus.txt | 2 | ||||
-rw-r--r-- | Documentation/devicetree/bindings/vendor-prefixes.txt | 35 | ||||
-rw-r--r-- | Documentation/devicetree/changesets.txt | 19 | ||||
-rw-r--r-- | drivers/of/base.c | 171 | ||||
-rw-r--r-- | drivers/of/platform.c | 2 | ||||
-rw-r--r-- | include/linux/of.h | 144 |
12 files changed, 423 insertions, 108 deletions
diff --git a/Documentation/devicetree/bindings/interrupt-controller/renesas,irqc.txt b/Documentation/devicetree/bindings/interrupt-controller/renesas,irqc.txt index ae5054c27c99..e3f052d8c11a 100644 --- a/Documentation/devicetree/bindings/interrupt-controller/renesas,irqc.txt +++ b/Documentation/devicetree/bindings/interrupt-controller/renesas,irqc.txt | |||
@@ -1,10 +1,12 @@ | |||
1 | DT bindings for the R-Mobile/R-Car interrupt controller | 1 | DT bindings for the R-Mobile/R-Car/RZ/G interrupt controller |
2 | 2 | ||
3 | Required properties: | 3 | Required properties: |
4 | 4 | ||
5 | - compatible: has to be "renesas,irqc-<soctype>", "renesas,irqc" as fallback. | 5 | - compatible: has to be "renesas,irqc-<soctype>", "renesas,irqc" as fallback. |
6 | Examples with soctypes are: | 6 | Examples with soctypes are: |
7 | - "renesas,irqc-r8a73a4" (R-Mobile APE6) | 7 | - "renesas,irqc-r8a73a4" (R-Mobile APE6) |
8 | - "renesas,irqc-r8a7743" (RZ/G1M) | ||
9 | - "renesas,irqc-r8a7745" (RZ/G1E) | ||
8 | - "renesas,irqc-r8a7790" (R-Car H2) | 10 | - "renesas,irqc-r8a7790" (R-Car H2) |
9 | - "renesas,irqc-r8a7791" (R-Car M2-W) | 11 | - "renesas,irqc-r8a7791" (R-Car M2-W) |
10 | - "renesas,irqc-r8a7792" (R-Car V2H) | 12 | - "renesas,irqc-r8a7792" (R-Car V2H) |
diff --git a/Documentation/devicetree/bindings/mfd/max77693.txt b/Documentation/devicetree/bindings/mfd/max77693.txt index d3425846aa5b..6a1ae3a2b77f 100644 --- a/Documentation/devicetree/bindings/mfd/max77693.txt +++ b/Documentation/devicetree/bindings/mfd/max77693.txt | |||
@@ -17,28 +17,28 @@ Required properties: | |||
17 | - interrupt-parent : The parent interrupt controller. | 17 | - interrupt-parent : The parent interrupt controller. |
18 | 18 | ||
19 | Optional properties: | 19 | Optional properties: |
20 | - regulators : The regulators of max77693 have to be instantiated under subnod | 20 | - regulators : The regulators of max77693 have to be instantiated under subnode |
21 | named "regulators" using the following format. | 21 | named "regulators" using the following format. |
22 | 22 | ||
23 | regulators { | 23 | regulators { |
24 | regualtor-compatible = ESAFEOUT1/ESAFEOUT2/CHARGER | 24 | regulator-compatible = ESAFEOUT1/ESAFEOUT2/CHARGER |
25 | standard regulator constratints[*]. | 25 | standard regulator constraints[*]. |
26 | }; | 26 | }; |
27 | 27 | ||
28 | [*] refer Documentation/devicetree/bindings/regulator/regulator.txt | 28 | [*] refer Documentation/devicetree/bindings/regulator/regulator.txt |
29 | 29 | ||
30 | - haptic : The MAX77693 haptic device utilises a PWM controlled motor to provide | 30 | - haptic : The MAX77693 haptic device utilises a PWM controlled motor to provide |
31 | users with tactile feedback. PWM period and duty-cycle are varied in | 31 | users with tactile feedback. PWM period and duty-cycle are varied in |
32 | order to provide the approprite level of feedback. | 32 | order to provide the appropriate level of feedback. |
33 | 33 | ||
34 | Required properties: | 34 | Required properties: |
35 | - compatible : Must be "maxim,max77693-hpatic" | 35 | - compatible : Must be "maxim,max77693-haptic" |
36 | - haptic-supply : power supply for the haptic motor | 36 | - haptic-supply : power supply for the haptic motor |
37 | [*] refer Documentation/devicetree/bindings/regulator/regulator.txt | 37 | [*] refer Documentation/devicetree/bindings/regulator/regulator.txt |
38 | - pwms : phandle to the physical PWM(Pulse Width Modulation) device. | 38 | - pwms : phandle to the physical PWM(Pulse Width Modulation) device. |
39 | PWM properties should be named "pwms". And number of cell is different | 39 | PWM properties should be named "pwms". And number of cell is different |
40 | for each pwm device. | 40 | for each pwm device. |
41 | To get more informations, please refer to documentaion. | 41 | To get more information, please refer to documentation. |
42 | [*] refer Documentation/devicetree/bindings/pwm/pwm.txt | 42 | [*] refer Documentation/devicetree/bindings/pwm/pwm.txt |
43 | 43 | ||
44 | - charger : Node configuring the charger driver. | 44 | - charger : Node configuring the charger driver. |
diff --git a/Documentation/devicetree/bindings/net/snps,dwc-qos-ethernet.txt b/Documentation/devicetree/bindings/net/snps,dwc-qos-ethernet.txt index 51f8d2eba8d8..d93f71ce8346 100644 --- a/Documentation/devicetree/bindings/net/snps,dwc-qos-ethernet.txt +++ b/Documentation/devicetree/bindings/net/snps,dwc-qos-ethernet.txt | |||
@@ -1,21 +1,111 @@ | |||
1 | * Synopsys DWC Ethernet QoS IP version 4.10 driver (GMAC) | 1 | * Synopsys DWC Ethernet QoS IP version 4.10 driver (GMAC) |
2 | 2 | ||
3 | This binding supports the Synopsys Designware Ethernet QoS (Quality Of Service) | ||
4 | IP block. The IP supports multiple options for bus type, clocking and reset | ||
5 | structure, and feature list. Consequently, a number of properties and list | ||
6 | entries in properties are marked as optional, or only required in specific HW | ||
7 | configurations. | ||
3 | 8 | ||
4 | Required properties: | 9 | Required properties: |
5 | - compatible: Should be "snps,dwc-qos-ethernet-4.10" | 10 | - compatible: One of: |
11 | - "axis,artpec6-eqos", "snps,dwc-qos-ethernet-4.10" | ||
12 | Represents the IP core when integrated into the Axis ARTPEC-6 SoC. | ||
13 | - "nvidia,tegra186-eqos", "snps,dwc-qos-ethernet-4.10" | ||
14 | Represents the IP core when integrated into the NVIDIA Tegra186 SoC. | ||
15 | - "snps,dwc-qos-ethernet-4.10" | ||
16 | This combination is deprecated. It should be treated as equivalent to | ||
17 | "axis,artpec6-eqos", "snps,dwc-qos-ethernet-4.10". It is supported to be | ||
18 | compatible with earlier revisions of this binding. | ||
6 | - reg: Address and length of the register set for the device | 19 | - reg: Address and length of the register set for the device |
7 | - clocks: Phandles to the reference clock and the bus clock | 20 | - clocks: Phandle and clock specifiers for each entry in clock-names, in the |
8 | - clock-names: Should be "phy_ref_clk" for the reference clock and "apb_pclk" | 21 | same order. See ../clock/clock-bindings.txt. |
9 | for the bus clock. | 22 | - clock-names: May contain any/all of the following depending on the IP |
23 | configuration, in any order: | ||
24 | - "tx" | ||
25 | The EQOS transmit path clock. The HW signal name is clk_tx_i. | ||
26 | In some configurations (e.g. GMII/RGMII), this clock also drives the PHY TX | ||
27 | path. In other configurations, other clocks (such as tx_125, rmii) may | ||
28 | drive the PHY TX path. | ||
29 | - "rx" | ||
30 | The EQOS receive path clock. The HW signal name is clk_rx_i. | ||
31 | In some configurations (e.g. GMII/RGMII), this clock is derived from the | ||
32 | PHY's RX clock output. In other configurations, other clocks (such as | ||
33 | rx_125, rmii) may drive the EQOS RX path. | ||
34 | In cases where the PHY clock is directly fed into the EQOS receive path | ||
35 | without intervening logic, the DT need not represent this clock, since it | ||
36 | is assumed to be fully under the control of the PHY device/driver. In | ||
37 | cases where SoC integration adds additional logic to this path, such as a | ||
38 | SW-controlled clock gate, this clock should be represented in DT. | ||
39 | - "slave_bus" | ||
40 | The CPU/slave-bus (CSR) interface clock. This applies to any bus type; | ||
41 | APB, AHB, AXI, etc. The HW signal name is hclk_i (AHB) or clk_csr_i (other | ||
42 | buses). | ||
43 | - "master_bus" | ||
44 | The master bus interface clock. Only required in configurations that use a | ||
45 | separate clock for the master and slave bus interfaces. The HW signal name | ||
46 | is hclk_i (AHB) or aclk_i (AXI). | ||
47 | - "ptp_ref" | ||
48 | The PTP reference clock. The HW signal name is clk_ptp_ref_i. | ||
49 | - "phy_ref_clk" | ||
50 | This clock is deprecated and should not be used by new compatible values. | ||
51 | It is equivalent to "tx". | ||
52 | - "apb_pclk" | ||
53 | This clock is deprecated and should not be used by new compatible values. | ||
54 | It is equivalent to "slave_bus". | ||
55 | |||
56 | Note: Support for additional IP configurations may require adding the | ||
57 | following clocks to this list in the future: clk_rx_125_i, clk_tx_125_i, | ||
58 | clk_pmarx_0_i, clk_pmarx1_i, clk_rmii_i, clk_revmii_rx_i, clk_revmii_tx_i. | ||
59 | Configurations exist where multiple similar clocks are used at once, e.g. all | ||
60 | of clk_rx_125_i, clk_pmarx_0_i, clk_pmarx1_i. For this reason it is best to | ||
61 | extend the binding with a separate clock-names entry for each of those RX | ||
62 | clocks, rather than repurposing the existing "rx" clock-names entry as a | ||
63 | generic/logical clock in a similar fashion to "master_bus" and "slave_bus". | ||
64 | This will allow easy support for configurations that support multiple PHY | ||
65 | interfaces using a mux, and hence need to have explicit control over | ||
66 | specific RX clocks. | ||
67 | |||
68 | The following compatible values require the following set of clocks: | ||
69 | - "nvidia,tegra186-eqos", "snps,dwc-qos-ethernet-4.10": | ||
70 | - "slave_bus" | ||
71 | - "master_bus" | ||
72 | - "rx" | ||
73 | - "tx" | ||
74 | - "ptp_ref" | ||
75 | - "axis,artpec6-eqos", "snps,dwc-qos-ethernet-4.10": | ||
76 | - "slave_bus" | ||
77 | - "master_bus" | ||
78 | - "tx" | ||
79 | - "ptp_ref" | ||
80 | - "snps,dwc-qos-ethernet-4.10" (deprecated): | ||
81 | - "phy_ref_clk" | ||
82 | - "apb_clk" | ||
10 | - interrupt-parent: Should be the phandle for the interrupt controller | 83 | - interrupt-parent: Should be the phandle for the interrupt controller |
11 | that services interrupts for this device | 84 | that services interrupts for this device |
12 | - interrupts: Should contain the core's combined interrupt signal | 85 | - interrupts: Should contain the core's combined interrupt signal |
13 | - phy-mode: See ethernet.txt file in the same directory | 86 | - phy-mode: See ethernet.txt file in the same directory |
87 | - resets: Phandle and reset specifiers for each entry in reset-names, in the | ||
88 | same order. See ../reset/reset.txt. | ||
89 | - reset-names: May contain any/all of the following depending on the IP | ||
90 | configuration, in any order: | ||
91 | - "eqos". The reset to the entire module. The HW signal name is hreset_n | ||
92 | (AHB) or aresetn_i (AXI). | ||
93 | |||
94 | The following compatible values require the following set of resets: | ||
95 | (the reset properties may be omitted if empty) | ||
96 | - "nvidia,tegra186-eqos", "snps,dwc-qos-ethernet-4.10": | ||
97 | - "eqos". | ||
98 | - "axis,artpec6-eqos", "snps,dwc-qos-ethernet-4.10": | ||
99 | - None. | ||
100 | - "snps,dwc-qos-ethernet-4.10" (deprecated): | ||
101 | - None. | ||
14 | 102 | ||
15 | Optional properties: | 103 | Optional properties: |
16 | - dma-coherent: Present if dma operations are coherent | 104 | - dma-coherent: Present if dma operations are coherent |
17 | - mac-address: See ethernet.txt in the same directory | 105 | - mac-address: See ethernet.txt in the same directory |
18 | - local-mac-address: See ethernet.txt in the same directory | 106 | - local-mac-address: See ethernet.txt in the same directory |
107 | - phy-reset-gpios: Phandle and specifier for any GPIO used to reset the PHY. | ||
108 | See ../gpio/gpio.txt. | ||
19 | - snps,en-lpi: If present it enables use of the AXI low-power interface | 109 | - snps,en-lpi: If present it enables use of the AXI low-power interface |
20 | - snps,write-requests: Number of write requests that the AXI port can issue. | 110 | - snps,write-requests: Number of write requests that the AXI port can issue. |
21 | It depends on the SoC configuration. | 111 | It depends on the SoC configuration. |
@@ -52,6 +142,7 @@ ethernet2@40010000 { | |||
52 | reg = <0x40010000 0x4000>; | 142 | reg = <0x40010000 0x4000>; |
53 | phy-handle = <&phy2>; | 143 | phy-handle = <&phy2>; |
54 | phy-mode = "gmii"; | 144 | phy-mode = "gmii"; |
145 | phy-reset-gpios = <&gpioctlr 43 GPIO_ACTIVE_LOW>; | ||
55 | 146 | ||
56 | snps,en-tx-lpi-clockgating; | 147 | snps,en-tx-lpi-clockgating; |
57 | snps,en-lpi; | 148 | snps,en-lpi; |
diff --git a/Documentation/devicetree/bindings/net/wireless/esp,esp8089.txt b/Documentation/devicetree/bindings/net/wireless/esp,esp8089.txt new file mode 100644 index 000000000000..19331bb4ff6e --- /dev/null +++ b/Documentation/devicetree/bindings/net/wireless/esp,esp8089.txt | |||
@@ -0,0 +1,31 @@ | |||
1 | Espressif ESP8089 wireless SDIO devices | ||
2 | |||
3 | This node provides properties for controlling the ESP8089 wireless device. | ||
4 | The node is expected to be specified as a child node to the SDIO controller | ||
5 | that connects the device to the system. | ||
6 | |||
7 | Required properties: | ||
8 | |||
9 | - compatible : Should be "esp,esp8089". | ||
10 | |||
11 | Optional properties: | ||
12 | - esp,crystal-26M-en: Integer value for the crystal_26M_en firmware parameter | ||
13 | |||
14 | Example: | ||
15 | |||
16 | &mmc1 { | ||
17 | #address-cells = <1>; | ||
18 | #size-cells = <0>; | ||
19 | |||
20 | vmmc-supply = <®_dldo1>; | ||
21 | mmc-pwrseq = <&wifi_pwrseq>; | ||
22 | bus-width = <4>; | ||
23 | non-removable; | ||
24 | status = "okay"; | ||
25 | |||
26 | esp8089: sdio_wifi@1 { | ||
27 | compatible = "esp,esp8089"; | ||
28 | reg = <1>; | ||
29 | esp,crystal-26M-en = <2>; | ||
30 | }; | ||
31 | }; | ||
diff --git a/Documentation/devicetree/bindings/pci/axis,artpec6-pcie.txt b/Documentation/devicetree/bindings/pci/axis,artpec6-pcie.txt index 330a45b5f0b5..5ecaea1e6eee 100644 --- a/Documentation/devicetree/bindings/pci/axis,artpec6-pcie.txt +++ b/Documentation/devicetree/bindings/pci/axis,artpec6-pcie.txt | |||
@@ -24,16 +24,17 @@ Example: | |||
24 | compatible = "axis,artpec6-pcie", "snps,dw-pcie"; | 24 | compatible = "axis,artpec6-pcie", "snps,dw-pcie"; |
25 | reg = <0xf8050000 0x2000 | 25 | reg = <0xf8050000 0x2000 |
26 | 0xf8040000 0x1000 | 26 | 0xf8040000 0x1000 |
27 | 0xc0000000 0x1000>; | 27 | 0xc0000000 0x2000>; |
28 | reg-names = "dbi", "phy", "config"; | 28 | reg-names = "dbi", "phy", "config"; |
29 | #address-cells = <3>; | 29 | #address-cells = <3>; |
30 | #size-cells = <2>; | 30 | #size-cells = <2>; |
31 | device_type = "pci"; | 31 | device_type = "pci"; |
32 | /* downstream I/O */ | 32 | /* downstream I/O */ |
33 | ranges = <0x81000000 0 0x00010000 0xc0010000 0 0x00010000 | 33 | ranges = <0x81000000 0 0 0xc0002000 0 0x00010000 |
34 | /* non-prefetchable memory */ | 34 | /* non-prefetchable memory */ |
35 | 0x82000000 0 0xc0020000 0xc0020000 0 0x1ffe0000>; | 35 | 0x82000000 0 0xc0012000 0xc0012000 0 0x1ffee000>; |
36 | num-lanes = <2>; | 36 | num-lanes = <2>; |
37 | bus-range = <0x00 0xff>; | ||
37 | interrupts = <GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>; | 38 | interrupts = <GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>; |
38 | interrupt-names = "msi"; | 39 | interrupt-names = "msi"; |
39 | #interrupt-cells = <1>; | 40 | #interrupt-cells = <1>; |
diff --git a/Documentation/devicetree/bindings/pci/xilinx-nwl-pcie.txt b/Documentation/devicetree/bindings/pci/xilinx-nwl-pcie.txt index 337fc97d18c9..3259798a1192 100644 --- a/Documentation/devicetree/bindings/pci/xilinx-nwl-pcie.txt +++ b/Documentation/devicetree/bindings/pci/xilinx-nwl-pcie.txt | |||
@@ -55,9 +55,10 @@ nwl_pcie: pcie@fd0e0000 { | |||
55 | msi-parent = <&nwl_pcie>; | 55 | msi-parent = <&nwl_pcie>; |
56 | reg = <0x0 0xfd0e0000 0x0 0x1000>, | 56 | reg = <0x0 0xfd0e0000 0x0 0x1000>, |
57 | <0x0 0xfd480000 0x0 0x1000>, | 57 | <0x0 0xfd480000 0x0 0x1000>, |
58 | <0x0 0xe0000000 0x0 0x1000000>; | 58 | <0x80 0x00000000 0x0 0x1000000>; |
59 | reg-names = "breg", "pcireg", "cfg"; | 59 | reg-names = "breg", "pcireg", "cfg"; |
60 | ranges = <0x02000000 0x00000000 0xe1000000 0x00000000 0xe1000000 0 0x0f000000>; | 60 | ranges = <0x02000000 0x00000000 0xe0000000 0x00000000 0xe0000000 0x00000000 0x10000000 /* non-prefetchable memory */ |
61 | 0x43000000 0x00000006 0x00000000 0x00000006 0x00000000 0x00000002 0x00000000>;/* prefetchable memory */ | ||
61 | 62 | ||
62 | pcie_intc: legacy-interrupt-controller { | 63 | pcie_intc: legacy-interrupt-controller { |
63 | interrupt-controller; | 64 | interrupt-controller; |
diff --git a/Documentation/devicetree/bindings/spi/spi-bus.txt b/Documentation/devicetree/bindings/spi/spi-bus.txt index 17822860cb98..4b1d6e74c744 100644 --- a/Documentation/devicetree/bindings/spi/spi-bus.txt +++ b/Documentation/devicetree/bindings/spi/spi-bus.txt | |||
@@ -31,7 +31,7 @@ with max(cs-gpios > hw cs). | |||
31 | So if for example the controller has 2 CS lines, and the cs-gpios | 31 | So if for example the controller has 2 CS lines, and the cs-gpios |
32 | property looks like this: | 32 | property looks like this: |
33 | 33 | ||
34 | cs-gpios = <&gpio1 0 0> <0> <&gpio1 1 0> <&gpio1 2 0>; | 34 | cs-gpios = <&gpio1 0 0>, <0>, <&gpio1 1 0>, <&gpio1 2 0>; |
35 | 35 | ||
36 | Then it should be configured so that num_chipselect = 4 with the | 36 | Then it should be configured so that num_chipselect = 4 with the |
37 | following mapping: | 37 | following mapping: |
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt index 1992aa97d45a..851e2caf9ae0 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.txt +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt | |||
@@ -3,8 +3,8 @@ Device tree binding vendor prefix registry. Keep list in alphabetical order. | |||
3 | This isn't an exhaustive list, but you should add new prefixes to it before | 3 | This isn't an exhaustive list, but you should add new prefixes to it before |
4 | using them to avoid name-space collisions. | 4 | using them to avoid name-space collisions. |
5 | 5 | ||
6 | abilis Abilis Systems | ||
7 | abcn Abracon Corporation | 6 | abcn Abracon Corporation |
7 | abilis Abilis Systems | ||
8 | active-semi Active-Semi International Inc | 8 | active-semi Active-Semi International Inc |
9 | ad Avionic Design GmbH | 9 | ad Avionic Design GmbH |
10 | adapteva Adapteva, Inc. | 10 | adapteva Adapteva, Inc. |
@@ -36,6 +36,7 @@ aspeed ASPEED Technology Inc. | |||
36 | atlas Atlas Scientific LLC | 36 | atlas Atlas Scientific LLC |
37 | atmel Atmel Corporation | 37 | atmel Atmel Corporation |
38 | auo AU Optronics Corporation | 38 | auo AU Optronics Corporation |
39 | auvidea Auvidea GmbH | ||
39 | avago Avago Technologies | 40 | avago Avago Technologies |
40 | avic Shanghai AVIC Optoelectronics Co., Ltd. | 41 | avic Shanghai AVIC Optoelectronics Co., Ltd. |
41 | axis Axis Communications AB | 42 | axis Axis Communications AB |
@@ -85,6 +86,7 @@ elan Elan Microelectronic Corp. | |||
85 | embest Shenzhen Embest Technology Co., Ltd. | 86 | embest Shenzhen Embest Technology Co., Ltd. |
86 | emmicro EM Microelectronic | 87 | emmicro EM Microelectronic |
87 | energymicro Silicon Laboratories (formerly Energy Micro AS) | 88 | energymicro Silicon Laboratories (formerly Energy Micro AS) |
89 | engicam Engicam S.r.l. | ||
88 | epcos EPCOS AG | 90 | epcos EPCOS AG |
89 | epfl Ecole Polytechnique Fédérale de Lausanne | 91 | epfl Ecole Polytechnique Fédérale de Lausanne |
90 | epson Seiko Epson Corp. | 92 | epson Seiko Epson Corp. |
@@ -101,8 +103,8 @@ focaltech FocalTech Systems Co.,Ltd | |||
101 | fsl Freescale Semiconductor | 103 | fsl Freescale Semiconductor |
102 | ge General Electric Company | 104 | ge General Electric Company |
103 | geekbuying GeekBuying | 105 | geekbuying GeekBuying |
104 | GEFanuc GE Fanuc Intelligent Platforms Embedded Systems, Inc. | ||
105 | gef GE Fanuc Intelligent Platforms Embedded Systems, Inc. | 106 | gef GE Fanuc Intelligent Platforms Embedded Systems, Inc. |
107 | GEFanuc GE Fanuc Intelligent Platforms Embedded Systems, Inc. | ||
106 | geniatech Geniatech, Inc. | 108 | geniatech Geniatech, Inc. |
107 | giantplus Giantplus Technology Co., Ltd. | 109 | giantplus Giantplus Technology Co., Ltd. |
108 | globalscale Globalscale Technologies, Inc. | 110 | globalscale Globalscale Technologies, Inc. |
@@ -126,7 +128,6 @@ i2se I2SE GmbH | |||
126 | ibm International Business Machines (IBM) | 128 | ibm International Business Machines (IBM) |
127 | idt Integrated Device Technologies, Inc. | 129 | idt Integrated Device Technologies, Inc. |
128 | ifi Ingenieurburo Fur Ic-Technologie (I/F/I) | 130 | ifi Ingenieurburo Fur Ic-Technologie (I/F/I) |
129 | iom Iomega Corporation | ||
130 | img Imagination Technologies Ltd. | 131 | img Imagination Technologies Ltd. |
131 | infineon Infineon Technologies | 132 | infineon Infineon Technologies |
132 | inforce Inforce Computing | 133 | inforce Inforce Computing |
@@ -135,11 +136,14 @@ innolux Innolux Corporation | |||
135 | intel Intel Corporation | 136 | intel Intel Corporation |
136 | intercontrol Inter Control Group | 137 | intercontrol Inter Control Group |
137 | invensense InvenSense Inc. | 138 | invensense InvenSense Inc. |
139 | iom Iomega Corporation | ||
138 | isee ISEE 2007 S.L. | 140 | isee ISEE 2007 S.L. |
139 | isil Intersil | 141 | isil Intersil |
140 | issi Integrated Silicon Solutions Inc. | 142 | issi Integrated Silicon Solutions Inc. |
143 | jdi Japan Display Inc. | ||
141 | jedec JEDEC Solid State Technology Association | 144 | jedec JEDEC Solid State Technology Association |
142 | karo Ka-Ro electronics GmbH | 145 | karo Ka-Ro electronics GmbH |
146 | keithkoep Keith & Koep GmbH | ||
143 | keymile Keymile GmbH | 147 | keymile Keymile GmbH |
144 | kinetic Kinetic Technologies | 148 | kinetic Kinetic Technologies |
145 | kosagi Sutajio Ko-Usagi PTE Ltd. | 149 | kosagi Sutajio Ko-Usagi PTE Ltd. |
@@ -149,8 +153,8 @@ lantiq Lantiq Semiconductor | |||
149 | lenovo Lenovo Group Ltd. | 153 | lenovo Lenovo Group Ltd. |
150 | lg LG Corporation | 154 | lg LG Corporation |
151 | linux Linux-specific binding | 155 | linux Linux-specific binding |
152 | lsi LSI Corp. (LSI Logic) | ||
153 | lltc Linear Technology Corporation | 156 | lltc Linear Technology Corporation |
157 | lsi LSI Corp. (LSI Logic) | ||
154 | marvell Marvell Technology Group Ltd. | 158 | marvell Marvell Technology Group Ltd. |
155 | maxim Maxim Integrated Products | 159 | maxim Maxim Integrated Products |
156 | meas Measurement Specialties | 160 | meas Measurement Specialties |
@@ -190,20 +194,20 @@ onnn ON Semiconductor Corp. | |||
190 | ontat On Tat Industrial Company | 194 | ontat On Tat Industrial Company |
191 | opencores OpenCores.org | 195 | opencores OpenCores.org |
192 | option Option NV | 196 | option Option NV |
197 | ORCL Oracle Corporation | ||
193 | ortustech Ortus Technology Co., Ltd. | 198 | ortustech Ortus Technology Co., Ltd. |
194 | ovti OmniVision Technologies | 199 | ovti OmniVision Technologies |
195 | ORCL Oracle Corporation | ||
196 | oxsemi Oxford Semiconductor, Ltd. | 200 | oxsemi Oxford Semiconductor, Ltd. |
197 | panasonic Panasonic Corporation | 201 | panasonic Panasonic Corporation |
198 | parade Parade Technologies Inc. | 202 | parade Parade Technologies Inc. |
199 | pericom Pericom Technology Inc. | 203 | pericom Pericom Technology Inc. |
200 | phytec PHYTEC Messtechnik GmbH | 204 | phytec PHYTEC Messtechnik GmbH |
201 | picochip Picochip Ltd | 205 | picochip Picochip Ltd |
206 | pixcir PIXCIR MICROELECTRONICS Co., Ltd | ||
202 | plathome Plat'Home Co., Ltd. | 207 | plathome Plat'Home Co., Ltd. |
203 | plda PLDA | 208 | plda PLDA |
204 | pixcir PIXCIR MICROELECTRONICS Co., Ltd | ||
205 | pulsedlight PulsedLight, Inc | ||
206 | powervr PowerVR (deprecated, use img) | 209 | powervr PowerVR (deprecated, use img) |
210 | pulsedlight PulsedLight, Inc | ||
207 | qca Qualcomm Atheros, Inc. | 211 | qca Qualcomm Atheros, Inc. |
208 | qcom Qualcomm Technologies, Inc | 212 | qcom Qualcomm Technologies, Inc |
209 | qemu QEMU, a generic and open source machine emulator and virtualizer | 213 | qemu QEMU, a generic and open source machine emulator and virtualizer |
@@ -231,12 +235,13 @@ sgx SGX Sensortech | |||
231 | sharp Sharp Corporation | 235 | sharp Sharp Corporation |
232 | si-en Si-En Technology Ltd. | 236 | si-en Si-En Technology Ltd. |
233 | sigma Sigma Designs, Inc. | 237 | sigma Sigma Designs, Inc. |
238 | sii Seiko Instruments, Inc. | ||
234 | sil Silicon Image | 239 | sil Silicon Image |
235 | silabs Silicon Laboratories | 240 | silabs Silicon Laboratories |
241 | silead Silead Inc. | ||
242 | silergy Silergy Corp. | ||
236 | siliconmitus Silicon Mitus, Inc. | 243 | siliconmitus Silicon Mitus, Inc. |
237 | simtek | 244 | simtek |
238 | sii Seiko Instruments, Inc. | ||
239 | silergy Silergy Corp. | ||
240 | sirf SiRF Technology, Inc. | 245 | sirf SiRF Technology, Inc. |
241 | sis Silicon Integrated Systems Corp. | 246 | sis Silicon Integrated Systems Corp. |
242 | sitronix Sitronix Technology Corporation | 247 | sitronix Sitronix Technology Corporation |
@@ -254,9 +259,12 @@ starry Starry Electronic Technology (ShenZhen) Co., LTD | |||
254 | startek Startek | 259 | startek Startek |
255 | ste ST-Ericsson | 260 | ste ST-Ericsson |
256 | stericsson ST-Ericsson | 261 | stericsson ST-Ericsson |
262 | summit Summit microelectronics | ||
263 | sunchip Shenzhen Sunchip Technology Co., Ltd | ||
264 | SUNW Sun Microsystems, Inc | ||
265 | swir Sierra Wireless | ||
257 | syna Synaptics Inc. | 266 | syna Synaptics Inc. |
258 | synology Synology, Inc. | 267 | synology Synology, Inc. |
259 | SUNW Sun Microsystems, Inc | ||
260 | tbs TBS Technologies | 268 | tbs TBS Technologies |
261 | tcg Trusted Computing Group | 269 | tcg Trusted Computing Group |
262 | tcl Toby Churchill Ltd. | 270 | tcl Toby Churchill Ltd. |
@@ -265,17 +273,18 @@ technologic Technologic Systems | |||
265 | thine THine Electronics, Inc. | 273 | thine THine Electronics, Inc. |
266 | ti Texas Instruments | 274 | ti Texas Instruments |
267 | tlm Trusted Logic Mobility | 275 | tlm Trusted Logic Mobility |
276 | topeet Topeet | ||
268 | toradex Toradex AG | 277 | toradex Toradex AG |
269 | toshiba Toshiba Corporation | 278 | toshiba Toshiba Corporation |
270 | toumaz Toumaz | 279 | toumaz Toumaz |
271 | tplink TP-LINK Technologies Co., Ltd. | ||
272 | tpk TPK U.S.A. LLC | 280 | tpk TPK U.S.A. LLC |
281 | tplink TP-LINK Technologies Co., Ltd. | ||
273 | tronfy Tronfy | 282 | tronfy Tronfy |
274 | tronsmart Tronsmart | 283 | tronsmart Tronsmart |
275 | truly Truly Semiconductors Limited | 284 | truly Truly Semiconductors Limited |
276 | tyan Tyan Computer Corporation | 285 | tyan Tyan Computer Corporation |
277 | upisemi uPI Semiconductor Corp. | ||
278 | uniwest United Western Technologies Corp (UniWest) | 286 | uniwest United Western Technologies Corp (UniWest) |
287 | upisemi uPI Semiconductor Corp. | ||
279 | urt United Radiant Technology Corporation | 288 | urt United Radiant Technology Corporation |
280 | usi Universal Scientific Industrial Co., Ltd. | 289 | usi Universal Scientific Industrial Co., Ltd. |
281 | v3 V3 Semiconductor | 290 | v3 V3 Semiconductor |
@@ -293,7 +302,7 @@ x-powers X-Powers | |||
293 | xes Extreme Engineering Solutions (X-ES) | 302 | xes Extreme Engineering Solutions (X-ES) |
294 | xillybus Xillybus Ltd. | 303 | xillybus Xillybus Ltd. |
295 | xlnx Xilinx | 304 | xlnx Xilinx |
296 | zyxel ZyXEL Communications Corp. | ||
297 | zarlink Zarlink Semiconductor | 305 | zarlink Zarlink Semiconductor |
298 | zii Zodiac Inflight Innovations | 306 | zii Zodiac Inflight Innovations |
299 | zte ZTE Corp. | 307 | zte ZTE Corp. |
308 | zyxel ZyXEL Communications Corp. | ||
diff --git a/Documentation/devicetree/changesets.txt b/Documentation/devicetree/changesets.txt index 935ba5acc34e..cb488eeb6353 100644 --- a/Documentation/devicetree/changesets.txt +++ b/Documentation/devicetree/changesets.txt | |||
@@ -21,20 +21,11 @@ a set of changes. No changes to the active tree are made at this point. | |||
21 | All the change operations are recorded in the of_changeset 'entries' | 21 | All the change operations are recorded in the of_changeset 'entries' |
22 | list. | 22 | list. |
23 | 23 | ||
24 | 3. mutex_lock(of_mutex) - starts a changeset; The global of_mutex | 24 | 3. of_changeset_apply() - Apply the changes to the tree. Either the |
25 | ensures there can only be one editor at a time. | ||
26 | |||
27 | 4. of_changeset_apply() - Apply the changes to the tree. Either the | ||
28 | entire changeset will get applied, or if there is an error the tree will | 25 | entire changeset will get applied, or if there is an error the tree will |
29 | be restored to the previous state | 26 | be restored to the previous state. The core ensures proper serialization |
30 | 27 | through locking. An unlocked version __of_changeset_apply is available, | |
31 | 5. mutex_unlock(of_mutex) - All operations complete, release the mutex | 28 | if needed. |
32 | 29 | ||
33 | If a successfully applied changeset needs to be removed, it can be done | 30 | If a successfully applied changeset needs to be removed, it can be done |
34 | with the following sequence. | 31 | with of_changeset_revert(). |
35 | |||
36 | 1. mutex_lock(of_mutex) | ||
37 | |||
38 | 2. of_changeset_revert() | ||
39 | |||
40 | 3. mutex_unlock(of_mutex) | ||
diff --git a/drivers/of/base.c b/drivers/of/base.c index 3ce69536a7b3..a0bccb54a9bd 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c | |||
@@ -1146,16 +1146,18 @@ EXPORT_SYMBOL_GPL(of_property_count_elems_of_size); | |||
1146 | * | 1146 | * |
1147 | * @np: device node from which the property value is to be read. | 1147 | * @np: device node from which the property value is to be read. |
1148 | * @propname: name of the property to be searched. | 1148 | * @propname: name of the property to be searched. |
1149 | * @len: requested length of property value | 1149 | * @min: minimum allowed length of property value |
1150 | * @max: maximum allowed length of property value (0 means unlimited) | ||
1151 | * @len: if !=NULL, actual length is written to here | ||
1150 | * | 1152 | * |
1151 | * Search for a property in a device node and valid the requested size. | 1153 | * Search for a property in a device node and valid the requested size. |
1152 | * Returns the property value on success, -EINVAL if the property does not | 1154 | * Returns the property value on success, -EINVAL if the property does not |
1153 | * exist, -ENODATA if property does not have a value, and -EOVERFLOW if the | 1155 | * exist, -ENODATA if property does not have a value, and -EOVERFLOW if the |
1154 | * property data isn't large enough. | 1156 | * property data is too small or too large. |
1155 | * | 1157 | * |
1156 | */ | 1158 | */ |
1157 | static void *of_find_property_value_of_size(const struct device_node *np, | 1159 | static void *of_find_property_value_of_size(const struct device_node *np, |
1158 | const char *propname, u32 len) | 1160 | const char *propname, u32 min, u32 max, size_t *len) |
1159 | { | 1161 | { |
1160 | struct property *prop = of_find_property(np, propname, NULL); | 1162 | struct property *prop = of_find_property(np, propname, NULL); |
1161 | 1163 | ||
@@ -1163,9 +1165,14 @@ static void *of_find_property_value_of_size(const struct device_node *np, | |||
1163 | return ERR_PTR(-EINVAL); | 1165 | return ERR_PTR(-EINVAL); |
1164 | if (!prop->value) | 1166 | if (!prop->value) |
1165 | return ERR_PTR(-ENODATA); | 1167 | return ERR_PTR(-ENODATA); |
1166 | if (len > prop->length) | 1168 | if (prop->length < min) |
1169 | return ERR_PTR(-EOVERFLOW); | ||
1170 | if (max && prop->length > max) | ||
1167 | return ERR_PTR(-EOVERFLOW); | 1171 | return ERR_PTR(-EOVERFLOW); |
1168 | 1172 | ||
1173 | if (len) | ||
1174 | *len = prop->length; | ||
1175 | |||
1169 | return prop->value; | 1176 | return prop->value; |
1170 | } | 1177 | } |
1171 | 1178 | ||
@@ -1189,7 +1196,9 @@ int of_property_read_u32_index(const struct device_node *np, | |||
1189 | u32 index, u32 *out_value) | 1196 | u32 index, u32 *out_value) |
1190 | { | 1197 | { |
1191 | const u32 *val = of_find_property_value_of_size(np, propname, | 1198 | const u32 *val = of_find_property_value_of_size(np, propname, |
1192 | ((index + 1) * sizeof(*out_value))); | 1199 | ((index + 1) * sizeof(*out_value)), |
1200 | 0, | ||
1201 | NULL); | ||
1193 | 1202 | ||
1194 | if (IS_ERR(val)) | 1203 | if (IS_ERR(val)) |
1195 | return PTR_ERR(val); | 1204 | return PTR_ERR(val); |
@@ -1200,102 +1209,145 @@ int of_property_read_u32_index(const struct device_node *np, | |||
1200 | EXPORT_SYMBOL_GPL(of_property_read_u32_index); | 1209 | EXPORT_SYMBOL_GPL(of_property_read_u32_index); |
1201 | 1210 | ||
1202 | /** | 1211 | /** |
1203 | * of_property_read_u8_array - Find and read an array of u8 from a property. | 1212 | * of_property_read_variable_u8_array - Find and read an array of u8 from a |
1213 | * property, with bounds on the minimum and maximum array size. | ||
1204 | * | 1214 | * |
1205 | * @np: device node from which the property value is to be read. | 1215 | * @np: device node from which the property value is to be read. |
1206 | * @propname: name of the property to be searched. | 1216 | * @propname: name of the property to be searched. |
1207 | * @out_values: pointer to return value, modified only if return value is 0. | 1217 | * @out_values: pointer to return value, modified only if return value is 0. |
1208 | * @sz: number of array elements to read | 1218 | * @sz_min: minimum number of array elements to read |
1219 | * @sz_max: maximum number of array elements to read, if zero there is no | ||
1220 | * upper limit on the number of elements in the dts entry but only | ||
1221 | * sz_min will be read. | ||
1209 | * | 1222 | * |
1210 | * Search for a property in a device node and read 8-bit value(s) from | 1223 | * Search for a property in a device node and read 8-bit value(s) from |
1211 | * it. Returns 0 on success, -EINVAL if the property does not exist, | 1224 | * it. Returns number of elements read on success, -EINVAL if the property |
1212 | * -ENODATA if property does not have a value, and -EOVERFLOW if the | 1225 | * does not exist, -ENODATA if property does not have a value, and -EOVERFLOW |
1213 | * property data isn't large enough. | 1226 | * if the property data is smaller than sz_min or longer than sz_max. |
1214 | * | 1227 | * |
1215 | * dts entry of array should be like: | 1228 | * dts entry of array should be like: |
1216 | * property = /bits/ 8 <0x50 0x60 0x70>; | 1229 | * property = /bits/ 8 <0x50 0x60 0x70>; |
1217 | * | 1230 | * |
1218 | * The out_values is modified only if a valid u8 value can be decoded. | 1231 | * The out_values is modified only if a valid u8 value can be decoded. |
1219 | */ | 1232 | */ |
1220 | int of_property_read_u8_array(const struct device_node *np, | 1233 | int of_property_read_variable_u8_array(const struct device_node *np, |
1221 | const char *propname, u8 *out_values, size_t sz) | 1234 | const char *propname, u8 *out_values, |
1235 | size_t sz_min, size_t sz_max) | ||
1222 | { | 1236 | { |
1237 | size_t sz, count; | ||
1223 | const u8 *val = of_find_property_value_of_size(np, propname, | 1238 | const u8 *val = of_find_property_value_of_size(np, propname, |
1224 | (sz * sizeof(*out_values))); | 1239 | (sz_min * sizeof(*out_values)), |
1240 | (sz_max * sizeof(*out_values)), | ||
1241 | &sz); | ||
1225 | 1242 | ||
1226 | if (IS_ERR(val)) | 1243 | if (IS_ERR(val)) |
1227 | return PTR_ERR(val); | 1244 | return PTR_ERR(val); |
1228 | 1245 | ||
1229 | while (sz--) | 1246 | if (!sz_max) |
1247 | sz = sz_min; | ||
1248 | else | ||
1249 | sz /= sizeof(*out_values); | ||
1250 | |||
1251 | count = sz; | ||
1252 | while (count--) | ||
1230 | *out_values++ = *val++; | 1253 | *out_values++ = *val++; |
1231 | return 0; | 1254 | |
1255 | return sz; | ||
1232 | } | 1256 | } |
1233 | EXPORT_SYMBOL_GPL(of_property_read_u8_array); | 1257 | EXPORT_SYMBOL_GPL(of_property_read_variable_u8_array); |
1234 | 1258 | ||
1235 | /** | 1259 | /** |
1236 | * of_property_read_u16_array - Find and read an array of u16 from a property. | 1260 | * of_property_read_variable_u16_array - Find and read an array of u16 from a |
1261 | * property, with bounds on the minimum and maximum array size. | ||
1237 | * | 1262 | * |
1238 | * @np: device node from which the property value is to be read. | 1263 | * @np: device node from which the property value is to be read. |
1239 | * @propname: name of the property to be searched. | 1264 | * @propname: name of the property to be searched. |
1240 | * @out_values: pointer to return value, modified only if return value is 0. | 1265 | * @out_values: pointer to return value, modified only if return value is 0. |
1241 | * @sz: number of array elements to read | 1266 | * @sz_min: minimum number of array elements to read |
1267 | * @sz_max: maximum number of array elements to read, if zero there is no | ||
1268 | * upper limit on the number of elements in the dts entry but only | ||
1269 | * sz_min will be read. | ||
1242 | * | 1270 | * |
1243 | * Search for a property in a device node and read 16-bit value(s) from | 1271 | * Search for a property in a device node and read 16-bit value(s) from |
1244 | * it. Returns 0 on success, -EINVAL if the property does not exist, | 1272 | * it. Returns number of elements read on success, -EINVAL if the property |
1245 | * -ENODATA if property does not have a value, and -EOVERFLOW if the | 1273 | * does not exist, -ENODATA if property does not have a value, and -EOVERFLOW |
1246 | * property data isn't large enough. | 1274 | * if the property data is smaller than sz_min or longer than sz_max. |
1247 | * | 1275 | * |
1248 | * dts entry of array should be like: | 1276 | * dts entry of array should be like: |
1249 | * property = /bits/ 16 <0x5000 0x6000 0x7000>; | 1277 | * property = /bits/ 16 <0x5000 0x6000 0x7000>; |
1250 | * | 1278 | * |
1251 | * The out_values is modified only if a valid u16 value can be decoded. | 1279 | * The out_values is modified only if a valid u16 value can be decoded. |
1252 | */ | 1280 | */ |
1253 | int of_property_read_u16_array(const struct device_node *np, | 1281 | int of_property_read_variable_u16_array(const struct device_node *np, |
1254 | const char *propname, u16 *out_values, size_t sz) | 1282 | const char *propname, u16 *out_values, |
1283 | size_t sz_min, size_t sz_max) | ||
1255 | { | 1284 | { |
1285 | size_t sz, count; | ||
1256 | const __be16 *val = of_find_property_value_of_size(np, propname, | 1286 | const __be16 *val = of_find_property_value_of_size(np, propname, |
1257 | (sz * sizeof(*out_values))); | 1287 | (sz_min * sizeof(*out_values)), |
1288 | (sz_max * sizeof(*out_values)), | ||
1289 | &sz); | ||
1258 | 1290 | ||
1259 | if (IS_ERR(val)) | 1291 | if (IS_ERR(val)) |
1260 | return PTR_ERR(val); | 1292 | return PTR_ERR(val); |
1261 | 1293 | ||
1262 | while (sz--) | 1294 | if (!sz_max) |
1295 | sz = sz_min; | ||
1296 | else | ||
1297 | sz /= sizeof(*out_values); | ||
1298 | |||
1299 | count = sz; | ||
1300 | while (count--) | ||
1263 | *out_values++ = be16_to_cpup(val++); | 1301 | *out_values++ = be16_to_cpup(val++); |
1264 | return 0; | 1302 | |
1303 | return sz; | ||
1265 | } | 1304 | } |
1266 | EXPORT_SYMBOL_GPL(of_property_read_u16_array); | 1305 | EXPORT_SYMBOL_GPL(of_property_read_variable_u16_array); |
1267 | 1306 | ||
1268 | /** | 1307 | /** |
1269 | * of_property_read_u32_array - Find and read an array of 32 bit integers | 1308 | * of_property_read_variable_u32_array - Find and read an array of 32 bit |
1270 | * from a property. | 1309 | * integers from a property, with bounds on the minimum and maximum array size. |
1271 | * | 1310 | * |
1272 | * @np: device node from which the property value is to be read. | 1311 | * @np: device node from which the property value is to be read. |
1273 | * @propname: name of the property to be searched. | 1312 | * @propname: name of the property to be searched. |
1274 | * @out_values: pointer to return value, modified only if return value is 0. | 1313 | * @out_values: pointer to return value, modified only if return value is 0. |
1275 | * @sz: number of array elements to read | 1314 | * @sz_min: minimum number of array elements to read |
1315 | * @sz_max: maximum number of array elements to read, if zero there is no | ||
1316 | * upper limit on the number of elements in the dts entry but only | ||
1317 | * sz_min will be read. | ||
1276 | * | 1318 | * |
1277 | * Search for a property in a device node and read 32-bit value(s) from | 1319 | * Search for a property in a device node and read 32-bit value(s) from |
1278 | * it. Returns 0 on success, -EINVAL if the property does not exist, | 1320 | * it. Returns number of elements read on success, -EINVAL if the property |
1279 | * -ENODATA if property does not have a value, and -EOVERFLOW if the | 1321 | * does not exist, -ENODATA if property does not have a value, and -EOVERFLOW |
1280 | * property data isn't large enough. | 1322 | * if the property data is smaller than sz_min or longer than sz_max. |
1281 | * | 1323 | * |
1282 | * The out_values is modified only if a valid u32 value can be decoded. | 1324 | * The out_values is modified only if a valid u32 value can be decoded. |
1283 | */ | 1325 | */ |
1284 | int of_property_read_u32_array(const struct device_node *np, | 1326 | int of_property_read_variable_u32_array(const struct device_node *np, |
1285 | const char *propname, u32 *out_values, | 1327 | const char *propname, u32 *out_values, |
1286 | size_t sz) | 1328 | size_t sz_min, size_t sz_max) |
1287 | { | 1329 | { |
1330 | size_t sz, count; | ||
1288 | const __be32 *val = of_find_property_value_of_size(np, propname, | 1331 | const __be32 *val = of_find_property_value_of_size(np, propname, |
1289 | (sz * sizeof(*out_values))); | 1332 | (sz_min * sizeof(*out_values)), |
1333 | (sz_max * sizeof(*out_values)), | ||
1334 | &sz); | ||
1290 | 1335 | ||
1291 | if (IS_ERR(val)) | 1336 | if (IS_ERR(val)) |
1292 | return PTR_ERR(val); | 1337 | return PTR_ERR(val); |
1293 | 1338 | ||
1294 | while (sz--) | 1339 | if (!sz_max) |
1340 | sz = sz_min; | ||
1341 | else | ||
1342 | sz /= sizeof(*out_values); | ||
1343 | |||
1344 | count = sz; | ||
1345 | while (count--) | ||
1295 | *out_values++ = be32_to_cpup(val++); | 1346 | *out_values++ = be32_to_cpup(val++); |
1296 | return 0; | 1347 | |
1348 | return sz; | ||
1297 | } | 1349 | } |
1298 | EXPORT_SYMBOL_GPL(of_property_read_u32_array); | 1350 | EXPORT_SYMBOL_GPL(of_property_read_variable_u32_array); |
1299 | 1351 | ||
1300 | /** | 1352 | /** |
1301 | * of_property_read_u64 - Find and read a 64 bit integer from a property | 1353 | * of_property_read_u64 - Find and read a 64 bit integer from a property |
@@ -1314,7 +1366,9 @@ int of_property_read_u64(const struct device_node *np, const char *propname, | |||
1314 | u64 *out_value) | 1366 | u64 *out_value) |
1315 | { | 1367 | { |
1316 | const __be32 *val = of_find_property_value_of_size(np, propname, | 1368 | const __be32 *val = of_find_property_value_of_size(np, propname, |
1317 | sizeof(*out_value)); | 1369 | sizeof(*out_value), |
1370 | 0, | ||
1371 | NULL); | ||
1318 | 1372 | ||
1319 | if (IS_ERR(val)) | 1373 | if (IS_ERR(val)) |
1320 | return PTR_ERR(val); | 1374 | return PTR_ERR(val); |
@@ -1325,38 +1379,51 @@ int of_property_read_u64(const struct device_node *np, const char *propname, | |||
1325 | EXPORT_SYMBOL_GPL(of_property_read_u64); | 1379 | EXPORT_SYMBOL_GPL(of_property_read_u64); |
1326 | 1380 | ||
1327 | /** | 1381 | /** |
1328 | * of_property_read_u64_array - Find and read an array of 64 bit integers | 1382 | * of_property_read_variable_u64_array - Find and read an array of 64 bit |
1329 | * from a property. | 1383 | * integers from a property, with bounds on the minimum and maximum array size. |
1330 | * | 1384 | * |
1331 | * @np: device node from which the property value is to be read. | 1385 | * @np: device node from which the property value is to be read. |
1332 | * @propname: name of the property to be searched. | 1386 | * @propname: name of the property to be searched. |
1333 | * @out_values: pointer to return value, modified only if return value is 0. | 1387 | * @out_values: pointer to return value, modified only if return value is 0. |
1334 | * @sz: number of array elements to read | 1388 | * @sz_min: minimum number of array elements to read |
1389 | * @sz_max: maximum number of array elements to read, if zero there is no | ||
1390 | * upper limit on the number of elements in the dts entry but only | ||
1391 | * sz_min will be read. | ||
1335 | * | 1392 | * |
1336 | * Search for a property in a device node and read 64-bit value(s) from | 1393 | * Search for a property in a device node and read 64-bit value(s) from |
1337 | * it. Returns 0 on success, -EINVAL if the property does not exist, | 1394 | * it. Returns number of elements read on success, -EINVAL if the property |
1338 | * -ENODATA if property does not have a value, and -EOVERFLOW if the | 1395 | * does not exist, -ENODATA if property does not have a value, and -EOVERFLOW |
1339 | * property data isn't large enough. | 1396 | * if the property data is smaller than sz_min or longer than sz_max. |
1340 | * | 1397 | * |
1341 | * The out_values is modified only if a valid u64 value can be decoded. | 1398 | * The out_values is modified only if a valid u64 value can be decoded. |
1342 | */ | 1399 | */ |
1343 | int of_property_read_u64_array(const struct device_node *np, | 1400 | int of_property_read_variable_u64_array(const struct device_node *np, |
1344 | const char *propname, u64 *out_values, | 1401 | const char *propname, u64 *out_values, |
1345 | size_t sz) | 1402 | size_t sz_min, size_t sz_max) |
1346 | { | 1403 | { |
1404 | size_t sz, count; | ||
1347 | const __be32 *val = of_find_property_value_of_size(np, propname, | 1405 | const __be32 *val = of_find_property_value_of_size(np, propname, |
1348 | (sz * sizeof(*out_values))); | 1406 | (sz_min * sizeof(*out_values)), |
1407 | (sz_max * sizeof(*out_values)), | ||
1408 | &sz); | ||
1349 | 1409 | ||
1350 | if (IS_ERR(val)) | 1410 | if (IS_ERR(val)) |
1351 | return PTR_ERR(val); | 1411 | return PTR_ERR(val); |
1352 | 1412 | ||
1353 | while (sz--) { | 1413 | if (!sz_max) |
1414 | sz = sz_min; | ||
1415 | else | ||
1416 | sz /= sizeof(*out_values); | ||
1417 | |||
1418 | count = sz; | ||
1419 | while (count--) { | ||
1354 | *out_values++ = of_read_number(val, 2); | 1420 | *out_values++ = of_read_number(val, 2); |
1355 | val += 2; | 1421 | val += 2; |
1356 | } | 1422 | } |
1357 | return 0; | 1423 | |
1424 | return sz; | ||
1358 | } | 1425 | } |
1359 | EXPORT_SYMBOL_GPL(of_property_read_u64_array); | 1426 | EXPORT_SYMBOL_GPL(of_property_read_variable_u64_array); |
1360 | 1427 | ||
1361 | /** | 1428 | /** |
1362 | * of_property_read_string - Find and read a string from a property | 1429 | * of_property_read_string - Find and read a string from a property |
diff --git a/drivers/of/platform.c b/drivers/of/platform.c index f39ccd5aa701..f811d2796437 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c | |||
@@ -142,6 +142,7 @@ struct platform_device *of_device_alloc(struct device_node *np, | |||
142 | } | 142 | } |
143 | 143 | ||
144 | dev->dev.of_node = of_node_get(np); | 144 | dev->dev.of_node = of_node_get(np); |
145 | dev->dev.fwnode = &np->fwnode; | ||
145 | dev->dev.parent = parent ? : &platform_bus; | 146 | dev->dev.parent = parent ? : &platform_bus; |
146 | 147 | ||
147 | if (bus_id) | 148 | if (bus_id) |
@@ -241,6 +242,7 @@ static struct amba_device *of_amba_device_create(struct device_node *node, | |||
241 | 242 | ||
242 | /* setup generic device info */ | 243 | /* setup generic device info */ |
243 | dev->dev.of_node = of_node_get(node); | 244 | dev->dev.of_node = of_node_get(node); |
245 | dev->dev.fwnode = &node->fwnode; | ||
244 | dev->dev.parent = parent ? : &platform_bus; | 246 | dev->dev.parent = parent ? : &platform_bus; |
245 | dev->dev.platform_data = platform_data; | 247 | dev->dev.platform_data = platform_data; |
246 | if (bus_id) | 248 | if (bus_id) |
diff --git a/include/linux/of.h b/include/linux/of.h index 3d9ff8e9d803..299aeb192727 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
@@ -291,20 +291,24 @@ extern int of_property_count_elems_of_size(const struct device_node *np, | |||
291 | extern int of_property_read_u32_index(const struct device_node *np, | 291 | extern int of_property_read_u32_index(const struct device_node *np, |
292 | const char *propname, | 292 | const char *propname, |
293 | u32 index, u32 *out_value); | 293 | u32 index, u32 *out_value); |
294 | extern int of_property_read_u8_array(const struct device_node *np, | 294 | extern int of_property_read_variable_u8_array(const struct device_node *np, |
295 | const char *propname, u8 *out_values, size_t sz); | 295 | const char *propname, u8 *out_values, |
296 | extern int of_property_read_u16_array(const struct device_node *np, | 296 | size_t sz_min, size_t sz_max); |
297 | const char *propname, u16 *out_values, size_t sz); | 297 | extern int of_property_read_variable_u16_array(const struct device_node *np, |
298 | extern int of_property_read_u32_array(const struct device_node *np, | 298 | const char *propname, u16 *out_values, |
299 | const char *propname, | 299 | size_t sz_min, size_t sz_max); |
300 | u32 *out_values, | 300 | extern int of_property_read_variable_u32_array(const struct device_node *np, |
301 | size_t sz); | 301 | const char *propname, |
302 | u32 *out_values, | ||
303 | size_t sz_min, | ||
304 | size_t sz_max); | ||
302 | extern int of_property_read_u64(const struct device_node *np, | 305 | extern int of_property_read_u64(const struct device_node *np, |
303 | const char *propname, u64 *out_value); | 306 | const char *propname, u64 *out_value); |
304 | extern int of_property_read_u64_array(const struct device_node *np, | 307 | extern int of_property_read_variable_u64_array(const struct device_node *np, |
305 | const char *propname, | 308 | const char *propname, |
306 | u64 *out_values, | 309 | u64 *out_values, |
307 | size_t sz); | 310 | size_t sz_min, |
311 | size_t sz_max); | ||
308 | 312 | ||
309 | extern int of_property_read_string(const struct device_node *np, | 313 | extern int of_property_read_string(const struct device_node *np, |
310 | const char *propname, | 314 | const char *propname, |
@@ -380,6 +384,122 @@ extern int of_detach_node(struct device_node *); | |||
380 | 384 | ||
381 | #define of_match_ptr(_ptr) (_ptr) | 385 | #define of_match_ptr(_ptr) (_ptr) |
382 | 386 | ||
387 | /** | ||
388 | * of_property_read_u8_array - Find and read an array of u8 from a property. | ||
389 | * | ||
390 | * @np: device node from which the property value is to be read. | ||
391 | * @propname: name of the property to be searched. | ||
392 | * @out_values: pointer to return value, modified only if return value is 0. | ||
393 | * @sz: number of array elements to read | ||
394 | * | ||
395 | * Search for a property in a device node and read 8-bit value(s) from | ||
396 | * it. Returns 0 on success, -EINVAL if the property does not exist, | ||
397 | * -ENODATA if property does not have a value, and -EOVERFLOW if the | ||
398 | * property data isn't large enough. | ||
399 | * | ||
400 | * dts entry of array should be like: | ||
401 | * property = /bits/ 8 <0x50 0x60 0x70>; | ||
402 | * | ||
403 | * The out_values is modified only if a valid u8 value can be decoded. | ||
404 | */ | ||
405 | static inline int of_property_read_u8_array(const struct device_node *np, | ||
406 | const char *propname, | ||
407 | u8 *out_values, size_t sz) | ||
408 | { | ||
409 | int ret = of_property_read_variable_u8_array(np, propname, out_values, | ||
410 | sz, 0); | ||
411 | if (ret >= 0) | ||
412 | return 0; | ||
413 | else | ||
414 | return ret; | ||
415 | } | ||
416 | |||
417 | /** | ||
418 | * of_property_read_u16_array - Find and read an array of u16 from a property. | ||
419 | * | ||
420 | * @np: device node from which the property value is to be read. | ||
421 | * @propname: name of the property to be searched. | ||
422 | * @out_values: pointer to return value, modified only if return value is 0. | ||
423 | * @sz: number of array elements to read | ||
424 | * | ||
425 | * Search for a property in a device node and read 16-bit value(s) from | ||
426 | * it. Returns 0 on success, -EINVAL if the property does not exist, | ||
427 | * -ENODATA if property does not have a value, and -EOVERFLOW if the | ||
428 | * property data isn't large enough. | ||
429 | * | ||
430 | * dts entry of array should be like: | ||
431 | * property = /bits/ 16 <0x5000 0x6000 0x7000>; | ||
432 | * | ||
433 | * The out_values is modified only if a valid u16 value can be decoded. | ||
434 | */ | ||
435 | static inline int of_property_read_u16_array(const struct device_node *np, | ||
436 | const char *propname, | ||
437 | u16 *out_values, size_t sz) | ||
438 | { | ||
439 | int ret = of_property_read_variable_u16_array(np, propname, out_values, | ||
440 | sz, 0); | ||
441 | if (ret >= 0) | ||
442 | return 0; | ||
443 | else | ||
444 | return ret; | ||
445 | } | ||
446 | |||
447 | /** | ||
448 | * of_property_read_u32_array - Find and read an array of 32 bit integers | ||
449 | * from a property. | ||
450 | * | ||
451 | * @np: device node from which the property value is to be read. | ||
452 | * @propname: name of the property to be searched. | ||
453 | * @out_values: pointer to return value, modified only if return value is 0. | ||
454 | * @sz: number of array elements to read | ||
455 | * | ||
456 | * Search for a property in a device node and read 32-bit value(s) from | ||
457 | * it. Returns 0 on success, -EINVAL if the property does not exist, | ||
458 | * -ENODATA if property does not have a value, and -EOVERFLOW if the | ||
459 | * property data isn't large enough. | ||
460 | * | ||
461 | * The out_values is modified only if a valid u32 value can be decoded. | ||
462 | */ | ||
463 | static inline int of_property_read_u32_array(const struct device_node *np, | ||
464 | const char *propname, | ||
465 | u32 *out_values, size_t sz) | ||
466 | { | ||
467 | int ret = of_property_read_variable_u32_array(np, propname, out_values, | ||
468 | sz, 0); | ||
469 | if (ret >= 0) | ||
470 | return 0; | ||
471 | else | ||
472 | return ret; | ||
473 | } | ||
474 | |||
475 | /** | ||
476 | * of_property_read_u64_array - Find and read an array of 64 bit integers | ||
477 | * from a property. | ||
478 | * | ||
479 | * @np: device node from which the property value is to be read. | ||
480 | * @propname: name of the property to be searched. | ||
481 | * @out_values: pointer to return value, modified only if return value is 0. | ||
482 | * @sz: number of array elements to read | ||
483 | * | ||
484 | * Search for a property in a device node and read 64-bit value(s) from | ||
485 | * it. Returns 0 on success, -EINVAL if the property does not exist, | ||
486 | * -ENODATA if property does not have a value, and -EOVERFLOW if the | ||
487 | * property data isn't large enough. | ||
488 | * | ||
489 | * The out_values is modified only if a valid u64 value can be decoded. | ||
490 | */ | ||
491 | static inline int of_property_read_u64_array(const struct device_node *np, | ||
492 | const char *propname, | ||
493 | u64 *out_values, size_t sz) | ||
494 | { | ||
495 | int ret = of_property_read_variable_u64_array(np, propname, out_values, | ||
496 | sz, 0); | ||
497 | if (ret >= 0) | ||
498 | return 0; | ||
499 | else | ||
500 | return ret; | ||
501 | } | ||
502 | |||
383 | /* | 503 | /* |
384 | * struct property *prop; | 504 | * struct property *prop; |
385 | * const __be32 *p; | 505 | * const __be32 *p; |