diff mbox series

[v5,7/7] ARM: dts: sun8i: v40: bananapi-m2-berry: Add Bluetooth device node

Message ID 1556040365-10913-8-git-send-email-pgreco@centosproject.org (mailing list archive)
State New, archived
Headers show
Series ARM: dts: sun8i: v40 Rewrite BPi M2 Berry DTS based on BPi M2 Ultra | expand

Commit Message

Pablo Sebastián Greco April 23, 2019, 5:26 p.m. UTC
The AP6212 is based on the Broadcom BCM43430 or BCM43438. The WiFi side
identifies as BCM43430, while the Bluetooth side identifies as BCM43438.

The Bluetooth side is connected to UART3 in a 4 wire configuration. Same
as the WiFi side, due to being the same chip and package, DLDO1 and
DLDO2 regulator outputs from the PMIC provide overall power via VBAT and
I/O power via VDDIO. The CLK_OUT_A clock output from the SoC provides
the LPO low power clock at 32.768 kHz.

This patch enables Bluetooth on this board, and also adds the missing
LPO clock on the WiFi side. There is also a PCM connection for
Bluetooth, but this is not covered here.

The LPO clock is fed from CLK_OUT_A, which needs to be muxed on pin
PI12. This can be represented in multiple ways. This patch puts the
pinctrl property in the pin controller node. This is due to limitations
in Linux, where pinmux settings, even the same one, can not be shared
by multiple devices. Thus we cannot put it in both the WiFi and
Bluetooth device nodes. Putting it the CCU node is another option, but
Linux's CCU driver does not handle pinctrl. Also the pin controller is
guaranteed to be initialized after the CCU, when clocks are available.
And any other devices that use muxed pins are guaranteed to be
initialized after the pin controller. Thus having the CLK_OUT_A pinmux
reference be in the pin controller node is a good choice without having
to deal with implementation issues.

Signed-off-by: Pablo Greco <pgreco@centosproject.org>
---
 arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

Comments

