diff options
author | Lars Poeschel <poeschel@lemonage.de> | 2013-04-04 06:02:02 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2013-04-10 17:41:17 -0400 |
commit | 97ddb1c88b4ebe057b63346660abfee165ddd468 (patch) | |
tree | eff1fc4d226bc72ecc8ca3887552b5477ac9298f /Documentation/devicetree/bindings/gpio | |
parent | a2797beadfcb5a0974a30929b613b4d1adb023d1 (diff) |
gpio: mcp23s08: convert driver to DT
This converts the mcp23s08 driver to be able to be used with
device tree.
There is a "spi-present-mask" device tree property, that allows to
use multiple of this spi chips on the same chipselect.
v4:
- removed the ability to specify the pullup from device tree
- updated binding doc
v3:
- removed mcp,chips device tree property in favour of a
mcp,spi-present-mask and a flag for the pullup of every gpio
- seperated the match table. Now there is one for i2c and one for spi
- do the of reading stuff on stack of the probe function - no devm
any more
v2:
- squashed booth patches together
- fixed build warning, when CONFIG_OF is not defined
- use of_match_ptr macro for of_match_table
Signed-off-by: Lars Poeschel <poeschel@lemonage.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'Documentation/devicetree/bindings/gpio')
-rw-r--r-- | Documentation/devicetree/bindings/gpio/gpio-mcp23s08.txt | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/gpio/gpio-mcp23s08.txt b/Documentation/devicetree/bindings/gpio/gpio-mcp23s08.txt new file mode 100644 index 000000000000..629d0ef17308 --- /dev/null +++ b/Documentation/devicetree/bindings/gpio/gpio-mcp23s08.txt | |||
@@ -0,0 +1,47 @@ | |||
1 | Microchip MCP2308/MCP23S08/MCP23017/MCP23S17 driver for | ||
2 | 8-/16-bit I/O expander with serial interface (I2C/SPI) | ||
3 | |||
4 | Required properties: | ||
5 | - compatible : Should be | ||
6 | - "mcp,mcp23s08" for 8 GPIO SPI version | ||
7 | - "mcp,mcp23s17" for 16 GPIO SPI version | ||
8 | - "mcp,mcp23008" for 8 GPIO I2C version or | ||
9 | - "mcp,mcp23017" for 16 GPIO I2C version of the chip | ||
10 | - #gpio-cells : Should be two. | ||
11 | - first cell is the pin number | ||
12 | - second cell is used to specify flags. Flags are currently unused. | ||
13 | - gpio-controller : Marks the device node as a GPIO controller. | ||
14 | - reg : For an address on its bus. I2C uses this a the I2C address of the chip. | ||
15 | SPI uses this to specify the chipselect line which the chip is | ||
16 | connected to. The driver and the SPI variant of the chip support | ||
17 | multiple chips on the same chipselect. Have a look at | ||
18 | mcp,spi-present-mask below. | ||
19 | |||
20 | Required device specific properties (only for SPI chips): | ||
21 | - mcp,spi-present-mask : This is a present flag, that makes only sense for SPI | ||
22 | chips - as the name suggests. Multiple SPI chips can share the same | ||
23 | SPI chipselect. Set a bit in bit0-7 in this mask to 1 if there is a | ||
24 | chip connected with the corresponding spi address set. For example if | ||
25 | you have a chip with address 3 connected, you have to set bit3 to 1, | ||
26 | which is 0x08. mcp23s08 chip variant only supports bits 0-3. It is not | ||
27 | possible to mix mcp23s08 and mcp23s17 on the same chipselect. Set at | ||
28 | least one bit to 1 for SPI chips. | ||
29 | - spi-max-frequency = The maximum frequency this chip is able to handle | ||
30 | |||
31 | Example I2C: | ||
32 | gpiom1: gpio@20 { | ||
33 | compatible = "mcp,mcp23017"; | ||
34 | gpio-controller; | ||
35 | #gpio-cells = <2>; | ||
36 | reg = <0x20>; | ||
37 | }; | ||
38 | |||
39 | Example SPI: | ||
40 | gpiom1: gpio@0 { | ||
41 | compatible = "mcp,mcp23s17"; | ||
42 | gpio-controller; | ||
43 | #gpio-cells = <2>; | ||
44 | spi-present-mask = <0x01>; | ||
45 | reg = <0>; | ||
46 | spi-max-frequency = <1000000>; | ||
47 | }; | ||