0355-Added-Overlay-for-Microchip-MCP23017-I2C-gpio-expand.patch 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. From 58c72d20f05a5943b48d834e8388a58332897ed8 Mon Sep 17 00:00:00 2001
  2. From: Michael Kaplan <m.kaplan@evva.com>
  3. Date: Tue, 24 May 2016 10:19:08 +0200
  4. Subject: [PATCH] Added Overlay for Microchip MCP23017 I2C gpio expander
  5. ---
  6. arch/arm/boot/dts/overlays/README | 9 +++++
  7. arch/arm/boot/dts/overlays/mcp23017-overlay.dts | 54 +++++++++++++++++++++++++
  8. 2 files changed, 63 insertions(+)
  9. create mode 100644 arch/arm/boot/dts/overlays/mcp23017-overlay.dts
  10. --- a/arch/arm/boot/dts/overlays/README
  11. +++ b/arch/arm/boot/dts/overlays/README
  12. @@ -567,6 +567,15 @@ Params: gpio_out_pin GPIO for
  13. (default "off")
  14. +Name: mcp23017
  15. +Info: Configures the MCP23017 I2C port expander
  16. +Load: dtoverlay=mcp23017,<param>=<val>
  17. +Params: gpiopin Gpio pin connected to the INTA output of the
  18. + MCP23017 (default: 4)
  19. +
  20. + addr I2C address of the MCP23017 (default: 0x20)
  21. +
  22. +
  23. Name: mcp2515-can0
  24. Info: Configures the MCP2515 CAN controller on spi0.0
  25. Load: dtoverlay=mcp2515-can0,<param>=<val>
  26. --- /dev/null
  27. +++ b/arch/arm/boot/dts/overlays/mcp23017-overlay.dts
  28. @@ -0,0 +1,54 @@
  29. +// Definitions for MCP23017 Gpio Extender from Microchip Semiconductor
  30. +
  31. +/dts-v1/;
  32. +/plugin/;
  33. +
  34. +/ {
  35. + compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";
  36. +
  37. + fragment@0 {
  38. + target = <&i2c1>;
  39. + __overlay__ {
  40. + status = "okay";
  41. + };
  42. + };
  43. +
  44. + fragment@1 {
  45. + target = <&gpio>;
  46. + __overlay__ {
  47. + mcp23017_pins: mcp23017_pins {
  48. + brcm,pins = <4>;
  49. + brcm,function = <0>;
  50. + };
  51. + };
  52. + };
  53. +
  54. + fragment@2 {
  55. + target = <&i2c1>;
  56. + __overlay__ {
  57. + #address-cells = <1>;
  58. + #size-cells = <0>;
  59. +
  60. + mcp23017: mcp@20 {
  61. + compatible = "microchip,mcp23017";
  62. + reg = <0x20>;
  63. + gpio-controller;
  64. + #gpio-cells = <2>;
  65. + #interrupt-cells=<2>;
  66. + interrupt-parent = <&gpio>;
  67. + interrupts = <4 2>;
  68. + interrupt-controller;
  69. + microchip,irq-mirror;
  70. +
  71. + status = "okay";
  72. + };
  73. + };
  74. + };
  75. +
  76. + __overrides__ {
  77. + gpiopin = <&mcp23017_pins>,"brcm,pins:0",
  78. + <&mcp23017>,"interrupts:0";
  79. + addr = <&mcp23017>,"reg:0";
  80. + };
  81. +};
  82. +