Maxime Ripard May 2, 2019, 7:41 a.m. UTC | #1
On Tue, Apr 23, 2019 at 02:26:04PM -0300, Pablo Greco wrote:
> The AP6212 is based on the Broadcom BCM43430 or BCM43438. The WiFi side
> identifies as BCM43430, while the Bluetooth side identifies as BCM43438.
>
> The Bluetooth side is connected to UART3 in a 4 wire configuration. Same
> as the WiFi side, due to being the same chip and package, DLDO1 and
> DLDO2 regulator outputs from the PMIC provide overall power via VBAT and
> I/O power via VDDIO. The CLK_OUT_A clock output from the SoC provides
> the LPO low power clock at 32.768 kHz.
>
> This patch enables Bluetooth on this board, and also adds the missing
> LPO clock on the WiFi side. There is also a PCM connection for
> Bluetooth, but this is not covered here.
>
> The LPO clock is fed from CLK_OUT_A, which needs to be muxed on pin
> PI12. This can be represented in multiple ways. This patch puts the
> pinctrl property in the pin controller node. This is due to limitations
> in Linux, where pinmux settings, even the same one, can not be shared
> by multiple devices. Thus we cannot put it in both the WiFi and
> Bluetooth device nodes. Putting it the CCU node is another option, but
> Linux's CCU driver does not handle pinctrl. Also the pin controller is
> guaranteed to be initialized after the CCU, when clocks are available.
> And any other devices that use muxed pins are guaranteed to be
> initialized after the pin controller. Thus having the CLK_OUT_A pinmux
> reference be in the pin controller node is a good choice without having
> to deal with implementation issues.
>
> Signed-off-by: Pablo Greco <pgreco@centosproject.org>
> ---
>  arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
>
> diff --git a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
> index c87f2c0..15c22b0 100644
> --- a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
> +++ b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
> @@ -96,6 +96,8 @@
>  	wifi_pwrseq: wifi_pwrseq {
>  		compatible = "mmc-pwrseq-simple";
>  		reset-gpios = <&pio 6 10 GPIO_ACTIVE_LOW>; /* PG10 WIFI_EN */
> +		clocks = <&ccu CLK_OUTA>;
> +		clock-names = "ext_clock";

So if you don't have that patch (that enables bluetooth) the wifi
doesn't work (even though the previous patch is supposed to enable it)
?

>  	};
>  };
>
> @@ -173,6 +175,7 @@
>
>  &pio {
>  	pinctrl-names = "default";
> +	pinctrl-0 = <&clk_out_a_pin>;

This one should bein the previous one as well

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Chen-Yu Tsai May 2, 2019, 8:20 a.m. UTC | #2
On Thu, May 2, 2019 at 3:41 PM Maxime Ripard <maxime.ripard@bootlin.com> wrote:
>
> On Tue, Apr 23, 2019 at 02:26:04PM -0300, Pablo Greco wrote:
> > The AP6212 is based on the Broadcom BCM43430 or BCM43438. The WiFi side
> > identifies as BCM43430, while the Bluetooth side identifies as BCM43438.
> >
> > The Bluetooth side is connected to UART3 in a 4 wire configuration. Same
> > as the WiFi side, due to being the same chip and package, DLDO1 and
> > DLDO2 regulator outputs from the PMIC provide overall power via VBAT and
> > I/O power via VDDIO. The CLK_OUT_A clock output from the SoC provides
> > the LPO low power clock at 32.768 kHz.
> >
> > This patch enables Bluetooth on this board, and also adds the missing
> > LPO clock on the WiFi side. There is also a PCM connection for
> > Bluetooth, but this is not covered here.
> >
> > The LPO clock is fed from CLK_OUT_A, which needs to be muxed on pin
> > PI12. This can be represented in multiple ways. This patch puts the
> > pinctrl property in the pin controller node. This is due to limitations
> > in Linux, where pinmux settings, even the same one, can not be shared
> > by multiple devices. Thus we cannot put it in both the WiFi and
> > Bluetooth device nodes. Putting it the CCU node is another option, but
> > Linux's CCU driver does not handle pinctrl. Also the pin controller is
> > guaranteed to be initialized after the CCU, when clocks are available.
> > And any other devices that use muxed pins are guaranteed to be
> > initialized after the pin controller. Thus having the CLK_OUT_A pinmux
> > reference be in the pin controller node is a good choice without having
> > to deal with implementation issues.
> >
> > Signed-off-by: Pablo Greco <pgreco@centosproject.org>
> > ---
> >  arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts | 22 ++++++++++++++++++++++
> >  1 file changed, 22 insertions(+)
> >
> > diff --git a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
> > index c87f2c0..15c22b0 100644
> > --- a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
> > +++ b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
> > @@ -96,6 +96,8 @@
> >       wifi_pwrseq: wifi_pwrseq {
> >               compatible = "mmc-pwrseq-simple";
> >               reset-gpios = <&pio 6 10 GPIO_ACTIVE_LOW>; /* PG10 WIFI_EN */
> > +             clocks = <&ccu CLK_OUTA>;
> > +             clock-names = "ext_clock";
>
> So if you don't have that patch (that enables bluetooth) the wifi
> doesn't work (even though the previous patch is supposed to enable it)

Maybe we should just squash the two (WiFi and Bluetooth) together?
After all, they are in the same package, and depend on some of the
same things, such as clocks and regulators.

ChenYu

> >       };
> >  };
> >
> > @@ -173,6 +175,7 @@
> >
> >  &pio {
> >       pinctrl-names = "default";
> > +     pinctrl-0 = <&clk_out_a_pin>;
>
> This one should bein the previous one as well
>
> Maxime
>
> --
> Maxime Ripard, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
>
> --
> You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Pablo Sebastián Greco May 2, 2019, 10:27 a.m. UTC | #3
El 2/5/19 a las 05:20, Chen-Yu Tsai escribió:
> On Thu, May 2, 2019 at 3:41 PM Maxime Ripard <maxime.ripard@bootlin.com> wrote:
>> On Tue, Apr 23, 2019 at 02:26:04PM -0300, Pablo Greco wrote:
>>> The AP6212 is based on the Broadcom BCM43430 or BCM43438. The WiFi side
>>> identifies as BCM43430, while the Bluetooth side identifies as BCM43438.
>>>
>>> The Bluetooth side is connected to UART3 in a 4 wire configuration. Same
>>> as the WiFi side, due to being the same chip and package, DLDO1 and
>>> DLDO2 regulator outputs from the PMIC provide overall power via VBAT and
>>> I/O power via VDDIO. The CLK_OUT_A clock output from the SoC provides
>>> the LPO low power clock at 32.768 kHz.
>>>
>>> This patch enables Bluetooth on this board, and also adds the missing
>>> LPO clock on the WiFi side. There is also a PCM connection for
>>> Bluetooth, but this is not covered here.
>>>
>>> The LPO clock is fed from CLK_OUT_A, which needs to be muxed on pin
>>> PI12. This can be represented in multiple ways. This patch puts the
>>> pinctrl property in the pin controller node. This is due to limitations
>>> in Linux, where pinmux settings, even the same one, can not be shared
>>> by multiple devices. Thus we cannot put it in both the WiFi and
>>> Bluetooth device nodes. Putting it the CCU node is another option, but
>>> Linux's CCU driver does not handle pinctrl. Also the pin controller is
>>> guaranteed to be initialized after the CCU, when clocks are available.
>>> And any other devices that use muxed pins are guaranteed to be
>>> initialized after the pin controller. Thus having the CLK_OUT_A pinmux
>>> reference be in the pin controller node is a good choice without having
>>> to deal with implementation issues.
>>>
>>> Signed-off-by: Pablo Greco <pgreco@centosproject.org>
>>> ---
>>>   arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts | 22 ++++++++++++++++++++++
>>>   1 file changed, 22 insertions(+)
>>>
>>> diff --git a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
>>> index c87f2c0..15c22b0 100644
>>> --- a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
>>> +++ b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
>>> @@ -96,6 +96,8 @@
>>>        wifi_pwrseq: wifi_pwrseq {
>>>                compatible = "mmc-pwrseq-simple";
>>>                reset-gpios = <&pio 6 10 GPIO_ACTIVE_LOW>; /* PG10 WIFI_EN */
>>> +             clocks = <&ccu CLK_OUTA>;
>>> +             clock-names = "ext_clock";
>> So if you don't have that patch (that enables bluetooth) the wifi
>> doesn't work (even though the previous patch is supposed to enable it)
> Maybe we should just squash the two (WiFi and Bluetooth) together?
> After all, they are in the same package, and depend on some of the
> same things, such as clocks and regulators.
>
> ChenYu
That seems better, I was trying to keep the same logic the patches 
applied to the ultra.
>>>        };
>>>   };
>>>
>>> @@ -173,6 +175,7 @@
>>>
>>>   &pio {
>>>        pinctrl-names = "default";
>>> +     pinctrl-0 = <&clk_out_a_pin>;
>> This one should bein the previous one as well
>>
>> Maxime
>>
>> --
>> Maxime Ripard, Bootlin
>> Embedded Linux and Kernel engineering
>> https://bootlin.com
>>
>> --
>> You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
Pablo.
diff mbox series

Patch

diff --git a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
index c87f2c0..15c22b0 100644
--- a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
+++ b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
@@ -96,6 +96,8 @@ 
 	wifi_pwrseq: wifi_pwrseq {
 		compatible = "mmc-pwrseq-simple";
 		reset-gpios = <&pio 6 10 GPIO_ACTIVE_LOW>; /* PG10 WIFI_EN */
+		clocks = <&ccu CLK_OUTA>;
+		clock-names = "ext_clock";
 	};
 };
 
