-/* c_can.c - Hynix HMS30c7202 ARM generic C_CAN module handling
- * Linux CAN-bus device driver.
- * Written by Sebastian Stolzenberg email:stolzi@sebastian-stolzenberg.de
- * Based on code from Arnaud Westenberg email:arnaud@wanadoo.nl
- * and Ake Hedman, eurosource, akhe@eurosource.se
- * 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.3 17 Jun 2004
- */
+/**************************************************************************/
+/* File: c_can.c - generic C_CAN Bosch IP core handling */
+/* The C_CAN core is found in Hynix HMS30c7202 and OKI OKI ML9620 devices */
+/* */
+/* LinCAN - (Not only) Linux CAN bus driver */
+/* Copyright (C) 2002-2009 DCE FEE CTU Prague <http://dce.felk.cvut.cz> */
+/* Copyright (C) 2002-2009 Pavel Pisa <pisa@cmp.felk.cvut.cz> */
+/* Copyright (C) 2004 Sebastian Stolzenberg <stolzi@sebastian-stolzenberg.de> */
+/* Funded by OCERA and FRESCOR IST projects */
+/* Based on CAN driver code by Arnaud Westenberg <arnaud@wanadoo.nl> */
+/* and Ake Hedman, eurosource <akhe@eurosource.se> */
+/* */
+/* LinCAN is free software; you can redistribute it and/or modify it */
+/* under terms of the GNU General Public License as published by the */
+/* Free Software Foundation; either version 2, or (at your option) any */
+/* later version. LinCAN is distributed in the hope that it will be */
+/* useful, but WITHOUT ANY WARRANTY; without even the implied warranty */
+/* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */
+/* General Public License for more details. You should have received a */
+/* copy of the GNU General Public License along with LinCAN; see file */
+/* COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, */
+/* Cambridge, MA 02139, USA. */
+/* */
+/* To allow use of LinCAN in the compact embedded systems firmware */
+/* and RT-executives (RTEMS for example), main authors agree with next */
+/* special exception: */
+/* */
+/* Including LinCAN header files in a file, instantiating LinCAN generics */
+/* or templates, or linking other files with LinCAN objects to produce */
+/* an application image/executable, does not by itself cause the */
+/* resulting application image/executable to be covered by */
+/* the GNU General Public License. */
+/* This exception does not however invalidate any other reasons */
+/* why the executable file might be covered by the GNU Public License. */
+/* Publication of enhanced or derived LinCAN files is required although. */
+/**************************************************************************/
#define __NO_VERSION__
return -1;
if (pchip->baudrate == 0)
- pchip->baudrate = 1000;
+ pchip->baudrate = 1000000;
if (c_can_baud_rate
- (pchip, pchip->baudrate * 1000, pchip->clock, 0, 75, 0)) {
+ (pchip, pchip->baudrate, pchip->clock, 0, 75, 0)) {
CANMSG("Error configuring baud rate\n");
return -ENODEV;
}
unsigned short comreg = 0;
comreg = c_can_read_reg_w(pchip, CCIF1CR);
- while ((comreg & IFXCR_BUSY) && (i <= 10)) {
- udelay(100); //100 microseconds
+ while ((comreg & IFXCR_BUSY) && (i <= 100)) {
+ udelay(1); //1 microseconds
i++;
comreg = c_can_read_reg_w(pchip, CCIF1CR);
}
unsigned short comreg = 0;
comreg = c_can_read_reg_w(pchip, CCIF2CR);
- while ((comreg & IFXCR_BUSY) && (i <= 10)) {
- udelay(100); //100 microseconds
+ while ((comreg & IFXCR_BUSY) && (i <= 100)) {
+ udelay(1); //1 microseconds
i++;
comreg = c_can_read_reg_w(pchip, CCIF2CR);
}
if (c_can_if1_busycheck(pmsgobj->hostchip))
return -ENODEV;
+ //set indication, that mask is used
+ tempreg = c_can_read_reg_w(pmsgobj->hostchip, CCIF1DMC);
+ c_can_write_reg_w(pmsgobj->hostchip, tempreg | IFXMC_UMASK,
+ CCIF1DMC);
+
//writing acceptance mask for extended or standart mode
if (can_msgobj_test_fl(pmsgobj, RX_MODE_EXT)) {
if (usedirbit)
((mask << 2) & 0x1FFC), CCIF1M2);
c_can_write_reg_w(pmsgobj->hostchip, 0, CCIF1M1);
}
+
//seting Message Valid Bit to one
tempreg = c_can_read_reg_w(pmsgobj->hostchip, CCIF1A2);
c_can_write_reg_w(pmsgobj->hostchip, tempreg | IFXARB2_MVAL, CCIF1A2);