Skip to content

Commit

Permalink
[PATCH] Serial: Split 8250 port table
Browse files Browse the repository at this point in the history
Add separate files for the different 8250 ISA-based serial boards.

Looking across all the various architectures, it seems reasonable that
we can key the availability of the configuration options for these
beasts to the bus-related symbols (iow, CONFIG_ISA).  We also standardise
the base baud/uart clock rate for these boards - I'm sure that isn't
architecture specific, but is solely dependent on the crystal fitted
on the board (which should be the same no matter what type of machine
its fitted into.)

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
  • Loading branch information
Russell King authored and Russell King committed Jun 27, 2005
1 parent addcc4a commit ec9f47c
Show file tree
Hide file tree
Showing 9 changed files with 357 additions and 32 deletions.
25 changes: 9 additions & 16 deletions drivers/serial/8250.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,23 +77,9 @@ static unsigned int share_irqs = SERIAL8250_SHARE_IRQS;
*/
#define is_real_interrupt(irq) ((irq) != 0)

/*
* This converts from our new CONFIG_ symbols to the symbols
* that asm/serial.h expects. You _NEED_ to comment out the
* linux/config.h include contained inside asm/serial.h for
* this to work.
*/
#undef CONFIG_SERIAL_MANY_PORTS
#undef CONFIG_SERIAL_DETECT_IRQ
#undef CONFIG_SERIAL_MULTIPORT
#undef CONFIG_HUB6

