The first round of I/O space pointers separation.
authorppisa <ppisa>
Mon, 1 Jan 2007 23:52:54 +0000 (23:52 +0000)
committerppisa <ppisa>
Mon, 1 Jan 2007 23:52:54 +0000 (23:52 +0000)
The new 2.6.x Linux kernels separates I/O space
addresses from kernel and user space ones.
They are defined as (void __iomem *).
To follow this rule and suppress some warnings
LinCAN defines type can_ioptr_t now which allows
to keep code compatible between 2.4.x and 2.6.x kernels.
These changes exposes more other inconsistencies
in some boards support code which should be corrected
one by one later.

The code requires testing and checking on more hardware.

60 files changed:
lincan/include/aim104.h
lincan/include/c_can.h
lincan/include/can_sysdep.h
lincan/include/cc_can104.h
lincan/include/eb8245.h
lincan/include/gensja1000io.h
lincan/include/hms30c7202_can.h
lincan/include/ipci165.h
lincan/include/kthread.h
lincan/include/m437.h
lincan/include/main.h
lincan/include/msmcan.h
lincan/include/ns_dev_can.h
lincan/include/nsi.h
lincan/include/nsi_canpci.h
lincan/include/oscar.h
lincan/include/pc-i03.h
lincan/include/pcan_dongle.h
lincan/include/pccan.h
lincan/include/pcccan.h
lincan/include/pcm3680.h
lincan/include/pikronisa.h
lincan/include/pip.h
lincan/include/smartcan.h
lincan/include/ssv.h
lincan/include/template.h
lincan/include/tscan1.h
lincan/src/adlink7841.c
lincan/src/aim104.c
lincan/src/bfadcan.c
lincan/src/cc_can104.c
lincan/src/eb8245.c
lincan/src/ems_cpcpci.c
lincan/src/gensja1000io.c
lincan/src/hms30c7202_can.c
lincan/src/i82527.c
lincan/src/ipci165.c
lincan/src/kthread.c
lincan/src/kv_pcican.c
lincan/src/m437.c
lincan/src/msmcan.c
lincan/src/ns_dev_can.c
lincan/src/nsi.c
lincan/src/nsi_canpci.c
lincan/src/oscar.c
lincan/src/pc_i03.c
lincan/src/pcan_dongle.c
lincan/src/pccan.c
lincan/src/pcccan.c
lincan/src/pcm3680.c
lincan/src/pikronisa.c
lincan/src/pimx1.c
lincan/src/pip.c
lincan/src/proc.c
lincan/src/setup.c
lincan/src/smartcan.c
lincan/src/ssv.c
lincan/src/template.c
lincan/src/tscan1.c
lincan/src/unican.c

index 0426441..f65074c 100644 (file)
@@ -13,7 +13,7 @@ int aim104_reset(struct candevice_t *candev);
 int aim104_init_hw_data(struct candevice_t *candev);
 int aim104_init_chip_data(struct candevice_t *candev, int chipnr);
 int aim104_init_obj_data(struct canchip_t *chip, int objnr);
-void aim104_write_register(unsigned data, unsigned long address);
-unsigned aim104_read_register(unsigned long address);
+void aim104_write_register(unsigned data, can_ioptr_t address);
+unsigned aim104_read_register(can_ioptr_t address);
 int aim104_program_irq(struct candevice_t *candev);
 
