diff mbox series

[7/7] arm64: dts: broadcom: bcm2712: Add UARTA controller node.

Message ID 20240731062814.215833-8-iivanov@suse.de
State New
Headers show
Series Add pin control driver for BCM2712 SoC | expand

Commit Message

Ivan T. Ivanov July 31, 2024, 6:28 a.m. UTC
On RPi5 device Bluetooth chips is connected to UARTA
port. Add Bluetooth chips and related pin definitions.
With this and firmware already provided by distributions,
at least on openSUSE Tumbleweed, this is sufficient to make
Bluetooth operational on RPi5 \o/.

Signed-off-by: Ivan T. Ivanov <iivanov@suse.de>
---
 .../boot/dts/broadcom/bcm2712-rpi-5-b.dts     | 45 +++++++++++++++++++
 arch/arm64/boot/dts/broadcom/bcm2712.dtsi     | 11 +++++
 2 files changed, 56 insertions(+)

Comments

Florian Fainelli July 31, 2024, 10:13 p.m. UTC | #1
On 7/30/24 23:28, Ivan T. Ivanov wrote:
> On RPi5 device Bluetooth chips is connected to UARTA
> port. Add Bluetooth chips and related pin definitions.
> With this and firmware already provided by distributions,
> at least on openSUSE Tumbleweed, this is sufficient to make
> Bluetooth operational on RPi5 \o/.
> 
> Signed-off-by: Ivan T. Ivanov <iivanov@suse.de>
> ---

[snip]

