Commit 9f2a036a authored by Russell King's avatar Russell King Committed by Linus Torvalds

Convert the oxsemi tornado special cases to use the quirk interface and not

scribble on its own reference structures.
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: default avatarAlan Cox <alan@redhat.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 8c056e5b
...@@ -737,6 +737,38 @@ static void __devexit pci_ite887x_exit(struct pci_dev *dev) ...@@ -737,6 +737,38 @@ static void __devexit pci_ite887x_exit(struct pci_dev *dev)
release_region(ioport, ITE_887x_IOSIZE); release_region(ioport, ITE_887x_IOSIZE);
} }
/*
* Oxford Semiconductor Inc.
* Check that device is part of the Tornado range of devices, then determine
* the number of ports available on the device.
*/
static int pci_oxsemi_tornado_init(struct pci_dev *dev)
{
u8 __iomem *p;
unsigned long deviceID;
unsigned int number_uarts = 0;
/* OxSemi Tornado devices are all 0xCxxx */
if (dev->vendor == PCI_VENDOR_ID_OXSEMI &&
(dev->device & 0xF000) != 0xC000)
return 0;
p = pci_iomap(dev, 0, 5);
if (p == NULL)
return -ENOMEM;
deviceID = ioread32(p);
/* Tornado device */
if (deviceID == 0x07000200) {
number_uarts = ioread8(p + 4);
printk(KERN_DEBUG
"%d ports detected on Oxford PCI Express device\n",
number_uarts);
}
pci_iounmap(dev, p);
return number_uarts;
}
static int static int
pci_default_setup(struct serial_private *priv, struct pciserial_board *board, pci_default_setup(struct serial_private *priv, struct pciserial_board *board,
struct uart_port *port, int idx) struct uart_port *port, int idx)
...@@ -1017,6 +1049,25 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = { ...@@ -1017,6 +1049,25 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = {
.init = pci_netmos_init, .init = pci_netmos_init,
.setup = pci_default_setup, .setup = pci_default_setup,
}, },
/*
* For Oxford Semiconductor and Mainpine
*/
{
.vendor = PCI_VENDOR_ID_OXSEMI,
.device = PCI_ANY_ID,
.subvendor = PCI_ANY_ID,
.subdevice = PCI_ANY_ID,
.init = pci_oxsemi_tornado_init,
.setup = pci_default_setup,
},
{
.vendor = PCI_VENDOR_ID_MAINPINE,
.device = PCI_ANY_ID,
.subvendor = PCI_ANY_ID,
.subdevice = PCI_ANY_ID,
.init = pci_oxsemi_tornado_init,
.setup = pci_default_setup,
},
/* /*
* Default "match everything" terminator entry * Default "match everything" terminator entry
*/ */
...@@ -1854,39 +1905,6 @@ serial_pci_matches(struct pciserial_board *board, ...@@ -1854,39 +1905,6 @@ serial_pci_matches(struct pciserial_board *board,
board->first_offset == guessed->first_offset; board->first_offset == guessed->first_offset;
} }
/*
* Oxford Semiconductor Inc.
* Check that device is part of the Tornado range of devices, then determine
* the number of ports available on the device.
*/
static int pci_oxsemi_tornado_init(struct pci_dev *dev, struct pciserial_board *board)
{
u8 __iomem *p;
unsigned long deviceID;
unsigned int number_uarts;
/* OxSemi Tornado devices are all 0xCxxx */
if (dev->vendor == PCI_VENDOR_ID_OXSEMI &&
(dev->device & 0xF000) != 0xC000)
return 0;
p = pci_iomap(dev, 0, 5);
if (p == NULL)
return -ENOMEM;
deviceID = ioread32(p);
/* Tornado device */
if (deviceID == 0x07000200) {
number_uarts = ioread8(p + 4);
board->num_ports = number_uarts;
printk(KERN_DEBUG
"%d ports detected on Oxford PCI Express device\n",
number_uarts);
}
pci_iounmap(dev, p);
return 0;
}
struct serial_private * struct serial_private *
pciserial_init_ports(struct pci_dev *dev, struct pciserial_board *board) pciserial_init_ports(struct pci_dev *dev, struct pciserial_board *board)
{ {
...@@ -1895,13 +1913,6 @@ pciserial_init_ports(struct pci_dev *dev, struct pciserial_board *board) ...@@ -1895,13 +1913,6 @@ pciserial_init_ports(struct pci_dev *dev, struct pciserial_board *board)
struct pci_serial_quirk *quirk; struct pci_serial_quirk *quirk;
int rc, nr_ports, i; int rc, nr_ports, i;
/*
* Find number of ports on board
*/
if (dev->vendor == PCI_VENDOR_ID_OXSEMI ||
dev->vendor == PCI_VENDOR_ID_MAINPINE)
pci_oxsemi_tornado_init(dev, board);
nr_ports = board->num_ports; nr_ports = board->num_ports;
/* /*
......
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