uart.c (7483d45f0aee3afc0646d185cabd4af9f6cab58c) uart.c (ce7240e445303de3ca66e6d08f17a2ec278a5bf6)
1
2/*
3 * IBM ASM Service Processor Device Driver
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.

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

28#include <linux/serial_reg.h>
29#include <linux/serial_8250.h>
30#include "ibmasm.h"
31#include "lowlevel.h"
32
33
34void ibmasm_register_uart(struct service_processor *sp)
35{
1
2/*
3 * IBM ASM Service Processor Device Driver
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.

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

28#include <linux/serial_reg.h>
29#include <linux/serial_8250.h>
30#include "ibmasm.h"
31#include "lowlevel.h"
32
33
34void ibmasm_register_uart(struct service_processor *sp)
35{
36 struct uart_port uport;
36 struct uart_8250_port uart;
37 void __iomem *iomem_base;
38
39 iomem_base = sp->base_address + SCOUT_COM_B_BASE;
40
41 /* read the uart scratch register to determine if the UART
42 * is dedicated to the service processor or if the OS can use it
43 */
44 if (0 == readl(iomem_base + UART_SCR)) {
45 dev_info(sp->dev, "IBM SP UART not registered, owned by service processor\n");
46 sp->serial_line = -1;
47 return;
48 }
49
37 void __iomem *iomem_base;
38
39 iomem_base = sp->base_address + SCOUT_COM_B_BASE;
40
41 /* read the uart scratch register to determine if the UART
42 * is dedicated to the service processor or if the OS can use it
43 */
44 if (0 == readl(iomem_base + UART_SCR)) {
45 dev_info(sp->dev, "IBM SP UART not registered, owned by service processor\n");
46 sp->serial_line = -1;
47 return;
48 }
49
50 memset(&uport, 0, sizeof(struct uart_port));
51 uport.irq = sp->irq;
52 uport.uartclk = 3686400;
53 uport.flags = UPF_SHARE_IRQ;
54 uport.iotype = UPIO_MEM;
55 uport.membase = iomem_base;
50 memset(&uart, 0, sizeof(uart));
51 uart.port.irq = sp->irq;
52 uart.port.uartclk = 3686400;
53 uart.port.flags = UPF_SHARE_IRQ;
54 uart.port.iotype = UPIO_MEM;
55 uart.port.membase = iomem_base;
56
56
57 sp->serial_line = serial8250_register_port(&uport);
57 sp->serial_line = serial8250_register_8250_port(&uart);
58 if (sp->serial_line < 0) {
59 dev_err(sp->dev, "Failed to register serial port\n");
60 return;
61 }
62 enable_uart_interrupts(sp->base_address);
63}
64
65void ibmasm_unregister_uart(struct service_processor *sp)
66{
67 if (sp->serial_line < 0)
68 return;
69
70 disable_uart_interrupts(sp->base_address);
71 serial8250_unregister_port(sp->serial_line);
72}
58 if (sp->serial_line < 0) {
59 dev_err(sp->dev, "Failed to register serial port\n");
60 return;
61 }
62 enable_uart_interrupts(sp->base_address);
63}
64
65void ibmasm_unregister_uart(struct service_processor *sp)
66{
67 if (sp->serial_line < 0)
68 return;
69
70 disable_uart_interrupts(sp->base_address);
71 serial8250_unregister_port(sp->serial_line);
72}