]> rtime.felk.cvut.cz Git - lincan.git/blobdiff - lincan/src/nsi_canpci.c
Merge branch 'master' into can-usb1
[lincan.git] / lincan / src / nsi_canpci.c
index e3e607eb34fa29928c1a5f1a2e9c37636c9449ee..97ce2b43ba09c6cd49ad9ccd8d67099daa3ca1db 100644 (file)
@@ -23,10 +23,10 @@ extern int mo15mask;
 #include <linux/module.h>
 
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10))
-       #define ioread32        readl
-       #define iowrite32       writel
-       #define ioread8         readb
-       #define iowrite8        writeb
+       #define ioread32        can_readl
+       #define iowrite32       can_writel
+       #define ioread8         can_readb
+       #define iowrite8        can_writeb
 #else
 #endif
 
@@ -90,7 +90,7 @@ int nsi_canpci_config_irqs(struct canchip_t *chip, short irqs)
                        DEBUGMSG("starting interrupt on chip 1\n");
                        it_mask=8;
                }
-               candev=(struct candevice_t *)chip->chip_data;
+               candev=chip->hostdevice;
                it_reg = ioread32( (void*)(candev->io_addr+PLX_INTCSR));
                it_reg|=it_mask|0x40;
                iowrite32(it_reg,(void*)(candev->io_addr+PLX_INTCSR));
@@ -107,7 +107,7 @@ int nsi_canpci_config_irqs(struct canchip_t *chip, short irqs)
                        DEBUGMSG("stoping interrupt on chip 1\n");
                        it_mask=8;
                }
-               candev=(struct candevice_t *)chip->chip_data;
+               candev=chip->hostdevice;
                it_reg = ioread32( (void*)(candev->io_addr+PLX_INTCSR));
                it_reg&=~it_mask;
                iowrite32(it_reg,(void*)(candev->io_addr+PLX_INTCSR));
@@ -190,7 +190,7 @@ int nsi_canpci_start_chip(struct canchip_t *chip)
                DEBUGMSG("starting chip 1\n");
                it_mask=8;
        }
-       candev=(struct candevice_t *)chip->chip_data;
+       candev=chip->hostdevice;
        it_reg = ioread32( (void*)(candev->io_addr+PLX_INTCSR));
        rmb();
        it_reg|=it_mask|0x40;
@@ -215,7 +215,7 @@ int nsi_canpci_stop_chip(struct canchip_t *chip)
                DEBUGMSG("stoping chip 1\n");
                it_mask=8;
        }
-       candev=(struct candevice_t *)chip->chip_data;
+       candev=chip->hostdevice;
        it_reg = ioread32( (void*)(candev->io_addr+PLX_INTCSR));
        rmb();
        it_reg&=~it_mask;
@@ -230,7 +230,7 @@ int nsi_canpci_irq_handler(int irq, struct canchip_t *chip)
        int retcode;
        unsigned long it_reg;
        struct candevice_t *candev;
-       candev=(struct candevice_t *)chip->chip_data;
+       candev=chip->hostdevice;
        retcode = CANCHIP_IRQ_NONE;
        it_reg = ioread32( (void*)(candev->io_addr+PLX_INTCSR));
        rmb();
@@ -470,7 +470,7 @@ int nsi_canpci_init_chip_data(struct candevice_t *candev, int chipnr)
        candev->chip[chipnr]->chipspecops->stop_chip=nsi_canpci_stop_chip;
        candev->chip[chipnr]->chipspecops->config_irqs=nsi_canpci_config_irqs;
        candev->chip[chipnr]->chipspecops->irq_handler=nsi_canpci_irq_handler;
-       candev->chip[chipnr]->chip_data =candev;
+       /*candev->chip[chipnr]->chip_data = NULL;*/
        
        candev->chip[chipnr]->chip_base_addr= (unsigned long) (((t_CardArray*)(candev->dev_base_addr))->addr_BAR_remap[chipnr+2]);
        candev->chip[chipnr]->clock = iCLOCK;
@@ -517,7 +517,7 @@ int nsi_canpci_program_irq(struct candevice_t *candev)
  * on the CAN chip. You should only have to edit this function if your hardware
  * uses some specific write process.
  */
-void nsi_canpci_write_register(unsigned data, unsigned long address)
+void nsi_canpci_write_register(unsigned data, can_ioptr_t address)
 {
        iowrite8((u8)data,(void*)address);
 }
@@ -526,12 +526,8 @@ void nsi_canpci_write_register(unsigned data, unsigned long address)
  * on the CAN chip. You should only have to edit this function if your hardware
  * uses some specific read process.
  */
-unsigned nsi_canpci_read_register(unsigned long address)
+unsigned nsi_canpci_read_register(can_ioptr_t address)
 {
-    /* this is the same thing that the function write_register.
-       We use the two register, we write the address where we 
-       want to read in a first time. In a second time we read the
-       data */
        return ioread8((void*)address);
 }