serial: 8250: Add Loongson-2K0300 and Loongson-2K3000 UART support
Subsystems (3)
cover serial: 8250: Add Loongson-2K0300 and Loongson-2K3000 UART support
Hi all:
This series adds UART support for two Loongson SoCs.
The Loongson-2K0300 UART is the same as the one found on the Loongson-2K1500, so it is documented as falling back to "loongson,ls2k1500-uart" and then "ns16550a". No driver changes are needed.
The Loongson-2K3000 UART differs from earlier Loongson UARTs in that it does not require MCR/MSR signal inversion. It also supports a fractional baud rate divisor. A dedicated compatible and driver data are added so the driver can distinguish it.
Thanks.
Binbin
Binbin Zhou (3):
dt-bindings: serial: 8250: Document Loongson-2K0300 UART compatible
dt-bindings: serial: 8250: Add dedicated Loongson-2K3000 UART
compatible
serial: 8250_loongson: Add Loongson-2K3000 UART support
Documentation/devicetree/bindings/serial/8250.yaml | 4 ++++ drivers/tty/serial/8250/8250_loongson.c | 7 +++++++ 2 files changed, 11 insertions(+)
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
Signature · 1 line
2.52.0
PATCH 1/3 dt-bindings: serial: 8250: Document Loongson-2K0300 UART compatible
The UART on the Loongson-2K0300 SoC is identical to the Loongson-2K1500 UART. Document the SoC-specific compatible loongson,ls2k0300-uart with fallback to loongson,ls2k1500-uart and then ns16550a.
--- Documentation/devicetree/bindings/serial/8250.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/serial/8250.yaml +1 -0
@@ -192,6 +192,7 @@ properties: - loongson,ls3a4000-uart - loongson,ls3a5000-uart - loongson,ls3a6000-uart + - loongson,ls2k0300-uart - loongson,ls2k2000-uart - const: loongson,ls2k1500-uart - const: ns16550a
Signature · 1 line
2.52.0
[email protected]
AI reviewRe: [PATCH 1/3] dt-bindings: serial: 8250: Document Loongson-2K0300 UART compatible
Sashiko has reviewed this patch and found no issues.
Quoted 5 lines
The UART on the Loongson-2K0300 SoC is identical to the Loongson-2K1500 UART. Document the SoC-specific compatible
loongson,ls2k0300-uartwith fallback toloongson,ls2k1500-uartand thenns16550a.Signed-off-by Binbin Zhou <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Re: [PATCH 1/3] dt-bindings: serial: 8250: Document Loongson-2K0300 UART compatible
In reply to Binbin ZhouQuoted 9 lines · Binbin Zhou
The UART on the Loongson-2K0300 SoC is identical to the Loongson-2K1500 UART. Document the SoC-specific compatible
loongson,ls2k0300-uartwith fallback toloongson,ls2k1500-uartand thenns16550a.Signed-off-by Binbin Zhou <[email protected]>--- Documentation/devicetree/bindings/serial/8250.yaml | 1 + 1 file changed, 1 insertion(+)
PATCH 2/3 dt-bindings: serial: 8250: Add dedicated Loongson-2K3000 UART compatible
In reply to Binbin ZhouUnlike earlier Loongson UARTs, the Loongson-2K3000 UART does not require MCR/MSR signal inversion. Add a dedicated compatible so the driver can distinguish it from the existing Loongson UART variants.
Document loongson,ls2k3000-uart with ns16550a as fallback.
--- Documentation/devicetree/bindings/serial/8250.yaml | 3 +++ 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/serial/8250.yaml +3 -0
@@ -196,6 +196,9 @@ properties: - loongson,ls2k2000-uart - const: loongson,ls2k1500-uart - const: ns16550a + - items: + - const: loongson,ls2k3000-uart + - const: ns16550a - items: - enum: - aspeed,ast2600-vuart
Signature · 1 line
2.52.0
[email protected]
AI reviewRe: [PATCH 2/3] dt-bindings: serial: 8250: Add dedicated Loongson-2K3000 UART compatible
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] dt-bindings: serial: 8250: duplicate ns16550a fallback block for ls2k3000 --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] dt-bindings: serial: 8250: duplicate ns16550a fallback block for ls2k3000 --
commit 71974153fe22bc00d365059be9198364c9cfaa86
Author: Binbin Zhou <[email protected]>
dt-bindings: serial: 8250: Add dedicated Loongson-2K3000 UART compatible
This commit documents the loongson,ls2k3000-uart compatible string with ns16550a as a fallback so the driver can distinguish the Loongson-2K3000 UART from earlier Loongson UARTs that require MCR/MSR signal inversion.
Documentation/devicetree/bindings/serial/8250.yaml properties: · line 201
Quoted 11 lines
Documentation/devicetree/bindings/serial/8250.yaml +3
-0@@ -196,6 +196,9 @@ properties: - loongson,ls2k2000-uart - const: loongson,ls2k1500-uart - const: ns16550a + - items: + - const: loongson,ls2k3000-uart + - const: ns16550a
[Severity: Low]
This isn't a bug, but properties:compatible in Documentation/devicetree/bindings/serial/8250.yaml already has a two-item block with const: ns16550a as the fallback that includes the other base Loongson UART compatibles:
- items:
- enum:
...
- loongson,ls2k0500-uart
- loongson,ls2k1500-uart
- const: ns16550a
Could loongson,ls2k3000-uart be added to that existing enum instead of adding a separate two-item block?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Rob Herring
maintainerRe: [PATCH 2/3] dt-bindings: serial: 8250: Add dedicated Loongson-2K3000 UART compatible
Quoted 38 lines · On Wed, Nov 04, 2026 at 07:52:04AM +0000, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] dt-bindings: serial: 8250: duplicate ns16550a fallback block for ls2k3000 --commit
71974153fe22bc00d365059be9198364c9cfaa86
Author: Binbin Zhou <[email protected]>dt-bindings: serial: 8250: Add dedicated Loongson-2K3000 UART compatible
This commit documents the loongson,ls2k3000-uart compatible string with ns16550a as a fallback so the driver can distinguish the Loongson-2K3000 UART from earlier Loongson UARTs that require MCR/MSR signal inversion.
Documentation/devicetree/bindings/serial/8250.yaml properties: · line 201
Quoted 11 lines
Documentation/devicetree/bindings/serial/8250.yaml +3
-0@@ -196,6 +196,9 @@ properties: - loongson,ls2k2000-uart - const: loongson,ls2k1500-uart - const: ns16550a + - items: + - const: loongson,ls2k3000-uart + - const: ns16550a[Severity: Low]
This isn't a bug, but properties:compatible inDocumentation/devicetree/bindings/serial/8250.yamlalready has a two-item block with const: ns16550a as the fallback that includes the other base Loongson UART compatibles:- items:
- enum:
...
- loongson,ls2k0500-uart
- loongson,ls2k1500-uart
- const: ns16550a
Quoted 2 lines
Could loongson,ls2k3000-uart be added to that existing enum instead of adding a separate two-item block?
Sashiko is correct. Please address this comment.
And please answer sashiko comments before the maintainers have to.
Rob
Re: [PATCH 2/3] dt-bindings: serial: 8250: Add dedicated Loongson-2K3000 UART compatible
Hi Rob:
Sorry for the late reply.
Quoted 39 lines · Rob Herring
Quoted 38 lines · On Wed, Nov 04, 2026 at 07:52:04AM +0000, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] dt-bindings: serial: 8250: duplicate ns16550a fallback block for ls2k3000 --commit
71974153fe22bc00d365059be9198364c9cfaa86
Author: Binbin Zhou <[email protected]>dt-bindings: serial: 8250: Add dedicated Loongson-2K3000 UART compatible
This commit documents the loongson,ls2k3000-uart compatible string with ns16550a as a fallback so the driver can distinguish the Loongson-2K3000 UART from earlier Loongson UARTs that require MCR/MSR signal inversion.
Documentation/devicetree/bindings/serial/8250.yaml properties: · line 201
Quoted 11 lines
Documentation/devicetree/bindings/serial/8250.yaml +3
-0@@ -196,6 +196,9 @@ properties: - loongson,ls2k2000-uart - const: loongson,ls2k1500-uart - const: ns16550a + - items: + - const: loongson,ls2k3000-uart + - const: ns16550a[Severity: Low]
This isn't a bug, but properties:compatible inDocumentation/devicetree/bindings/serial/8250.yamlalready has a two-item block with const: ns16550a as the fallback that includes the other base Loongson UART compatibles:- items:
- enum:
...
- loongson,ls2k0500-uart
- loongson,ls2k1500-uart
- const: ns16550a
Quoted 2 lines
Quoted 2 lines
Could loongson,ls2k3000-uart be added to that existing enum instead of adding a separate two-item block?
Let me briefly explain why Loongson UART compatible is necessary at this time. First, as described in the driver, each compatible type defines different driver data:
struct loongson_uart_ddata {
bool has_frac;
u8 mcr_invert;
u8 msr_invert;
};Since the Loongson-2k3000 has already fixed the hardware issues with mcr/msr, we need a new compatible to correspond to the updated driver_data.
static const struct loongson_uart_ddata ls2k3000_uart_data = {
.has_frac = true,
.mcr_invert = 0,
.msr_invert = 0,
};As for why a fallback to ns16550a is required in all cases, the DTS files for the Loongson-2K1000 and similar devices were merged into the repository before 8250_loongson.c, and this approach was used at the time to maintain compatibility[1].
Quoted 4 lines
Sashiko is correct. Please address this comment.
And please answer sashiko comments before the maintainers have to.
Okay, I'll keep that in mind next time.
Quoted 2 lines
Rob
Signature · 2 lines
Thanks. Binbin
PATCH 3/3 serial: 8250_loongson: Add Loongson-2K3000 UART support
In reply to Binbin ZhouThe Loongson-2K3000 UART differs from earlier Loongson UARTs in that it does not require MCR/MSR signal inversion. It also supports a fractional baud rate divisor.
Add the corresponding OF match entry for loongson,ls2k3000-uart so the driver can probe with the new driver data.
--- drivers/tty/serial/8250/8250_loongson.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/tty/serial/8250/8250_loongson.c +7 -0
@@ -43,6 +43,12 @@ static const struct loongson_uart_ddata ls2k1500_uart_data = { .msr_invert = 0, }; +static const struct loongson_uart_ddata ls2k3000_uart_data = { + .has_frac = true, + .mcr_invert =0 , + .msr_invert =0 , +}; +struct loongson_uart_priv {struct uart_8250_port *uport;struct clk *clk;
@@ -216,6 +222,7 @@ static DEFINE_SIMPLE_DEV_PM_OPS(loongson_uart_pm_ops, loongson_uart_suspend,static const struct of_device_id loongson_uart_of_ids[] = { { .compatible ="loongson,ls2k0500-uart" , .data = &ls2k0500_uart_data }, { .compatible ="loongson,ls2k1500-uart" , .data = &ls2k1500_uart_data }, + { .compatible ="loongson,ls2k3000-uart" , .data = &ls2k3000_uart_data }, { }, };MODULE_DEVICE_TABLE (of, loongson_uart_of_ids);
Signature · 1 line
2.52.0
[email protected]
AI reviewRe: [PATCH 3/3] serial: 8250_loongson: Add Loongson-2K3000 UART support
Sashiko has reviewed this patch and found no issues.
Quoted 9 lines
The Loongson-2K3000 UART differs from earlier Loongson UARTs in that it does not require MCR/MSR signal inversion. It also supports a fractional baud rate divisor.
Add the corresponding OF match entry for
loongson,ls2k3000-uartso the driver can probe with the new driver data.Signed-off-by Haowei Zheng <[email protected]>Signed-off-by Binbin Zhou <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
For this series:
Quoted 33 lines · Binbin Zhou
Hi all:
This series adds UART support for two Loongson SoCs.
The Loongson-2K0300 UART is the same as the one found on the Loongson-2K1500, so it is documented as falling back to "loongson,ls2k1500-uart" and then "ns16550a". No driver changes are needed.
The Loongson-2K3000 UART differs from earlier Loongson UARTs in that it does not require MCR/MSR signal inversion. It also supports a fractional baud rate divisor. A dedicated compatible and driver data are added so the driver can distinguish it.
Thanks.
BinbinBinbin Zhou (3):
dt-bindings: serial: 8250: Document Loongson-2K0300 UART compatible
dt-bindings: serial: 8250: Add dedicated Loongson-2K3000 UART
compatible
serial: 8250_loongson: Add Loongson-2K3000 UART supportDocumentation/devicetree/bindings/serial/8250.yaml | 4 ++++ drivers/tty/serial/8250/8250_loongson.c | 7 +++++++ 2 files changed, 11 insertions(+)base-commit:
6628e7d4c6b25c8d18f1345e3a20d21829aae7e4--
2.52.0