ARM: dts: sunxi: Enable Broadcom-based Bluetooth w/ serdev
Subsystems (2)
cover ARM: dts: sunxi: Enable Broadcom-based Bluetooth w/ serdev
Hi everyone,
This is the second batch of patches enabling Bluetooth for Broadcom (AMPAK) modules using the new serdev bindings.
The patches are self-explanatory, so I won't go into the details here.
This pretty much covers all the boards I have that have AMPAK modules. The only ones missing are the A80-based boards, which I haven't gotten working yet.
Chen-Yu Tsai (5):
ARM: dts: sun8i: r40: Add pinmux settings for UART3 on PG pingroup
ARM: dts: sun8i: r40: Add pinmux setting for CLK_OUT_A
ARM: dts: sun8i: r40: bananapi-m2-ultra: Fix WiFi regulator
definitions
ARM: dts: sun8i: r40: bananapi-m2-ultra: Add Bluetooth device node
ARM: dts: sunxi: bananapi-m2-plus: Add Bluetooth device node
.../boot/dts/sun8i-r40-bananapi-m2-ultra.dts | 41 +++++++++++++++++++ arch/arm/boot/dts/sun8i-r40.dtsi | 15 +++++++ arch/arm/boot/dts/sunxi-bananapi-m2-plus.dtsi | 16 +++++++- 3 files changed, 71 insertions(+), 1 deletion(-)
Signature · 1 line
2.20.1
PATCH 1/5 ARM: dts: sun8i: r40: Add pinmux settings for UART3 on PG pingroup
UART3 on the PG pingroup on the R40 SoC is commonly used to connect the bluetooth controller in a WiFi+Bluetooth combo chip, with the WiFi bits also on the PG pingroup.
This patch adds two device nodes for UART3 on PG pingroup, one for the RX/TX pins, and one for the RTS/CTS pins. Consumers can reference either just the RX/TX pinmux setting or both, depending on the application.
--- arch/arm/boot/dts/sun8i-r40.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm/boot/dts/sun8i-r40.dtsi +10 -0
@@ -389,6 +389,16 @@ pins = "PB22", "PB23"; function = "uart0"; }; + + uart3_pg_pins: uart3-pg-pins { + pins = "PG6", "PG7"; + function = "uart3"; + }; + + uart3_rts_cts_pg_pins: uart3-rts-cts-pg-pins { + pins = "PG8", "PG9"; + function = "uart3"; + }; }; wdt: watchdog@1c20c90 {
Signature · 1 line
2.20.1
PATCH 2/5 ARM: dts: sun8i: r40: Add pinmux setting for CLK_OUT_A
In reply to Chen-Yu TsaiCLK_OUT_A, an external clock output function driven from the clock control unit, on the R40 is sometimes used to provide a low rate low power clock to a WiFi or Bluetooth controller.
This patch adds a pinmux setting for it.
--- arch/arm/boot/dts/sun8i-r40.dtsi | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm/boot/dts/sun8i-r40.dtsi +5 -0
@@ -342,6 +342,11 @@ #interrupt-cells = <3>; #gpio-cells = <3>; + clk_out_a_pin: clk-out-a-pin { + pins = "PI12"; + function = "clk_out_a"; + }; + gmac_rgmii_pins: gmac-rgmii-pins { pins = "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7",
Signature · 1 line
2.20.1
PATCH 3/5 ARM: dts: sun8i: r40: bananapi-m2-ultra: Fix WiFi regulator definitions
In reply to Chen-Yu TsaiThe design of the Bananapi M2 Ultra has both DLDO1 and DLDO2 regulators provide power to the WiFi+BT module, which is based on the Broadcom BCM43438 or BCM43430 chip. Each regulator output from the PMIC can supply up to 200 mA. The datasheet of the chip suggests a maximum power draw of up to 360 mA when transmitting, thus requiring two outputs from the PMIC to handle the load. However the device tree only references one of them, leaving the other unused and possibly turned off.
This patch marks both as always-on, since we don't have a proper binding to specify two regulators as "bound together". The name and constraints of DLDO2 are also added.
Ultra")
--- arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts +15 -0
@@ -250,12 +250,27 @@ regulator-name = "vcc-wifi-io"; }; +/* + * Our WiFi chip needs both DLDO2 and DLDO3 to be powered at the same + * time, with the two being in sync, to be able to meet maximum power + * consumption during transmits. Since this is not really supported + * right now, just use the two as always on, and we will fix it later. + */ + ®_dldo2 { + regulator-always-on; regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; regulator-name = "vcc-wifi"; }; +®_dldo3 { + regulator-always-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vcc-wifi-2"; +}; + ®_dldo4 { regulator-min-microvolt = <2500000>; regulator-max-microvolt = <2500000>;
Signature · 1 line
2.20.1
PATCH 4/5 ARM: dts: sun8i: r40: bananapi-m2-ultra: Add Bluetooth device node
In reply to Chen-Yu TsaiThe 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.
--- .../boot/dts/sun8i-r40-bananapi-m2-ultra.dts | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+)
arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts +26 -0
@@ -102,6 +102,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"; }; };
@@ -196,6 +198,11 @@ status = "okay"; }; +&pio { + pinctrl-names = "default"; + pinctrl-0 = <&clk_out_a_pin>; +}; + ®_aldo2 { regulator-always-on; regulator-min-microvolt = <2500000>;
@@ -293,6 +300,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 = <®_dldo2>; + vddio-supply = <®_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 = <®_vcc5v0>; usb2_vbus-supply = <®_vcc5v0>;
Signature · 1 line
2.20.1
PATCH 5/5 ARM: dts: sunxi: bananapi-m2-plus: Add Bluetooth device node
In reply to Chen-Yu TsaiThe 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 UART1 in a 4 wire configuration. Same as the WiFi side, due to being the same chip and package, the board's fixed 3.3V power regulator provides overall power via VBAT and I/O power via VDDIO. The RTC 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.
--- arch/arm/boot/dts/sunxi-bananapi-m2-plus.dtsi | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
arch/arm/boot/dts/sunxi-bananapi-m2-plus.dtsi +15 -1
@@ -103,6 +103,8 @@ compatible = "mmc-pwrseq-simple"; pinctrl-names = "default"; reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>; /* PL7 */ + clocks = <&rtc 1>; + clock-names = "ext_clock"; }; };
@@ -215,7 +217,19 @@ &uart1 { pinctrl-names = "default"; pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>; - status = "okay"; + uart-has-rtscts; + status = "okay"; + + bluetooth { + compatible = "brcm,bcm43438-bt"; + clocks = <&rtc 1>; + clock-names = "lpo"; + vbat-supply = <®_vcc3v3>; + vddio-supply = <®_vcc3v3>; + device-wakeup-gpios = <&pio 6 13 GPIO_ACTIVE_HIGH>; /* PG13 */ + host-wakeup-gpios = <&pio 6 11 GPIO_ACTIVE_HIGH>; /* PG11 */ + shutdown-gpios = <&pio 6 12 GPIO_ACTIVE_HIGH>; /* PG12 */ + }; }; &usb_otg {
Signature · 1 line
2.20.1
Maxime Ripard
AppliedQuoted 10 lines · Chen-Yu Tsai
Hi everyone,
This is the second batch of patches enabling Bluetooth for Broadcom (AMPAK) modules using the new serdev bindings.
The patches are self-explanatory, so I won't go into the details here.
This pretty much covers all the boards I have that have AMPAK modules. The only ones missing are the A80-based boards, which I haven't gotten working yet.
Applied, thanks!
Maxime
Signature · 3 lines
Maxime Ripard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com