* Rewritten for new CAN queues by Pavel Pisa - OCERA team member
* email:pisa@cmp.felk.cvut.cz
* This software is released under the GPL-License.
- * Version lincan-0.2 9 Jul 2003
+ * Version lincan-0.3 17 Jun 2004
*/
-#include <linux/autoconf.h>
-
-#include <linux/ioport.h>
-#include <linux/delay.h>
-#include <linux/sched.h>
-#include <asm/errno.h>
-#include <asm/io.h>
-#include <asm/irq.h>
-
+#include "../include/can.h"
+#include "../include/can_sysdep.h"
#include "../include/main.h"
#include "../include/smartcan.h"
#include "../include/i82527.h"
int smartcan_irq=-1;
unsigned long smartcan_base=0x0;
+static CAN_DEFINE_SPINLOCK(smartcan_port_lock);
+
int smartcan_request_io(struct candevice_t *candev)
{
if (!can_request_io_region(candev->io_addr,0x04,DEVICE_NAME)) {
int smartcan_init_chip_data(struct candevice_t *candev, int chipnr)
{
- candev->chip[chipnr]->chip_type="i82527";
+ i82527_fill_chipspecops(candev->chip[chipnr]);
candev->chip[chipnr]->chip_base_addr=candev->io_addr;
candev->chip[chipnr]->clock = 16000000;
candev->chip[chipnr]->int_cpu_reg = iCPU_DSC;
return 0;
}
-int smartcan_init_obj_data(struct chip_t *chip, int objnr)
+int smartcan_init_obj_data(struct canchip_t *chip, int objnr)
{
chip->msgobj[objnr]->obj_base_addr=(objnr+1)*0x10;
- chip->msgobj[objnr]->flags=0;
return 0;
}
-void smartcan_write_register(unsigned char data, unsigned long address)
+void smartcan_write_register(unsigned data, unsigned long address)
{
- 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);
- enable_irq(smartcan_irq);
+ can_spin_unlock_irqrestore(&smartcan_port_lock,flags);
}
unsigned smartcan_read_register(unsigned long address)
{
unsigned ret;
- 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);
- enable_irq(smartcan_irq);
+ can_spin_unlock_irqrestore(&smartcan_port_lock,flags);
return ret;
}