0161-DT-Add-overlays-to-configure-I2C-pins.patch 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. From e4fc78fecfc8cf3cf04b252d0822b2ebd149c031 Mon Sep 17 00:00:00 2001
  2. From: Dave Stevenson <6by9@users.noreply.github.com>
  3. Date: Mon, 8 Feb 2016 23:49:41 +0000
  4. Subject: [PATCH 161/381] DT: Add overlays to configure I2C pins
  5. Lifted from
  6. https://www.raspberrypi.org/forums/viewtopic.php?f=107&t=120938&p=825883
  7. so not claiming this to be my own work.
  8. Adds overlays i2c0-bcm2708 and i2c1-bcm2708 that allow the pin
  9. allocations for i2c-0 and i2c-1 to be changed.
  10. ---
  11. arch/arm/boot/dts/overlays/Makefile | 2 ++
  12. arch/arm/boot/dts/overlays/README | 16 ++++++++++
  13. .../arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts | 36 +++++++++++++++++++++
  14. .../arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts | 37 ++++++++++++++++++++++
  15. 4 files changed, 91 insertions(+)
  16. create mode 100644 arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts
  17. create mode 100644 arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts
  18. --- a/arch/arm/boot/dts/overlays/Makefile
  19. +++ b/arch/arm/boot/dts/overlays/Makefile
  20. @@ -29,6 +29,8 @@ dtb-$(RPI_DT_OVERLAYS) += hy28a-overlay.
  21. dtb-$(RPI_DT_OVERLAYS) += hy28b-overlay.dtb
  22. dtb-$(RPI_DT_OVERLAYS) += i2c-rtc-overlay.dtb
  23. dtb-$(RPI_DT_OVERLAYS) += i2c-gpio-overlay.dtb
  24. +dtb-$(RPI_DT_OVERLAYS) += i2c0-bcm2708-overlay.dtb
  25. +dtb-$(RPI_DT_OVERLAYS) += i2c1-bcm2708-overlay.dtb
  26. dtb-$(RPI_DT_OVERLAYS) += i2s-mmap-overlay.dtb
  27. dtb-$(RPI_DT_OVERLAYS) += iqaudio-dac-overlay.dtb
  28. dtb-$(RPI_DT_OVERLAYS) += iqaudio-dacplus-overlay.dtb
  29. --- a/arch/arm/boot/dts/overlays/README
  30. +++ b/arch/arm/boot/dts/overlays/README
  31. @@ -371,6 +371,22 @@ Params: ds1307 Select t
  32. pcf8563 Select the PCF8563 device
  33. +Name: i2c0-bcm2708
  34. +Info: Enable the i2c_bcm2708 driver for the i2c0 bus
  35. +Load: dtoverlay=i2c0-bcm2708,<param>=<val>
  36. +Params: sda0_pin GPIO pin for SDA0 (0, 28 [or 44] - default 0)
  37. + scl0_pin GPIO pin for SCL0 (1, 29 [or 45] - default 1)
  38. +
  39. +
  40. +Name: i2c1-bcm2708
  41. +Info: Enable the i2c_bcm2708 driver for the i2c1 bus
  42. +Load: dtoverlay=i2c1-bcm2708,<param>=<val>
  43. +Params: sda1_pin GPIO pin for SDA1 (2 or 44 - default 2)
  44. + scl1_pin GPIO pin for SCL1 (3 or 45 - default 3)
  45. + pin_func Alternative pin function (4 (alt0), 6 (alt2) -
  46. + default 4)
  47. +
  48. +
  49. Name: i2s-mmap
  50. Info: Enables mmap support in the bcm2708-i2s driver
  51. Load: dtoverlay=i2s-mmap
  52. --- /dev/null
  53. +++ b/arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts
  54. @@ -0,0 +1,36 @@
  55. +/*
  56. + * Device tree overlay for i2c_bcm2708, i2c0 bus
  57. + *
  58. + * Compile:
  59. + * dtc -@ -I dts -O dtb -o i2c0-bcm2708-overlay.dtb i2c0-bcm2708-overlay.dts
  60. + */
  61. +
  62. +/dts-v1/;
  63. +/plugin/;
  64. +
  65. +/{
  66. + compatible = "brcm,bcm2708";
  67. +
  68. + fragment@0 {
  69. + target = <&i2c0>;
  70. + __overlay__ {
  71. + pinctrl-0 = <&i2c0_pins>;
  72. + status = "okay";
  73. + };
  74. + };
  75. +
  76. + fragment@1 {
  77. + target = <&gpio>;
  78. + __overlay__ {
  79. + i2c0_pins: i2c0 {
  80. + brcm,pins = <0 1>;
  81. + brcm,function = <4>; /* alt0 */
  82. + };
  83. + };
  84. + };
  85. +
  86. + __overrides__ {
  87. + sda0_pin = <&i2c0_pins>,"brcm,pins:0";
  88. + scl0_pin = <&i2c0_pins>,"brcm,pins:4";
  89. + };
  90. +};
  91. --- /dev/null
  92. +++ b/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts
  93. @@ -0,0 +1,37 @@
  94. +/*
  95. + * Device tree overlay for i2c_bcm2708, i2c1 bus
  96. + *
  97. + * Compile:
  98. + * dtc -@ -I dts -O dtb -o i2c1-bcm2708-overlay.dtb i2c1-bcm2708-overlay.dts
  99. + */
  100. +
  101. +/dts-v1/;
  102. +/plugin/;
  103. +
  104. +/{
  105. + compatible = "brcm,bcm2708";
  106. +
  107. + fragment@0 {
  108. + target = <&i2c1>;
  109. + __overlay__ {
  110. + pinctrl-0 = <&i2c1_pins>;
  111. + status = "okay";
  112. + };
  113. + };
  114. +
  115. + fragment@1 {
  116. + target = <&gpio>;
  117. + __overlay__ {
  118. + i2c1_pins: i2c1 {
  119. + brcm,pins = <2 3>;
  120. + brcm,function = <4>; /* alt0 */
  121. + };
  122. + };
  123. + };
  124. +
  125. + __overrides__ {
  126. + sda1_pin = <&i2c1_pins>,"brcm,pins:0";
  127. + scl1_pin = <&i2c1_pins>,"brcm,pins:4";
  128. + pin_func = <&i2c1_pins>,"brcm,function:0";
  129. + };
  130. +};