/* Register definitions for the ASIX99100
*/ #define ASIX_LINTSR 0x28 /* Interrupt Control/Status register */ #define ASIX_LINTSR_INT0AC BIT(0) /* Writing 1 enables or clears interrupt */
#define ASIX_LIEMR 0x24 /* Local Interrupt Enable / Miscellaneous Register */ #define ASIX_LIEMR_L0EINTEN BIT(16) /* Local INT0 input assertion enable */ #define ASIX_LIEMR_LRST BIT(14) /* Local Reset assert */
/* The board configuration is probably following: * RX1 is connected to ground. * TX1 is not connected. * CLKO is not connected. * Setting the OCR register to 0xDA is a good idea. * This means normal output mode, push-pull and the correct polarity.
*/ #define EMS_PCI_OCR (OCR_TX0_PUSHPULL | OCR_TX1_PUSHPULL)
/* In the CDR register, you should set CBP to 1. * You will probably also want to set the clock divider value to 7 * (meaning direct oscillator output) because the second SJA1000 chip * is driven by the first one CLKOUT output.
*/ #define EMS_PCI_CDR (CDR_CBP | CDR_CLKOUT_MASK)
#define EMS_PCI_V1_BASE_BAR 1 #define EMS_PCI_V1_CONF_BAR 0 #define EMS_PCI_V1_CONF_SIZE 4096 /* size of PITA control area */ #define EMS_PCI_V1_CAN_BASE_OFFSET 0x400 /* offset where the controllers start */ #define EMS_PCI_V1_CAN_CTRL_SIZE 0x200 /* memory size for each controller */
#define EMS_PCI_V2_BASE_BAR 2 #define EMS_PCI_V2_CONF_BAR 0 #define EMS_PCI_V2_CONF_SIZE 128 /* size of PLX control area */ #define EMS_PCI_V2_CAN_BASE_OFFSET 0x400 /* offset where the controllers start */ #define EMS_PCI_V2_CAN_CTRL_SIZE 0x200 /* memory size for each controller */
#define EMS_PCI_V3_BASE_BAR 0 #define EMS_PCI_V3_CONF_BAR 5 #define EMS_PCI_V3_CONF_SIZE 128 /* size of ASIX control area */ #define EMS_PCI_V3_CAN_BASE_OFFSET 0x00 /* offset where the controllers starts */ #define EMS_PCI_V3_CAN_CTRL_SIZE 0x100 /* memory size for each controller */
#define EMS_PCI_BASE_SIZE 4096 /* size of controller area */
/* Check if a CAN controller is present at the specified location * by trying to set 'em into the PeliCAN mode
*/ staticinlineint ems_pci_check_chan(conststruct sja1000_priv *priv)
{ unsignedchar res;
/* Make sure SJA1000 is in reset mode */
priv->write_reg(priv, SJA1000_MOD, 1);
priv->write_reg(priv, SJA1000_CDR, CDR_PELICAN);
/* read reset-values */
res = priv->read_reg(priv, SJA1000_CDR);
if (res == CDR_PELICAN) return 1;
return 0;
}
staticvoid ems_pci_del_card(struct pci_dev *pdev)
{ struct ems_pci_card *card = pci_get_drvdata(pdev); struct net_device *dev; int i = 0;
for (i = 0; i < card->channels; i++) {
dev = card->net_dev[i];
/* Probe PCI device for EMS CAN signature and register each available * CAN channel to SJA1000 Socket-CAN subsystem.
*/ staticint ems_pci_add_card(struct pci_dev *pdev, conststruct pci_device_id *ent)
{ struct sja1000_priv *priv; struct net_device *dev; struct ems_pci_card *card; int max_chan, conf_size, base_bar, conf_bar; int err, i;
/* Check for unique EMS CAN signature */ if (ems_pci_v1_readb(card, 0) != 0x55 ||
ems_pci_v1_readb(card, 1) != 0xAA ||
ems_pci_v1_readb(card, 2) != 0x01 ||
ems_pci_v1_readb(card, 3) != 0xCB ||
ems_pci_v1_readb(card, 4) != 0x11) {
dev_err(&pdev->dev, "Not EMS Dr. Thomas Wuensche interface\n");
err = -ENODEV; goto failure_cleanup;
}
}
if (card->version == 3) { /* ASIX chip asserts local reset to CAN controllers * after bootup until it is deasserted
*/
writel(readl(card->conf_addr + ASIX_LIEMR) & ~ASIX_LIEMR_LRST,
card->conf_addr + ASIX_LIEMR);
}
ems_pci_card_reset(card);
/* Detect available channels */ for (i = 0; i < max_chan; i++) {
dev = alloc_sja1000dev(0); if (!dev) {
err = -ENOMEM; goto failure_cleanup;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.