brcm2708: add kernel 4.14 support
[openwrt/staging/chunkeey.git] / target / linux / brcm2708 / patches-4.14 / 950-0233-overlays-Rework-sdio-overlays-to-allow-polling.patch
1 From 152d226fd2eff1fdc1f8881287bf1a7d4560b27e Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Mon, 26 Feb 2018 19:46:32 +0000
4 Subject: [PATCH 233/454] overlays: Rework sdio overlays to allow polling
5
6 MMC/SD interfaces support a DT property (non-removable) that disables
7 the usual polling required to detect card removal for a configuration
8 that doesn't have hardware card presence detection. This property is
9 required for the on-board SDIO WiFi interface, but other uses of the
10 interface may want the polling to be re-enabled.
11
12 'non-removable' is a boolean DT property - true if present, false if
13 absent - and the overlay mechanism does not allow a property in the
14 base DTB to be deleted, so if the base DTB has non-removable set
15 (which is true for all WiFi-equipped Pis) then an overlay cannot
16 unset it.
17
18 Modify the SDIO overlays to work around this problem by disabling
19 the mmc node and adding a clone to which non-removable may
20 optionally be added.
21
22 N.B. The default state of poll_once is still true, and the overlay
23 does include a non-removable property, but setting poll_once to false
24 ("off") will remove the property from the overlay before it is applied.
25
26 See: https://github.com/raspberrypi/linux/issues/2401
27
28 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
29 ---
30 .../boot/dts/overlays/sdio-1bit-overlay.dts | 40 +++++++++++++-----
31 arch/arm/boot/dts/overlays/sdio-overlay.dts | 41 ++++++++++++++-----
32 2 files changed, 59 insertions(+), 22 deletions(-)
33
34 --- a/arch/arm/boot/dts/overlays/sdio-1bit-overlay.dts
35 +++ b/arch/arm/boot/dts/overlays/sdio-1bit-overlay.dts
36 @@ -8,21 +8,39 @@
37
38 fragment@0 {
39 target = <&mmc>;
40 - sdio_mmc: __overlay__ {
41 - compatible = "brcm,bcm2835-mmc";
42 - pinctrl-names = "default";
43 - pinctrl-0 = <&sdio_pins>;
44 - non-removable;
45 - bus-width = <1>;
46 - brcm,overclock-50 = <0>;
47 - status = "okay";
48 + __overlay__ {
49 + status = "disabled";
50 };
51 };
52
53 fragment@1 {
54 + target = <&soc>;
55 + __overlay__ {
56 + #address-cells = <1>;
57 + #size-cells = <1>;
58 +
59 + sdio_1bit: sdio@7e300000 {
60 + compatible = "brcm,bcm2835-mmc",
61 + "brcm,bcm2835-sdhci";
62 + reg = <0x7e300000 0x100>;
63 + interrupts = <2 30>;
64 + clocks = <&clocks 28/*BCM2835_CLOCK_EMMC*/>;
65 + dmas = <&dma 11>;
66 + dma-names = "rx-tx";
67 + brcm,overclock-50 = <0>;
68 + status = "okay";
69 + pinctrl-names = "default";
70 + pinctrl-0 = <&sdio_1bit_pins>;
71 + non-removable;
72 + bus-width = <1>;
73 + };
74 + };
75 + };
76 +
77 + fragment@2 {
78 target = <&gpio>;
79 __overlay__ {
80 - sdio_pins: sdio_pins {
81 + sdio_1bit_pins: sdio_1bit_pins {
82 brcm,pins = <22 23 24 25>;
83 brcm,function = <7>; /* ALT3 = SD1 */
84 brcm,pull = <0 2 2 2>;
85 @@ -31,7 +49,7 @@
86 };
87
88 __overrides__ {
89 - poll_once = <&sdio_mmc>,"non-removable?";
90 - sdio_overclock = <&sdio_mmc>,"brcm,overclock-50:0";
91 + poll_once = <&sdio_1bit>,"non-removable?";
92 + sdio_overclock = <&sdio_1bit>,"brcm,overclock-50:0";
93 };
94 };
95 --- a/arch/arm/boot/dts/overlays/sdio-overlay.dts
96 +++ b/arch/arm/boot/dts/overlays/sdio-overlay.dts
97 @@ -8,20 +8,39 @@
98
99 fragment@0 {
100 target = <&mmc>;
101 - sdio_mmc: __overlay__ {
102 - pinctrl-names = "default";
103 - pinctrl-0 = <&sdio_pins>;
104 - non-removable;
105 - bus-width = <4>;
106 - brcm,overclock-50 = <0>;
107 - status = "okay";
108 + __overlay__ {
109 + status = "disabled";
110 };
111 };
112
113 fragment@1 {
114 + target = <&soc>;
115 + __overlay__ {
116 + #address-cells = <1>;
117 + #size-cells = <1>;
118 +
119 + sdio_ovl: sdio@7e300000 {
120 + compatible = "brcm,bcm2835-mmc",
121 + "brcm,bcm2835-sdhci";
122 + reg = <0x7e300000 0x100>;
123 + interrupts = <2 30>;
124 + clocks = <&clocks 28/*BCM2835_CLOCK_EMMC*/>;
125 + dmas = <&dma 11>;
126 + dma-names = "rx-tx";
127 + brcm,overclock-50 = <0>;
128 + status = "okay";
129 + pinctrl-names = "default";
130 + pinctrl-0 = <&sdio_ovl_pins>;
131 + non-removable;
132 + bus-width = <1>;
133 + };
134 + };
135 + };
136 +
137 + fragment@2 {
138 target = <&gpio>;
139 __overlay__ {
140 - sdio_pins: sdio_pins {
141 + sdio_ovl_pins: sdio_ovl_pins {
142 brcm,pins = <22 23 24 25 26 27>;
143 brcm,function = <7>; /* ALT3 = SD1 */
144 brcm,pull = <0 2 2 2 2 2>;
145 @@ -30,8 +49,8 @@
146 };
147
148 __overrides__ {
149 - poll_once = <&sdio_mmc>,"non-removable?";
150 - bus_width = <&sdio_mmc>,"bus-width:0";
151 - sdio_overclock = <&sdio_mmc>,"brcm,overclock-50:0";
152 + poll_once = <&sdio_ovl>,"non-removable?";
153 + bus_width = <&sdio_ovl>,"bus-width:0";
154 + sdio_overclock = <&sdio_ovl>,"brcm,overclock-50:0";
155 };
156 };