1 /**************************************************************************/
2 /* File: mpc5200.h - Freescale MPC5200 MSCAN controller support */
4 /* LinCAN - (Not only) Linux CAN bus driver */
5 /* Copyright (C) 2002-2009 DCE FEE CTU Prague <http://dce.felk.cvut.cz> */
6 /* Copyright (C) 2002-2009 Pavel Pisa <pisa@cmp.felk.cvut.cz> */
7 /* Copyright (C) 2007-2008 Martin Petera <peterm4@fel.cvut.cz> */
8 /* Funded by OCERA and FRESCOR IST projects */
9 /* Based on CAN driver code by Arnaud Westenberg <arnaud@wanadoo.nl> */
11 /* LinCAN is free software; you can redistribute it and/or modify it */
12 /* under terms of the GNU General Public License as published by the */
13 /* Free Software Foundation; either version 2, or (at your option) any */
14 /* later version. LinCAN is distributed in the hope that it will be */
15 /* useful, but WITHOUT ANY WARRANTY; without even the implied warranty */
16 /* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */
17 /* General Public License for more details. You should have received a */
18 /* copy of the GNU General Public License along with LinCAN; see file */
19 /* COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, */
20 /* Cambridge, MA 02139, USA. */
22 /* To allow use of LinCAN in the compact embedded systems firmware */
23 /* and RT-executives (RTEMS for example), main authors agree with next */
24 /* special exception: */
26 /* Including LinCAN header files in a file, instantiating LinCAN generics */
27 /* or templates, or linking other files with LinCAN objects to produce */
28 /* an application image/executable, does not by itself cause the */
29 /* resulting application image/executable to be covered by */
30 /* the GNU General Public License. */
31 /* This exception does not however invalidate any other reasons */
32 /* why the executable file might be covered by the GNU Public License. */
33 /* Publication of enhanced or derived LinCAN files is required although. */
34 /**************************************************************************/
38 #define NR_MSCAN 2 /* this isnt used in Lincan core */
41 #define MPC5200_CAN_IRQ 17 /* IRQ 17, 18 according to shark.dts */
42 #define MPC5200_CAN_CHIP_OFFSET 0x80
47 /* Clock frequency - used for baudrate */
48 // TODO: zjistit frekvence IPB a SYS_XTAL
49 #define MPC5200_SHARK_SYS_XTAL_FREQ 32768000 /* 32768k xtal */
50 #define MPC5200_SHARK_IPB_FREQ 3300000 /* derived from XTAL by dividing */
52 /* Determine which clock source to use */
53 /* 0 - use IP Bus clock */
54 /* 1 - use SYS_XTAL_IN frequency */
55 #define MPC5200_CLKSRC 1
57 #ifndef MPC5200_CLKSRC
58 #define MPC5200_CLK_FREQ MPC5200_SHARK_SYS_XTAL_FREQ
60 #define MPC5200_CLK_FREQ MPC5200_SHARK_IPB_FREQ
65 /* static CAN_DEFINE_SPINLOCK(mpc5200_port_lock); */
67 int mpc5200_request_io(struct candevice_t *candev);
68 int mpc5200_release_io(struct candevice_t *candev);
69 int mpc5200_reset(struct candevice_t *candev);
70 int mpc5200_init_hw_data(struct candevice_t *candev);
71 int mpc5200_init_chip_data(struct candevice_t *candev, int chipnr);
72 int mpc5200_init_obj_data(struct canchip_t *chip, int objnr);
73 int mpc5200_program_irq(struct candevice_t *candev);
74 void mpc5200_write_register(unsigned data, can_ioptr_t address);
75 unsigned mpc5200_read_register(can_ioptr_t address);