aboutsummaryrefslogtreecommitdiffstats
diff options
-rw-r--r--serial-8250_pci-add-support-for-fintek-4-8-and-12-port-cards.patch177
1 files changed, 73 insertions, 104 deletions
diff --git a/serial-8250_pci-add-support-for-fintek-4-8-and-12-port-cards.patch b/serial-8250_pci-add-support-for-fintek-4-8-and-12-port-cards.patch
index b0c2169d2cf458..a4fa431cc339ca 100644
--- a/serial-8250_pci-add-support-for-fintek-4-8-and-12-port-cards.patch
+++ b/serial-8250_pci-add-support-for-fintek-4-8-and-12-port-cards.patch
@@ -16,21 +16,28 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
- drivers/tty/serial/8250/8250_pci.c | 162 ++++++++++++++++++++++++++++++++++++-
- 1 file changed, 161 insertions(+), 1 deletion(-)
+ drivers/tty/serial/8250/8250_pci.c | 114 +++++++++++++++++++++++++++++++++++--
+ 1 file changed, 108 insertions(+), 6 deletions(-)
--- a/drivers/tty/serial/8250/8250_pci.c
+++ b/drivers/tty/serial/8250/8250_pci.c
-@@ -27,7 +27,7 @@
+@@ -9,6 +9,7 @@
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License.
+ */
++#define DEBUG
+ #include <linux/module.h>
+ #include <linux/init.h>
+ #include <linux/pci.h>
+@@ -27,7 +28,6 @@
#include "8250.h"
-#undef SERIAL_DEBUG_PCI
-+#define SERIAL_DEBUG_PCI
/*
* init function returns:
-@@ -1344,6 +1344,122 @@ pci_brcm_trumanage_setup(struct serial_p
+@@ -1344,6 +1344,60 @@ pci_brcm_trumanage_setup(struct serial_p
return ret;
}
@@ -38,122 +45,60 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+ const struct pciserial_board *board,
+ struct uart_8250_port *port, int idx)
+{
-+ int iobase;
-+ int ret;
++ unsigned long base;
++ unsigned long iobase;
++ unsigned long ciobase = 0;
+
+ /* FIXME: read these from the PCI config space */
+ switch (idx) {
-+ case 0:
-+ iobase = 0xe000;
-+ break;
-+ case 1:
-+ iobase = 0xe008;
-+ break;
-+ case 2:
-+ iobase = 0xe010;
-+ break;
-+ case 3:
-+ iobase = 0xe018;
-+ break;
-+ case 4:
-+ iobase = 0xe020;
-+ break;
-+ case 5:
-+ iobase = 0xe028;
-+ break;
-+ case 6:
-+ iobase = 0xe030;
-+ break;
-+ case 7:
-+ iobase = 0xe038;
-+ break;
-+ case 8:
-+ iobase = 0xe040;
-+ break;
-+ case 9:
-+ iobase = 0xe048;
-+ break;
-+ case 10:
-+ iobase = 0xe050;
-+ break;
-+ case 11:
-+ iobase = 0xe058;
-+ break;
++ case 0: iobase = 0xe000; break;
++ case 1: iobase = 0xe008; break;
++ case 2: iobase = 0xe010; break;
++ case 3: iobase = 0xe018; break;
++ case 4: iobase = 0xe020; break;
++ case 5: iobase = 0xe028; break;
++ case 6: iobase = 0xe030; break;
++ case 7: iobase = 0xe038; break;
++ case 8: iobase = 0xe040; break;
++ case 9: iobase = 0xe048; break;
++ case 10: iobase = 0xe050; break;
++ case 11: iobase = 0xe058; break;
+ default:
+ /* Unknown number of ports, get out of here */
+ return -EINVAL;
+ }
++
++ dev_dbg(&priv->dev->dev, "bar 0 = %lx\n", (unsigned long)pci_resource_start(priv->dev, 0));
++ dev_dbg(&priv->dev->dev, "bar 1 = %lx\n", (unsigned long)pci_resource_start(priv->dev, 1));
++ dev_dbg(&priv->dev->dev, "bar 2 = %lx\n", (unsigned long)pci_resource_start(priv->dev, 2));
++ dev_dbg(&priv->dev->dev, "bar 3 = %lx\n", (unsigned long)pci_resource_start(priv->dev, 3));
++ dev_dbg(&priv->dev->dev, "bar 4 = %lx\n", (unsigned long)pci_resource_start(priv->dev, 4));
++ dev_dbg(&priv->dev->dev, "bar 5 = %lx\n", (unsigned long)pci_resource_start(priv->dev, 5));
++ dev_dbg(&priv->dev->dev, "bar 6 = %lx\n", (unsigned long)pci_resource_start(priv->dev, 6));
++
++ if (idx < 4) {
++ base = pci_resource_start(priv->dev, 3);
++ ciobase = (int)(base + (0x8 * idx));
++ }
++
++ dev_dbg(&priv->dev->dev, "%s: iobase=%lx ciobase=%lx\n", __func__, iobase, ciobase);
++
+ port->port.iotype = UPIO_PORT;
+ port->port.iobase = iobase;
+ port->port.mapbase = 0;
+ port->port.membase = NULL;
+ port->port.regshift = 0;
+
-+// ret = pci_default_setup(priv, board, port, idx);
-+ return 0;
-+#if 0
-+static int
-+setup_port(struct serial_private *priv, struct uart_8250_port *port,
-+ int bar, int offset, int regshift)
-+{
-+ struct pci_dev *dev = priv->dev;
-+ unsigned long base, len;
-+
-+ if (bar >= PCI_NUM_BAR_RESOURCES)
-+ return -EINVAL;
-+
-+ base = pci_resource_start(dev, bar);
-+
-+ if (pci_resource_flags(dev, bar) & IORESOURCE_MEM) {
-+ len = pci_resource_len(dev, bar);
-+
-+ if (!priv->remapped_bar[bar])
-+ priv->remapped_bar[bar] = ioremap_nocache(base, len);
-+ if (!priv->remapped_bar[bar])
-+ return -ENOMEM;
++ dev_dbg(&priv->dev->dev, "%s: idx=%d iobase=%lx\n",
++ __func__, idx, iobase);
+
-+ port->port.iotype = UPIO_MEM;
-+ port->port.iobase = 0;
-+ port->port.mapbase = base + offset;
-+ port->port.membase = priv->remapped_bar[bar] + offset;
-+ port->port.regshift = regshift;
-+ } else {
-+ port->port.iotype = UPIO_PORT;
-+ port->port.iobase = base + offset;
-+ port->port.mapbase = 0;
-+ port->port.membase = NULL;
-+ port->port.regshift = 0;
-+ }
+ return 0;
+}
-+static int pci_default_setup(struct serial_private *priv,
-+ const struct pciserial_board *board,
-+ struct uart_8250_port *port, int idx)
-+{
-+ unsigned int bar, offset = board->first_offset, maxnr;
-+
-+ bar = FL_GET_BASE(board->flags);
-+ if (board->flags & FL_BASE_BARS)
-+ bar += idx;
-+ else
-+ offset += idx * board->uart_offset;
-+
-+ maxnr = (pci_resource_len(priv->dev, bar) - board->first_offset) >>
-+ (board->reg_shift + 3);
-+
-+ if (board->flags & FL_REGION_SZ_CAP && idx >= maxnr)
-+ return 1;
-+
-+ return setup_port(priv, port, bar, offset, board->reg_shift);
-+}
-+#endif
-+
-+}
+
static int skip_tx_en_setup(struct serial_private *priv,
const struct pciserial_board *board,
struct uart_8250_port *port, int idx)
-@@ -2254,6 +2370,27 @@ static struct pci_serial_quirk pci_seria
+@@ -2254,6 +2308,27 @@ static struct pci_serial_quirk pci_seria
.subdevice = PCI_ANY_ID,
.setup = pci_brcm_trumanage_setup,
},
@@ -181,7 +126,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
/*
* Default "match everything" terminator entry
-@@ -2451,6 +2588,9 @@ enum pci_board_num_t {
+@@ -2451,6 +2526,9 @@ enum pci_board_num_t {
pbn_omegapci,
pbn_NETMOS9900_2s_115200,
pbn_brcm_trumanage,
@@ -191,29 +136,53 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
};
/*
-@@ -3201,6 +3341,21 @@ static struct pciserial_board pci_boards
+@@ -3201,6 +3279,24 @@ static struct pciserial_board pci_boards
.reg_shift = 2,
.base_baud = 115200,
},
+ [pbn_fintek_4] = {
+ .num_ports = 4,
+ .uart_offset = 8,
++ .base_baud = 115200,
+ .first_offset = 0x40,
+ },
+ [pbn_fintek_8] = {
+ .num_ports = 8,
+ .uart_offset = 8,
++ .base_baud = 115200,
+ .first_offset = 0x40,
+ },
+ [pbn_fintek_12] = {
+ .num_ports = 12,
+ .uart_offset = 8,
++ .base_baud = 115200,
+ .first_offset = 0x40,
+ },
};
static const struct pci_device_id blacklist[] = {
-@@ -4911,6 +5066,11 @@ static struct pci_device_id serial_pci_t
+@@ -3361,14 +3457,15 @@ pciserial_init_ports(struct pci_dev *dev
+ if (quirk->setup(priv, board, &uart, i))
+ break;
+
+-#ifdef SERIAL_DEBUG_PCI
+- printk(KERN_DEBUG "Setup PCI port: port %lx, irq %d, type %d\n",
+- uart.port.iobase, uart.port.irq, uart.port.iotype);
+-#endif
++ dev_dbg(&dev->dev, "Setup PCI port: port %lx, irq %d, type %d\n",
++ uart.port.iobase, uart.port.irq, uart.port.iotype);
+
+ priv->line[i] = serial8250_register_8250_port(&uart);
+ if (priv->line[i] < 0) {
+- printk(KERN_WARNING "Couldn't register serial port %s: %d\n", pci_name(dev), priv->line[i]);
++ dev_err(&dev->dev,
++ "Couldn't register serial port %lx, irq %d, type %d, error %d\n",
++ uart.port.iobase, uart.port.irq,
++ uart.port.iotype, priv->line[i]);
+ break;
+ }
+ }
+@@ -4911,6 +5008,11 @@ static struct pci_device_id serial_pci_t
0,
0, pbn_exar_XR17V358 },