#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/netdevice.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/pci.h>
#include <linux/can/dev.h>
#include <linux/io.h>
#include "sja1000.h"
#define DRV_NAME …
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
#define PLX_PCI_MAX_CHAN …
struct plx_pci_card { … };
#define PLX_PCI_CAN_CLOCK …
#define PLX_INTCSR …
#define PLX_CNTRL …
#define PLX_LINT1_EN …
#define PLX_LINT1_POL …
#define PLX_LINT2_EN …
#define PLX_LINT2_POL …
#define PLX_PCI_INT_EN …
#define PLX_PCI_RESET …
#define PLX9056_INTCSR …
#define PLX9056_CNTRL …
#define PLX9056_LINTI …
#define PLX9056_PCI_INT_EN …
#define PLX9056_PCI_RCR …
#define PLX_PCI_OCR …
#define ASEM_PCI_OCR …
#define PLX_PCI_CDR …
#define REG_CR …
#define REG_CR_BASICCAN_INITIAL …
#define REG_CR_BASICCAN_INITIAL_MASK …
#define REG_SR_BASICCAN_INITIAL …
#define REG_IR_BASICCAN_INITIAL …
#define REG_MOD_PELICAN_INITIAL …
#define REG_SR_PELICAN_INITIAL …
#define REG_IR_PELICAN_INITIAL …
#define ADLINK_PCI_VENDOR_ID …
#define ADLINK_PCI_DEVICE_ID …
#define ESD_PCI_SUB_SYS_ID_PCI200 …
#define ESD_PCI_SUB_SYS_ID_PCI266 …
#define ESD_PCI_SUB_SYS_ID_PMC266 …
#define ESD_PCI_SUB_SYS_ID_CPCI200 …
#define ESD_PCI_SUB_SYS_ID_PCIE2000 …
#define ESD_PCI_SUB_SYS_ID_PCI104200 …
#define CAN200PCI_DEVICE_ID …
#define CAN200PCI_VENDOR_ID …
#define CAN200PCI_SUB_DEVICE_ID …
#define CAN200PCI_SUB_VENDOR_ID …
#define IXXAT_PCI_VENDOR_ID …
#define IXXAT_PCI_DEVICE_ID …
#define IXXAT_PCI_SUB_SYS_ID …
#define MARATHON_PCI_DEVICE_ID …
#define MARATHON_PCIE_DEVICE_ID …
#define TEWS_PCI_VENDOR_ID …
#define TEWS_PCI_DEVICE_ID_TMPC810 …
#define CTI_PCI_DEVICE_ID_CRG001 …
#define MOXA_PCI_VENDOR_ID …
#define MOXA_PCI_DEVICE_ID …
#define ASEM_RAW_CAN_VENDOR_ID …
#define ASEM_RAW_CAN_DEVICE_ID …
#define ASEM_RAW_CAN_SUB_VENDOR_ID …
#define ASEM_RAW_CAN_SUB_DEVICE_ID …
#define ASEM_RAW_CAN_SUB_DEVICE_ID_BIS …
#define ASEM_RAW_CAN_RST_REGISTER …
#define ASEM_RAW_CAN_RST_MASK_CAN1 …
#define ASEM_RAW_CAN_RST_MASK_CAN2 …
static void plx_pci_reset_common(struct pci_dev *pdev);
static void plx9056_pci_reset_common(struct pci_dev *pdev);
static void plx_pci_reset_marathon_pci(struct pci_dev *pdev);
static void plx_pci_reset_marathon_pcie(struct pci_dev *pdev);
static void plx_pci_reset_asem_dual_can_raw(struct pci_dev *pdev);
struct plx_pci_channel_map { … };
struct plx_pci_card_info { … };
static struct plx_pci_card_info plx_pci_card_info_adlink = …;
static struct plx_pci_card_info plx_pci_card_info_adlink_se = …;
static struct plx_pci_card_info plx_pci_card_info_esd200 = …;
static struct plx_pci_card_info plx_pci_card_info_esd266 = …;
static struct plx_pci_card_info plx_pci_card_info_esd2000 = …;
static struct plx_pci_card_info plx_pci_card_info_ixxat = …;
static struct plx_pci_card_info plx_pci_card_info_marathon_pci = …;
static struct plx_pci_card_info plx_pci_card_info_marathon_pcie = …;
static struct plx_pci_card_info plx_pci_card_info_tews = …;
static struct plx_pci_card_info plx_pci_card_info_cti = …;
static struct plx_pci_card_info plx_pci_card_info_elcus = …;
static struct plx_pci_card_info plx_pci_card_info_moxa = …;
static struct plx_pci_card_info plx_pci_card_info_asem_dual_can = …;
static const struct pci_device_id plx_pci_tbl[] = …;
MODULE_DEVICE_TABLE(pci, plx_pci_tbl);
static u8 plx_pci_read_reg(const struct sja1000_priv *priv, int port)
{ … }
static void plx_pci_write_reg(const struct sja1000_priv *priv, int port, u8 val)
{ … }
static inline int plx_pci_check_sja1000(const struct sja1000_priv *priv)
{ … }
static void plx_pci_reset_common(struct pci_dev *pdev)
{
struct plx_pci_card *card = pci_get_drvdata(pdev);
u32 cntrl;
cntrl = ioread32(card->conf_addr + PLX_CNTRL);
cntrl |= PLX_PCI_RESET;
iowrite32(cntrl, card->conf_addr + PLX_CNTRL);
udelay(100);
cntrl ^= PLX_PCI_RESET;
iowrite32(cntrl, card->conf_addr + PLX_CNTRL);
};
static void plx9056_pci_reset_common(struct pci_dev *pdev)
{
struct plx_pci_card *card = pci_get_drvdata(pdev);
u32 cntrl;
cntrl = ioread32(card->conf_addr + PLX9056_CNTRL);
cntrl |= PLX_PCI_RESET;
iowrite32(cntrl, card->conf_addr + PLX9056_CNTRL);
udelay(100);
cntrl ^= PLX_PCI_RESET;
iowrite32(cntrl, card->conf_addr + PLX9056_CNTRL);
cntrl |= PLX9056_PCI_RCR;
iowrite32(cntrl, card->conf_addr + PLX9056_CNTRL);
mdelay(10);
cntrl ^= PLX9056_PCI_RCR;
iowrite32(cntrl, card->conf_addr + PLX9056_CNTRL);
};
static void plx_pci_reset_marathon_pci(struct pci_dev *pdev)
{ … }
static void plx_pci_reset_marathon_pcie(struct pci_dev *pdev)
{ … }
static void plx_pci_reset_asem_dual_can_raw(struct pci_dev *pdev)
{ … }
static void plx_pci_del_card(struct pci_dev *pdev)
{ … }
static int plx_pci_add_card(struct pci_dev *pdev,
const struct pci_device_id *ent)
{ … }
static struct pci_driver plx_pci_driver = …;
module_pci_driver(…) …;