Skip to content

Commit

Permalink
tty: serial: qcom_geni_serial: Use iowrite32_rep to write to FIFO
Browse files Browse the repository at this point in the history
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: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Karthikeyan Ramasubramanian authored and Greg Kroah-Hartman committed May 14, 2018
1 parent 7fb5b88 commit 69736b5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/tty/serial/qcom_geni_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 69736b5

Please sign in to comment.