2005-04-16 22:20:36 +00:00
|
|
|
/************************************************************************
|
|
|
|
* Copyright 2003 Digi International (www.digi.com)
|
|
|
|
*
|
|
|
|
* Copyright (C) 2004 IBM Corporation. All rights reserved.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the
|
|
|
|
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* Contact Information:
|
|
|
|
* Scott H Kilau <Scott_Kilau@digi.com>
|
2006-03-31 23:04:20 +00:00
|
|
|
* Wendy Xiong <wendyx@us.ibm.com>
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
2005-07-27 18:43:49 +00:00
|
|
|
*
|
2005-04-16 22:20:36 +00:00
|
|
|
***********************************************************************/
|
2011-05-27 20:14:23 +00:00
|
|
|
#include <linux/module.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
#include <linux/pci.h>
|
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-24 08:04:11 +00:00
|
|
|
#include <linux/slab.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
#include "jsm.h"
|
|
|
|
|
|
|
|
MODULE_AUTHOR("Digi International, http://www.digi.com");
|
2014-11-06 23:05:33 +00:00
|
|
|
MODULE_DESCRIPTION("Driver for the Digi International Neo and Classic PCI based product line");
|
2005-04-16 22:25:44 +00:00
|
|
|
MODULE_LICENSE("GPL");
|
2005-04-16 22:20:36 +00:00
|
|
|
MODULE_SUPPORTED_DEVICE("jsm");
|
|
|
|
|
|
|
|
#define JSM_DRIVER_NAME "jsm"
|
|
|
|
#define NR_PORTS 32
|
|
|
|
#define JSM_MINOR_START 0
|
|
|
|
|
|
|
|
struct uart_driver jsm_uart_driver = {
|
|
|
|
.owner = THIS_MODULE,
|
|
|
|
.driver_name = JSM_DRIVER_NAME,
|
|
|
|
.dev_name = "ttyn",
|
2005-07-27 18:43:48 +00:00
|
|
|
.major = 0,
|
2005-04-16 22:20:36 +00:00
|
|
|
.minor = JSM_MINOR_START,
|
|
|
|
.nr = NR_PORTS,
|
|
|
|
};
|
|
|
|
|
2009-10-14 17:57:51 +00:00
|
|
|
static pci_ers_result_t jsm_io_error_detected(struct pci_dev *pdev,
|
2014-11-06 23:05:33 +00:00
|
|
|
pci_channel_state_t state);
|
2009-10-14 17:57:51 +00:00
|
|
|
static pci_ers_result_t jsm_io_slot_reset(struct pci_dev *pdev);
|
|
|
|
static void jsm_io_resume(struct pci_dev *pdev);
|
|
|
|
|
2012-09-07 16:33:17 +00:00
|
|
|
static const struct pci_error_handlers jsm_err_handler = {
|
2009-10-14 17:57:51 +00:00
|
|
|
.error_detected = jsm_io_error_detected,
|
|
|
|
.slot_reset = jsm_io_slot_reset,
|
|
|
|
.resume = jsm_io_resume,
|
|
|
|
};
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
int jsm_debug;
|
|
|
|
module_param(jsm_debug, int, 0);
|
|
|
|
MODULE_PARM_DESC(jsm_debug, "Driver debugging level");
|
|
|
|
|
2012-11-19 18:21:50 +00:00
|
|
|
static int jsm_probe_one(struct pci_dev *pdev, const struct pci_device_id *ent)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
|
|
|
int rc = 0;
|
2005-04-16 22:25:44 +00:00
|
|
|
struct jsm_board *brd;
|
2014-11-06 23:05:33 +00:00
|
|
|
static int adapter_count;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-04-16 22:25:44 +00:00
|
|
|
rc = pci_enable_device(pdev);
|
|
|
|
if (rc) {
|
|
|
|
dev_err(&pdev->dev, "Device enable FAILED\n");
|
|
|
|
goto out;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2015-12-02 00:06:19 +00:00
|
|
|
rc = pci_request_regions(pdev, JSM_DRIVER_NAME);
|
2005-04-16 22:25:44 +00:00
|
|
|
if (rc) {
|
|
|
|
dev_err(&pdev->dev, "pci_request_region FAILED\n");
|
|
|
|
goto out_disable_device;
|
|
|
|
}
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2014-11-06 23:05:33 +00:00
|
|
|
brd = kzalloc(sizeof(*brd), GFP_KERNEL);
|
2005-04-16 22:20:36 +00:00
|
|
|
if (!brd) {
|
2005-04-16 22:25:44 +00:00
|
|
|
rc = -ENOMEM;
|
|
|
|
goto out_release_regions;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* store the info for the board we've found */
|
2005-04-16 22:25:44 +00:00
|
|
|
brd->boardnum = adapter_count++;
|
2005-04-16 22:20:36 +00:00
|
|
|
brd->pci_dev = pdev;
|
2014-08-30 20:35:57 +00:00
|
|
|
|
|
|
|
switch (pdev->device) {
|
|
|
|
case PCI_DEVICE_ID_NEO_2DB9:
|
|
|
|
case PCI_DEVICE_ID_NEO_2DB9PRI:
|
|
|
|
case PCI_DEVICE_ID_NEO_2RJ45:
|
|
|
|
case PCI_DEVICE_ID_NEO_2RJ45PRI:
|
|
|
|
case PCI_DEVICE_ID_NEO_2_422_485:
|
|
|
|
brd->maxports = 2;
|
|
|
|
break;
|
|
|
|
|
2014-11-06 23:05:33 +00:00
|
|
|
case PCI_DEVICE_ID_CLASSIC_4:
|
|
|
|
case PCI_DEVICE_ID_CLASSIC_4_422:
|
2014-08-30 20:35:57 +00:00
|
|
|
case PCI_DEVICE_ID_NEO_4:
|
|
|
|
case PCIE_DEVICE_ID_NEO_4:
|
|
|
|
case PCIE_DEVICE_ID_NEO_4RJ45:
|
|
|
|
case PCIE_DEVICE_ID_NEO_4_IBM:
|
2008-05-01 11:35:00 +00:00
|
|
|
brd->maxports = 4;
|
2014-08-30 20:35:57 +00:00
|
|
|
break;
|
|
|
|
|
2014-11-06 23:05:33 +00:00
|
|
|
case PCI_DEVICE_ID_CLASSIC_8:
|
|
|
|
case PCI_DEVICE_ID_CLASSIC_8_422:
|
2014-08-30 20:35:57 +00:00
|
|
|
case PCI_DEVICE_ID_DIGI_NEO_8:
|
|
|
|
case PCIE_DEVICE_ID_NEO_8:
|
|
|
|
case PCIE_DEVICE_ID_NEO_8RJ45:
|
2009-02-18 22:48:34 +00:00
|
|
|
brd->maxports = 8;
|
2014-08-30 20:35:57 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
brd->maxports = 1;
|
|
|
|
break;
|
|
|
|
}
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
spin_lock_init(&brd->bd_intr_lock);
|
|
|
|
|
|
|
|
/* store which revision we have */
|
2007-06-08 22:46:36 +00:00
|
|
|
brd->rev = pdev->revision;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
brd->irq = pdev->irq;
|
|
|
|
|
2014-11-06 23:05:33 +00:00
|
|
|
switch (pdev->device) {
|
|
|
|
case PCI_DEVICE_ID_CLASSIC_4:
|
|
|
|
case PCI_DEVICE_ID_CLASSIC_4_422:
|
|
|
|
case PCI_DEVICE_ID_CLASSIC_8:
|
|
|
|
case PCI_DEVICE_ID_CLASSIC_8_422:
|
|
|
|
|
|
|
|
jsm_dbg(INIT, &brd->pci_dev,
|
|
|
|
"jsm_found_board - Classic adapter\n");
|
|
|
|
|
|
|
|
/*
|
|
|
|
* For PCI ClassicBoards
|
|
|
|
* PCI Local Address (.i.e. "resource" number) space
|
|
|
|
* 0 PLX Memory Mapped Config
|
|
|
|
* 1 PLX I/O Mapped Config
|
|
|
|
* 2 I/O Mapped UARTs and Status
|
|
|
|
* 3 Memory Mapped VPD
|
|
|
|
* 4 Memory Mapped UARTs and Status
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Get the PCI Base Address Registers */
|
|
|
|
brd->membase = pci_resource_start(pdev, 4);
|
|
|
|
brd->membase_end = pci_resource_end(pdev, 4);
|
|
|
|
|
|
|
|
if (brd->membase & 0x1)
|
|
|
|
brd->membase &= ~0x3;
|
|
|
|
else
|
|
|
|
brd->membase &= ~0xF;
|
|
|
|
|
|
|
|
brd->iobase = pci_resource_start(pdev, 1);
|
|
|
|
brd->iobase_end = pci_resource_end(pdev, 1);
|
|
|
|
brd->iobase = ((unsigned int)(brd->iobase)) & 0xFFFE;
|
|
|
|
|
|
|
|
/* Assign the board_ops struct */
|
|
|
|
brd->bd_ops = &jsm_cls_ops;
|
|
|
|
|
|
|
|
brd->bd_uart_offset = 0x8;
|
|
|
|
brd->bd_dividend = 921600;
|
|
|
|
|
|
|
|
brd->re_map_membase = ioremap(brd->membase,
|
|
|
|
pci_resource_len(pdev, 4));
|
|
|
|
if (!brd->re_map_membase) {
|
|
|
|
dev_err(&pdev->dev,
|
|
|
|
"Card has no PCI Memory resources, failing board.\n");
|
|
|
|
rc = -ENOMEM;
|
|
|
|
goto out_kfree_brd;
|
|
|
|
}
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2014-11-06 23:05:33 +00:00
|
|
|
/*
|
|
|
|
* Enable Local Interrupt 1 (0x1),
|
|
|
|
* Local Interrupt 1 Polarity Active high (0x2),
|
|
|
|
* Enable PCI interrupt (0x43)
|
|
|
|
*/
|
|
|
|
outb(0x43, brd->iobase + 0x4c);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2014-11-06 23:05:33 +00:00
|
|
|
break;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2014-11-06 23:05:33 +00:00
|
|
|
case PCI_DEVICE_ID_NEO_2DB9:
|
|
|
|
case PCI_DEVICE_ID_NEO_2DB9PRI:
|
|
|
|
case PCI_DEVICE_ID_NEO_2RJ45:
|
|
|
|
case PCI_DEVICE_ID_NEO_2RJ45PRI:
|
|
|
|
case PCI_DEVICE_ID_NEO_2_422_485:
|
|
|
|
case PCI_DEVICE_ID_NEO_4:
|
|
|
|
case PCIE_DEVICE_ID_NEO_4:
|
|
|
|
case PCIE_DEVICE_ID_NEO_4RJ45:
|
|
|
|
case PCIE_DEVICE_ID_NEO_4_IBM:
|
|
|
|
case PCI_DEVICE_ID_DIGI_NEO_8:
|
|
|
|
case PCIE_DEVICE_ID_NEO_8:
|
|
|
|
case PCIE_DEVICE_ID_NEO_8RJ45:
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2014-11-06 23:05:33 +00:00
|
|
|
jsm_dbg(INIT, &brd->pci_dev, "jsm_found_board - NEO adapter\n");
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2014-11-06 23:05:33 +00:00
|
|
|
/* get the PCI Base Address Registers */
|
|
|
|
brd->membase = pci_resource_start(pdev, 0);
|
|
|
|
brd->membase_end = pci_resource_end(pdev, 0);
|
|
|
|
|
|
|
|
if (brd->membase & 1)
|
|
|
|
brd->membase &= ~0x3;
|
|
|
|
else
|
|
|
|
brd->membase &= ~0xF;
|
|
|
|
|
|
|
|
/* Assign the board_ops struct */
|
|
|
|
brd->bd_ops = &jsm_neo_ops;
|
|
|
|
|
|
|
|
brd->bd_uart_offset = 0x200;
|
|
|
|
brd->bd_dividend = 921600;
|
|
|
|
|
|
|
|
brd->re_map_membase = ioremap(brd->membase,
|
|
|
|
pci_resource_len(pdev, 0));
|
|
|
|
if (!brd->re_map_membase) {
|
|
|
|
dev_err(&pdev->dev,
|
|
|
|
"Card has no PCI Memory resources, failing board.\n");
|
|
|
|
rc = -ENOMEM;
|
|
|
|
goto out_kfree_brd;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return -ENXIO;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2014-11-06 23:05:33 +00:00
|
|
|
rc = request_irq(brd->irq, brd->bd_ops->intr, IRQF_SHARED, "JSM", brd);
|
2005-04-16 22:25:44 +00:00
|
|
|
if (rc) {
|
2014-11-06 23:05:33 +00:00
|
|
|
dev_warn(&pdev->dev, "Failed to hook IRQ %d\n", brd->irq);
|
2005-04-16 22:25:44 +00:00
|
|
|
goto out_iounmap;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
rc = jsm_tty_init(brd);
|
|
|
|
if (rc < 0) {
|
|
|
|
dev_err(&pdev->dev, "Can't init tty devices (%d)\n", rc);
|
2009-04-06 16:34:27 +00:00
|
|
|
rc = -ENXIO;
|
2005-04-16 22:25:44 +00:00
|
|
|
goto out_free_irq;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
rc = jsm_uart_port_init(brd);
|
|
|
|
if (rc < 0) {
|
2005-04-16 22:25:44 +00:00
|
|
|
/* XXX: leaking all resources from jsm_tty_init here! */
|
2005-04-16 22:20:36 +00:00
|
|
|
dev_err(&pdev->dev, "Can't init uart port (%d)\n", rc);
|
2009-04-06 16:34:27 +00:00
|
|
|
rc = -ENXIO;
|
2005-04-16 22:25:44 +00:00
|
|
|
goto out_free_irq;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Log the information about the board */
|
2014-11-06 23:05:33 +00:00
|
|
|
dev_info(&pdev->dev, "board %d: Digi Classic/Neo (rev %d), irq %d\n",
|
2005-04-16 22:25:44 +00:00
|
|
|
adapter_count, brd->rev, brd->irq);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-04-16 22:25:44 +00:00
|
|
|
pci_set_drvdata(pdev, brd);
|
2009-10-14 17:57:51 +00:00
|
|
|
pci_save_state(pdev);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
return 0;
|
2005-04-16 22:25:44 +00:00
|
|
|
out_free_irq:
|
2010-02-25 18:31:49 +00:00
|
|
|
jsm_remove_uart_port(brd);
|
2005-04-16 22:20:36 +00:00
|
|
|
free_irq(brd->irq, brd);
|
2005-04-16 22:25:44 +00:00
|
|
|
out_iounmap:
|
2005-04-16 22:20:36 +00:00
|
|
|
iounmap(brd->re_map_membase);
|
2005-04-16 22:25:44 +00:00
|
|
|
out_kfree_brd:
|
|
|
|
kfree(brd);
|
|
|
|
out_release_regions:
|
|
|
|
pci_release_regions(pdev);
|
|
|
|
out_disable_device:
|
|
|
|
pci_disable_device(pdev);
|
|
|
|
out:
|
2005-04-16 22:20:36 +00:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2012-11-19 18:26:18 +00:00
|
|
|
static void jsm_remove_one(struct pci_dev *pdev)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2005-04-16 22:25:44 +00:00
|
|
|
struct jsm_board *brd = pci_get_drvdata(pdev);
|
2005-04-16 22:20:36 +00:00
|
|
|
int i = 0;
|
|
|
|
|
2014-11-06 23:05:33 +00:00
|
|
|
switch (pdev->device) {
|
|
|
|
case PCI_DEVICE_ID_CLASSIC_4:
|
|
|
|
case PCI_DEVICE_ID_CLASSIC_4_422:
|
|
|
|
case PCI_DEVICE_ID_CLASSIC_8:
|
|
|
|
case PCI_DEVICE_ID_CLASSIC_8_422:
|
|
|
|
/* Tell card not to interrupt anymore. */
|
|
|
|
outb(0x0, brd->iobase + 0x4c);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-04-16 22:25:44 +00:00
|
|
|
jsm_remove_uart_port(brd);
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
free_irq(brd->irq, brd);
|
|
|
|
iounmap(brd->re_map_membase);
|
|
|
|
|
|
|
|
/* Free all allocated channels structs */
|
|
|
|
for (i = 0; i < brd->maxports; i++) {
|
|
|
|
if (brd->channels[i]) {
|
2005-04-16 22:25:44 +00:00
|
|
|
kfree(brd->channels[i]->ch_rqueue);
|
|
|
|
kfree(brd->channels[i]->ch_equeue);
|
2005-04-16 22:20:36 +00:00
|
|
|
kfree(brd->channels[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-04-16 22:25:44 +00:00
|
|
|
pci_release_regions(pdev);
|
|
|
|
pci_disable_device(pdev);
|
2005-04-16 22:20:36 +00:00
|
|
|
kfree(brd);
|
|
|
|
}
|
|
|
|
|
2005-04-16 22:25:44 +00:00
|
|
|
static struct pci_device_id jsm_pci_tbl[] = {
|
|
|
|
{ PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_NEO_2DB9), 0, 0, 0 },
|
|
|
|
{ PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_NEO_2DB9PRI), 0, 0, 1 },
|
|
|
|
{ PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_NEO_2RJ45), 0, 0, 2 },
|
|
|
|
{ PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_NEO_2RJ45PRI), 0, 0, 3 },
|
2008-05-01 11:35:00 +00:00
|
|
|
{ PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCIE_DEVICE_ID_NEO_4_IBM), 0, 0, 4 },
|
2009-02-18 22:48:34 +00:00
|
|
|
{ PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_NEO_8), 0, 0, 5 },
|
2014-08-30 20:35:57 +00:00
|
|
|
{ PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_NEO_4), 0, 0, 6 },
|
|
|
|
{ PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_NEO_1_422), 0, 0, 7 },
|
|
|
|
{ PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_NEO_1_422_485), 0, 0, 8 },
|
|
|
|
{ PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_NEO_2_422_485), 0, 0, 9 },
|
|
|
|
{ PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCIE_DEVICE_ID_NEO_8), 0, 0, 10 },
|
|
|
|
{ PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCIE_DEVICE_ID_NEO_4), 0, 0, 11 },
|
|
|
|
{ PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCIE_DEVICE_ID_NEO_4RJ45), 0, 0, 12 },
|
|
|
|
{ PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCIE_DEVICE_ID_NEO_8RJ45), 0, 0, 13 },
|
2014-11-06 23:05:33 +00:00
|
|
|
{ PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_CLASSIC_4), 0, 0, 14 },
|
|
|
|
{ PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_CLASSIC_4_422), 0, 0, 15 },
|
|
|
|
{ PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_CLASSIC_8), 0, 0, 16 },
|
|
|
|
{ PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_CLASSIC_8_422), 0, 0, 17 },
|
2005-04-16 22:25:44 +00:00
|
|
|
{ 0, }
|
|
|
|
};
|
|
|
|
MODULE_DEVICE_TABLE(pci, jsm_pci_tbl);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-04-16 22:25:44 +00:00
|
|
|
static struct pci_driver jsm_driver = {
|
2015-12-02 00:06:19 +00:00
|
|
|
.name = JSM_DRIVER_NAME,
|
2005-04-16 22:20:36 +00:00
|
|
|
.id_table = jsm_pci_tbl,
|
2005-04-16 22:25:44 +00:00
|
|
|
.probe = jsm_probe_one,
|
2012-11-19 18:21:34 +00:00
|
|
|
.remove = jsm_remove_one,
|
2009-10-14 17:57:51 +00:00
|
|
|
.err_handler = &jsm_err_handler,
|
2005-04-16 22:20:36 +00:00
|
|
|
};
|
|
|
|
|
2009-10-14 17:57:51 +00:00
|
|
|
static pci_ers_result_t jsm_io_error_detected(struct pci_dev *pdev,
|
|
|
|
pci_channel_state_t state)
|
|
|
|
{
|
|
|
|
struct jsm_board *brd = pci_get_drvdata(pdev);
|
|
|
|
|
|
|
|
jsm_remove_uart_port(brd);
|
|
|
|
|
|
|
|
return PCI_ERS_RESULT_NEED_RESET;
|
|
|
|
}
|
|
|
|
|
|
|
|
static pci_ers_result_t jsm_io_slot_reset(struct pci_dev *pdev)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
rc = pci_enable_device(pdev);
|
|
|
|
|
|
|
|
if (rc)
|
|
|
|
return PCI_ERS_RESULT_DISCONNECT;
|
|
|
|
|
|
|
|
pci_set_master(pdev);
|
|
|
|
|
|
|
|
return PCI_ERS_RESULT_RECOVERED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void jsm_io_resume(struct pci_dev *pdev)
|
|
|
|
{
|
|
|
|
struct jsm_board *brd = pci_get_drvdata(pdev);
|
|
|
|
|
|
|
|
pci_restore_state(pdev);
|
2012-01-09 12:58:06 +00:00
|
|
|
pci_save_state(pdev);
|
2009-10-14 17:57:51 +00:00
|
|
|
|
|
|
|
jsm_uart_port_init(brd);
|
|
|
|
}
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
static int __init jsm_init_module(void)
|
|
|
|
{
|
2005-04-16 22:25:44 +00:00
|
|
|
int rc;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
rc = uart_register_driver(&jsm_uart_driver);
|
2005-04-16 22:25:44 +00:00
|
|
|
if (!rc) {
|
|
|
|
rc = pci_register_driver(&jsm_driver);
|
|
|
|
if (rc)
|
|
|
|
uart_unregister_driver(&jsm_uart_driver);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void __exit jsm_exit_module(void)
|
|
|
|
{
|
|
|
|
pci_unregister_driver(&jsm_driver);
|
|
|
|
uart_unregister_driver(&jsm_uart_driver);
|
|
|
|
}
|
2005-04-16 22:25:44 +00:00
|
|
|
|
|
|
|
module_init(jsm_init_module);
|
2005-04-16 22:20:36 +00:00
|
|
|
module_exit(jsm_exit_module);
|