Module: xenomai-head
Branch: master
Commit: 9d70c373eee0ac43a1b5869600e33ec6bff89868
URL:    
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=9d70c373eee0ac43a1b5869600e33ec6bff89868

Author: Peter Soetens <pe...@thesourceworks.com>
Date:   Fri Jul  9 15:21:53 2010 +0200

rtcan: Mask the SJA_MOD register when probing for channels

Inspired by the plx_pci.c driver which does the same.
Tested on IXXAT PC-I 04

Signed-off-by: Peter Soetens <pe...@thesourceworks.com>

---

 ksrc/drivers/can/sja1000/rtcan_ixxat_pci.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/ksrc/drivers/can/sja1000/rtcan_ixxat_pci.c 
b/ksrc/drivers/can/sja1000/rtcan_ixxat_pci.c
index 5faa763..8c91efd 100644
--- a/ksrc/drivers/can/sja1000/rtcan_ixxat_pci.c
+++ b/ksrc/drivers/can/sja1000/rtcan_ixxat_pci.c
@@ -63,6 +63,7 @@ struct rtcan_ixxat_pci
 #define IXXAT_INTCSR_OFFSET  0x4c /* Offset in PLX9050 conf registers */
 #define IXXAT_INTCSR_SLAVE   0x41 /* LINT1 and PCI interrupt enabled */
 #define IXXAT_INTCSR_MASTER  0x08 /* LINT2 enabled */
+#define IXXAT_SJA_MOD_MASK   0xa1 /* Mask for reading dual/single channel */
 
 /* PCI vender, device and sub-device ID */
 #define IXXAT_PCI_VENDOR_ID  0x10b5
@@ -238,7 +239,7 @@ static int __devinit ixxat_pci_init_one (struct pci_dev 
*pdev,
     writeb(0x1, base_addr + CHANNEL_MASTER_RESET);
     writeb(0x1, base_addr + CHANNEL_SLAVE_RESET);
     udelay(100);
-    if (readb(base_addr + CHANNEL_OFFSET + SJA_MOD) != 0x21 ||
+    if ( (readb(base_addr + CHANNEL_OFFSET + SJA_MOD) & IXXAT_SJA_MOD_MASK ) 
!= 0x21 ||
        readb(base_addr + CHANNEL_OFFSET + SJA_SR ) != 0x0c ||
        readb(base_addr + CHANNEL_OFFSET + SJA_IR ) != 0xe0)
        channel = CHANNEL_SINGLE;


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to