]> rtime.felk.cvut.cz Git - lincan.git/commitdiff
Added individual Kconfig for CAN and ORTE components.
authorppisa <ppisa>
Wed, 3 Mar 2004 00:37:25 +0000 (00:37 +0000)
committerppisa <ppisa>
Wed, 3 Mar 2004 00:37:25 +0000 (00:37 +0000)
Work is based on the proposal and initial version done by Pierre.
The option names has been preserved from the previous Kconfig version.
This means, that compilation should work correctly with actual Kconfig
and with new one after upper level Kconfig changes.

IRQ manipulation changed to spin-locks for rest of boards
to support better RT-Linux.

lincan/src/bfadcan.c
lincan/src/nsi.c
lincan/src/pcccan.c
lincan/src/smartcan.c
lincan/src/ssv.c

index 2853ed147e8ff53c1c2a03a4ef6ec27252fd5024..c2c9ce7aa03d7f83fbe4e47e0b96790d5eeb70b7 100644 (file)
@@ -29,7 +29,7 @@ MODULE_PARM(clock_freq,"i");
 
 /* cli and sti are not allowed in 2.5.5x SMP kernels */
 #ifdef WINDOWED_ACCESS
-can_spinlock_t bfadcan_win_lock=SPIN_LOCK_UNLOCKED;
+static can_spinlock_t bfadcan_win_lock=SPIN_LOCK_UNLOCKED;
 #endif
 
 /*
index 9f6bdefd46b61caea13c6804e278c098106fd8af..03ba230bc761348d3785eef043e07f5ddbeecc70 100644 (file)
@@ -16,6 +16,8 @@
 int nsican_irq=-1;
 unsigned long nsican_base=0x0;
 
+static can_spinlock_t nsican_port_lock=SPIN_LOCK_UNLOCKED;
+
 /* IO_RANGE is the io-memory range that gets reserved, please adjust according
  * your hardware. Example: #define IO_RANGE 0x100 for i82527 chips or
  * #define IO_RANGE 0x20 for sja1000 chips.
@@ -190,13 +192,14 @@ unsigned nsi_read_register(unsigned long address)
        We use the two register, we write the address where we 
        want to read in a first time. In a second time we read the
        data */
-    unsigned char ret;
+       unsigned char ret;
+       can_spin_irqflags_t flags;
     
-    can_disable_irq(nsican_irq); 
-    outb(address-nsican_base, nsican_base);
-    ret=inb(nsican_base+1);
-    can_enable_irq(nsican_irq); 
-    return ret;
+       can_spin_lock_irqsave(&nsican_port_lock,flags);
+       outb(address-nsican_base, nsican_base);
+       ret=inb(nsican_base+1);
+       can_spin_unlock_irqrestore(&nsican_port_lock,flags);
+       return ret;
 }
 
 
index 64e6b700a9fd55c4cc9831d4222d0fbce5c9f1ed..ebf315c82e54e685f11e984758b5b4e48d2f9c36 100644 (file)
@@ -20,6 +20,8 @@
 int pcccan_irq=-1;
 unsigned long pcccan_base=0x0;
 
+static can_spinlock_t pcccan_port_lock=SPIN_LOCK_UNLOCKED;
+
 /*
  * IO_RANGE is the io-memory range that gets reserved, please adjust according
  * your hardware. Example: #define IO_RANGE 0x100 for i82527 chips or
@@ -253,10 +255,11 @@ int pcccan_program_irq(struct candevice_t *candev)
  */
 void pcccan_write_register(unsigned char data, unsigned long address)
 {
-       can_disable_irq(pcccan_irq);
+       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_enable_irq(pcccan_irq);
+       can_spin_unlock_irqrestore(&pcccan_port_lock,flags);
 }
 
 /**
@@ -272,10 +275,11 @@ void pcccan_write_register(unsigned char data, unsigned long address)
 unsigned pcccan_read_register(unsigned long address)
 {
        unsigned ret;
-       can_disable_irq(pcccan_irq);
+       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_enable_irq(pcccan_irq);
+       can_spin_unlock_irqrestore(&pcccan_port_lock,flags);
        return ret;
 
 }
index abbbe1a663194ed7f7e841125a787b68a5392381..4d638f9fdcdc34ab6d3f2a67fae94c2fc1dfdb94 100644 (file)
@@ -16,6 +16,8 @@
 int smartcan_irq=-1;
 unsigned long smartcan_base=0x0;
 
+static can_spinlock_t smartcan_port_lock=SPIN_LOCK_UNLOCKED;
+
 int smartcan_request_io(struct candevice_t *candev)
 {
        if (!can_request_io_region(candev->io_addr,0x04,DEVICE_NAME)) {
@@ -100,19 +102,21 @@ int smartcan_init_obj_data(struct chip_t *chip, int objnr)
 
 void smartcan_write_register(unsigned char data, unsigned long address)
 {
-       can_disable_irq(smartcan_irq);
+       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_enable_irq(smartcan_irq);
+       can_spin_unlock_irqrestore(&smartcan_port_lock,flags);
 }
 
 unsigned smartcan_read_register(unsigned long address)
 {
        unsigned ret;
-       can_disable_irq(smartcan_irq);
+       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_enable_irq(smartcan_irq);
+       can_spin_unlock_irqrestore(&smartcan_port_lock,flags);
        return ret;
 }
 
index 83fbba3115fc19409fdfb61b21807e18b3825f30..802aee76450ef7c6dd4dfa2fa355338103237ffd 100644 (file)
@@ -14,6 +14,8 @@
 int ssvcan_irq[2]={-1,-1};
 unsigned long ssvcan_base=0x0;
 
+static can_spinlock_t ssv_port_lock=SPIN_LOCK_UNLOCKED;
+
 /* IO_RANGE is the io-memory range that gets reserved, please adjust according
  * your hardware. Example: #define IO_RANGE 0x100 for i82527 chips or
  * #define IO_RANGE 0x20 for sja1000 chips.
@@ -209,21 +211,22 @@ unsigned ssv_read_register(unsigned long address)
        want to read in a first time. In a second time we read the
        data */
     unsigned char ret;
+    can_spin_irqflags_t flags;
     
 
     if((address-ssvcan_base)<0x100)
     {
-       can_disable_irq(ssvcan_irq[0]);
+       can_spin_lock_irqsave(&ssv_port_lock,flags);
        outb(address-ssvcan_base, ssvcan_base);
        ret=inb(ssvcan_base+1);
-       can_enable_irq(ssvcan_irq[0]);
+       can_spin_unlock_irqrestore(&ssv_port_lock,flags);
     }
     else
     {
-       can_disable_irq(ssvcan_irq[1]);
+       can_spin_lock_irqsave(&ssv_port_lock,flags);
        outb(address-ssvcan_base-0x100, ssvcan_base+0x02);
        ret=inb(ssvcan_base+1+0x02);
-       can_enable_irq(ssvcan_irq[1]);
+       can_spin_unlock_irqrestore(&ssv_port_lock,flags);
     }
 
     return ret;