Re: [PATCH] serial: 8250: 8250_omap: Support native RS485

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 27 Sep 2022, Lukas Wunner wrote:

> Recent TI Sitara SoCs such as AM64/AM65 have gained the ability to
> automatically assert RTS when data is transmitted, obviating the need
> to emulate this functionality in software.
> 
> The feature is controlled through new DIR_EN and DIR_POL bits in the
> Mode Definition Register 3.  For details see page 8783 and 8890 of the
> AM65 TRM:  https://www.ti.com/lit/ug/spruid7e/spruid7e.pdf
> 
> Tested-by: Matthias Schiffer <matthias.schiffer@xxxxxxxxxxxxxxx>
> Signed-off-by: Lukas Wunner <lukas@xxxxxxxxx>
> Cc: Jan Kiszka <jan.kiszka@xxxxxxxxxxx>
> Cc: Su Bao Cheng <baocheng.su@xxxxxxxxxxx>
> Cc: Vignesh Raghavendra <vigneshr@xxxxxx>
> Cc: Nishanth Menon <nm@xxxxxx>

> @@ -1335,10 +1387,7 @@ static int omap8250_probe(struct platform_device *pdev)
>  	up.port.shutdown = omap_8250_shutdown;
>  	up.port.throttle = omap_8250_throttle;
>  	up.port.unthrottle = omap_8250_unthrottle;
> -	up.port.rs485_config = serial8250_em485_config;
>  	up.port.rs485_supported = serial8250_em485_supported;
> -	up.rs485_start_tx = serial8250_em485_start_tx;
> -	up.rs485_stop_tx = serial8250_em485_stop_tx;
>  	up.port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_8250_CONSOLE);
>  
>  	ret = of_alias_get_id(np, "serial");
> @@ -1377,6 +1426,14 @@ static int omap8250_probe(struct platform_device *pdev)
>  			 DEFAULT_CLK_SPEED);
>  	}
>  
> +	if (priv->habit & UART_HAS_NATIVE_RS485) {
> +		up.port.rs485_config = omap8250_rs485_config;
> +	} else {
> +		up.port.rs485_config = serial8250_em485_config;
> +		up.rs485_start_tx = serial8250_em485_start_tx;
> +		up.rs485_stop_tx = serial8250_em485_stop_tx;
> +	}

I guess .rs485_supported shouldn't be equal in both cases?

Somehow I feel this hw rs485 + em485 fallback setup might become a common 
pattern so adding some helper for it might be warranted (dwlib already has 
a similar if construct).

-- 
 i.




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux