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