From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Patrick Yavitz Date: Thu, 1 Jun 2023 06:32:23 +0200 Subject: use divide XTAL by 2 - backport MESON UART Series improves support for UART attached Bluetooth modules on Amlogic Meson G12A and newer SoCs. These SoCs also support the "divide XTAL by 2" bit which (greatly) reduces jitter when generating baud rates such as 1500000 (which is used by the Bluetooth part of the RTL8822CS SDIO WiFi and UART Bluetooth combo chip). --- arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi | 15 ++++++---- drivers/tty/serial/meson_uart.c | 8 +++-- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi index cc549f52219d..c629b2a32175 100644 --- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi @@ -2061,7 +2061,8 @@ pwm_AO_cd: pwm@2000 { }; uart_AO: serial@3000 { - compatible = "amlogic,meson-gx-uart", + compatible = "amlogic,meson-g12a-uart", + "amlogic,meson-gx-uart", "amlogic,meson-ao-uart"; reg = <0x0 0x3000 0x0 0x18>; interrupts = ; @@ -2071,7 +2072,8 @@ uart_AO: serial@3000 { }; uart_AO_B: serial@4000 { - compatible = "amlogic,meson-gx-uart", + compatible = "amlogic,meson-g12a-uart", + "amlogic,meson-gx-uart", "amlogic,meson-ao-uart"; reg = <0x0 0x4000 0x0 0x18>; interrupts = ; @@ -2308,7 +2310,8 @@ clk_msr: clock-measure@18000 { }; uart_C: serial@22000 { - compatible = "amlogic,meson-gx-uart"; + compatible = "amlogic,meson-g12a-uart", + "amlogic,meson-gx-uart"; reg = <0x0 0x22000 0x0 0x18>; interrupts = ; clocks = <&xtal>, <&clkc CLKID_UART2>, <&xtal>; @@ -2317,7 +2320,8 @@ uart_C: serial@22000 { }; uart_B: serial@23000 { - compatible = "amlogic,meson-gx-uart"; + compatible = "amlogic,meson-g12a-uart", + "amlogic,meson-gx-uart"; reg = <0x0 0x23000 0x0 0x18>; interrupts = ; clocks = <&xtal>, <&clkc CLKID_UART1>, <&xtal>; @@ -2326,7 +2330,8 @@ uart_B: serial@23000 { }; uart_A: serial@24000 { - compatible = "amlogic,meson-gx-uart"; + compatible = "amlogic,meson-g12a-uart", + "amlogic,meson-gx-uart"; reg = <0x0 0x24000 0x0 0x18>; interrupts = ; clocks = <&xtal>, <&clkc CLKID_UART0>, <&xtal>; diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c index 74110017988a..2501db5a7aaf 100644 --- a/drivers/tty/serial/meson_uart.c +++ b/drivers/tty/serial/meson_uart.c @@ -779,7 +779,7 @@ static int meson_uart_remove(struct platform_device *pdev) return 0; } -static struct meson_uart_data s4_uart_data = { +static struct meson_uart_data meson_g12a_uart_data = { .has_xtal_div2 = true, }; @@ -788,9 +788,13 @@ static const struct of_device_id meson_uart_dt_match[] = { { .compatible = "amlogic,meson8-uart" }, { .compatible = "amlogic,meson8b-uart" }, { .compatible = "amlogic,meson-gx-uart" }, + { + .compatible = "amlogic,meson-g12a-uart", + .data = (void *)&meson_g12a_uart_data, + }, { .compatible = "amlogic,meson-s4-uart", - .data = (void *)&s4_uart_data, + .data = (void *)&meson_g12a_uart_data, }, { /* sentinel */ }, }; -- Armbian