blob: c306a2d0f2b1fb4c66a7e54bd8f9bd3c5ee667cb [file] [log] [blame]
Lars Poeschel97ddb1c2013-04-04 12:02:02 +02001Microchip MCP2308/MCP23S08/MCP23017/MCP23S17 driver for
28-/16-bit I/O expander with serial interface (I2C/SPI)
3
4Required properties:
5- compatible : Should be
Lars Poeschel45971682013-08-28 10:38:50 +02006 - "mcp,mcp23s08" (DEPRECATED) for 8 GPIO SPI version
7 - "mcp,mcp23s17" (DEPRECATED) for 16 GPIO SPI version
8 - "mcp,mcp23008" (DEPRECATED) for 8 GPIO I2C version or
9 - "mcp,mcp23017" (DEPRECATED) for 16 GPIO I2C version of the chip
10
11 - "microchip,mcp23s08" for 8 GPIO SPI version
12 - "microchip,mcp23s17" for 16 GPIO SPI version
13 - "microchip,mcp23008" for 8 GPIO I2C version or
14 - "microchip,mcp23017" for 16 GPIO I2C version of the chip
15 NOTE: Do not use the old mcp prefix any more. It is deprecated and will be
16 removed.
Lars Poeschel97ddb1c2013-04-04 12:02:02 +020017- #gpio-cells : Should be two.
18 - first cell is the pin number
19 - second cell is used to specify flags. Flags are currently unused.
20- gpio-controller : Marks the device node as a GPIO controller.
21- reg : For an address on its bus. I2C uses this a the I2C address of the chip.
22 SPI uses this to specify the chipselect line which the chip is
23 connected to. The driver and the SPI variant of the chip support
24 multiple chips on the same chipselect. Have a look at
Lars Poeschel45971682013-08-28 10:38:50 +020025 microchip,spi-present-mask below.
Lars Poeschel97ddb1c2013-04-04 12:02:02 +020026
27Required device specific properties (only for SPI chips):
Lars Poeschel45971682013-08-28 10:38:50 +020028- mcp,spi-present-mask (DEPRECATED)
29- microchip,spi-present-mask : This is a present flag, that makes only sense for SPI
Lars Poeschel97ddb1c2013-04-04 12:02:02 +020030 chips - as the name suggests. Multiple SPI chips can share the same
31 SPI chipselect. Set a bit in bit0-7 in this mask to 1 if there is a
32 chip connected with the corresponding spi address set. For example if
33 you have a chip with address 3 connected, you have to set bit3 to 1,
34 which is 0x08. mcp23s08 chip variant only supports bits 0-3. It is not
35 possible to mix mcp23s08 and mcp23s17 on the same chipselect. Set at
36 least one bit to 1 for SPI chips.
Lars Poeschel45971682013-08-28 10:38:50 +020037 NOTE: Do not use the old mcp prefix any more. It is deprecated and will be
38 removed.
Lars Poeschel97ddb1c2013-04-04 12:02:02 +020039- spi-max-frequency = The maximum frequency this chip is able to handle
40
Lars Poeschel4e47f912014-01-16 11:44:15 +010041Optional properties:
42- #interrupt-cells : Should be two.
43 - first cell is the pin number
44 - second cell is used to specify flags.
45- interrupt-controller: Marks the device node as a interrupt controller.
46NOTE: The interrupt functionality is only supported for i2c versions of the
47chips. The spi chips can also do the interrupts, but this is not supported by
48the linux driver yet.
49
50Optional device specific properties:
51- microchip,irq-mirror: Sets the mirror flag in the IOCON register. Devices
52 with two interrupt outputs (these are the devices ending with 17 and
53 those that have 16 IOs) have two IO banks: IO 0-7 form bank 1 and
54 IO 8-15 are bank 2. These chips have two different interrupt outputs:
55 One for bank 1 and another for bank 2. If irq-mirror is set, both
56 interrupts are generated regardless of the bank that an input change
Carlos Garciac98be0c2014-04-04 22:31:00 -040057 occurred on. If it is not set, the interrupt are only generated for the
Lars Poeschel4e47f912014-01-16 11:44:15 +010058 bank they belong to.
59 On devices with only one interrupt output this property is useless.
60
61Example I2C (with interrupt):
Lars Poeschel97ddb1c2013-04-04 12:02:02 +020062gpiom1: gpio@20 {
Lars Poeschel45971682013-08-28 10:38:50 +020063 compatible = "microchip,mcp23017";
Lars Poeschel97ddb1c2013-04-04 12:02:02 +020064 gpio-controller;
65 #gpio-cells = <2>;
66 reg = <0x20>;
Lars Poeschel4e47f912014-01-16 11:44:15 +010067
68 interrupt-parent = <&gpio1>;
69 interrupts = <17 IRQ_TYPE_LEVEL_LOW>;
70 interrupt-controller;
71 #interrupt-cells=<2>;
72 microchip,irq-mirror;
Lars Poeschel97ddb1c2013-04-04 12:02:02 +020073};
74
75Example SPI:
76gpiom1: gpio@0 {
Lars Poeschel45971682013-08-28 10:38:50 +020077 compatible = "microchip,mcp23s17";
Lars Poeschel97ddb1c2013-04-04 12:02:02 +020078 gpio-controller;
79 #gpio-cells = <2>;
80 spi-present-mask = <0x01>;
81 reg = <0>;
82 spi-max-frequency = <1000000>;
83};