]> rtime.felk.cvut.cz Git - lincan.git/blobdiff - lincan/include/mpc5200.h
Initial MPC5200 support contribution
[lincan.git] / lincan / include / mpc5200.h
diff --git a/lincan/include/mpc5200.h b/lincan/include/mpc5200.h
new file mode 100644 (file)
index 0000000..d63ffbd
--- /dev/null
@@ -0,0 +1,76 @@
+/**************************************************************************/
+/* File: mpc5200.h - Freescale MPC5200 MSCAN controller support           */
+/*                                                                        */
+/* 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.  */
+/**************************************************************************/
+
+#define NR_82527       0
+#define NR_SJA1000     0
+#define NR_MSCAN       2                               /* this isnt used in Lincan core */
+#define NR_ALL         2
+
+#define MPC5200_CAN_IRQ                17              /* IRQ 17, 18 according to shark.dts */
+#define MPC5200_CAN_CHIP_OFFSET                0x80
+
+#define IO_RANGE                       0x80
+
+
+/* Clock frequency - used for baudrate */
+// TODO: zjistit frekvence IPB a SYS_XTAL
+#define MPC5200_SHARK_SYS_XTAL_FREQ    32768000        /* 32768k xtal */
+#define MPC5200_SHARK_IPB_FREQ         3300000         /* derived from XTAL by dividing */
+
+/* Determine which clock source to use */
+/* 0 - use IP Bus clock                */
+/* 1 - use SYS_XTAL_IN frequency       */
+#define MPC5200_CLKSRC         1               
+
+#ifndef MPC5200_CLKSRC
+       #define MPC5200_CLK_FREQ        MPC5200_SHARK_SYS_XTAL_FREQ
+#else
+       #define MPC5200_CLK_FREQ        MPC5200_SHARK_IPB_FREQ
+#endif
+
+
+
+/* static CAN_DEFINE_SPINLOCK(mpc5200_port_lock); */
+
+int mpc5200_request_io(struct candevice_t *candev);
+int mpc5200_release_io(struct candevice_t *candev);
+int mpc5200_reset(struct candevice_t *candev); 
+int mpc5200_init_hw_data(struct candevice_t *candev);
+int mpc5200_init_chip_data(struct candevice_t *candev, int chipnr);
+int mpc5200_init_obj_data(struct canchip_t *chip, int objnr);
+int mpc5200_program_irq(struct candevice_t *candev);
+void mpc5200_write_register(unsigned data, can_ioptr_t address);
+unsigned mpc5200_read_register(can_ioptr_t address);
+