0070-Adding-w1-gpio-device-tree-overlays.patch 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. From 2fea9b14e39bd6c64e362ba7d170b67d09206987 Mon Sep 17 00:00:00 2001
  2. From: Phil Elwell <phil@raspberrypi.org>
  3. Date: Thu, 15 Jan 2015 10:39:06 +0000
  4. Subject: [PATCH 070/114] Adding w1-gpio device tree overlays
  5. N.B. Requires firmware supporting multi-target overrides
  6. w1-gpio-overlay:
  7. Use if a pullup pin is not required.
  8. Parameters:
  9. gpiopin=<i/o pin> // default 4
  10. w1-gpio-pullup-overlay:
  11. Use if a pullup pin is required.
  12. Parameters:
  13. gpiopin=<i/o pin> // default 4
  14. pullup=<pullup pin> // default 5
  15. ---
  16. arch/arm/boot/dts/w1-gpio-overlay.dts | 37 ++++++++++++++++++++++++++
  17. arch/arm/boot/dts/w1-gpio-pullup-overlay.dts | 39 ++++++++++++++++++++++++++++
  18. 2 files changed, 76 insertions(+)
  19. create mode 100644 arch/arm/boot/dts/w1-gpio-overlay.dts
  20. create mode 100644 arch/arm/boot/dts/w1-gpio-pullup-overlay.dts
  21. --- /dev/null
  22. +++ b/arch/arm/boot/dts/w1-gpio-overlay.dts
  23. @@ -0,0 +1,37 @@
  24. +// Definitions for lirc-rpi module
  25. +/dts-v1/;
  26. +/plugin/;
  27. +
  28. +/ {
  29. + compatible = "brcm,bcm2708";
  30. +
  31. + fragment@0 {
  32. + target-path = "/";
  33. + __overlay__ {
  34. +
  35. + w1: onewire@0 {
  36. + compatible = "w1-gpio";
  37. + pinctrl-names = "default";
  38. + pinctrl-0 = <&w1_pins>;
  39. + gpios = <&gpio 4 0>;
  40. + status = "okay";
  41. + };
  42. + };
  43. + };
  44. +
  45. + fragment@1 {
  46. + target = <&gpio>;
  47. + __overlay__ {
  48. + w1_pins: w1_pins {
  49. + brcm,pins = <4>;
  50. + brcm,function = <0>; // in (initially)
  51. + brcm,pull = <0>; // off
  52. + };
  53. + };
  54. + };
  55. +
  56. + __overrides__ {
  57. + gpiopin = <&w1>,"gpios:4",
  58. + <&w1_pins>,"brcm,pins:0";
  59. + };
  60. +};
  61. --- /dev/null
  62. +++ b/arch/arm/boot/dts/w1-gpio-pullup-overlay.dts
  63. @@ -0,0 +1,39 @@
  64. +// Definitions for lirc-rpi module
  65. +/dts-v1/;
  66. +/plugin/;
  67. +
  68. +/ {
  69. + compatible = "brcm,bcm2708";
  70. +
  71. + fragment@0 {
  72. + target-path = "/";
  73. + __overlay__ {
  74. +
  75. + w1: onewire@0 {
  76. + compatible = "w1-gpio";
  77. + pinctrl-names = "default";
  78. + pinctrl-0 = <&w1_pins>;
  79. + gpios = <&gpio 4 0>, <&gpio 5 1>;
  80. + status = "okay";
  81. + };
  82. + };
  83. + };
  84. +
  85. + fragment@1 {
  86. + target = <&gpio>;
  87. + __overlay__ {
  88. + w1_pins: w1_pins {
  89. + brcm,pins = <4 5>;
  90. + brcm,function = <0 1>; // in out
  91. + brcm,pull = <0 0>; // off off
  92. + };
  93. + };
  94. + };
  95. +
  96. + __overrides__ {
  97. + gpiopin = <&w1>,"gpios:4",
  98. + <&w1_pins>,"brcm,pins:0";
  99. + pullup = <&w1>,"gpios:16",
  100. + <&w1_pins>,"brcm,pins:4";
  101. + };
  102. +};