* [PATCH v4 0/3] uart: Introduce uart driver for the Loongson family
@ 2025-09-09 12:11 Binbin Zhou
2025-09-09 12:11 ` [PATCH v4 1/3] dt-bindings: serial: Add Loongson UART controller Binbin Zhou
` (2 more replies)
0 siblings, 3 replies; 13+ messages in thread
From: Binbin Zhou @ 2025-09-09 12:11 UTC (permalink / raw)
To: Binbin Zhou, Huacai Chen, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Greg Kroah-Hartman, Jiri Slaby, Haowei Zheng
Cc: Huacai Chen, Xuerui Wang, loongarch, devicetree, linux-serial,
Binbin Zhou
Hi all:
For various reasons, I will be taking over from Haowei and continuing to
push forward with this patch set. Thanks to Haowei for his efforts so
far.
This patchset introduce a generic UART framework driver for Loongson family.
It can be found on Loongson3 series cpus, Loongson-2K series cpus and Loongson
LS7A bridge chips.
Thanks.
------
V4:
Patch 1:
- Rename binding name from loongson,uart.yaml to
loongson,ls2k0500-uart.yaml;
- Drop ls7a compatible;
- According to the manual, ls3a and ls2k uart are the same, so merge their
compatible.
Patch 2:
- Format code;
- Add the LOONGSON_UART_DLF macro definition to avoid magic numbers;
- Simplify the code, merge flags and quirks, and remove struct
loongson_uart_config;
- Use DEFINE_SIMPLE_DEV_PM_OPS;
- Drop loongson,ls7a-uart compatible.
Patch 3:
- Add ls2k* compatible string, and ns16550a as the fallback
compatible.
Link to V3:
https://lore.kernel.org/all/20240826024705.55474-1-zhenghaowei@loongson.cn/
Binbin Zhou (3):
dt-bindings: serial: Add Loongson UART controller
serial: 8250: Add Loongson uart driver support
LoongArch: dts: Add uart new compatible string
.../serial/loongson,ls2k0500-uart.yaml | 60 ++++++
MAINTAINERS | 8 +
arch/loongarch/boot/dts/loongson-2k0500.dtsi | 2 +-
arch/loongarch/boot/dts/loongson-2k1000.dtsi | 2 +-
arch/loongarch/boot/dts/loongson-2k2000.dtsi | 2 +-
drivers/tty/serial/8250/8250_loongson.c | 200 ++++++++++++++++++
drivers/tty/serial/8250/8250_port.c | 8 +
drivers/tty/serial/8250/Kconfig | 10 +
drivers/tty/serial/8250/Makefile | 1 +
include/uapi/linux/serial_core.h | 1 +
10 files changed, 291 insertions(+), 3 deletions(-)
create mode 100644 Documentation/devicetree/bindings/serial/loongson,ls2k0500-uart.yaml
create mode 100644 drivers/tty/serial/8250/8250_loongson.c
base-commit: b601e1f41edd4667062aa7cccb4e5199814979a3
--
2.47.3
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH v4 1/3] dt-bindings: serial: Add Loongson UART controller 2025-09-09 12:11 [PATCH v4 0/3] uart: Introduce uart driver for the Loongson family Binbin Zhou @ 2025-09-09 12:11 ` Binbin Zhou 2025-09-10 8:26 ` Krzysztof Kozlowski 2025-09-10 8:28 ` Krzysztof Kozlowski 2025-09-09 12:11 ` [PATCH v4 2/3] serial: 8250: Add Loongson uart driver support Binbin Zhou 2025-09-09 12:11 ` [PATCH v4 3/3] LoongArch: dts: Add uart new compatible string Binbin Zhou 2 siblings, 2 replies; 13+ messages in thread From: Binbin Zhou @ 2025-09-09 12:11 UTC (permalink / raw) To: Binbin Zhou, Huacai Chen, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Greg Kroah-Hartman, Jiri Slaby, Haowei Zheng Cc: Huacai Chen, Xuerui Wang, loongarch, devicetree, linux-serial, Binbin Zhou Add Loongson UART controller binding with DT schema format using json-schema. Co-developed-by: Haowei Zheng <zhenghaowei@loongson.cn> Signed-off-by: Haowei Zheng <zhenghaowei@loongson.cn> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn> --- .../serial/loongson,ls2k0500-uart.yaml | 60 +++++++++++++++++++ MAINTAINERS | 7 +++ 2 files changed, 67 insertions(+) create mode 100644 Documentation/devicetree/bindings/serial/loongson,ls2k0500-uart.yaml diff --git a/Documentation/devicetree/bindings/serial/loongson,ls2k0500-uart.yaml b/Documentation/devicetree/bindings/serial/loongson,ls2k0500-uart.yaml new file mode 100644 index 000000000000..69f6df6cd9fe --- /dev/null +++ b/Documentation/devicetree/bindings/serial/loongson,ls2k0500-uart.yaml @@ -0,0 +1,60 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/loongson,ls2k0500-uart.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Loongson UART controller + +maintainers: + - Haowei Zheng <zhenghaowei@loongson.cn> + - Binbin Zhou <zhoubinbin@loongson.cn> + +allOf: + - $ref: serial.yaml + +properties: + compatible: + oneOf: + - enum: + - loongson,ls2k0500-uart + - loongson,ls2k1500-uart + - items: + - enum: + - loongson,ls2k1000-uart + - const: loongson,ls2k0500-uart + - items: + - enum: + - loongson,ls3a5000-uart + - loongson,ls3a6000-uart + - loongson,ls2k2000-uart + - const: loongson,ls2k1500-uart + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + clock-frequency: true + +required: + - compatible + - reg + - interrupts + - clock-frequency + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + #include <dt-bindings/clock/loongson,ls2k-clk.h> + + serial@1fe20000 { + compatible = "loongson,ls2k1000-uart", "loongson,ls2k0500-uart"; + reg = <0x1fe20000 0x10>; + clock-frequency = <125000000>; + interrupt-parent = <&liointc0>; + interrupts = <0x0 IRQ_TYPE_LEVEL_HIGH>; + }; diff --git a/MAINTAINERS b/MAINTAINERS index fe168477caa4..ed016f251cf7 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14353,6 +14353,13 @@ S: Maintained F: Documentation/devicetree/bindings/pwm/loongson,ls7a-pwm.yaml F: drivers/pwm/pwm-loongson.c +LOONGSON UART DRIVER +M: Haowei Zheng <zhenghaowei@loongson.cn> +M: Binbin Zhou <zhoubinbin@loongson.cn> +L: linux-serial@vger.kernel.org +S: Maintained +F: Documentation/devicetree/bindings/serial/loongson,uart.yaml + LOONGSON-2 SOC SERIES CLOCK DRIVER M: Yinbo Zhu <zhuyinbo@loongson.cn> L: linux-clk@vger.kernel.org -- 2.47.3 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v4 1/3] dt-bindings: serial: Add Loongson UART controller 2025-09-09 12:11 ` [PATCH v4 1/3] dt-bindings: serial: Add Loongson UART controller Binbin Zhou @ 2025-09-10 8:26 ` Krzysztof Kozlowski 2025-09-10 8:28 ` Krzysztof Kozlowski 1 sibling, 0 replies; 13+ messages in thread From: Krzysztof Kozlowski @ 2025-09-10 8:26 UTC (permalink / raw) To: Binbin Zhou Cc: Binbin Zhou, Huacai Chen, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Greg Kroah-Hartman, Jiri Slaby, Haowei Zheng, Huacai Chen, Xuerui Wang, loongarch, devicetree, linux-serial On Tue, Sep 09, 2025 at 08:11:18PM +0800, Binbin Zhou wrote: > + reg: > + maxItems: 1 > + > + interrupts: > + maxItems: 1 > + > + clock-frequency: true Device does not take any clocks, so you must be describing link speed. What is wrong with current-speed property? Best regards, Krzysztof ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v4 1/3] dt-bindings: serial: Add Loongson UART controller 2025-09-09 12:11 ` [PATCH v4 1/3] dt-bindings: serial: Add Loongson UART controller Binbin Zhou 2025-09-10 8:26 ` Krzysztof Kozlowski @ 2025-09-10 8:28 ` Krzysztof Kozlowski 2025-09-12 6:06 ` Binbin Zhou 1 sibling, 1 reply; 13+ messages in thread From: Krzysztof Kozlowski @ 2025-09-10 8:28 UTC (permalink / raw) To: Binbin Zhou Cc: Binbin Zhou, Huacai Chen, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Greg Kroah-Hartman, Jiri Slaby, Haowei Zheng, Huacai Chen, Xuerui Wang, loongarch, devicetree, linux-serial On Tue, Sep 09, 2025 at 08:11:18PM +0800, Binbin Zhou wrote: > Add Loongson UART controller binding with DT schema format using > json-schema. Why? Your DTS claims this is 8250 / ns16550a. This is just incomplete commit msg. You must explain the bigger picture here, not repeat what the patch does. We see what the patch does from the patch. Best regards, Krzysztof ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v4 1/3] dt-bindings: serial: Add Loongson UART controller 2025-09-10 8:28 ` Krzysztof Kozlowski @ 2025-09-12 6:06 ` Binbin Zhou 0 siblings, 0 replies; 13+ messages in thread From: Binbin Zhou @ 2025-09-12 6:06 UTC (permalink / raw) To: Krzysztof Kozlowski Cc: Binbin Zhou, Huacai Chen, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Greg Kroah-Hartman, Jiri Slaby, Haowei Zheng, Huacai Chen, Xuerui Wang, loongarch, devicetree, linux-serial Hi Krzysztof: Thanks for your reply. On Wed, Sep 10, 2025 at 4:28 PM Krzysztof Kozlowski <krzk@kernel.org> wrote: > > On Tue, Sep 09, 2025 at 08:11:18PM +0800, Binbin Zhou wrote: > > Add Loongson UART controller binding with DT schema format using > > json-schema. > > Why? Your DTS claims this is 8250 / ns16550a. > > This is just incomplete commit msg. You must explain the bigger picture > here, not repeat what the patch does. We see what the patch does from > the patch. According to the chip manual[1], the Loongson UART controller's registers and functions are compatible with the NS16550A. Would adding Loongson UART compatible to the 8250.yaml file be a better choice, as shown below: diff --git a/Documentation/devicetree/bindings/serial/8250.yaml b/Documentation/devicetree/bindings/serial/8250.yaml index e46bee8d25bf..abd41e996e68 100644 --- a/Documentation/devicetree/bindings/serial/8250.yaml +++ b/Documentation/devicetree/bindings/serial/8250.yaml @@ -99,6 +99,8 @@ properties: - nxp,lpc1850-uart - opencores,uart16550-rtlsvn105 - ti,da830-uart + - loongson,ls2k0500-uart + - loongson,ls2k1500-uart - const: ns16550a - items: - enum: @@ -143,6 +145,18 @@ properties: - nvidia,tegra194-uart - nvidia,tegra234-uart - const: nvidia,tegra20-uart + - items: + - enum: + - loongson,ls2k1000-uart + - const: loongson,ls2k0500-uart + - const: ns16550a + - items: + - enum: + - loongson,ls3a5000-uart + - loongson,ls3a6000-uart + - loongson,ls2k2000-uart + - const: loongson,ls2k1500-uart + - const: ns16550a reg: maxItems: 1 [1]: https://loongson.github.io/LoongArch-Documentation/Loongson-3A5000-usermanual-EN.pdf > > Best regards, > Krzysztof > -- Thanks. Binbin ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v4 2/3] serial: 8250: Add Loongson uart driver support 2025-09-09 12:11 [PATCH v4 0/3] uart: Introduce uart driver for the Loongson family Binbin Zhou 2025-09-09 12:11 ` [PATCH v4 1/3] dt-bindings: serial: Add Loongson UART controller Binbin Zhou @ 2025-09-09 12:11 ` Binbin Zhou 2025-09-10 11:05 ` kernel test robot 2025-09-10 11:26 ` kernel test robot 2025-09-09 12:11 ` [PATCH v4 3/3] LoongArch: dts: Add uart new compatible string Binbin Zhou 2 siblings, 2 replies; 13+ messages in thread From: Binbin Zhou @ 2025-09-09 12:11 UTC (permalink / raw) To: Binbin Zhou, Huacai Chen, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Greg Kroah-Hartman, Jiri Slaby, Haowei Zheng Cc: Huacai Chen, Xuerui Wang, loongarch, devicetree, linux-serial, Binbin Zhou Add the driver for on-chip UART used on Loongson family chips. The hardware is similar to 8250, but there are the following differences: - Some chips (such as Loongson-2K2000) have added a fractional division register to obtain the required baud rate accurately, so the {get,set}_divisor callback is overridden. - Due to hardware defects, quirk handling is required for UART_MCR/UART_MSR. Co-developed-by: Haowei Zheng <zhenghaowei@loongson.cn> Signed-off-by: Haowei Zheng <zhenghaowei@loongson.cn> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn> --- MAINTAINERS | 1 + drivers/tty/serial/8250/8250_loongson.c | 200 ++++++++++++++++++++++++ drivers/tty/serial/8250/8250_port.c | 8 + drivers/tty/serial/8250/Kconfig | 10 ++ drivers/tty/serial/8250/Makefile | 1 + include/uapi/linux/serial_core.h | 1 + 6 files changed, 221 insertions(+) create mode 100644 drivers/tty/serial/8250/8250_loongson.c diff --git a/MAINTAINERS b/MAINTAINERS index ed016f251cf7..9383d12e430c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14359,6 +14359,7 @@ M: Binbin Zhou <zhoubinbin@loongson.cn> L: linux-serial@vger.kernel.org S: Maintained F: Documentation/devicetree/bindings/serial/loongson,uart.yaml +F: drivers/tty/serial/8250/8250_loongson.c LOONGSON-2 SOC SERIES CLOCK DRIVER M: Yinbo Zhu <zhuyinbo@loongson.cn> diff --git a/drivers/tty/serial/8250/8250_loongson.c b/drivers/tty/serial/8250/8250_loongson.c new file mode 100644 index 000000000000..78328f77d941 --- /dev/null +++ b/drivers/tty/serial/8250/8250_loongson.c @@ -0,0 +1,200 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Serial Port driver for Loongson family chips + * + * Copyright (C) 2020-2025 Loongson Technology Corporation Limited + */ + +#include <linux/bitfield.h> +#include <linux/module.h> +#include <linux/reset.h> + +#include "8250.h" + +/* Divisor Latch Fraction Register */ +#define LOONGSON_UART_DLF 0x2 + +/* Flags */ +#define LOONGSON_UART_HAS_FRAC BIT(0) +#define LOONGSON_UART_QUIRK_MCR BIT(1) +#define LOONGSON_UART_QUIRK_MSR BIT(2) + +#define LS2K0500_UART_FLAG (LOONGSON_UART_QUIRK_MCR | LOONGSON_UART_QUIRK_MSR) +#define LS2K1500_UART_FLAG (LOONGSON_UART_HAS_FRAC | LOONGSON_UART_QUIRK_MCR) + +struct loongson_uart_data { + int line; + int mcr_invert; + int msr_invert; + struct reset_control *rst; +}; + +static unsigned int serial_fixup(struct uart_port *p, unsigned int offset, unsigned int val) +{ + struct loongson_uart_data *ddata = p->private_data; + + if (offset == UART_MCR) + val ^= ddata->mcr_invert; + + if (offset == UART_MSR) + val ^= ddata->msr_invert; + + return val; +} + +static u32 loongson_serial_in(struct uart_port *p, unsigned int offset) +{ + unsigned int val; + + val = readb(p->membase + (offset << p->regshift)); + + return serial_fixup(p, offset, val); +} + +static void loongson_serial_out(struct uart_port *p, unsigned int offset, unsigned int value) +{ + offset <<= p->regshift; + writeb(serial_fixup(p, offset, value), p->membase + offset); +} + +static unsigned int loongson_frac_get_divisor(struct uart_port *port, unsigned int baud, + unsigned int *frac) +{ + unsigned int quot; + + quot = DIV_ROUND_CLOSEST((port->uartclk << 4), baud); + *frac = FIELD_GET(GENMASK(7, 0), quot); + + return FIELD_GET(GENMASK(15, 8), quot); +} + +static void loongson_frac_set_divisor(struct uart_port *port, unsigned int baud, + unsigned int quot, unsigned int quot_frac) +{ + struct uart_8250_port *up = up_to_u8250p(port); + + serial_port_out(port, UART_LCR, up->lcr | UART_LCR_DLAB); + serial_dl_write(up, quot); + serial_port_out(port, LOONGSON_UART_DLF, quot_frac); +} + +static int loongson_uart_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct uart_8250_port uart = {}; + struct loongson_uart_data *ddata; + struct resource *res; + unsigned int flags; + int ret; + + ddata = devm_kzalloc(dev, sizeof(*ddata), GFP_KERNEL); + if (!ddata) + return -ENOMEM; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) + return -ENODEV; + + uart.port.irq = platform_get_irq(pdev, 0); + if (uart.port.irq < 0) + return -EINVAL; + + device_property_read_u32(dev, "clock-frequency", &uart.port.uartclk); + + spin_lock_init(&uart.port.lock); + uart.port.flags = UPF_SHARE_IRQ | UPF_FIXED_PORT | UPF_FIXED_TYPE | UPF_IOREMAP; + uart.port.iotype = UPIO_MEM; + uart.port.regshift = 0; + uart.port.dev = dev; + uart.port.type = PORT_LOONGSON; + uart.port.private_data = ddata; + + uart.port.mapbase = res->start; + uart.port.mapsize = resource_size(res); + uart.port.serial_in = loongson_serial_in; + uart.port.serial_out = loongson_serial_out; + + flags = (uintptr_t)device_get_match_data(dev); + + if (flags & LOONGSON_UART_HAS_FRAC) { + uart.port.get_divisor = loongson_frac_get_divisor; + uart.port.set_divisor = loongson_frac_set_divisor; + } + + if (flags & LOONGSON_UART_QUIRK_MCR) + ddata->mcr_invert |= (UART_MCR_RTS | UART_MCR_DTR); + + if (flags & LOONGSON_UART_QUIRK_MSR) + ddata->msr_invert |= (UART_MSR_CTS | UART_MSR_DSR); + + ddata->rst = devm_reset_control_get_optional_shared(dev, NULL); + if (IS_ERR(ddata->rst)) + return PTR_ERR(ddata->rst); + + ret = reset_control_deassert(ddata->rst); + if (ret) + return ret; + + ret = serial8250_register_8250_port(&uart); + if (ret < 0) { + reset_control_assert(ddata->rst); + return ret; + } + + ddata->line = ret; + platform_set_drvdata(pdev, ddata); + + return 0; +} + +static void loongson_uart_remove(struct platform_device *pdev) +{ + struct loongson_uart_data *ddata = platform_get_drvdata(pdev); + + serial8250_unregister_port(ddata->line); + reset_control_assert(ddata->rst); +} + +static int loongson_uart_suspend(struct device *dev) +{ + struct loongson_uart_data *ddata = dev_get_drvdata(dev); + + serial8250_suspend_port(ddata->line); + + return 0; +} + +static int loongson_uart_resume(struct device *dev) +{ + struct loongson_uart_data *data = dev_get_drvdata(dev); + + serial8250_resume_port(data->line); + + return 0; +} + +static DEFINE_SIMPLE_DEV_PM_OPS(loongson_uart_pm_ops, loongson_uart_suspend, + loongson_uart_resume); + +static const struct of_device_id loongson_uart_of_ids[] = { + { .compatible = "loongson,ls2k0500-uart", .data = (void *)LS2K0500_UART_FLAG }, + { .compatible = "loongson,ls2k1500-uart", .data = (void *)LS2K1500_UART_FLAG }, + { /* sentinel */ }, +}; +MODULE_DEVICE_TABLE(of, loongson_uart_of_ids); + +static struct platform_driver loongson_uart_driver = { + .probe = loongson_uart_probe, + .remove = loongson_uart_remove, + .driver = { + .name = "loongson-uart", + .pm = pm_ptr(&loongson_uart_pm_ops), + .of_match_table = loongson_uart_of_ids, + }, +}; + +module_platform_driver(loongson_uart_driver); + +MODULE_DESCRIPTION("Loongson UART driver"); +MODULE_AUTHOR("Loongson Technology Corporation Limited."); +MODULE_LICENSE("GPL"); diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index 719faf92aa8a..53efe841656f 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -310,6 +310,14 @@ static const struct serial8250_config uart_config[] = { .rxtrig_bytes = {1, 8, 16, 30}, .flags = UART_CAP_FIFO | UART_CAP_AFE, }, + [PORT_LOONGSON] = { + .name = "Loongson", + .fifo_size = 16, + .tx_loadsz = 16, + .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10, + .rxtrig_bytes = {1, 4, 8, 14}, + .flags = UART_CAP_FIFO, + }, }; /* Uart divisor latch read */ diff --git a/drivers/tty/serial/8250/Kconfig b/drivers/tty/serial/8250/Kconfig index f64ef0819cd4..98236b3bec10 100644 --- a/drivers/tty/serial/8250/Kconfig +++ b/drivers/tty/serial/8250/Kconfig @@ -468,6 +468,16 @@ config SERIAL_8250_OMAP_TTYO_FIXUP not booting kernel because the serial console remains silent in case they forgot to update the command line. +config SERIAL_8250_LOONGSON + tristate "Loongson 8250 based serial port" + depends on SERIAL_8250 + depends on LOONGARCH || 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 unsure, say N. + config SERIAL_8250_LPC18XX tristate "NXP LPC18xx/43xx serial port support" depends on SERIAL_8250 && OF && (ARCH_LPC18XX || COMPILE_TEST) diff --git a/drivers/tty/serial/8250/Makefile b/drivers/tty/serial/8250/Makefile index 513a0941c284..e318a3240789 100644 --- a/drivers/tty/serial/8250/Makefile +++ b/drivers/tty/serial/8250/Makefile @@ -38,6 +38,7 @@ obj-$(CONFIG_SERIAL_8250_HP300) += 8250_hp300.o obj-$(CONFIG_SERIAL_8250_HUB6) += 8250_hub6.o obj-$(CONFIG_SERIAL_8250_INGENIC) += 8250_ingenic.o obj-$(CONFIG_SERIAL_8250_IOC3) += 8250_ioc3.o +obj-$(CONFIG_SERIAL_8250_LOONGSON) += 8250_loongson.o obj-$(CONFIG_SERIAL_8250_LPC18XX) += 8250_lpc18xx.o obj-$(CONFIG_SERIAL_8250_LPSS) += 8250_lpss.o obj-$(CONFIG_SERIAL_8250_MEN_MCB) += 8250_men_mcb.o diff --git a/include/uapi/linux/serial_core.h b/include/uapi/linux/serial_core.h index 9c007a106330..607cf060a72a 100644 --- a/include/uapi/linux/serial_core.h +++ b/include/uapi/linux/serial_core.h @@ -31,6 +31,7 @@ #define PORT_ALTR_16550_F128 28 /* Altera 16550 UART with 128 FIFOs */ #define PORT_RT2880 29 /* Ralink RT2880 internal UART */ #define PORT_16550A_FSL64 30 /* Freescale 16550 UART with 64 FIFOs */ +#define PORT_LOONGSON 31 /* Loongson 16550 UART */ /* * ARM specific type numbers. These are not currently guaranteed -- 2.47.3 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v4 2/3] serial: 8250: Add Loongson uart driver support 2025-09-09 12:11 ` [PATCH v4 2/3] serial: 8250: Add Loongson uart driver support Binbin Zhou @ 2025-09-10 11:05 ` kernel test robot 2025-09-10 11:26 ` kernel test robot 1 sibling, 0 replies; 13+ messages in thread From: kernel test robot @ 2025-09-10 11:05 UTC (permalink / raw) To: Binbin Zhou, Binbin Zhou, Huacai Chen, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Greg Kroah-Hartman, Jiri Slaby, Haowei Zheng Cc: oe-kbuild-all, Xuerui Wang, loongarch, devicetree, linux-serial Hi Binbin, kernel test robot noticed the following build errors: [auto build test ERROR on b601e1f41edd4667062aa7cccb4e5199814979a3] url: https://github.com/intel-lab-lkp/linux/commits/Binbin-Zhou/dt-bindings-serial-Add-Loongson-UART-controller/20250909-201640 base: b601e1f41edd4667062aa7cccb4e5199814979a3 patch link: https://lore.kernel.org/r/91ae8cd4f903ac452e337e4662bbabf8a412b061.1757318368.git.zhoubinbin%40loongson.cn patch subject: [PATCH v4 2/3] serial: 8250: Add Loongson uart driver support config: m68k-allmodconfig (https://download.01.org/0day-ci/archive/20250910/202509101843.2PXpHVfr-lkp@intel.com/config) compiler: m68k-linux-gcc (GCC) 15.1.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250910/202509101843.2PXpHVfr-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202509101843.2PXpHVfr-lkp@intel.com/ All errors (new ones prefixed by >>): drivers/tty/serial/8250/8250_loongson.c: In function 'loongson_uart_probe': >> drivers/tty/serial/8250/8250_loongson.c:102:9: error: implicit declaration of function 'device_property_read_u32' [-Wimplicit-function-declaration] 102 | device_property_read_u32(dev, "clock-frequency", &uart.port.uartclk); | ^~~~~~~~~~~~~~~~~~~~~~~~ >> drivers/tty/serial/8250/8250_loongson.c:117:28: error: implicit declaration of function 'device_get_match_data'; did you mean 'device_match_any'? [-Wimplicit-function-declaration] 117 | flags = (uintptr_t)device_get_match_data(dev); | ^~~~~~~~~~~~~~~~~~~~~ | device_match_any drivers/tty/serial/8250/8250_loongson.c: At top level: >> drivers/tty/serial/8250/8250_loongson.c:179:34: error: array type has incomplete element type 'struct of_device_id' 179 | static const struct of_device_id loongson_uart_of_ids[] = { | ^~~~~~~~~~~~~~~~~~~~ vim +/device_property_read_u32 +102 drivers/tty/serial/8250/8250_loongson.c 80 81 static int loongson_uart_probe(struct platform_device *pdev) 82 { 83 struct device *dev = &pdev->dev; 84 struct uart_8250_port uart = {}; 85 struct loongson_uart_data *ddata; 86 struct resource *res; 87 unsigned int flags; 88 int ret; 89 90 ddata = devm_kzalloc(dev, sizeof(*ddata), GFP_KERNEL); 91 if (!ddata) 92 return -ENOMEM; 93 94 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 95 if (!res) 96 return -ENODEV; 97 98 uart.port.irq = platform_get_irq(pdev, 0); 99 if (uart.port.irq < 0) 100 return -EINVAL; 101 > 102 device_property_read_u32(dev, "clock-frequency", &uart.port.uartclk); 103 104 spin_lock_init(&uart.port.lock); 105 uart.port.flags = UPF_SHARE_IRQ | UPF_FIXED_PORT | UPF_FIXED_TYPE | UPF_IOREMAP; 106 uart.port.iotype = UPIO_MEM; 107 uart.port.regshift = 0; 108 uart.port.dev = dev; 109 uart.port.type = PORT_LOONGSON; 110 uart.port.private_data = ddata; 111 112 uart.port.mapbase = res->start; 113 uart.port.mapsize = resource_size(res); 114 uart.port.serial_in = loongson_serial_in; 115 uart.port.serial_out = loongson_serial_out; 116 > 117 flags = (uintptr_t)device_get_match_data(dev); 118 119 if (flags & LOONGSON_UART_HAS_FRAC) { 120 uart.port.get_divisor = loongson_frac_get_divisor; 121 uart.port.set_divisor = loongson_frac_set_divisor; 122 } 123 124 if (flags & LOONGSON_UART_QUIRK_MCR) 125 ddata->mcr_invert |= (UART_MCR_RTS | UART_MCR_DTR); 126 127 if (flags & LOONGSON_UART_QUIRK_MSR) 128 ddata->msr_invert |= (UART_MSR_CTS | UART_MSR_DSR); 129 130 ddata->rst = devm_reset_control_get_optional_shared(dev, NULL); 131 if (IS_ERR(ddata->rst)) 132 return PTR_ERR(ddata->rst); 133 134 ret = reset_control_deassert(ddata->rst); 135 if (ret) 136 return ret; 137 138 ret = serial8250_register_8250_port(&uart); 139 if (ret < 0) { 140 reset_control_assert(ddata->rst); 141 return ret; 142 } 143 144 ddata->line = ret; 145 platform_set_drvdata(pdev, ddata); 146 147 return 0; 148 } 149 150 static void loongson_uart_remove(struct platform_device *pdev) 151 { 152 struct loongson_uart_data *ddata = platform_get_drvdata(pdev); 153 154 serial8250_unregister_port(ddata->line); 155 reset_control_assert(ddata->rst); 156 } 157 158 static int loongson_uart_suspend(struct device *dev) 159 { 160 struct loongson_uart_data *ddata = dev_get_drvdata(dev); 161 162 serial8250_suspend_port(ddata->line); 163 164 return 0; 165 } 166 167 static int loongson_uart_resume(struct device *dev) 168 { 169 struct loongson_uart_data *data = dev_get_drvdata(dev); 170 171 serial8250_resume_port(data->line); 172 173 return 0; 174 } 175 176 static DEFINE_SIMPLE_DEV_PM_OPS(loongson_uart_pm_ops, loongson_uart_suspend, 177 loongson_uart_resume); 178 > 179 static const struct of_device_id loongson_uart_of_ids[] = { 180 { .compatible = "loongson,ls2k0500-uart", .data = (void *)LS2K0500_UART_FLAG }, 181 { .compatible = "loongson,ls2k1500-uart", .data = (void *)LS2K1500_UART_FLAG }, 182 { /* sentinel */ }, 183 }; 184 MODULE_DEVICE_TABLE(of, loongson_uart_of_ids); 185 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v4 2/3] serial: 8250: Add Loongson uart driver support 2025-09-09 12:11 ` [PATCH v4 2/3] serial: 8250: Add Loongson uart driver support Binbin Zhou 2025-09-10 11:05 ` kernel test robot @ 2025-09-10 11:26 ` kernel test robot 1 sibling, 0 replies; 13+ messages in thread From: kernel test robot @ 2025-09-10 11:26 UTC (permalink / raw) To: Binbin Zhou, Binbin Zhou, Huacai Chen, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Greg Kroah-Hartman, Jiri Slaby, Haowei Zheng Cc: oe-kbuild-all, Xuerui Wang, loongarch, devicetree, linux-serial Hi Binbin, kernel test robot noticed the following build warnings: [auto build test WARNING on b601e1f41edd4667062aa7cccb4e5199814979a3] url: https://github.com/intel-lab-lkp/linux/commits/Binbin-Zhou/dt-bindings-serial-Add-Loongson-UART-controller/20250909-201640 base: b601e1f41edd4667062aa7cccb4e5199814979a3 patch link: https://lore.kernel.org/r/91ae8cd4f903ac452e337e4662bbabf8a412b061.1757318368.git.zhoubinbin%40loongson.cn patch subject: [PATCH v4 2/3] serial: 8250: Add Loongson uart driver support config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20250910/202509102107.dmwhCV71-lkp@intel.com/config) compiler: m68k-linux-gcc (GCC) 15.1.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250910/202509102107.dmwhCV71-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202509102107.dmwhCV71-lkp@intel.com/ All warnings (new ones prefixed by >>): drivers/tty/serial/8250/8250_loongson.c: In function 'loongson_uart_probe': drivers/tty/serial/8250/8250_loongson.c:102:9: error: implicit declaration of function 'device_property_read_u32' [-Wimplicit-function-declaration] 102 | device_property_read_u32(dev, "clock-frequency", &uart.port.uartclk); | ^~~~~~~~~~~~~~~~~~~~~~~~ drivers/tty/serial/8250/8250_loongson.c:117:28: error: implicit declaration of function 'device_get_match_data'; did you mean 'device_match_any'? [-Wimplicit-function-declaration] 117 | flags = (uintptr_t)device_get_match_data(dev); | ^~~~~~~~~~~~~~~~~~~~~ | device_match_any drivers/tty/serial/8250/8250_loongson.c: At top level: drivers/tty/serial/8250/8250_loongson.c:179:34: error: array type has incomplete element type 'struct of_device_id' 179 | static const struct of_device_id loongson_uart_of_ids[] = { | ^~~~~~~~~~~~~~~~~~~~ >> drivers/tty/serial/8250/8250_loongson.c:179:34: warning: 'loongson_uart_of_ids' defined but not used [-Wunused-variable] vim +/loongson_uart_of_ids +179 drivers/tty/serial/8250/8250_loongson.c 175 176 static DEFINE_SIMPLE_DEV_PM_OPS(loongson_uart_pm_ops, loongson_uart_suspend, 177 loongson_uart_resume); 178 > 179 static const struct of_device_id loongson_uart_of_ids[] = { 180 { .compatible = "loongson,ls2k0500-uart", .data = (void *)LS2K0500_UART_FLAG }, 181 { .compatible = "loongson,ls2k1500-uart", .data = (void *)LS2K1500_UART_FLAG }, 182 { /* sentinel */ }, 183 }; 184 MODULE_DEVICE_TABLE(of, loongson_uart_of_ids); 185 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v4 3/3] LoongArch: dts: Add uart new compatible string 2025-09-09 12:11 [PATCH v4 0/3] uart: Introduce uart driver for the Loongson family Binbin Zhou 2025-09-09 12:11 ` [PATCH v4 1/3] dt-bindings: serial: Add Loongson UART controller Binbin Zhou 2025-09-09 12:11 ` [PATCH v4 2/3] serial: 8250: Add Loongson uart driver support Binbin Zhou @ 2025-09-09 12:11 ` Binbin Zhou 2025-09-10 8:27 ` Krzysztof Kozlowski 2 siblings, 1 reply; 13+ messages in thread From: Binbin Zhou @ 2025-09-09 12:11 UTC (permalink / raw) To: Binbin Zhou, Huacai Chen, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Greg Kroah-Hartman, Jiri Slaby, Haowei Zheng Cc: Huacai Chen, Xuerui Wang, loongarch, devicetree, linux-serial, Binbin Zhou Add loongson,ls2k*-uart compatible string on uarts. Co-developed-by: Haowei Zheng <zhenghaowei@loongson.cn> Signed-off-by: Haowei Zheng <zhenghaowei@loongson.cn> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn> --- arch/loongarch/boot/dts/loongson-2k0500.dtsi | 2 +- arch/loongarch/boot/dts/loongson-2k1000.dtsi | 2 +- arch/loongarch/boot/dts/loongson-2k2000.dtsi | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/loongarch/boot/dts/loongson-2k0500.dtsi b/arch/loongarch/boot/dts/loongson-2k0500.dtsi index 588ebc3bded4..357de4ca7555 100644 --- a/arch/loongarch/boot/dts/loongson-2k0500.dtsi +++ b/arch/loongarch/boot/dts/loongson-2k0500.dtsi @@ -380,7 +380,7 @@ tsensor: thermal-sensor@1fe11500 { }; uart0: serial@1ff40800 { - compatible = "ns16550a"; + compatible = "loongson,ls2k0500-uart", "ns16550a"; reg = <0x0 0x1ff40800 0x0 0x10>; clock-frequency = <100000000>; interrupt-parent = <&eiointc>; diff --git a/arch/loongarch/boot/dts/loongson-2k1000.dtsi b/arch/loongarch/boot/dts/loongson-2k1000.dtsi index d8e01e2534dd..60ab425f793f 100644 --- a/arch/loongarch/boot/dts/loongson-2k1000.dtsi +++ b/arch/loongarch/boot/dts/loongson-2k1000.dtsi @@ -297,7 +297,7 @@ dma-controller@1fe00c40 { }; uart0: serial@1fe20000 { - compatible = "ns16550a"; + compatible = "loongson,ls2k1000-uart", "loongson,ls2k0500-uart", "ns16550a"; reg = <0x0 0x1fe20000 0x0 0x10>; clock-frequency = <125000000>; interrupt-parent = <&liointc0>; diff --git a/arch/loongarch/boot/dts/loongson-2k2000.dtsi b/arch/loongarch/boot/dts/loongson-2k2000.dtsi index 00cc485b753b..6c77b86ee06c 100644 --- a/arch/loongarch/boot/dts/loongson-2k2000.dtsi +++ b/arch/loongarch/boot/dts/loongson-2k2000.dtsi @@ -250,7 +250,7 @@ i2c@1fe00130 { }; uart0: serial@1fe001e0 { - compatible = "ns16550a"; + compatible = "loongson,ls2k2000-uart", "loongson,ls2k1500-uart", "ns16550a"; reg = <0x0 0x1fe001e0 0x0 0x10>; clock-frequency = <100000000>; interrupt-parent = <&liointc>; -- 2.47.3 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v4 3/3] LoongArch: dts: Add uart new compatible string 2025-09-09 12:11 ` [PATCH v4 3/3] LoongArch: dts: Add uart new compatible string Binbin Zhou @ 2025-09-10 8:27 ` Krzysztof Kozlowski 2025-09-11 7:55 ` Binbin Zhou 0 siblings, 1 reply; 13+ messages in thread From: Krzysztof Kozlowski @ 2025-09-10 8:27 UTC (permalink / raw) To: Binbin Zhou Cc: Binbin Zhou, Huacai Chen, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Greg Kroah-Hartman, Jiri Slaby, Haowei Zheng, Huacai Chen, Xuerui Wang, loongarch, devicetree, linux-serial On Tue, Sep 09, 2025 at 08:11:20PM +0800, Binbin Zhou wrote: > Add loongson,ls2k*-uart compatible string on uarts. > > Co-developed-by: Haowei Zheng <zhenghaowei@loongson.cn> > Signed-off-by: Haowei Zheng <zhenghaowei@loongson.cn> > Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn> > --- > arch/loongarch/boot/dts/loongson-2k0500.dtsi | 2 +- > arch/loongarch/boot/dts/loongson-2k1000.dtsi | 2 +- > arch/loongarch/boot/dts/loongson-2k2000.dtsi | 2 +- > 3 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/arch/loongarch/boot/dts/loongson-2k0500.dtsi b/arch/loongarch/boot/dts/loongson-2k0500.dtsi > index 588ebc3bded4..357de4ca7555 100644 > --- a/arch/loongarch/boot/dts/loongson-2k0500.dtsi > +++ b/arch/loongarch/boot/dts/loongson-2k0500.dtsi > @@ -380,7 +380,7 @@ tsensor: thermal-sensor@1fe11500 { > }; > > uart0: serial@1ff40800 { > - compatible = "ns16550a"; > + compatible = "loongson,ls2k0500-uart", "ns16550a"; You clearly never bothered to actually test this against own code. NAK Best regards, Krzysztof ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v4 3/3] LoongArch: dts: Add uart new compatible string 2025-09-10 8:27 ` Krzysztof Kozlowski @ 2025-09-11 7:55 ` Binbin Zhou 2025-09-11 9:00 ` Krzysztof Kozlowski 0 siblings, 1 reply; 13+ messages in thread From: Binbin Zhou @ 2025-09-11 7:55 UTC (permalink / raw) To: Krzysztof Kozlowski Cc: Binbin Zhou, Huacai Chen, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Greg Kroah-Hartman, Jiri Slaby, Haowei Zheng, Huacai Chen, Xuerui Wang, loongarch, devicetree, linux-serial Hi Krzysztof: Thanks for your reply. On Wed, Sep 10, 2025 at 4:27 PM Krzysztof Kozlowski <krzk@kernel.org> wrote: > > On Tue, Sep 09, 2025 at 08:11:20PM +0800, Binbin Zhou wrote: > > Add loongson,ls2k*-uart compatible string on uarts. > > > > Co-developed-by: Haowei Zheng <zhenghaowei@loongson.cn> > > Signed-off-by: Haowei Zheng <zhenghaowei@loongson.cn> > > Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn> > > --- > > arch/loongarch/boot/dts/loongson-2k0500.dtsi | 2 +- > > arch/loongarch/boot/dts/loongson-2k1000.dtsi | 2 +- > > arch/loongarch/boot/dts/loongson-2k2000.dtsi | 2 +- > > 3 files changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/arch/loongarch/boot/dts/loongson-2k0500.dtsi b/arch/loongarch/boot/dts/loongson-2k0500.dtsi > > index 588ebc3bded4..357de4ca7555 100644 > > --- a/arch/loongarch/boot/dts/loongson-2k0500.dtsi > > +++ b/arch/loongarch/boot/dts/loongson-2k0500.dtsi > > @@ -380,7 +380,7 @@ tsensor: thermal-sensor@1fe11500 { > > }; > > > > uart0: serial@1ff40800 { > > - compatible = "ns16550a"; > > + compatible = "loongson,ls2k0500-uart", "ns16550a"; > > You clearly never bothered to actually test this against own code. Sorry, perhaps I should have included more detailed descriptions in the binding file. As per Chapter 15 of the Loongson-3A5000 manual[1], the Loongson UART registers and functionality are compatible with the NS16550A. However, generic 16550A drivers cannot support full serial port capabilities, such as hardware flow control. Based on your feedback in the V3 patchset[2], I attempted to use compatible fallbacks to avoid API breakage. These fallbacks match according to the Makefile's compilation order[3]. Therefore, if 8250_loongson exists, it will prioritize matching ls2k_* compatible; otherwise, it will fallback to ns16550a. [1]: https://loongson.github.io/LoongArch-Documentation/Loongson-3A5000-usermanual-EN.pdf [2]: https://lore.kernel.org/all/51f564ea-9507-40b4-a943-23bdd330e6d6@kernel.org/ [3]: https://elixir.bootlin.com/linux/v6.16/source/drivers/tty/serial/8250/Makefile > > NAK > > Best regards, > Krzysztof > -- Thanks. Binbin ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v4 3/3] LoongArch: dts: Add uart new compatible string 2025-09-11 7:55 ` Binbin Zhou @ 2025-09-11 9:00 ` Krzysztof Kozlowski 2025-09-12 6:22 ` Binbin Zhou 0 siblings, 1 reply; 13+ messages in thread From: Krzysztof Kozlowski @ 2025-09-11 9:00 UTC (permalink / raw) To: Binbin Zhou Cc: Binbin Zhou, Huacai Chen, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Greg Kroah-Hartman, Jiri Slaby, Haowei Zheng, Huacai Chen, Xuerui Wang, loongarch, devicetree, linux-serial On 11/09/2025 09:55, Binbin Zhou wrote: > Hi Krzysztof: > > Thanks for your reply. > > On Wed, Sep 10, 2025 at 4:27 PM Krzysztof Kozlowski <krzk@kernel.org> wrote: >> >> On Tue, Sep 09, 2025 at 08:11:20PM +0800, Binbin Zhou wrote: >>> Add loongson,ls2k*-uart compatible string on uarts. >>> >>> Co-developed-by: Haowei Zheng <zhenghaowei@loongson.cn> >>> Signed-off-by: Haowei Zheng <zhenghaowei@loongson.cn> >>> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn> >>> --- >>> arch/loongarch/boot/dts/loongson-2k0500.dtsi | 2 +- >>> arch/loongarch/boot/dts/loongson-2k1000.dtsi | 2 +- >>> arch/loongarch/boot/dts/loongson-2k2000.dtsi | 2 +- >>> 3 files changed, 3 insertions(+), 3 deletions(-) >>> >>> diff --git a/arch/loongarch/boot/dts/loongson-2k0500.dtsi b/arch/loongarch/boot/dts/loongson-2k0500.dtsi >>> index 588ebc3bded4..357de4ca7555 100644 >>> --- a/arch/loongarch/boot/dts/loongson-2k0500.dtsi >>> +++ b/arch/loongarch/boot/dts/loongson-2k0500.dtsi >>> @@ -380,7 +380,7 @@ tsensor: thermal-sensor@1fe11500 { >>> }; >>> >>> uart0: serial@1ff40800 { >>> - compatible = "ns16550a"; >>> + compatible = "loongson,ls2k0500-uart", "ns16550a"; >> >> You clearly never bothered to actually test this against own code. > > Sorry, perhaps I should have included more detailed descriptions in > the binding file. > > As per Chapter 15 of the Loongson-3A5000 manual[1], the Loongson UART > registers and functionality are compatible with the NS16550A. However, > generic 16550A drivers cannot support full serial port capabilities, > such as hardware flow control. > > Based on your feedback in the V3 patchset[2], I attempted to use > compatible fallbacks to avoid API breakage. > > These fallbacks match according to the Makefile's compilation DT bindings and fallbacks in DTS cannot match Makefile. You are mixing concepts. I said, this was not tested. I am 100% sure. Instead of replying with irrelevant build related stuff, please come with actual arguments, e.g. output (on some pastebin.com) of entire dtbs_check proving no new warnings are there. But even without warnings, I see with my own eyes that DTS is just wrong. Or bindings. Best regards, Krzysztof ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v4 3/3] LoongArch: dts: Add uart new compatible string 2025-09-11 9:00 ` Krzysztof Kozlowski @ 2025-09-12 6:22 ` Binbin Zhou 0 siblings, 0 replies; 13+ messages in thread From: Binbin Zhou @ 2025-09-12 6:22 UTC (permalink / raw) To: Krzysztof Kozlowski Cc: Binbin Zhou, Huacai Chen, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Greg Kroah-Hartman, Jiri Slaby, Haowei Zheng, Huacai Chen, Xuerui Wang, loongarch, devicetree, linux-serial Hi Krzysztof: On Thu, Sep 11, 2025 at 5:00 PM Krzysztof Kozlowski <krzk@kernel.org> wrote: > > On 11/09/2025 09:55, Binbin Zhou wrote: > > Hi Krzysztof: > > > > Thanks for your reply. > > > > On Wed, Sep 10, 2025 at 4:27 PM Krzysztof Kozlowski <krzk@kernel.org> wrote: > >> > >> On Tue, Sep 09, 2025 at 08:11:20PM +0800, Binbin Zhou wrote: > >>> Add loongson,ls2k*-uart compatible string on uarts. > >>> > >>> Co-developed-by: Haowei Zheng <zhenghaowei@loongson.cn> > >>> Signed-off-by: Haowei Zheng <zhenghaowei@loongson.cn> > >>> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn> > >>> --- > >>> arch/loongarch/boot/dts/loongson-2k0500.dtsi | 2 +- > >>> arch/loongarch/boot/dts/loongson-2k1000.dtsi | 2 +- > >>> arch/loongarch/boot/dts/loongson-2k2000.dtsi | 2 +- > >>> 3 files changed, 3 insertions(+), 3 deletions(-) > >>> > >>> diff --git a/arch/loongarch/boot/dts/loongson-2k0500.dtsi b/arch/loongarch/boot/dts/loongson-2k0500.dtsi > >>> index 588ebc3bded4..357de4ca7555 100644 > >>> --- a/arch/loongarch/boot/dts/loongson-2k0500.dtsi > >>> +++ b/arch/loongarch/boot/dts/loongson-2k0500.dtsi > >>> @@ -380,7 +380,7 @@ tsensor: thermal-sensor@1fe11500 { > >>> }; > >>> > >>> uart0: serial@1ff40800 { > >>> - compatible = "ns16550a"; > >>> + compatible = "loongson,ls2k0500-uart", "ns16550a"; > >> > >> You clearly never bothered to actually test this against own code. > > > > Sorry, perhaps I should have included more detailed descriptions in > > the binding file. > > > > As per Chapter 15 of the Loongson-3A5000 manual[1], the Loongson UART > > registers and functionality are compatible with the NS16550A. However, > > generic 16550A drivers cannot support full serial port capabilities, > > such as hardware flow control. > > > > Based on your feedback in the V3 patchset[2], I attempted to use > > compatible fallbacks to avoid API breakage. > > > > These fallbacks match according to the Makefile's compilation > > DT bindings and fallbacks in DTS cannot match Makefile. You are mixing > concepts. > > I said, this was not tested. I am 100% sure. Instead of replying with > irrelevant build related stuff, please come with actual arguments, e.g. > output (on some pastebin.com) of entire dtbs_check proving no new > warnings are there. > > But even without warnings, I see with my own eyes that DTS is just > wrong. Or bindings. Please disregard my previous email. I apologize for wasting your time; this was indeed my mistake. I'm attempting to correct the issue by changing the binding file. > > Best regards, > Krzysztof -- Thanks. Binbin ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2025-09-12 6:23 UTC | newest] Thread overview: 13+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-09-09 12:11 [PATCH v4 0/3] uart: Introduce uart driver for the Loongson family Binbin Zhou 2025-09-09 12:11 ` [PATCH v4 1/3] dt-bindings: serial: Add Loongson UART controller Binbin Zhou 2025-09-10 8:26 ` Krzysztof Kozlowski 2025-09-10 8:28 ` Krzysztof Kozlowski 2025-09-12 6:06 ` Binbin Zhou 2025-09-09 12:11 ` [PATCH v4 2/3] serial: 8250: Add Loongson uart driver support Binbin Zhou 2025-09-10 11:05 ` kernel test robot 2025-09-10 11:26 ` kernel test robot 2025-09-09 12:11 ` [PATCH v4 3/3] LoongArch: dts: Add uart new compatible string Binbin Zhou 2025-09-10 8:27 ` Krzysztof Kozlowski 2025-09-11 7:55 ` Binbin Zhou 2025-09-11 9:00 ` Krzysztof Kozlowski 2025-09-12 6:22 ` Binbin Zhou
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox