Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [PATCH 0/3] MIPS: dts: loongson64g-package: Switch to Loongson UART driver
@ 2026-03-14 23:41 Rong Zhang
  2026-03-14 23:41 ` [PATCH 1/3] dt-bindings: serial: 8250: Add Loongson 3A4000 uart compatible Rong Zhang
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Rong Zhang @ 2026-03-14 23:41 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Thomas Bogendoerfer, Huacai Chen, Jiaxun Yang
  Cc: Rong Zhang, linux-kernel, linux-serial, linux-mips, devicetree,
	Yao Zi, Icenowy Zheng, Rong Zhang

Loongson64g is Loongson 3A4000, whose UART controller is compatible with
Loongson 2K1500, which is NS16550A-compatible with an additional
fractional frequency divisor register.

Patch 1 adds loongson,ls3a4000-uart as compatible with
loongson,ls2k1500-uart.

Patch 2 enables building 8250_loongson (loongson-uart) on MIPS
Loongson64.

Patch 3 updates the compatible strings to reflect this, so that 3A4000
can benefit from the fractional frequency divisor provided by
loongson-uart. This is required on some devices, otherwise their UART
can't work at some high baud rates, e.g., 115200.

Tested on Loongson-LS3A4000-7A1000-NUC-SE with a 25MHz UART clock.
Without fractional frequency divisor, the actual baud rate was 111607
(25MHz / 16 / 14, measured value: 111545) and some USB-to-UART
converters couldn't work with it at all. With fractional frequency
divisor, the measured baud rate becomes 115207, which is quite accurate.

Rong Zhang (3):
  dt-bindings: serial: 8250: Add Loongson 3A4000 uart compatible
  serial: 8250: loongson: Enable building on MIPS Loongson64
  MIPS: dts: loongson64g-package: Switch to Loongson UART driver

 Documentation/devicetree/bindings/serial/8250.yaml   | 1 +
 arch/mips/boot/dts/loongson/loongson64g-package.dtsi | 4 ++--
 drivers/tty/serial/8250/Kconfig                      | 9 +++++----
 3 files changed, 8 insertions(+), 6 deletions(-)


base-commit: 69237f8c1f69112cca7388af7fab6d0ee45a2525
-- 
2.53.0

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/3] dt-bindings: serial: 8250: Add Loongson 3A4000 uart compatible
  2026-03-14 23:41 [PATCH 0/3] MIPS: dts: loongson64g-package: Switch to Loongson UART driver Rong Zhang
@ 2026-03-14 23:41 ` Rong Zhang
  2026-03-15  9:09   ` Krzysztof Kozlowski
  2026-03-14 23:41 ` [PATCH 2/3] serial: 8250: loongson: Enable building on MIPS Loongson64 Rong Zhang
  2026-03-14 23:41 ` [PATCH 3/3] MIPS: dts: loongson64g-package: Switch to Loongson UART driver Rong Zhang
  2 siblings, 1 reply; 6+ messages in thread
From: Rong Zhang @ 2026-03-14 23:41 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Thomas Bogendoerfer, Huacai Chen, Jiaxun Yang
  Cc: Rong Zhang, linux-kernel, linux-serial, linux-mips, devicetree,
	Yao Zi, Icenowy Zheng, Rong Zhang

The UART controller on Loongson 3A4000 is compatible with Loongson
2K1500, which is NS16550A-compatible with an additional fractional
frequency divisor register.

Add loongson,ls3a4000-uart as compatible with loongson,ls2k1500-uart.

Signed-off-by: Rong Zhang <rongrong@oss.cipunited.com>
---
 Documentation/devicetree/bindings/serial/8250.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/serial/8250.yaml b/Documentation/devicetree/bindings/serial/8250.yaml
index 73851f19330d..1d1f2a22776c 100644
--- a/Documentation/devicetree/bindings/serial/8250.yaml
+++ b/Documentation/devicetree/bindings/serial/8250.yaml
@@ -179,6 +179,7 @@ properties:
           - const: ns16550a
       - items:
           - enum:
+              - loongson,ls3a4000-uart
               - loongson,ls3a5000-uart
               - loongson,ls3a6000-uart
               - loongson,ls2k2000-uart
-- 
2.53.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] serial: 8250: loongson: Enable building on MIPS Loongson64
  2026-03-14 23:41 [PATCH 0/3] MIPS: dts: loongson64g-package: Switch to Loongson UART driver Rong Zhang
  2026-03-14 23:41 ` [PATCH 1/3] dt-bindings: serial: 8250: Add Loongson 3A4000 uart compatible Rong Zhang
