Re: [PATCH v13 4/5] uart: pl011: Improve LCRH register access decision

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

 



Hi Jun,

On 31/07/15 08:49, Jun Nie wrote:
> Improve LCRH register access decision as ARM PL011 lcrh
> register serve as both TX and RX, while other SOC may
> implement TX and RX function with separated register.
> 
> Signed-off-by: Jun Nie <jun.nie@xxxxxxxxxx>
> ---
>  drivers/tty/serial/amba-pl011.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
> index e1f3bd5..017443d 100644
> --- a/drivers/tty/serial/amba-pl011.c
> +++ b/drivers/tty/serial/amba-pl011.c
> @@ -249,6 +249,11 @@ struct uart_amba_port {
>  #endif
>  };
>  
> +static bool is_implemented(struct uart_amba_port *uap, unsigned int reg)
> +{
> +	return uap->reg_lut[reg] != (u16)~0;
> +}
> +

Just a nit: is_implemented sounds a bit too generic for me, could this
be more specific like reg_is_implemented or the like?

Other than that the patch looks good to me.

Cheers,
Andre.

>  static unsigned int pl011_readw(struct uart_amba_port *uap, int index)
>  {
>  	WARN_ON(index > REG_NR);
> @@ -1649,7 +1654,7 @@ static int pl011_hwinit(struct uart_port *port)
>  static void pl011_write_lcr_h(struct uart_amba_port *uap, unsigned int lcr_h)
>  {
>  	pl011_writew(uap, lcr_h, uap->lcrh_rx);
> -	if (uap->lcrh_rx != uap->lcrh_tx) {
> +	if (is_implemented(uap, REG_ST_LCRH_RX)) {
>  		int i;
>  		/*
>  		 * Wait 10 PCLKs before writing LCRH_TX register,
> @@ -1784,7 +1789,7 @@ static void pl011_disable_uart(struct uart_amba_port *uap)
>  	 * disable break condition and fifos
>  	 */
>  	pl011_shutdown_channel(uap, uap->lcrh_rx);
> -	if (uap->lcrh_rx != uap->lcrh_tx)
> +	if (is_implemented(uap, REG_ST_LCRH_RX))
>  		pl011_shutdown_channel(uap, uap->lcrh_tx);
>  }
>  
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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