Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

serial: liteuart: move function definitions

Move definitions for liteuart_[stop|start]_tx(), liteuart_stop_rx(),
and liteuart_putchar() to a more convenient location in preparation
for adding IRQ support. This patch contains no functional changes.

Signed-off-by: Gabriel Somlo <gsomlo@gmail.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
Link: https://lore.kernel.org/r/20221123130500.1030189-12-gsomlo@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Gabriel Somlo and committed by
Greg Kroah-Hartman
7121d86e 5dcceabe

+49 -49
+49 -49
drivers/tty/serial/liteuart.c
··· 68 68 #endif 69 69 }; 70 70 71 - static void liteuart_rx_chars(struct uart_port *port) 72 - { 73 - unsigned char __iomem *membase = port->membase; 74 - u8 ch; 75 - 76 - while (!litex_read8(membase + OFF_RXEMPTY)) { 77 - ch = litex_read8(membase + OFF_RXTX); 78 - port->icount.rx++; 79 - 80 - /* necessary for RXEMPTY to refresh its value */ 81 - litex_write8(membase + OFF_EV_PENDING, EV_RX); 82 - 83 - /* no overflow bits in status */ 84 - if (!(uart_handle_sysrq_char(port, ch))) 85 - uart_insert_char(port, 1, 0, ch, TTY_NORMAL); 86 - } 87 - 88 - tty_flip_buffer_push(&port->state->port); 89 - } 90 - 91 - static void liteuart_timer(struct timer_list *t) 92 - { 93 - struct liteuart_port *uart = from_timer(uart, t, timer); 94 - struct uart_port *port = &uart->port; 95 - 96 - liteuart_rx_chars(port); 97 - 98 - mod_timer(&uart->timer, jiffies + uart_poll_timeout(port)); 99 - } 100 - 101 71 static void liteuart_putchar(struct uart_port *port, unsigned char ch) 102 72 { 103 73 while (litex_read8(port->membase + OFF_TXFULL)) 104 74 cpu_relax(); 105 75 106 76 litex_write8(port->membase + OFF_RXTX, ch); 107 - } 108 - 109 - static unsigned int liteuart_tx_empty(struct uart_port *port) 110 - { 111 - /* not really tx empty, just checking if tx is not full */ 112 - if (!litex_read8(port->membase + OFF_TXFULL)) 113 - return TIOCSER_TEMT; 114 - 115 - return 0; 116 - } 117 - 118 - static void liteuart_set_mctrl(struct uart_port *port, unsigned int mctrl) 119 - { 120 - /* modem control register is not present in LiteUART */ 121 - } 122 - 123 - static unsigned int liteuart_get_mctrl(struct uart_port *port) 124 - { 125 - return TIOCM_CTS | TIOCM_DSR | TIOCM_CAR; 126 77 } 127 78 128 79 static void liteuart_stop_tx(struct uart_port *port) ··· 107 156 108 157 /* just delete timer */ 109 158 del_timer(&uart->timer); 159 + } 160 + 161 + static void liteuart_rx_chars(struct uart_port *port) 162 + { 163 + unsigned char __iomem *membase = port->membase; 164 + u8 ch; 165 + 166 + while (!litex_read8(membase + OFF_RXEMPTY)) { 167 + ch = litex_read8(membase + OFF_RXTX); 168 + port->icount.rx++; 169 + 170 + /* necessary for RXEMPTY to refresh its value */ 171 + litex_write8(membase + OFF_EV_PENDING, EV_RX); 172 + 173 + /* no overflow bits in status */ 174 + if (!(uart_handle_sysrq_char(port, ch))) 175 + uart_insert_char(port, 1, 0, ch, TTY_NORMAL); 176 + } 177 + 178 + tty_flip_buffer_push(&port->state->port); 179 + } 180 + 181 + static void liteuart_timer(struct timer_list *t) 182 + { 183 + struct liteuart_port *uart = from_timer(uart, t, timer); 184 + struct uart_port *port = &uart->port; 185 + 186 + liteuart_rx_chars(port); 187 + 188 + mod_timer(&uart->timer, jiffies + uart_poll_timeout(port)); 189 + } 190 + 191 + static unsigned int liteuart_tx_empty(struct uart_port *port) 192 + { 193 + /* not really tx empty, just checking if tx is not full */ 194 + if (!litex_read8(port->membase + OFF_TXFULL)) 195 + return TIOCSER_TEMT; 196 + 197 + return 0; 198 + } 199 + 200 + static void liteuart_set_mctrl(struct uart_port *port, unsigned int mctrl) 201 + { 202 + /* modem control register is not present in LiteUART */ 203 + } 204 + 205 + static unsigned int liteuart_get_mctrl(struct uart_port *port) 206 + { 207 + return TIOCM_CTS | TIOCM_DSR | TIOCM_CAR; 110 208 } 111 209 112 210 static int liteuart_startup(struct uart_port *port)