Skip to contentSkip to conversation

arm64: dts: imx8mp: Improve bluetooth UART on DH electronics i.MX8M Plus DHCOM

PATCH Applied Marek Vasut 3 participants 3 messages Jan 17, 2023 – Jan 26, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: dts: imx8mp: Improve bluetooth UART on DH electronics i.MX8M Plus DHCOM

Use PLL1_80M instead of PLL3 to drive UART2 clock divided down to 80 MHz instead of 64 MHz to obtain suitable block clock for exact 4 Mbdps, which is the maximum supported baud rate by the muRata 2AE BT UART.

The difference here is that at 64 MHz UART block clock, the clock with are divided by 16 (due to oversampling) to 4 MHz and the baud rate generator then needs to be set to UBIR+1/UBMR+1 = 1/1 to yield 4 Mbdps . In case of 80 MHz UART block clock divided by 16 to 5 MHz, the baud rate generator needs to be set to UBIR+1/UBMR+1 = 4/5 to yield 4 Mbdps .

Both options are valid and yield the same result, except using the PLL1_80M output requires fewer clock tree changes, since the PLL1 already generates the 80 MHz usable for UART, which frees the PLL3 for other uses.

---
Cc: Fabio Estevam <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: NXP Linux Team <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Pengutronix Kernel Team <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: Shawn Guo <[email protected]>
Cc: [email protected]
To: [email protected]

---
 arch/arm64/boot/dts/freescale/imx8mp-dhcom-som.dtsi | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
arch/arm64/boot/dts/freescale/imx8mp-dhcom-som.dtsi +6 -5
index 89266b386ac85..75ac4c91a5a40 100644
@@ -516,14 +516,15 @@ &uart2 {
 	status = "okay";
 
 	/*
-	 * PLL3 at 320 MHz supplies UART2 root with 64 MHz clock,
-	 * which with 16x oversampling yields 4 Mbdps baud base,
+	 * PLL1 at 80 MHz supplies UART2 root with 80 MHz clock,
+	 * which with 16x oversampling yields 5 Mbdps baud base,
+	 * which can be well divided by 5/4 to achieve 4 Mbdps,
 	 * which is exactly the maximum rate supported by muRata
 	 * 2AE bluetooth UART.
 	 */
-	assigned-clocks = <&clk IMX8MP_SYS_PLL3>, <&clk IMX8MP_CLK_UART2>;
-	assigned-clock-parents = <0>, <&clk IMX8MP_SYS_PLL3_OUT>;
-	assigned-clock-rates = <320000000>, <64000000>;
+	assigned-clocks = <&clk IMX8MP_CLK_UART2>;
+	assigned-clock-parents = <&clk IMX8MP_SYS_PLL1_80M>;
+	assigned-clock-rates = <80000000>;
 
 	bluetooth {
 		pinctrl-names = "default";
Signature · 7 lines
2.39.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
reviewer Reviewed-by on v1 1/1
#1 lore raw

Hi Marek,

Quoted 11 lines · Marek Vasut

Use PLL1_80M instead of PLL3 to drive UART2 clock divided down to 80 MHz instead of 64 MHz to obtain suitable block clock for exact 4 Mbdps, which is the maximum supported baud rate by the muRata 2AE BT UART.

The difference here is that at 64 MHz UART block clock, the clock with are divided by 16 (due to oversampling) to 4 MHz and the baud rate generator then needs to be set to UBIR+1/UBMR+1 = 1/1 to yield 4 Mbdps . In case of 80 MHz UART block clock divided by 16 to 5 MHz, the baud rate generator needs to be set to UBIR+1/UBMR+1 = 4/5 to yield 4 Mbdps .

Quoted 3 lines

Both options are valid and yield the same result, except using the PLL1_80M output requires fewer clock tree changes, since the PLL1 already generates the 80 MHz usable for UART, which frees the PLL3 for other uses.

This looks like a good idea:

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Applied
#2 lore raw
In reply to Marek Vasut
Quoted 10 lines · Marek Vasut

Use PLL1_80M instead of PLL3 to drive UART2 clock divided down to 80 MHz instead of 64 MHz to obtain suitable block clock for exact 4 Mbdps, which is the maximum supported baud rate by the muRata 2AE BT UART.

The difference here is that at 64 MHz UART block clock, the clock with are divided by 16 (due to oversampling) to 4 MHz and the baud rate generator then needs to be set to UBIR+1/UBMR+1 = 1/1 to yield 4 Mbdps . In case of 80 MHz UART block clock divided by 16 to 5 MHz, the baud rate generator needs to be set to UBIR+1/UBMR+1 = 4/5 to yield 4 Mbdps .

Quoted 6 lines

Both options are valid and yield the same result, except using the PLL1_80M output requires fewer clock tree changes, since the PLL1 already generates the 80 MHz usable for UART, which frees the PLL3 for other uses.

Applied, thanks!