0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include <linux/termios.h>
0012 #include <linux/tty.h>
0013 #include <linux/serial_core.h>
0014 #include <linux/serial_reg.h>
0015 #include <linux/serial_8250.h>
0016 #include "ibmasm.h"
0017 #include "lowlevel.h"
0018
0019
0020 void ibmasm_register_uart(struct service_processor *sp)
0021 {
0022 struct uart_8250_port uart;
0023 void __iomem *iomem_base;
0024
0025 iomem_base = sp->base_address + SCOUT_COM_B_BASE;
0026
0027
0028
0029
0030 if (0 == readl(iomem_base + UART_SCR)) {
0031 dev_info(sp->dev, "IBM SP UART not registered, owned by service processor\n");
0032 sp->serial_line = -1;
0033 return;
0034 }
0035
0036 memset(&uart, 0, sizeof(uart));
0037 uart.port.irq = sp->irq;
0038 uart.port.uartclk = 3686400;
0039 uart.port.flags = UPF_SHARE_IRQ;
0040 uart.port.iotype = UPIO_MEM;
0041 uart.port.membase = iomem_base;
0042
0043 sp->serial_line = serial8250_register_8250_port(&uart);
0044 if (sp->serial_line < 0) {
0045 dev_err(sp->dev, "Failed to register serial port\n");
0046 return;
0047 }
0048 enable_uart_interrupts(sp->base_address);
0049 }
0050
0051 void ibmasm_unregister_uart(struct service_processor *sp)
0052 {
0053 if (sp->serial_line < 0)
0054 return;
0055
0056 disable_uart_interrupts(sp->base_address);
0057 serial8250_unregister_port(sp->serial_line);
0058 }