]> rtime.felk.cvut.cz Git - lincan.git/commitdiff
Added distinguish mechanism between full MPC5200 (used on RYU board) and original...
authorMartin Petera <martin.petera@gmail.com>
Tue, 5 Jan 2010 18:00:07 +0000 (19:00 +0100)
committerMartin Petera <martin.petera@gmail.com>
Tue, 5 Jan 2010 18:00:07 +0000 (19:00 +0100)
lincan/include/mpc5200.h
lincan/src/Makefile.omk
lincan/src/boardlist.c
lincan/src/mpc5200.c
lincan/src/mpc5200_midam.c [new file with mode: 0644]

index 79dbc300d7e3cc204c090d5562c26c751422de46..23e5a86e305875b82ead6dd2f6b97948737cce25 100644 (file)
@@ -36,9 +36,6 @@
 #ifndef LINCAN_MPC5200_H
 #define LINCAN_MPC5200_H
 
-/* Change this to distinguish between original MIDAM board and CTU daughterboard aka RYU */
-#define MSCAN_MIDAM    2
-
 
 /* MPC5200 has two CAN controlers
  * however MIDAM board uses only one controler
 #ifdef MSCAN_MIDAM
        #define NR_MSCAN        1
 #else
-       #ifdef MSCAN_RYU
-               #define NR_MSCAN        2
-       #else
-               #define NR_MSCAN        0
-       #endif /* MSCAN_RYU */
+       #define NR_MSCAN        2
 #endif /* MSCAN_MIDAM */
 
 
index 9fc24b3dea9d43481f1e3c1e96bb2d867f94e955..db54582bae5c3046ccefc6ed6e50d52551ae5487 100644 (file)
@@ -2,7 +2,7 @@ lincan_cards_NAMES = pip pccan smartcan nsi cc_can104 ems_cpcpci \
                pc_i03 pcm3680 aim104 m437 pcccan ssv bfadcan gensja1000io gensja1000mm eb8245 \
                kv_pcican msmcan oscar adlink7841 pcan_pci esdpci200 unican virtual template
 
-lincan_morecards_NAMES = esdpci266 hms30c7202_can ns_dev_can ipci165 pimx1 tscan1 ts7kv nsi_canpci sh7760 mpc5200
+lincan_morecards_NAMES = esdpci266 hms30c7202_can ns_dev_can ipci165 pimx1 tscan1 ts7kv nsi_canpci sh7760 mpc5200 mpc5200_midam
 
 default_CONFIG = CONFIG_OC_LINCAN=y CONFIG_OC_LINCANRTL=n CONFIG_OC_LINCANVME=n
 default_CONFIG += CONFIG_OC_LINCAN_PORTIO_ONLY=n CONFIG_OC_LINCAN_MEMIO_ONLY=n
@@ -42,8 +42,14 @@ $(warning Not finished C_CAN support requested)
 lincan_cards_SOURCES += c_can.c c_can_irq.c
 endif
 
+# both cannot be selected, full MPC5200 has precedence
 ifeq ($(CONFIG_OC_LINCAN_CARD_mpc5200),y)
 lincan_cards_SOURCES += mscan.c
+else
+ifeq ($(CONFIG_OC_LINCAN_CARD_mpc5200_midam),y)
+lincan_cards_SOURCES += mscan.c
+linux_INCLUDES += -DMSCAN_MIDAM
+endif
 endif
 
 ifneq ($(CONFIG_OC_LINCANRTL),y)
index be1f8ad5488a53a68418c3d1fc3bb07acc98523d..a52f2d4e3edad19c9be5fb0d3cdb494a6d362e59 100644 (file)
@@ -1,5 +1,5 @@
 /**************************************************************************/
-/* File: boardslist.c - list to translate hardware option to board struct*/
+/* File: boardslist.c - list to translate hardware option to board struct */
 /*                                                                        */
 /* LinCAN - (Not only) Linux CAN bus driver                               */
 /* Copyright (C) 2002-2009 DCE FEE CTU Prague <http://dce.felk.cvut.cz>   */
@@ -204,7 +204,11 @@ const struct boardtype_t can_boardtypes[]={
        {"usbcan", usbcan_register, 0},
     #endif
     #if defined(CONFIG_OC_LINCAN_CARD_mpc5200)
-       {"mpc5200", mpc5200_register, 2},
+       {"mpc5200", mpc5200_register, 0},
+    #else
+        #if defined(CONFIG_OC_LINCAN_CARD_mpc5200_midam)
+           {"mpc5200", mpc5200_register, 0},
+        #endif
     #endif
        {NULL}
 };
index 2e159cc1ae89f6ddc87758f5dce987a61ad32fe2..9371eca369e33ca39a706f76323ada5c20b059c4 100644 (file)
@@ -106,6 +106,8 @@ int mpc5200_release_io(struct candevice_t *candev)
        /* free all chips memorey space - using internal address storage */
        for (i = 0; i < candev->nr_all_chips; i++)
                iounmap((void*)chips_addr[i]);
+
+       kfree(chips_addr);
        
        return 0;
 }
diff --git a/lincan/src/mpc5200_midam.c b/lincan/src/mpc5200_midam.c
new file mode 100644 (file)
index 0000000..f1d9d48
--- /dev/null
@@ -0,0 +1,37 @@
+/**************************************************************************/
+/* File: mpc5200-midam.c - Freescale MPC5200 MSCAN controller support,    */
+/*                         fake file for MIDAM board                      */
+/*                                                                        */
+/* 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) 2007-2008 Martin Petera <peterm4@fel.cvut.cz>            */
+/* Funded by OCERA and FRESCOR IST projects                               */
+/* Based on CAN driver code by Arnaud Westenberg <arnaud@wanadoo.nl>      */
+/*                                                                        */
+/* 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.  */
+/**************************************************************************/
+
+#include "mpc5200.c"