mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
1a59d1b8e0
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details you should have received a copy of the gnu general public license along with this program if not write to the free software foundation inc 59 temple place suite 330 boston ma 02111 1307 usa extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 1334 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Richard Fontana <rfontana@redhat.com> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070033.113240726@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
59 lines
1.4 KiB
C
59 lines
1.4 KiB
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
/*
|
|
* IBM ASM Service Processor Device Driver
|
|
*
|
|
* Copyright (C) IBM Corporation, 2004
|
|
*
|
|
* Author: Max Asböck <amax@us.ibm.com>
|
|
*/
|
|
|
|
#include <linux/termios.h>
|
|
#include <linux/tty.h>
|
|
#include <linux/serial_core.h>
|
|
#include <linux/serial_reg.h>
|
|
#include <linux/serial_8250.h>
|
|
#include "ibmasm.h"
|
|
#include "lowlevel.h"
|
|
|
|
|
|
void ibmasm_register_uart(struct service_processor *sp)
|
|
{
|
|
struct uart_8250_port uart;
|
|
void __iomem *iomem_base;
|
|
|
|
iomem_base = sp->base_address + SCOUT_COM_B_BASE;
|
|
|
|
/* read the uart scratch register to determine if the UART
|
|
* is dedicated to the service processor or if the OS can use it
|
|
*/
|
|
if (0 == readl(iomem_base + UART_SCR)) {
|
|
dev_info(sp->dev, "IBM SP UART not registered, owned by service processor\n");
|
|
sp->serial_line = -1;
|
|
return;
|
|
}
|
|
|
|
memset(&uart, 0, sizeof(uart));
|
|
uart.port.irq = sp->irq;
|
|
uart.port.uartclk = 3686400;
|
|
uart.port.flags = UPF_SHARE_IRQ;
|
|
uart.port.iotype = UPIO_MEM;
|
|
uart.port.membase = iomem_base;
|
|
|
|
sp->serial_line = serial8250_register_8250_port(&uart);
|
|
if (sp->serial_line < 0) {
|
|
dev_err(sp->dev, "Failed to register serial port\n");
|
|
return;
|
|
}
|
|
enable_uart_interrupts(sp->base_address);
|
|
}
|
|
|
|
void ibmasm_unregister_uart(struct service_processor *sp)
|
|
{
|
|
if (sp->serial_line < 0)
|
|
return;
|
|
|
|
disable_uart_interrupts(sp->base_address);
|
|
serial8250_unregister_port(sp->serial_line);
|
|
}
|