Commit edf42a27 authored by Sebastian Haas's avatar Sebastian Haas Committed by David S. Miller

ems_pci: fix size of CAN controllers BAR mapping for CPC-PCI v2

The driver mapped only 128 bytes of the CAN controller address space when a
CPC-PCI v2 was detected (incl. CPC-104P). This patch will fix it by always
mapping the whole address space (4096 bytes on all boards) of the
corresponding PCI BAR.
Signed-off-by: default avatarSebastian Haas <haas@ems-wuensche.com>
Signed-off-by: default avatarWolfgang Grandegger <wg@grandegger.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0c01695d
...@@ -94,12 +94,14 @@ struct ems_pci_card { ...@@ -94,12 +94,14 @@ struct ems_pci_card {
#define EMS_PCI_CDR (CDR_CBP | CDR_CLKOUT_MASK) #define EMS_PCI_CDR (CDR_CBP | CDR_CLKOUT_MASK)
#define EMS_PCI_V1_BASE_BAR 1 #define EMS_PCI_V1_BASE_BAR 1
#define EMS_PCI_V1_MEM_SIZE 4096 #define EMS_PCI_V1_CONF_SIZE 4096 /* size of PITA control area */
#define EMS_PCI_V2_BASE_BAR 2 #define EMS_PCI_V2_BASE_BAR 2
#define EMS_PCI_V2_MEM_SIZE 128 #define EMS_PCI_V2_CONF_SIZE 128 /* size of PLX control area */
#define EMS_PCI_CAN_BASE_OFFSET 0x400 /* offset where the controllers starts */ #define EMS_PCI_CAN_BASE_OFFSET 0x400 /* offset where the controllers starts */
#define EMS_PCI_CAN_CTRL_SIZE 0x200 /* memory size for each controller */ #define EMS_PCI_CAN_CTRL_SIZE 0x200 /* memory size for each controller */
#define EMS_PCI_BASE_SIZE 4096 /* size of controller area */
static struct pci_device_id ems_pci_tbl[] = { static struct pci_device_id ems_pci_tbl[] = {
/* CPC-PCI v1 */ /* CPC-PCI v1 */
{PCI_VENDOR_ID_SIEMENS, 0x2104, PCI_ANY_ID, PCI_ANY_ID,}, {PCI_VENDOR_ID_SIEMENS, 0x2104, PCI_ANY_ID, PCI_ANY_ID,},
...@@ -224,7 +226,7 @@ static int __devinit ems_pci_add_card(struct pci_dev *pdev, ...@@ -224,7 +226,7 @@ static int __devinit ems_pci_add_card(struct pci_dev *pdev,
struct sja1000_priv *priv; struct sja1000_priv *priv;
struct net_device *dev; struct net_device *dev;
struct ems_pci_card *card; struct ems_pci_card *card;
int max_chan, mem_size, base_bar; int max_chan, conf_size, base_bar;
int err, i; int err, i;
/* Enabling PCI device */ /* Enabling PCI device */
...@@ -251,22 +253,22 @@ static int __devinit ems_pci_add_card(struct pci_dev *pdev, ...@@ -251,22 +253,22 @@ static int __devinit ems_pci_add_card(struct pci_dev *pdev,
card->version = 2; /* CPC-PCI v2 */ card->version = 2; /* CPC-PCI v2 */
max_chan = EMS_PCI_V2_MAX_CHAN; max_chan = EMS_PCI_V2_MAX_CHAN;
base_bar = EMS_PCI_V2_BASE_BAR; base_bar = EMS_PCI_V2_BASE_BAR;
mem_size = EMS_PCI_V2_MEM_SIZE; conf_size = EMS_PCI_V2_CONF_SIZE;
} else { } else {
card->version = 1; /* CPC-PCI v1 */ card->version = 1; /* CPC-PCI v1 */
max_chan = EMS_PCI_V1_MAX_CHAN; max_chan = EMS_PCI_V1_MAX_CHAN;
base_bar = EMS_PCI_V1_BASE_BAR; base_bar = EMS_PCI_V1_BASE_BAR;
mem_size = EMS_PCI_V1_MEM_SIZE; conf_size = EMS_PCI_V1_CONF_SIZE;
} }
/* Remap configuration space and controller memory area */ /* Remap configuration space and controller memory area */
card->conf_addr = pci_iomap(pdev, 0, mem_size); card->conf_addr = pci_iomap(pdev, 0, conf_size);
if (card->conf_addr == NULL) { if (card->conf_addr == NULL) {
err = -ENOMEM; err = -ENOMEM;
goto failure_cleanup; goto failure_cleanup;
} }
card->base_addr = pci_iomap(pdev, base_bar, mem_size); card->base_addr = pci_iomap(pdev, base_bar, EMS_PCI_BASE_SIZE);
if (card->base_addr == NULL) { if (card->base_addr == NULL) {
err = -ENOMEM; err = -ENOMEM;
goto failure_cleanup; goto failure_cleanup;
......
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