gpio-mcp23s08.txt 3.8 KB

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