[PATCH v2] tty: serial: samsung_tty: support more than 4 uart ports

Jiri Slaby jirislaby at kernel.org
Mon Jul 4 00:40:14 PDT 2022


On 29. 06. 22, 2:55, Chanho Park wrote:
> Regarding Exynos Auto v9 SoC, it supports uarts up to 12. However, the
> maximum number of the ports has been derived from
> CONFIG_SERIAL_SAMSUNG_UARTS and tightly coupled with the config for
> previous Samsung SoCs such as s3c24xx and s3c64xx. To overcome this
> limitation, this changes the usage of the definition to UART_NR which is
> widely used from other serial drivers. This also defines the value to 12
> only for ARM64 SoCs to not affect the change to previous arm32 SoCs.
> 
> Instead of enumerating all the ports as predefined arrays, this
> introduces s3c24xx_serial_init_port_default that is initializing the
> structure as the default value.
...
> --- a/drivers/tty/serial/samsung_tty.c
> +++ b/drivers/tty/serial/samsung_tty.c
...
> @@ -1810,67 +1816,27 @@ static const struct uart_ops apple_s5l_serial_ops = {
...
> +static struct s3c24xx_uart_port s3c24xx_serial_ports[UART_NR];
> +
> +static void s3c24xx_serial_init_port_default(int index) {

The opening brace should be on a separate line.

> +	struct uart_port *port = &s3c24xx_serial_ports[index].port;
> +
> +	spin_lock_init(&port->lock);
> +
> +	port->iotype = UPIO_MEM;
> +	port->uartclk = 0;
> +	port->fifosize = 16;
> +	port->ops = &s3c24xx_serial_ops;
> +	port->flags = UPF_BOOT_AUTOCONF;
> +	port->line = index;
> +}
>   
>   /* s3c24xx_serial_resetport
>    *
> @@ -2186,6 +2152,8 @@ static int s3c24xx_serial_probe(struct platform_device *pdev)
>   	}
>   	ourport = &s3c24xx_serial_ports[index];
>   
> +	s3c24xx_serial_init_port_default(index);

Perhaps pass &ourport->port to the function too -- you'd save the 
refetch there.

thanks,
-- 
js
suse labs



More information about the linux-arm-kernel mailing list