]> rtime.felk.cvut.cz Git - lincan.git/blobdiff - lincan/src/msmcan.c
The first round of I/O space pointers separation.
[lincan.git] / lincan / src / msmcan.c
index 9851b5ff5fb34a85443e89c076f06292f4861ac8..b6ebbae70cd52f55f1e1b1f4ccfc191cb397953f 100644 (file)
@@ -61,7 +61,7 @@ int msmcan_reset(struct candevice_t *candev)
        DEBUGMSG("Resetting msmcan hardware ...\n");
        /* we don't use template_write_register because we don't use the two first
           registers of the card but the third in order to make a hard reset */
-       /* outb (1, msmcan_base + candev->res_addr); */
+       /* can_outb (1, msmcan_base + candev->res_addr); */
 
 
        /* terrible MSMCAN reset design - best to comment out */
@@ -128,7 +128,7 @@ int msmcan_init_chip_data(struct candevice_t *candev, int chipnr)
        i82527_fill_chipspecops(candev->chip[chipnr]);
        /* device uses indexed access */
        candev->chip[chipnr]->chip_base_addr=
-           candev->io_addr << 16;
+           can_ioport2ioptr(candev->io_addr << 16);
        candev->chip[chipnr]->clock = 16000000;
        /* The CLKOUT has to be enabled to reset MSMCAN MAX1232 watchdog */
        candev->chip[chipnr]->int_cpu_reg = iCPU_DSC | iCPU_CEN;
@@ -172,17 +172,18 @@ int msmcan_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 msmcan_write_register(unsigned data, unsigned long address)
+void msmcan_write_register(unsigned data, can_ioptr_t address)
 {
        /* address is combination of base address shifted left by 16 and index */
        can_spin_irqflags_t flags;
+       unsigned long addr=can_ioptr2ulong(address);
 
        /* the msmcan card has two registers, the data register at 0x0
           and the address register at 0x01 */
 
        can_spin_lock_irqsave(&msmcan_port_lock,flags);
-       outb(address & 0xff, (address>>16)+1);
-       outb(data, address>>16); 
+       can_outb(addr & 0xff, (addr>>16)+1);
+       can_outb(data, addr>>16); 
        can_spin_unlock_irqrestore(&msmcan_port_lock,flags);
 }
 
@@ -190,7 +191,7 @@ void msmcan_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 msmcan_read_register(unsigned long address)
+unsigned msmcan_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 
@@ -198,11 +199,11 @@ unsigned msmcan_read_register(unsigned long address)
           data */
        unsigned char ret;
        can_spin_irqflags_t flags;
-    
+       unsigned long addr=can_ioptr2ulong(address);
 
        can_spin_lock_irqsave(&msmcan_port_lock,flags);
-       outb(address & 0xff, (address>>16)+1);
-       ret=inb(address>>16); 
+       can_outb(addr & 0xff, (addr>>16)+1);
+       ret=can_inb(addr>>16); 
        can_spin_unlock_irqrestore(&msmcan_port_lock,flags);
        return ret;
 }