Commit 8ae584e0 authored by Dave Jones's avatar Dave Jones

[PATCH] Extra cards support for MOXA driver

parent 32019cbc
...@@ -32,6 +32,9 @@ ...@@ -32,6 +32,9 @@
* version : 1.2 * version : 1.2
* *
* Fixes for C104H/PCI by Tim Hockin <thockin@sun.com> * Fixes for C104H/PCI by Tim Hockin <thockin@sun.com>
* Added support for: C102, CI-132, CI-134, CP-132, CP-114, CT-114 cards
* by Damian Wrobel <dwrobel@ertel.com.pl>
*
*/ */
#include <linux/config.h> #include <linux/config.h>
...@@ -61,7 +64,7 @@ ...@@ -61,7 +64,7 @@
#include <asm/bitops.h> #include <asm/bitops.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#define MXSER_VERSION "1.2" #define MXSER_VERSION "1.2.1"
#define MXSERMAJOR 174 #define MXSERMAJOR 174
#define MXSERCUMAJOR 175 #define MXSERCUMAJOR 175
...@@ -114,10 +117,22 @@ ...@@ -114,10 +117,22 @@
#ifndef PCI_DEVICE_ID_C104 #ifndef PCI_DEVICE_ID_C104
#define PCI_DEVICE_ID_C104 0x1040 #define PCI_DEVICE_ID_C104 0x1040
#endif #endif
#ifndef PCI_DEVICE_ID_CP132
#define PCI_DEVICE_ID_CP132 0x1320
#endif
#ifndef PCI_DEVICE_ID_CP114
#define PCI_DEVICE_ID_CP114 0x1141
#endif
#ifndef PCI_DEVICE_ID_CT114
#define PCI_DEVICE_ID_CT114 0x1140
#endif
#define C168_ASIC_ID 1 #define C168_ASIC_ID 1
#define C104_ASIC_ID 2 #define C104_ASIC_ID 2
#define CI134_ASIC_ID 3
#define CI132_ASIC_ID 4
#define CI104J_ASIC_ID 5 #define CI104J_ASIC_ID 5
#define C102_ASIC_ID 0xB
enum { enum {
MXSER_BOARD_C168_ISA = 0, MXSER_BOARD_C168_ISA = 0,
...@@ -125,6 +140,12 @@ enum { ...@@ -125,6 +140,12 @@ enum {
MXSER_BOARD_CI104J, MXSER_BOARD_CI104J,
MXSER_BOARD_C168_PCI, MXSER_BOARD_C168_PCI,
MXSER_BOARD_C104_PCI, MXSER_BOARD_C104_PCI,
MXSER_BOARD_C102_ISA,
MXSER_BOARD_CI132,
MXSER_BOARD_CI134,
MXSER_BOARD_CP132_PCI,
MXSER_BOARD_CP114_PCI,
MXSER_BOARD_CT114_PCI
}; };
static char *mxser_brdname[] = static char *mxser_brdname[] =
...@@ -134,6 +155,12 @@ static char *mxser_brdname[] = ...@@ -134,6 +155,12 @@ static char *mxser_brdname[] =
"CI-104J series", "CI-104J series",
"C168H/PCI series", "C168H/PCI series",
"C104H/PCI series", "C104H/PCI series",
"C102 series",
"CI-132 series",
"CI-134 series",
"CP-132 series",
"CP-114 series",
"CT-114 series"
}; };
static int mxser_numports[] = static int mxser_numports[] =
...@@ -143,6 +170,12 @@ static int mxser_numports[] = ...@@ -143,6 +170,12 @@ static int mxser_numports[] =
4, 4,
8, 8,
4, 4,
2,
2,
4,
2,
4,
4
}; };
/* /*
...@@ -163,6 +196,12 @@ static struct pci_device_id mxser_pcibrds[] = { ...@@ -163,6 +196,12 @@ static struct pci_device_id mxser_pcibrds[] = {
MXSER_BOARD_C168_PCI }, MXSER_BOARD_C168_PCI },
{ PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_C104, PCI_ANY_ID, PCI_ANY_ID, 0, 0, { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_C104, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
MXSER_BOARD_C104_PCI }, MXSER_BOARD_C104_PCI },
{ PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_CP132, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
MXSER_BOARD_CP132_PCI },
{ PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_CP114, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
MXSER_BOARD_CP114_PCI },
{ PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_CT114, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
MXSER_BOARD_CT114_PCI },
{ 0 } { 0 }
}; };
MODULE_DEVICE_TABLE(pci, mxser_pcibrds); MODULE_DEVICE_TABLE(pci, mxser_pcibrds);
...@@ -613,9 +652,9 @@ int mxser_init(void) ...@@ -613,9 +652,9 @@ int mxser_init(void)
n = (sizeof(mxser_pcibrds) / sizeof(mxser_pcibrds[0])) - 1; n = (sizeof(mxser_pcibrds) / sizeof(mxser_pcibrds[0])) - 1;
index = 0; index = 0;
for (b = 0; b < n; b++) { for (b = 0; b < n; b++) {
pdev = pci_find_device(mxser_pcibrds[b].vendor, while (pdev = pci_find_device(mxser_pcibrds[b].vendor, mxser_pcibrds[b].device, pdev))
mxser_pcibrds[b].device, pdev); {
if (!pdev || pci_enable_device(pdev)) if (pci_enable_device(pdev))
continue; continue;
hwconf.pdev = pdev; hwconf.pdev = pdev;
printk("Found MOXA %s board(BusNo=%d,DevNo=%d)\n", printk("Found MOXA %s board(BusNo=%d,DevNo=%d)\n",
...@@ -624,8 +663,7 @@ int mxser_init(void) ...@@ -624,8 +663,7 @@ int mxser_init(void)
if (m >= MXSER_BOARDS) { if (m >= MXSER_BOARDS) {
printk("Too many Smartio family boards found (maximum %d),board not configured\n", MXSER_BOARDS); printk("Too many Smartio family boards found (maximum %d),board not configured\n", MXSER_BOARDS);
} else { } else {
retval = mxser_get_PCI_conf(pdev, retval = mxser_get_PCI_conf(pdev, mxser_pcibrds[b].driver_data, &hwconf);
mxser_pcibrds[b].driver_data, &hwconf);
if (retval < 0) { if (retval < 0) {
if (retval == MXSER_ERR_IRQ) if (retval == MXSER_ERR_IRQ)
printk("Invalid interrupt number,board not configured\n"); printk("Invalid interrupt number,board not configured\n");
...@@ -636,15 +674,13 @@ int mxser_init(void) ...@@ -636,15 +674,13 @@ int mxser_init(void)
else if (retval == MXSER_ERR_IOADDR) else if (retval == MXSER_ERR_IOADDR)
printk("Invalid I/O address,board not configured\n"); printk("Invalid I/O address,board not configured\n");
continue; continue;
} }
if (mxser_initbrd(m, &hwconf) < 0) if (mxser_initbrd(m, &hwconf) < 0)
continue; continue;
mxser_getcfg(m, &hwconf); mxser_getcfg(m, &hwconf);
m++; m++;
} }
}
} }
} }
#endif #endif
...@@ -2306,6 +2342,12 @@ static int mxser_get_ISA_conf(int cap, struct mxser_hwconf *hwconf) ...@@ -2306,6 +2342,12 @@ static int mxser_get_ISA_conf(int cap, struct mxser_hwconf *hwconf)
hwconf->board_type = MXSER_BOARD_C168_ISA; hwconf->board_type = MXSER_BOARD_C168_ISA;
else if (id == C104_ASIC_ID) else if (id == C104_ASIC_ID)
hwconf->board_type = MXSER_BOARD_C104_ISA; hwconf->board_type = MXSER_BOARD_C104_ISA;
else if (id == C102_ASIC_ID)
hwconf->board_type = MXSER_BOARD_C102_ISA;
else if (id == CI132_ASIC_ID)
hwconf->board_type = MXSER_BOARD_CI132;
else if (id == CI134_ASIC_ID)
hwconf->board_type = MXSER_BOARD_CI134;
else if (id == CI104J_ASIC_ID) else if (id == CI104J_ASIC_ID)
hwconf->board_type = MXSER_BOARD_CI104J; hwconf->board_type = MXSER_BOARD_CI104J;
else else
...@@ -2417,7 +2459,8 @@ static int mxser_program_mode(int port) ...@@ -2417,7 +2459,8 @@ static int mxser_program_mode(int port)
(void) inb(port); (void) inb(port);
restore_flags(flags); restore_flags(flags);
id = inb(port + 1) & 0x1F; id = inb(port + 1) & 0x1F;
if ((id != C168_ASIC_ID) && (id != C104_ASIC_ID) && (id != CI104J_ASIC_ID)) if ((id != C168_ASIC_ID) && (id != C104_ASIC_ID) && (id != CI104J_ASIC_ID) &&
(id != C102_ASIC_ID) && (id != CI132_ASIC_ID) && (id != CI134_ASIC_ID))
return (-1); return (-1);
for (i = 0, j = 0; i < 4; i++) { for (i = 0, j = 0; i < 4; i++) {
n = inb(port + 2); n = inb(port + 2);
......
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