From: ppisa Date: Thu, 17 Jun 2004 17:28:24 +0000 (+0000) Subject: Changed filling of the chip specific operations. X-Git-Tag: CLT_COMM_CAN-pre_locking_udate~3 X-Git-Url: http://rtime.felk.cvut.cz/gitweb/lincan.git/commitdiff_plain/2a4663dd0b20d96d1ffe20993dd0c63ed2ca9f20 Changed filling of the chip specific operations. This enables simpler fine tuning for specific boards which needs modified functions. ENS CPC-PCI requires special interrupt handling for example. --- diff --git a/lincan/include/c_can.h b/lincan/include/c_can.h index 57a68ca..772213a 100644 --- a/lincan/include/c_can.h +++ b/lincan/include/c_can.h @@ -72,6 +72,8 @@ void c_can_irq_sync_activities(struct chip_t *chip, struct msgobj_t *obj); can_irqreturn_t c_can_irq_handler(int irq, void *dev_id, struct pt_regs *regs); +int c_can_fill_chipspecops(struct chip_t *chip); + /* BasicCAN mode address map */ #define CCCR 0x0000 /* Control Register */ #define CCSR 0x0004 /* Status Register */ diff --git a/lincan/include/constants.h b/lincan/include/constants.h index 9788c7a..d5c66d9 100644 --- a/lincan/include/constants.h +++ b/lincan/include/constants.h @@ -18,8 +18,8 @@ /* Version of the driver */ #define CAN_DRV_VER_MAJOR 0 -#define CAN_DRV_VER_MINOR 2 -#define CAN_DRV_VER_PATCH 2 +#define CAN_DRV_VER_MINOR 3 +#define CAN_DRV_VER_PATCH 0 #define CAN_DRV_VER ((CAN_DRV_VER_MAJOR<<16) | (CAN_DRV_VER_MINOR<<8) | CAN_DRV_VER_PATCH) /* Default driver major number, see /usr/src/linux/Documentation/devices.txt */ diff --git a/lincan/include/i82527.h b/lincan/include/i82527.h index cb8be71..2b98162 100644 --- a/lincan/include/i82527.h +++ b/lincan/include/i82527.h @@ -32,6 +32,8 @@ int i82527_start_chip(struct chip_t *chip); int i82527_stop_chip(struct chip_t *chip); int i82527_check_tx_stat(struct chip_t *chip); can_irqreturn_t i82527_irq_handler(int irq, void *dev_id, struct pt_regs *regs); +int i82527_fill_chipspecops(struct chip_t *chip); + #define MSG_OFFSET(object) ((object)*0x10) diff --git a/lincan/include/sja1000.h b/lincan/include/sja1000.h index bb6dd11..16dc20c 100644 --- a/lincan/include/sja1000.h +++ b/lincan/include/sja1000.h @@ -24,6 +24,7 @@ int sja1000_set_btregs(struct chip_t *chip, unsigned short btr0, int sja1000_start_chip(struct chip_t *chip); int sja1000_stop_chip(struct chip_t *chip); can_irqreturn_t sja1000_irq_handler(int irq, void *dev_id, struct pt_regs *regs); +int sja1000_fill_chipspecops(struct chip_t *chip); /* BasicCAN mode address map */ #define SJACR 0x00 /* Control register */ diff --git a/lincan/include/sja1000p.h b/lincan/include/sja1000p.h index 1d57aa8..9ec11e3 100644 --- a/lincan/include/sja1000p.h +++ b/lincan/include/sja1000p.h @@ -18,6 +18,7 @@ int sja1000p_pre_write_config(struct chip_t *chip, struct msgobj_t *obj, struct canmsg_t *msg); int sja1000p_send_msg(struct chip_t *chip, struct msgobj_t *obj, struct canmsg_t *msg); +int sja1000p_fill_chipspecops(struct chip_t *chip); /* PeliCAN mode */ enum SJA1000_PeliCAN_regs { diff --git a/lincan/src/aim104.c b/lincan/src/aim104.c index 8e0fe8f..d406f76 100644 --- a/lincan/src/aim104.c +++ b/lincan/src/aim104.c @@ -129,7 +129,6 @@ int aim104_init_hw_data(struct candevice_t *candev) return 0; } -#define CHIP_TYPE "sja1000" /** * template_init_chip_data - Initialize chips * @candev: Pointer to candevice/board structure @@ -161,7 +160,7 @@ int aim104_init_hw_data(struct candevice_t *candev) */ int aim104_init_chip_data(struct candevice_t *candev, int chipnr) { - candev->chip[chipnr]->chip_type=CHIP_TYPE; + sja1000_fill_chipspecops(candev->chip[chipnr]); candev->chip[chipnr]->chip_base_addr=candev->io_addr; candev->chip[chipnr]->clock = 16000000; candev->chip[chipnr]->flags = 0; diff --git a/lincan/src/bfadcan.c b/lincan/src/bfadcan.c index 2f65559..d91603c 100644 --- a/lincan/src/bfadcan.c +++ b/lincan/src/bfadcan.c @@ -161,7 +161,6 @@ int bfadcan_init_hw_data(struct candevice_t *candev) return 0; } -#define CHIP_TYPE "sja1000p" /** * bfadcan_init_chip_data - Initialize chips * @candev: Pointer to candevice/board structure @@ -197,7 +196,7 @@ int bfadcan_init_hw_data(struct candevice_t *candev) int bfadcan_init_chip_data(struct candevice_t *candev, int chipnr) { unsigned int id1, id2; - candev->chip[chipnr]->chip_type=CHIP_TYPE; + sja1000p_fill_chipspecops(candev->chip[chipnr]); candev->chip[chipnr]->chip_base_addr=candev->io_addr; candev->chip[chipnr]->clock = clock_freq; candev->chip[chipnr]->int_cpu_reg = iCPU_DSC; @@ -210,7 +209,7 @@ int bfadcan_init_chip_data(struct candevice_t *candev, int chipnr) id2 = inb(0xe285); - CANMSG("can driver ver lincan-0.2, at %04lx, CPLD v%d.%d.%d.%d\n", + 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); diff --git a/lincan/src/c_can.c b/lincan/src/c_can.c index d179b18..bb1ee0b 100644 --- a/lincan/src/c_can.c +++ b/lincan/src/c_can.c @@ -912,33 +912,10 @@ int c_can_register(struct chipspecops_t *chipspecops) return 0; } -/*int c_can_register(struct chip_t *pchip) +int c_can_fill_chipspecops(struct chip_t *chip) { - DEBUGMSG("(c%d)call c_can_register\n", pchip->chip_idx); - - // Validate pointer - if ( NULL == pchip ) return -1; - - pchip->chip_config = c_can_chip_config; - pchip->set_baud_rate = c_can_baud_rate; - pchip->set_mask = c_can_mask; - pchip->set_use_mask = c_can_use_mask; - //pchip->set_message15_mask = c_can_extended_mask; - pchip->clear_objects = c_can_clear_objects; - pchip->config_irqs = c_can_config_irqs; - pchip->pre_read_config = c_can_pre_read_config; - //pchip->pre_write_config = c_can_pre_write_config; - pchip->send_msg = c_can_send_msg; - pchip->check_tx_stat = c_can_check_tx_stat; - pchip->remote_request = c_can_remote_request; - pchip->enable_configuration = c_can_enable_configuration; - pchip->disable_configuration = c_can_disable_configuration; - pchip->set_btregs = c_can_set_btregs; - pchip->start_chip = c_can_start_chip; - pchip->stop_chip = c_can_stop_chip; - pchip->register_dump = c_can_registerdump; - - DEBUGMSG("-> ok\n"); - return 0; + chip->chip_type="c_can"; + chip->max_objects = 32; + c_can_register(chip->chipspecops); + return 0; } -*/ diff --git a/lincan/src/cc_can104.c b/lincan/src/cc_can104.c index 9df4b71..92a6994 100644 --- a/lincan/src/cc_can104.c +++ b/lincan/src/cc_can104.c @@ -109,7 +109,6 @@ int cc104_init_hw_data(struct candevice_t *candev) return 0; } -#define CHIP_TYPE "sja1000" /** * template_init_chip_data - Initialize chips * @candev: Pointer to candevice/board structure @@ -141,7 +140,7 @@ int cc104_init_hw_data(struct candevice_t *candev) */ int cc104_init_chip_data(struct candevice_t *candev, int chipnr) { - candev->chip[chipnr]->chip_type=CHIP_TYPE; + sja1000_fill_chipspecops(candev->chip[chipnr]); candev->chip[chipnr]->chip_base_addr=candev->io_addr; candev->chip[chipnr]->clock = 16000000; candev->chip[chipnr]->flags = 0; diff --git a/lincan/src/ems_cpcpci.c b/lincan/src/ems_cpcpci.c index 7f1bee4..0fa2897 100644 --- a/lincan/src/ems_cpcpci.c +++ b/lincan/src/ems_cpcpci.c @@ -236,13 +236,13 @@ int ems_cpcpci_init_hw_data(struct candevice_t *candev) int ems_cpcpci_init_chip_data(struct candevice_t *candev, int chipnr) { - if(candev->sysdevptr.pcidev==NULL) return -ENODEV; + sja1000p_fill_chipspecops(candev->chip[chipnr]); + candev->chip[chipnr]->chip_irq=candev->sysdevptr.pcidev->irq; - candev->chip[chipnr]->chip_type="sja1000p"; candev->chip[chipnr]->chip_base_addr = candev->io_addr+ 0x400 + chipnr*EMS_CPCPCI_BYTES_PER_CIRCUIT; candev->chip[chipnr]->flags = 0; diff --git a/lincan/src/hms30c7202_can.c b/lincan/src/hms30c7202_can.c index ee99cb6..4661c3a 100644 --- a/lincan/src/hms30c7202_can.c +++ b/lincan/src/hms30c7202_can.c @@ -294,20 +294,20 @@ int hms30c7202_init_hw_data(struct candevice_t *candev) */ int hms30c7202_init_chip_data(struct candevice_t *candev, int chipnr) { - candev->chip[chipnr]->chip_type=CHIP_TYPE; + // Register chip operations + c_can_fill_chipspecops(candev->chip[chipnr]); + /* override chip provided default value */ + candev->chip[chipnr]->max_objects = NR_MSGOBJ; + candev->chip[chipnr]->chip_base_addr=candev->io_addr; candev->chip[chipnr]->clock = 16000000; - candev->chip[chipnr]->max_objects = NR_MSGOBJ; - /*candev->chip[chipnr]->int_clk_reg = 0x0; candev->chip[chipnr]->int_bus_reg = 0x0; candev->chip[chipnr]->sja_cdr_reg = 0x0; candev->chip[chipnr]->sja_ocr_reg = 0x0;*/ - // Register chip operations - c_can_register(candev->chip[chipnr]->chipspecops); return 0; } diff --git a/lincan/src/i82527.c b/lincan/src/i82527.c index f71a16a..443124a 100644 --- a/lincan/src/i82527.c +++ b/lincan/src/i82527.c @@ -744,3 +744,11 @@ int i82527_register(struct chipspecops_t *chipspecops) chipspecops->irq_handler = i82527_irq_handler; return 0; } + +int i82527_fill_chipspecops(struct chip_t *chip) +{ + chip->chip_type="i82527"; + chip->max_objects=15; + i82527_register(chip->chipspecops); + return 0; +} diff --git a/lincan/src/kv_pcican.c b/lincan/src/kv_pcican.c index c883610..eb344b4 100644 --- a/lincan/src/kv_pcican.c +++ b/lincan/src/kv_pcican.c @@ -233,7 +233,7 @@ int kv_pcican_init_chip_data(struct candevice_t *candev, int chipnr) candev->chip[chipnr]->chip_irq=candev->sysdevptr.pcidev->irq; - candev->chip[chipnr]->chip_type="sja1000p"; + sja1000p_fill_chipspecops(candev->chip[chipnr]); candev->chip[chipnr]->chip_base_addr= candev->io_addr+chipnr*KV_PCICAN_BYTES_PER_CIRCUIT; candev->chip[chipnr]->flags = 0; diff --git a/lincan/src/m437.c b/lincan/src/m437.c index 7fd02ba..82c03eb 100644 --- a/lincan/src/m437.c +++ b/lincan/src/m437.c @@ -163,7 +163,6 @@ int m437_init_hw_data(struct candevice_t *candev) return 0; } -#define CHIP_TYPE "i82527" /** * m437_init_chip_data - Initialize chips * @candev: Pointer to candevice/board structure @@ -198,7 +197,7 @@ int m437_init_hw_data(struct candevice_t *candev) */ int m437_init_chip_data(struct candevice_t *candev, int chipnr) { - candev->chip[chipnr]->chip_type=CHIP_TYPE; + 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 | iCPU_CEN; diff --git a/lincan/src/msmcan.c b/lincan/src/msmcan.c index 573abaa..42513ad 100644 --- a/lincan/src/msmcan.c +++ b/lincan/src/msmcan.c @@ -122,11 +122,10 @@ int msmcan_init_hw_data(struct candevice_t *candev) * argument supplied at module loading time. * The clock argument holds the chip clock value in Hz. */ -#define CHIP_TYPE "i82527" int msmcan_init_chip_data(struct candevice_t *candev, int chipnr) { - candev->chip[chipnr]->chip_type=CHIP_TYPE; + i82527_fill_chipspecops(candev->chip[chipnr]); /* device uses indexed access */ candev->chip[chipnr]->chip_base_addr= candev->io_addr << 16; diff --git a/lincan/src/nsi.c b/lincan/src/nsi.c index 99f1afa..455a3dc 100644 --- a/lincan/src/nsi.c +++ b/lincan/src/nsi.c @@ -119,11 +119,10 @@ int nsi_init_hw_data(struct candevice_t *candev) * argument supplied at module loading time. * The clock argument holds the chip clock value in Hz. */ -#define CHIP_TYPE "i82527" int nsi_init_chip_data(struct candevice_t *candev, int chipnr) { - candev->chip[chipnr]->chip_type=CHIP_TYPE; + i82527_fill_chipspecops(candev->chip[chipnr]); candev->chip[chipnr]->chip_base_addr= candev->io_addr; candev->chip[chipnr]->clock = 16000000; diff --git a/lincan/src/pc_i03.c b/lincan/src/pc_i03.c index c01e548..18c9df8 100644 --- a/lincan/src/pc_i03.c +++ b/lincan/src/pc_i03.c @@ -136,7 +136,6 @@ int pci03_init_hw_data(struct candevice_t *candev) return 0; } -#define CHIP_TYPE "sja1000" /** * pci03_init_chip_data - Initialize chips * @candev: Pointer to candevice/board structure @@ -168,8 +167,8 @@ int pci03_init_hw_data(struct candevice_t *candev) */ int pci03_init_chip_data(struct candevice_t *candev, int chipnr) { + sja1000_fill_chipspecops(candev->chip[chipnr]); pci03_base_addr = candev->io_addr; - candev->chip[chipnr]->chip_type=CHIP_TYPE; candev->chip[chipnr]->chip_base_addr=candev->io_addr; candev->chip[chipnr]->clock = 16000000; candev->chip[chipnr]->sja_cdr_reg = sjaCDR_CBP | sjaCDR_CLK_OFF; diff --git a/lincan/src/pccan.c b/lincan/src/pccan.c index 7205230..4b23f9b 100644 --- a/lincan/src/pccan.c +++ b/lincan/src/pccan.c @@ -248,7 +248,7 @@ int pccan_init_chip_data(struct candevice_t *candev, int chipnr) { if (!strcmp(candev->hwname,"pccan-q")) { if (chipnr<2) { - candev->chip[chipnr]->chip_type="i82527"; + i82527_fill_chipspecops(candev->chip[chipnr]); candev->chip[chipnr]->flags = CHIP_SEGMENTED; candev->chip[chipnr]->int_cpu_reg=iCPU_DSC; candev->chip[chipnr]->int_clk_reg=iCLK_SL1; @@ -257,7 +257,7 @@ int pccan_init_chip_data(struct candevice_t *candev, int chipnr) candev->chip[chipnr]->sja_ocr_reg = 0; } else{ - candev->chip[chipnr]->chip_type="sja1000"; + sja1000_fill_chipspecops(candev->chip[chipnr]); candev->chip[chipnr]->flags = 0; candev->chip[chipnr]->int_cpu_reg = 0; candev->chip[chipnr]->int_clk_reg = 0; @@ -270,7 +270,7 @@ int pccan_init_chip_data(struct candevice_t *candev, int chipnr) candev->chip[chipnr]->chip_base_addr=0x1000*chipnr+0x2000+candev->io_addr; } else { - candev->chip[chipnr]->chip_type="sja1000"; + sja1000_fill_chipspecops(candev->chip[chipnr]); candev->chip[chipnr]->chip_base_addr=0x1000*chipnr+0x4000+candev->io_addr; candev->chip[chipnr]->flags = 0; candev->chip[chipnr]->int_cpu_reg = 0; diff --git a/lincan/src/pcccan.c b/lincan/src/pcccan.c index 8dbb485..f83b1c5 100644 --- a/lincan/src/pcccan.c +++ b/lincan/src/pcccan.c @@ -152,7 +152,6 @@ int pcccan_init_hw_data(struct candevice_t *candev) return 0; } -#define CHIP_TYPE "i82527" /** * pcccan_init_chip_data - Initialize chips * @candev: Pointer to candevice/board structure @@ -187,7 +186,7 @@ int pcccan_init_hw_data(struct candevice_t *candev) */ int pcccan_init_chip_data(struct candevice_t *candev, int chipnr) { - candev->chip[chipnr]->chip_type=CHIP_TYPE; + 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 | iCPU_DMC; diff --git a/lincan/src/pcm3680.c b/lincan/src/pcm3680.c index dc3c274..63e8556 100644 --- a/lincan/src/pcm3680.c +++ b/lincan/src/pcm3680.c @@ -140,7 +140,6 @@ int pcm3680_init_hw_data(struct candevice_t *candev) return 0; } -#define CHIP_TYPE "sja1000p" /** * template_init_chip_data - Initialize chips * @candev: Pointer to candevice/board structure @@ -172,7 +171,7 @@ int pcm3680_init_hw_data(struct candevice_t *candev) */ int pcm3680_init_chip_data(struct candevice_t *candev, int chipnr) { - candev->chip[chipnr]->chip_type=CHIP_TYPE; + sja1000p_fill_chipspecops(candev->chip[chipnr]); candev->chip[chipnr]->chip_base_addr= candev->io_addr + 0x200*chipnr; candev->chip[chipnr]->clock = 16000000; diff --git a/lincan/src/pikronisa.c b/lincan/src/pikronisa.c index db0977f..67f383f 100644 --- a/lincan/src/pikronisa.c +++ b/lincan/src/pikronisa.c @@ -144,9 +144,6 @@ int pikronisa_init_hw_data(struct candevice_t *candev) return 0; } -#define CHIP_TYPE "sja1000p" -/* #define CHIP_TYPE "sja1000" */ - /** * pikronisa_init_chip_data - Initialize chips * @candev: Pointer to candevice/board structure @@ -181,7 +178,9 @@ int pikronisa_init_hw_data(struct candevice_t *candev) */ int pikronisa_init_chip_data(struct candevice_t *candev, int chipnr) { - candev->chip[chipnr]->chip_type=CHIP_TYPE; + /*sja1000_fill_chipspecops(candev->chip[chipnr]);*/ + sja1000p_fill_chipspecops(candev->chip[chipnr]); + candev->chip[chipnr]->chip_base_addr=candev->io_addr; candev->chip[chipnr]->clock = 24000000; candev->chip[chipnr]->int_clk_reg = 0x0; diff --git a/lincan/src/pip.c b/lincan/src/pip.c index 22a8393..5ca28f8 100644 --- a/lincan/src/pip.c +++ b/lincan/src/pip.c @@ -126,7 +126,7 @@ int pip_init_hw_data(struct candevice_t *candev) int pip_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; if (!strcmp(candev->hwname,"pip5")) diff --git a/lincan/src/setup.c b/lincan/src/setup.c index c5bb40a..564b3c0 100644 --- a/lincan/src/setup.c +++ b/lincan/src/setup.c @@ -14,15 +14,10 @@ #include "../include/setup.h" #include "../include/finish.h" -extern int sja1000_register(struct chipspecops_t *chipspecops); -extern int sja1000p_register(struct chipspecops_t *chipspecops); -extern int i82527_register(struct chipspecops_t *chipspecops); - int init_hwspecops(struct candevice_t *candev, int *irqnum_p); int init_device_struct(int card, int *chan_param_idx_p, int *irq_param_idx_p); int init_chip_struct(struct candevice_t *candev, int chipnr, int irq, long baudrate); int init_obj_struct(struct candevice_t *candev, struct chip_t *hostchip, int objnr); -int init_chipspecops(struct candevice_t *candev, int chipnr); /** * can_checked_malloc - memory allocation with registering of requested blocks @@ -442,8 +437,8 @@ int init_device_struct(int card, int *chan_param_idx_p, int *irq_param_idx_p) * @baudrate: baudrate in the units of 1Bd * * Chip structure is allocated and chip specific operations are filled by - * call to board specific init_chip_data() function and generic - * init_chipspecops() function. The message objects are generated by + * call to board specific init_chip_data() which calls chip specific + * fill_chipspecops(). The message objects are generated by * calls to init_obj_struct() function. * * Return Value: returns negative number in the case of fail @@ -474,9 +469,7 @@ int init_chip_struct(struct candevice_t *candev, int chipnr, int irq, long baudr chip->baudrate=baudrate; chip->flags=0x0; - candev->hwspecops->init_chip_data(candev,chipnr); - - if (init_chipspecops(candev,chipnr)) + if(candev->hwspecops->init_chip_data(candev,chipnr)<0) return -ENODEV; for (objnr=0; objnrmax_objects; objnr++) { @@ -567,35 +560,6 @@ int init_hwspecops(struct candevice_t *candev, int *irqnum_p) } -/** - * init_chipspecops - fills chip specific operations for board for known chip types - * @candev: pointer to the corresponding CAN device/board - * @chipnr: index of the chip in the device/board structure - * - * The function fills chip specific operations for next known generic chip - * types "i82527", "sja1000", "sja1000p" (PeliCAN). Other non generic chip types - * operations has to be initialized in the board specific init_chip_data() function. - * - * Return Value: returns negative number in the case of fail - */ -int init_chipspecops(struct candevice_t *candev, int chipnr) -{ - if (!strcmp(candev->chip[chipnr]->chip_type,"i82527")) { - candev->chip[chipnr]->max_objects=15; - i82527_register(candev->chip[chipnr]->chipspecops); - } - if (!strcmp(candev->chip[chipnr]->chip_type,"sja1000")) { - candev->chip[chipnr]->max_objects=1; - sja1000_register(candev->chip[chipnr]->chipspecops); - } - if (!strcmp(candev->chip[chipnr]->chip_type,"sja1000p")) { - candev->chip[chipnr]->max_objects=1; - sja1000p_register(candev->chip[chipnr]->chipspecops); - } - - return 0; -} - #ifndef CAN_WITH_RTL /** diff --git a/lincan/src/sja1000.c b/lincan/src/sja1000.c index 6a43185..5b549c4 100644 --- a/lincan/src/sja1000.c +++ b/lincan/src/sja1000.c @@ -491,3 +491,12 @@ int sja1000_register(struct chipspecops_t *chipspecops) chipspecops->irq_handler = sja1000_irq_handler; return 0; } + +int sja1000_fill_chipspecops(struct chip_t *chip) +{ + chip->chip_type="sja1000"; + chip->max_objects=1; + sja1000_register(chip->chipspecops); + return 0; +} + diff --git a/lincan/src/sja1000p.c b/lincan/src/sja1000p.c index d59b82b..dc15154 100644 --- a/lincan/src/sja1000p.c +++ b/lincan/src/sja1000p.c @@ -738,3 +738,19 @@ int sja1000p_register(struct chipspecops_t *chipspecops) chipspecops->irq_handler=sja1000p_irq_handler; return 0; } + +/** + * sja1000p_fill_chipspecops - fills chip specific operations + * @chip: pointer to chip representation structure + * + * The function fills chip specific operations for sja1000 (PeliCAN) chip. + * + * Return Value: returns negative number in the case of fail + */ +int sja1000p_fill_chipspecops(struct chip_t *chip) +{ + chip->chip_type="sja1000p"; + chip->max_objects=1; + sja1000p_register(chip->chipspecops); + return 0; +} diff --git a/lincan/src/smartcan.c b/lincan/src/smartcan.c index 869f5a5..f9123fe 100644 --- a/lincan/src/smartcan.c +++ b/lincan/src/smartcan.c @@ -78,7 +78,7 @@ int smartcan_init_hw_data(struct candevice_t *candev) 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; diff --git a/lincan/src/ssv.c b/lincan/src/ssv.c index 145d830..7f147e1 100644 --- a/lincan/src/ssv.c +++ b/lincan/src/ssv.c @@ -133,11 +133,9 @@ int ssv_init_hw_data(struct candevice_t *candev) * argument supplied at module loading time. * The clock argument holds the chip clock value in Hz. */ -#define CHIP_TYPE "i82527" - int ssv_init_chip_data(struct candevice_t *candev, int chipnr) { - candev->chip[chipnr]->chip_type=CHIP_TYPE; + i82527_fill_chipspecops(candev->chip[chipnr]); candev->chip[chipnr]->chip_base_addr= candev->io_addr+0x100*chipnr; candev->chip[chipnr]->clock = 16000000; diff --git a/lincan/src/template.c b/lincan/src/template.c index d8ceaa4..5999366 100644 --- a/lincan/src/template.c +++ b/lincan/src/template.c @@ -114,7 +114,6 @@ int template_init_hw_data(struct candevice_t *candev) return 0; } -#define CHIP_TYPE "i82527" /** * template_init_chip_data - Initialize chips * @candev: Pointer to candevice/board structure @@ -149,7 +148,10 @@ int template_init_hw_data(struct candevice_t *candev) */ int template_init_chip_data(struct candevice_t *candev, int chipnr) { - candev->chip[chipnr]->chip_type=CHIP_TYPE; + i82527_fill_chipspecops(candev->chip[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]->clock = 16000000; candev->chip[chipnr]->int_cpu_reg = iCPU_DSC; diff --git a/lincan/src/unican.c b/lincan/src/unican.c index fde7c00..f2c7ec6 100644 --- a/lincan/src/unican.c +++ b/lincan/src/unican.c @@ -759,8 +759,6 @@ int unican_init_hw_data(struct candevice_t *candev) return 0; } -#define CHIP_TYPE "unican" - /** * unican_init_chip_data - Initialize chips * @candev: Pointer to candevice/board structure @@ -772,7 +770,7 @@ int unican_init_hw_data(struct candevice_t *candev) int unican_init_chip_data(struct candevice_t *candev, int chipnr) { struct chip_t *chip = candev->chip[chipnr]; - chip->chip_type = CHIP_TYPE; + chip->chip_type = "unican"; chip->chip_base_addr = 0; chip->clock = 10000000; chip->int_clk_reg = 0x0;