aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm2708/patches-3.18/0070-Adding-w1-gpio-device-tree-overlays.patch
blob: bf1a63433bc5fe74d16a003b06758fc6ce485841 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
From 2fea9b14e39bd6c64e362ba7d170b67d09206987 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.org>
Date: Thu, 15 Jan 2015 10:39:06 +0000
Subject: [PATCH 070/114] Adding w1-gpio device tree overlays

N.B. Requires firmware supporting multi-target overrides

w1-gpio-overlay:
  Use if a pullup pin is not required.
  Parameters:
    gpiopin=<i/o pin>     // default 4

w1-gpio-pullup-overlay:
  Use if a pullup pin is required.
  Parameters:
    gpiopin=<i/o pin>     // default 4
    pullup=<pullup pin>   // default 5
---
 arch/arm/boot/dts/w1-gpio-overlay.dts        | 37 ++++++++++++++++++++++++++
 arch/arm/boot/dts/w1-gpio-pullup-overlay.dts | 39 ++++++++++++++++++++++++++++
 2 files changed, 76 insertions(+)
 create mode 100644 arch/arm/boot/dts/w1-gpio-overlay.dts
 create mode 100644 arch/arm/boot/dts/w1-gpio-pullup-overlay.dts

--- /dev/null
+++ b/arch/arm/boot/dts/w1-gpio-overlay.dts
@@ -0,0 +1,37 @@
+// Definitions for lirc-rpi module
+/dts-v1/;
+/plugin/;
+
+/ {
+	compatible = "brcm,bcm2708";
+
+	fragment@0 {
+		target-path = "/";
+		__overlay__ {
+
+			w1: onewire@0 {
+				compatible = "w1-gpio";
+				pinctrl-names = "default";
+				pinctrl-0 = <&w1_pins>;
+				gpios = <&gpio 4 0>;
+				status = "okay";
+			};
+		};
+	};
+
+	fragment@1 {
+		target = <&gpio>;
+		__overlay__ {
+			w1_pins: w1_pins {
+				brcm,pins = <4>;
+				brcm,function = <0>; // in (initially)
+				brcm,pull = <0>; // off
+			};
+		};
+	};
+
+	__overrides__ {
+		gpiopin =       <&w1>,"gpios:4",
+				<&w1_pins>,"brcm,pins:0";
+	};
+};
--- /dev/null
+++ b/arch/arm/boot/dts/w1-gpio-pullup-overlay.dts
@@ -0,0 +1,39 @@
+// Definitions for lirc-rpi module
+/dts-v1/;
+/plugin/;
+
+/ {
+	compatible = "brcm,bcm2708";
+
+	fragment@0 {
+		target-path = "/";
+		__overlay__ {
+
+			w1: onewire@0 {
+				compatible = "w1-gpio";
+				pinctrl-names = "default";
+				pinctrl-0 = <&w1_pins>;
+				gpios = <&gpio 4 0>, <&gpio 5 1>;
+				status = "okay";
+			};
+		};
+	};
+
+	fragment@1 {
+		target = <&gpio>;
+		__overlay__ {
+			w1_pins: w1_pins {
+				brcm,pins = <4 5>;
+				brcm,function = <0 1>; // in out
+				brcm,pull = <0 0>; // off off
+			};
+		};
+	};
+
+	__overrides__ {
+		gpiopin =       <&w1>,"gpios:4",
+				<&w1_pins>,"brcm,pins:0";
+		pullup =        <&w1>,"gpios:16",
+				<&w1_pins>,"brcm,pins:4";
+	};
+};