index f5d9d10..5a189b3 100644 (file)
@@ -14,7 +14,7 @@
  */
 extern inline void c_can_write_reg_w(const struct canchip_t *pchip, u16 data, unsigned reg)
 {
-       u32 address = pchip->chip_base_addr + reg;
+       can_ioptr_t address = pchip->chip_base_addr + reg;
     #ifndef CONFIG_OC_LINCAN_DYNAMICIO
        writew(data,address);
     #else /*CONFIG_OC_LINCAN_DYNAMICIO*/
@@ -24,7 +24,7 @@ extern inline void c_can_write_reg_w(const struct canchip_t *pchip, u16 data, un
 
 extern inline u16 c_can_read_reg_w(const struct canchip_t *pchip, unsigned reg)
 {
-       u32 address = pchip->chip_base_addr + reg;
+       can_ioptr_t address = pchip->chip_base_addr + reg;
     #ifndef CONFIG_OC_LINCAN_DYNAMICIO
        return readw(address);
     #else /*CONFIG_OC_LINCAN_DYNAMICIO*/
index f4d66a7..019f985 100644 (file)
   #define del_timer_sync del_timer
 #endif /* <2.4.0 */
 
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9))
+   typedef unsigned long can_ioptr_t;
+   #define can_ioptr2ulong(ioaddr) ((unsigned long)(ioaddr))
+   #define can_ulong2ioptr(addr)   ((unsigned long)(addr))
+   #define can_inb(ioaddr) inb(ioaddr)
+   #define can_outb(data,ioaddr) outb(data,ioaddr)
+   #define can_inw(ioaddr) inb(ioaddr)
+   #define can_outw(data,ioaddr) outb(data,ioaddr)
+   #define can_inl(ioaddr) inb(ioaddr)
+   #define can_outl(data,ioaddr) outb(data,ioaddr)
+#else /* >=2.6.9 */
+   typedef void __iomem * can_ioptr_t;
+   #define can_ioptr2ulong(ioaddr) ((unsigned long __force)(ioaddr))
+   #define can_ulong2ioptr(addr)   ((can_ioptr_t)(addr))
+   #define can_inb(ioaddr) inb(can_ioptr2ulong(ioaddr))
+   #define can_outb(data,ioaddr) outb(data,can_ioptr2ulong(ioaddr))
+   #define can_inw(ioaddr) inb(can_ioptr2ulong(ioaddr))
+   #define can_outw(data,ioaddr) outb(data,can_ioptr2ulong(ioaddr))
+   #define can_inl(ioaddr) inb(can_ioptr2ulong(ioaddr))
+   #define can_outl(data,ioaddr) outb(data,can_ioptr2ulong(ioaddr))
+#endif
+
+#define can_readb  readb
+#define can_writeb writeb
+#define can_readw  readw
+#define can_writew writew
+#define can_readl  readl
+#define can_writel writel
+
+#define can_ioport2ioptr can_ulong2ioptr
+
 #ifdef __HAVE_ARCH_CMPXCHG
   #define CAN_HAVE_ARCH_CMPXCHG
 #endif
index 722746a..b3e5b10 100644 (file)
@@ -13,7 +13,7 @@ int cc104_reset(struct candevice_t *candev);
 int cc104_init_hw_data(struct candevice_t *candev);
 int cc104_init_chip_data(struct candevice_t *candev, int chipnr);
 int cc104_init_obj_data(struct canchip_t *chip, int objnr);
-void cc104_write_register(unsigned data, unsigned long address);
-unsigned cc104_read_register(unsigned long address);
+void cc104_write_register(unsigned data, can_ioptr_t address);
+unsigned cc104_read_register(can_ioptr_t address);
 int cc104_program_irq(struct candevice_t *candev);
 
index f076f38..ccb17dc 100644 (file)
@@ -17,5 +17,5 @@ int eb8245_init_hw_data(struct candevice_t *candev);
 int eb8245_init_chip_data(struct candevice_t *candev, int chipnr);
 int eb8245_init_obj_data(struct canchip_t *chip, int objnr);
 int eb8245_program_irq(struct candevice_t *candev);
-void eb8245_write_register(unsigned data, unsigned long address);
-unsigned eb8245_read_register(unsigned long address);
+void eb8245_write_register(unsigned data, can_ioptr_t address);
+unsigned eb8245_read_register(can_ioptr_t address);
index 78245dc..947992c 100644 (file)
@@ -17,6 +17,6 @@ int gensja1000io_init_hw_data(struct candevice_t *candev);
 int gensja1000io_init_chip_data(struct candevice_t *candev, int chipnr);
 int gensja1000io_init_obj_data(struct canchip_t *chip, int objnr);
 int gensja1000io_program_irq(struct candevice_t *candev);
-void gensja1000io_write_register(unsigned data, unsigned long address);
-unsigned gensja1000io_read_register(unsigned long address);
+void gensja1000io_write_register(unsigned data, can_ioptr_t address);
+unsigned gensja1000io_read_register(can_ioptr_t address);
 
index 9b4704e..520f0ec 100644 (file)
@@ -17,8 +17,8 @@ int hms30c7202_init_chip_data(struct candevice_t *candev, int chipnr);
 int hms30c7202_request_io(struct candevice_t *candev);\r
 int hms30c7202_release_io(struct candevice_t *candev);\r
 int hms30c7202_reset(  struct candevice_t *candev);\r
-void hms30c7202_write_register(unsigned data, unsigned long address);\r
-unsigned hms30c7202_read_register(unsigned long address);\r
+void hms30c7202_write_register(unsigned data, can_ioptr_t address);\r
+unsigned hms30c7202_read_register(can_ioptr_t address);\r
 \r
 \r
 \r
index 7f50484..4a3f354 100644 (file)
@@ -6,6 +6,7 @@
  * Version lincan-0.3  17 Jun 2004
  */ 
 
+#include "../include/can_sysdep.h"
 #include "../include/kthread.h"
 
 /* PCI device identification */
 
 /* BCI queue info */
 struct bci_queue_t {
-  int           idx;                       /* points to the active record in buffer */
-  unsigned long addr;                      /* start address of the message queue    */
+  int         idx;                         /* points to the active record in buffer */
+  can_ioptr_t addr;                        /* start address of the message queue    */
 };
 
 /* ipci165 chip data */
index 2d3ee56..2c570b0 100644 (file)
@@ -1,7 +1,9 @@
 #ifndef _KTHREAD_H
 #define _KTHREAD_H
-#include <linux/config.h>
 #include <linux/version.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17))
+#include <linux/config.h>
+#endif
 
 #include <linux/kernel.h>
 #include <linux/sched.h>
index 351e3a3..f8a317f 100644 (file)
@@ -15,7 +15,7 @@ int m437_reset(struct candevice_t *candev);
 int m437_init_hw_data(struct candevice_t *candev);
 int m437_init_chip_data(struct candevice_t *candev, int chipnr);
 int m437_init_obj_data(struct canchip_t *chip, int objnr);
-void m437_write_register(unsigned data, unsigned long address);
-unsigned m437_read_register(unsigned long address);
+void m437_write_register(unsigned data, can_ioptr_t address);
+unsigned m437_read_register(can_ioptr_t address);
 int m437_program_irq(struct candevice_t *candev);
 int m437_register(struct hwspecops_t *hwspecops);
index fa98bb2..5e7ed39 100644 (file)
@@ -75,7 +75,8 @@ struct candevice_t {
        int candev_idx;                 /* board index in canhardware_t.candevice[] */
        unsigned long io_addr;          /* IO/physical MEM address */
        unsigned long res_addr;         /* optional reset register port */
-       unsigned long dev_base_addr;    /* CPU translated IO/virtual MEM address */
+       can_ioptr_t dev_base_addr;      /* CPU translated IO/virtual MEM address */
+       can_ioptr_t aux_base_addr;      /* CPU translated IO/virtual MEM address */
        unsigned int flags;
        int nr_all_chips;
        int nr_82527_chips;
@@ -154,13 +155,13 @@ struct canchip_t {
        char *chip_type;
        int chip_idx;   /* chip index in candevice_t.chip[] */
        int chip_irq;
-       unsigned long chip_base_addr;
+       can_ioptr_t chip_base_addr;
        unsigned int flags;
        long clock; /* Chip clock in Hz */
        long baudrate;
 
-       void (*write_register)(unsigned data,unsigned long address);
-       unsigned (*read_register)(unsigned long address);
+       void (*write_register)(unsigned data, can_ioptr_t address);
+       unsigned (*read_register)(can_ioptr_t address);
        
        void *chip_data;
        
@@ -214,7 +215,7 @@ struct canchip_t {
  *              that reuse same object for TX
  */
 struct msgobj_t {
-       unsigned long obj_base_addr;
+       can_ioptr_t obj_base_addr;
        unsigned int minor;     /* associated device minor number  */
        unsigned int object;    /* object number in canchip_t +1 for debug printk */
        unsigned long obj_flags; 
@@ -298,8 +299,8 @@ struct hwspecops_t {
        int (*init_chip_data)(struct candevice_t *candev, int chipnr);
        int (*init_obj_data)(struct canchip_t *chip, int objnr);
        int (*program_irq)(struct candevice_t *candev);
-       void (*write_register)(unsigned data,unsigned long address);
-       unsigned (*read_register)(unsigned long address);
+       void (*write_register)(unsigned data, can_ioptr_t address);
+       unsigned (*read_register)(can_ioptr_t address);
 };
 
 /**
@@ -393,43 +394,43 @@ extern struct mem_addr *mem_head;
 
 
 #if defined(CONFIG_OC_LINCAN_PORTIO_ONLY)
-extern inline void can_write_reg(const struct canchip_t *chip, unsigned char data, unsigned address)
+extern inline void can_write_reg(const struct canchip_t *chip, unsigned char data, unsigned reg_offs)
 {
-       outb(data, chip->chip_base_addr+address);
+       can_outb(data, chip->chip_base_addr+reg_offs);
 }
-extern inline unsigned can_read_reg(const struct canchip_t *chip, unsigned address)
+extern inline unsigned can_read_reg(const struct canchip_t *chip, unsigned reg_offs)
 {
-       return inb(chip->chip_base_addr+address);
+       return can_inb(chip->chip_base_addr+reg_offs);
 }
 extern inline void canobj_write_reg(const struct canchip_t *chip, const struct msgobj_t *obj,
-                               unsigned char data, unsigned address)
+                               unsigned char data, unsigned reg_offs)
 {
-       outb(data, obj->obj_base_addr+address);
+       can_outb(data, obj->obj_base_addr+reg_offs);
 }
 extern inline unsigned canobj_read_reg(const struct canchip_t *chip, const struct msgobj_t *obj,
-                               unsigned address)
+                               unsigned reg_offs)
 {
-       return inb(obj->obj_base_addr+address);
+       return can_inb(obj->obj_base_addr+reg_offs);
 }
 
 #elif defined(CONFIG_OC_LINCAN_MEMIO_ONLY)
-extern inline void can_write_reg(const struct canchip_t *chip, unsigned char data, unsigned address)
+extern inline void can_write_reg(const struct canchip_t *chip, unsigned char data, unsigned reg_offs)
 {
-       writeb(data, chip->chip_base_addr+address);
+       can_writeb(data, chip->chip_base_addr+reg_offs);
 }
-extern inline unsigned can_read_reg(const struct canchip_t *chip, unsigned address)
+extern inline unsigned can_read_reg(const struct canchip_t *chip, unsigned reg_offs)
 {
-       return readb(chip->chip_base_addr+address);
+       return can_readb(chip->chip_base_addr+reg_offs);
 }
 extern inline void canobj_write_reg(const struct canchip_t *chip, const struct msgobj_t *obj,
-                               unsigned char data, unsigned address)
+                               unsigned char data, unsigned reg_offs)
 {
-       writeb(data, obj->obj_base_addr+address);
+       can_writeb(data, obj->obj_base_addr+reg_offs);
 }
 extern inline unsigned canobj_read_reg(const struct canchip_t *chip, const struct msgobj_t *obj,
-                               unsigned address)
+                               unsigned reg_offs)
 {
-       return readb(obj->obj_base_addr+address);
+       return can_readb(obj->obj_base_addr+reg_offs);
 }
 
 #else /*CONFIG_OC_LINCAN_DYNAMICIO*/
@@ -437,42 +438,42 @@ extern inline unsigned canobj_read_reg(const struct canchip_t *chip, const struc
 #define CONFIG_OC_LINCAN_DYNAMICIO
 #endif
 
-/* Inline function to write to the hardware registers. The argument address is 
- * relative to the memory map of the chip and not the absolute memory address.
+/* Inline function to write to the hardware registers. The argument reg_offs is 
+ * relative to the memory map of the chip and not the absolute memory reg_offs.
  */
-extern inline void can_write_reg(const struct canchip_t *chip, unsigned char data, unsigned address)
+extern inline void can_write_reg(const struct canchip_t *chip, unsigned char data, unsigned reg_offs)
 {
-       unsigned long address_to_write;
-       address_to_write = chip->chip_base_addr+address;
+       can_ioptr_t address_to_write;
+       address_to_write = chip->chip_base_addr+reg_offs;
        chip->write_register(data, address_to_write);
 }
 
-extern inline unsigned can_read_reg(const struct canchip_t *chip, unsigned address)
+extern inline unsigned can_read_reg(const struct canchip_t *chip, unsigned reg_offs)
 {
-       unsigned long address_to_read;
-       address_to_read = chip->chip_base_addr+address;
+       can_ioptr_t address_to_read;
+       address_to_read = chip->chip_base_addr+reg_offs;
        return chip->read_register(address_to_read);
 }
 
 extern inline void canobj_write_reg(const struct canchip_t *chip, const struct msgobj_t *obj,
-                               unsigned char data, unsigned address)
+                               unsigned char data, unsigned reg_offs)
 {
-       unsigned long address_to_write;
-       address_to_write = obj->obj_base_addr+address;
+       can_ioptr_t address_to_write;
+       address_to_write = obj->obj_base_addr+reg_offs;
        chip->write_register(data, address_to_write);
 }
 
 extern inline unsigned canobj_read_reg(const struct canchip_t *chip, const struct msgobj_t *obj,
-                               unsigned address)
+                               unsigned reg_offs)
 {
-       unsigned long address_to_read;
-       address_to_read = obj->obj_base_addr+address;
+       can_ioptr_t address_to_read;
+       address_to_read = obj->obj_base_addr+reg_offs;
        return chip->read_register(address_to_read);
 }
 
 #endif /*CONFIG_OC_LINCAN_DYNAMICIO*/
 
-int can_base_addr_fixup(struct candevice_t *candev, unsigned long new_base);
+int can_base_addr_fixup(struct candevice_t *candev, can_ioptr_t new_base);
 int can_request_io_region(unsigned long start, unsigned long n, const char *name);
 void can_release_io_region(unsigned long start, unsigned long n);
 int can_request_mem_region(unsigned long start, unsigned long n, const char *name);
index 9f5b387..5364809 100644 (file)
@@ -13,7 +13,7 @@ int msmcan_reset(struct candevice_t *candev);
 int msmcan_init_hw_data(struct candevice_t *candev);
 int msmcan_init_chip_data(struct candevice_t *candev, int chipnr);
 int msmcan_init_obj_data(struct canchip_t *chip, int objnr);
-void msmcan_write_register(unsigned data, unsigned long address);
-unsigned msmcan_read_register(unsigned long address);
+void msmcan_write_register(unsigned data, can_ioptr_t address);
+unsigned msmcan_read_register(can_ioptr_t address);
 int msmcan_program_irq(struct candevice_t *candev);
 
index 79be115..2e928d2 100644 (file)
@@ -20,8 +20,8 @@ int ns_dev_init_chip_data(struct candevice_t *candev, int chipnr);
 int ns_dev_request_io(struct candevice_t *candev);
 int ns_dev_release_io(struct candevice_t *candev);
 int ns_dev_reset(struct candevice_t *candev);
-void ns_dev_write_register(unsigned data, unsigned long address);
-unsigned ns_dev_read_register(unsigned long address);
+void ns_dev_write_register(unsigned data, can_ioptr_t address);
+unsigned ns_dev_read_register(can_ioptr_t address);
 
 int ns_dev_init_obj_data(struct canchip_t *chip, int objnr);
 int ns_dev_program_irq(struct candevice_t *candev);
index c48e4ef..45cf660 100644 (file)
@@ -13,7 +13,7 @@ int nsi_reset(struct candevice_t *candev);
 int nsi_init_hw_data(struct candevice_t *candev);
 int nsi_init_chip_data(struct candevice_t *candev, int chipnr);
 int nsi_init_obj_data(struct canchip_t *chip, int objnr);
-void nsi_write_register(unsigned data, unsigned long address);
-unsigned nsi_read_register(unsigned long address);
+void nsi_write_register(unsigned data, can_ioptr_t address);
+unsigned nsi_read_register(can_ioptr_t address);
 int nsi_program_irq(struct candevice_t *candev);
 
index d59f927..f268172 100644 (file)
@@ -13,7 +13,7 @@ int nsi_canpci_reset(struct candevice_t *candev);
 int nsi_canpci_init_hw_data(struct candevice_t *candev);
 int nsi_canpci_init_chip_data(struct candevice_t *candev, int chipnr);
 int nsi_canpci_init_obj_data(struct canchip_t *chip, int objnr);
-void nsi_canpci_write_register(unsigned data, unsigned long address);
-unsigned nsi_canpci_read_register(unsigned long address);
+void nsi_canpci_write_register(unsigned data, can_ioptr_t address);
+unsigned nsi_canpci_read_register(can_ioptr_t address);
 int nsi_canpci_program_irq(struct candevice_t *candev);
 
index 50cca0c..9560017 100644 (file)
@@ -13,7 +13,7 @@ int oscar_reset(struct candevice_t *candev);
 int oscar_init_hw_data(struct candevice_t *candev);
 int oscar_init_chip_data(struct candevice_t *candev, int chipnr);
 int oscar_init_obj_data(struct canchip_t *chip, int objnr);
-void oscar_write_register(unsigned data, unsigned long address);
-unsigned oscar_read_register(unsigned long address);
+void oscar_write_register(unsigned data, can_ioptr_t address);
+unsigned oscar_read_register(can_ioptr_t address);
 int oscar_program_irq(struct candevice_t *candev);
 
index 0e8ec4f..589e042 100644 (file)
@@ -13,7 +13,7 @@ int pci03_reset(struct candevice_t *candev);
 int pci03_init_hw_data(struct candevice_t *candev);
 int pci03_init_chip_data(struct candevice_t *candev, int chipnr);
 int pci03_init_obj_data(struct canchip_t *chip, int objnr);
-void pci03_write_register(unsigned data, unsigned long address);
-unsigned pci03_read_register(unsigned long address);
+void pci03_write_register(unsigned data, can_ioptr_t address);
+unsigned pci03_read_register(can_ioptr_t address);
 int pci03_program_irq(struct candevice_t *candev);
 
index ca5a14d..b9c07eb 100644 (file)
@@ -96,8 +96,8 @@ int pcan_dongle_reset(struct candevice_t *candev);
 int pcan_dongle_init_hw_data(struct candevice_t *candev);
 int pcan_dongle_init_chip_data(struct candevice_t *candev, int chipnr);
 int pcan_dongle_init_obj_data(struct canchip_t *chip, int objnr);
-void pcan_dongle_write_register(unsigned data, unsigned long address);
-unsigned pcan_dongle_read_register(unsigned long address);
+void pcan_dongle_write_register(unsigned data, can_ioptr_t address);
+unsigned pcan_dongle_read_register(can_ioptr_t address);
 int pcan_dongle_program_irq(struct candevice_t *candev);
 
 #endif // __PCAN_DONGLE_H__
index 918e7cd..35006c9 100644 (file)
@@ -19,8 +19,8 @@ int pccanq_reset(struct candevice_t *candev);
 int pccan_init_hw_data(struct candevice_t *candev);
 int pccan_init_chip_data(struct candevice_t *candev, int chipnr);
 int pccan_init_obj_data(struct canchip_t *chip, int objnr);
-void pccan_write_register(unsigned data, unsigned long address);
-unsigned pccan_read_register(unsigned long address);
+void pccan_write_register(unsigned data, can_ioptr_t address);
+unsigned pccan_read_register(can_ioptr_t address);
 int pccan_program_irq(struct candevice_t *candev);
 
 
index 50039c1..183186b 100644 (file)
@@ -13,7 +13,7 @@ int pcccan_reset(struct candevice_t *candev);
 int pcccan_init_hw_data(struct candevice_t *candev);
 int pcccan_init_chip_data(struct candevice_t *candev, int chipnr);
 int pcccan_init_obj_data(struct canchip_t *chip, int objnr);
-void pcccan_write_register(unsigned data, unsigned long address);
-unsigned pcccan_read_register(unsigned long address);
+void pcccan_write_register(unsigned data, can_ioptr_t address);
+unsigned pcccan_read_register(can_ioptr_t address);
 int pcccan_program_irq(struct candevice_t *candev);
 
index d97cbd2..45b665c 100644 (file)
@@ -13,7 +13,7 @@ int pcm3680_reset(struct candevice_t *candev);
 int pcm3680_init_hw_data(struct candevice_t *candev);
 int pcm3680_init_chip_data(struct candevice_t *candev, int chipnr);
 int pcm3680_init_obj_data(struct canchip_t *chip, int objnr);
-void pcm3680_write_register(unsigned data, unsigned long address);
-unsigned pcm3680_read_register(unsigned long address);
+void pcm3680_write_register(unsigned data, can_ioptr_t address);
+unsigned pcm3680_read_register(can_ioptr_t address);
 int pcm3680_program_irq(struct candevice_t *candev);
 
index a6ba399..292c46e 100644 (file)
@@ -17,6 +17,6 @@ int pikronisa_init_hw_data(struct candevice_t *candev);
 int pikronisa_init_chip_data(struct candevice_t *candev, int chipnr);
 int pikronisa_init_obj_data(struct canchip_t *chip, int objnr);
 int pikronisa_program_irq(struct candevice_t *candev);
-void pikronisa_write_register(unsigned data, unsigned long address);
-unsigned pikronisa_read_register(unsigned long address);
+void pikronisa_write_register(unsigned data, can_ioptr_t address);
+unsigned pikronisa_read_register(can_ioptr_t address);
 
index 5feddfe..93dcefa 100644 (file)
@@ -15,7 +15,7 @@ int pip_reset(struct candevice_t *candev);
 int pip_init_hw_data(struct candevice_t *candev);
 int pip_init_chip_data(struct candevice_t *candev, int chipnr);
 int pip_init_obj_data(struct canchip_t *chip, int objnr);
-void pip_write_register(unsigned data, unsigned long address);
-unsigned pip_read_register(unsigned long address);
+void pip_write_register(unsigned data, can_ioptr_t address);
+unsigned pip_read_register(can_ioptr_t address);
 int pip_program_irq(struct candevice_t *candev);
 
index 58c0d42..11887be 100644 (file)
@@ -13,6 +13,6 @@ int smartcan_reset(struct candevice_t *candev);
 int smartcan_init_hw_data(struct candevice_t *candev);
 int smartcan_init_chip_data(struct candevice_t *candev, int chipnr);
 int smartcan_init_obj_data(struct canchip_t *chip, int objnr);
-void smartcan_write_register(unsigned data, unsigned long address);
-unsigned smartcan_read_register(unsigned long address);
+void smartcan_write_register(unsigned data, can_ioptr_t address);
+unsigned smartcan_read_register(can_ioptr_t address);
 
index 6395782..2bab005 100644 (file)
@@ -11,7 +11,7 @@ int ssv_reset(struct candevice_t *candev);
 int ssv_init_hw_data(struct candevice_t *candev);
 int ssv_init_chip_data(struct candevice_t *candev, int chipnr);
 int ssv_init_obj_data(struct canchip_t *chip, int objnr);
-void ssv_write_register(unsigned data, unsigned long address);
-unsigned ssv_read_register(unsigned long address);
+void ssv_write_register(unsigned data, can_ioptr_t address);
+unsigned ssv_read_register(can_ioptr_t address);
 int ssv_program_irq(struct candevice_t *candev);
 
index 88f162c..3963dc3 100644 (file)
@@ -13,7 +13,7 @@ int template_reset(struct candevice_t *candev);
 int template_init_hw_data(struct candevice_t *candev);
 int template_init_chip_data(struct candevice_t *candev, int chipnr);
 int template_init_obj_data(struct canchip_t *chip, int objnr);
-void template_write_register(unsigned data, unsigned long address);
-unsigned template_read_register(unsigned long address);
+void template_write_register(unsigned data, can_ioptr_t address);
+unsigned template_read_register(can_ioptr_t address);
 int template_program_irq(struct candevice_t *candev);
 
index 97efdb6..427b387 100644 (file)
@@ -58,8 +58,8 @@ int tscan1_reset(struct candevice_t *candev);
 int tscan1_init_hw_data(struct candevice_t *candev);
 int tscan1_init_chip_data(struct candevice_t *candev, int chipnr);
 int tscan1_init_obj_data(struct canchip_t *chip, int objnr);
-void tscan1_write_register(unsigned data, unsigned long address);
-unsigned tscan1_read_register(unsigned long address);
+void tscan1_write_register(unsigned data, can_ioptr_t address);
+unsigned tscan1_read_register(can_ioptr_t address);
 int tscan1_program_irq(struct candevice_t *candev);
 
 unsigned long tscan1_getmappedaddr(unsigned long address);
index 59107d4..248f480 100644 (file)
@@ -95,14 +95,14 @@ int adlink7841_release_io(struct candevice_t *candev)
 }
 
 
-void adlink7841_write_register(unsigned data, unsigned long address)
+void adlink7841_write_register(unsigned data, can_ioptr_t address)
 {
-       outb(data,address); 
+       can_outb(data,address); 
 }
 
-unsigned adlink7841_read_register(unsigned long address)
+unsigned adlink7841_read_register(can_ioptr_t address)
 {
-       return inb(address);
+       return can_inb(address);
 }
 
 int adlink7841_reset(struct candevice_t *candev)
@@ -194,7 +194,7 @@ int adlink7841_init_chip_data(struct candevice_t *candev, int chipnr)
 
        sja1000p_fill_chipspecops(candev->chip[chipnr]);
        candev->chip[chipnr]->chip_base_addr=
-                       candev->io_addr+chipnr*ADLINK7841_BYTES_PER_CIRCUIT;
+                       can_ioport2ioptr(candev->io_addr+chipnr*ADLINK7841_BYTES_PER_CIRCUIT);
        candev->chip[chipnr]->flags = 0;
        candev->chip[chipnr]->int_cpu_reg = 0;
        candev->chip[chipnr]->int_clk_reg = 0;
index 485186b..015a793 100644 (file)
@@ -161,7 +161,7 @@ int aim104_init_hw_data(struct candevice_t *candev)
 int aim104_init_chip_data(struct candevice_t *candev, int chipnr)
 {
        sja1000_fill_chipspecops(candev->chip[chipnr]);
-       candev->chip[chipnr]->chip_base_addr=candev->io_addr;
+       candev->chip[chipnr]->chip_base_addr=can_ioport2ioptr(candev->io_addr);
        candev->chip[chipnr]->clock = 16000000;
        candev->chip[chipnr]->flags = 0;
        candev->chip[chipnr]->sja_cdr_reg = 0x08;
@@ -223,9 +223,9 @@ int aim104_program_irq(struct candevice_t *candev)
  * Return Value: The function does not return a value
  * File: src/template.c
  */
-void aim104_write_register(unsigned data, unsigned long address)
+void aim104_write_register(unsigned data, can_ioptr_t address)
 {
-       outb(data,address);
+       can_outb(data,address);
 }
 
 /**
@@ -238,9 +238,9 @@ void aim104_write_register(unsigned data, unsigned long address)
  * Return Value: The function returns the value stored in @address
  * File: src/template.c
  */
-unsigned aim104_read_register(unsigned long address)
+unsigned aim104_read_register(can_ioptr_t address)
 {
-       return inb(address);
+       return can_inb(address);
 }
 
 /* !!! Don't change this function !!! */
index f04fe9f..75294ec 100644 (file)
@@ -41,8 +41,8 @@ static CAN_DEFINE_SPINLOCK(bfadcan_win_lock);
 #define IO_RANGE 0x100
 #endif
 
-unsigned bfadcan_read_register(unsigned long address);
-void bfadcan_write_register(unsigned data, unsigned long address);
+unsigned bfadcan_read_register(can_ioptr_t address);
+void bfadcan_write_register(unsigned data, can_ioptr_t address);
 
 
 /**
@@ -195,18 +195,18 @@ int bfadcan_init_chip_data(struct candevice_t *candev, int chipnr)
 {
        unsigned int id1, id2;
        sja1000p_fill_chipspecops(candev->chip[chipnr]);
-       candev->chip[chipnr]->chip_base_addr=candev->io_addr;
+       candev->chip[chipnr]->chip_base_addr=can_ioport2ioptr(candev->io_addr);
        if(candev->chip[chipnr]->clock<=0)
                candev->chip[chipnr]->clock = CAN_BFAD_CLOCKFREQ;
        candev->chip[chipnr]->sja_cdr_reg = sjaCDR_CBP | sjaCDR_CLK_OFF;
        candev->chip[chipnr]->sja_ocr_reg = sjaOCR_MODE_NORMAL | sjaOCR_TX0_LH;
-       id1 = inb(0xe284);
-       id2 = inb(0xe285);
+       id1 = can_inb(0xe284);
+       id2 = can_inb(0xe285);
 
 
        CANMSG("can driver ver lincan-0.3, at %04lx, CPLD v%d.%d.%d.%d\n",
-                                       candev->chip[chipnr]->chip_base_addr,
-                                                       id1>>4, id1&0x0f, id2>>4, id2&0x0f);
+                       can_ioptr2ulong(candev->chip[chipnr]->chip_base_addr),
+                       id1>>4, id1&0x0f, id2>>4, id2&0x0f);
 
 
        return 0;
@@ -264,16 +264,16 @@ int bfadcan_program_irq(struct candevice_t *candev)
  * Return Value: The function does not return a value
  * File: src/bfadcan.c
  */
-void bfadcan_write_register(unsigned data, unsigned long address)
+void bfadcan_write_register(unsigned data, can_ioptr_t address)
 {
 #ifdef WINDOWED_ACCESS
        can_spin_irqflags_t flags;
        can_spin_lock_irqsave(&bfadcan_win_lock,flags);
-       outb(address&0x00ff,0x200);
-       outb(data, 0x201);
+       can_outb(can_ioptr2ulong(address)&0x00ff,0x200);
+       can_outb(data, 0x201);
        can_spin_unlock_irqrestore(&bfadcan_win_lock,flags);
 #else
-       outb(data,address);
+       can_outb(data,address);
 #endif
 }
 
@@ -287,18 +287,18 @@ void bfadcan_write_register(unsigned data, unsigned long address)
  * Return Value: The function returns the value stored in @address
  * File: src/bfadcan.c
  */
-unsigned bfadcan_read_register(unsigned long address)
+unsigned bfadcan_read_register(can_ioptr_t address)
 {
 #ifdef WINDOWED_ACCESS
        can_spin_irqflags_t flags;
        int ret;
        can_spin_lock_irqsave(&bfadcan_win_lock,flags);
-       outb(address&0x00ff,0x200);
-       ret = inb(0x201);
+       can_outb(can_ioptr2ulong(address)&0x00ff,0x200);
+       ret = can_inb(0x201);
        can_spin_unlock_irqrestore(&bfadcan_win_lock,flags);
        return ret;
 #else
-       return inb(address);
+       return can_inb(address);
 #endif
 }
 
index 2dafc3d..15819a3 100644 (file)
@@ -140,7 +140,7 @@ int cc104_init_hw_data(struct candevice_t *candev)
 int cc104_init_chip_data(struct candevice_t *candev, int chipnr)
 {
        sja1000_fill_chipspecops(candev->chip[chipnr]);
-       candev->chip[chipnr]->chip_base_addr=candev->io_addr;
+       candev->chip[chipnr]->chip_base_addr=can_ioport2ioptr(candev->io_addr);
        candev->chip[chipnr]->clock = 16000000;
        candev->chip[chipnr]->flags = 0;
        candev->chip[chipnr]->sja_cdr_reg = sjaCDR_CBP | sjaCDR_CLK_OFF;
@@ -202,9 +202,9 @@ int cc104_program_irq(struct candevice_t *candev)
  * Return Value: The function does not return a value
  * File: src/template.c
  */
-void cc104_write_register(unsigned data, unsigned long address)
+void cc104_write_register(unsigned data, can_ioptr_t address)
 {
-       outb(data,address);
+       can_outb(data,address);
 }
 
 /**
@@ -217,9 +217,9 @@ void cc104_write_register(unsigned data, unsigned long address)
  * Return Value: The function returns the value stored in @address
  * File: src/template.c
  */
-unsigned cc104_read_register(unsigned long address)
+unsigned cc104_read_register(can_ioptr_t address)
 {
-       return inb(address);
+       return can_inb(address);
 }
 
 /* !!! Don't change this function !!! */
index b871305..ff1f1c5 100644 (file)
  */
 int eb8245_request_io(struct candevice_t *candev)
 {
-        int remap_addr;
+        can_ioptr_t remap_addr;
        
        if (!can_request_mem_region(candev->io_addr,IO_RANGE,DEVICE_NAME " - eb8245")) {
                CANMSG("Unable to request IO-memory: 0x%lx\n",candev->io_addr);
                return -ENODEV;
        }
-       if ( !( remap_addr = (long) ioremap( candev->io_addr, IO_RANGE ) ) ) {
+       if ( !( remap_addr = ioremap( candev->io_addr, IO_RANGE ) ) ) {
                CANMSG("Unable to access I/O memory at: 0x%lx\n", candev->io_addr);
                can_release_mem_region(candev->io_addr,IO_RANGE);
                return -ENODEV;
@@ -241,11 +241,11 @@ int eb8245_program_irq(struct candevice_t *candev)
  * Return Value: The function does not return a value
  * File: src/eb8245.c
  */
-void eb8245_write_register(unsigned data, unsigned long address)
+void eb8245_write_register(unsigned data, can_ioptr_t address)
 {
        /*DEBUGMSG("eb8245_write_register: addr=0x%lx data=0x%x",
                address,data);*/
-       writeb(data,address);
+       can_writeb(data,address);
 }
 
 /**
@@ -258,9 +258,9 @@ void eb8245_write_register(unsigned data, unsigned long address)
  * Return Value: The function returns the value stored in @address
  * File: src/eb8245.c
  */
-unsigned eb8245_read_register(unsigned long address)
+unsigned eb8245_read_register(can_ioptr_t address)
 {
-       return readb(address);
+       return can_readb(address);
 }
 
 /* !!! Don't change this function !!! */
index d20e281..ffbf76a 100644 (file)
@@ -71,13 +71,13 @@ The board configuration is probably following:
 void ems_cpcpci_disconnect_irq(struct candevice_t *candev)
 {
        /* Disable interrupts from card */
-       writel(0, candev->dev_base_addr + PITA2_ICR);
+       can_writel(0, candev->aux_base_addr + PITA2_ICR);
 }
 
 void ems_cpcpci_connect_irq(struct candevice_t *candev)
 {
        /* Enable interrupts from card */
-       writel(PITA2_ICR_INT0_En, candev->dev_base_addr + PITA2_ICR);
+       can_writel(PITA2_ICR_INT0_En, candev->aux_base_addr + PITA2_ICR);
 }
 
 
@@ -103,20 +103,21 @@ int ems_cpcpci_request_io(struct candevice_t *candev)
     #endif /*(LINUX_VERSION_CODE > KERNEL_VERSION(2,4,21))*/
 
        pita2_addr=pci_resource_start(candev->sysdevptr.pcidev,0);
-       if (!(candev->dev_base_addr = (long) ioremap(pita2_addr, 
+       if (!(candev->aux_base_addr = ioremap(pita2_addr, 
              pci_resource_len(candev->sysdevptr.pcidev,0)))) {
                CANMSG("Unable to access I/O memory at: 0x%lx\n", pita2_addr);
                goto error_ioremap_pita2;
        }
 
        io_addr=pci_resource_start(candev->sysdevptr.pcidev,1);;
-       if (!(candev->io_addr = (long) ioremap(io_addr,
+       if (!(candev->dev_base_addr = ioremap(io_addr,
              pci_resource_len(candev->sysdevptr.pcidev,1)))) {
                CANMSG("Unable to access I/O memory at: 0x%lx\n", io_addr);
                goto error_ioremap_io;
        }
 
-       candev->res_addr=candev->io_addr;
+       candev->io_addr=io_addr;
+       candev->res_addr=pita2_addr;
        
        /* 
         * this is redundant with chip initialization, but remap address 
@@ -125,21 +126,21 @@ int ems_cpcpci_request_io(struct candevice_t *candev)
        for(i=0;i<candev->nr_all_chips;i++) {
                struct canchip_t *chip=candev->chip[i];
                if(!chip) continue;
-               chip->chip_base_addr = candev->io_addr+
+               chip->chip_base_addr = candev->dev_base_addr+
                        0x400 + i*EMS_CPCPCI_BYTES_PER_CIRCUIT;
                if(!chip->msgobj[0]) continue;
                chip->msgobj[0]->obj_base_addr=chip->chip_base_addr;
        }
 
        /* Configure PITA-2 parallel interface */
-       writel(PITA2_MISC_CONFIG, candev->dev_base_addr + PITA2_MISC);
+       can_writel(PITA2_MISC_CONFIG, candev->aux_base_addr + PITA2_MISC);
 
        ems_cpcpci_disconnect_irq(candev);
 
        return 0;
 
     error_ioremap_io:
-       iounmap((void*)candev->dev_base_addr);
+       iounmap(candev->aux_base_addr);
     error_ioremap_pita2:
     #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,21))
        pci_release_region(candev->sysdevptr.pcidev, 1);
@@ -156,8 +157,8 @@ int ems_cpcpci_release_io(struct candevice_t *candev)
 {
        ems_cpcpci_disconnect_irq(candev);
 
-       iounmap((void*)candev->io_addr);
-       iounmap((void*)candev->dev_base_addr);
+       iounmap(candev->dev_base_addr);
+       iounmap(candev->aux_base_addr);
     #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,21))
        pci_release_region(candev->sysdevptr.pcidev, 1);
        pci_release_region(candev->sysdevptr.pcidev, 0);
@@ -169,18 +170,18 @@ int ems_cpcpci_release_io(struct candevice_t *candev)
 }
 
 
-void ems_cpcpci_write_register(unsigned data, unsigned long address)
+void ems_cpcpci_write_register(unsigned data, can_ioptr_t address)
 {
-       address += ((address&(EMS_CPCPCI_BYTES_PER_CIRCUIT-1))
-                           *(EMS_CPCPCI_BYTES_PER_REG-1));
-       writeb(data,address); 
+       address += ((can_ioptr2ulong(address)&(EMS_CPCPCI_BYTES_PER_CIRCUIT-1))
+                                            *(EMS_CPCPCI_BYTES_PER_REG-1));
+       can_writeb(data,address); 
 }
 
-unsigned ems_cpcpci_read_register(unsigned long address)
+unsigned ems_cpcpci_read_register(can_ioptr_t address)
 {
-       address += ((address&(EMS_CPCPCI_BYTES_PER_CIRCUIT-1))
-                           *(EMS_CPCPCI_BYTES_PER_REG-1));
-       return readb(address);
+       address += ((can_ioptr2ulong(address)&(EMS_CPCPCI_BYTES_PER_CIRCUIT-1))
+                                            *(EMS_CPCPCI_BYTES_PER_REG-1));
+       return can_readb(address);
 }
 
 int ems_cpcpci_irq_handler(int irq, struct canchip_t *chip)
@@ -191,12 +192,12 @@ int ems_cpcpci_irq_handler(int irq, struct canchip_t *chip)
        unsigned long icr;
        int test_irq_again;
 
-       icr=readl(candev->dev_base_addr + PITA2_ICR);
+       icr=can_readl(candev->aux_base_addr + PITA2_ICR);
        if(!(icr & PITA2_ICR_INT0)) return CANCHIP_IRQ_NONE;
        
        /* correct way to handle interrupts from all chips connected to the one PITA-2 */
        do {
-               writel(PITA2_ICR_INT0_En | PITA2_ICR_INT0, candev->dev_base_addr + PITA2_ICR);
+               can_writel(PITA2_ICR_INT0_En | PITA2_ICR_INT0, candev->aux_base_addr + PITA2_ICR);
                test_irq_again=0;
                for(i=0;i<candev->nr_all_chips;i++){
                        chip=candev->chip[i];
@@ -205,7 +206,7 @@ int ems_cpcpci_irq_handler(int irq, struct canchip_t *chip)
                        if(sja1000p_irq_handler(irq, chip))
                                test_irq_again=1;
                }
-               icr=readl(candev->dev_base_addr + PITA2_ICR);
+               icr=can_readl(candev->aux_base_addr + PITA2_ICR);
        } while((icr & PITA2_ICR_INT0)||test_irq_again);
        return CANCHIP_IRQ_HANDLED;
 }
@@ -282,9 +283,9 @@ int ems_cpcpci_init_hw_data(struct candevice_t *candev)
        if(ems_cpcpci_request_io(candev)<0)
                return -ENODEV;
 
-       /*** candev->dev_base_addr=pci_resource_start(pcidev,0); ***/
+       /*** candev->aux_base_addr=pci_resource_start(pcidev,0); ***/
        /* some control registers */
-       /*** candev->io_addr=pci_resource_start(pcidev,1); ***/
+       /*** candev->dev_base_addr=pci_resource_start(pcidev,1); ***/
        /* 0 more EMS control registers
          * 0x400 the first SJA1000
          * 0x600 the second SJA1000
@@ -295,9 +296,9 @@ int ems_cpcpci_init_hw_data(struct candevice_t *candev)
        
        for(l=0,i=0;i<4;i++){
                l<<=8;
-               l|=readb(candev->io_addr + i*4);
+               l|=can_readb(candev->dev_base_addr + i*4);
        }
-       i=readb(candev->io_addr + i*5);
+       i=can_readb(candev->dev_base_addr + i*5);
        
        CANMSG("EMS CPC-PCI check value %04lx, ID %d\n", l, i);
        
@@ -328,7 +329,7 @@ int ems_cpcpci_init_chip_data(struct candevice_t *candev, int chipnr)
 
        candev->chip[chipnr]->chip_irq=candev->sysdevptr.pcidev->irq;
 
-       candev->chip[chipnr]->chip_base_addr = candev->io_addr+
+       candev->chip[chipnr]->chip_base_addr = candev->dev_base_addr+
                        0x400 + chipnr*EMS_CPCPCI_BYTES_PER_CIRCUIT;
        candev->chip[chipnr]->flags = 0;
        candev->chip[chipnr]->int_cpu_reg = 0;
index 9c1a00e..8dcf9fb 100644 (file)
@@ -170,7 +170,7 @@ int gensja1000io_init_chip_data(struct candevice_t *candev, int chipnr)
        /*sja1000_fill_chipspecops(candev->chip[chipnr]);*/
        sja1000p_fill_chipspecops(candev->chip[chipnr]);
 
-       candev->chip[chipnr]->chip_base_addr=candev->io_addr;
+       candev->chip[chipnr]->chip_base_addr=can_ioport2ioptr(candev->io_addr);
        if(candev->chip[chipnr]->clock<=0)
        candev->chip[chipnr]->clock = 16000000;
        candev->chip[chipnr]->int_clk_reg = 0x0;
@@ -232,11 +232,11 @@ int gensja1000io_program_irq(struct candevice_t *candev)
  * Return Value: The function does not return a value
  * File: src/gensja1000io.c
  */
-void gensja1000io_write_register(unsigned data, unsigned long address)
+void gensja1000io_write_register(unsigned data, can_ioptr_t address)
 {
        /*DEBUGMSG("gensja1000io_write_register: addr=0x%lx data=0x%x",
                address,data);*/
-       outb(data,address);
+       can_outb(data,address);
 }
 
 /**
@@ -249,9 +249,9 @@ void gensja1000io_write_register(unsigned data, unsigned long address)
  * Return Value: The function returns the value stored in @address
  * File: src/gensja1000io.c
  */
-unsigned gensja1000io_read_register(unsigned long address)
+unsigned gensja1000io_read_register(can_ioptr_t address)
 {
-       return inb(address);
+       return can_inb(address);
 }
 
 /* !!! Don't change this function !!! */
index 1a18904..ff12573 100644 (file)
@@ -47,7 +47,7 @@ int hms30c7202_request_io(struct candevice_t *candev)
                (unsigned long)candev->io_addr );
        }
        
-       if (!( candev->dev_base_addr = (long)ioremap( candev->io_addr, IO_RANGE ))) {
+       if (!( candev->dev_base_addr = ioremap( candev->io_addr, IO_RANGE ))) {
                DEBUGMSG( "Failed to map IO-memory: 0x%lx - 0x%lx, mapped to 0x%lx\n",
                        (unsigned long)candev->io_addr,
                        (unsigned long)candev->io_addr + IO_RANGE - 1,
@@ -121,7 +121,7 @@ int hms30c7202_release_io(struct candevice_t *candev)
        candev->chip[0]->chipspecops->stop_chip(candev->chip[0]);
        
        // release I/O memory mapping
-       iounmap((void*)candev->dev_base_addr);
+       iounmap(candev->dev_base_addr);
        
        // Release the memory region
        can_release_mem_region(candev->io_addr, IO_RANGE);
@@ -193,16 +193,16 @@ int hms30c7202_init_hw_data(struct candevice_t *candev)
 /*( struct canchip_t *pchip, u16 chip_nr, u16 startminor, u32 baseaddr, u8 irq )*/
 {
        //      u32 intCntrVAddr = 0;
-       u32 gpioVAddr = 0;
+       can_ioptr_t gpioVAddr = 0;
        u32 tempReg = 0;
        u32 baseaddr=candev->io_addr;
        
-       //      if ( (!( intCntrVAddr = (u32)ioremap( 0x80024000, 0xCD ) ))
-       //              & (! ( gpioVAddr = (u32)ioremap( 0x80023000, 0xAD ) ))) {
+       //      if ( (!( intCntrVAddr = ioremap( 0x80024000, 0xCD ) ))
+       //              & (! ( gpioVAddr = ioremap( 0x80023000, 0xAD ) ))) {
        //              DEBUGMSG("Failed to map Int and GPIO memory\n");
        //              return -EIO;
        //      }
-       if ( ! ( gpioVAddr = (u32)ioremap( 0x80023000, 0xAD ) )) {
+       if ( ! ( gpioVAddr = ioremap( 0x80023000, 0xAD ) )) {
                DEBUGMSG("Failed to map GPIO memory\n");
                return -EIO;
        } else {
@@ -218,48 +218,48 @@ int hms30c7202_init_hw_data(struct candevice_t *candev)
        }
        
        if (baseaddr == 0x8002f000) {
-               //              tempReg = readl(intCntrVAddr);
+               //              tempReg = can_readl(intCntrVAddr);
                //              DEBUGMSG("Read Interrupt Enable Register : 0x%.4lx\n",(long)tempReg);
                //              DEBUGMSG("Trying to activate CAN0 Interrupt (Bit 18)\n");
-               //              writel((tempReg | (1<<18)), intCntrVAddr);
-               //              tempReg = readl(intCntrVAddr);
+               //              can_writel((tempReg | (1<<18)), intCntrVAddr);
+               //              tempReg = can_readl(intCntrVAddr);
                //              DEBUGMSG("Read changed Interrupt Enable Register : 0x%.4lx\n",(long)tempReg);
-               tempReg = readl(gpioVAddr + 0x5C);
+               tempReg = can_readl(gpioVAddr + 0x5C);
                DEBUGMSG("Read GPIO-C Enable Register : 0x%.4lx\n",(long)tempReg);
                DEBUGMSG("Trying to activate CAN0 (Bit 1 = 0 for CANTx0, Bit 2 = 0 for CANRx0,)\n");
-               writel(tempReg & ~0x6, gpioVAddr + 0x5C);
-               tempReg = readl(gpioVAddr + 0x5C);
+               can_writel(tempReg & ~0x6, gpioVAddr + 0x5C);
+               tempReg = can_readl(gpioVAddr + 0x5C);
                DEBUGMSG("Read changed GPIO-C Enable Register : 0x%.4lx\n",(long)tempReg);
-               tempReg = readl(gpioVAddr + 0x44);
+               tempReg = can_readl(gpioVAddr + 0x44);
                DEBUGMSG("Read GPIO-C Direction Register : 0x%.4lx\n",(long)tempReg);
                DEBUGMSG("Trying to set CAN0 directions (Bit 1 = 0 for CANTx0 as OUT, Bit 2 = 1 for CANRx0 as IN,)\n");
-               writel((tempReg & ~0x2) | 0x4, gpioVAddr + 0x44);
-               tempReg = readl(gpioVAddr + 0x44);
+               can_writel((tempReg & ~0x2) | 0x4, gpioVAddr + 0x44);
+               tempReg = can_readl(gpioVAddr + 0x44);
                DEBUGMSG("Read changed GPIO-C Direction Register : 0x%.4lx\n",(long)tempReg);
        }
        else if (baseaddr == 0x80030000) {
-               //              tempReg = readl(intCntrVAddr);
-               //              writel((tempReg | (1<<19)), intCntrVAddr);
-               tempReg = readl(gpioVAddr + 0x9C);
+               //              tempReg = can_readl(intCntrVAddr);
+               //              can_writel((tempReg | (1<<19)), intCntrVAddr);
+               tempReg = can_readl(gpioVAddr + 0x9C);
                DEBUGMSG("Read GPIO-E Enable Register : 0x%.8lx\n",(long)tempReg);
                DEBUGMSG("Trying to activate CAN1 (Bit 22 = 0 for CANRx1, Bit 23 = 0 for CANTx1,)\n");
-               writel(tempReg & 0xFF3FFFFF, gpioVAddr + 0x9C);
-               tempReg = readl(gpioVAddr + 0x9C);
+               can_writel(tempReg & 0xFF3FFFFF, gpioVAddr + 0x9C);
+               tempReg = can_readl(gpioVAddr + 0x9C);
                DEBUGMSG("Read changed GPIO-E Enable Register : 0x%.8lx\n",(long)tempReg);
-               tempReg = readl(gpioVAddr + 0x84);
+               tempReg = can_readl(gpioVAddr + 0x84);
                DEBUGMSG("Read GPIO-E Direction Register : 0x%.8lx\n",(long)tempReg);
                DEBUGMSG("Trying to set CAN1 directions (Bit 22 = 1 for CANRx1 as IN, Bit 23 = 0 for CANTx1 as OUT,)\n");
-               writel((tempReg & ~(1<<23)) | 1<<22, gpioVAddr + 0x84);
-               tempReg = readl(gpioVAddr + 0x84);
+               can_writel((tempReg & ~(1<<23)) | 1<<22, gpioVAddr + 0x84);
+               tempReg = can_readl(gpioVAddr + 0x84);
                DEBUGMSG("Read changed GPIO-E Direction Register : 0x%.8lx\n",(long)tempReg);
        }
 
        //DEBUGMSG("Current Interrupt Status Register (ISR): 0x%4.4lx\n",
-       //                      (long)readl(intCntrVAddr + 4));
+       //                      (long)can_readl(intCntrVAddr + 4));
        //DEBUGMSG("Current Interrupt ID: %d\n",
-       //                      (int)(readl(intCntrVAddr + 0x90) & 0xF));
+       //                      (int)(can_readl(intCntrVAddr + 0x90) & 0xF));
        //      iounmap( (void*)intCntrVAddr);
-       iounmap( (void*)gpioVAddr );
+       iounmap( gpioVAddr );
        //      DEBUGMSG( "Unmapped Interrupt Controller IO-memory: 0x%lx\n",
        //            (unsigned long)intCntrVAddr);
        DEBUGMSG( "Unmapped GPIO IO-memory: 0x%lx\n",
@@ -352,17 +352,18 @@ int hms30c7202_init_obj_data(struct canchip_t *chip, int objnr)
  * File: src/template.c
  */
 
-void hms30c7202_write_register(unsigned data, unsigned long address)
+void hms30c7202_write_register(unsigned data, can_ioptr_t address)
 {
+       unsigned long addr=can_ioptr2ulong(address);
        int i;
        //unsigned long usecs = 1;
 
-       address = ((address & C_CAN_REGOFFS_MASK) << 1) |
-                 (address & ~C_CAN_REGOFFS_MASK);
+       address = can_ulong2ioptr(((addr & C_CAN_REGOFFS_MASK) << 1) |
+                                 (addr & ~C_CAN_REGOFFS_MASK));
        
        //DEBUGMSG("Trying to write 0x%u16x to address 0x%lx\n",data,address);
        
-       writew(data,address);
+       can_writew(data,address);
        //udelay( usecs );
        for (i=0; i<5; i++);
 }
@@ -378,19 +379,20 @@ void hms30c7202_write_register(unsigned data, unsigned long address)
  * Return Value: The function returns the value stored in @address
  * File: src/template.c
  */
-unsigned hms30c7202_read_register(unsigned long address)
+unsigned hms30c7202_read_register(can_ioptr_t address)
 {
+       unsigned long addr=can_ioptr2ulong(address);
        u16 value, i;
        
-       address = ((address & C_CAN_REGOFFS_MASK) << 1) |
-                 (address & ~C_CAN_REGOFFS_MASK);
+       address = can_ulong2ioptr(((addr & C_CAN_REGOFFS_MASK) << 1) |
+                                 (addr & ~C_CAN_REGOFFS_MASK));
 
        //DEBUGMSG("Trying to read from address 0x%lx :",address);
        
-       value = readw(address);
+       value = can_readw(address);
        //udelay( usecs );
        for (i=0;i<5;i++);
-       value = readw(address);
+       value = can_readw(address);
                //udelay( usecs );
        for (i=0;i<5;i++);
        
index 58aa048..9210ac4 100644 (file)
@@ -596,7 +596,8 @@ void i82527_irq_update_filter(struct canchip_t *chip, struct msgobj_t *obj)
 
                i82527_pre_read_config(chip, obj);
 
-               CANMSG("i82527_irq_update_filter: obj at 0x%08lx\n",obj->obj_base_addr);
+               CANMSG("i82527_irq_update_filter: obj at 0x%08lx\n",
+                       can_ioptr2ulong(obj->obj_base_addr));
        }
 }
 
index 02b0d02..0975231 100644 (file)
@@ -62,9 +62,9 @@ static void ipci165_delay(long msdelay)
  */
 void ipci165_generate_irq(struct candevice_t *candev)
 {
-  unsigned long crm_addr = candev->io_addr;
-  writeb(readb(crm_addr + CRM_UCR) & 0xFB, crm_addr + CRM_UCR);
-  writeb(readb(crm_addr + CRM_UCR) | 0x04, crm_addr + CRM_UCR);
+  can_ioptr_t crm_addr = candev->aux_base_addr;
+  can_writeb(can_readb(crm_addr + CRM_UCR) & 0xFB, crm_addr + CRM_UCR);
+  can_writeb(can_readb(crm_addr + CRM_UCR) | 0x04, crm_addr + CRM_UCR);
 }
 
 /**
@@ -79,7 +79,7 @@ void ipci165_generate_irq(struct candevice_t *candev)
  */
 int bci_command(struct candevice_t *candev, char cmd, int size, char *data)
 {
-  unsigned long dpram_addr = candev->dev_base_addr;
+  can_ioptr_t dpram_addr = candev->dev_base_addr;
 
   DEBUGMSG ("ipci165_bci_command\n");
 
@@ -93,7 +93,7 @@ int bci_command(struct candevice_t *candev, char cmd, int size, char *data)
   can_spin_lock(&candev->device_lock);
 
   // check command buffer status
-  if (readb(dpram_addr + OF_BCI_SYNC) != 0)
+  if (can_readb(dpram_addr + OF_BCI_SYNC) != 0)
   {
     /* something went wrong ... */
     can_spin_unlock(&candev->device_lock);
@@ -102,12 +102,12 @@ int bci_command(struct candevice_t *candev, char cmd, int size, char *data)
   }
 
   // prepare command
-  writeb(cmd, dpram_addr + OF_BCI_CMD);
-  writeb(size + 1, dpram_addr + OF_BCI_NUM);
+  can_writeb(cmd, dpram_addr + OF_BCI_CMD);
+  can_writeb(size + 1, dpram_addr + OF_BCI_NUM);
   memcpy_toio(dpram_addr + OF_BCI_DATA, data, size);
 
   // set flag for firmware
-  writeb(1, dpram_addr + OF_BCI_SYNC);
+  can_writeb(1, dpram_addr + OF_BCI_SYNC);
 
   // generate interrupt to microcontroller
   ipci165_generate_irq (candev);
@@ -127,14 +127,14 @@ int bci_command(struct candevice_t *candev, char cmd, int size, char *data)
  */
 int bci_response(struct candevice_t *candev, char cmd, int *size, char *data)
 {
-  unsigned long dpram_addr = candev->dev_base_addr;
+  can_ioptr_t dpram_addr = candev->dev_base_addr;
   char tmp;
   int delay;
 
   DEBUGMSG ("ipci165_bci_response\n");
 
   delay = 1000;
-  while (readb(dpram_addr + OF_BCI_SYNC) != 2)
+  while (can_readb(dpram_addr + OF_BCI_SYNC) != 2)
   {
     /* wait 1 ms */
     /*    ipci165_delay(1); */
@@ -150,13 +150,13 @@ int bci_response(struct candevice_t *candev, char cmd, int *size, char *data)
   }
 
   /* we will not copy the command filed, so decrement the size by 1 */
-  tmp = readb(dpram_addr + OF_BCI_NUM) - 1;
+  tmp = can_readb(dpram_addr + OF_BCI_NUM) - 1;
   if (*size > tmp) *size = tmp;
 
-  if (readb(dpram_addr + OF_BCI_CMD) != cmd)
+  if (can_readb(dpram_addr + OF_BCI_CMD) != cmd)
   {
     /* release the buffer */
-    writeb(0, dpram_addr + OF_BCI_SYNC);
+    can_writeb(0, dpram_addr + OF_BCI_SYNC);
     /* unlock the access */
     can_spin_unlock(&candev->device_lock);
 
@@ -166,7 +166,7 @@ int bci_response(struct candevice_t *candev, char cmd, int *size, char *data)
   memcpy_fromio(data, dpram_addr + OF_BCI_DATA, *size);
 
   /* release the buffer */
-  writeb(0, dpram_addr + OF_BCI_SYNC);
+  can_writeb(0, dpram_addr + OF_BCI_SYNC);
   /* unlock the access */
   can_spin_unlock(&candev->device_lock);
   return 0;
@@ -206,8 +206,8 @@ int ipci165_restart_can(struct canchip_t *chip)
 
   for (i = 0; i< BCI_QUEUE_SIZE; i++)
   {
-    writeb(BCI_MSG_STATUS_FREE, chip_data->rx_queue.addr + msg_ofs);
-    writeb(BCI_MSG_STATUS_FREE, chip_data->tx_queue.addr + msg_ofs);
+    can_writeb(BCI_MSG_STATUS_FREE, chip_data->rx_queue.addr + msg_ofs);
+    can_writeb(BCI_MSG_STATUS_FREE, chip_data->tx_queue.addr + msg_ofs);
     msg_ofs += BCI_MSG_SIZE;
   }
 
@@ -314,7 +314,7 @@ long ipci165_qfull_latency(struct msgobj_t *obj)
  */
 int ipci165_connect_irq(struct candevice_t *candev)
 {
-  unsigned long crm_addr = candev->io_addr;
+  can_ioptr_t crm_addr = candev->aux_base_addr;
   unsigned char icr;
   DEBUGMSG ("ipci165_connect_irq\n");
 
@@ -327,9 +327,9 @@ int ipci165_connect_irq(struct candevice_t *candev)
     return -ENODEV;
 
   // Enable interrupt to PC
-  writeb(readb(crm_addr + CRM_ICR) | 0x40, crm_addr + CRM_ICR);
+  can_writeb(can_readb(crm_addr + CRM_ICR) | 0x40, crm_addr + CRM_ICR);
   udelay (100);
-  icr = readb(crm_addr + CRM_ICR);
+  icr = can_readb(crm_addr + CRM_ICR);
   return 0;
 }
 
@@ -342,14 +342,14 @@ int ipci165_connect_irq(struct candevice_t *candev)
  */
 void ipci165_disconnect_irq(struct candevice_t *candev)
 {
-  unsigned long crm_addr = candev->io_addr;
+  can_ioptr_t crm_addr = candev->aux_base_addr;
   unsigned char icr;
   DEBUGMSG ("ipci165_disconnect_irq\n");
 
   // Enable interrupt to PC
-  writeb(readb(crm_addr + CRM_ICR) & ~0x40, crm_addr + CRM_ICR);
+  can_writeb(can_readb(crm_addr + CRM_ICR) & ~0x40, crm_addr + CRM_ICR);
   udelay (100);
-  icr = readb(crm_addr + CRM_ICR);
+  icr = can_readb(crm_addr + CRM_ICR);
   /* deinstall interrupt routine */
   free_irq(candev->sysdevptr.pcidev->irq, candev);
 }
@@ -607,8 +607,8 @@ void ipci165_irq_read_handler(struct canchip_t *chip, struct msgobj_t *obj)
 {
   struct ipci165_chip_t *chip_data = (struct ipci165_chip_t *)chip->chip_data;
   struct bci_queue_t *queue = &(chip_data)->rx_queue;
-  unsigned long       queue_addr = queue->addr;
-  unsigned long       msg_addr   = queue_addr + queue->idx * BCI_MSG_SIZE;
+  can_ioptr_t         queue_addr = queue->addr;
+  can_ioptr_t         msg_addr   = queue_addr + queue->idx * BCI_MSG_SIZE;
 
   int len;
   unsigned char frame_info;
@@ -620,18 +620,18 @@ void ipci165_irq_read_handler(struct canchip_t *chip, struct msgobj_t *obj)
 
   do {
     dump_mem(msg_addr, BCI_MSG_SIZE);
-    if (readb(msg_addr + BCI_MSG_TYPE) == BCI_MSG_TYPE_CAN)
+    if (can_readb(msg_addr + BCI_MSG_TYPE) == BCI_MSG_TYPE_CAN)
     {
 #if 0
-      printk("ST(0)=%x, ST(1)=%x\n",readw(chip->chip_base_addr+OF_CAN1_STATUS),
-             readw(chip->chip_base_addr+OF_CAN2_STATUS));
+      printk("ST(0)=%x, ST(1)=%x\n",can_readw(chip->chip_base_addr+OF_CAN1_STATUS),
+             can_readw(chip->chip_base_addr+OF_CAN2_STATUS));
       for (tmp16 = 0 ; tmp16 < BCI_QUEUE_SIZE ; tmp16 ++)
-        printk ("MSG_ST(%i)=%x\n",tmp16,readb(chip->chip_base_addr + OF_CH2_TX_QUEUE + tmp16*BCI_MSG_SIZE + BCI_MSG_STATUS));
+        printk ("MSG_ST(%i)=%x\n",tmp16,can_readb(chip->chip_base_addr + OF_CH2_TX_QUEUE + tmp16*BCI_MSG_SIZE + BCI_MSG_STATUS));
       /* this is a can message */
       DEBUGMSG ("ipci165_irq_read_handler[%i]: message in buffer\n",chip->chip_idx);
 #endif
 
-      frame_info = readb(msg_addr + BCI_MSG_FRAME);
+      frame_info = can_readb(msg_addr + BCI_MSG_FRAME);
       len =  frame_info & 0x0f;
       if(len > CAN_MSG_LENGTH) len = CAN_MSG_LENGTH;
       obj->rx_msg.length = len;
@@ -639,8 +639,8 @@ void ipci165_irq_read_handler(struct canchip_t *chip, struct msgobj_t *obj)
       obj->rx_msg.cob    = 0;
       obj->rx_msg.timestamp.tv_sec = 0;
       obj->rx_msg.timestamp.tv_usec = 
-          BCI_TIMESTAMP_RES * readl(msg_addr + BCI_MSG_TIMESTAMP);
-      /*  BCI_TIMESTAMP_RES * le32_to_cpu(readl(msg_addr + BCI_MSG_TIMESTAMP)); */
+          BCI_TIMESTAMP_RES * can_readl(msg_addr + BCI_MSG_TIMESTAMP);
+      /*  BCI_TIMESTAMP_RES * le32_to_cpu(can_readl(msg_addr + BCI_MSG_TIMESTAMP)); */
 
       /* fill CAN message timestamp */
       /* can_filltimestamp(&obj->rx_msg.timestamp); */
@@ -650,7 +650,7 @@ void ipci165_irq_read_handler(struct canchip_t *chip, struct msgobj_t *obj)
         /* extended frame - 29 bit identifier */
         obj->rx_msg.flags |= MSG_EXT;
         /* the ID is stored in motorola format (big endian), left justified  */
-        /* obj->rx_msg.id = be32_to_cpu(readl(msg_addr + BCI_MSG_ID) >> 3); */
+        /* obj->rx_msg.id = be32_to_cpu(can_readl(msg_addr + BCI_MSG_ID) >> 3); */
         memcpy_fromio(&tmp32, msg_addr + BCI_MSG_ID, 4);
         obj->rx_msg.id = be32_to_cpu(tmp32 >> 3);
         if (len > 0)
@@ -659,7 +659,7 @@ void ipci165_irq_read_handler(struct canchip_t *chip, struct msgobj_t *obj)
       {
         /* standard frame - 11 bit identifier */
         /* the ID is stored in motorola format (big endian), left justified */
-        /* obj->rx_msg.id = be16_to_cpu(readw(msg_addr + BCI_MSG_ID) >> 5); */
+        /* obj->rx_msg.id = be16_to_cpu(can_readw(msg_addr + BCI_MSG_ID) >> 5); */
         memcpy_fromio(&tmp16, msg_addr + BCI_MSG_ID, 2);
         obj->rx_msg.id = be16_to_cpu(tmp16 >> 5);
         if (len > 0)
@@ -670,7 +670,7 @@ void ipci165_irq_read_handler(struct canchip_t *chip, struct msgobj_t *obj)
     else
     {
       /* this is a status message */
-      status = readw(msg_addr + BCI_MSG_CAN_STATUS);
+      status = can_readw(msg_addr + BCI_MSG_CAN_STATUS);
       DEBUGMSG ("ipci165_irq_read_handler[%i]: CAN status=%04x\n",chip->chip_idx, status);
 
       /* wake up the reset thread if the CAN is in bus off */
@@ -693,10 +693,10 @@ void ipci165_irq_read_handler(struct canchip_t *chip, struct msgobj_t *obj)
     /* update pointer */
     queue->idx = (queue->idx + 1) % BCI_QUEUE_SIZE;
     /* release the buffer */
-    writeb(BCI_MSG_STATUS_FREE, msg_addr + BCI_MSG_STATUS);
+    can_writeb(BCI_MSG_STATUS_FREE, msg_addr + BCI_MSG_STATUS);
     msg_addr = queue_addr + queue->idx * BCI_MSG_SIZE;
 
-  } while (readb(msg_addr + BCI_MSG_STATUS) == BCI_MSG_STATUS_FULL);
+  } while (can_readb(msg_addr + BCI_MSG_STATUS) == BCI_MSG_STATUS_FULL);
 
 }
 
@@ -713,8 +713,8 @@ void ipci165_irq_write_handler(struct canchip_t *chip, struct msgobj_t *obj)
 {
   struct ipci165_chip_t *chip_data = ((struct ipci165_chip_t *)chip->chip_data);
   struct bci_queue_t *queue      = &chip_data->tx_queue;
-  unsigned long       queue_addr = queue->addr;
-  unsigned long       msg_addr   = queue_addr + queue->idx * BCI_MSG_SIZE;
+  can_ioptr_t         queue_addr = queue->addr;
+  can_ioptr_t         msg_addr   = queue_addr + queue->idx * BCI_MSG_SIZE;
   struct canque_slot_t *tx_slot;
 
   int len;
@@ -727,7 +727,7 @@ void ipci165_irq_write_handler(struct canchip_t *chip, struct msgobj_t *obj)
   while ((canque_test_outslot(obj->qends, &obj->tx_qedge, &obj->tx_slot) >=0))
   {
     if (test_bit(CHIP_FLAG_RESET,&chip_data->flags) ||
-        (readb(msg_addr + BCI_MSG_STATUS) == BCI_MSG_STATUS_FULL))
+        (can_readb(msg_addr + BCI_MSG_STATUS) == BCI_MSG_STATUS_FULL))
     {
       canque_again_outslot(obj->qends, obj->tx_qedge, obj->tx_slot);
 
@@ -757,9 +757,9 @@ void ipci165_irq_write_handler(struct canchip_t *chip, struct msgobj_t *obj)
         ((tx_slot->msg.flags & MSG_RTR) ? BCI_MSG_FRAME_RTR : 0) |
         ((tx_slot->msg.flags & MSG_EXT) ? BCI_MSG_FRAME_EXT : 0);
 
-    writeb(BCI_MSG_SIZE - 2, msg_addr + BCI_MSG_NUM);
-    writeb(BCI_MSG_TYPE_CAN, msg_addr + BCI_MSG_TYPE);
-    writeb(frame_info, msg_addr + BCI_MSG_FRAME);
+    can_writeb(BCI_MSG_SIZE - 2, msg_addr + BCI_MSG_NUM);
+    can_writeb(BCI_MSG_TYPE_CAN, msg_addr + BCI_MSG_TYPE);
+    can_writeb(frame_info, msg_addr + BCI_MSG_FRAME);
     if (frame_info & BCI_MSG_FRAME_EXT)
     {
       /* extended frame - 29 bit identifier */
@@ -783,7 +783,7 @@ void ipci165_irq_write_handler(struct canchip_t *chip, struct msgobj_t *obj)
     /* update pointer */
     queue->idx = (queue->idx + 1) % BCI_QUEUE_SIZE;
     /* mark the buffer as full */
-    writeb(BCI_MSG_STATUS_FULL, msg_addr + BCI_MSG_STATUS);
+    can_writeb(BCI_MSG_STATUS_FULL, msg_addr + BCI_MSG_STATUS);
     /* wake up the controller */
     ipci165_generate_irq(chip->hostdevice);
 
@@ -848,12 +848,12 @@ void ipci165_irq_chip_handler(struct canchip_t *chip)
 
   /* check receive queue for messages */
   queue = &chip_data->rx_queue;
-  if (readb(queue->addr + queue->idx * BCI_MSG_SIZE + BCI_MSG_STATUS)
+  if (can_readb(queue->addr + queue->idx * BCI_MSG_SIZE + BCI_MSG_STATUS)
       == BCI_MSG_STATUS_FULL)
     ipci165_irq_read_handler(chip, obj);
 
   queue = &chip_data->tx_queue;
-/*  if (readb(queue->addr + queue->idx * BCI_MSG_SIZE + BCI_MSG_STATUS)
+/*  if (can_readb(queue->addr + queue->idx * BCI_MSG_SIZE + BCI_MSG_STATUS)
   == BCI_MSG_STATUS_FREE) */
   {
     can_msgobj_set_fl(obj,TX_REQUEST);
@@ -884,8 +884,8 @@ can_irqreturn_t ipci165_irq_handler(CAN_IRQ_HANDLER_ARGS(irq_number, dev_id))
   int retval;
   struct candevice_t *candev = (struct candevice_t *)dev_id;
 
-  unsigned long crm_addr   = candev->io_addr;
-  unsigned long ucr1_addr  = crm_addr + CRM_UCR + 1;
+  can_ioptr_t crm_addr   = candev->aux_base_addr;
+  can_ioptr_t ucr1_addr  = crm_addr + CRM_UCR + 1;
   struct canchip_t *chip;
   unsigned char icr;
   int i;
@@ -893,15 +893,15 @@ can_irqreturn_t ipci165_irq_handler(CAN_IRQ_HANDLER_ARGS(irq_number, dev_id))
   /* DEBUGMSG ("ipci165_irq_handler\n"); */
 
   /* read interrupt control register (byte 0) */
-  icr = readb(crm_addr + CRM_ICR);
+  icr = can_readb(crm_addr + CRM_ICR);
 
   if ((icr & 0x44) == 0x44)
   {
     DEBUGMSG ("ipci165_irq_handler: pending interrupt\n");
 
     /* confirm pending interrupt */
-    writeb(readb(ucr1_addr) | 0x01,  ucr1_addr);
-    writeb(readb(ucr1_addr) & ~0x01, ucr1_addr);
+    can_writeb(can_readb(ucr1_addr) | 0x01,  ucr1_addr);
+    can_writeb(can_readb(ucr1_addr) & ~0x01, ucr1_addr);
 
     /* call interrupt handler for every channel */
     for (i=0 ; i < candev->nr_all_chips ; i++)
@@ -1005,9 +1005,9 @@ int ipci165_release_chip(struct canchip_t *chip)
  */
 int ipci165_request_io(struct candevice_t *candev)
 {
-  unsigned long dpram_addr;
-  unsigned long crm_addr;
-  unsigned long fix_addr;
+  unsigned long dpram_addr; /* physical address before remap for this function */
+  unsigned long crm_addr;   /* physical address before remap for this function */
+  unsigned long fix_addr;   /* physical address before remap for this function */
   int i,j;
 
   DEBUGMSG ("ipci165_request_io\n");
@@ -1029,18 +1029,18 @@ int ipci165_request_io(struct candevice_t *candev)
     {
       CANMSG ("This card was not fixed!\n");
 
-      if (candev->io_addr == 0)
+      if (candev->aux_base_addr == NULL)
       {
         CANMSG ("You have to specify IO address parameter!\n");
         return -EINVAL;
       }
       CANMSG ("Using specified IO address value for the memory [0x%lx]\n",
-              candev->io_addr);
+              can_ioptr2ulong(candev->aux_base_addr));
     }
     else
     {
       CANMSG ("Fixed card. Using of 3 region [0x%lx]\n", fix_addr);
-      candev->io_addr = fix_addr;
+      candev->aux_base_addr = fix_addr;
     }
 
     pci_write_config_dword (candev->sysdevptr.pcidev,
@@ -1058,17 +1058,16 @@ int ipci165_request_io(struct candevice_t *candev)
   {
 #endif /*(LINUX_VERSION_CODE > KERNEL_VERSION(2,4,21))*/
 
-      if ((candev->dev_base_addr = (long) ioremap(dpram_addr, 
+      if ((candev->dev_base_addr = ioremap(dpram_addr, 
            pci_resource_len(candev->sysdevptr.pcidev,2))))
       {
         DEBUGMSG ("ipci165_request_io: dpram remapped to 0x%lx\n", candev->dev_base_addr);
 
-        if ((candev->io_addr = (long) ioremap(crm_addr, 
+        if ((candev->aux_base_addr = ioremap(crm_addr, 
              pci_resource_len(candev->sysdevptr.pcidev,0))))
         {
-          DEBUGMSG ("ipci165_request_io: crm remapped to 0x%lx\n", candev->io_addr);
+          DEBUGMSG ("ipci165_request_io: crm remapped to 0x%lx\n", can_ioptr2ulong(candev->aux_base_addr));
           /* all resources has been allocated */
-          candev->res_addr=candev->io_addr;
 
           /* Because of my mapping, I cannot use the
              can_base_addr_fixup(candev, remap_addr) to remap the addresses */
@@ -1082,10 +1081,10 @@ int ipci165_request_io(struct candevice_t *candev)
           return 0;
 
         } else CANMSG("Unable to remap memory at: 0x%lx\n", crm_addr);
-        iounmap((void*)candev->io_addr);
+        iounmap(candev->aux_base_addr);
 
       } else CANMSG("Unable to remap memory at: 0x%lx\n", dpram_addr);
-      iounmap((void*)candev->dev_base_addr);
+      iounmap(candev->dev_base_addr);
 
 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,21))
       pci_release_region(candev->sysdevptr.pcidev, 0);
@@ -1126,8 +1125,8 @@ int ipci165_release_io(struct candevice_t *candev)
   }
 #endif
 
-  iounmap((void*)candev->io_addr);
-  iounmap((void*)candev->dev_base_addr);
+  iounmap(candev->aux_base_addr);
+  iounmap(candev->dev_base_addr);
 
 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,21))
   pci_release_region(candev->sysdevptr.pcidev, 2);
@@ -1148,7 +1147,7 @@ int ipci165_release_io(struct candevice_t *candev)
  */
 int ipci165_download_fw(struct candevice_t *candev)
 {
-  unsigned long dpram_addr = candev->dev_base_addr;
+  can_ioptr_t dpram_addr = candev->dev_base_addr;
   char board_name[BOARD_NAME_LEN+1];
   char hw_version[HW_VERSION_LEN+1];
   char mode[MODE_LEN+1];
@@ -1189,13 +1188,13 @@ int ipci165_download_fw(struct candevice_t *candev)
   while (fwArray->len)
   {
     /* fill buffer */
-    writeb(LD_CMD_DOWNLOAD, dpram_addr + OF_LD_CMD);
-    writeb(fwArray->len, dpram_addr + OF_LD_NUM);
-    writeb(0, dpram_addr + OF_LD_NUM + 1);
+    can_writeb(LD_CMD_DOWNLOAD, dpram_addr + OF_LD_CMD);
+    can_writeb(fwArray->len, dpram_addr + OF_LD_NUM);
+    can_writeb(0, dpram_addr + OF_LD_NUM + 1);
 
-    writel(fwArray->addr, dpram_addr + OF_LD_ADDRESS);
-    /*    writel already performes the cpu_to_le32 conversion by itself   */
-    /*    writel(cpu_to_le32(fwArray->addr), dpram_addr + OF_LD_ADDRESS); */
+    can_writel(fwArray->addr, dpram_addr + OF_LD_ADDRESS);
+    /*    can_writel already performes the cpu_to_le32 conversion by itself   */
+    /*    can_writel(cpu_to_le32(fwArray->addr), dpram_addr + OF_LD_ADDRESS); */
 
     memcpy_toio(dpram_addr + OF_LD_DATA, fwArray->a_data, fwArray->len);
 
@@ -1203,14 +1202,14 @@ int ipci165_download_fw(struct candevice_t *candev)
     dump_mem((void *)(dpram_addr + OF_LD_SYNC), fwArray->len + 8);
 #endif
     /* buffer is prepared, set flag for loader */
-    writeb(1, dpram_addr + OF_LD_SYNC);
+    can_writeb(1, dpram_addr + OF_LD_SYNC);
 
     /* update pointer */
     fwArray++;
 
     /* wait for the loader */
     attempt = 1000;
-    while (readb(dpram_addr + OF_LD_SYNC) != 0)
+    while (can_readb(dpram_addr + OF_LD_SYNC) != 0)
     {
       udelay(100);
       if (--attempt == 0)
@@ -1224,8 +1223,8 @@ int ipci165_download_fw(struct candevice_t *candev)
   CANMSG ("Firmware downladed successfully\n");
 
   /* start the FW */
-  writeb(LD_CMD_START_FW, dpram_addr + OF_LD_CMD);
-  writeb(1, dpram_addr + OF_LD_SYNC);
+  can_writeb(LD_CMD_START_FW, dpram_addr + OF_LD_CMD);
+  can_writeb(1, dpram_addr + OF_LD_SYNC);
   ipci165_delay (500);
 
   return 0;
@@ -1240,7 +1239,7 @@ int ipci165_download_fw(struct candevice_t *candev)
  */
 int ipci165_reset(struct candevice_t *candev)
 {
-  unsigned long crm_addr = candev->io_addr;
+  can_ioptr_t crm_addr = candev->aux_base_addr;
   unsigned long test_data;
   char buffer[BCI_CMD_MAX_LEN];
   int i, size, chips;
@@ -1251,10 +1250,10 @@ int ipci165_reset(struct candevice_t *candev)
   DEBUGMSG ("ipci165_reset: hardware reset\n");
 
   /* reset the HW */
-  ucr = readb(crm_addr + CRM_UCR + 3);
-  writeb(ucr | 0x40, crm_addr + CRM_UCR + 3);
+  ucr = can_readb(crm_addr + CRM_UCR + 3);
+  can_writeb(ucr | 0x40, crm_addr + CRM_UCR + 3);
   udelay(100);
-  writeb(ucr & ~0x40, crm_addr + CRM_UCR + 3);
+  can_writeb(ucr & ~0x40, crm_addr + CRM_UCR + 3);
 
   /* wait a little bit */
   ipci165_delay(200);
index 4e574a9..e8e94c4 100644 (file)
@@ -1,5 +1,7 @@
-#include <linux/config.h>
 #include <linux/version.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17))
+#include <linux/config.h>
+#endif
 
 #if defined(MODVERSIONS)
 #include <linux/modversions.h>
index a3d2000..e01a9eb 100644 (file)
@@ -56,18 +56,18 @@ void kv_pcican_disconnect_irq(struct candevice_t *candev)
 {
        unsigned long tmp;
        /* Disable interrupts from card */
-       tmp = inl(candev->dev_base_addr + S5920_INTCSR);
+       tmp = can_inl(candev->dev_base_addr + S5920_INTCSR);
        tmp &= ~INTCSR_ADDON_INTENABLE_M;
-       outl(tmp, candev->dev_base_addr + S5920_INTCSR);
+       can_outl(tmp, candev->dev_base_addr + S5920_INTCSR);
 }
 
 void kv_pcican_connect_irq(struct candevice_t *candev)
 {
        unsigned long tmp;
        /* Enable interrupts from card */
-       tmp = inl(candev->dev_base_addr + S5920_INTCSR);
+       tmp = can_inl(candev->dev_base_addr + S5920_INTCSR);
        tmp |= INTCSR_ADDON_INTENABLE_M;
-       outl(tmp, candev->dev_base_addr + S5920_INTCSR);
+       can_outl(tmp, candev->dev_base_addr + S5920_INTCSR);
 }
 
 
@@ -121,14 +121,14 @@ int kv_pcican_release_io(struct candevice_t *candev)
 }
 
 
-void kv_pcican_write_register(unsigned data, unsigned long address)
+void kv_pcican_write_register(unsigned data, can_ioptr_t address)
 {
-       outb(data,address); 
+       can_outb(data,address); 
 }
 
-unsigned kv_pcican_read_register(unsigned long address)
+unsigned kv_pcican_read_register(can_ioptr_t address)
 {
-       return inb(address);
+       return can_inb(address);
 }
 
 int kv_pcican_reset(struct candevice_t *candev)
@@ -140,7 +140,7 @@ int kv_pcican_reset(struct candevice_t *candev)
        DEBUGMSG("Resetting kv_pcican hardware ...\n");
 
        /* Assert PTADR# - we're in passive mode so the other bits are not important */
-       outl(0x80808080L, candev->dev_base_addr + S5920_PTCR);
+       can_outl(0x80808080L, candev->dev_base_addr + S5920_PTCR);
 
        kv_pcican_disconnect_irq(candev);
 
index c67b3dd..d90db12 100644 (file)
@@ -36,8 +36,6 @@
 #define IO_RANGE 0x100
 
 
-static long base = 0L; 
-
 /**
  * m437_request_io: - reserve io or memory range for can board
  * @candev: pointer to candevice/board which asks for io. Field @io_addr
@@ -60,7 +58,7 @@ int m437_request_io(struct candevice_t *candev)
                return -ENODEV;
        }
 
-       if ( !( base = (long) ioremap( candev->io_addr, IO_RANGE ) ) ) {
+       if ( !( candev->dev_base_addr = ioremap( candev->io_addr, IO_RANGE ) ) ) {
                CANMSG("Unable to access I/O memory at: 0x%lx\n", candev->io_addr);
                can_release_mem_region(candev->io_addr,IO_RANGE);
                return -ENODEV;
@@ -87,7 +85,7 @@ int m437_release_io(struct candevice_t *candev)
        unsigned i;
        
         /* disable IRQ generation */
-        m437_write_register(iCTL_CCE, iCTL);
+        m437_write_register(iCTL_CCE, candev->dev_base_addr+iCTL);
 
        /* clear all message objects */
        for (i=1; i<=15; i++) {
@@ -96,21 +94,21 @@ int m437_release_io(struct candevice_t *candev)
                                RXIE_RES | 
                                TXIE_RES | 
                                MVAL_RES, 
-                               i*0x10+iMSGCTL0);
+                               candev->dev_base_addr+i*0x10+iMSGCTL0);
                m437_write_register(
                                NEWD_RES | 
                                MLST_RES | 
                                CPUU_RES | 
                                TXRQ_RES | 
                                RMPD_RES, 
-                               i*0x10+iMSGCTL1);
+                               candev->dev_base_addr+i*0x10+iMSGCTL1);
        }
        
        /* power down i82527 */
-       m437_write_register(iCPU_PWD, iCPU);
+       m437_write_register(iCPU_PWD, candev->dev_base_addr+iCPU);
        
        /* release I/O memory mapping */
-       iounmap((void*)base);
+       iounmap(candev->dev_base_addr);
 
        can_release_mem_region(candev->io_addr,IO_RANGE);
 
@@ -198,7 +196,7 @@ int m437_init_hw_data(struct candevice_t *candev)
 int m437_init_chip_data(struct candevice_t *candev, int chipnr)
 {
        i82527_fill_chipspecops(candev->chip[chipnr]);
-       candev->chip[chipnr]->chip_base_addr=candev->io_addr;
+       candev->chip[chipnr]->chip_base_addr=candev->dev_base_addr;
        candev->chip[chipnr]->clock = 16000000;
        candev->chip[chipnr]->int_cpu_reg = iCPU_DSC | iCPU_CEN;
        candev->chip[chipnr]->int_clk_reg = 
@@ -260,9 +258,9 @@ int m437_program_irq(struct candevice_t *candev)
  * Return Value: The function does not return a value
  * File: src/m437.c
  */
-void m437_write_register(unsigned data, unsigned long address)
+void m437_write_register(unsigned data, can_ioptr_t address)
 {
-       writeb(data,base+address);
+       can_writeb(data,address);
 }
 
 /**
@@ -275,9 +273,9 @@ void m437_write_register(unsigned data, unsigned long address)
  * Return Value: The function returns the value stored in @address
  * File: src/m437.c
  */
-unsigned m437_read_register(unsigned long address)
+unsigned m437_read_register(can_ioptr_t address)
 {
-       return readb(base+address);
+       return can_readb(address);
 }
 
 /* !!! Don't change this function !!! */
index 9851b5f..b6ebbae 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;
 }
index 0fc15c0..4d35965 100644 (file)
@@ -43,7 +43,7 @@ int ns_dev_request_io(struct candevice_t *candev)
                       (unsigned long)candev->io_addr);
        }
 
-       if (!(candev->dev_base_addr = (long)ioremap(candev->io_addr, IO_RANGE))) {
+       if (!(candev->dev_base_addr = ioremap(candev->io_addr, IO_RANGE))) {
                DEBUGMSG
                    ("Failed to map IO-memory: 0x%lx - 0x%lx, mapped to 0x%lx\n",
                     (unsigned long)candev->io_addr,
@@ -76,13 +76,10 @@ int ns_dev_request_io(struct candevice_t *candev)
  */
 int ns_dev_release_io(struct candevice_t *candev)
 {
-       u16 tempReg;
-       int i;
-
        DEBUGMSG("(c%d)ns_dev_release_io (...)\n", candev->chip[0]->chip_idx);
 
        /* Release I/O memory mapping */
-       iounmap((void *)candev->dev_base_addr);
+       iounmap(candev->dev_base_addr);
 
        /* Release the memory region */
        can_release_mem_region(candev->io_addr, IO_RANGE);
@@ -148,21 +145,21 @@ int ns_dev_reset(struct candevice_t *candev)
  */
 int ns_dev_init_hw_data(struct candevice_t *candev)
 {
-       u32 sys_contVA = 0;
+       can_ioptr_t sys_contVA = NULL;
 
        /* LUCAN : Magic numbers */
-       if (!(sys_contVA = (u32) ioremap(NS9750_PERIPHERAL_BASE_ADDRESS,
+       if (!(sys_contVA = ioremap(NS9750_PERIPHERAL_BASE_ADDRESS,
                                         NS9750_PERIPHERAL_MAP_SIZE))) {
                DEBUGMSG("Failed to map FPGA memory\n");
                return -EIO;
        } else {
                DEBUGMSG("Writing to NS9750 sys cont\n");
-               writel((BUS_WIDTH_16BIT | ACTIVE_LOW_CHIP_SELECT),
+               can_writel((BUS_WIDTH_16BIT | ACTIVE_LOW_CHIP_SELECT),
                       sys_contVA + NS9750_SYSTEM_CONTROLLER_OFFSET);
        }
 
        /* We have finished with this mapping */
-       iounmap((void *)sys_contVA);
+       iounmap(sys_contVA);
 
        candev->nr_82527_chips = 0;
        candev->nr_sja1000_chips = 0;
@@ -236,12 +233,12 @@ int ns_dev_init_obj_data(struct canchip_t *chip, int objnr)
  * Return Value: The function does not return a value
  * File: src/template.c
  */
-void ns_dev_write_register(unsigned data, unsigned long address)
+void ns_dev_write_register(unsigned data, can_ioptr_t address)
 {
        int i;
        //unsigned long usecs = 1;
 
-       writew(data, address);
+       can_writew(data, address);
        //udelay( usecs );
        for (i = 0; i < 5; i++) ;
 }
@@ -256,14 +253,14 @@ void ns_dev_write_register(unsigned data, unsigned long address)
  * Return Value: The function returns the value stored in @address
  * File: src/template.c
  */
-unsigned ns_dev_read_register(unsigned long address)
+unsigned ns_dev_read_register(can_ioptr_t address)
 {
        u16 value, i;
 
-       value = readw(address);
+       value = can_readw(address);
        //udelay( usecs );
        for (i = 0; i < 5; i++) ;
-       value = readw(address);
+       value = can_readw(address);
        //udelay( usecs );
        for (i = 0; i < 5; i++) ;
 
index ce9c591..06d38e1 100644 (file)
@@ -64,8 +64,8 @@ int nsi_reset(struct candevice_t *candev)
     DEBUGMSG("Resetting nsi hardware ...\n");
     /* we don't use template_write_register because we don't use the two first
        register of the card but the third in order to make a hard reset */
-    outb (1, nsican_base + candev->res_addr);
-    outb (0, nsican_base + candev->res_addr);
+    can_outb (1, nsican_base + candev->res_addr);
+    can_outb (0, nsican_base + candev->res_addr);
     for (i = 1; i < 1000; i++)
        udelay (1000);
     
@@ -124,7 +124,7 @@ int nsi_init_chip_data(struct candevice_t *candev, int chipnr)
 {
        i82527_fill_chipspecops(candev->chip[chipnr]);
        candev->chip[chipnr]->chip_base_addr=
-           candev->io_addr;
+           can_ioport2ioptr(candev->io_addr);
        candev->chip[chipnr]->clock = 16000000;
        nsican_irq=candev->chip[chipnr]->chip_irq;      
         nsican_base=candev->chip[chipnr]->chip_base_addr;
@@ -169,7 +169,7 @@ int nsi_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_write_register(unsigned data, unsigned long address)
+void nsi_write_register(unsigned data, can_ioptr_t address)
 {
     /* address is an absolute address */
 
@@ -178,14 +178,14 @@ void nsi_write_register(unsigned data, unsigned long address)
 
     /* write the relative address on the eight LSB bits 
        and the data on the eight MSB bits in one time */
-    outw(address-nsican_base + (256 * data), nsican_base); 
+    can_outw(address-nsican_base + (256 * data), nsican_base); 
 }
 
 /* The function template_read_register is used to read from hardware registers
  * on the CAN chip. You should only have to edit this function if your hardware
  * uses some specific read process.
  */
-unsigned nsi_read_register(unsigned long address)
+unsigned nsi_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 
@@ -195,8 +195,8 @@ unsigned nsi_read_register(unsigned long address)
        can_spin_irqflags_t flags;
     
        can_spin_lock_irqsave(&nsican_port_lock,flags);
-       outb(address-nsican_base, nsican_base);
-       ret=inb(nsican_base+1);
+       can_outb(address-nsican_base, nsican_base);
+       ret=can_inb(nsican_base+1);
        can_spin_unlock_irqrestore(&nsican_port_lock,flags);
        return ret;
 }
index 9fbed11..97ce2b4 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
 
@@ -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,7 +526,7 @@ 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)
 {
        return ioread8((void*)address);
 }
index 798e6ea..0c8c5af 100644 (file)
@@ -83,7 +83,7 @@ int oscar_init_chip_data(struct candevice_t *candev, int chipnr)
     // sja1000_fill_chipspecops(candev->chip[chipnr]);
     sja1000p_fill_chipspecops(candev->chip[chipnr]);
        
-    candev->chip[chipnr]->chip_base_addr = candev->io_addr;
+    candev->chip[chipnr]->chip_base_addr = can_ioport2ioptr(candev->io_addr);
     candev->chip[chipnr]->clock = 12000000;
     candev->chip[chipnr]->sja_cdr_reg = sjaCDR_CBP;  // we use an external tranceiver
     candev->chip[chipnr]->sja_ocr_reg = sjaOCR_MODE_NORMAL | sjaOCR_TX0_LH;
@@ -110,14 +110,14 @@ int oscar_program_irq(struct candevice_t *candev)
     return 0;
 }
 
-void oscar_write_register(unsigned data, unsigned long address)
+void oscar_write_register(unsigned data, can_ioptr_t address)
 {
-       outb(data,address);
+       can_outb(data,address);
 }
 
-unsigned oscar_read_register(unsigned long address)
+unsigned oscar_read_register(can_ioptr_t address)
 {
-       return inb(address);
+       return can_inb(address);
 }
 
 /* !!! Don't change this function !!! */
index c724068..def0546 100644 (file)
@@ -230,7 +230,7 @@ int pci03_program_irq(struct candevice_t *candev)
  * Return Value: The function does not return a value
  * File: src/pc-i03.c
  */
-void pci03_write_register(unsigned data, unsigned long address)
+void pci03_write_register(unsigned data, can_ioptr_t address)
 {
        unsigned int *pci03_base_ptr;
        unsigned short address_to_write;
@@ -255,7 +255,7 @@ void pci03_write_register(unsigned data, unsigned long address)
  * Return Value: The function returns the value stored in @address
  * File: src/pc-i03.c
  */
-unsigned pci03_read_register(unsigned long address)
+unsigned pci03_read_register(can_ioptr_t address)
 {
        unsigned int *pci03_base_ptr;
        unsigned short address_to_read;
index ca7ef79..d2a8968 100644 (file)
@@ -140,13 +140,13 @@ char dongle_type[] = "epp_dongle";
 static void _parport_disable_irq(struct DONGLE_PORT *dng)
 {
   u16 _PC_ = (u16)dng->dwPort + 2;
-  outb(inb(_PC_) & ~0x10, _PC_);
+  can_outb(can_inb(_PC_) & ~0x10, _PC_);
 }
 
 static void _parport_enable_irq(struct DONGLE_PORT *dng)
 {
   u16 _PC_ = (u16)dng->dwPort + 2;
-  outb(inb(_PC_) | 0x10, _PC_);
+  can_outb(can_inb(_PC_) | 0x10, _PC_);
 }
 
 
@@ -157,18 +157,18 @@ static u8 pcan_dongle_sp_readreg(struct DONGLE_PORT *dng, u8 port) // read a reg
   u16 _PB_ = _PA_ + 1;
   u16 _PC_ = _PB_ + 1;
   u8  b0, b1 ;
-  u8  irqEnable = inb(_PC_) & 0x10; // don't influence irqEnable
+  u8  irqEnable = can_inb(_PC_) & 0x10; // don't influence irqEnable
   can_spin_irqflags_t flags;
 
   can_spin_lock_irqsave(&pcan_lock, flags);
 
-  outb((0x0B ^ 0x0D) | irqEnable, _PC_);
-  outb((port & 0x1F) | 0x80,      _PA_);
-  outb((0x0B ^ 0x0C) | irqEnable, _PC_);
-  b1=nibble_decode[inb(_PB_)>>3];
-  outb(0x40, _PA_);
-  b0=nibble_decode[inb(_PB_)>>3];
-  outb((0x0B ^ 0x0D) | irqEnable, _PC_);
+  can_outb((0x0B ^ 0x0D) | irqEnable, _PC_);
+  can_outb((port & 0x1F) | 0x80,      _PA_);
+  can_outb((0x0B ^ 0x0C) | irqEnable, _PC_);
+  b1=nibble_decode[can_inb(_PB_)>>3];
+  can_outb(0x40, _PA_);
+  b0=nibble_decode[can_inb(_PB_)>>3];
+  can_outb((0x0B ^ 0x0D) | irqEnable, _PC_);
 
   can_spin_unlock_irqrestore(&pcan_lock, flags);
 
@@ -179,16 +179,16 @@ static void pcan_dongle_writereg(struct DONGLE_PORT *dng, u8 port, u8 data) // w
 {
   u16 _PA_ = (u16)dng->dwPort;
   u16 _PC_ = _PA_ + 2;
-  u8  irqEnable = inb(_PC_) & 0x10; // don't influence irqEnable
+  u8  irqEnable = can_inb(_PC_) & 0x10; // don't influence irqEnable
   can_spin_irqflags_t flags;
 
   can_spin_lock_irqsave(&pcan_lock, flags);
 
-  outb((0x0B ^ 0x0D) | irqEnable, _PC_);
-  outb(port & 0x1F,               _PA_);
-  outb((0x0B ^ 0x0C) | irqEnable, _PC_);
-  outb(data,                      _PA_);
-  outb((0x0B ^ 0x0D) | irqEnable, _PC_);
+  can_outb((0x0B ^ 0x0D) | irqEnable, _PC_);
+  can_outb(port & 0x1F,               _PA_);
+  can_outb((0x0B ^ 0x0C) | irqEnable, _PC_);
+  can_outb(data,                      _PA_);
+  can_outb((0x0B ^ 0x0D) | irqEnable, _PC_);
 
   can_spin_unlock_irqrestore(&pcan_lock, flags);
 }
@@ -199,16 +199,16 @@ static u8 pcan_dongle_epp_readreg(struct DONGLE_PORT *dng, u8 port) // read a re
   u16 _PA_ = (u16)dng->dwPort;
   u16 _PC_ = _PA_ + 2;
   u8  wert;
-  u8  irqEnable = inb(_PC_) & 0x10; // don't influence irqEnable
+  u8  irqEnable = can_inb(_PC_) & 0x10; // don't influence irqEnable
   can_spin_irqflags_t flags;
 
   can_spin_lock_irqsave(&pcan_lock, flags);
 
-  outb((0x0B ^ 0x0F) | irqEnable, _PC_);
-  outb((port & 0x1F) | 0x80,      _PA_);
-  outb((0x0B ^ 0x2E) | irqEnable, _PC_);
-  wert = inb(_PA_);
-  outb((0x0B ^ 0x0F) | irqEnable, _PC_);
+  can_outb((0x0B ^ 0x0F) | irqEnable, _PC_);
+  can_outb((port & 0x1F) | 0x80,      _PA_);
+  can_outb((0x0B ^ 0x2E) | irqEnable, _PC_);
+  wert = can_inb(_PA_);
+  can_outb((0x0B ^ 0x0F) | irqEnable, _PC_);
 
   can_spin_unlock_irqrestore(&pcan_lock, flags);
 
@@ -260,8 +260,8 @@ static void setECR(struct DONGLE_PORT *dng)
 {
        u16 wEcr = dng->wEcr;
 
-       dng->ucOldECRContent = inb(wEcr);
-       outb((dng->ucOldECRContent & 0x1F) | 0x20, wEcr);
+       dng->ucOldECRContent = can_inb(wEcr);
+       can_outb((dng->ucOldECRContent & 0x1F) | 0x20, wEcr);
 
        if (dng->ucOldECRContent == 0xff)
                DEBUGMSG("%s: realy ECP mode configured?\n", DEVICE_NAME);
@@ -271,7 +271,7 @@ static void restoreECR(struct DONGLE_PORT *dng)
 {
   u16 wEcr = dng->wEcr;
 
-  outb(dng->ucOldECRContent, wEcr);
+  can_outb(dng->ucOldECRContent, wEcr);
 
   DEBUGMSG("%s: restore ECR\n", DEVICE_NAME);
 }
@@ -337,8 +337,8 @@ static int pcan_dongle_open(struct DONGLE_PORT *dng)
       wPort    = (u16)dng->dwPort;
          
      // save old port contents
-     dng->ucOldDataContent     = inb(wPort);
-     dng->ucOldControlContent  = inb(wPort + 2);
+     dng->ucOldDataContent     = can_inb(wPort);
+     dng->ucOldControlContent  = can_inb(wPort + 2);
          
      // switch to epp mode if possible
      if (dng->wType == HW_DONGLE_SJA_EPP)
@@ -364,8 +364,8 @@ static int pcan_dongle_release(struct DONGLE_PORT *dng)
     restoreECR(dng);
     
   // restore port state
-  outb(dng->ucOldDataContent, wPort);
-  outb(dng->ucOldControlContent, wPort + 2);
+  can_outb(dng->ucOldDataContent, wPort);
+  can_outb(dng->ucOldControlContent, wPort + 2);
       
   parport_release(dng->pardev);
   
@@ -605,7 +605,7 @@ int pcan_dongle_init_chip_data(struct candevice_t *candev, int chipnr)
 
 
        candev->chip[chipnr]->chip_type=CHIP_TYPE;
-       candev->chip[chipnr]->chip_base_addr=candev->io_addr;
+       candev->chip[chipnr]->chip_base_addr=can_ioport2ioptr(candev->io_addr);
        candev->chip[chipnr]->clock = 16000000;
        candev->chip[chipnr]->int_clk_reg = 0x0;
        candev->chip[chipnr]->int_bus_reg = 0x0;
@@ -679,7 +679,7 @@ int pcan_dongle_program_irq(struct candevice_t *candev)
  * Return Value: The function does not return a value
  * File: src/template.c
  */
-void pcan_dongle_write_register(unsigned data, unsigned long address)
+void pcan_dongle_write_register(unsigned data, can_ioptr_t address)
 {
    address -= dongle_port.chip->chip_base_addr;  // it's in mutiplexed mode
 
@@ -698,7 +698,7 @@ void pcan_dongle_write_register(unsigned data, unsigned long address)
  * Return Value: The function returns the value stored in @address
  * File: src/template.c
  */
-unsigned pcan_dongle_read_register(unsigned long address)
+unsigned pcan_dongle_read_register(can_ioptr_t address)
 {
    u8 val;
 
index 4d877c6..289fa84 100644 (file)
@@ -108,14 +108,14 @@ int pccanf_reset(struct candevice_t *candev)
        DEBUGMSG("Resetting pccanf/s hardware ...\n");
        while (i < 1000000) {
                i++;
-               outb(0x00,candev->res_addr);
+               can_outb(0x00,candev->res_addr);
        }
-       outb(0x01,candev->res_addr);
-       outb(0x00,candev->chip[0]->chip_base_addr+SJACR);
+       can_outb(0x01,candev->res_addr);
+       can_outb(0x00,candev->chip[0]->chip_base_addr+SJACR);
 
        /* Check hardware reset status */
        i=0;
-       while ( (inb(candev->chip[0]->chip_base_addr+SJACR) & sjaCR_RR)
+       while ( (can_inb(candev->chip[0]->chip_base_addr+SJACR) & sjaCR_RR)
                                                                 && (i<=15) ) {
                udelay(20000);
                i++;
@@ -138,17 +138,17 @@ int pccand_reset(struct candevice_t *candev)
        DEBUGMSG("Resetting pccan-d hardware ...\n");
        while (i < 1000000) {
                i++;
-               outb(0x00,candev->res_addr);
+               can_outb(0x00,candev->res_addr);
        }
-       outb(0x01,candev->res_addr);
-       outb(0x00,candev->chip[0]->chip_base_addr+SJACR);
-       outb(0x00,candev->chip[1]->chip_base_addr+SJACR);
+       can_outb(0x01,candev->res_addr);
+       can_outb(0x00,candev->chip[0]->chip_base_addr+SJACR);
+       can_outb(0x00,candev->chip[1]->chip_base_addr+SJACR);
 
        /* Check hardware reset status */
        i=0;
        for (chip_nr=0; chip_nr<2; chip_nr++) {
                i=0;
-               while ( (inb(candev->chip[chip_nr]->chip_base_addr +
+               while ( (can_inb(candev->chip[chip_nr]->chip_base_addr +
                                                SJACR) & sjaCR_RR) && (i<=15) ) {
                        udelay(20000);
                        i++;
@@ -174,17 +174,17 @@ int pccanq_reset(struct candevice_t *candev)
        DEBUGMSG("Resetting pccan-q hardware ...\n");
        while (i < 100000) {
                i++;
-               outb(0x00,candev->res_addr);
+               can_outb(0x00,candev->res_addr);
        }
        outb_p(0x01,candev->res_addr);
                
-       outb(0x00,candev->chip[2]->chip_base_addr+SJACR);
-       outb(0x00,candev->chip[3]->chip_base_addr+SJACR);
+       can_outb(0x00,candev->chip[2]->chip_base_addr+SJACR);
+       can_outb(0x00,candev->chip[3]->chip_base_addr+SJACR);
 
        /* Check hardware reset status */
        for (chip_nr=0; chip_nr<2; chip_nr++) {
                i=0;
-               while( (inb(candev->chip[chip_nr]->chip_base_addr +
+               while( (can_inb(candev->chip[chip_nr]->chip_base_addr +
                                                iCPU) & iCPU_RST) && (i<=15) ) {
                        udelay(20000);
                        i++;
@@ -199,7 +199,7 @@ int pccanq_reset(struct candevice_t *candev)
        }
        for (chip_nr=2; chip_nr<4; chip_nr++) {
                i=0;
-               while( (inb(candev->chip[chip_nr]->chip_base_addr +
+               while( (can_inb(candev->chip[chip_nr]->chip_base_addr +
                                                SJACR) & sjaCR_RR) && (i<=15) ) {
                        udelay(20000);
                        i++;
@@ -267,11 +267,11 @@ int pccan_init_chip_data(struct candevice_t *candev, int chipnr)
                        candev->chip[chipnr]->sja_ocr_reg = 
                                                sjaOCR_MODE_NORMAL | sjaOCR_TX0_LH;     
                }
-               candev->chip[chipnr]->chip_base_addr=0x1000*chipnr+0x2000+candev->io_addr;
+               candev->chip[chipnr]->chip_base_addr=can_ioport2ioptr(0x1000*chipnr+0x2000+candev->io_addr);
        }
        else {
                sja1000_fill_chipspecops(candev->chip[chipnr]);
-               candev->chip[chipnr]->chip_base_addr=0x1000*chipnr+0x4000+candev->io_addr;
+               candev->chip[chipnr]->chip_base_addr=can_ioport2ioptr(0x1000*chipnr+0x4000+candev->io_addr);
                candev->chip[chipnr]->flags = 0;
                candev->chip[chipnr]->int_cpu_reg = 0;
                candev->chip[chipnr]->int_clk_reg = 0;
@@ -330,22 +330,22 @@ int pccan_program_irq(struct candevice_t *candev)
                        }
                }
        }
-       outb(irq_reg_value,0x6000+candev->io_addr);
+       can_outb(irq_reg_value,0x6000+candev->io_addr);
        DEBUGMSG("Configured pccan hardware interrupts\n");
-       outb(0x80,0x6000+candev->io_addr+0x02);
+       can_outb(0x80,0x6000+candev->io_addr+0x02);
        DEBUGMSG("Selected pccan on-board 16 MHz oscillator\n");
 
        return 0;
 }
 
-inline void pccan_write_register(unsigned data, unsigned long address)
+inline void pccan_write_register(unsigned data, can_ioptr_t address)
 {
-       outb(data,address); 
+       can_outb(data,address); 
 }
 
-unsigned pccan_read_register(unsigned long address)
+unsigned pccan_read_register(can_ioptr_t address)
 {
-       return inb(address);
+       return can_inb(address);
 }
 
 int pccanf_register(struct hwspecops_t *hwspecops)
index b568912..a8c0b19 100644 (file)
@@ -103,13 +103,13 @@ int pcccan_reset(struct candevice_t *candev)
        DEBUGMSG("Resetting pcccan-1 hardware ...\n");
        while (i < 1000000) {
                i++;
-               outb(0x0,candev->res_addr);
+               can_outb(0x0,candev->res_addr);
        }
 
        /* Check hardware reset status */
        i=0;
-       outb(iCPU,candev->io_addr+0x1);
-       while ( (inb(candev->io_addr+0x2)&0x80) && (i<=15) ) {
+       can_outb(iCPU,candev->io_addr+0x1);
+       while ( (can_inb(candev->io_addr+0x2)&0x80) && (i<=15) ) {
                udelay(20000);
                i++;
        }
@@ -187,7 +187,7 @@ int pcccan_init_hw_data(struct candevice_t *candev)
 int pcccan_init_chip_data(struct candevice_t *candev, int chipnr)
 {
        i82527_fill_chipspecops(candev->chip[chipnr]);
-       candev->chip[chipnr]->chip_base_addr=candev->io_addr;
+       candev->chip[chipnr]->chip_base_addr=can_ioport2ioptr(candev->io_addr);
        candev->chip[chipnr]->clock = 16000000;
        candev->chip[chipnr]->int_cpu_reg = iCPU_DSC | iCPU_DMC;
        candev->chip[chipnr]->int_clk_reg = iCLK_SL1 | iCLK_CD0;
@@ -252,12 +252,12 @@ int pcccan_program_irq(struct candevice_t *candev)
  * Return Value: The function does not return a value
  * File: src/pcccan.c
  */
-void pcccan_write_register(unsigned data, unsigned long address)
+void pcccan_write_register(unsigned data, can_ioptr_t address)
 {
        can_spin_irqflags_t flags;
        can_spin_lock_irqsave(&pcccan_port_lock,flags);
-       outb(address - pcccan_base, pcccan_base+1);
-       outb(data, pcccan_base+6);
+       can_outb(address - pcccan_base, pcccan_base+1);
+       can_outb(data, pcccan_base+6);
        can_spin_unlock_irqrestore(&pcccan_port_lock,flags);
 }
 
@@ -271,13 +271,13 @@ void pcccan_write_register(unsigned data, unsigned long address)
  * Return Value: The function returns the value stored in @address
  * File: src/pcccan.c
  */
-unsigned pcccan_read_register(unsigned long address)
+unsigned pcccan_read_register(can_ioptr_t address)
 {
        unsigned ret;
        can_spin_irqflags_t flags;
        can_spin_lock_irqsave(&pcccan_port_lock,flags);
-       outb(address - pcccan_base, pcccan_base+1);
-       ret=inb(pcccan_base+2);
+       can_outb(address - pcccan_base, pcccan_base+1);
+       ret=can_inb(pcccan_base+2);
        can_spin_unlock_irqrestore(&pcccan_port_lock,flags);
        return ret;
 
index adc4293..b87e7a8 100644 (file)
  */
 int pcm3680_request_io(struct candevice_t *candev)
 {
-        unsigned long remap_addr;
+        can_ioptr_t remap_addr;
        if (!can_request_mem_region(candev->io_addr,IO_RANGE,DEVICE_NAME " - pcm3680")) {
                CANMSG("Unable to request IO-memory: 0x%lx\n",candev->io_addr);
                return -ENODEV;
        }
-       if ( !( remap_addr = (long) ioremap( candev->io_addr, IO_RANGE ) ) ) {
+       if ( !( remap_addr = ioremap( candev->io_addr, IO_RANGE ) ) ) {
                CANMSG("Unable to access I/O memory at: 0x%lx\n", candev->io_addr);
                can_release_mem_region(candev->io_addr,IO_RANGE);
                return -ENODEV;
@@ -172,7 +172,7 @@ int pcm3680_init_chip_data(struct candevice_t *candev, int chipnr)
 {
        sja1000p_fill_chipspecops(candev->chip[chipnr]);
        candev->chip[chipnr]->chip_base_addr=
-                       candev->io_addr + 0x200*chipnr;
+                       candev->dev_base_addr + 0x200*chipnr;
        candev->chip[chipnr]->clock = 16000000;
        candev->chip[chipnr]->int_clk_reg = 0x0;
        candev->chip[chipnr]->int_bus_reg = 0x0;
@@ -235,9 +235,9 @@ int pcm3680_program_irq(struct candevice_t *candev)
  * Return Value: The function does not return a value
  * File: src/template.c
  */
-void pcm3680_write_register(unsigned data, unsigned long address)
+void pcm3680_write_register(unsigned data, can_ioptr_t address)
 {
-       writeb(data,address);
+       can_writeb(data,address);
 }
 
 /**
@@ -250,9 +250,9 @@ void pcm3680_write_register(unsigned data, unsigned long address)
  * Return Value: The function returns the value stored in @address
  * File: src/template.c
  */
-unsigned pcm3680_read_register(unsigned long address)
+unsigned pcm3680_read_register(can_ioptr_t address)
 {
-       return readb(address);
+       return can_readb(address);
 }
 
 /* !!! Don't change this function !!! */
index fd0f340..2a4fd22 100644 (file)
  */
 int pikronisa_request_io(struct candevice_t *candev)
 {
-        int remap_addr;
+        can_ioptr_t remap_addr;
        
        if (!can_request_mem_region(candev->io_addr,IO_RANGE,DEVICE_NAME " - pikronisa")) {
                CANMSG("Unable to request IO-memory: 0x%lx\n",candev->io_addr);
                return -ENODEV;
        }
-       if ( !( remap_addr = (long) ioremap( candev->io_addr, IO_RANGE ) ) ) {
+       if ( !( remap_addr = ioremap( candev->io_addr, IO_RANGE ) ) ) {
                CANMSG("Unable to access I/O memory at: 0x%lx\n", candev->io_addr);
                can_release_mem_region(candev->io_addr,IO_RANGE);
                return -ENODEV;
@@ -68,7 +68,7 @@ int pikronisa_request_io(struct candevice_t *candev)
 int pikronisa_release_io(struct candevice_t *candev)
 {
        /* release I/O memory mapping */
-       iounmap((void*)candev->dev_base_addr);
+       iounmap(candev->dev_base_addr);
        can_release_mem_region(candev->io_addr,IO_RANGE);
 
        return 0;
@@ -180,7 +180,7 @@ int pikronisa_init_chip_data(struct candevice_t *candev, int chipnr)
        /*sja1000_fill_chipspecops(candev->chip[chipnr]);*/
        sja1000p_fill_chipspecops(candev->chip[chipnr]);
 
-       candev->chip[chipnr]->chip_base_addr=candev->io_addr;
+       candev->chip[chipnr]->chip_base_addr=candev->dev_base_addr;
        candev->chip[chipnr]->clock = 24000000;
        candev->chip[chipnr]->int_clk_reg = 0x0;
        candev->chip[chipnr]->int_bus_reg = 0x0;
@@ -241,11 +241,11 @@ int pikronisa_program_irq(struct candevice_t *candev)
  * Return Value: The function does not return a value
  * File: src/pikronisa.c
  */
-void pikronisa_write_register(unsigned data, unsigned long address)
+void pikronisa_write_register(unsigned data, can_ioptr_t address)
 {
        /*DEBUGMSG("pikronisa_write_register: addr=0x%lx data=0x%x",
                address,data);*/
-       writeb(data,address);
+       can_writeb(data,address);
 }
 
 /**
@@ -258,9 +258,9 @@ void pikronisa_write_register(unsigned data, unsigned long address)
  * Return Value: The function returns the value stored in @address
  * File: src/pikronisa.c
  */
-unsigned pikronisa_read_register(unsigned long address)
+unsigned pikronisa_read_register(can_ioptr_t address)
 {
-       return readb(address);
+       return can_readb(address);
 }
 
 /* !!! Don't change this function !!! */
index 1c1a303..00b7d6d 100644 (file)
@@ -133,11 +133,11 @@ int pimx1_release_io(struct candevice_t *candev)
  * Return Value: The function does not return a value
  * File: src/pikronisa.c
  */
-void pimx1_write_register(unsigned data, unsigned long address)
+void pimx1_write_register(unsigned data, can_ioptr_t address)
 {
        /*DEBUGMSG("pimx1_write_register: addr=0x%lx data=0x%x\n",
                address,data);*/
-       writeb(data,address);
+       can_writeb(data,address);
 }
 
 /**
@@ -150,9 +150,9 @@ void pimx1_write_register(unsigned data, unsigned long address)
  * Return Value: The function returns the value stored in @address
  * File: src/pikronisa.c
  */
-unsigned pimx1_read_register(unsigned long address)
+unsigned pimx1_read_register(can_ioptr_t address)
 {
-       return readb(address);
+       return can_readb(address);
 }
 
 /**
index add0fee..1410288 100644 (file)
@@ -71,13 +71,13 @@ int pip_reset(struct candevice_t *candev)
        DEBUGMSG("Resetting %s hardware ...\n", candev->hwname);
        while (i < 1000000) {
                i++;
-               outb(0x01, candev->res_addr);
+               can_outb(0x01, candev->res_addr);
        }
-       outb(0x0, candev->res_addr);
+       can_outb(0x0, candev->res_addr);
 
        /* Check hardware reset status */
        i = 0;
-       while ((inb(candev->io_addr + iCPU) & iCPU_RST) && (i <= 15)) {
+       while ((can_inb(candev->io_addr + iCPU) & iCPU_RST) && (i <= 15)) {
                udelay(20000);
                i++;
        }
@@ -106,7 +106,7 @@ int pip_init_hw_data(struct candevice_t *candev)
 int pip_init_chip_data(struct candevice_t *candev, int chipnr)
 {
        i82527_fill_chipspecops(candev->chip[chipnr]);
-       candev->chip[chipnr]->chip_base_addr = candev->io_addr;
+       candev->chip[chipnr]->chip_base_addr = can_ioport2ioptr(candev->io_addr);
        candev->chip[chipnr]->clock = 8000000;
        candev->chip[chipnr]->int_cpu_reg = 0;
        candev->chip[chipnr]->int_clk_reg = iCLK_SL1;
@@ -131,7 +131,7 @@ int pip_program_irq(struct candevice_t *candev)
        unsigned char can_addr = 0, can_reg = 0;
        DEBUGMSG("pip_program_irq\n");
        /* Reset can controller */
-       outb(0x01, candev->res_addr);
+       can_outb(0x01, candev->res_addr);
        if (strcmp(candev->hwname, "pip5") == 0) {
                irq_mask = PIP5_IRQ_MAP;
        } else if (strcmp(candev->hwname, "pip6") == 0) {
@@ -175,26 +175,26 @@ int pip_program_irq(struct candevice_t *candev)
                        return -ENODEV;
                }
        }
-       can_reg = inb(PIP_CANRES_REG);
+       can_reg = can_inb(PIP_CANRES_REG);
        DEBUGMSG("PIP_CANRES was 0x%x\n", can_reg);
        can_reg = (candev->chip[0]->chip_irq << 4) | can_addr;
        DEBUGMSG("Setting PIP_CANRES_REG to 0x%x\n", can_reg);
-       outb((candev->chip[0]->chip_irq << 4) | can_addr, PIP_CANRES_REG);
+       can_outb((candev->chip[0]->chip_irq << 4) | can_addr, PIP_CANRES_REG);
        /* re-enable the chip */
-       outb(0x00, candev->res_addr);
+       can_outb(0x00, candev->res_addr);
 
        return 0;
 }
 
 
-void pip_write_register(unsigned data, unsigned long address)
+void pip_write_register(unsigned data, can_ioptr_t address)
 {
-       outb(data, address);
+       can_outb(data, address);
 }
 
-unsigned pip_read_register(unsigned long address)
+unsigned pip_read_register(can_ioptr_t address)
 {
-       return inb(address);
+       return can_inb(address);
 }
 
 /* !!! Don't change these functions !!! */
index 3957e5f..98fbb80 100644 (file)
@@ -184,9 +184,10 @@ static int can_chip_procinfo(char *buf, char **start, off_t offset,
        len += sprintf(buf+len,"type    : %s\n",chip->chip_type);
        len += sprintf(buf+len,"index   : %d\n",chip->chip_idx);
        len += sprintf(buf+len,"irq     : %d\n",chip->chip_irq);
-       len += sprintf(buf+len,"addr    : %lu\n",chip->chip_base_addr);
+       len += sprintf(buf+len,"addr    : %lu\n",
+                       can_ioptr2ulong(chip->chip_base_addr));
        len += sprintf(buf+len,"config  : %s\n",
-                      (chip->flags & CHIP_CONFIGURED) ? "yes":"no");
+                       (chip->flags & CHIP_CONFIGURED) ? "yes":"no");
        len += sprintf(buf+len,"clock   : %ld Hz\n",chip->clock);
        len += sprintf(buf+len,"baud    : %ld\n",chip->baudrate);
        len += sprintf(buf+len,"num obj : %d\n",chip->max_objects);
index bce1226..619956a 100644 (file)
@@ -30,9 +30,9 @@ int init_obj_struct(struct candevice_t *candev, struct canchip_t *hostchip, int
  * This function is prepared to simplify board specific xxx_request_io() function
  * for memory mapped devices.
  */
-int can_base_addr_fixup(struct candevice_t *candev, unsigned long new_base)
+int can_base_addr_fixup(struct candevice_t *candev, can_ioptr_t new_base)
 {
-       unsigned long offs;
+       long offs;
        int i, j;
        
        offs=new_base-candev->dev_base_addr;
index a7a990d..f83d8d9 100644 (file)
@@ -41,17 +41,17 @@ int smartcan_reset(struct candevice_t *candev)
        int i=0;
 
        DEBUGMSG("Resetting smartcan hardware ...\n");
-       outb(0x00,candev->res_addr);
+       can_outb(0x00,candev->res_addr);
        while (i < 1000000) {
                i++;
-               outb(0x01,candev->res_addr);
+               can_outb(0x01,candev->res_addr);
        }
-       outb(0x00,candev->res_addr); 
+       can_outb(0x00,candev->res_addr); 
 
        /* Check hardware reset status */
        i=0;
-       outb(candev->io_addr+iCPU,candev->io_addr);
-       while ( (inb(candev->io_addr+1)&0x80) && (i<=15) ) {
+       can_outb(candev->io_addr+iCPU,candev->io_addr);
+       while ( (can_inb(candev->io_addr+1)&0x80) && (i<=15) ) {
                udelay(20000);
                i++;
        }
@@ -79,7 +79,7 @@ int smartcan_init_hw_data(struct candevice_t *candev)
 int smartcan_init_chip_data(struct candevice_t *candev, int chipnr)
 {
        i82527_fill_chipspecops(candev->chip[chipnr]);
-       candev->chip[chipnr]->chip_base_addr=candev->io_addr;
+       candev->chip[chipnr]->chip_base_addr=can_ioport2ioptr(candev->io_addr);
        candev->chip[chipnr]->clock = 16000000;
        candev->chip[chipnr]->int_cpu_reg = iCPU_DSC;
        candev->chip[chipnr]->int_clk_reg = iCLK_SL1;
@@ -100,22 +100,22 @@ int smartcan_init_obj_data(struct canchip_t *chip, int objnr)
 }
 
 
-void smartcan_write_register(unsigned data, unsigned long address)
+void smartcan_write_register(unsigned data, can_ioptr_t address)
 {
        can_spin_irqflags_t flags;
        can_spin_lock_irqsave(&smartcan_port_lock,flags);
-       outb(address-smartcan_base,smartcan_base);
-       outb(data,smartcan_base+1);
+       can_outb(address-smartcan_base,smartcan_base);
+       can_outb(data,smartcan_base+1);
        can_spin_unlock_irqrestore(&smartcan_port_lock,flags);
 }
 
-unsigned smartcan_read_register(unsigned long address)
+unsigned smartcan_read_register(can_ioptr_t address)
 {
        unsigned ret;
        can_spin_irqflags_t flags;
        can_spin_lock_irqsave(&smartcan_port_lock,flags);
-       outb(address-smartcan_base,smartcan_base);
-       ret=inb(smartcan_base+1);
+       can_outb(address-smartcan_base,smartcan_base);
+       ret=can_inb(smartcan_base+1);
        can_spin_unlock_irqrestore(&smartcan_port_lock,flags);
        return ret;
 }
index 45aef4b..17d60ef 100644 (file)
@@ -12,7 +12,7 @@
 #include "../include/i82527.h"
 
 int ssvcan_irq[2]={-1,-1};
-unsigned long ssvcan_base=0x0;
+can_ioptr_t ssvcan_base=0x0;
 
 static CAN_DEFINE_SPINLOCK(ssv_port_lock);
 
@@ -137,7 +137,7 @@ int ssv_init_chip_data(struct candevice_t *candev, int chipnr)
 {
     i82527_fill_chipspecops(candev->chip[chipnr]);
     candev->chip[chipnr]->chip_base_addr=
-       candev->io_addr+0x100*chipnr;
+       can_ioport2ioptr(candev->io_addr+0x100*chipnr);
     candev->chip[chipnr]->clock = 16000000;
     ssvcan_irq[chipnr]=candev->chip[chipnr]->chip_irq;
 
@@ -183,7 +183,7 @@ int ssv_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 ssv_write_register(unsigned data, unsigned long address)
+void ssv_write_register(unsigned data, can_ioptr_t address)
 {
     /* address is an absolute address */
 
@@ -193,16 +193,16 @@ void ssv_write_register(unsigned data, unsigned long address)
     /* write the relative address on the eight LSB bits 
      and the data on the eight MSB bits in one time */
     if((address-ssvcan_base)<0x100)
-       outw(address-ssvcan_base + (256 * data), ssvcan_base);
+       can_outw(address-ssvcan_base + (256 * data), ssvcan_base);
     else
-       outw(address-ssvcan_base-0x100 + (256 * data), ssvcan_base+0x02);
+       can_outw(address-ssvcan_base-0x100 + (256 * data), ssvcan_base+0x02);
 }
 
 /* The function template_read_register is used to read from hardware registers
  * on the CAN chip. You should only have to edit this function if your hardware
  * uses some specific read process.
  */
-unsigned ssv_read_register(unsigned long address)
+unsigned ssv_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 
@@ -215,15 +215,15 @@ unsigned ssv_read_register(unsigned long address)
     if((address-ssvcan_base)<0x100)
     {
        can_spin_lock_irqsave(&ssv_port_lock,flags);
-       outb(address-ssvcan_base, ssvcan_base);
-       ret=inb(ssvcan_base+1);
+       can_outb(address-ssvcan_base, ssvcan_base);
+       ret=can_inb(ssvcan_base+1);
        can_spin_unlock_irqrestore(&ssv_port_lock,flags);
     }
     else
     {
        can_spin_lock_irqsave(&ssv_port_lock,flags);
-       outb(address-ssvcan_base-0x100, ssvcan_base+0x02);
-       ret=inb(ssvcan_base+1+0x02);
+       can_outb(address-ssvcan_base-0x100, ssvcan_base+0x02);
+       ret=can_inb(ssvcan_base+1+0x02);
        can_spin_unlock_irqrestore(&ssv_port_lock,flags);
     }
 
index d990332..a91d9fd 100644 (file)
@@ -152,7 +152,7 @@ int template_init_chip_data(struct candevice_t *candev, int chipnr)
        /*sja1000_fill_chipspecops(candev->chip[chipnr]);*/
        /*sja1000p_fill_chipspecops(candev->chip[chipnr]);*/
        
-       candev->chip[chipnr]->chip_base_addr=candev->io_addr;
+       candev->chip[chipnr]->chip_base_addr=can_ioport2ioptr(candev->io_addr);
        candev->chip[chipnr]->clock = 16000000;
        candev->chip[chipnr]->int_cpu_reg = iCPU_DSC;
        candev->chip[chipnr]->int_clk_reg = iCLK_SL1;
@@ -216,9 +216,9 @@ int template_program_irq(struct candevice_t *candev)
  * Return Value: The function does not return a value
  * File: src/template.c
  */
-void template_write_register(unsigned data, unsigned long address)
+void template_write_register(unsigned data, can_ioptr_t address)
 {
-       outb(data,address);
+       can_outb(data,address);
 }
 
 /**
@@ -231,9 +231,9 @@ void template_write_register(unsigned data, unsigned long address)
  * Return Value: The function returns the value stored in @address
  * File: src/template.c
  */
-unsigned template_read_register(unsigned long address)
+unsigned template_read_register(can_ioptr_t address)
 {
-       return inb(address);
+       return can_inb(address);
 }
 
 /* !!! Don't change this function !!! */
index e799097..841970a 100644 (file)
@@ -136,8 +136,8 @@ int tscan1_request_io(struct candevice_t *candev)
                default:        mode=0x60; break;
        }
 
-       outb(0x00, candev->io_addr+TSCAN1_WIN_REG);
-       outb(mode, candev->io_addr+TSCAN1_MOD_REG);
+       can_outb(0x00, candev->io_addr+TSCAN1_WIN_REG);
+       can_outb(mode, candev->io_addr+TSCAN1_MOD_REG);
 
        return 0;
 }
@@ -177,7 +177,7 @@ int tscan1_release_io(struct candevice_t *candev)
                        can_release_io_region(remap_can_io_addr, TSXXX_CAN_RANGE);
        }
 
-       outb(0x20, candev->io_addr+TSCAN1_MOD_REG);
+       can_outb(0x20, candev->io_addr+TSCAN1_MOD_REG);
 
        can_release_io_region(candev->io_addr, TSXXX_IO_RANGE);
        return 0;
@@ -238,15 +238,15 @@ int tscan1_check_presence(unsigned long remap_io_addr, int *pjmp)
                return -ENODEV;
 
        do {
-               if (inb(remap_io_addr+TSXXX_ID0_REG)!=TSCAN1_ID0 ||
-                       inb(remap_io_addr+TSXXX_ID1_REG)!=TSCAN1_ID1)
+               if (can_inb(remap_io_addr+TSXXX_ID0_REG)!=TSCAN1_ID0 ||
+                       can_inb(remap_io_addr+TSXXX_ID1_REG)!=TSCAN1_ID1)
                        break;
 
-               outb(0x00, remap_io_addr+TSCAN1_WIN_REG);
-               outb(0x20, remap_io_addr+TSCAN1_MOD_REG);
+               can_outb(0x00, remap_io_addr+TSCAN1_WIN_REG);
+               can_outb(0x20, remap_io_addr+TSCAN1_MOD_REG);
 
                if(pjmp)
-                       *pjmp = inb(remap_io_addr+TSCAN1_JMP_REG);
+                       *pjmp = can_inb(remap_io_addr+TSCAN1_JMP_REG);
 
                result = 0;
        } while (0);
@@ -343,12 +343,12 @@ int ts7kv_check_presence(unsigned long remap_io_addr, int *pjmp)
                return -ENODEV;
 
        do {
-               if (inb(remap_io_addr+TSXXX_ID0_REG)!=TS7KV_ID0 ||
-                       inb(remap_io_addr+TSXXX_ID1_REG)!=TS7KV_ID1)
+               if (can_inb(remap_io_addr+TSXXX_ID0_REG)!=TS7KV_ID0 ||
+                       can_inb(remap_io_addr+TSXXX_ID1_REG)!=TS7KV_ID1)
                        break;
 
                if(pjmp)
-                       *pjmp = inb(remap_io_addr+TS7KV_JMP_REG);
+                       *pjmp = can_inb(remap_io_addr+TS7KV_JMP_REG);
 
                result = 0;
        } while (0);
@@ -580,32 +580,33 @@ int tscan1_program_irq(struct candevice_t *candev)
  * Return Value: The function does not return a value
  * File: src/tscan1.c
  */
-void tscan1_write_register(unsigned data, unsigned long address)
+void tscan1_write_register(unsigned data, can_ioptr_t address)
 {
-       outb(data, address);
+       can_outb(data, address);
 }
 
-void ts7kv_write_register(unsigned data, unsigned long address)
+void ts7kv_write_register(unsigned data, can_ioptr_t address)
 {
-       unsigned long base = address & ~0x1f;
+       unsigned long addr=can_ioptr2ulong(address);
+       can_ioptr_t base = can_ulong2ioptr(addr & ~0x1f);
        unsigned char nwin = 0x10;
        unsigned char savewin;
        
        can_spin_irqflags_t flags;
 
-       if((address&0x1f) > 0x1d) {
+       if((addr&0x1f) > 0x1d) {
                nwin++;
                address -= 0x10;
        }
 
        can_spin_lock_irqsave(&ts7kv_win_lock,flags);
-       savewin = inb(base+TS7KV_WIN_REG);
+       savewin = can_inb(base+TS7KV_WIN_REG);
        if(nwin == savewin) {
-               outb(data, address);
+               can_outb(data, address);
        }else{
-               outb(nwin, base+TS7KV_WIN_REG);
-               outb(data, address);
-               outb(savewin, base+TS7KV_WIN_REG);
+               can_outb(nwin, base+TS7KV_WIN_REG);
+               can_outb(data, address);
+               can_outb(savewin, base+TS7KV_WIN_REG);
        }
        can_spin_unlock_irqrestore(&ts7kv_win_lock,flags);
 }
@@ -620,33 +621,34 @@ void ts7kv_write_register(unsigned data, unsigned long address)
  * Return Value: The function returns the value stored in @address
  * File: src/tscan1.c
  */
-unsigned tscan1_read_register(unsigned long address)
+unsigned tscan1_read_register(can_ioptr_t address)
 {
-       return inb(address);
+       return can_inb(address);
 }
 
-unsigned ts7kv_read_register(unsigned long address)
+unsigned ts7kv_read_register(can_ioptr_t address)
 {
-       unsigned long base = address & ~0x1f;
+       unsigned long addr=can_ioptr2ulong(address);
+       can_ioptr_t base = can_ulong2ioptr(addr & ~0x1f);
        unsigned char nwin = 0x10;
        unsigned char savewin;
        unsigned val;
        
        can_spin_irqflags_t flags;
 
-       if((address&0x1f) > 0x1d) {
+       if((addr&0x1f) > 0x1d) {
                nwin++;
                address -= 0x10;
        }
 
        can_spin_lock_irqsave(&ts7kv_win_lock,flags);
-       savewin = inb(base+TS7KV_WIN_REG);
+       savewin = can_inb(base+TS7KV_WIN_REG);
        if(nwin == savewin) {
-               val = inb(address);
+               val = can_inb(address);
        }else{
-               outb(nwin, base+TS7KV_WIN_REG);
-               val = inb(address);
-               outb(savewin, base+TS7KV_WIN_REG);
+               can_outb(nwin, base+TS7KV_WIN_REG);
+               val = can_inb(address);
+               can_outb(savewin, base+TS7KV_WIN_REG);
        }
        can_spin_unlock_irqrestore(&ts7kv_win_lock,flags);
 
index 55cfbd5..7b27ade 100644 (file)
@@ -693,12 +693,12 @@ int unican_wakeup_tx(struct canchip_t *chip, struct msgobj_t *obj)
  */
 int unican_request_io(struct candevice_t *candev)
 {
-        unsigned long remap_addr;
+        can_ioptr_t remap_addr;
        if (!can_request_mem_region(candev->io_addr,IO_RANGE,DEVICE_NAME " - unican")) {
                CANMSG("Unable to request IO-memory: 0x%lx\n",candev->io_addr);
                return -ENODEV;
        }
-       if ( !( remap_addr = (long) ioremap( candev->io_addr, IO_RANGE ) ) ) {
+       if ( !( remap_addr = ioremap( candev->io_addr, IO_RANGE ) ) ) {
                CANMSG("Unable to access I/O memory at: 0x%lx\n", candev->io_addr);
                can_release_mem_region(candev->io_addr,IO_RANGE);
                return -ENODEV;
@@ -718,7 +718,7 @@ int unican_request_io(struct candevice_t *candev)
  */
 int unican_release_io(struct candevice_t *candev)
 {
-       iounmap((void*)candev->dev_base_addr);
+       iounmap(candev->dev_base_addr);
        can_release_mem_region(candev->io_addr,IO_RANGE);
        return 0;
 }
@@ -812,7 +812,7 @@ int unican_init_chip_data(struct candevice_t *candev, int chipnr)
        chip->int_clk_reg = 0x0;
        chip->int_bus_reg = 0x0;
        chip->max_objects = 1;
-       chip->chip_base_addr=candev->io_addr;
+       chip->chip_base_addr=candev->dev_base_addr;
                        
        CANMSG("initializing unican chip operations\n");
        chip->chipspecops->chip_config=unican_chip_config;
@@ -891,7 +891,7 @@ int unican_register(struct hwspecops_t *hwspecops)
 
 int unican_pci_request_io(struct candevice_t *candev)
 {
-        unsigned long remap_addr;
+        can_ioptr_t remap_addr;
 
     #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,21))
        if(pci_request_region(candev->sysdevptr.pcidev, 0, "unican_pci") != 0){
@@ -905,11 +905,10 @@ int unican_pci_request_io(struct candevice_t *candev)
        }
     #endif /*(LINUX_VERSION_CODE > KERNEL_VERSION(2,4,21))*/
 
-       candev->dev_base_addr=pci_resource_start(candev->sysdevptr.pcidev,0);
-       candev->io_addr=candev->dev_base_addr;
-       candev->res_addr=candev->dev_base_addr;
+       candev->io_addr=pci_resource_start(candev->sysdevptr.pcidev,0);
+       candev->res_addr=candev->io_addr;
 
-       if ( !( remap_addr = (long) ioremap( candev->io_addr, IO_RANGE ) ) ) {
+       if ( !( remap_addr = ioremap( candev->io_addr, IO_RANGE ) ) ) {
                CANMSG("Unable to access I/O memory at: 0x%lx\n", candev->io_addr);
            #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,21))
                pci_release_region(candev->sysdevptr.pcidev, 0);
@@ -922,7 +921,8 @@ int unican_pci_request_io(struct candevice_t *candev)
        can_base_addr_fixup(candev, remap_addr);
        DEBUGMSG("Registered IO-memory: 0x%lx - 0x%lx\n", candev->io_addr, candev->io_addr + IO_RANGE - 1);
        DEBUGMSG("VMA: dev_base_addr: 0x%lx chip_base_addr: 0x%lx\n", 
-               candev->dev_base_addr, candev->chip[0]->chip_base_addr);
+               can_ioptr2ulong(candev->dev_base_addr),
+               can_ioptr2ulong(candev->chip[0]->chip_base_addr));
 
        return 0;
 }
@@ -930,7 +930,7 @@ int unican_pci_request_io(struct candevice_t *candev)
 
 int unican_pci_release_io(struct candevice_t *candev)
 {
-       iounmap((void*)candev->dev_base_addr);
+       iounmap(candev->dev_base_addr);
     #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,21))
        pci_release_region(candev->sysdevptr.pcidev, 0);
     #else /*(LINUX_VERSION_CODE > KERNEL_VERSION(2,4,21))*/
@@ -959,9 +959,9 @@ int unican_pci_init_hw_data(struct candevice_t *candev)
                printk(KERN_CRIT "Unican PCI region 0 is not MEM\n");
                return -EIO;
        }
-       candev->dev_base_addr=pci_resource_start(pcidev,0);
-       candev->io_addr=candev->dev_base_addr;
-       candev->res_addr=candev->dev_base_addr;
+       candev->io_addr=pci_resource_start(pcidev,0);
+       candev->res_addr=candev->io_addr;
+       candev->dev_base_addr=NULL;
        
        /*candev->flags |= CANDEV_PROGRAMMABLE_IRQ;*/