@ 2026-03-14 23:41 ` Rong Zhang
  2026-03-14 23:41 ` [PATCH 3/3] MIPS: dts: loongson64g-package: Switch to Loongson UART driver Rong Zhang
  2 siblings, 0 replies; 6+ messages in thread
From: Rong Zhang @ 2026-03-14 23:41 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Thomas Bogendoerfer, Huacai Chen, Jiaxun Yang
  Cc: Rong Zhang, linux-kernel, linux-serial, linux-mips, devicetree,
	Yao Zi, Icenowy Zheng, Rong Zhang

Loongson 3A4000 is a MIPS-based Loongson64 CPU which also supports
8250_loongson (loongson-uart).

Enable building on MIPS Loongson64 so that Loongson 3A4000 can benefit
from it.

Signed-off-by: Rong Zhang <rongrong@oss.cipunited.com>
---
 drivers/tty/serial/8250/Kconfig | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/8250/Kconfig b/drivers/tty/serial/8250/Kconfig
index fd4e8b6ab60d..fc3e58d62233 100644
--- a/drivers/tty/serial/8250/Kconfig
+++ b/drivers/tty/serial/8250/Kconfig
@@ -465,11 +465,12 @@ config SERIAL_8250_OMAP_TTYO_FIXUP
 config SERIAL_8250_LOONGSON
 	tristate "Loongson 8250 based serial port"
 	depends on SERIAL_8250
-	depends on LOONGARCH || COMPILE_TEST
+	depends on LOONGARCH || MACH_LOONGSON64 || COMPILE_TEST
 	help
-	  If you have a machine based on LoongArch CPU you can enable
-	  its onboard serial ports by enabling this option. The option
-	  is applicable to both devicetree and ACPI, say Y to this option.
+	  If you have a machine based on LoongArch CPU or MIPS-based Loongson
+	  3A4000 CPU you can enable its onboard serial ports by enabling this
+	  option. The option is applicable to both devicetree and ACPI, say Y
+	  to enable this option.
 	  If unsure, say N.
 
 config SERIAL_8250_LPC18XX
-- 
2.53.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] MIPS: dts: loongson64g-package: Switch to Loongson UART driver
  2026-03-14 23:41 [PATCH 0/3] MIPS: dts: loongson64g-package: Switch to Loongson UART driver Rong Zhang
  2026-03-14 23:41 ` [PATCH 1/3] dt-bindings: serial: 8250: Add Loongson 3A4000 uart compatible Rong Zhang
  2026-03-14 23:41 ` [PATCH 2/3] serial: 8250: loongson: Enable building on MIPS Loongson64 Rong Zhang
@ 2026-03-14 23:41 ` Rong Zhang
  2026-03-15  9:08   ` Krzysztof Kozlowski
  2 siblings, 1 reply; 6+ messages in thread
From: Rong Zhang @ 2026-03-14 23:41 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Thomas Bogendoerfer, Huacai Chen, Jiaxun Yang
  Cc: Rong Zhang, linux-kernel, linux-serial, linux-mips, devicetree,
	Yao Zi, Icenowy Zheng, Rong Zhang

Loongson64g is Loongson 3A4000, whose UART controller is compatible with
Loongson 2K1500, which is NS16550A-compatible with an additional
fractional frequency divisor register.

Update the compatible strings to reflect this, so that 3A4000 can
benefit from the fractional frequency divisor provided by loongson-uart.
This is required on some devices, otherwise their UART can't work at
some high baud rates, e.g., 115200.

Tested on Loongson-LS3A4000-7A1000-NUC-SE with a 25MHz UART clock.
Without fractional frequency divisor, the actual baud rate was 111607
(25MHz / 16 / 14, measured value: 111545) and some USB-to-UART
converters couldn't work with it at all. With fractional frequency
divisor, the measured baud rate becomes 115207, which is quite accurate.

Signed-off-by: Rong Zhang <rongrong@oss.cipunited.com>
---
 arch/mips/boot/dts/loongson/loongson64g-package.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/mips/boot/dts/loongson/loongson64g-package.dtsi b/arch/mips/boot/dts/loongson/loongson64g-package.dtsi