>   	sdio2_30_pins: sdio2-30-pins {
>   		pin-clk {
>   			function = "sd2";
> @@ -156,3 +184,20 @@ pins-dat {
>   		};
>   	};
>   };
> +
> +/* uarta communicates with the BT module */
> +&uarta {
> +	uart-has-rtscts;
> +	auto-flow-control;
> +	status = "okay";
> +	clock-frequency = <96000000>;

Would not the "clock-frequency" belong to the .dtsi node instead?

> +	pinctrl-0 = <&uarta_24_pins &bt_shutdown_pins>;
> +	pinctrl-names = "default";
> +
> +	bluetooth: bluetooth {
> +		compatible = "brcm,bcm43438-bt";
> +		max-speed = <3000000>;
> +		shutdown-gpios = <&gio 29 GPIO_ACTIVE_HIGH>;
> +		local-bd-address = [ 00 00 00 00 00 00 ];
> +	};
> +};
> diff --git a/arch/arm64/boot/dts/broadcom/bcm2712.dtsi b/arch/arm64/boot/dts/broadcom/bcm2712.dtsi
> index 3c0663dc6712..e972f94d6828 100644
> --- a/arch/arm64/boot/dts/broadcom/bcm2712.dtsi
> +++ b/arch/arm64/boot/dts/broadcom/bcm2712.dtsi
> @@ -305,6 +305,17 @@ gio: gpio@7d508500 {
>   			brcm,gpio-direct;
>   		};
>   
> +		uarta: serial@7d50c000 {
> +			compatible = "brcm,bcm7271-uart";
> +			reg = <0x7d50c000 0x20>;
> +			reg-names = "uart";
> +			reg-shift = <2>;
> +			reg-io-width = <4>;
> +			interrupts = <GIC_SPI 276 IRQ_TYPE_LEVEL_HIGH>;
> +			skip-init;

Also an undocumented property upstream, what does it do? Is this to set 
UPF_SKIP_TEST?
Ivan T. Ivanov Aug. 1, 2024, 7:50 a.m. UTC | #2
Hi,

On 07-31 15:13, Florian Fainelli wrote:

> > +
> > +/* uarta communicates with the BT module */
> > +&uarta {
> > +	uart-has-rtscts;
> > +	auto-flow-control;
> > +	status = "okay";
> > +	clock-frequency = <96000000>;
> 
> Would not the "clock-frequency" belong to the .dtsi node instead?
> 

Perhaps.

> > +	pinctrl-0 = <&uarta_24_pins &bt_shutdown_pins>;
> > +	pinctrl-names = "default";
> > +
> > +	bluetooth: bluetooth {
> > +		compatible = "brcm,bcm43438-bt";
> > +		max-speed = <3000000>;
> > +		shutdown-gpios = <&gio 29 GPIO_ACTIVE_HIGH>;
> > +		local-bd-address = [ 00 00 00 00 00 00 ];
> > +	};
> > +};
> > diff --git a/arch/arm64/boot/dts/broadcom/bcm2712.dtsi b/arch/arm64/boot/dts/broadcom/bcm2712.dtsi
> > index 3c0663dc6712..e972f94d6828 100644
> > --- a/arch/arm64/boot/dts/broadcom/bcm2712.dtsi
> > +++ b/arch/arm64/boot/dts/broadcom/bcm2712.dtsi
> > @@ -305,6 +305,17 @@ gio: gpio@7d508500 {
> >   			brcm,gpio-direct;
> >   		};
> > +		uarta: serial@7d50c000 {
> > +			compatible = "brcm,bcm7271-uart";
> > +			reg = <0x7d50c000 0x20>;
> > +			reg-names = "uart";
> > +			reg-shift = <2>;
> > +			reg-io-width = <4>;
> > +			interrupts = <GIC_SPI 276 IRQ_TYPE_LEVEL_HIGH>;
> > +			skip-init;
> 
> Also an undocumented property upstream, what does it do? Is this to set
> UPF_SKIP_TEST?

It is U-Boot thing [1]. I suppose I can drop it.

Thanks,
Ivan

[1] ... "
    serial: pl01x: Add support for devices with the rate pre-configured.

    For Raspberry Pi, we had the input clock rate to the pl011 fixed in
    the rpi.c file, but it may be changed by firmware due to user changes
    to config.txt.  Since the firmware always sets up the uart (default
    115200 output unless the user changes it), we can just skip our own
    uart init to simplify the boot process and more reliably get serial
    output.
    ..."
Stefan Wahren Aug. 2, 2024, 7:12 p.m. UTC | #3
Hi Ivan,

Am 31.07.24 um 08:28 schrieb Ivan T. Ivanov:
> On RPi5 device Bluetooth chips is connected to UARTA
> port. Add Bluetooth chips and related pin definitions.
> With this and firmware already provided by distributions,
> at least on openSUSE Tumbleweed, this is sufficient to make
> Bluetooth operational on RPi5 \o/.
>
> Signed-off-by: Ivan T. Ivanov <iivanov@suse.de>
> ---
>   .../boot/dts/broadcom/bcm2712-rpi-5-b.dts     | 45 +++++++++++++++++++
>   arch/arm64/boot/dts/broadcom/bcm2712.dtsi     | 11 +++++
>   2 files changed, 56 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dts b/arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dts
> index b6bfe0abb774..a557cbd8ba17 100644
> --- a/arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dts
> +++ b/arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dts
> @@ -133,11 +133,39 @@ wl_on_pins: wl-on-pins {
>   		pins = "gpio28";
>   	};
>
> +	bt_shutdown_pins: bt-shutdown-pins {
> +		function = "gpio";
> +		pins = "gpio29";
> +	};
> +
>   	emmc_sd_pulls: emmc-sd-pulls {
>   		pins = "emmc_cmd", "emmc_dat0", "emmc_dat1", "emmc_dat2", "emmc_dat3";
>   		bias-pull-up;
>   	};
>
> +	uarta_24_pins: uarta-24-pins {
> +		pin-rts {
> +			function = "uart0";
> +			pins = "gpio24";
> +			bias-disable;
> +		};
> +		pin-cts {
> +			function = "uart0";
> +			pins = "gpio25";
> +			bias-pull-up;
> +		};
> +		pin-txd {
> +			function = "uart0";
> +			pins = "gpio26";
> +			bias-disable;
> +		};
> +		pin-rxd {
> +			function = "uart0";
> +			pins = "gpio27";
> +			bias-pull-up;
> +		};
> +	};
> +
>   	sdio2_30_pins: sdio2-30-pins {
>   		pin-clk {
>   			function = "sd2";
> @@ -156,3 +184,20 @@ pins-dat {
>   		};
>   	};
>   };
> +
> +/* uarta communicates with the BT module */
> +&uarta {
> +	uart-has-rtscts;
> +	auto-flow-control;
> +	status = "okay";
> +	clock-frequency = <96000000>;
> +	pinctrl-0 = <&uarta_24_pins &bt_shutdown_pins>;
> +	pinctrl-names = "default";
Please add status here
> +
> +	bluetooth: bluetooth {
> +		compatible = "brcm,bcm43438-bt";
> +		max-speed = <3000000>;
> +		shutdown-gpios = <&gio 29 GPIO_ACTIVE_HIGH>;
> +		local-bd-address = [ 00 00 00 00 00 00 ];
Can we drop this?

Thanks
> +	};
> +};
> diff --git a/arch/arm64/boot/dts/broadcom/bcm2712.dtsi b/arch/arm64/boot/dts/broadcom/bcm2712.dtsi
> index 3c0663dc6712..e972f94d6828 100644
> --- a/arch/arm64/boot/dts/broadcom/bcm2712.dtsi
> +++ b/arch/arm64/boot/dts/broadcom/bcm2712.dtsi
> @@ -305,6 +305,17 @@ gio: gpio@7d508500 {
>   			brcm,gpio-direct;
>   		};
>
> +		uarta: serial@7d50c000 {
> +			compatible = "brcm,bcm7271-uart";
> +			reg = <0x7d50c000 0x20>;
> +			reg-names = "uart";
> +			reg-shift = <2>;
> +			reg-io-width = <4>;
> +			interrupts = <GIC_SPI 276 IRQ_TYPE_LEVEL_HIGH>;
> +			skip-init;
> +			status = "disabled";
> +		};
> +
>   		pinctrl_aon: pinctrl@7d510700 {
>   			compatible = "brcm,bcm2712-aon-pinctrl";
>   			reg = <0x7d510700 0x20>;
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dts b/arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dts
index b6bfe0abb774..a557cbd8ba17 100644
--- a/arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dts
+++ b/arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dts
@@ -133,11 +133,39 @@  wl_on_pins: wl-on-pins {
 		pins = "gpio28";
 	};
 
+	bt_shutdown_pins: bt-shutdown-pins {
+		function = "gpio";
+		pins = "gpio29";
+	};
+
 	emmc_sd_pulls: emmc-sd-pulls {
 		pins = "emmc_cmd", "emmc_dat0", "emmc_dat1", "emmc_dat2", "emmc_dat3";
 		bias-pull-up;
 	};
 
+	uarta_24_pins: uarta-24-pins {
+		pin-rts {
+			function = "uart0";
+			pins = "gpio24";
+			bias-disable;
+		};
+		pin-cts {
+			function = "uart0";
+			pins = "gpio25";
+			bias-pull-up;
+		};
+		pin-txd {
+			function = "uart0";
+			pins = "gpio26";
+			bias-disable;
+		};
+		pin-rxd {
+			function = "uart0";
+			pins = "gpio27";
+			bias-pull-up;
+		};
+	};
+
 	sdio2_30_pins: sdio2-30-pins {
 		pin-clk {
 			function = "sd2";
@@ -156,3 +184,20 @@  pins-dat {
 		};
 	};
 };
+
+/* uarta communicates with the BT module */
+&uarta {
+	uart-has-rtscts;
+	auto-flow-control;
+	status = "okay";
+	clock-frequency = <96000000>;
+	pinctrl-0 = <&uarta_24_pins &bt_shutdown_pins>;
+	pinctrl-names = "default";
+
+	bluetooth: bluetooth {
+		compatible = "brcm,bcm43438-bt";
+		max-speed = <3000000>;
+		shutdown-gpios = <&gio 29 GPIO_ACTIVE_HIGH>;
+		local-bd-address = [ 00 00 00 00 00 00 ];
+	};
+};
diff --git a/arch/arm64/boot/dts/broadcom/bcm2712.dtsi b/arch/arm64/boot/dts/broadcom/bcm2712.dtsi
index 3c0663dc6712..e972f94d6828 100644
--- a/arch/arm64/boot/dts/broadcom/bcm2712.dtsi
+++ b/arch/arm64/boot/dts/broadcom/bcm2712.dtsi
@@ -305,6 +305,17 @@  gio: gpio@7d508500 {
 			brcm,gpio-direct;
 		};
 
+		uarta: serial@7d50c000 {
+			compatible = "brcm,bcm7271-uart";
+			reg = <0x7d50c000 0x20>;
+			reg-names = "uart";
+			reg-shift = <2>;
+			reg-io-width = <4>;
+			interrupts = <GIC_SPI 276 IRQ_TYPE_LEVEL_HIGH>;
+			skip-init;
+			status = "disabled";
+		};
+
 		pinctrl_aon: pinctrl@7d510700 {
 			compatible = "brcm,bcm2712-aon-pinctrl";
 			reg = <0x7d510700 0x20>;