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