index d4314f62ccc2..029daeedd0ab 100644
--- a/arch/mips/boot/dts/loongson/loongson64g-package.dtsi
+++ b/arch/mips/boot/dts/loongson/loongson64g-package.dtsi
@@ -40,7 +40,7 @@ liointc: interrupt-controller@3ff01400 {
 		};
 
 		cpu_uart0: serial@1fe00100 {
-			compatible = "ns16550a";
+			compatible = "loongson,ls3a4000-uart", "loongson,ls2k1500-uart", "ns16550a";
 			reg = <0 0x1fe00100 0x10>;
 			clock-frequency = <100000000>;
 			interrupt-parent = <&liointc>;
@@ -50,7 +50,7 @@ cpu_uart0: serial@1fe00100 {
 
 		cpu_uart1: serial@1fe00110 {
 			status = "disabled";
-			compatible = "ns16550a";
+			compatible = "loongson,ls3a4000-uart", "loongson,ls2k1500-uart", "ns16550a";
 			reg = <0 0x1fe00110 0x10>;
 			clock-frequency = <100000000>;
 			interrupts = <15 IRQ_TYPE_LEVEL_HIGH>;
-- 
2.53.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 3/3] MIPS: dts: loongson64g-package: Switch to Loongson UART driver
  2026-03-14 23:41 ` [PATCH 3/3] MIPS: dts: loongson64g-package: Switch to Loongson UART driver Rong Zhang
@ 2026-03-15  9:08   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2026-03-15  9:08 UTC (permalink / raw)
  To: Rong Zhang
  Cc: Greg Kroah-Hartman, Jiri Slaby, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Thomas Bogendoerfer, Huacai Chen, Jiaxun Yang,
	linux-kernel, linux-serial, linux-mips, devicetree, Yao Zi,
	Icenowy Zheng, Rong Zhang

On Sun, Mar 15, 2026 at 07:41:43AM +0800, Rong Zhang wrote:
> Loongson64g is Loongson 3A4000, whose UART controller is compatible with
> Loongson 2K1500, which is NS16550A-compatible with an additional
> fractional frequency divisor register.
> 
> Update the compatible strings to reflect this, so that 3A4000 can
> benefit from the fractional frequency divisor provided by loongson-uart.
> This is required on some devices, otherwise their UART can't work at
> some high baud rates, e.g., 115200.
> 
> Tested on Loongson-LS3A4000-7A1000-NUC-SE with a 25MHz UART clock.
> Without fractional frequency divisor, the actual baud rate was 111607
> (25MHz / 16 / 14, measured value: 111545) and some USB-to-UART
> converters couldn't work with it at all. With fractional frequency
> divisor, the measured baud rate becomes 115207, which is quite accurate.
> 
> Signed-off-by: Rong Zhang <rongrong@oss.cipunited.com>
> ---
>  arch/mips/boot/dts/loongson/loongson64g-package.dtsi | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

DTS should be sent separately, don't mix independent patches targetting
serial tree.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/3] dt-bindings: serial: 8250: Add Loongson 3A4000 uart compatible
  2026-03-14 23:41 ` [PATCH 1/3] dt-bindings: serial: 8250: Add Loongson 3A4000 uart compatible Rong Zhang
@ 2026-03-15  9:09   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2026-03-15  9:09 UTC (permalink / raw)
  To: Rong Zhang
  Cc: Greg Kroah-Hartman, Jiri Slaby, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Thomas Bogendoerfer, Huacai Chen, Jiaxun Yang,
	linux-kernel, linux-serial, linux-mips, devicetree, Yao Zi,
	Icenowy Zheng, Rong Zhang

On Sun, Mar 15, 2026 at 07:41:41AM +0800, Rong Zhang wrote:
> The UART controller on Loongson 3A4000 is compatible with Loongson
> 2K1500, which is NS16550A-compatible with an additional fractional
> frequency divisor register.
> 
> Add loongson,ls3a4000-uart as compatible with loongson,ls2k1500-uart.
> 
> Signed-off-by: Rong Zhang <rongrong@oss.cipunited.com>
> ---
>  Documentation/devicetree/bindings/serial/8250.yaml | 1 +
>  1 file changed, 1 insertion(+)

Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-03-15  9:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-14 23:41 [PATCH 0/3] MIPS: dts: loongson64g-package: Switch to Loongson UART driver Rong Zhang
2026-03-14 23:41 ` [PATCH 1/3] dt-bindings: serial: 8250: Add Loongson 3A4000 uart compatible Rong Zhang
2026-03-15  9:09   ` Krzysztof Kozlowski
2026-03-14 23:41 ` [PATCH 2/3] serial: 8250: loongson: Enable building on MIPS Loongson64 Rong Zhang
2026-03-14 23:41 ` [PATCH 3/3] MIPS: dts: loongson64g-package: Switch to Loongson UART driver Rong Zhang
2026-03-15  9:08   ` Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox