aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/8250_pci.c
diff options
context:
space:
mode:
authorRussell King <rmk+lkml@arm.linux.org.uk>2009-01-02 08:44:20 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-02 13:19:37 -0500
commit9f2a036aaac8f29bb7c68303b52a9263238b63d2 (patch)
tree4e7683190665e2e19c509eeea30aa90504667d9b /drivers/serial/8250_pci.c
parent8c056e5b148498192832678cf2957760945e8c71 (diff)
Convert the oxsemi tornado special cases to use the quirk interface and not
scribble on its own reference structures. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/serial/8250_pci.c')
-rw-r--r--drivers/serial/8250_pci.c91
1 files changed, 51 insertions, 40 deletions
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c
index 5450a0e5ecdb..057b532ccaad 100644
--- a/drivers/serial/8250_pci.c
+++ b/drivers/serial/8250_pci.c
@@ -737,6 +737,38 @@ static void __devexit pci_ite887x_exit(struct pci_dev *dev)
737 release_region(ioport, ITE_887x_IOSIZE); 737 release_region(ioport, ITE_887x_IOSIZE);
738} 738}
739 739
740/*
741 * Oxford Semiconductor Inc.
742 * Check that device is part of the Tornado range of devices, then determine
743 * the number of ports available on the device.
744 */
745static int pci_oxsemi_tornado_init(struct pci_dev *dev)
746{
747 u8 __iomem *p;
748 unsigned long deviceID;
749 unsigned int number_uarts = 0;
750
751 /* OxSemi Tornado devices are all 0xCxxx */
752 if (dev->vendor == PCI_VENDOR_ID_OXSEMI &&
753 (dev->device & 0xF000) != 0xC000)
754 return 0;
755
756 p = pci_iomap(dev, 0, 5);
757 if (p == NULL)
758 return -ENOMEM;
759
760 deviceID = ioread32(p);
761 /* Tornado device */
762 if (deviceID == 0x07000200) {
763 number_uarts = ioread8(p + 4);
764 printk(KERN_DEBUG
765 "%d ports detected on Oxford PCI Express device\n",
766 number_uarts);
767 }
768 pci_iounmap(dev, p);
769 return number_uarts;
770}
771
740static int 772static int
741pci_default_setup(struct serial_private *priv, struct pciserial_board *board, 773pci_default_setup(struct serial_private *priv, struct pciserial_board *board,
742 struct uart_port *port, int idx) 774 struct uart_port *port, int idx)
@@ -1018,6 +1050,25 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = {
1018 .setup = pci_default_setup, 1050 .setup = pci_default_setup,
1019 }, 1051 },
1020 /* 1052 /*
1053 * For Oxford Semiconductor and Mainpine
1054 */
1055 {
1056 .vendor = PCI_VENDOR_ID_OXSEMI,
1057 .device = PCI_ANY_ID,
1058 .subvendor = PCI_ANY_ID,
1059 .subdevice = PCI_ANY_ID,
1060 .init = pci_oxsemi_tornado_init,
1061 .setup = pci_default_setup,
1062 },
1063 {
1064 .vendor = PCI_VENDOR_ID_MAINPINE,
1065 .device = PCI_ANY_ID,
1066 .subvendor = PCI_ANY_ID,
1067 .subdevice = PCI_ANY_ID,
1068 .init = pci_oxsemi_tornado_init,
1069 .setup = pci_default_setup,
1070 },
1071 /*
1021 * Default "match everything" terminator entry 1072 * Default "match everything" terminator entry
1022 */ 1073 */
1023 { 1074 {
@@ -1854,39 +1905,6 @@ serial_pci_matches(struct pciserial_board *board,
1854 board->first_offset == guessed->first_offset; 1905 board->first_offset == guessed->first_offset;
1855} 1906}
1856 1907
1857/*
1858 * Oxford Semiconductor Inc.
1859 * Check that device is part of the Tornado range of devices, then determine
1860 * the number of ports available on the device.
1861 */
1862static int pci_oxsemi_tornado_init(struct pci_dev *dev, struct pciserial_board *board)
1863{
1864 u8 __iomem *p;
1865 unsigned long deviceID;
1866 unsigned int number_uarts;
1867
1868 /* OxSemi Tornado devices are all 0xCxxx */
1869 if (dev->vendor == PCI_VENDOR_ID_OXSEMI &&
1870 (dev->device & 0xF000) != 0xC000)
1871 return 0;
1872
1873 p = pci_iomap(dev, 0, 5);
1874 if (p == NULL)
1875 return -ENOMEM;
1876
1877 deviceID = ioread32(p);
1878 /* Tornado device */
1879 if (deviceID == 0x07000200) {
1880 number_uarts = ioread8(p + 4);
1881 board->num_ports = number_uarts;
1882 printk(KERN_DEBUG
1883 "%d ports detected on Oxford PCI Express device\n",
1884 number_uarts);
1885 }
1886 pci_iounmap(dev, p);
1887 return 0;
1888}
1889
1890struct serial_private * 1908struct serial_private *
1891pciserial_init_ports(struct pci_dev *dev, struct pciserial_board *board) 1909pciserial_init_ports(struct pci_dev *dev, struct pciserial_board *board)
1892{ 1910{
@@ -1895,13 +1913,6 @@ pciserial_init_ports(struct pci_dev *dev, struct pciserial_board *board)
1895 struct pci_serial_quirk *quirk; 1913 struct pci_serial_quirk *quirk;
1896 int rc, nr_ports, i; 1914 int rc, nr_ports, i;
1897 1915
1898 /*
1899 * Find number of ports on board
1900 */
1901 if (dev->vendor == PCI_VENDOR_ID_OXSEMI ||
1902 dev->vendor == PCI_VENDOR_ID_MAINPINE)
1903 pci_oxsemi_tornado_init(dev, board);
1904
1905 nr_ports = board->num_ports; 1916 nr_ports = board->num_ports;
1906 1917
1907 /* 1918 /*