• Home
  • Raw
  • Download

Lines Matching +full:serial +full:- +full:mux

1 // SPDX-License-Identifier: GPL-2.0+
3 ** mux.c:
4 ** serial driver for the Mux console found in some PA-RISC servers.
7 ** (c) Copyright 2002 Hewlett-Packard Company
9 ** This Driver currently only supports the console (port 0) on the MUX.
11 ** functionality of the MUX.
18 #include <linux/serial.h>
26 #include <asm/parisc-device.h>
63 #define UART_PUT_CHAR(p, c) __raw_writel((c), (p)->membase + IO_DATA_REG_OFFSET)
64 #define UART_GET_FIFO_CNT(p) __raw_readl((p)->membase + IO_DCOUNT_REG_OFFSET)
67 * get_mux_port_count - Get the number of available ports on the Mux.
70 * This function is used to determine the number of ports the Mux
71 * supports. The IODC data reports the number of ports the Mux
72 * can support, but there are cases where not all the Mux ports
82 /* If this is the built-in Mux for the K-Class (Eole CAP/MUX), in get_mux_port_count()
86 if(dev->id.hversion == 0x15) in get_mux_port_count()
89 status = pdc_iodc_read(&bytecnt, dev->hpa.start, 0, iodc_data, 32); in get_mux_port_count()
97 * mux_tx_empty - Check if the transmitter fifo is empty.
110 * mux_set_mctrl - Set the current state of the modem control inputs.
114 * The Serial MUX does not support CTS, DCD or DSR so this function
122 * mux_get_mctrl - Returns the current state of modem control inputs.
125 * The Serial MUX does not support CTS, DCD or DSR so these lines are
134 * mux_stop_tx - Stop transmitting characters.
137 * The Serial MUX does not support this function.
144 * mux_start_tx - Start transmitting characters.
147 * The Serial Mux does not support this function.
154 * mux_stop_rx - Stop receiving characters.
157 * The Serial Mux does not support this function.
164 * mux_break_ctl - Control the transmitssion of a break signal.
168 * The Serial Mux does not support this function.
175 * mux_write - Write chars to the mux fifo.
179 * the mux fifo.
184 struct circ_buf *xmit = &port->state->xmit; in mux_write()
186 if(port->x_char) { in mux_write()
187 UART_PUT_CHAR(port, port->x_char); in mux_write()
188 port->icount.tx++; in mux_write()
189 port->x_char = 0; in mux_write()
198 count = (port->fifosize) - UART_GET_FIFO_CNT(port); in mux_write()
200 UART_PUT_CHAR(port, xmit->buf[xmit->tail]); in mux_write()
201 xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); in mux_write()
202 port->icount.tx++; in mux_write()
206 } while(--count > 0); in mux_write()
219 * mux_read - Read chars from the mux fifo.
222 * This reads all available data from the mux's fifo and pushes
227 struct tty_port *tport = &port->state->port; in mux_read()
229 __u32 start_count = port->icount.rx; in mux_read()
232 data = __raw_readl(port->membase + IO_DATA_REG_OFFSET); in mux_read()
240 port->icount.rx++; in mux_read()
243 port->icount.brk++; in mux_read()
254 if (start_count != port->icount.rx) in mux_read()
259 * mux_startup - Initialize the port.
263 * mux timer.
267 mux_ports[port->line].enabled = 1; in mux_startup()
272 * mux_shutdown - Disable the port.
279 mux_ports[port->line].enabled = 0; in mux_shutdown()
283 * mux_set_termios - Chane port parameters.
288 * The Serial Mux does not support this function.
297 * mux_type - Describe the port.
305 return "Mux"; in mux_type()
309 * mux_release_port - Release memory and IO regions.
320 * mux_request_port - Request memory and IO regions.
325 * returns, and it should return -EBUSY on failure.
333 * mux_config_port - Perform port autoconfiguration.
339 * [Note: This is required for now because of a bug in the Serial core.
345 port->type = PORT_MUX; in mux_config_port()
349 * mux_verify_port - Verify the port information.
351 * @ser: Ptr to the serial information.
353 * Verify the new serial port information contained within serinfo is
358 if(port->membase == NULL) in mux_verify_port()
359 return -EINVAL; in mux_verify_port()
365 * mux_drv_poll - Mux poll function.
368 * This function periodically polls the Serial MUX to check for new data.
393 while(count--) { in mux_console_write()
441 * mux_probe - Determine if the Serial Mux should claim this device.
444 * Deterimine if the Serial Mux should claim this chip (return 0)
452 printk(KERN_INFO "Serial mux driver (%d ports) Revision: 0.6\n", port_count); in mux_probe()
454 dev_set_drvdata(&dev->dev, (void *)(long)port_count); in mux_probe()
455 request_mem_region(dev->hpa.start + MUX_OFFSET, in mux_probe()
456 port_count * MUX_LINE_OFFSET, "Mux"); in mux_probe()
463 printk(KERN_ERR "Serial mux: Unable to register driver.\n"); in mux_probe()
470 port->iobase = 0; in mux_probe()
471 port->mapbase = dev->hpa.start + MUX_OFFSET + in mux_probe()
473 port->membase = ioremap(port->mapbase, MUX_LINE_OFFSET); in mux_probe()
474 port->iotype = UPIO_MEM; in mux_probe()
475 port->type = PORT_MUX; in mux_probe()
476 port->irq = 0; in mux_probe()
477 port->uartclk = 0; in mux_probe()
478 port->fifosize = MUX_FIFO_SIZE; in mux_probe()
479 port->ops = &mux_pops; in mux_probe()
480 port->flags = UPF_BOOT_AUTOCONF; in mux_probe()
481 port->line = port_cnt; in mux_probe()
482 port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_MUX_CONSOLE); in mux_probe()
484 /* The port->timeout needs to match what is present in in mux_probe()
489 port->timeout = HZ / 50; in mux_probe()
490 spin_lock_init(&port->lock); in mux_probe()
502 int port_count = (long)dev_get_drvdata(&dev->dev); in mux_remove()
506 if(mux_ports[i].port.mapbase == dev->hpa.start + MUX_OFFSET) in mux_remove()
516 if(port->membase) in mux_remove()
517 iounmap(port->membase); in mux_remove()
520 release_mem_region(dev->hpa.start + MUX_OFFSET, port_count * MUX_LINE_OFFSET); in mux_remove()
525 * the serial port detection in the proper order. The idea is we always
526 * want the builtin mux to be detected before addin mux cards, so we
527 * specifically probe for the builtin mux cards first.
529 * This table only contains the parisc_device_id of known builtin mux
530 * devices. All other mux cards will be detected by the generic mux_tbl.
533 { HPHW_A_DIRECT, HVERSION_REV_ANY_ID, 0x15, 0x0000D }, /* All K-class */
561 * mux_init - Serial MUX initialization procedure.
563 * Register the Serial MUX driver.
571 /* Start the Mux timer */ in mux_init()
584 * mux_exit - Serial MUX cleanup procedure.
586 * Unregister the Serial MUX driver from the tty layer.
590 /* Delete the Mux timer. */ in mux_exit()
607 MODULE_DESCRIPTION("Serial MUX driver");