Re: [PATCH] serial: sc16is7xx, adjust register address to regmap_raw_read/write to enable secondary UART

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

 



On Wed, 22 Apr 2015 14:27:26 +0200, bo.svangard@xxxxxxxxxxxxxx wrote:
> From: Bo Svangård <bo.svangard@xxxxxxxxxxxxxx>
> 
> Calls to regmap_raw_read/write needed register rewrite in a
> similar way as calls to regmap_read/write already had.
> This enables reading/writing the serial datastream to the device.
> 
> Signed-off-by: Bo Svangård <bo.svangard@xxxxxxxxxxxxxx>
> ---
> ---
>  drivers/tty/serial/sc16is7xx.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
> index 468354e..a4fd862 100644
> --- a/drivers/tty/serial/sc16is7xx.c
> +++ b/drivers/tty/serial/sc16is7xx.c
> @@ -495,8 +495,9 @@ static void sc16is7xx_handle_rx(struct uart_port *port, unsigned int rxlen,
>  			bytes_read = 1;
>  		} else {
>  			regcache_cache_bypass(s->regmap, true);
> -			regmap_raw_read(s->regmap, SC16IS7XX_RHR_REG,
> -					s->buf, rxlen);
> +			regmap_raw_read(s->regmap,
> +					(SC16IS7XX_RHR_REG << SC16IS7XX_REG_SHIFT) | port->line,
> +					 s->buf, rxlen);
>  			regcache_cache_bypass(s->regmap, false);
>  			bytes_read = rxlen;
>  		}
> @@ -578,7 +579,9 @@ static void sc16is7xx_handle_tx(struct uart_port *port)
>  			xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
>  		}
>  		regcache_cache_bypass(s->regmap, true);
> -		regmap_raw_write(s->regmap, SC16IS7XX_THR_REG, s->buf, to_send);
> +		regmap_raw_write(s->regmap,
> +				 (SC16IS7XX_THR_REG << SC16IS7XX_REG_SHIFT) | port->line,
> +				 s->buf, to_send);
>  		regcache_cache_bypass(s->regmap, false);
>  	}
>  

Seems to me it would be cleaner if you provided wrapper functions
similar sc16is7xx_port_(read|write|update) for FIFO access.  Your
calls already take 3 lines and you go over 80 chars.
--
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