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: Sebastian Haas <haas@ems-wuensche.com>
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Sebastian Haas and committed by
David S. Miller
edf42a27 0c01695d

+9 -7
+9 -7
drivers/net/can/sja1000/ems_pci.c
··· 94 #define EMS_PCI_CDR (CDR_CBP | CDR_CLKOUT_MASK) 95 96 #define EMS_PCI_V1_BASE_BAR 1 97 - #define EMS_PCI_V1_MEM_SIZE 4096 98 #define EMS_PCI_V2_BASE_BAR 2 99 - #define EMS_PCI_V2_MEM_SIZE 128 100 #define EMS_PCI_CAN_BASE_OFFSET 0x400 /* offset where the controllers starts */ 101 #define EMS_PCI_CAN_CTRL_SIZE 0x200 /* memory size for each controller */ 102 103 static struct pci_device_id ems_pci_tbl[] = { 104 /* CPC-PCI v1 */ ··· 226 struct sja1000_priv *priv; 227 struct net_device *dev; 228 struct ems_pci_card *card; 229 - int max_chan, mem_size, base_bar; 230 int err, i; 231 232 /* Enabling PCI device */ ··· 253 card->version = 2; /* CPC-PCI v2 */ 254 max_chan = EMS_PCI_V2_MAX_CHAN; 255 base_bar = EMS_PCI_V2_BASE_BAR; 256 - mem_size = EMS_PCI_V2_MEM_SIZE; 257 } else { 258 card->version = 1; /* CPC-PCI v1 */ 259 max_chan = EMS_PCI_V1_MAX_CHAN; 260 base_bar = EMS_PCI_V1_BASE_BAR; 261 - mem_size = EMS_PCI_V1_MEM_SIZE; 262 } 263 264 /* Remap configuration space and controller memory area */ 265 - card->conf_addr = pci_iomap(pdev, 0, mem_size); 266 if (card->conf_addr == NULL) { 267 err = -ENOMEM; 268 goto failure_cleanup; 269 } 270 271 - card->base_addr = pci_iomap(pdev, base_bar, mem_size); 272 if (card->base_addr == NULL) { 273 err = -ENOMEM; 274 goto failure_cleanup;
··· 94 #define EMS_PCI_CDR (CDR_CBP | CDR_CLKOUT_MASK) 95 96 #define EMS_PCI_V1_BASE_BAR 1 97 + #define EMS_PCI_V1_CONF_SIZE 4096 /* size of PITA control area */ 98 #define EMS_PCI_V2_BASE_BAR 2 99 + #define EMS_PCI_V2_CONF_SIZE 128 /* size of PLX control area */ 100 #define EMS_PCI_CAN_BASE_OFFSET 0x400 /* offset where the controllers starts */ 101 #define EMS_PCI_CAN_CTRL_SIZE 0x200 /* memory size for each controller */ 102 + 103 + #define EMS_PCI_BASE_SIZE 4096 /* size of controller area */ 104 105 static struct pci_device_id ems_pci_tbl[] = { 106 /* CPC-PCI v1 */ ··· 224 struct sja1000_priv *priv; 225 struct net_device *dev; 226 struct ems_pci_card *card; 227 + int max_chan, conf_size, base_bar; 228 int err, i; 229 230 /* Enabling PCI device */ ··· 251 card->version = 2; /* CPC-PCI v2 */ 252 max_chan = EMS_PCI_V2_MAX_CHAN; 253 base_bar = EMS_PCI_V2_BASE_BAR; 254 + conf_size = EMS_PCI_V2_CONF_SIZE; 255 } else { 256 card->version = 1; /* CPC-PCI v1 */ 257 max_chan = EMS_PCI_V1_MAX_CHAN; 258 base_bar = EMS_PCI_V1_BASE_BAR; 259 + conf_size = EMS_PCI_V1_CONF_SIZE; 260 } 261 262 /* Remap configuration space and controller memory area */ 263 + card->conf_addr = pci_iomap(pdev, 0, conf_size); 264 if (card->conf_addr == NULL) { 265 err = -ENOMEM; 266 goto failure_cleanup; 267 } 268 269 + card->base_addr = pci_iomap(pdev, base_bar, EMS_PCI_BASE_SIZE); 270 if (card->base_addr == NULL) { 271 err = -ENOMEM; 272 goto failure_cleanup;