From 509b7455ef87e1447670c51037cabbf93d772d6f Mon Sep 17 00:00:00 2001 From: Benjamin Herrenschmidt Date: Mon, 22 Oct 2012 11:32:30 +1100 Subject: of/fdt: Don't copy garbage after "/" in root node path The root node path must be internally converted to "/", or various pieces of code looking for it that way will fail. The code to do that however had a bug where we might incorrectly append pieces of the original path from the fdt to the "/". We should probably add a proper dedicated accessor for the root node but in the meantime this patch should fix it. Signed-off-by: Benjamin Herrenschmidt Signed-off-by: Rob Herring --- drivers/of/fdt.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers') diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 91a375fb6ae6..c2b08dcdbc53 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -186,6 +186,7 @@ static unsigned long unflatten_dt_node(struct boot_param_header *blob, */ fpsize = 1; allocl = 2; + l = 0; } else { /* account for '/' and path size minus terminal 0 * already in 'l' -- cgit v1.2.3 From 16c4c52435cf8bb6e5986c14d36d93a0dd4c98df Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Tue, 13 Nov 2012 18:16:43 +0100 Subject: bindings: i2c: use consistent naming for i2c binding descriptions Filenames of devictree binding documentation seems to be arbitrary and for me it is unneeded hazzle to find the corresponding documentation for a specific driver. Naming the description the same as the driver is a lot easier and makes sense to me since the driver defines the binding it understands. Also, remove a reference in one source to the binding documentation, since path information easily gets stale. Signed-off-by: Wolfram Sang Cc: Rob Herring Cc: Grant Likely Signed-off-by: Grant Likely --- .../devicetree/bindings/i2c/arm-versatile.txt | 10 --- .../devicetree/bindings/i2c/atmel-i2c.txt | 30 ------- .../devicetree/bindings/i2c/cavium-i2c.txt | 34 -------- .../devicetree/bindings/i2c/ce4100-i2c.txt | 93 ---------------------- Documentation/devicetree/bindings/i2c/davinci.txt | 28 ------- Documentation/devicetree/bindings/i2c/fsl-i2c.txt | 64 --------------- .../devicetree/bindings/i2c/fsl-imx-i2c.txt | 25 ------ Documentation/devicetree/bindings/i2c/gpio-i2c.txt | 32 -------- Documentation/devicetree/bindings/i2c/i2c-at91.txt | 30 +++++++ .../devicetree/bindings/i2c/i2c-davinci.txt | 28 +++++++ Documentation/devicetree/bindings/i2c/i2c-gpio.txt | 32 ++++++++ Documentation/devicetree/bindings/i2c/i2c-imx.txt | 25 ++++++ Documentation/devicetree/bindings/i2c/i2c-mpc.txt | 64 +++++++++++++++ Documentation/devicetree/bindings/i2c/i2c-mux.txt | 60 ++++++++++++++ .../devicetree/bindings/i2c/i2c-mv64xxx.txt | 18 +++++ .../devicetree/bindings/i2c/i2c-nomadik.txt | 23 ++++++ .../devicetree/bindings/i2c/i2c-octeon.txt | 34 ++++++++ Documentation/devicetree/bindings/i2c/i2c-omap.txt | 30 +++++++ Documentation/devicetree/bindings/i2c/i2c-pnx.txt | 36 +++++++++ .../devicetree/bindings/i2c/i2c-pxa-pci-ce4100.txt | 93 ++++++++++++++++++++++ Documentation/devicetree/bindings/i2c/i2c-pxa.txt | 33 ++++++++ .../devicetree/bindings/i2c/i2c-s3c2410.txt | 43 ++++++++++ Documentation/devicetree/bindings/i2c/i2c-sirf.txt | 19 +++++ .../devicetree/bindings/i2c/i2c-versatile.txt | 10 +++ Documentation/devicetree/bindings/i2c/i2c-xiic.txt | 22 +++++ Documentation/devicetree/bindings/i2c/mrvl-i2c.txt | 51 ------------ Documentation/devicetree/bindings/i2c/mux.txt | 60 -------------- Documentation/devicetree/bindings/i2c/nomadik.txt | 23 ------ Documentation/devicetree/bindings/i2c/omap-i2c.txt | 30 ------- Documentation/devicetree/bindings/i2c/pnx.txt | 36 --------- .../devicetree/bindings/i2c/samsung-i2c.txt | 43 ---------- Documentation/devicetree/bindings/i2c/sirf-i2c.txt | 19 ----- Documentation/devicetree/bindings/i2c/xiic.txt | 22 ----- drivers/i2c/busses/i2c-ocores.c | 4 - 34 files changed, 600 insertions(+), 604 deletions(-) delete mode 100644 Documentation/devicetree/bindings/i2c/arm-versatile.txt delete mode 100644 Documentation/devicetree/bindings/i2c/atmel-i2c.txt delete mode 100644 Documentation/devicetree/bindings/i2c/cavium-i2c.txt delete mode 100644 Documentation/devicetree/bindings/i2c/ce4100-i2c.txt delete mode 100644 Documentation/devicetree/bindings/i2c/davinci.txt delete mode 100644 Documentation/devicetree/bindings/i2c/fsl-i2c.txt delete mode 100644 Documentation/devicetree/bindings/i2c/fsl-imx-i2c.txt delete mode 100644 Documentation/devicetree/bindings/i2c/gpio-i2c.txt create mode 100644 Documentation/devicetree/bindings/i2c/i2c-at91.txt create mode 100644 Documentation/devicetree/bindings/i2c/i2c-davinci.txt create mode 100644 Documentation/devicetree/bindings/i2c/i2c-gpio.txt create mode 100644 Documentation/devicetree/bindings/i2c/i2c-imx.txt create mode 100644 Documentation/devicetree/bindings/i2c/i2c-mpc.txt create mode 100644 Documentation/devicetree/bindings/i2c/i2c-mux.txt create mode 100644 Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt create mode 100644 Documentation/devicetree/bindings/i2c/i2c-nomadik.txt create mode 100644 Documentation/devicetree/bindings/i2c/i2c-octeon.txt create mode 100644 Documentation/devicetree/bindings/i2c/i2c-omap.txt create mode 100644 Documentation/devicetree/bindings/i2c/i2c-pnx.txt create mode 100644 Documentation/devicetree/bindings/i2c/i2c-pxa-pci-ce4100.txt create mode 100644 Documentation/devicetree/bindings/i2c/i2c-pxa.txt create mode 100644 Documentation/devicetree/bindings/i2c/i2c-s3c2410.txt create mode 100644 Documentation/devicetree/bindings/i2c/i2c-sirf.txt create mode 100644 Documentation/devicetree/bindings/i2c/i2c-versatile.txt create mode 100644 Documentation/devicetree/bindings/i2c/i2c-xiic.txt delete mode 100644 Documentation/devicetree/bindings/i2c/mrvl-i2c.txt delete mode 100644 Documentation/devicetree/bindings/i2c/mux.txt delete mode 100644 Documentation/devicetree/bindings/i2c/nomadik.txt delete mode 100644 Documentation/devicetree/bindings/i2c/omap-i2c.txt delete mode 100644 Documentation/devicetree/bindings/i2c/pnx.txt delete mode 100644 Documentation/devicetree/bindings/i2c/samsung-i2c.txt delete mode 100644 Documentation/devicetree/bindings/i2c/sirf-i2c.txt delete mode 100644 Documentation/devicetree/bindings/i2c/xiic.txt (limited to 'drivers') diff --git a/Documentation/devicetree/bindings/i2c/arm-versatile.txt b/Documentation/devicetree/bindings/i2c/arm-versatile.txt deleted file mode 100644 index 361d31c51b6f..000000000000 --- a/Documentation/devicetree/bindings/i2c/arm-versatile.txt +++ /dev/null @@ -1,10 +0,0 @@ -i2c Controller on ARM Versatile platform: - -Required properties: -- compatible : Must be "arm,versatile-i2c"; -- reg -- #address-cells = <1>; -- #size-cells = <0>; - -Optional properties: -- Child nodes conforming to i2c bus binding diff --git a/Documentation/devicetree/bindings/i2c/atmel-i2c.txt b/Documentation/devicetree/bindings/i2c/atmel-i2c.txt deleted file mode 100644 index b689a0d9441c..000000000000 --- a/Documentation/devicetree/bindings/i2c/atmel-i2c.txt +++ /dev/null @@ -1,30 +0,0 @@ -I2C for Atmel platforms - -Required properties : -- compatible : Must be "atmel,at91rm9200-i2c", "atmel,at91sam9261-i2c", - "atmel,at91sam9260-i2c", "atmel,at91sam9g20-i2c", "atmel,at91sam9g10-i2c" - or "atmel,at91sam9x5-i2c" -- reg: physical base address of the controller and length of memory mapped - region. -- interrupts: interrupt number to the cpu. -- #address-cells = <1>; -- #size-cells = <0>; - -Optional properties: -- Child nodes conforming to i2c bus binding - -Examples : - -i2c0: i2c@fff84000 { - compatible = "atmel,at91sam9g20-i2c"; - reg = <0xfff84000 0x100>; - interrupts = <12 4 6>; - #address-cells = <1>; - #size-cells = <0>; - - 24c512@50 { - compatible = "24c512"; - reg = <0x50>; - pagesize = <128>; - } -} diff --git a/Documentation/devicetree/bindings/i2c/cavium-i2c.txt b/Documentation/devicetree/bindings/i2c/cavium-i2c.txt deleted file mode 100644 index dced82ebe31d..000000000000 --- a/Documentation/devicetree/bindings/i2c/cavium-i2c.txt +++ /dev/null @@ -1,34 +0,0 @@ -* Two Wire Serial Interface (TWSI) / I2C - -- compatible: "cavium,octeon-3860-twsi" - - Compatibility with all cn3XXX, cn5XXX and cn6XXX SOCs. - -- reg: The base address of the TWSI/I2C bus controller register bank. - -- #address-cells: Must be <1>. - -- #size-cells: Must be <0>. I2C addresses have no size component. - -- interrupts: A single interrupt specifier. - -- clock-frequency: The I2C bus clock rate in Hz. - -Example: - twsi0: i2c@1180000001000 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "cavium,octeon-3860-twsi"; - reg = <0x11800 0x00001000 0x0 0x200>; - interrupts = <0 45>; - clock-frequency = <100000>; - - rtc@68 { - compatible = "dallas,ds1337"; - reg = <0x68>; - }; - tmp@4c { - compatible = "ti,tmp421"; - reg = <0x4c>; - }; - }; diff --git a/Documentation/devicetree/bindings/i2c/ce4100-i2c.txt b/Documentation/devicetree/bindings/i2c/ce4100-i2c.txt deleted file mode 100644 index 569b16248514..000000000000 --- a/Documentation/devicetree/bindings/i2c/ce4100-i2c.txt +++ /dev/null @@ -1,93 +0,0 @@ -CE4100 I2C ----------- - -CE4100 has one PCI device which is described as the I2C-Controller. This -PCI device has three PCI-bars, each bar contains a complete I2C -controller. So we have a total of three independent I2C-Controllers -which share only an interrupt line. -The driver is probed via the PCI-ID and is gathering the information of -attached devices from the devices tree. -Grant Likely recommended to use the ranges property to map the PCI-Bar -number to its physical address and to use this to find the child nodes -of the specific I2C controller. This were his exact words: - - Here's where the magic happens. Each entry in - ranges describes how the parent pci address space - (middle group of 3) is translated to the local - address space (first group of 2) and the size of - each range (last cell). In this particular case, - the first cell of the local address is chosen to be - 1:1 mapped to the BARs, and the second is the - offset from be base of the BAR (which would be - non-zero if you had 2 or more devices mapped off - the same BAR) - - ranges allows the address mapping to be described - in a way that the OS can interpret without - requiring custom device driver code. - -This is an example which is used on FalconFalls: ------------------------------------------------- - i2c-controller@b,2 { - #address-cells = <2>; - #size-cells = <1>; - compatible = "pci8086,2e68.2", - "pci8086,2e68", - "pciclass,ff0000", - "pciclass,ff00"; - - reg = <0x15a00 0x0 0x0 0x0 0x0>; - interrupts = <16 1>; - - /* as described by Grant, the first number in the group of - * three is the bar number followed by the 64bit bar address - * followed by size of the mapping. The bar address - * requires also a valid translation in parents ranges - * property. - */ - ranges = <0 0 0x02000000 0 0xdffe0500 0x100 - 1 0 0x02000000 0 0xdffe0600 0x100 - 2 0 0x02000000 0 0xdffe0700 0x100>; - - i2c@0 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "intel,ce4100-i2c-controller"; - - /* The first number in the reg property is the - * number of the bar - */ - reg = <0 0 0x100>; - - /* This I2C controller has no devices */ - }; - - i2c@1 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "intel,ce4100-i2c-controller"; - reg = <1 0 0x100>; - - /* This I2C controller has one gpio controller */ - gpio@26 { - #gpio-cells = <2>; - compatible = "ti,pcf8575"; - reg = <0x26>; - gpio-controller; - }; - }; - - i2c@2 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "intel,ce4100-i2c-controller"; - reg = <2 0 0x100>; - - gpio@26 { - #gpio-cells = <2>; - compatible = "ti,pcf8575"; - reg = <0x26>; - gpio-controller; - }; - }; - }; diff --git a/Documentation/devicetree/bindings/i2c/davinci.txt b/Documentation/devicetree/bindings/i2c/davinci.txt deleted file mode 100644 index 2dc935b4113d..000000000000 --- a/Documentation/devicetree/bindings/i2c/davinci.txt +++ /dev/null @@ -1,28 +0,0 @@ -* Texas Instruments Davinci I2C - -This file provides information, what the device node for the -davinci i2c interface contain. - -Required properties: -- compatible: "ti,davinci-i2c"; -- reg : Offset and length of the register set for the device - -Recommended properties : -- interrupts : standard interrupt property. -- clock-frequency : desired I2C bus clock frequency in Hz. - -Example (enbw_cmc board): - i2c@1c22000 { - compatible = "ti,davinci-i2c"; - reg = <0x22000 0x1000>; - clock-frequency = <100000>; - interrupts = <15>; - interrupt-parent = <&intc>; - #address-cells = <1>; - #size-cells = <0>; - - dtt@48 { - compatible = "national,lm75"; - reg = <0x48>; - }; - }; diff --git a/Documentation/devicetree/bindings/i2c/fsl-i2c.txt b/Documentation/devicetree/bindings/i2c/fsl-i2c.txt deleted file mode 100644 index 1eacd6b20ed5..000000000000 --- a/Documentation/devicetree/bindings/i2c/fsl-i2c.txt +++ /dev/null @@ -1,64 +0,0 @@ -* I2C - -Required properties : - - - reg : Offset and length of the register set for the device - - compatible : should be "fsl,CHIP-i2c" where CHIP is the name of a - compatible processor, e.g. mpc8313, mpc8543, mpc8544, mpc5121, - mpc5200 or mpc5200b. For the mpc5121, an additional node - "fsl,mpc5121-i2c-ctrl" is required as shown in the example below. - -Recommended properties : - - - interrupts : where a is the interrupt number and b is a - field that represents an encoding of the sense and level - information for the interrupt. This should be encoded based on - the information in section 2) depending on the type of interrupt - controller you have. - - interrupt-parent : the phandle for the interrupt controller that - services interrupts for this device. - - fsl,preserve-clocking : boolean; if defined, the clock settings - from the bootloader are preserved (not touched). - - clock-frequency : desired I2C bus clock frequency in Hz. - - fsl,timeout : I2C bus timeout in microseconds. - -Examples : - - /* MPC5121 based board */ - i2c@1740 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "fsl,mpc5121-i2c", "fsl-i2c"; - reg = <0x1740 0x20>; - interrupts = <11 0x8>; - interrupt-parent = <&ipic>; - clock-frequency = <100000>; - }; - - i2ccontrol@1760 { - compatible = "fsl,mpc5121-i2c-ctrl"; - reg = <0x1760 0x8>; - }; - - /* MPC5200B based board */ - i2c@3d00 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c"; - reg = <0x3d00 0x40>; - interrupts = <2 15 0>; - interrupt-parent = <&mpc5200_pic>; - fsl,preserve-clocking; - }; - - /* MPC8544 base board */ - i2c@3100 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "fsl,mpc8544-i2c", "fsl-i2c"; - reg = <0x3100 0x100>; - interrupts = <43 2>; - interrupt-parent = <&mpic>; - clock-frequency = <400000>; - fsl,timeout = <10000>; - }; diff --git a/Documentation/devicetree/bindings/i2c/fsl-imx-i2c.txt b/Documentation/devicetree/bindings/i2c/fsl-imx-i2c.txt deleted file mode 100644 index f3cf43b66f7e..000000000000 --- a/Documentation/devicetree/bindings/i2c/fsl-imx-i2c.txt +++ /dev/null @@ -1,25 +0,0 @@ -* Freescale Inter IC (I2C) and High Speed Inter IC (HS-I2C) for i.MX - -Required properties: -- compatible : Should be "fsl,-i2c" -- reg : Should contain I2C/HS-I2C registers location and length -- interrupts : Should contain I2C/HS-I2C interrupt - -Optional properties: -- clock-frequency : Constains desired I2C/HS-I2C bus clock frequency in Hz. - The absence of the propoerty indicates the default frequency 100 kHz. - -Examples: - -i2c@83fc4000 { /* I2C2 on i.MX51 */ - compatible = "fsl,imx51-i2c", "fsl,imx1-i2c"; - reg = <0x83fc4000 0x4000>; - interrupts = <63>; -}; - -i2c@70038000 { /* HS-I2C on i.MX51 */ - compatible = "fsl,imx51-i2c", "fsl,imx1-i2c"; - reg = <0x70038000 0x4000>; - interrupts = <64>; - clock-frequency = <400000>; -}; diff --git a/Documentation/devicetree/bindings/i2c/gpio-i2c.txt b/Documentation/devicetree/bindings/i2c/gpio-i2c.txt deleted file mode 100644 index 4f8ec947c6bd..000000000000 --- a/Documentation/devicetree/bindings/i2c/gpio-i2c.txt +++ /dev/null @@ -1,32 +0,0 @@ -Device-Tree bindings for i2c gpio driver - -Required properties: - - compatible = "i2c-gpio"; - - gpios: sda and scl gpio - - -Optional properties: - - i2c-gpio,sda-open-drain: sda as open drain - - i2c-gpio,scl-open-drain: scl as open drain - - i2c-gpio,scl-output-only: scl as output only - - i2c-gpio,delay-us: delay between GPIO operations (may depend on each platform) - - i2c-gpio,timeout-ms: timeout to get data - -Example nodes: - -i2c@0 { - compatible = "i2c-gpio"; - gpios = <&pioA 23 0 /* sda */ - &pioA 24 0 /* scl */ - >; - i2c-gpio,sda-open-drain; - i2c-gpio,scl-open-drain; - i2c-gpio,delay-us = <2>; /* ~100 kHz */ - #address-cells = <1>; - #size-cells = <0>; - - rv3029c2@56 { - compatible = "rv3029c2"; - reg = <0x56>; - }; -}; diff --git a/Documentation/devicetree/bindings/i2c/i2c-at91.txt b/Documentation/devicetree/bindings/i2c/i2c-at91.txt new file mode 100644 index 000000000000..b689a0d9441c --- /dev/null +++ b/Documentation/devicetree/bindings/i2c/i2c-at91.txt @@ -0,0 +1,30 @@ +I2C for Atmel platforms + +Required properties : +- compatible : Must be "atmel,at91rm9200-i2c", "atmel,at91sam9261-i2c", + "atmel,at91sam9260-i2c", "atmel,at91sam9g20-i2c", "atmel,at91sam9g10-i2c" + or "atmel,at91sam9x5-i2c" +- reg: physical base address of the controller and length of memory mapped + region. +- interrupts: interrupt number to the cpu. +- #address-cells = <1>; +- #size-cells = <0>; + +Optional properties: +- Child nodes conforming to i2c bus binding + +Examples : + +i2c0: i2c@fff84000 { + compatible = "atmel,at91sam9g20-i2c"; + reg = <0xfff84000 0x100>; + interrupts = <12 4 6>; + #address-cells = <1>; + #size-cells = <0>; + + 24c512@50 { + compatible = "24c512"; + reg = <0x50>; + pagesize = <128>; + } +} diff --git a/Documentation/devicetree/bindings/i2c/i2c-davinci.txt b/Documentation/devicetree/bindings/i2c/i2c-davinci.txt new file mode 100644 index 000000000000..2dc935b4113d --- /dev/null +++ b/Documentation/devicetree/bindings/i2c/i2c-davinci.txt @@ -0,0 +1,28 @@ +* Texas Instruments Davinci I2C + +This file provides information, what the device node for the +davinci i2c interface contain. + +Required properties: +- compatible: "ti,davinci-i2c"; +- reg : Offset and length of the register set for the device + +Recommended properties : +- interrupts : standard interrupt property. +- clock-frequency : desired I2C bus clock frequency in Hz. + +Example (enbw_cmc board): + i2c@1c22000 { + compatible = "ti,davinci-i2c"; + reg = <0x22000 0x1000>; + clock-frequency = <100000>; + interrupts = <15>; + interrupt-parent = <&intc>; + #address-cells = <1>; + #size-cells = <0>; + + dtt@48 { + compatible = "national,lm75"; + reg = <0x48>; + }; + }; diff --git a/Documentation/devicetree/bindings/i2c/i2c-gpio.txt b/Documentation/devicetree/bindings/i2c/i2c-gpio.txt new file mode 100644 index 000000000000..4f8ec947c6bd --- /dev/null +++ b/Documentation/devicetree/bindings/i2c/i2c-gpio.txt @@ -0,0 +1,32 @@ +Device-Tree bindings for i2c gpio driver + +Required properties: + - compatible = "i2c-gpio"; + - gpios: sda and scl gpio + + +Optional properties: + - i2c-gpio,sda-open-drain: sda as open drain + - i2c-gpio,scl-open-drain: scl as open drain + - i2c-gpio,scl-output-only: scl as output only + - i2c-gpio,delay-us: delay between GPIO operations (may depend on each platform) + - i2c-gpio,timeout-ms: timeout to get data + +Example nodes: + +i2c@0 { + compatible = "i2c-gpio"; + gpios = <&pioA 23 0 /* sda */ + &pioA 24 0 /* scl */ + >; + i2c-gpio,sda-open-drain; + i2c-gpio,scl-open-drain; + i2c-gpio,delay-us = <2>; /* ~100 kHz */ + #address-cells = <1>; + #size-cells = <0>; + + rv3029c2@56 { + compatible = "rv3029c2"; + reg = <0x56>; + }; +}; diff --git a/Documentation/devicetree/bindings/i2c/i2c-imx.txt b/Documentation/devicetree/bindings/i2c/i2c-imx.txt new file mode 100644 index 000000000000..f3cf43b66f7e --- /dev/null +++ b/Documentation/devicetree/bindings/i2c/i2c-imx.txt @@ -0,0 +1,25 @@ +* Freescale Inter IC (I2C) and High Speed Inter IC (HS-I2C) for i.MX + +Required properties: +- compatible : Should be "fsl,-i2c" +- reg : Should contain I2C/HS-I2C registers location and length +- interrupts : Should contain I2C/HS-I2C interrupt + +Optional properties: +- clock-frequency : Constains desired I2C/HS-I2C bus clock frequency in Hz. + The absence of the propoerty indicates the default frequency 100 kHz. + +Examples: + +i2c@83fc4000 { /* I2C2 on i.MX51 */ + compatible = "fsl,imx51-i2c", "fsl,imx1-i2c"; + reg = <0x83fc4000 0x4000>; + interrupts = <63>; +}; + +i2c@70038000 { /* HS-I2C on i.MX51 */ + compatible = "fsl,imx51-i2c", "fsl,imx1-i2c"; + reg = <0x70038000 0x4000>; + interrupts = <64>; + clock-frequency = <400000>; +}; diff --git a/Documentation/devicetree/bindings/i2c/i2c-mpc.txt b/Documentation/devicetree/bindings/i2c/i2c-mpc.txt new file mode 100644 index 000000000000..1eacd6b20ed5 --- /dev/null +++ b/Documentation/devicetree/bindings/i2c/i2c-mpc.txt @@ -0,0 +1,64 @@ +* I2C + +Required properties : + + - reg : Offset and length of the register set for the device + - compatible : should be "fsl,CHIP-i2c" where CHIP is the name of a + compatible processor, e.g. mpc8313, mpc8543, mpc8544, mpc5121, + mpc5200 or mpc5200b. For the mpc5121, an additional node + "fsl,mpc5121-i2c-ctrl" is required as shown in the example below. + +Recommended properties : + + - interrupts : where a is the interrupt number and b is a + field that represents an encoding of the sense and level + information for the interrupt. This should be encoded based on + the information in section 2) depending on the type of interrupt + controller you have. + - interrupt-parent : the phandle for the interrupt controller that + services interrupts for this device. + - fsl,preserve-clocking : boolean; if defined, the clock settings + from the bootloader are preserved (not touched). + - clock-frequency : desired I2C bus clock frequency in Hz. + - fsl,timeout : I2C bus timeout in microseconds. + +Examples : + + /* MPC5121 based board */ + i2c@1740 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "fsl,mpc5121-i2c", "fsl-i2c"; + reg = <0x1740 0x20>; + interrupts = <11 0x8>; + interrupt-parent = <&ipic>; + clock-frequency = <100000>; + }; + + i2ccontrol@1760 { + compatible = "fsl,mpc5121-i2c-ctrl"; + reg = <0x1760 0x8>; + }; + + /* MPC5200B based board */ + i2c@3d00 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c"; + reg = <0x3d00 0x40>; + interrupts = <2 15 0>; + interrupt-parent = <&mpc5200_pic>; + fsl,preserve-clocking; + }; + + /* MPC8544 base board */ + i2c@3100 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "fsl,mpc8544-i2c", "fsl-i2c"; + reg = <0x3100 0x100>; + interrupts = <43 2>; + interrupt-parent = <&mpic>; + clock-frequency = <400000>; + fsl,timeout = <10000>; + }; diff --git a/Documentation/devicetree/bindings/i2c/i2c-mux.txt b/Documentation/devicetree/bindings/i2c/i2c-mux.txt new file mode 100644 index 000000000000..af84cce5cd7b --- /dev/null +++ b/Documentation/devicetree/bindings/i2c/i2c-mux.txt @@ -0,0 +1,60 @@ +Common i2c bus multiplexer/switch properties. + +An i2c bus multiplexer/switch will have several child busses that are +numbered uniquely in a device dependent manner. The nodes for an i2c bus +multiplexer/switch will have one child node for each child +bus. + +Required properties: +- #address-cells = <1>; +- #size-cells = <0>; + +Required properties for child nodes: +- #address-cells = <1>; +- #size-cells = <0>; +- reg : The sub-bus number. + +Optional properties for child nodes: +- Other properties specific to the multiplexer/switch hardware. +- Child nodes conforming to i2c bus binding + + +Example : + + /* + An NXP pca9548 8 channel I2C multiplexer at address 0x70 + with two NXP pca8574 GPIO expanders attached, one each to + ports 3 and 4. + */ + + mux@70 { + compatible = "nxp,pca9548"; + reg = <0x70>; + #address-cells = <1>; + #size-cells = <0>; + + i2c@3 { + #address-cells = <1>; + #size-cells = <0>; + reg = <3>; + + gpio1: gpio@38 { + compatible = "nxp,pca8574"; + reg = <0x38>; + #gpio-cells = <2>; + gpio-controller; + }; + }; + i2c@4 { + #address-cells = <1>; + #size-cells = <0>; + reg = <4>; + + gpio2: gpio@38 { + compatible = "nxp,pca8574"; + reg = <0x38>; + #gpio-cells = <2>; + gpio-controller; + }; + }; + }; diff --git a/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt b/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt new file mode 100644 index 000000000000..f46d928aa73d --- /dev/null +++ b/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt @@ -0,0 +1,18 @@ + +* Marvell MV64XXX I2C controller + +Required properties : + + - reg : Offset and length of the register set for the device + - compatible : Should be "marvell,mv64xxx-i2c" + - interrupts : The interrupt number + - clock-frequency : Desired I2C bus clock frequency in Hz. + +Examples: + + i2c@11000 { + compatible = "marvell,mv64xxx-i2c"; + reg = <0x11000 0x20>; + interrupts = <29>; + clock-frequency = <100000>; + }; diff --git a/Documentation/devicetree/bindings/i2c/i2c-nomadik.txt b/Documentation/devicetree/bindings/i2c/i2c-nomadik.txt new file mode 100644 index 000000000000..72065b0ff680 --- /dev/null +++ b/Documentation/devicetree/bindings/i2c/i2c-nomadik.txt @@ -0,0 +1,23 @@ +I2C for Nomadik based systems + +Required (non-standard) properties: + - Nil + +Recommended (non-standard) properties: + - clock-frequency : Maximum bus clock frequency for the device + +Optional (non-standard) properties: + - Nil + +Example : + +i2c@80004000 { + compatible = "stericsson,db8500-i2c", "st,nomadik-i2c"; + reg = <0x80004000 0x1000>; + interrupts = <0 21 0x4>; + #address-cells = <1>; + #size-cells = <0>; + v-i2c-supply = <&db8500_vape_reg>; + + clock-frequency = <400000>; +}; diff --git a/Documentation/devicetree/bindings/i2c/i2c-octeon.txt b/Documentation/devicetree/bindings/i2c/i2c-octeon.txt new file mode 100644 index 000000000000..dced82ebe31d --- /dev/null +++ b/Documentation/devicetree/bindings/i2c/i2c-octeon.txt @@ -0,0 +1,34 @@ +* Two Wire Serial Interface (TWSI) / I2C + +- compatible: "cavium,octeon-3860-twsi" + + Compatibility with all cn3XXX, cn5XXX and cn6XXX SOCs. + +- reg: The base address of the TWSI/I2C bus controller register bank. + +- #address-cells: Must be <1>. + +- #size-cells: Must be <0>. I2C addresses have no size component. + +- interrupts: A single interrupt specifier. + +- clock-frequency: The I2C bus clock rate in Hz. + +Example: + twsi0: i2c@1180000001000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "cavium,octeon-3860-twsi"; + reg = <0x11800 0x00001000 0x0 0x200>; + interrupts = <0 45>; + clock-frequency = <100000>; + + rtc@68 { + compatible = "dallas,ds1337"; + reg = <0x68>; + }; + tmp@4c { + compatible = "ti,tmp421"; + reg = <0x4c>; + }; + }; diff --git a/Documentation/devicetree/bindings/i2c/i2c-omap.txt b/Documentation/devicetree/bindings/i2c/i2c-omap.txt new file mode 100644 index 000000000000..56564aa4b444 --- /dev/null +++ b/Documentation/devicetree/bindings/i2c/i2c-omap.txt @@ -0,0 +1,30 @@ +I2C for OMAP platforms + +Required properties : +- compatible : Must be "ti,omap3-i2c" or "ti,omap4-i2c" +- ti,hwmods : Must be "i2c", n being the instance number (1-based) +- #address-cells = <1>; +- #size-cells = <0>; + +Recommended properties : +- clock-frequency : Desired I2C bus clock frequency in Hz. Otherwise + the default 100 kHz frequency will be used. + +Optional properties: +- Child nodes conforming to i2c bus binding + +Note: Current implementation will fetch base address, irq and dma +from omap hwmod data base during device registration. +Future plan is to migrate hwmod data base contents into device tree +blob so that, all the required data will be used from device tree dts +file. + +Examples : + +i2c1: i2c@0 { + compatible = "ti,omap3-i2c"; + #address-cells = <1>; + #size-cells = <0>; + ti,hwmods = "i2c1"; + clock-frequency = <400000>; +}; diff --git a/Documentation/devicetree/bindings/i2c/i2c-pnx.txt b/Documentation/devicetree/bindings/i2c/i2c-pnx.txt new file mode 100644 index 000000000000..fe98ada33ee4 --- /dev/null +++ b/Documentation/devicetree/bindings/i2c/i2c-pnx.txt @@ -0,0 +1,36 @@ +* NXP PNX I2C Controller + +Required properties: + + - reg: Offset and length of the register set for the device + - compatible: should be "nxp,pnx-i2c" + - interrupts: configure one interrupt line + - #address-cells: always 1 (for i2c addresses) + - #size-cells: always 0 + - interrupt-parent: the phandle for the interrupt controller that + services interrupts for this device. + +Optional properties: + + - clock-frequency: desired I2C bus clock frequency in Hz, Default: 100000 Hz + +Examples: + + i2c1: i2c@400a0000 { + compatible = "nxp,pnx-i2c"; + reg = <0x400a0000 0x100>; + interrupt-parent = <&mic>; + interrupts = <51 0>; + #address-cells = <1>; + #size-cells = <0>; + }; + + i2c2: i2c@400a8000 { + compatible = "nxp,pnx-i2c"; + reg = <0x400a8000 0x100>; + interrupt-parent = <&mic>; + interrupts = <50 0>; + #address-cells = <1>; + #size-cells = <0>; + clock-frequency = <100000>; + }; diff --git a/Documentation/devicetree/bindings/i2c/i2c-pxa-pci-ce4100.txt b/Documentation/devicetree/bindings/i2c/i2c-pxa-pci-ce4100.txt new file mode 100644 index 000000000000..569b16248514 --- /dev/null +++ b/Documentation/devicetree/bindings/i2c/i2c-pxa-pci-ce4100.txt @@ -0,0 +1,93 @@ +CE4100 I2C +---------- + +CE4100 has one PCI device which is described as the I2C-Controller. This +PCI device has three PCI-bars, each bar contains a complete I2C +controller. So we have a total of three independent I2C-Controllers +which share only an interrupt line. +The driver is probed via the PCI-ID and is gathering the information of +attached devices from the devices tree. +Grant Likely recommended to use the ranges property to map the PCI-Bar +number to its physical address and to use this to find the child nodes +of the specific I2C controller. This were his exact words: + + Here's where the magic happens. Each entry in + ranges describes how the parent pci address space + (middle group of 3) is translated to the local + address space (first group of 2) and the size of + each range (last cell). In this particular case, + the first cell of the local address is chosen to be + 1:1 mapped to the BARs, and the second is the + offset from be base of the BAR (which would be + non-zero if you had 2 or more devices mapped off + the same BAR) + + ranges allows the address mapping to be described + in a way that the OS can interpret without + requiring custom device driver code. + +This is an example which is used on FalconFalls: +------------------------------------------------ + i2c-controller@b,2 { + #address-cells = <2>; + #size-cells = <1>; + compatible = "pci8086,2e68.2", + "pci8086,2e68", + "pciclass,ff0000", + "pciclass,ff00"; + + reg = <0x15a00 0x0 0x0 0x0 0x0>; + interrupts = <16 1>; + + /* as described by Grant, the first number in the group of + * three is the bar number followed by the 64bit bar address + * followed by size of the mapping. The bar address + * requires also a valid translation in parents ranges + * property. + */ + ranges = <0 0 0x02000000 0 0xdffe0500 0x100 + 1 0 0x02000000 0 0xdffe0600 0x100 + 2 0 0x02000000 0 0xdffe0700 0x100>; + + i2c@0 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "intel,ce4100-i2c-controller"; + + /* The first number in the reg property is the + * number of the bar + */ + reg = <0 0 0x100>; + + /* This I2C controller has no devices */ + }; + + i2c@1 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "intel,ce4100-i2c-controller"; + reg = <1 0 0x100>; + + /* This I2C controller has one gpio controller */ + gpio@26 { + #gpio-cells = <2>; + compatible = "ti,pcf8575"; + reg = <0x26>; + gpio-controller; + }; + }; + + i2c@2 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "intel,ce4100-i2c-controller"; + reg = <2 0 0x100>; + + gpio@26 { + #gpio-cells = <2>; + compatible = "ti,pcf8575"; + reg = <0x26>; + gpio-controller; + }; + }; + }; diff --git a/Documentation/devicetree/bindings/i2c/i2c-pxa.txt b/Documentation/devicetree/bindings/i2c/i2c-pxa.txt new file mode 100644 index 000000000000..12b78ac507e9 --- /dev/null +++ b/Documentation/devicetree/bindings/i2c/i2c-pxa.txt @@ -0,0 +1,33 @@ +* Marvell MMP I2C controller + +Required properties : + + - reg : Offset and length of the register set for the device + - compatible : should be "mrvl,mmp-twsi" where mmp is the name of a + compatible processor, e.g. pxa168, pxa910, mmp2, mmp3. + For the pxa2xx/pxa3xx, an additional node "mrvl,pxa-i2c" is required + as shown in the example below. + +Recommended properties : + + - interrupts : the interrupt number + - interrupt-parent : the phandle for the interrupt controller that + services interrupts for this device. If the parent is the default + interrupt controller in device tree, it could be ignored. + - mrvl,i2c-polling : Disable interrupt of i2c controller. Polling + status register of i2c controller instead. + - mrvl,i2c-fast-mode : Enable fast mode of i2c controller. + +Examples: + twsi1: i2c@d4011000 { + compatible = "mrvl,mmp-twsi"; + reg = <0xd4011000 0x1000>; + interrupts = <7>; + mrvl,i2c-fast-mode; + }; + + twsi2: i2c@d4025000 { + compatible = "mrvl,mmp-twsi"; + reg = <0xd4025000 0x1000>; + interrupts = <58>; + }; diff --git a/Documentation/devicetree/bindings/i2c/i2c-s3c2410.txt b/Documentation/devicetree/bindings/i2c/i2c-s3c2410.txt new file mode 100644 index 000000000000..b6cb5a12c672 --- /dev/null +++ b/Documentation/devicetree/bindings/i2c/i2c-s3c2410.txt @@ -0,0 +1,43 @@ +* Samsung's I2C controller + +The Samsung's I2C controller is used to interface with I2C devices. + +Required properties: + - compatible: value should be either of the following. + (a) "samsung, s3c2410-i2c", for i2c compatible with s3c2410 i2c. + (b) "samsung, s3c2440-i2c", for i2c compatible with s3c2440 i2c. + (c) "samsung, s3c2440-hdmiphy-i2c", for s3c2440-like i2c used + inside HDMIPHY block found on several samsung SoCs + - reg: physical base address of the controller and length of memory mapped + region. + - interrupts: interrupt number to the cpu. + - samsung,i2c-sda-delay: Delay (in ns) applied to data line (SDA) edges. + +Optional properties: + - gpios: The order of the gpios should be the following: . + The gpio specifier depends on the gpio controller. Required in all + cases except for "samsung,s3c2440-hdmiphy-i2c" whose input/output + lines are permanently wired to the respective client + - samsung,i2c-slave-addr: Slave address in multi-master enviroment. If not + specified, default value is 0. + - samsung,i2c-max-bus-freq: Desired frequency in Hz of the bus. If not + specified, the default value in Hz is 100000. + +Example: + + i2c@13870000 { + compatible = "samsung,s3c2440-i2c"; + reg = <0x13870000 0x100>; + interrupts = <345>; + samsung,i2c-sda-delay = <100>; + samsung,i2c-max-bus-freq = <100000>; + gpios = <&gpd1 2 0 /* SDA */ + &gpd1 3 0 /* SCL */>; + #address-cells = <1>; + #size-cells = <0>; + + wm8994@1a { + compatible = "wlf,wm8994"; + reg = <0x1a>; + }; + }; diff --git a/Documentation/devicetree/bindings/i2c/i2c-sirf.txt b/Documentation/devicetree/bindings/i2c/i2c-sirf.txt new file mode 100644 index 000000000000..7baf9e133fa8 --- /dev/null +++ b/Documentation/devicetree/bindings/i2c/i2c-sirf.txt @@ -0,0 +1,19 @@ +I2C for SiRFprimaII platforms + +Required properties : +- compatible : Must be "sirf,prima2-i2c" +- reg: physical base address of the controller and length of memory mapped + region. +- interrupts: interrupt number to the cpu. + +Optional properties: +- clock-frequency : Constains desired I2C/HS-I2C bus clock frequency in Hz. + The absence of the propoerty indicates the default frequency 100 kHz. + +Examples : + +i2c0: i2c@b00e0000 { + compatible = "sirf,prima2-i2c"; + reg = <0xb00e0000 0x10000>; + interrupts = <24>; +}; diff --git a/Documentation/devicetree/bindings/i2c/i2c-versatile.txt b/Documentation/devicetree/bindings/i2c/i2c-versatile.txt new file mode 100644 index 000000000000..361d31c51b6f --- /dev/null +++ b/Documentation/devicetree/bindings/i2c/i2c-versatile.txt @@ -0,0 +1,10 @@ +i2c Controller on ARM Versatile platform: + +Required properties: +- compatible : Must be "arm,versatile-i2c"; +- reg +- #address-cells = <1>; +- #size-cells = <0>; + +Optional properties: +- Child nodes conforming to i2c bus binding diff --git a/Documentation/devicetree/bindings/i2c/i2c-xiic.txt b/Documentation/devicetree/bindings/i2c/i2c-xiic.txt new file mode 100644 index 000000000000..ceabbe91ae44 --- /dev/null +++ b/Documentation/devicetree/bindings/i2c/i2c-xiic.txt @@ -0,0 +1,22 @@ +Xilinx IIC controller: + +Required properties: +- compatible : Must be "xlnx,xps-iic-2.00.a" +- reg : IIC register location and length +- interrupts : IIC controller unterrupt +- #address-cells = <1> +- #size-cells = <0> + +Optional properties: +- Child nodes conforming to i2c bus binding + +Example: + + axi_iic_0: i2c@40800000 { + compatible = "xlnx,xps-iic-2.00.a"; + interrupts = < 1 2 >; + reg = < 0x40800000 0x10000 >; + + #size-cells = <0>; + #address-cells = <1>; + }; diff --git a/Documentation/devicetree/bindings/i2c/mrvl-i2c.txt b/Documentation/devicetree/bindings/i2c/mrvl-i2c.txt deleted file mode 100644 index 0f7945019f6f..000000000000 --- a/Documentation/devicetree/bindings/i2c/mrvl-i2c.txt +++ /dev/null @@ -1,51 +0,0 @@ -* Marvell MMP I2C controller - -Required properties : - - - reg : Offset and length of the register set for the device - - compatible : should be "mrvl,mmp-twsi" where mmp is the name of a - compatible processor, e.g. pxa168, pxa910, mmp2, mmp3. - For the pxa2xx/pxa3xx, an additional node "mrvl,pxa-i2c" is required - as shown in the example below. - -Recommended properties : - - - interrupts : the interrupt number - - interrupt-parent : the phandle for the interrupt controller that - services interrupts for this device. If the parent is the default - interrupt controller in device tree, it could be ignored. - - mrvl,i2c-polling : Disable interrupt of i2c controller. Polling - status register of i2c controller instead. - - mrvl,i2c-fast-mode : Enable fast mode of i2c controller. - -Examples: - twsi1: i2c@d4011000 { - compatible = "mrvl,mmp-twsi"; - reg = <0xd4011000 0x1000>; - interrupts = <7>; - mrvl,i2c-fast-mode; - }; - - twsi2: i2c@d4025000 { - compatible = "mrvl,mmp-twsi"; - reg = <0xd4025000 0x1000>; - interrupts = <58>; - }; - -* Marvell MV64XXX I2C controller - -Required properties : - - - reg : Offset and length of the register set for the device - - compatible : Should be "marvell,mv64xxx-i2c" - - interrupts : The interrupt number - - clock-frequency : Desired I2C bus clock frequency in Hz. - -Examples: - - i2c@11000 { - compatible = "marvell,mv64xxx-i2c"; - reg = <0x11000 0x20>; - interrupts = <29>; - clock-frequency = <100000>; - }; diff --git a/Documentation/devicetree/bindings/i2c/mux.txt b/Documentation/devicetree/bindings/i2c/mux.txt deleted file mode 100644 index af84cce5cd7b..000000000000 --- a/Documentation/devicetree/bindings/i2c/mux.txt +++ /dev/null @@ -1,60 +0,0 @@ -Common i2c bus multiplexer/switch properties. - -An i2c bus multiplexer/switch will have several child busses that are -numbered uniquely in a device dependent manner. The nodes for an i2c bus -multiplexer/switch will have one child node for each child -bus. - -Required properties: -- #address-cells = <1>; -- #size-cells = <0>; - -Required properties for child nodes: -- #address-cells = <1>; -- #size-cells = <0>; -- reg : The sub-bus number. - -Optional properties for child nodes: -- Other properties specific to the multiplexer/switch hardware. -- Child nodes conforming to i2c bus binding - - -Example : - - /* - An NXP pca9548 8 channel I2C multiplexer at address 0x70 - with two NXP pca8574 GPIO expanders attached, one each to - ports 3 and 4. - */ - - mux@70 { - compatible = "nxp,pca9548"; - reg = <0x70>; - #address-cells = <1>; - #size-cells = <0>; - - i2c@3 { - #address-cells = <1>; - #size-cells = <0>; - reg = <3>; - - gpio1: gpio@38 { - compatible = "nxp,pca8574"; - reg = <0x38>; - #gpio-cells = <2>; - gpio-controller; - }; - }; - i2c@4 { - #address-cells = <1>; - #size-cells = <0>; - reg = <4>; - - gpio2: gpio@38 { - compatible = "nxp,pca8574"; - reg = <0x38>; - #gpio-cells = <2>; - gpio-controller; - }; - }; - }; diff --git a/Documentation/devicetree/bindings/i2c/nomadik.txt b/Documentation/devicetree/bindings/i2c/nomadik.txt deleted file mode 100644 index 72065b0ff680..000000000000 --- a/Documentation/devicetree/bindings/i2c/nomadik.txt +++ /dev/null @@ -1,23 +0,0 @@ -I2C for Nomadik based systems - -Required (non-standard) properties: - - Nil - -Recommended (non-standard) properties: - - clock-frequency : Maximum bus clock frequency for the device - -Optional (non-standard) properties: - - Nil - -Example : - -i2c@80004000 { - compatible = "stericsson,db8500-i2c", "st,nomadik-i2c"; - reg = <0x80004000 0x1000>; - interrupts = <0 21 0x4>; - #address-cells = <1>; - #size-cells = <0>; - v-i2c-supply = <&db8500_vape_reg>; - - clock-frequency = <400000>; -}; diff --git a/Documentation/devicetree/bindings/i2c/omap-i2c.txt b/Documentation/devicetree/bindings/i2c/omap-i2c.txt deleted file mode 100644 index 56564aa4b444..000000000000 --- a/Documentation/devicetree/bindings/i2c/omap-i2c.txt +++ /dev/null @@ -1,30 +0,0 @@ -I2C for OMAP platforms - -Required properties : -- compatible : Must be "ti,omap3-i2c" or "ti,omap4-i2c" -- ti,hwmods : Must be "i2c", n being the instance number (1-based) -- #address-cells = <1>; -- #size-cells = <0>; - -Recommended properties : -- clock-frequency : Desired I2C bus clock frequency in Hz. Otherwise - the default 100 kHz frequency will be used. - -Optional properties: -- Child nodes conforming to i2c bus binding - -Note: Current implementation will fetch base address, irq and dma -from omap hwmod data base during device registration. -Future plan is to migrate hwmod data base contents into device tree -blob so that, all the required data will be used from device tree dts -file. - -Examples : - -i2c1: i2c@0 { - compatible = "ti,omap3-i2c"; - #address-cells = <1>; - #size-cells = <0>; - ti,hwmods = "i2c1"; - clock-frequency = <400000>; -}; diff --git a/Documentation/devicetree/bindings/i2c/pnx.txt b/Documentation/devicetree/bindings/i2c/pnx.txt deleted file mode 100644 index fe98ada33ee4..000000000000 --- a/Documentation/devicetree/bindings/i2c/pnx.txt +++ /dev/null @@ -1,36 +0,0 @@ -* NXP PNX I2C Controller - -Required properties: - - - reg: Offset and length of the register set for the device - - compatible: should be "nxp,pnx-i2c" - - interrupts: configure one interrupt line - - #address-cells: always 1 (for i2c addresses) - - #size-cells: always 0 - - interrupt-parent: the phandle for the interrupt controller that - services interrupts for this device. - -Optional properties: - - - clock-frequency: desired I2C bus clock frequency in Hz, Default: 100000 Hz - -Examples: - - i2c1: i2c@400a0000 { - compatible = "nxp,pnx-i2c"; - reg = <0x400a0000 0x100>; - interrupt-parent = <&mic>; - interrupts = <51 0>; - #address-cells = <1>; - #size-cells = <0>; - }; - - i2c2: i2c@400a8000 { - compatible = "nxp,pnx-i2c"; - reg = <0x400a8000 0x100>; - interrupt-parent = <&mic>; - interrupts = <50 0>; - #address-cells = <1>; - #size-cells = <0>; - clock-frequency = <100000>; - }; diff --git a/Documentation/devicetree/bindings/i2c/samsung-i2c.txt b/Documentation/devicetree/bindings/i2c/samsung-i2c.txt deleted file mode 100644 index b6cb5a12c672..000000000000 --- a/Documentation/devicetree/bindings/i2c/samsung-i2c.txt +++ /dev/null @@ -1,43 +0,0 @@ -* Samsung's I2C controller - -The Samsung's I2C controller is used to interface with I2C devices. - -Required properties: - - compatible: value should be either of the following. - (a) "samsung, s3c2410-i2c", for i2c compatible with s3c2410 i2c. - (b) "samsung, s3c2440-i2c", for i2c compatible with s3c2440 i2c. - (c) "samsung, s3c2440-hdmiphy-i2c", for s3c2440-like i2c used - inside HDMIPHY block found on several samsung SoCs - - reg: physical base address of the controller and length of memory mapped - region. - - interrupts: interrupt number to the cpu. - - samsung,i2c-sda-delay: Delay (in ns) applied to data line (SDA) edges. - -Optional properties: - - gpios: The order of the gpios should be the following: . - The gpio specifier depends on the gpio controller. Required in all - cases except for "samsung,s3c2440-hdmiphy-i2c" whose input/output - lines are permanently wired to the respective client - - samsung,i2c-slave-addr: Slave address in multi-master enviroment. If not - specified, default value is 0. - - samsung,i2c-max-bus-freq: Desired frequency in Hz of the bus. If not - specified, the default value in Hz is 100000. - -Example: - - i2c@13870000 { - compatible = "samsung,s3c2440-i2c"; - reg = <0x13870000 0x100>; - interrupts = <345>; - samsung,i2c-sda-delay = <100>; - samsung,i2c-max-bus-freq = <100000>; - gpios = <&gpd1 2 0 /* SDA */ - &gpd1 3 0 /* SCL */>; - #address-cells = <1>; - #size-cells = <0>; - - wm8994@1a { - compatible = "wlf,wm8994"; - reg = <0x1a>; - }; - }; diff --git a/Documentation/devicetree/bindings/i2c/sirf-i2c.txt b/Documentation/devicetree/bindings/i2c/sirf-i2c.txt deleted file mode 100644 index 7baf9e133fa8..000000000000 --- a/Documentation/devicetree/bindings/i2c/sirf-i2c.txt +++ /dev/null @@ -1,19 +0,0 @@ -I2C for SiRFprimaII platforms - -Required properties : -- compatible : Must be "sirf,prima2-i2c" -- reg: physical base address of the controller and length of memory mapped - region. -- interrupts: interrupt number to the cpu. - -Optional properties: -- clock-frequency : Constains desired I2C/HS-I2C bus clock frequency in Hz. - The absence of the propoerty indicates the default frequency 100 kHz. - -Examples : - -i2c0: i2c@b00e0000 { - compatible = "sirf,prima2-i2c"; - reg = <0xb00e0000 0x10000>; - interrupts = <24>; -}; diff --git a/Documentation/devicetree/bindings/i2c/xiic.txt b/Documentation/devicetree/bindings/i2c/xiic.txt deleted file mode 100644 index ceabbe91ae44..000000000000 --- a/Documentation/devicetree/bindings/i2c/xiic.txt +++ /dev/null @@ -1,22 +0,0 @@ -Xilinx IIC controller: - -Required properties: -- compatible : Must be "xlnx,xps-iic-2.00.a" -- reg : IIC register location and length -- interrupts : IIC controller unterrupt -- #address-cells = <1> -- #size-cells = <0> - -Optional properties: -- Child nodes conforming to i2c bus binding - -Example: - - axi_iic_0: i2c@40800000 { - compatible = "xlnx,xps-iic-2.00.a"; - interrupts = < 1 2 >; - reg = < 0x40800000 0x10000 >; - - #size-cells = <0>; - #address-cells = <1>; - }; diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c index bffd5501ac2d..15da1ac7cf9e 100644 --- a/drivers/i2c/busses/i2c-ocores.c +++ b/drivers/i2c/busses/i2c-ocores.c @@ -9,10 +9,6 @@ * kind, whether express or implied. */ -/* - * This driver can be used from the device tree, see - * Documentation/devicetree/bindings/i2c/ocore-i2c.txt - */ #include #include #include -- cgit v1.2.3 From c22618a11d1ba2966bd2cfd5e4918ed4f2dad13e Mon Sep 17 00:00:00 2001 From: Grant Likely Date: Wed, 14 Nov 2012 22:37:12 +0000 Subject: drivers/of: Constify device_node->name and ->path_component_name Neither of these should ever be changed once set. Make them const and fix up the users that try to modify it in-place. In one case kmalloc+memcpy is replaced with kstrdup() to avoid modifying the string. Build tested with defconfigs on ARM, PowerPC, Sparc, MIPS, x86 among others. Signed-off-by: Grant Likely Acked-by: David S. Miller Cc: Benjamin Herrenschmidt Cc: Julian Calaby --- arch/powerpc/platforms/powermac/pfunc_core.c | 2 +- arch/powerpc/platforms/pseries/reconfig.c | 3 +-- arch/powerpc/sysdev/fsl_pci.c | 2 +- arch/sparc/kernel/pci_impl.h | 2 +- drivers/of/fdt.c | 10 +++++----- include/linux/of.h | 4 ++-- 6 files changed, 11 insertions(+), 12 deletions(-) (limited to 'drivers') diff --git a/arch/powerpc/platforms/powermac/pfunc_core.c b/arch/powerpc/platforms/powermac/pfunc_core.c index b0c3777528a1..d588e48dff74 100644 --- a/arch/powerpc/platforms/powermac/pfunc_core.c +++ b/arch/powerpc/platforms/powermac/pfunc_core.c @@ -686,7 +686,7 @@ static int pmf_add_functions(struct pmf_device *dev, void *driverdata) int count = 0; for (pp = dev->node->properties; pp != 0; pp = pp->next) { - char *name; + const char *name; if (strncmp(pp->name, PP_PREFIX, plen) != 0) continue; name = pp->name + plen; diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c index 39f71fba9b38..2f4668136b20 100644 --- a/arch/powerpc/platforms/pseries/reconfig.c +++ b/arch/powerpc/platforms/pseries/reconfig.c @@ -281,12 +281,11 @@ static struct property *new_property(const char *name, const int length, if (!new) return NULL; - if (!(new->name = kmalloc(strlen(name) + 1, GFP_KERNEL))) + if (!(new->name = kstrdup(name, GFP_KERNEL))) goto cleanup; if (!(new->value = kmalloc(length + 1, GFP_KERNEL))) goto cleanup; - strcpy(new->name, name); memcpy(new->value, value, length); *(((char *)new->value) + length) = 0; new->length = length; diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c index ffb93ae9379b..01b62a62c635 100644 --- a/arch/powerpc/sysdev/fsl_pci.c +++ b/arch/powerpc/sysdev/fsl_pci.c @@ -136,7 +136,7 @@ static void __init setup_pci_atmu(struct pci_controller *hose, u32 pcicsrbar = 0, pcicsrbar_sz; u32 piwar = PIWAR_EN | PIWAR_PF | PIWAR_TGI_LOCAL | PIWAR_READ_SNOOP | PIWAR_WRITE_SNOOP; - char *name = hose->dn->full_name; + const char *name = hose->dn->full_name; const u64 *reg; int len; diff --git a/arch/sparc/kernel/pci_impl.h b/arch/sparc/kernel/pci_impl.h index 918a2031c8bb..5f688531f48c 100644 --- a/arch/sparc/kernel/pci_impl.h +++ b/arch/sparc/kernel/pci_impl.h @@ -88,7 +88,7 @@ struct pci_pbm_info { int chip_revision; /* Name used for top-level resources. */ - char *name; + const char *name; /* OBP specific information. */ struct platform_device *op; diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index c2b08dcdbc53..c8be32644c85 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -199,10 +199,10 @@ static unsigned long unflatten_dt_node(struct boot_param_header *blob, np = unflatten_dt_alloc(&mem, sizeof(struct device_node) + allocl, __alignof__(struct device_node)); if (allnextpp) { + char *fn; memset(np, 0, sizeof(*np)); - np->full_name = ((char *)np) + sizeof(struct device_node); + np->full_name = fn = ((char *)np) + sizeof(*np); if (new_format) { - char *fn = np->full_name; /* rebuild full path for new format */ if (dad && dad->parent) { strcpy(fn, dad->full_name); @@ -216,9 +216,9 @@ static unsigned long unflatten_dt_node(struct boot_param_header *blob, fn += strlen(fn); } *(fn++) = '/'; - memcpy(fn, pathp, l); - } else - memcpy(np->full_name, pathp, l); + } + memcpy(fn, pathp, l); + prev_pp = &np->properties; **allnextpp = np; *allnextpp = &np->allnext; diff --git a/include/linux/of.h b/include/linux/of.h index b4e50d56fc74..857dde984a6e 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -46,7 +46,7 @@ struct device_node { const char *name; const char *type; phandle phandle; - char *full_name; + const char *full_name; struct property *properties; struct property *deadprops; /* removed properties */ @@ -60,7 +60,7 @@ struct device_node { unsigned long _flags; void *data; #if defined(CONFIG_SPARC) - char *path_component_name; + const char *path_component_name; unsigned int unique_id; struct of_irq_controller *irq_trans; #endif -- cgit v1.2.3 From e55b0829cbace88f4b50036432a12146d22cd106 Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Mon, 12 Nov 2012 18:30:49 -0200 Subject: of: fdt: Constify 'pathp' Constify 'pathp' in order to get rid of the following warning: drivers/of/fdt.c:491:10: warning: assignment discards 'const' qualifier from pointer target type [enabled by default] Signed-off-by: Fabio Estevam [Rob Herring: also constify np and lp] Signed-off-by: Rob Herring --- drivers/of/fdt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index c8be32644c85..135b8083212a 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -460,7 +460,7 @@ int __init of_scan_flat_dt(int (*it)(unsigned long node, do { u32 tag = be32_to_cpup((__be32 *)p); - char *pathp; + const char *pathp; p += 4; if (tag == OF_DT_END_NODE) { @@ -488,7 +488,7 @@ int __init of_scan_flat_dt(int (*it)(unsigned long node, pathp = (char *)p; p = ALIGN(p + strlen(pathp) + 1, 4); if ((*pathp) == '/') { - char *lp, *np; + const char *lp, *np; for (lp = NULL, np = pathp; *np; np++) if ((*np) == '/') lp = np+1; -- cgit v1.2.3 From 0fca5deafeac764c2ab0d37c2409fdd0962d5724 Mon Sep 17 00:00:00 2001 From: Catalin Marinas Date: Fri, 16 Nov 2012 15:14:38 +0000 Subject: of/fdt: NULL-terminate the root node path Commit 509b7455 (of/fdt: Don't copy garbage after "/" in root node path) sets the path length to 0 to ignore any garbage after "/" in the root node path. This has the side effect of also ignoring '\0' at the end of the root node path. This patch sets the ignores the garbage by setting the last character to '\0' and length to 1. Signed-off-by: Catalin Marinas Cc: Benjamin Herrenschmidt Signed-off-by: Rob Herring --- drivers/of/fdt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 135b8083212a..e36ff40011f4 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -186,7 +186,8 @@ static unsigned long unflatten_dt_node(struct boot_param_header *blob, */ fpsize = 1; allocl = 2; - l = 0; + l = 1; + *pathp = '\0'; } else { /* account for '/' and path size minus terminal 0 * already in 'l' -- cgit v1.2.3 From be193249b4178158c0f697cb452b2bbf0cb16361 Mon Sep 17 00:00:00 2001 From: Viresh Kumar Date: Tue, 20 Nov 2012 10:15:19 +0530 Subject: dt: add helper function to read u8 & u16 variables & arrays This adds following helper routines: - of_property_read_u8_array() - of_property_read_u16_array() - of_property_read_u8() - of_property_read_u16() This expects arrays from DT to be passed as: - u8 array: property = /bits/ 8 <0x50 0x60 0x70>; - u16 array: property = /bits/ 16 <0x5000 0x6000 0x7000>; Signed-off-by: Viresh Kumar Reviewed-by: Stephen Warren Signed-off-by: Rob Herring --- drivers/of/base.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ include/linux/of.h | 30 +++++++++++++++++++++ 2 files changed, 107 insertions(+) (limited to 'drivers') diff --git a/drivers/of/base.c b/drivers/of/base.c index af3b22ac7627..f564e3107b3e 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -670,6 +670,82 @@ struct device_node *of_find_node_by_phandle(phandle handle) } EXPORT_SYMBOL(of_find_node_by_phandle); +/** + * of_property_read_u8_array - Find and read an array of u8 from a property. + * + * @np: device node from which the property value is to be read. + * @propname: name of the property to be searched. + * @out_value: pointer to return value, modified only if return value is 0. + * @sz: number of array elements to read + * + * Search for a property in a device node and read 8-bit value(s) from + * it. Returns 0 on success, -EINVAL if the property does not exist, + * -ENODATA if property does not have a value, and -EOVERFLOW if the + * property data isn't large enough. + * + * dts entry of array should be like: + * property = /bits/ 8 <0x50 0x60 0x70>; + * + * The out_value is modified only if a valid u8 value can be decoded. + */ +int of_property_read_u8_array(const struct device_node *np, + const char *propname, u8 *out_values, size_t sz) +{ + struct property *prop = of_find_property(np, propname, NULL); + const u8 *val; + + if (!prop) + return -EINVAL; + if (!prop->value) + return -ENODATA; + if ((sz * sizeof(*out_values)) > prop->length) + return -EOVERFLOW; + + val = prop->value; + while (sz--) + *out_values++ = *val++; + return 0; +} +EXPORT_SYMBOL_GPL(of_property_read_u8_array); + +/** + * of_property_read_u16_array - Find and read an array of u16 from a property. + * + * @np: device node from which the property value is to be read. + * @propname: name of the property to be searched. + * @out_value: pointer to return value, modified only if return value is 0. + * @sz: number of array elements to read + * + * Search for a property in a device node and read 16-bit value(s) from + * it. Returns 0 on success, -EINVAL if the property does not exist, + * -ENODATA if property does not have a value, and -EOVERFLOW if the + * property data isn't large enough. + * + * dts entry of array should be like: + * property = /bits/ 16 <0x5000 0x6000 0x7000>; + * + * The out_value is modified only if a valid u16 value can be decoded. + */ +int of_property_read_u16_array(const struct device_node *np, + const char *propname, u16 *out_values, size_t sz) +{ + struct property *prop = of_find_property(np, propname, NULL); + const __be16 *val; + + if (!prop) + return -EINVAL; + if (!prop->value) + return -ENODATA; + if ((sz * sizeof(*out_values)) > prop->length) + return -EOVERFLOW; + + val = prop->value; + while (sz--) + *out_values++ = be16_to_cpup(val++); + return 0; +} +EXPORT_SYMBOL_GPL(of_property_read_u16_array); + /** * of_property_read_u32_array - Find and read an array of 32 bit integers * from a property. @@ -677,6 +753,7 @@ EXPORT_SYMBOL(of_find_node_by_phandle); * @np: device node from which the property value is to be read. * @propname: name of the property to be searched. * @out_value: pointer to return value, modified only if return value is 0. + * @sz: number of array elements to read * * Search for a property in a device node and read 32-bit value(s) from * it. Returns 0 on success, -EINVAL if the property does not exist, diff --git a/include/linux/of.h b/include/linux/of.h index 857dde984a6e..ab1af0e14659 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -223,6 +223,10 @@ extern struct device_node *of_find_node_with_property( extern struct property *of_find_property(const struct device_node *np, const char *name, int *lenp); +extern int of_property_read_u8_array(const struct device_node *np, + const char *propname, u8 *out_values, size_t sz); +extern int of_property_read_u16_array(const struct device_node *np, + const char *propname, u16 *out_values, size_t sz); extern int of_property_read_u32_array(const struct device_node *np, const char *propname, u32 *out_values, @@ -364,6 +368,18 @@ static inline struct device_node *of_find_compatible_node( return NULL; } +static inline int of_property_read_u8_array(const struct device_node *np, + const char *propname, u8 *out_values, size_t sz) +{ + return -ENOSYS; +} + +static inline int of_property_read_u16_array(const struct device_node *np, + const char *propname, u16 *out_values, size_t sz) +{ + return -ENOSYS; +} + static inline int of_property_read_u32_array(const struct device_node *np, const char *propname, u32 *out_values, size_t sz) @@ -470,6 +486,20 @@ static inline bool of_property_read_bool(const struct device_node *np, return prop ? true : false; } +static inline int of_property_read_u8(const struct device_node *np, + const char *propname, + u8 *out_value) +{ + return of_property_read_u8_array(np, propname, out_value, 1); +} + +static inline int of_property_read_u16(const struct device_node *np, + const char *propname, + u16 *out_value) +{ + return of_property_read_u16_array(np, propname, out_value, 1); +} + static inline int of_property_read_u32(const struct device_node *np, const char *propname, u32 *out_value) -- cgit v1.2.3 From 50c8af4cf98fd97d6779f244215154e4c89699c7 Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Tue, 20 Nov 2012 16:12:20 -0700 Subject: of: introduce for_each_matching_node_and_match() The following pattern of code is tempting: for_each_matching_node(np, table) { match = of_match_node(table, np); However, this results in iterating over table twice; the second time inside of_match_node(). The implementation of for_each_matching_node() already found the match, so this is redundant. Invent new function of_find_matching_node_and_match() and macro for_each_matching_node_and_match() to remove the double iteration, thus transforming the above code to: for_each_matching_node_and_match(np, table, &match) Signed-off-by: Stephen Warren Signed-off-by: Rob Herring --- drivers/of/base.c | 18 +++++++++++++----- include/linux/of.h | 15 +++++++++++++-- 2 files changed, 26 insertions(+), 7 deletions(-) (limited to 'drivers') diff --git a/drivers/of/base.c b/drivers/of/base.c index f564e3107b3e..0ceb26a16050 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -594,27 +594,35 @@ const struct of_device_id *of_match_node(const struct of_device_id *matches, EXPORT_SYMBOL(of_match_node); /** - * of_find_matching_node - Find a node based on an of_device_id match - * table. + * of_find_matching_node_and_match - Find a node based on an of_device_id + * match table. * @from: The node to start searching from or NULL, the node * you pass will not be searched, only the next one * will; typically, you pass what the previous call * returned. of_node_put() will be called on it * @matches: array of of device match structures to search in + * @match Updated to point at the matches entry which matched * * Returns a node pointer with refcount incremented, use * of_node_put() on it when done. */ -struct device_node *of_find_matching_node(struct device_node *from, - const struct of_device_id *matches) +struct device_node *of_find_matching_node_and_match(struct device_node *from, + const struct of_device_id *matches, + const struct of_device_id **match) { struct device_node *np; + if (match) + *match = NULL; + read_lock(&devtree_lock); np = from ? from->allnext : allnodes; for (; np; np = np->allnext) { - if (of_match_node(matches, np) && of_node_get(np)) + if (of_match_node(matches, np) && of_node_get(np)) { + if (match) + *match = matches; break; + } } of_node_put(from); read_unlock(&devtree_lock); diff --git a/include/linux/of.h b/include/linux/of.h index ab1af0e14659..13e0aacb4d9f 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -179,11 +179,22 @@ extern struct device_node *of_find_compatible_node(struct device_node *from, #define for_each_compatible_node(dn, type, compatible) \ for (dn = of_find_compatible_node(NULL, type, compatible); dn; \ dn = of_find_compatible_node(dn, type, compatible)) -extern struct device_node *of_find_matching_node(struct device_node *from, - const struct of_device_id *matches); +extern struct device_node *of_find_matching_node_and_match( + struct device_node *from, + const struct of_device_id *matches, + const struct of_device_id **match); +static inline struct device_node *of_find_matching_node( + struct device_node *from, + const struct of_device_id *matches) +{ + return of_find_matching_node_and_match(from, matches, NULL); +} #define for_each_matching_node(dn, matches) \ for (dn = of_find_matching_node(NULL, matches); dn; \ dn = of_find_matching_node(dn, matches)) +#define for_each_matching_node_and_match(dn, matches, match) \ + for (dn = of_find_matching_node_and_match(NULL, matches, match); \ + dn; dn = of_find_matching_node_and_match(dn, matches, match)) extern struct device_node *of_find_node_by_path(const char *path); extern struct device_node *of_find_node_by_phandle(phandle handle); extern struct device_node *of_get_parent(const struct device_node *node); -- cgit v1.2.3 From b8fbdc42c5c5df8ab1f358fe90e3a8a1bdc9ae48 Mon Sep 17 00:00:00 2001 From: Steffen Trumtrar Date: Thu, 22 Nov 2012 12:16:43 +0100 Subject: of: add 'const' for of_parse_phandle parameter *np The existing function does not change the passed device_node pointer. It is only handed to of_get_property which itself takes a const struct device_node. of_parse_phandle() can therefore take a const pointer as well. Signed-off-by: Steffen Trumtrar [grant.likely: drop extraneous whitespace change] Signed-off-by: Grant Likely --- drivers/of/base.c | 4 ++-- include/linux/of.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers') diff --git a/drivers/of/base.c b/drivers/of/base.c index 0ceb26a16050..c3724110a288 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -978,8 +978,8 @@ EXPORT_SYMBOL_GPL(of_property_count_strings); * Returns the device_node pointer with refcount incremented. Use * of_node_put() on it when done. */ -struct device_node * -of_parse_phandle(struct device_node *np, const char *phandle_name, int index) +struct device_node *of_parse_phandle(const struct device_node *np, + const char *phandle_name, int index) { const __be32 *phandle; int size; diff --git a/include/linux/of.h b/include/linux/of.h index 13e0aacb4d9f..7337dc109c89 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -270,7 +270,7 @@ extern int of_n_size_cells(struct device_node *np); extern const struct of_device_id *of_match_node( const struct of_device_id *matches, const struct device_node *node); extern int of_modalias_node(struct device_node *node, char *modalias, int len); -extern struct device_node *of_parse_phandle(struct device_node *np, +extern struct device_node *of_parse_phandle(const struct device_node *np, const char *phandle_name, int index); extern int of_parse_phandle_with_args(struct device_node *np, @@ -438,7 +438,7 @@ static inline int of_property_match_string(struct device_node *np, return -ENOSYS; } -static inline struct device_node *of_parse_phandle(struct device_node *np, +static inline struct device_node *of_parse_phandle(const struct device_node *np, const char *phandle_name, int index) { -- cgit v1.2.3 From 4447ca1280c39265c29475fb6940daa5b867466d Mon Sep 17 00:00:00 2001 From: Alexander Sverdlin Date: Wed, 28 Nov 2012 15:21:14 +0100 Subject: of_i2c: Honour "status=disabled" property of device Currently of_i2c_register_devices() function registers all i2c devices, independently from their status property in device tree. According to "ePAPR 1.1" spec, device should only be registered if there is no "status" property, or it has "ok" (or "okay") value (see of_device_is_available()). In case of "platform devices", of_platform_device_create_pdata() checks for "status" and ensures that disabled devices are not populated. But such check for i2c buses was missing until now. Fix it. Signed-off-by: Alexander Sverdlin Acked-by: Rob Herring Acked-by: Wolfram Sang Reviewed-by: Barry Song Signed-off-by: Grant Likely --- drivers/of/of_i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/of/of_i2c.c b/drivers/of/of_i2c.c index 3550f3bf4f92..b667264222cc 100644 --- a/drivers/of/of_i2c.c +++ b/drivers/of/of_i2c.c @@ -29,7 +29,7 @@ void of_i2c_register_devices(struct i2c_adapter *adap) dev_dbg(&adap->dev, "of_i2c: walking child nodes\n"); - for_each_child_of_node(adap->dev.of_node, node) { + for_each_available_child_of_node(adap->dev.of_node, node) { struct i2c_board_info info = {}; struct dev_archdata dev_ad = {}; const __be32 *addr; -- cgit v1.2.3 From e207e7619cc9be8dedd910d9c6ce3ee56c7f53d0 Mon Sep 17 00:00:00 2001 From: Alexander Sverdlin Date: Thu, 29 Nov 2012 08:45:20 +0100 Subject: of_mdio: Honour "status=disabled" property of device Currently of_mdiobus_register() function registers all PHY devices, independetly from their status property in device tree. According to "ePAPR 1.1" spec, device should only be registered if there is no "status" property, or it has "ok" (or "okay") value (see of_device_is_available()). In case of "platform devices", of_platform_device_create_pdata() checks for "status" and ensures that disabled devices are not pupulated. But such check for MDIO buses was missing until now. Fix it. Signed-off-by: Alexander Sverdlin Signed-off-by: Grant Likely --- drivers/of/of_mdio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index 8e6c25f35040..83ca06f4312b 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c @@ -53,7 +53,7 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) return rc; /* Loop over the child nodes and register a phy_device for each one */ - for_each_child_of_node(np, child) { + for_each_available_child_of_node(np, child) { const __be32 *paddr; u32 addr; int len; -- cgit v1.2.3 From f3b6159e6a12136ac9c59aaa92ba9f3e484df650 Mon Sep 17 00:00:00 2001 From: Alexander Sverdlin Date: Thu, 29 Nov 2012 08:59:29 +0100 Subject: of/spi: Honour "status=disabled" property of device Currently of_register_spi_devices() function registers all SPI devices, independetly from their status property in device tree. According to "ePAPR 1.1" spec, device should only be registered if there is no "status" property, or it has "ok" (or "okay") value (see of_device_is_available()). In case of "platform devices", of_platform_device_create_pdata() checks for "status" and ensures that disabled devices are not pupulated. But such check for SPI buses was missing until now. Fix it. Signed-off-by: Alexander Sverdlin Signed-off-by: Grant Likely --- drivers/spi/spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 84c2861d6f4d..d3e64080c409 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -819,7 +819,7 @@ static void of_register_spi_devices(struct spi_master *master) if (!master->dev.of_node) return; - for_each_child_of_node(master->dev.of_node, nc) { + for_each_available_child_of_node(master->dev.of_node, nc) { /* Alloc an spi_device */ spi = spi_alloc_device(master); if (!spi) { -- cgit v1.2.3 From 465aac6d496aa3e99caaa6868865fb3830f73d80 Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Fri, 30 Nov 2012 10:01:51 +0000 Subject: Fix build when CONFIG_W1_MASTER_GPIO=m b exporting "allnodes" ERROR: "allnodes" [drivers/w1/masters/w1-gpio.ko] undefined! Signed-off-by: Randy Dunlap [grant.likely: allnodes is too generic; rename to of_allnodes] Signed-off-by: Grant Likely Cc: Ville Syrjala --- arch/arm/mach-vexpress/v2m.c | 2 +- drivers/of/base.c | 29 +++++++++++++++-------------- drivers/of/fdt.c | 2 +- drivers/of/pdt.c | 12 ++++++------ include/linux/of.h | 4 ++-- 5 files changed, 25 insertions(+), 24 deletions(-) (limited to 'drivers') diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c index 560e0df728f8..359f782c747d 100644 --- a/arch/arm/mach-vexpress/v2m.c +++ b/arch/arm/mach-vexpress/v2m.c @@ -589,7 +589,7 @@ void __init v2m_dt_init_early(void) return; /* Confirm board type against DT property, if available */ - if (of_property_read_u32(allnodes, "arm,hbi", &dt_hbi) == 0) { + if (of_property_read_u32(of_allnodes, "arm,hbi", &dt_hbi) == 0) { int site = v2m_get_master_site(); u32 id = readl(v2m_sysreg_base + (site == SYS_CFG_SITE_DB2 ? V2M_SYS_PROCID1 : V2M_SYS_PROCID0)); diff --git a/drivers/of/base.c b/drivers/of/base.c index c3724110a288..538e3cfad23e 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -45,7 +45,8 @@ struct alias_prop { static LIST_HEAD(aliases_lookup); -struct device_node *allnodes; +struct device_node *of_allnodes; +EXPORT_SYMBOL(of_allnodes); struct device_node *of_chosen; struct device_node *of_aliases; @@ -199,7 +200,7 @@ struct device_node *of_find_all_nodes(struct device_node *prev) struct device_node *np; read_lock(&devtree_lock); - np = prev ? prev->allnext : allnodes; + np = prev ? prev->allnext : of_allnodes; for (; np != NULL; np = np->allnext) if (of_node_get(np)) break; @@ -422,7 +423,7 @@ EXPORT_SYMBOL(of_get_child_by_name); */ struct device_node *of_find_node_by_path(const char *path) { - struct device_node *np = allnodes; + struct device_node *np = of_allnodes; read_lock(&devtree_lock); for (; np; np = np->allnext) { @@ -452,7 +453,7 @@ struct device_node *of_find_node_by_name(struct device_node *from, struct device_node *np; read_lock(&devtree_lock); - np = from ? from->allnext : allnodes; + np = from ? from->allnext : of_allnodes; for (; np; np = np->allnext) if (np->name && (of_node_cmp(np->name, name) == 0) && of_node_get(np)) @@ -481,7 +482,7 @@ struct device_node *of_find_node_by_type(struct device_node *from, struct device_node *np; read_lock(&devtree_lock); - np = from ? from->allnext : allnodes; + np = from ? from->allnext : of_allnodes; for (; np; np = np->allnext) if (np->type && (of_node_cmp(np->type, type) == 0) && of_node_get(np)) @@ -512,7 +513,7 @@ struct device_node *of_find_compatible_node(struct device_node *from, struct device_node *np; read_lock(&devtree_lock); - np = from ? from->allnext : allnodes; + np = from ? from->allnext : of_allnodes; for (; np; np = np->allnext) { if (type && !(np->type && (of_node_cmp(np->type, type) == 0))) @@ -545,7 +546,7 @@ struct device_node *of_find_node_with_property(struct device_node *from, struct property *pp; read_lock(&devtree_lock); - np = from ? from->allnext : allnodes; + np = from ? from->allnext : of_allnodes; for (; np; np = np->allnext) { for (pp = np->properties; pp; pp = pp->next) { if (of_prop_cmp(pp->name, prop_name) == 0) { @@ -616,7 +617,7 @@ struct device_node *of_find_matching_node_and_match(struct device_node *from, *match = NULL; read_lock(&devtree_lock); - np = from ? from->allnext : allnodes; + np = from ? from->allnext : of_allnodes; for (; np; np = np->allnext) { if (of_match_node(matches, np) && of_node_get(np)) { if (match) @@ -669,7 +670,7 @@ struct device_node *of_find_node_by_phandle(phandle handle) struct device_node *np; read_lock(&devtree_lock); - for (np = allnodes; np; np = np->allnext) + for (np = of_allnodes; np; np = np->allnext) if (np->phandle == handle) break; of_node_get(np); @@ -1254,9 +1255,9 @@ void of_attach_node(struct device_node *np) write_lock_irqsave(&devtree_lock, flags); np->sibling = np->parent->child; - np->allnext = allnodes; + np->allnext = of_allnodes; np->parent->child = np; - allnodes = np; + of_allnodes = np; write_unlock_irqrestore(&devtree_lock, flags); } @@ -1277,11 +1278,11 @@ void of_detach_node(struct device_node *np) if (!parent) goto out_unlock; - if (allnodes == np) - allnodes = np->allnext; + if (of_allnodes == np) + of_allnodes = np->allnext; else { struct device_node *prev; - for (prev = allnodes; + for (prev = of_allnodes; prev->allnext != np; prev = prev->allnext) ; diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index e36ff40011f4..a65c39c473bf 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -712,7 +712,7 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, */ void __init unflatten_device_tree(void) { - __unflatten_device_tree(initial_boot_params, &allnodes, + __unflatten_device_tree(initial_boot_params, &of_allnodes, early_init_dt_alloc_memory_arch); /* Get pointer to "/chosen" and "/aliasas" nodes for use everywhere */ diff --git a/drivers/of/pdt.c b/drivers/of/pdt.c index 07cc1d678e4d..37b56fd716e6 100644 --- a/drivers/of/pdt.c +++ b/drivers/of/pdt.c @@ -241,15 +241,15 @@ void __init of_pdt_build_devicetree(phandle root_node, struct of_pdt_ops *ops) BUG_ON(!ops); of_pdt_prom_ops = ops; - allnodes = of_pdt_create_node(root_node, NULL); + of_allnodes = of_pdt_create_node(root_node, NULL); #if defined(CONFIG_SPARC) - allnodes->path_component_name = ""; + of_allnodes->path_component_name = ""; #endif - allnodes->full_name = "/"; + of_allnodes->full_name = "/"; - nextp = &allnodes->allnext; - allnodes->child = of_pdt_build_tree(allnodes, - of_pdt_prom_ops->getchild(allnodes->phandle), &nextp); + nextp = &of_allnodes->allnext; + of_allnodes->child = of_pdt_build_tree(of_allnodes, + of_pdt_prom_ops->getchild(of_allnodes->phandle), &nextp); /* Get pointer to "/chosen" and "/aliasas" nodes for use everywhere */ of_alias_scan(kernel_tree_alloc); diff --git a/include/linux/of.h b/include/linux/of.h index 7337dc109c89..60053bd7e79a 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -88,14 +88,14 @@ static inline void of_node_put(struct device_node *node) { } #ifdef CONFIG_OF /* Pointer for first entry in chain of all nodes. */ -extern struct device_node *allnodes; +extern struct device_node *of_allnodes; extern struct device_node *of_chosen; extern struct device_node *of_aliases; extern rwlock_t devtree_lock; static inline bool of_have_populated_dt(void) { - return allnodes != NULL; + return of_allnodes != NULL; } static inline bool of_node_is_root(const struct device_node *node) -- cgit v1.2.3