arm64: dts: qcom: sm7225-fairphone-fp4: Add Bluetooth
authorLuca Weiss <luca.weiss@fairphone.com>
Fri, 12 May 2023 13:58:26 +0000 (15:58 +0200)
committerBjorn Andersson <andersson@kernel.org>
Tue, 13 Jun 2023 22:06:12 +0000 (15:06 -0700)
The device has a WCN3988 chip for WiFi and Bluetooth. Configure the
Bluetooth node and enable the UART it is connected to, plus the
necessary pinctrl that has been borrowed with comments from
sc7280-idp.dtsi.

Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Link: https://lore.kernel.org/r/20230421-fp4-bluetooth-v2-4-3de840d5483e@fairphone.com
arch/arm64/boot/dts/qcom/sm7225-fairphone-fp4.dts

index 7ae6aba..e3dc499 100644 (file)
@@ -31,6 +31,7 @@
 
        aliases {
                serial0 = &uart9;
+               serial1 = &uart1;
        };
 
        chosen {
        };
 };
 
+&qup_uart1_cts {
+       /*
+        * Configure a bias-bus-hold on CTS to lower power
+        * usage when Bluetooth is turned off. Bus hold will
+        * maintain a low power state regardless of whether
+        * the Bluetooth module drives the pin in either
+        * direction or leaves the pin fully unpowered.
+        */
+       bias-bus-hold;
+};
+
+&qup_uart1_rts {
+       /* We'll drive RTS, so no pull */
+       drive-strength = <2>;
+       bias-disable;
+};
+
+&qup_uart1_rx {
+       /*
+        * Configure a pull-up on RX. This is needed to avoid
+        * garbage data when the TX pin of the Bluetooth module is
+        * in tri-state (module powered off or not driving the
+        * signal yet).
+        */
+       bias-pull-up;
+};
+
+&qup_uart1_tx {
+       /* We'll drive TX, so no pull */
+       drive-strength = <2>;
+       bias-disable;
+};
+
 &qupv3_id_0 {
        status = "okay";
 };
 
 &tlmm {
        gpio-reserved-ranges = <13 4>, <56 2>;
+
+       qup_uart1_sleep_cts: qup-uart1-sleep-cts-state {
+               pins = "gpio61";
+               function = "gpio";
+               /*
+                * Configure a bias-bus-hold on CTS to lower power
+                * usage when Bluetooth is turned off. Bus hold will
+                * maintain a low power state regardless of whether
+                * the Bluetooth module drives the pin in either
+                * direction or leaves the pin fully unpowered.
+                */
+               bias-bus-hold;
+       };
+
+       qup_uart1_sleep_rts: qup-uart1-sleep-rts-state {
+               pins = "gpio62";
+               function = "gpio";
+               /*
+                * Configure pull-down on RTS. As RTS is active low
+                * signal, pull it low to indicate the BT SoC that it
+                * can wakeup the system anytime from suspend state by
+                * pulling RX low (by sending wakeup bytes).
+                */
+               bias-pull-down;
+       };
+
+       qup_uart1_sleep_rx: qup-uart1-sleep-rx-state {
+               pins = "gpio64";
+               function = "gpio";
+               /*
+                * Configure a pull-up on RX. This is needed to avoid
+                * garbage data when the TX pin of the Bluetooth module
+                * is floating which may cause spurious wakeups.
+                */
+               bias-pull-up;
+       };
+
+       qup_uart1_sleep_tx: qup-uart1-sleep-tx-state {
+               pins = "gpio63";
+               function = "gpio";
+               /*
+                * Configure pull-up on TX when it isn't actively driven
+                * to prevent BT SoC from receiving garbage during sleep.
+                */
+               bias-pull-up;
+       };
+};
+
+&uart1 {
+       /delete-property/ interrupts;
+       interrupts-extended = <&intc GIC_SPI 602 IRQ_TYPE_LEVEL_HIGH>,
+                             <&tlmm 64 IRQ_TYPE_EDGE_FALLING>;
+
+       pinctrl-names = "default", "sleep";
+       pinctrl-1 = <&qup_uart1_sleep_cts>, <&qup_uart1_sleep_rts>, <&qup_uart1_sleep_tx>, <&qup_uart1_sleep_rx>;
+
+       status = "okay";
+
+       bluetooth {
+               compatible = "qcom,wcn3988-bt";
+
+               vddio-supply = <&vreg_l11a>;
+               vddxo-supply = <&vreg_l7a>;
+               vddrf-supply = <&vreg_l2e>;
+               vddch0-supply = <&vreg_l10e>;
+               swctrl-gpios = <&tlmm 69 GPIO_ACTIVE_HIGH>;
+
+               max-speed = <3200000>;
+       };
 };
 
 &uart9 {