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.
182 * mux_write - Write chars to the mux fifo.
186 * the mux fifo.
193 port->fifosize - UART_GET_FIFO_CNT(port), in mux_write()
200 * mux_read - Read chars from the mux fifo.
203 * This reads all available data from the mux's fifo and pushes
208 struct tty_port *tport = &port->state->port; in mux_read()
210 __u32 start_count = port->icount.rx; in mux_read()
213 data = __raw_readl(port->membase + IO_DATA_REG_OFFSET); in mux_read()
221 port->icount.rx++; in mux_read()
224 port->icount.brk++; in mux_read()
235 if (start_count != port->icount.rx) in mux_read()
240 * mux_startup - Initialize the port.
244 * mux timer.
248 mux_ports[port->line].enabled = 1; in mux_startup()
253 * mux_shutdown - Disable the port.
260 mux_ports[port->line].enabled = 0; in mux_shutdown()
264 * mux_set_termios - Chane port parameters.
269 * The Serial Mux does not support this function.
278 * mux_type - Describe the port.
286 return "Mux"; in mux_type()
290 * mux_release_port - Release memory and IO regions.
301 * mux_request_port - Request memory and IO regions.
306 * returns, and it should return -EBUSY on failure.
314 * mux_config_port - Perform port autoconfiguration.
320 * [Note: This is required for now because of a bug in the Serial core.
326 port->type = PORT_MUX; in mux_config_port()
330 * mux_verify_port - Verify the port information.
332 * @ser: Ptr to the serial information.
334 * Verify the new serial port information contained within serinfo is
339 if(port->membase == NULL) in mux_verify_port()
340 return -EINVAL; in mux_verify_port()
346 * mux_drv_poll - Mux poll function.
349 * This function periodically polls the Serial MUX to check for new data.
374 while(count--) { in mux_console_write()
422 * mux_probe - Determine if the Serial Mux should claim this device.
425 * Deterimine if the Serial Mux should claim this chip (return 0)
433 printk(KERN_INFO "Serial mux driver (%d ports) Revision: 0.6\n", port_count); in mux_probe()
435 dev_set_drvdata(&dev->dev, (void *)(long)port_count); in mux_probe()
436 request_mem_region(dev->hpa.start + MUX_OFFSET, in mux_probe()
437 port_count * MUX_LINE_OFFSET, "Mux"); in mux_probe()
444 printk(KERN_ERR "Serial mux: Unable to register driver.\n"); in mux_probe()
451 port->iobase = 0; in mux_probe()
452 port->mapbase = dev->hpa.start + MUX_OFFSET + in mux_probe()
454 port->membase = ioremap(port->mapbase, MUX_LINE_OFFSET); in mux_probe()
455 port->iotype = UPIO_MEM; in mux_probe()
456 port->type = PORT_MUX; in mux_probe()
457 port->irq = 0; in mux_probe()
458 port->uartclk = 0; in mux_probe()
459 port->fifosize = MUX_FIFO_SIZE; in mux_probe()
460 port->ops = &mux_pops; in mux_probe()
461 port->flags = UPF_BOOT_AUTOCONF; in mux_probe()
462 port->line = port_cnt; in mux_probe()
463 port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_MUX_CONSOLE); in mux_probe()
465 spin_lock_init(&port->lock); in mux_probe()
477 int port_count = (long)dev_get_drvdata(&dev->dev); in mux_remove()
481 if(mux_ports[i].port.mapbase == dev->hpa.start + MUX_OFFSET) in mux_remove()
491 if(port->membase) in mux_remove()
492 iounmap(port->membase); in mux_remove()
495 release_mem_region(dev->hpa.start + MUX_OFFSET, port_count * MUX_LINE_OFFSET); in mux_remove()
499 * the serial port detection in the proper order. The idea is we always
500 * want the builtin mux to be detected before addin mux cards, so we
501 * specifically probe for the builtin mux cards first.
503 * This table only contains the parisc_device_id of known builtin mux
504 * devices. All other mux cards will be detected by the generic mux_tbl.
507 { HPHW_A_DIRECT, HVERSION_REV_ANY_ID, 0x15, 0x0000D }, /* All K-class */
535 * mux_init - Serial MUX initialization procedure.
537 * Register the Serial MUX driver.
545 /* Start the Mux timer */ in mux_init()
558 * mux_exit - Serial MUX cleanup procedure.
560 * Unregister the Serial MUX driver from the tty layer.
564 /* Delete the Mux timer. */ in mux_exit()
581 MODULE_DESCRIPTION("Serial MUX driver");