@@ -39,6 +39,7 @@ MODULE_DESCRIPTION("Socket-CAN driver for PLX90xx PCI-bridge cards with "
3939MODULE_SUPPORTED_DEVICE ("Adlink PCI-7841/cPCI-7841, "
4040 "Adlink PCI-7841/cPCI-7841 SE, "
4141 "Marathon CAN-bus-PCI, "
42+ "Marathon CAN-bus-PCIe, "
4243 "TEWS TECHNOLOGIES TPMC810, "
4344 "esd CAN-PCI/CPCI/PCI104/200, "
4445 "esd CAN-PCI/PMC/266, "
@@ -133,6 +134,7 @@ struct plx_pci_card {
133134#define IXXAT_PCI_SUB_SYS_ID 0x2540
134135
135136#define MARATHON_PCI_DEVICE_ID 0x2715
137+ #define MARATHON_PCIE_DEVICE_ID 0x3432
136138
137139#define TEWS_PCI_VENDOR_ID 0x1498
138140#define TEWS_PCI_DEVICE_ID_TMPC810 0x032A
@@ -141,8 +143,9 @@ struct plx_pci_card {
141143#define CTI_PCI_DEVICE_ID_CRG001 0x0900
142144
143145static void plx_pci_reset_common (struct pci_dev * pdev );
144- static void plx_pci_reset_marathon (struct pci_dev * pdev );
145146static void plx9056_pci_reset_common (struct pci_dev * pdev );
147+ static void plx_pci_reset_marathon_pci (struct pci_dev * pdev );
148+ static void plx_pci_reset_marathon_pcie (struct pci_dev * pdev );
146149
147150struct plx_pci_channel_map {
148151 u32 bar ;
@@ -215,14 +218,22 @@ static struct plx_pci_card_info plx_pci_card_info_ixxat = {
215218 /* based on PLX9050 */
216219};
217220
218- static struct plx_pci_card_info plx_pci_card_info_marathon = {
221+ static struct plx_pci_card_info plx_pci_card_info_marathon_pci = {
219222 "Marathon CAN-bus-PCI" , 2 ,
220223 PLX_PCI_CAN_CLOCK , PLX_PCI_OCR , PLX_PCI_CDR ,
221224 {0 , 0x00 , 0x00 }, { {2 , 0x00 , 0x00 }, {4 , 0x00 , 0x00 } },
222- & plx_pci_reset_marathon
225+ & plx_pci_reset_marathon_pci
223226 /* based on PLX9052 */
224227};
225228
229+ static struct plx_pci_card_info plx_pci_card_info_marathon_pcie = {
230+ "Marathon CAN-bus-PCIe" , 2 ,
231+ PLX_PCI_CAN_CLOCK , PLX_PCI_OCR , PLX_PCI_CDR ,
232+ {0 , 0x00 , 0x00 }, { {2 , 0x00 , 0x00 }, {3 , 0x80 , 0x00 } },
233+ & plx_pci_reset_marathon_pcie
234+ /* based on PEX8311 */
235+ };
236+
226237static struct plx_pci_card_info plx_pci_card_info_tews = {
227238 "TEWS TECHNOLOGIES TPMC810" , 2 ,
228239 PLX_PCI_CAN_CLOCK , PLX_PCI_OCR , PLX_PCI_CDR ,
@@ -316,7 +327,14 @@ static const struct pci_device_id plx_pci_tbl[] = {
316327 PCI_VENDOR_ID_PLX , MARATHON_PCI_DEVICE_ID ,
317328 PCI_ANY_ID , PCI_ANY_ID ,
318329 0 , 0 ,
319- (kernel_ulong_t )& plx_pci_card_info_marathon
330+ (kernel_ulong_t )& plx_pci_card_info_marathon_pci
331+ },
332+ {
333+ /* Marathon CAN-bus-PCIe card */
334+ PCI_VENDOR_ID_PLX , MARATHON_PCIE_DEVICE_ID ,
335+ PCI_ANY_ID , PCI_ANY_ID ,
336+ 0 , 0 ,
337+ (kernel_ulong_t )& plx_pci_card_info_marathon_pcie
320338 },
321339 {
322340 /* TEWS TECHNOLOGIES TPMC810 card */
@@ -437,8 +455,8 @@ static void plx9056_pci_reset_common(struct pci_dev *pdev)
437455 iowrite32 (cntrl , card -> conf_addr + PLX9056_CNTRL );
438456};
439457
440- /* Special reset function for Marathon card */
441- static void plx_pci_reset_marathon (struct pci_dev * pdev )
458+ /* Special reset function for Marathon CAN-bus-PCI card */
459+ static void plx_pci_reset_marathon_pci (struct pci_dev * pdev )
442460{
443461 void __iomem * reset_addr ;
444462 int i ;
@@ -460,6 +478,34 @@ static void plx_pci_reset_marathon(struct pci_dev *pdev)
460478 }
461479}
462480
481+ /* Special reset function for Marathon CAN-bus-PCIe card */
482+ static void plx_pci_reset_marathon_pcie (struct pci_dev * pdev )
483+ {
484+ void __iomem * addr ;
485+ void __iomem * reset_addr ;
486+ int i ;
487+
488+ plx9056_pci_reset_common (pdev );
489+
490+ for (i = 0 ; i < 2 ; i ++ ) {
491+ struct plx_pci_channel_map * chan_map =
492+ & plx_pci_card_info_marathon_pcie .chan_map_tbl [i ];
493+ addr = pci_iomap (pdev , chan_map -> bar , chan_map -> size );
494+ if (!addr ) {
495+ dev_err (& pdev -> dev , "Failed to remap reset "
496+ "space %d (BAR%d)\n" , i , chan_map -> bar );
497+ } else {
498+ /* reset the SJA1000 chip */
499+ #define MARATHON_PCIE_RESET_OFFSET 32
500+ reset_addr = addr + chan_map -> offset +
501+ MARATHON_PCIE_RESET_OFFSET ;
502+ iowrite8 (0x1 , reset_addr );
503+ udelay (100 );
504+ pci_iounmap (pdev , addr );
505+ }
506+ }
507+ }
508+
463509static void plx_pci_del_card (struct pci_dev * pdev )
464510{
465511 struct plx_pci_card * card = pci_get_drvdata (pdev );
@@ -486,7 +532,8 @@ static void plx_pci_del_card(struct pci_dev *pdev)
486532 * Disable interrupts from PCI-card and disable local
487533 * interrupts
488534 */
489- if (pdev -> device != PCI_DEVICE_ID_PLX_9056 )
535+ if (pdev -> device != PCI_DEVICE_ID_PLX_9056 &&
536+ pdev -> device != MARATHON_PCIE_DEVICE_ID )
490537 iowrite32 (0x0 , card -> conf_addr + PLX_INTCSR );
491538 else
492539 iowrite32 (0x0 , card -> conf_addr + PLX9056_INTCSR );
@@ -619,7 +666,8 @@ static int plx_pci_add_card(struct pci_dev *pdev,
619666 * Enable interrupts from PCI-card (PLX90xx) and enable Local_1,
620667 * Local_2 interrupts from the SJA1000 chips
621668 */
622- if (pdev -> device != PCI_DEVICE_ID_PLX_9056 ) {
669+ if (pdev -> device != PCI_DEVICE_ID_PLX_9056 &&
670+ pdev -> device != MARATHON_PCIE_DEVICE_ID ) {
623671 val = ioread32 (card -> conf_addr + PLX_INTCSR );
624672 if (pdev -> subsystem_vendor == PCI_VENDOR_ID_ESDGMBH )
625673 val |= PLX_LINT1_EN | PLX_PCI_INT_EN ;
0 commit comments