Commit 2655a2c7 authored by Alan Cox's avatar Alan Cox Committed by Greg Kroah-Hartman

8250: use the 8250 register interface not the legacy one

The old interface just copies bits over and calls the newer one.
In addition we can now pass more information.
Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 000c74d9
...@@ -2979,36 +2979,36 @@ void serial8250_resume_port(int line) ...@@ -2979,36 +2979,36 @@ void serial8250_resume_port(int line)
static int __devinit serial8250_probe(struct platform_device *dev) static int __devinit serial8250_probe(struct platform_device *dev)
{ {
struct plat_serial8250_port *p = dev->dev.platform_data; struct plat_serial8250_port *p = dev->dev.platform_data;
struct uart_port port; struct uart_8250_port uart;
int ret, i, irqflag = 0; int ret, i, irqflag = 0;
memset(&port, 0, sizeof(struct uart_port)); memset(&uart, 0, sizeof(uart));
if (share_irqs) if (share_irqs)
irqflag = IRQF_SHARED; irqflag = IRQF_SHARED;
for (i = 0; p && p->flags != 0; p++, i++) { for (i = 0; p && p->flags != 0; p++, i++) {
port.iobase = p->iobase; uart.port.iobase = p->iobase;
port.membase = p->membase; uart.port.membase = p->membase;
port.irq = p->irq; uart.port.irq = p->irq;
port.irqflags = p->irqflags; uart.port.irqflags = p->irqflags;
port.uartclk = p->uartclk; uart.port.uartclk = p->uartclk;
port.regshift = p->regshift; uart.port.regshift = p->regshift;
port.iotype = p->iotype; uart.port.iotype = p->iotype;
port.flags = p->flags; uart.port.flags = p->flags;
port.mapbase = p->mapbase; uart.port.mapbase = p->mapbase;
port.hub6 = p->hub6; uart.port.hub6 = p->hub6;
port.private_data = p->private_data; uart.port.private_data = p->private_data;
port.type = p->type; uart.port.type = p->type;
port.serial_in = p->serial_in; uart.port.serial_in = p->serial_in;
port.serial_out = p->serial_out; uart.port.serial_out = p->serial_out;
port.handle_irq = p->handle_irq; uart.port.handle_irq = p->handle_irq;
port.handle_break = p->handle_break; uart.port.handle_break = p->handle_break;
port.set_termios = p->set_termios; uart.port.set_termios = p->set_termios;
port.pm = p->pm; uart.port.pm = p->pm;
port.dev = &dev->dev; uart.port.dev = &dev->dev;
port.irqflags |= irqflag; uart.port.irqflags |= irqflag;
ret = serial8250_register_port(&port); ret = serial8250_register_8250_port(&uart);
if (ret < 0) { if (ret < 0) {
dev_err(&dev->dev, "unable to register port at index %d " dev_err(&dev->dev, "unable to register port at index %d "
"(IO%lx MEM%llx IRQ%d): %d\n", i, "(IO%lx MEM%llx IRQ%d): %d\n", i,
...@@ -3081,7 +3081,7 @@ static struct platform_driver serial8250_isa_driver = { ...@@ -3081,7 +3081,7 @@ static struct platform_driver serial8250_isa_driver = {
static struct platform_device *serial8250_isa_devs; static struct platform_device *serial8250_isa_devs;
/* /*
* serial8250_register_port and serial8250_unregister_port allows for * serial8250_register_8250_port and serial8250_unregister_port allows for
* 16x50 serial ports to be configured at run-time, to support PCMCIA * 16x50 serial ports to be configured at run-time, to support PCMCIA
* modems and PCI multiport cards. * modems and PCI multiport cards.
*/ */
...@@ -3197,29 +3197,6 @@ int serial8250_register_8250_port(struct uart_8250_port *up) ...@@ -3197,29 +3197,6 @@ int serial8250_register_8250_port(struct uart_8250_port *up)
} }
EXPORT_SYMBOL(serial8250_register_8250_port); EXPORT_SYMBOL(serial8250_register_8250_port);
/**
* serial8250_register_port - register a serial port
* @port: serial port template
*
* Configure the serial port specified by the request. If the
* port exists and is in use, it is hung up and unregistered
* first.
*
* The port is then probed and if necessary the IRQ is autodetected
* If this fails an error is returned.
*
* On success the port is ready to use and the line number is returned.
*/
int serial8250_register_port(struct uart_port *port)
{
struct uart_8250_port up;
memset(&up, 0, sizeof(up));
memcpy(&up.port, port, sizeof(*port));
return serial8250_register_8250_port(&up);
}
EXPORT_SYMBOL(serial8250_register_port);
/** /**
* serial8250_unregister_port - remove a 16x50 serial port at runtime * serial8250_unregister_port - remove a 16x50 serial port at runtime
* @line: serial line number * @line: serial line number
......
...@@ -43,7 +43,7 @@ serial_card_probe(struct expansion_card *ec, const struct ecard_id *id) ...@@ -43,7 +43,7 @@ serial_card_probe(struct expansion_card *ec, const struct ecard_id *id)
{ {
struct serial_card_info *info; struct serial_card_info *info;
struct serial_card_type *type = id->data; struct serial_card_type *type = id->data;
struct uart_port port; struct uart_8250_port uart;
unsigned long bus_addr; unsigned long bus_addr;
unsigned int i; unsigned int i;
...@@ -62,19 +62,19 @@ serial_card_probe(struct expansion_card *ec, const struct ecard_id *id) ...@@ -62,19 +62,19 @@ serial_card_probe(struct expansion_card *ec, const struct ecard_id *id)
ecard_set_drvdata(ec, info); ecard_set_drvdata(ec, info);
memset(&port, 0, sizeof(struct uart_port)); memset(&uart, 0, sizeof(struct uart_8250_port));
port.irq = ec->irq; uart.port.irq = ec->irq;
port.flags = UPF_BOOT_AUTOCONF | UPF_SHARE_IRQ; uart.port.flags = UPF_BOOT_AUTOCONF | UPF_SHARE_IRQ;
port.uartclk = type->uartclk; uart.port.uartclk = type->uartclk;
port.iotype = UPIO_MEM; uart.port.iotype = UPIO_MEM;
port.regshift = 2; uart.port.regshift = 2;
port.dev = &ec->dev; uart.port.dev = &ec->dev;
for (i = 0; i < info->num_ports; i ++) { for (i = 0; i < info->num_ports; i ++) {
port.membase = info->vaddr + type->offset[i]; uart.port.membase = info->vaddr + type->offset[i];
port.mapbase = bus_addr + type->offset[i]; uart.port.mapbase = bus_addr + type->offset[i];
info->ports[i] = serial8250_register_port(&port); info->ports[i] = serial8250_register_8250_port(&uart);
} }
return 0; return 0;
......
...@@ -89,7 +89,7 @@ static int dw8250_handle_irq(struct uart_port *p) ...@@ -89,7 +89,7 @@ static int dw8250_handle_irq(struct uart_port *p)
static int __devinit dw8250_probe(struct platform_device *pdev) static int __devinit dw8250_probe(struct platform_device *pdev)
{ {
struct uart_port port = {}; struct uart_8250_port uart = {};
struct resource *regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); struct resource *regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
struct resource *irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); struct resource *irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
struct device_node *np = pdev->dev.of_node; struct device_node *np = pdev->dev.of_node;
...@@ -104,28 +104,28 @@ static int __devinit dw8250_probe(struct platform_device *pdev) ...@@ -104,28 +104,28 @@ static int __devinit dw8250_probe(struct platform_device *pdev)
data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
if (!data) if (!data)
return -ENOMEM; return -ENOMEM;
port.private_data = data; uart.port.private_data = data;
spin_lock_init(&port.lock); spin_lock_init(&uart.port.lock);
port.mapbase = regs->start; uart.port.mapbase = regs->start;
port.irq = irq->start; uart.port.irq = irq->start;
port.handle_irq = dw8250_handle_irq; uart.port.handle_irq = dw8250_handle_irq;
port.type = PORT_8250; uart.port.type = PORT_8250;
port.flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF | UPF_IOREMAP | uart.port.flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF | UPF_IOREMAP |
UPF_FIXED_PORT | UPF_FIXED_TYPE; UPF_FIXED_PORT | UPF_FIXED_TYPE;
port.dev = &pdev->dev; uart.port.dev = &pdev->dev;
port.iotype = UPIO_MEM; uart.port.iotype = UPIO_MEM;
port.serial_in = dw8250_serial_in; uart.port.serial_in = dw8250_serial_in;
port.serial_out = dw8250_serial_out; uart.port.serial_out = dw8250_serial_out;
if (!of_property_read_u32(np, "reg-io-width", &val)) { if (!of_property_read_u32(np, "reg-io-width", &val)) {
switch (val) { switch (val) {
case 1: case 1:
break; break;
case 4: case 4:
port.iotype = UPIO_MEM32; uart.port.iotype = UPIO_MEM32;
port.serial_in = dw8250_serial_in32; uart.port.serial_in = dw8250_serial_in32;
port.serial_out = dw8250_serial_out32; uart.port.serial_out = dw8250_serial_out32;
break; break;
default: default:
dev_err(&pdev->dev, "unsupported reg-io-width (%u)\n", dev_err(&pdev->dev, "unsupported reg-io-width (%u)\n",
...@@ -135,15 +135,15 @@ static int __devinit dw8250_probe(struct platform_device *pdev) ...@@ -135,15 +135,15 @@ static int __devinit dw8250_probe(struct platform_device *pdev)
} }
if (!of_property_read_u32(np, "reg-shift", &val)) if (!of_property_read_u32(np, "reg-shift", &val))
port.regshift = val; uart.port.regshift = val;
if (of_property_read_u32(np, "clock-frequency", &val)) { if (of_property_read_u32(np, "clock-frequency", &val)) {
dev_err(&pdev->dev, "no clock-frequency property set\n"); dev_err(&pdev->dev, "no clock-frequency property set\n");
return -EINVAL; return -EINVAL;
} }
port.uartclk = val; uart.uart.port.uartclk = val;
data->line = serial8250_register_port(&port); data->line = serial8250_register_8250_port(&uart);
if (data->line < 0) if (data->line < 0)
return data->line; return data->line;
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
static int __init serial_init_chip(struct parisc_device *dev) static int __init serial_init_chip(struct parisc_device *dev)
{ {
struct uart_port port; struct uart_8250_port uart;
unsigned long address; unsigned long address;
int err; int err;
...@@ -48,21 +48,21 @@ static int __init serial_init_chip(struct parisc_device *dev) ...@@ -48,21 +48,21 @@ static int __init serial_init_chip(struct parisc_device *dev)
if (dev->id.sversion != 0x8d) if (dev->id.sversion != 0x8d)
address += 0x800; address += 0x800;
memset(&port, 0, sizeof(port)); memset(&uart, 0, sizeof(uart));
port.iotype = UPIO_MEM; uart.port.iotype = UPIO_MEM;
/* 7.272727MHz on Lasi. Assumed the same for Dino, Wax and Timi. */ /* 7.272727MHz on Lasi. Assumed the same for Dino, Wax and Timi. */
port.uartclk = 7272727; uart.port.uartclk = 7272727;
port.mapbase = address; uart.port.mapbase = address;
port.membase = ioremap_nocache(address, 16); uart.port.membase = ioremap_nocache(address, 16);
port.irq = dev->irq; uart.port.irq = dev->irq;
port.flags = UPF_BOOT_AUTOCONF; uart.port.flags = UPF_BOOT_AUTOCONF;
port.dev = &dev->dev; uart.port.dev = &dev->dev;
err = serial8250_register_port(&port); err = serial8250_register_8250_port(&uart);
if (err < 0) { if (err < 0) {
printk(KERN_WARNING printk(KERN_WARNING
"serial8250_register_port returned error %d\n", err); "serial8250_register_8250_port returned error %d\n", err);
iounmap(port.membase); iounmap(uart.port.membase);
return err; return err;
} }
......
...@@ -171,7 +171,7 @@ static int __devinit hpdca_init_one(struct dio_dev *d, ...@@ -171,7 +171,7 @@ static int __devinit hpdca_init_one(struct dio_dev *d,
return 0; return 0;
} }
#endif #endif
memset(&port, 0, sizeof(struct uart_port)); memset(&uart, 0, sizeof(uart));
/* Memory mapped I/O */ /* Memory mapped I/O */
port.iotype = UPIO_MEM; port.iotype = UPIO_MEM;
...@@ -182,7 +182,7 @@ static int __devinit hpdca_init_one(struct dio_dev *d, ...@@ -182,7 +182,7 @@ static int __devinit hpdca_init_one(struct dio_dev *d,
port.membase = (char *)(port.mapbase + DIO_VIRADDRBASE); port.membase = (char *)(port.mapbase + DIO_VIRADDRBASE);
port.regshift = 1; port.regshift = 1;
port.dev = &d->dev; port.dev = &d->dev;
line = serial8250_register_port(&port); line = serial8250_register_8250_port(&uart);
if (line < 0) { if (line < 0) {
printk(KERN_NOTICE "8250_hp300: register_serial() DCA scode %d" printk(KERN_NOTICE "8250_hp300: register_serial() DCA scode %d"
...@@ -210,7 +210,7 @@ static int __init hp300_8250_init(void) ...@@ -210,7 +210,7 @@ static int __init hp300_8250_init(void)
#ifdef CONFIG_HPAPCI #ifdef CONFIG_HPAPCI
int line; int line;
unsigned long base; unsigned long base;
struct uart_port uport; struct uart_8250_port uart;
struct hp300_port *port; struct hp300_port *port;
int i; int i;
#endif #endif
...@@ -248,26 +248,26 @@ static int __init hp300_8250_init(void) ...@@ -248,26 +248,26 @@ static int __init hp300_8250_init(void)
if (!port) if (!port)
return -ENOMEM; return -ENOMEM;
memset(&uport, 0, sizeof(struct uart_port)); memset(&uart, 0, sizeof(uart));
base = (FRODO_BASE + FRODO_APCI_OFFSET(i)); base = (FRODO_BASE + FRODO_APCI_OFFSET(i));
/* Memory mapped I/O */ /* Memory mapped I/O */
uport.iotype = UPIO_MEM; uart.port.iotype = UPIO_MEM;
uport.flags = UPF_SKIP_TEST | UPF_SHARE_IRQ \ uart.port.flags = UPF_SKIP_TEST | UPF_SHARE_IRQ \
| UPF_BOOT_AUTOCONF; | UPF_BOOT_AUTOCONF;
/* XXX - no interrupt support yet */ /* XXX - no interrupt support yet */
uport.irq = 0; uart.port.irq = 0;
uport.uartclk = HPAPCI_BAUD_BASE * 16; uart.port.uartclk = HPAPCI_BAUD_BASE * 16;
uport.mapbase = base; uart.port.mapbase = base;
uport.membase = (char *)(base + DIO_VIRADDRBASE); uart.port.membase = (char *)(base + DIO_VIRADDRBASE);
uport.regshift = 2; uart.port.regshift = 2;
line = serial8250_register_port(&uport); line = serial8250_register_8250_port(&uart);
if (line < 0) { if (line < 0) {
printk(KERN_NOTICE "8250_hp300: register_serial() APCI" printk(KERN_NOTICE "8250_hp300: register_serial() APCI"
" %d irq %d failed\n", i, uport.irq); " %d irq %d failed\n", i, uart.port.irq);
kfree(port); kfree(port);
continue; continue;
} }
......
...@@ -44,7 +44,7 @@ struct pci_serial_quirk { ...@@ -44,7 +44,7 @@ struct pci_serial_quirk {
int (*init)(struct pci_dev *dev); int (*init)(struct pci_dev *dev);
int (*setup)(struct serial_private *, int (*setup)(struct serial_private *,
const struct pciserial_board *, const struct pciserial_board *,
struct uart_port *, int); struct uart_8250_port *, int);
void (*exit)(struct pci_dev *dev); void (*exit)(struct pci_dev *dev);
}; };
...@@ -59,7 +59,7 @@ struct serial_private { ...@@ -59,7 +59,7 @@ struct serial_private {
}; };
static int pci_default_setup(struct serial_private*, static int pci_default_setup(struct serial_private*,
const struct pciserial_board*, struct uart_port*, int); const struct pciserial_board*, struct uart_8250_port *, int);
static void moan_device(const char *str, struct pci_dev *dev) static void moan_device(const char *str, struct pci_dev *dev)
{ {
...@@ -74,7 +74,7 @@ static void moan_device(const char *str, struct pci_dev *dev) ...@@ -74,7 +74,7 @@ static void moan_device(const char *str, struct pci_dev *dev)
} }
static int static int
setup_port(struct serial_private *priv, struct uart_port *port, setup_port(struct serial_private *priv, struct uart_8250_port *port,
int bar, int offset, int regshift) int bar, int offset, int regshift)
{ {
struct pci_dev *dev = priv->dev; struct pci_dev *dev = priv->dev;
...@@ -93,17 +93,17 @@ setup_port(struct serial_private *priv, struct uart_port *port, ...@@ -93,17 +93,17 @@ setup_port(struct serial_private *priv, struct uart_port *port,
if (!priv->remapped_bar[bar]) if (!priv->remapped_bar[bar])
return -ENOMEM; return -ENOMEM;
port->iotype = UPIO_MEM; port->port.iotype = UPIO_MEM;
port->iobase = 0; port->port.iobase = 0;
port->mapbase = base + offset; port->port.mapbase = base + offset;
port->membase = priv->remapped_bar[bar] + offset; port->port.membase = priv->remapped_bar[bar] + offset;
port->regshift = regshift; port->port.regshift = regshift;
} else { } else {
port->iotype = UPIO_PORT; port->port.iotype = UPIO_PORT;
port->iobase = base + offset; port->port.iobase = base + offset;
port->mapbase = 0; port->port.mapbase = 0;
port->membase = NULL; port->port.membase = NULL;
port->regshift = 0; port->port.regshift = 0;
} }
return 0; return 0;
} }
...@@ -113,7 +113,7 @@ setup_port(struct serial_private *priv, struct uart_port *port, ...@@ -113,7 +113,7 @@ setup_port(struct serial_private *priv, struct uart_port *port,
*/ */
static int addidata_apci7800_setup(struct serial_private *priv, static int addidata_apci7800_setup(struct serial_private *priv,
const struct pciserial_board *board, const struct pciserial_board *board,
struct uart_port *port, int idx) struct uart_8250_port *port, int idx)
{ {
unsigned int bar = 0, offset = board->first_offset; unsigned int bar = 0, offset = board->first_offset;
bar = FL_GET_BASE(board->flags); bar = FL_GET_BASE(board->flags);
...@@ -140,7 +140,7 @@ static int addidata_apci7800_setup(struct serial_private *priv, ...@@ -140,7 +140,7 @@ static int addidata_apci7800_setup(struct serial_private *priv,
*/ */
static int static int
afavlab_setup(struct serial_private *priv, const struct pciserial_board *board, afavlab_setup(struct serial_private *priv, const struct pciserial_board *board,
struct uart_port *port, int idx) struct uart_8250_port *port, int idx)
{ {
unsigned int bar, offset = board->first_offset; unsigned int bar, offset = board->first_offset;
...@@ -195,7 +195,7 @@ static int pci_hp_diva_init(struct pci_dev *dev) ...@@ -195,7 +195,7 @@ static int pci_hp_diva_init(struct pci_dev *dev)
static int static int
pci_hp_diva_setup(struct serial_private *priv, pci_hp_diva_setup(struct serial_private *priv,
const struct pciserial_board *board, const struct pciserial_board *board,
struct uart_port *port, int idx) struct uart_8250_port *port, int idx)
{ {
unsigned int offset = board->first_offset; unsigned int offset = board->first_offset;
unsigned int bar = FL_GET_BASE(board->flags); unsigned int bar = FL_GET_BASE(board->flags);
...@@ -370,7 +370,7 @@ static void __devexit pci_ni8430_exit(struct pci_dev *dev) ...@@ -370,7 +370,7 @@ static void __devexit pci_ni8430_exit(struct pci_dev *dev)
/* SBS Technologies Inc. PMC-OCTPRO and P-OCTAL cards */ /* SBS Technologies Inc. PMC-OCTPRO and P-OCTAL cards */
static int static int
sbs_setup(struct serial_private *priv, const struct pciserial_board *board, sbs_setup(struct serial_private *priv, const struct pciserial_board *board,
struct uart_port *port, int idx) struct uart_8250_port *port, int idx)
{ {
unsigned int bar, offset = board->first_offset; unsigned int bar, offset = board->first_offset;
...@@ -525,7 +525,7 @@ static int pci_siig_init(struct pci_dev *dev) ...@@ -525,7 +525,7 @@ static int pci_siig_init(struct pci_dev *dev)
static int pci_siig_setup(struct serial_private *priv, static int pci_siig_setup(struct serial_private *priv,
const struct pciserial_board *board, const struct pciserial_board *board,
struct uart_port *port, int idx) struct uart_8250_port *port, int idx)
{ {
unsigned int bar = FL_GET_BASE(board->flags) + idx, offset = 0; unsigned int bar = FL_GET_BASE(board->flags) + idx, offset = 0;
...@@ -619,7 +619,7 @@ static int pci_timedia_init(struct pci_dev *dev) ...@@ -619,7 +619,7 @@ static int pci_timedia_init(struct pci_dev *dev)
static int static int
pci_timedia_setup(struct serial_private *priv, pci_timedia_setup(struct serial_private *priv,
const struct pciserial_board *board, const struct pciserial_board *board,
struct uart_port *port, int idx) struct uart_8250_port *port, int idx)
{ {
unsigned int bar = 0, offset = board->first_offset; unsigned int bar = 0, offset = board->first_offset;
...@@ -653,7 +653,7 @@ pci_timedia_setup(struct serial_private *priv, ...@@ -653,7 +653,7 @@ pci_timedia_setup(struct serial_private *priv,
static int static int
titan_400l_800l_setup(struct serial_private *priv, titan_400l_800l_setup(struct serial_private *priv,
const struct pciserial_board *board, const struct pciserial_board *board,
struct uart_port *port, int idx) struct uart_8250_port *port, int idx)
{ {
unsigned int bar, offset = board->first_offset; unsigned int bar, offset = board->first_offset;
...@@ -754,7 +754,7 @@ static int pci_ni8430_init(struct pci_dev *dev) ...@@ -754,7 +754,7 @@ static int pci_ni8430_init(struct pci_dev *dev)
static int static int
pci_ni8430_setup(struct serial_private *priv, pci_ni8430_setup(struct serial_private *priv,
const struct pciserial_board *board, const struct pciserial_board *board,
struct uart_port *port, int idx) struct uart_8250_port *port, int idx)
{ {
void __iomem *p; void __iomem *p;
unsigned long base, len; unsigned long base, len;
...@@ -781,7 +781,7 @@ pci_ni8430_setup(struct serial_private *priv, ...@@ -781,7 +781,7 @@ pci_ni8430_setup(struct serial_private *priv,
static int pci_netmos_9900_setup(struct serial_private *priv, static int pci_netmos_9900_setup(struct serial_private *priv,
const struct pciserial_board *board, const struct pciserial_board *board,
struct uart_port *port, int idx) struct uart_8250_port *port, int idx)
{ {
unsigned int bar; unsigned int bar;
...@@ -1035,7 +1035,7 @@ static int pci_oxsemi_tornado_init(struct pci_dev *dev) ...@@ -1035,7 +1035,7 @@ static int pci_oxsemi_tornado_init(struct pci_dev *dev)
static int static int
pci_default_setup(struct serial_private *priv, pci_default_setup(struct serial_private *priv,
const struct pciserial_board *board, const struct pciserial_board *board,
struct uart_port *port, int idx) struct uart_8250_port *port, int idx)
{