diff mbox

[v2,6/8] tty: serial: qcom_geni_serial: Use iowrite32_rep to write to FIFO

Message ID 1523302721-19439-7-git-send-email-kramasub@codeaurora.org (mailing list archive)
State Not Applicable, archived
Delegated to: Andy Gross
Headers show

Commit Message

Karthikeyan Ramasubramanian April 9, 2018, 7:38 p.m. UTC
Use iowrite32_rep to write to the hardware FIFO so that the code does
not have to worry about the system endianness.

Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
---
 drivers/tty/serial/qcom_geni_serial.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Matthias Kaehlcke April 16, 2018, 9:12 p.m. UTC | #1
On Mon, Apr 09, 2018 at 01:38:39PM -0600, Karthikeyan Ramasubramanian wrote:
> Use iowrite32_rep to write to the hardware FIFO so that the code does
> not have to worry about the system endianness.
> 
> Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
> ---
>  drivers/tty/serial/qcom_geni_serial.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
> index 3274071..801e6eb 100644
> --- a/drivers/tty/serial/qcom_geni_serial.c
> +++ b/drivers/tty/serial/qcom_geni_serial.c
> @@ -600,14 +600,15 @@ static void qcom_geni_serial_handle_tx(struct uart_port *uport)
>  	remaining = chunk;
>  	for (i = 0; i < chunk; ) {
>  		unsigned int tx_bytes;
> -		unsigned int buf = 0;
> +		u8 buf[sizeof(u32)];
>  		int c;
>  
> +		memset(buf, 0, ARRAY_SIZE(buf));
>  		tx_bytes = min_t(size_t, remaining, port->tx_bytes_pw);
>  		for (c = 0; c < tx_bytes ; c++)
> -			buf |= (xmit->buf[tail + c] << (c * BITS_PER_BYTE));
> +			buf[c] = xmit->buf[tail + c];
>  
> -		writel_relaxed(buf, uport->membase + SE_GENI_TX_FIFOn);
> +		iowrite32_rep(uport->membase + SE_GENI_TX_FIFOn, buf, 1);
>  
>  		i += tx_bytes;
>  		tail = (tail + tx_bytes) & (UART_XMIT_SIZE - 1);

Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Stephen Boyd April 17, 2018, 6:07 a.m. UTC | #2
Quoting Karthikeyan Ramasubramanian (2018-04-09 12:38:39)
> Use iowrite32_rep to write to the hardware FIFO so that the code does
> not have to worry about the system endianness.
> 
> Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
> ---

Reviewed-by: Stephen Boyd <swboyd@chromium.org>

--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
index 3274071..801e6eb 100644
--- a/drivers/tty/serial/qcom_geni_serial.c
+++ b/drivers/tty/serial/qcom_geni_serial.c
@@ -600,14 +600,15 @@  static void qcom_geni_serial_handle_tx(struct uart_port *uport)
 	remaining = chunk;
 	for (i = 0; i < chunk; ) {
 		unsigned int tx_bytes;
-		unsigned int buf = 0;
+		u8 buf[sizeof(u32)];
 		int c;
 
+		memset(buf, 0, ARRAY_SIZE(buf));
 		tx_bytes = min_t(size_t, remaining, port->tx_bytes_pw);
 		for (c = 0; c < tx_bytes ; c++)
-			buf |= (xmit->buf[tail + c] << (c * BITS_PER_BYTE));
+			buf[c] = xmit->buf[tail + c];
 
-		writel_relaxed(buf, uport->membase + SE_GENI_TX_FIFOn);
+		iowrite32_rep(uport->membase + SE_GENI_TX_FIFOn, buf, 1);
 
 		i += tx_bytes;
 		tail = (tail + tx_bytes) & (UART_XMIT_SIZE - 1);