Commit 2a2b8976 authored by Russell King's avatar Russell King

[SERIAL] Fix PPC64 for recent serial changes

- linux/8250.h is replaced by linux/serial_8250.h
- we now pass serial port information via a platform device.
parent 025e8c09
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#include <linux/cpu.h> #include <linux/cpu.h>
#include <linux/unistd.h> #include <linux/unistd.h>
#include <linux/serial.h> #include <linux/serial.h>
#include <linux/8250.h> #include <linux/serial_8250.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/prom.h> #include <asm/prom.h>
#include <asm/processor.h> #include <asm/processor.h>
...@@ -901,7 +901,7 @@ static int __init set_preferred_console(void) ...@@ -901,7 +901,7 @@ static int __init set_preferred_console(void)
DBG("Found serial console at ttyS%d\n", offset); DBG("Found serial console at ttyS%d\n", offset);
if (spd) { if (spd) {
char opt[16]; static char __initdata opt[16];
sprintf(opt, "%d", *spd); sprintf(opt, "%d", *spd);
return add_preferred_console("ttyS", offset, opt); return add_preferred_console("ttyS", offset, opt);
} else } else
...@@ -1123,8 +1123,8 @@ __setup("decr_overclock=", set_decr_overclock ); ...@@ -1123,8 +1123,8 @@ __setup("decr_overclock=", set_decr_overclock );
*/ */
#define MAX_LEGACY_SERIAL_PORTS 8 #define MAX_LEGACY_SERIAL_PORTS 8
static struct old_serial_port old_serial_ports[MAX_LEGACY_SERIAL_PORTS]; static struct plat_serial8250_port serial_ports[MAX_LEGACY_SERIAL_PORTS+1];
static unsigned int old_serial_count; static unsigned int old_serial_count;
void __init generic_find_legacy_serial_ports(unsigned int *default_speed) void __init generic_find_legacy_serial_ports(unsigned int *default_speed)
{ {
...@@ -1202,13 +1202,13 @@ void __init generic_find_legacy_serial_ports(unsigned int *default_speed) ...@@ -1202,13 +1202,13 @@ void __init generic_find_legacy_serial_ports(unsigned int *default_speed)
if (index >= old_serial_count) if (index >= old_serial_count)
old_serial_count = index + 1; old_serial_count = index + 1;
/* Check if there is a port who already claimed our slot */ /* Check if there is a port who already claimed our slot */
if (old_serial_ports[index].port != 0) { if (serial_ports[index].iobase != 0) {
/* if we still have some room, move it, else override */ /* if we still have some room, move it, else override */
if (old_serial_count < MAX_LEGACY_SERIAL_PORTS) { if (old_serial_count < MAX_LEGACY_SERIAL_PORTS) {
DBG("Moved legacy port %d -> %d\n", index, DBG("Moved legacy port %d -> %d\n", index,
old_serial_count); old_serial_count);
old_serial_ports[old_serial_count++] = serial_ports[old_serial_count++] =
old_serial_ports[index]; serial_ports[index];
} else { } else {
DBG("Replacing legacy port %d\n", index); DBG("Replacing legacy port %d\n", index);
} }
...@@ -1220,18 +1220,17 @@ void __init generic_find_legacy_serial_ports(unsigned int *default_speed) ...@@ -1220,18 +1220,17 @@ void __init generic_find_legacy_serial_ports(unsigned int *default_speed)
old_serial_count = index + 1; old_serial_count = index + 1;
/* Now fill the entry */ /* Now fill the entry */
memset(&old_serial_ports[index], 0, sizeof(struct old_serial_port)); memset(&serial_ports[index], 0, sizeof(struct plat_serial8250_port));
old_serial_ports[index].uart = 0; serial_ports[index].uartclk = clk ? *clk : BASE_BAUD * 16;
old_serial_ports[index].baud_base = clk ? (*clk / 16) : BASE_BAUD; serial_ports[index].iobase = reg->address;
old_serial_ports[index].port = reg->address; serial_ports[index].irq = interrupts ? interrupts[0] : 0;
old_serial_ports[index].irq = interrupts ? interrupts[0] : 0; serial_ports[index].flags = ASYNC_BOOT_AUTOCONF;
old_serial_ports[index].flags = ASYNC_BOOT_AUTOCONF;
DBG("Added legacy port, index: %d, port: %x, irq: %d, clk: %d\n", DBG("Added legacy port, index: %d, port: %x, irq: %d, clk: %d\n",
index, index,
old_serial_ports[index].port, serial_ports[index].iobase,
old_serial_ports[index].irq, serial_ports[index].irq,
old_serial_ports[index].baud_base * 16); serial_ports[index].uartclk);
/* Get phys address of IO reg for port 1 */ /* Get phys address of IO reg for port 1 */
if (index != 0) if (index != 0)
...@@ -1279,19 +1278,21 @@ void __init generic_find_legacy_serial_ports(unsigned int *default_speed) ...@@ -1279,19 +1278,21 @@ void __init generic_find_legacy_serial_ports(unsigned int *default_speed)
DBG(" <- generic_find_legacy_serial_port()\n"); DBG(" <- generic_find_legacy_serial_port()\n");
} }
struct old_serial_port *get_legacy_serial_ports(unsigned int *count) static struct platform_device serial_device = {
{ .name = "serial8250",
*count = old_serial_count; .id = 0,
return old_serial_ports; .dev = {
} .platform_data = serial_ports,
#else },
struct old_serial_port *get_legacy_serial_ports(unsigned int *count) };
static int __init serial_dev_init(void)
{ {
*count = 0; return platform_device_register(&serial_device);
return 0;
} }
arch_initcall(serial_dev_init);
#endif /* CONFIG_PPC_ISERIES */ #endif /* CONFIG_PPC_ISERIES */
EXPORT_SYMBOL(get_legacy_serial_ports);
int check_legacy_ioport(unsigned long base_port) int check_legacy_ioport(unsigned long base_port)
{ {
......
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
#ifndef _PPC64_SERIAL_H #ifndef _PPC64_SERIAL_H
#define _PPC64_SERIAL_H #define _PPC64_SERIAL_H
#include <linux/config.h>
/* /*
* This assumes you have a 1.8432 MHz clock for your UART. * This assumes you have a 1.8432 MHz clock for your UART.
* *
...@@ -22,9 +20,4 @@ ...@@ -22,9 +20,4 @@
/* Default baud base if not found in device-tree */ /* Default baud base if not found in device-tree */
#define BASE_BAUD ( 1843200 / 16 ) #define BASE_BAUD ( 1843200 / 16 )
#define ARCH_HAS_GET_LEGACY_SERIAL_PORTS
struct old_serial_port;
extern struct old_serial_port *get_legacy_serial_ports(unsigned int *count);
#define UART_NR (8 + CONFIG_SERIAL_8250_NR_UARTS)
#endif /* _PPC64_SERIAL_H */ #endif /* _PPC64_SERIAL_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment