Updates for BSP v5.5.0
[AGL/meta-agl-refhw.git] / meta-agl-refhw-gen3 / recipes-kernel / linux / files / 0003-Add-support-for-TI-WL1837.patch
1 From 8d08ab1372ede05e1c9dabdd242fd4bb1e0be414 Mon Sep 17 00:00:00 2001
2 From: Scott Murray <scott.murray@konsulko.com>
3 Date: Tue, 21 Sep 2021 15:52:18 -0400
4 Subject: [PATCH 3/4] Add support for TI WL1837
5
6 This patch adds description of TI WL1837 and links interfaces
7 to communicate with the IC.
8
9 Signed-off-by: ito.yoshiki001 <ito.yoshiki001@jp.panasonic.com>
10
11 Reworked:
12 - WL1837 specific devicetree configuration moved to the board
13   specific r8a77951-agl-refhw.dts from agl-refhw-common.dtsi.
14 - Switched to HCI_LL driver for BT support to match other upstream
15   users and prepare for btwilink driver going away (dropped in 5.5
16   upstream).
17 - WLAN_PWR_EN enabling moved to GPIO initialization to work around
18   BT initialization problems.
19 - Update sound configuration to enable WL1837 BT audio, and disable
20   the HDMI1 audio left over from the original Salvator-X devicetree.
21   The latter is clean up, as HDMI1 as defined uses a SSI that
22   conflicts with the ak4613 configuration.
23 - Updated for kernel 5.10 in BSP v5.5.0.
24
25 Signed-off-by: Scott Murray <scott.murray@konsulko.com>
26 ---
27  .../boot/dts/renesas/agl-refhw-common.dtsi    | 37 +++++---
28  .../boot/dts/renesas/r8a77951-agl-refhw.dts   | 84 +++++++++++++++----
29  2 files changed, 94 insertions(+), 27 deletions(-)
30
31 diff --git a/arch/arm64/boot/dts/renesas/agl-refhw-common.dtsi b/arch/arm64/boot/dts/renesas/agl-refhw-common.dtsi
32 index 7474ed578c21..3ae835a1ff13 100644
33 --- a/arch/arm64/boot/dts/renesas/agl-refhw-common.dtsi
34 +++ b/arch/arm64/boot/dts/renesas/agl-refhw-common.dtsi
35 @@ -183,6 +183,18 @@ vccq_sdhi3: regulator-vccq-sdhi3 {
36                           1800000 0>;
37         };
38  
39 +       wlan_en: regulator-wlan_en {
40 +               compatible = "regulator-fixed";
41 +
42 +               regulator-name = "wlan-en-regulator";
43 +               regulator-min-microvolt = <3300000>;
44 +               regulator-max-microvolt = <3300000>;
45 +
46 +               gpio = <&gpio7 2 GPIO_ACTIVE_HIGH>;
47 +               startup-delay-us = <70000>;
48 +               enable-active-high;
49 +       };
50 +
51         hdmi0-out {
52                 compatible = "hdmi-connector";
53                 label = "HDMI0 OUT";
54 @@ -673,7 +685,8 @@ sdhi3_pins_uhs: sd3_uhs {
55         };
56  
57         sound_pins: sound {
58 -               groups = "ssi349_ctrl", "ssi3_data", "ssi4_data";
59 +               groups = "ssi349_ctrl", "ssi3_data", "ssi4_data",
60 +                        "ssi78_ctrl", "ssi7_data", "ssi8_data";
61                 function = "ssi";
62         };
63  
64 @@ -828,24 +841,28 @@ &sdhi2 {
65  };
66  
67  &sdhi3 {
68 +       /* Default WLAN card configuration */
69         pinctrl-0 = <&sdhi3_pins>;
70 -       pinctrl-1 = <&sdhi3_pins_uhs>;
71 -       pinctrl-names = "default", "state_uhs";
72 +       pinctrl-names = "default";
73  
74 -       vmmc-supply = <&vcc_sdhi3>;
75 -       vqmmc-supply = <&vccq_sdhi3>;
76 -       cd-gpios = <&gpio4 15 GPIO_ACTIVE_LOW>;
77 -       wp-gpios = <&gpio4 16 GPIO_ACTIVE_HIGH>;
78 +       vmmc-supply = <&wlan_en>;
79         bus-width = <4>;
80 -       sd-uhs-sdr50;
81 -       sd-uhs-sdr104;
82 -       status = "okay";
83 +       no-1-8-v;
84 +       non-removable;
85 +       cap-power-off-card;
86 +       keep-power-in-suspend;
87 +
88 +       /* leave disabled by default */
89  };
90  
91  &ssi4 {
92         shared-pin;
93  };
94  
95 +&ssi8 {
96 +       shared-pin;
97 +};
98 +
99  &usb_extal_clk {
100         clock-frequency = <50000000>;
101  };
102 diff --git a/arch/arm64/boot/dts/renesas/r8a77951-agl-refhw.dts b/arch/arm64/boot/dts/renesas/r8a77951-agl-refhw.dts
103 index 3d1107f6d9cc..24ba2c5c4b88 100644
104 --- a/arch/arm64/boot/dts/renesas/r8a77951-agl-refhw.dts
105 +++ b/arch/arm64/boot/dts/renesas/r8a77951-agl-refhw.dts
106 @@ -119,6 +119,23 @@ adv7123_out: endpoint {
107                 };
108         };
109  
110 +       sound_wl18xx {
111 +               compatible = "audio-graph-card";
112 +               label = "wl18xx";
113 +
114 +               dais = <&rsnd_port2>;
115 +       };
116 +
117 +       wl18xx_pcm {
118 +               compatible = "ti,wl18xx-pcm";
119 +               status = "okay";
120 +
121 +               port {
122 +                       wl18xx_endpoint: endpoint {
123 +                               remote-endpoint = <&rsnd_for_wl18xx>;
124 +                       };
125 +               };
126 +       };
127  };
128  
129  &adsp {
130 @@ -155,8 +172,14 @@ &hsusb3 {
131  
132  &sound_card {
133         dais = <&rsnd_port0     /* ak4613 */
134 -               &rsnd_port1     /* HDMI0  */
135 -               &rsnd_port2>;   /* HDMI1  */
136 +               &rsnd_port1>;   /* HDMI0  */
137 +};
138 +
139 +&hscif0 {
140 +       bluetooth {
141 +               compatible = "ti,wl1837-st";
142 +               enable-gpios = <&gpio7 3 GPIO_ACTIVE_HIGH>;
143 +       };
144  };
145  
146  &hdmi0 {
147 @@ -192,12 +215,6 @@ rcar_dw_hdmi1_out: endpoint {
148                                 remote-endpoint = <&hdmi1_con>;
149                         };
150                 };
151 -               port@2 {
152 -                       reg = <2>;
153 -                       dw_hdmi1_snd_in: endpoint {
154 -                               remote-endpoint = <&rsnd_endpoint2>;
155 -                       };
156 -               };
157         };
158  };
159  
160 @@ -215,8 +232,11 @@ &ohci3 {
161  };
162  
163  &rcar_sound {
164 +       /* Multi DAI */
165 +       #sound-dai-cells = <1>;
166 +
167         ports {
168 -               /* rsnd_port0 is on salvator-common */
169 +               /* rsnd_port0 is in agl-refhw-common */
170                 rsnd_port1: port@1 {
171                         reg = <1>;
172                         rsnd_endpoint1: endpoint {
173 @@ -231,14 +251,15 @@ rsnd_endpoint1: endpoint {
174                 };
175                 rsnd_port2: port@2 {
176                         reg = <2>;
177 -                       rsnd_endpoint2: endpoint {
178 -                               remote-endpoint = <&dw_hdmi1_snd_in>;
179 +                       rsnd_for_wl18xx: endpoint {
180 +                               remote-endpoint = <&wl18xx_endpoint>;
181  
182 -                               dai-format = "i2s";
183 -                               bitclock-master = <&rsnd_endpoint2>;
184 -                               frame-master = <&rsnd_endpoint2>;
185 +                               simple-audio-card,format = "i2s";
186 +                               bitclock-master = <&wl18xx_endpoint>;
187 +                               frame-master = <&wl18xx_endpoint>;
188  
189 -                               playback = <&ssi3>;
190 +                               playback = <&ssi7>;
191 +                               capture = <&ssi8>;
192                         };
193                 };
194         };
195 @@ -373,11 +394,40 @@ &sdhi0 {
196  };
197  
198  &sdhi3 {
199 -       /delete-property/ wp-gpios;
200 -       non-removable;
201 +       status = "okay";
202 +
203 +       max-frequency = <50000000>;
204 +
205 +       #address-cells = <1>;
206 +       #size-cells = <0>;
207 +       wlcore: wlcore@2 {
208 +               compatible = "ti,wl1837";
209 +               reg = <2>;
210 +               interrupt-parent = <&gpio1>;
211 +               interrupts = <25 IRQ_TYPE_EDGE_FALLING>;
212 +       };
213  };
214  
215  &gpio6 {
216 +       /*
217 +        * Enable WLAN_PWR_EN right from boot to get reliable BT
218 +        * initialization, as doing it at SDHI initialization
219 +        * does not seem to do so, no matter how much BT_EN is
220 +        * delayed.
221 +        *
222 +        * This is perhaps not ideal per the requirements described
223 +        * in the "Level Shifting WL18xx/WL18xxMOD/WL18xxQ I/Os"
224 +        * document (SWRA448A)[1], but the BT UART seems unusable
225 +        * otherwise.
226 +        *
227 +        * [1] https://www.ti.com/lit/an/swra448a/swra448a.pdf
228 +        */
229 +       wlan-pwr-en {
230 +               gpio-hog;
231 +               gpios = <9 GPIO_ACTIVE_HIGH>;
232 +               output-high;
233 +       };
234 +
235         /* Enable the CAN 1 & 2 transceivers */
236         can-1-transceiver-stb {
237                 gpio-hog;
238 -- 
239 2.31.1
240