uart: Introduce uart driver for the Loongson family
Subsystems (3)
v4 cover uart: Introduce uart driver for the Loongson family
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/[email protected]/
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
Signature · 1 line
2.47.3
PATCH v4 1/3 dt-bindings: serial: Add Loongson UART controller
Add Loongson UART controller binding with DT schema format using json-schema.
--- .../serial/loongson,ls2k0500-uart.yaml | 60 +++++++++++++++++++ MAINTAINERS | 7 +++ 2 files changed, 67 insertions(+) create mode 100644 Documentation/devicetree/bindings/serial/loongson,ls2k0500-uart.yaml
Documentation/devicetree/bindings/serial/loongson,ls2k0500-uart.yaml new file +60 -0
@@ -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 <[email protected]> + - Binbin Zhou <[email protected]> + +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>; + };
MAINTAINERS +7 -0
@@ -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 <[email protected]> +M: Binbin Zhou <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/devicetree/bindings/serial/loongson,uart.yaml + LOONGSON-2 SOC SERIES CLOCK DRIVER M: Yinbo Zhu <[email protected]> L: [email protected]
Signature · 1 line
2.47.3
Re: [PATCH v4 1/3] dt-bindings: serial: Add Loongson UART controller
Documentation/devicetree/bindings/serial/loongson,ls2k0500-uart.yaml line 39
Quoted 7 lines · Binbin Zhou
Documentation/devicetree/bindings/serial/loongson,ls2k0500-uart.yaml new file +7
-0+ 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
Re: [PATCH v4 1/3] dt-bindings: serial: Add Loongson UART controller
In reply to Binbin ZhouQuoted 2 lines · Binbin Zhou
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
Re: [PATCH v4 1/3] dt-bindings: serial: Add Loongson UART controller
Hi Krzysztof:
Thanks for your reply.
Quoted 10 lines · Krzysztof Kozlowski
Quoted 2 lines · Binbin Zhou
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:
(quoted diff) +0 -0
b/Documentation/devicetree/bindings/serial/8250.yaml index e46bee8d25bf..abd41e996e68 100644
Documentation/devicetree/bindings/serial/8250.yaml +14 -0
@@ -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
Quoted 4 lines
Best regards,
Krzysztof
--
Thanks.
Binbin
PATCH v4 2/3 serial: 8250: Add Loongson uart driver support
In reply to Binbin ZhouAdd 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.
--- 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
MAINTAINERS +1 -0
@@ -14359,6 +14359,7 @@ M: Binbin Zhou <[email protected]> L: [email protected] 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 <[email protected]>
drivers/tty/serial/8250/8250_loongson.c new file +200 -0
200 lines not on this page · raw message
drivers/tty/serial/8250/8250_port.c +8 -0
@@ -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 */
drivers/tty/serial/8250/Kconfig +10 -0
@@ -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)
drivers/tty/serial/8250/Makefile +1 -0
@@ -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
include/uapi/linux/serial_core.h +1 -0
@@ -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
Signature · 1 line
2.47.3
kernel test robot
build botRe: [PATCH v4 2/3] serial: 8250: Add Loongson uart driver support
kernel test robot noticed the following build errors:
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/[email protected]/config) compiler: m68k-linux-gcc (GCC) 15.1.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250910/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
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
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [PATCH v4 2/3] serial: 8250: Add Loongson uart driver support
In reply to Binbin Zhoukernel test robot noticed the following build warnings:
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/[email protected]/config) compiler: m68k-linux-gcc (GCC) 15.1.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250910/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
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
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
PATCH v4 3/3 LoongArch: dts: Add uart new compatible string
In reply to Binbin ZhouAdd loongson,ls2k*-uart compatible string on uarts.
--- 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(-)
arch/loongarch/boot/dts/loongson-2k0500.dtsi +1 -1
@@ -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>;
arch/loongarch/boot/dts/loongson-2k1000.dtsi +1 -1
@@ -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>;
arch/loongarch/boot/dts/loongson-2k2000.dtsi +1 -1
@@ -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>;
Signature · 1 line
2.47.3
Re: [PATCH v4 3/3] LoongArch: dts: Add uart new compatible string
Quoted 16 lines · Binbin Zhou
Add loongson,ls2k*-uart compatible string on uarts.
Co-developed-by Haowei Zheng <[email protected]>Signed-off-by Haowei Zheng <[email protected]>Signed-off-by Binbin Zhou <[email protected]>--- 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(-)arch/loongarch/boot/dts/loongson-2k0500.dtsi +0
-0
arch/loongarch/boot/dts/loongson-2k0500.dtsi tsensor: thermal-sensor@1fe11500 { · line 383
Quoted 5 lines
arch/loongarch/boot/dts/loongson-2k0500.dtsi +1
-1@@ -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
Re: [PATCH v4 3/3] LoongArch: dts: Add uart new compatible string
Hi Krzysztof:
Thanks for your reply.
Quoted 20 lines · Krzysztof Kozlowski
Quoted 18 lines · Binbin Zhou
Add loongson,ls2k*-uart compatible string on uarts.
Co-developed-by Haowei Zheng <[email protected]>Signed-off-by Haowei Zheng <[email protected]>Signed-off-by Binbin Zhou <[email protected]>--- 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(-)arch/loongarch/boot/dts/loongson-2k0500.dtsi +0
-0@@ -380,7 +380,7 @@ tsensor: thermal-sensor@1fe11500 { };
Quoted 5 lines
arch/loongarch/boot/dts/loongson-2k0500.dtsi tsensor: thermal-sensor@1fe11500 { · line 383
Quoted 3 lines
arch/loongarch/boot/dts/loongson-2k0500.dtsi +1
-1uart0: 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/[email protected]/
[3]: https://elixir.bootlin.com/linux/v6.16/source/drivers/tty/serial/8250/Makefile
Quoted 6 lines
NAK
Best regards,
Krzysztof
Signature · 2 lines
Thanks. Binbin
Re: [PATCH v4 3/3] LoongArch: dts: Add uart new compatible string
Quoted 39 lines · Binbin Zhou
Hi Krzysztof:
Thanks for your reply.
Quoted 20 lines · Krzysztof Kozlowski
Quoted 18 lines · Binbin Zhou
Add loongson,ls2k*-uart compatible string on uarts.
Co-developed-by Haowei Zheng <[email protected]>Signed-off-by Haowei Zheng <[email protected]>Signed-off-by Binbin Zhou <[email protected]>--- 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(-)arch/loongarch/boot/dts/loongson-2k0500.dtsi +0
-0@@ -380,7 +380,7 @@ tsensor: thermal-sensor@1fe11500 { };Quoted 5 lines
arch/loongarch/boot/dts/loongson-2k0500.dtsi tsensor: thermal-sensor@1fe11500 { · line 383
Quoted 3 lines
arch/loongarch/boot/dts/loongson-2k0500.dtsi +1
-1uart0: 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.
Quoted 4 lines
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
Re: [PATCH v4 3/3] LoongArch: dts: Add uart new compatible string
Hi Krzysztof:
Quoted 49 lines · Krzysztof Kozlowski
Quoted 39 lines · Binbin Zhou
Hi Krzysztof:
Thanks for your reply.
Quoted 20 lines · Krzysztof Kozlowski
Quoted 18 lines · Binbin Zhou
Add loongson,ls2k*-uart compatible string on uarts.
Co-developed-by Haowei Zheng <[email protected]>Signed-off-by Haowei Zheng <[email protected]>Signed-off-by Binbin Zhou <[email protected]>--- 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(-)arch/loongarch/boot/dts/loongson-2k0500.dtsi +0
-0@@ -380,7 +380,7 @@ tsensor: thermal-sensor@1fe11500 { };Quoted 5 lines
arch/loongarch/boot/dts/loongson-2k0500.dtsi tsensor: thermal-sensor@1fe11500 { · line 383
Quoted 3 lines
arch/loongarch/boot/dts/loongson-2k0500.dtsi +1
-1uart0: 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.
Quoted 4 lines
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.
Quoted 7 lines
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_checkproving 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.
Quoted 3 lines
Best regards,
Krzysztof
--
Thanks.
Binbin