#ifdef CONFIG_SERIAL_8250_DETECT_IRQ
#define CONFIG_SERIAL_DETECT_IRQ 1
#endif
#ifdef CONFIG_SERIAL_8250_MULTIPORT
#define CONFIG_SERIAL_MULTIPORT 1
#endif
#ifdef CONFIG_SERIAL_8250_MANY_PORTS
#define CONFIG_SERIAL_MANY_PORTS 1
#endif
Expand Down Expand Up @@ -2323,10 +2309,11 @@ static int __devinit serial8250_probe(struct device *dev)
{
struct plat_serial8250_port *p = dev->platform_data;
struct uart_port port;
int ret, i;

memset(&port, 0, sizeof(struct uart_port));

for (; p && p->flags != 0; p++) {
for (i = 0; p && p->flags != 0; p++, i++) {
port.iobase = p->iobase;
port.membase = p->membase;
port.irq = p->irq;
Expand All @@ -2335,10 +2322,16 @@ static int __devinit serial8250_probe(struct device *dev)
port.iotype = p->iotype;
port.flags = p->flags;
port.mapbase = p->mapbase;
port.hub6 = p->hub6;
port.dev = dev;
if (share_irqs)
port.flags |= UPF_SHARE_IRQ;
serial8250_register_port(&port);
ret = serial8250_register_port(&port);
if (ret < 0) {
dev_err(dev, "unable to register port at index %d "
"(IO%lx MEM%lx IRQ%d): %d\n", i,
p->iobase, p->mapbase, p->irq, ret);
}
}
return 0;
}
Expand Down
47 changes: 47 additions & 0 deletions drivers/serial/8250_accent.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* linux/drivers/serial/8250_accent.c
*
* Copyright (C) 2005 Russell King.
* Data taken from include/asm-i386/serial.h
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/serial_8250.h>

#define PORT(_base,_irq) \
{ \
.iobase = _base, \
.irq = _irq, \
.uartclk = 1843200, \
.iotype = UPIO_PORT, \
.flags = UPF_BOOT_AUTOCONF, \
}

static struct plat_serial8250_port accent_data[] = {
PORT(0x330, 4),
PORT(0x338, 4),
{ },
};

static struct platform_device accent_device = {
.name = "serial8250",
.id = 2,
.dev = {
.platform_data = accent_data,
},
};

static int __init accent_init(void)
{
return platform_device_register(&accent_device);
}

module_init(accent_init);

MODULE_AUTHOR("Russell King");
MODULE_DESCRIPTION("8250 serial probe module for Accent Async cards");
MODULE_LICENSE("GPL");
61 changes: 61 additions & 0 deletions drivers/serial/8250_boca.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* linux/drivers/serial/8250_boca.c
*
* Copyright (C) 2005 Russell King.
* Data taken from include/asm-i386/serial.h
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/serial_8250.h>

#define PORT(_base,_irq) \
{ \
.iobase = _base, \
.irq = _irq, \
.uartclk = 1843200, \
.iotype = UPIO_PORT, \
.flags = UPF_BOOT_AUTOCONF, \
}

static struct plat_serial8250_port boca_data[] = {
PORT(0x100, 12),
PORT(0x108, 12),
PORT(0x110, 12),
PORT(0x118, 12),
PORT(0x120, 12),
PORT(0x128, 12),
PORT(0x130, 12),
PORT(0x138, 12),
PORT(0x140, 12),
PORT(0x148, 12),
PORT(0x150, 12),
PORT(0x158, 12),
PORT(0x160, 12),
PORT(0x168, 12),
PORT(0x170, 12),
PORT(0x178, 12),
{ },
};

static struct platform_device boca_device = {
.name = "serial8250",
.id = 3,
.dev = {
.platform_data = boca_data,
},
};

static int __init boca_init(void)
{
return platform_device_register(&boca_device);
}

module_init(boca_init);

MODULE_AUTHOR("Russell King");
MODULE_DESCRIPTION("8250 serial probe module for Boca cards");
MODULE_LICENSE("GPL");
53 changes: 53 additions & 0 deletions drivers/serial/8250_fourport.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* linux/drivers/serial/8250_fourport.c
*
* Copyright (C) 2005 Russell King.
* Data taken from include/asm-i386/serial.h
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/serial_8250.h>

#define PORT(_base,_irq) \
{ \
.iobase = _base, \
.irq = _irq, \
.uartclk = 1843200, \
.iotype = UPIO_PORT, \
.flags = UPF_BOOT_AUTOCONF | UPF_FOURPORT, \
}

static struct plat_serial8250_port fourport_data[] = {
PORT(0x1a0, 9),
PORT(0x1a8, 9),
PORT(0x1b0, 9),
PORT(0x1b8, 9),
PORT(0x2a0, 5),
PORT(0x2a8, 5),
PORT(0x2b0, 5),
PORT(0x2b8, 5),
{ },
};

static struct platform_device fourport_device = {
.name = "serial8250",
.id = 1,
.dev = {
.platform_data = fourport_data,
},
};

static int __init fourport_init(void)
{
return platform_device_register(&fourport_device);
}

module_init(fourport_init);

MODULE_AUTHOR("Russell King");
MODULE_DESCRIPTION("8250 serial probe module for AST Fourport cards");
MODULE_LICENSE("GPL");
58 changes: 58 additions & 0 deletions drivers/serial/8250_hub6.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* linux/drivers/serial/8250_hub6.c
*
* Copyright (C) 2005 Russell King.
* Data taken from include/asm-i386/serial.h
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/serial_8250.h>

#define HUB6(card,port) \
{ \
.iobase = 0x302, \
.irq = 3, \
.uartclk = 1843200, \
.iotype = UPIO_HUB6, \
.flags = UPF_BOOT_AUTOCONF, \
.hub6 = (card) << 6 | (port) << 3 | 1, \
}

static struct plat_serial8250_port hub6_data[] = {
HUB6(0,0),
HUB6(0,1),
HUB6(0,2),
HUB6(0,3),
HUB6(0,4),
HUB6(0,5),
HUB6(1,0),
HUB6(1,1),
HUB6(1,2),
HUB6(1,3),
HUB6(1,4),
HUB6(1,5),
{ },
};

static struct platform_device hub6_device = {
.name = "serial8250",
.id = 4,
.dev = {
.platform_data = hub6_data,
},
};

static int __init hub6_init(void)
{
return platform_device_register(&hub6_device);
}

module_init(hub6_init);

MODULE_AUTHOR("Russell King");
MODULE_DESCRIPTION("8250 serial probe module for Hub6 cards");
MODULE_LICENSE("GPL");
64 changes: 64 additions & 0 deletions drivers/serial/8250_mca.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* linux/drivers/serial/8250_mca.c
*
* Copyright (C) 2005 Russell King.
* Data taken from include/asm-i386/serial.h
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/config.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/mca.h>
#include <linux/serial_8250.h>

/*
* FIXME: Should we be doing AUTO_IRQ here?
*/
#ifdef CONFIG_SERIAL_8250_DETECT_IRQ
#define MCA_FLAGS UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_AUTO_IRQ
#else
#define MCA_FLAGS UPF_BOOT_AUTOCONF | UPF_SKIP_TEST
#endif

#define PORT(_base,_irq) \
{ \
.iobase = _base, \
.irq = _irq, \
.uartclk = 1843200, \
.iotype = UPIO_PORT, \
.flags = MCA_FLAGS, \
}

static struct plat_serial8250_port mca_data[] = {
PORT(0x3220, 3),
PORT(0x3228, 3),
PORT(0x4220, 3),
PORT(0x4228, 3),
PORT(0x5220, 3),
PORT(0x5228, 3),
{ },
};

static struct platform_device mca_device = {
.name = "serial8250",
.id = 5,
.dev = {
.platform_data = mca_data,
},
};

static int __init mca_init(void)
{
if (!MCA_bus)
return -ENODEV;
return platform_device_register(&mca_device);
}

module_init(mca_init);

MODULE_AUTHOR("Russell King");
MODULE_DESCRIPTION("8250 serial probe module for MCA ports");
MODULE_LICENSE("GPL");
Loading

0 comments on commit ec9f47c

Please sign in to comment.