mux.c (14e77332e74603efab8347c89d3cda447c3b97c9) mux.c (d11cc8c3c4b65e00e01f20a920c5fa412415204a)
1// SPDX-License-Identifier: GPL-2.0+
2/*
3** mux.c:
4** serial driver for the Mux console found in some PA-RISC servers.
5**
6** (c) Copyright 2002 Ryan Bradetich
7** (c) Copyright 2002 Hewlett-Packard Company
8**

--- 157 unchanged lines hidden (view full) ---

166 * @break_state: Raise/Lower the break signal.
167 *
168 * The Serial Mux does not support this function.
169 */
170static void mux_break_ctl(struct uart_port *port, int break_state)
171{
172}
173
1// SPDX-License-Identifier: GPL-2.0+
2/*
3** mux.c:
4** serial driver for the Mux console found in some PA-RISC servers.
5**
6** (c) Copyright 2002 Ryan Bradetich
7** (c) Copyright 2002 Hewlett-Packard Company
8**

--- 157 unchanged lines hidden (view full) ---

166 * @break_state: Raise/Lower the break signal.
167 *
168 * The Serial Mux does not support this function.
169 */
170static void mux_break_ctl(struct uart_port *port, int break_state)
171{
172}
173
174static void mux_tx_done(struct uart_port *port)
175{
176 /* FIXME js: really needs to wait? */
177 while (UART_GET_FIFO_CNT(port))
178 udelay(1);
179}
180
174/**
175 * mux_write - Write chars to the mux fifo.
176 * @port: Ptr to the uart_port.
177 *
178 * This function writes all the data from the uart buffer to
179 * the mux fifo.
180 */
181static void mux_write(struct uart_port *port)
182{
181/**
182 * mux_write - Write chars to the mux fifo.
183 * @port: Ptr to the uart_port.
184 *
185 * This function writes all the data from the uart buffer to
186 * the mux fifo.
187 */
188static void mux_write(struct uart_port *port)
189{
183 int count;
184 struct circ_buf *xmit = &port->state->xmit;
190 u8 ch;
185
191
186 if(port->x_char) {
187 UART_PUT_CHAR(port, port->x_char);
188 port->icount.tx++;
189 port->x_char = 0;
190 return;
191 }
192
193 if(uart_circ_empty(xmit) || uart_tx_stopped(port)) {
194 mux_stop_tx(port);
195 return;
196 }
197
198 count = (port->fifosize) - UART_GET_FIFO_CNT(port);
199 do {
200 UART_PUT_CHAR(port, xmit->buf[xmit->tail]);
201 xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
202 port->icount.tx++;
203 if(uart_circ_empty(xmit))
204 break;
205
206 } while(--count > 0);
207
208 while(UART_GET_FIFO_CNT(port))
209 udelay(1);
210
211 if(uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
212 uart_write_wakeup(port);
213
214 if (uart_circ_empty(xmit))
215 mux_stop_tx(port);
192 uart_port_tx_limited(port, ch,
193 port->fifosize - UART_GET_FIFO_CNT(port),
194 true,
195 UART_PUT_CHAR(port, ch),
196 mux_tx_done(port));
216}
217
218/**
219 * mux_read - Read chars from the mux fifo.
220 * @port: Ptr to the uart_port.
221 *
222 * This reads all available data from the mux's fifo and pushes
223 * the data to the tty layer.

--- 379 unchanged lines hidden ---
197}
198
199/**
200 * mux_read - Read chars from the mux fifo.
201 * @port: Ptr to the uart_port.
202 *
203 * This reads all available data from the mux's fifo and pushes
204 * the data to the tty layer.

--- 379 unchanged lines hidden ---