C_CAN changes
authorppisa <ppisa>
Thu, 2 Jun 2005 12:58:57 +0000 (12:58 +0000)
committerppisa <ppisa>
Thu, 2 Jun 2005 12:58:57 +0000 (12:58 +0000)
removed spin_unlock(&c_can_sprlock), because it is not used
in c_can_irq_read_handler(). Modified c_can_pre_read_config().

lincan/src/c_can.c
lincan/src/c_can_irq.c

index 4c052c3..2add428 100644 (file)
@@ -466,7 +466,7 @@ int c_can_config_irqs(struct canchip_t *pchip,
    DEBUGMSG("(c%d)calling c_can_config_irqs(...)\n", pchip->chip_idx);
 
    tempreg = c_can_read_reg_w(pchip, CCCR);
-   //DEBUGMSG("-> CAN Control Register: 0x%.4lx\n",(long)tempreg);
+   DEBUGMSG("-> CAN Control Register: 0x%4lx\n",(long)tempreg);
    c_can_write_reg_w(pchip, tempreg | (irqs & 0xe), CCCR);
    DEBUGMSG("-> Configured hardware interrupt delivery\n");
    return 0;
@@ -484,29 +484,30 @@ int c_can_pre_read_config(struct canchip_t *pchip, struct msgobj_t *pmsgobj)
 
    spin_lock( &c_can_if1lock );
 
-   //loading Message Object in IF1
    if (c_can_if1_busycheck(pmsgobj->hostchip))
        goto error_enodev;
    
+   //loading Message Object in IF1
    c_can_write_reg_w(pmsgobj->hostchip, readMaskCM, CCIF1CM);
    c_can_write_reg_w(pmsgobj->hostchip, pmsgobj->object, CCIF1CR);
 
-   //setting Message Valid Bit to zero
    if (c_can_if1_busycheck(pmsgobj->hostchip))
        goto error_enodev;
 
+   //setting Message Valid Bit to zero
    c_can_write_reg_w(pmsgobj->hostchip, 0, CCIF1A2);
    c_can_write_reg_w(pmsgobj->hostchip, writeMaskCM, CCIF1CM);
    c_can_write_reg_w(pmsgobj->hostchip, pmsgobj->object, CCIF1CR);
 
-   //Configuring Message-Object
    /* Only access when the C_CAN controller is idle */
    if (c_can_if1_busycheck(pmsgobj->hostchip))
        goto error_enodev;
 
-   mcreg = c_can_read_reg_w(pmsgobj->hostchip, CCIF1CM);
+   //Configuring Message-Object
+   mcreg = c_can_read_reg_w(pmsgobj->hostchip, CCIF1DMC);
    c_can_write_reg_w(pmsgobj->hostchip, 
                      ((mcreg & IFXMC_UMASK) | IFXMC_EOB | IFXMC_RXIE), CCIF1DMC);
+
    //writing arbitration mask for extended or standart mode
    if (can_msgobj_test_fl(pmsgobj,RX_MODE_EXT))
      {
index 7c93901..72ac0b5 100644 (file)
@@ -163,8 +163,6 @@ inline void c_can_irq_read_handler( struct canchip_t *pchip,
                pchip->stat.cntRxData += pmsgobj->rx_msg.length;
            #endif /*CAN_WITH_STATISTICS*/
 
-               spin_unlock( &c_can_sprlock );
-
                // Check if new data arrived
                if (c_can_if1_busycheck(pchip)) ;
                c_can_write_reg_w(pchip, readMaskCM, CCIF1CM);
@@ -223,15 +221,7 @@ int c_can_irq_handler(int irq, struct canchip_t *pchip)
        u16 irqreg = 0;
        u32 msgid = 0;
        u16 tempCntlReg = 0;
-       //#ifdef CAN_DEBUG
-       // u32 intCntrVAddr = 0;
-       //#endif
-       //unsigned short flags = 0;
 
-       //if (pchip->ntype != CAN_CHIPTYPE_C_CAN)       {
-       //      DEBUGMSG("\n(c%d)IRQ not for c_can_irq_handler(...)\n", pchip->chip_idx);
-       //      return;
-       //}
 
        irqreg = c_can_read_reg_w( pchip, CCINTR );
 
@@ -253,28 +243,6 @@ int c_can_irq_handler(int irq, struct canchip_t *pchip)
        c_can_registerdump(pchip);
     #endif
 
-/*
-#ifdef CAN_DEBUG
-       if ( (!( intCntrVAddr = (u32)ioremap( 0x80024000, 0xCD ) ))) {
-               DEBUGMSG("Failed to map Interrupt Controller IO-memory\n");
-       }
-       else {
-
-   DEBUGMSG( "Mapped Interrupt Controller IO-memory: 0x%lx - 0x%lx to 0x%lx\n",
-               (unsigned long)0X80024000,
-             (unsigned long)0X800240CC,
-             (unsigned long)intCntrVAddr);
-       }
-
-       DEBUGMSG("Current Interrupt Status Register (ISR): 0x%4.4lx\n",
-                               (long)readl(intCntrVAddr + 4));
-       DEBUGMSG("Current Interrupt ID: %d\n",
-                               (int)(readl(intCntrVAddr + 0x90) & 0xF));
-       iounmap( (void*)intCntrVAddr);
-       DEBUGMSG( "Unmapped Interrupt Controller IO-memory: 0x%lx\n",
-             (unsigned long)intCntrVAddr);
-#endif
-*/
        while ( irqreg ){
                // Handle change in status register