1/*2* IBM ASM Service Processor Device Driver3*4* This program is free software; you can redistribute it and/or modify5* it under the terms of the GNU General Public License as published by6* the Free Software Foundation; either version 2 of the License, or7* (at your option) any later version.8*9* This program is distributed in the hope that it will be useful,10* but WITHOUT ANY WARRANTY; without even the implied warranty of11* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12* GNU General Public License for more details.13*14* You should have received a copy of the GNU General Public License15* along with this program; if not, write to the Free Software16* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.17*18* Copyright (C) IBM Corporation, 200419*20* Author: Max Asb�ck <[email protected]>21*22*/2324#include <linux/termios.h>25#include <linux/tty.h>26#include <linux/serial_core.h>27#include <linux/serial_reg.h>28#include <linux/serial_8250.h>29#include "ibmasm.h"30#include "lowlevel.h"313233void ibmasm_register_uart(struct service_processor *sp)34{35struct uart_port uport;36void __iomem *iomem_base;3738iomem_base = sp->base_address + SCOUT_COM_B_BASE;3940/* read the uart scratch register to determine if the UART41* is dedicated to the service processor or if the OS can use it42*/43if (0 == readl(iomem_base + UART_SCR)) {44dev_info(sp->dev, "IBM SP UART not registered, owned by service processor\n");45sp->serial_line = -1;46return;47}4849memset(&uport, 0, sizeof(struct uart_port));50uport.irq = sp->irq;51uport.uartclk = 3686400;52uport.flags = UPF_SHARE_IRQ;53uport.iotype = UPIO_MEM;54uport.membase = iomem_base;5556sp->serial_line = serial8250_register_port(&uport);57if (sp->serial_line < 0) {58dev_err(sp->dev, "Failed to register serial port\n");59return;60}61enable_uart_interrupts(sp->base_address);62}6364void ibmasm_unregister_uart(struct service_processor *sp)65{66if (sp->serial_line < 0)67return;6869disable_uart_interrupts(sp->base_address);70serial8250_unregister_port(sp->serial_line);71}727374