diff mbox series

[v2] serial: 8250_pnp: Support configurable reg shift property

Message ID PSAPR06MB4952ED7EAD4410B25258F42FC9212@PSAPR06MB4952.apcprd06.prod.outlook.com
State New
Headers show
Series [v2] serial: 8250_pnp: Support configurable reg shift property | expand

Commit Message

Guanbing Huang March 6, 2024, 11:42 a.m. UTC
From: Guanbing Huang <albanhuang@tencent.com>

The 16550a serial port based on the ACPI table requires obtaining the
reg-shift attribute. In the ACPI scenario, If the reg-shift property
is not configured like in DTS, the 16550a serial driver cannot read or
write controller registers properly during initialization.

Signed-off-by: Guanbing Huang <albanhuang@tencent.com>
Signed-off-by: Bing Fan <tombinfan@tencent.com>
Signed-off-by: Linheng Du <dylanlhdu@tencent.com>
---
v2: change the names after "Signed off by" to the real names

 drivers/tty/serial/8250/8250_pnp.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Andy Shevchenko March 8, 2024, 4:15 p.m. UTC | #1
On Wed, Mar 06, 2024 at 07:42:27PM +0800, Guanbing Huang wrote:
> From: Guanbing Huang <albanhuang@tencent.com>

Thanks for your contribution!
My comments below.

...


First of all, always start a new email thread when sending a new version of the
patch (i.o.w. no In-Reply-to email header).

> The 16550a serial port based on the ACPI table requires obtaining the
> reg-shift attribute. In the ACPI scenario, If the reg-shift property
> is not configured like in DTS, the 16550a serial driver cannot read or
> write controller registers properly during initialization.
> 
> Signed-off-by: Guanbing Huang <albanhuang@tencent.com>


> Signed-off-by: Bing Fan <tombinfan@tencent.com>
> Signed-off-by: Linheng Du <dylanlhdu@tencent.com>

This chain, as described in Submitting Patches documentation [1], should go
accordingly.

...

> @@ -473,6 +473,7 @@ serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
>  		uart.port.flags |= UPF_SHARE_IRQ;
>  	uart.port.uartclk = 1843200;
>  	device_property_read_u32(&dev->dev, "clock-frequency", &uart.port.uartclk);
> +	device_property_read_u8(&dev->dev, "reg-shift", &uart.port.regshift);
>  	uart.port.dev = &dev->dev;

Instead, it may make sense to switch to use uart_read_port_properties() which
has been recently introduced and dozen of drivers converted.

Ex. e6a46d073e11 ("serial: 8250_dw: Switch to use uart_read_port_properties()")

Yes, it assumes that you always need to base your changes on the latest
available changes in the certain subsystem (here it is tty-next branch
in Greg's tty tree, see git.kernel.org for the details).

>  	line = serial8250_register_8250_port(&uart);

[1]: https://www.kernel.org/doc/html/latest/process/submitting-patches.html
diff mbox series

Patch

diff --git a/drivers/tty/serial/8250/8250_pnp.c b/drivers/tty/serial/8250/8250_pnp.c
index 1974bbadc975..25b4e41e9745 100644
--- a/drivers/tty/serial/8250/8250_pnp.c
+++ b/drivers/tty/serial/8250/8250_pnp.c
@@ -473,6 +473,7 @@  serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
 		uart.port.flags |= UPF_SHARE_IRQ;
 	uart.port.uartclk = 1843200;
 	device_property_read_u32(&dev->dev, "clock-frequency", &uart.port.uartclk);
+	device_property_read_u8(&dev->dev, "reg-shift", &uart.port.regshift);
 	uart.port.dev = &dev->dev;
 
 	line = serial8250_register_8250_port(&uart);