@@ -173,6 +175,7 @@ 
 
 &pio {
 	pinctrl-names = "default";
+	pinctrl-0 = <&clk_out_a_pin>;
 	vcc-pa-supply = <&reg_aldo2>;
 	vcc-pc-supply = <&reg_dcdc1>;
 	vcc-pd-supply = <&reg_dcdc1>;
@@ -277,6 +280,25 @@ 
 	status = "okay";
 };
 
+&uart3 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart3_pg_pins>, <&uart3_rts_cts_pg_pins>;
+	uart-has-rtscts;
+	status = "okay";
+
+	bluetooth {
+		compatible = "brcm,bcm43438-bt";
+		clocks = <&ccu CLK_OUTA>;
+		clock-names = "lpo";
+		vbat-supply = <&reg_dldo2>;
+		vddio-supply = <&reg_dldo1>;
+		device-wakeup-gpios = <&pio 6 11 GPIO_ACTIVE_HIGH>; /* PG11 */
+		/* TODO host wake line connected to PMIC GPIO pins */
+		shutdown-gpios = <&pio 7 12 GPIO_ACTIVE_HIGH>; /* PH12 */
+		max-speed = <1500000>;
+	};
+};
+
 &usbphy {
 	usb1_vbus-supply = <&reg_vcc5v0>;
 	status = "okay";