blob: 1365a8300d5defbe39be9cc32c89b2ad0689022e [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/***************************************************************************/
2
3/*
4 * linux/arch/m68knommu/platform/5272/config.c
5 *
6 * Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com)
7 * Copyright (C) 2001-2002, SnapGear Inc. (www.snapgear.com)
8 */
9
10/***************************************************************************/
11
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#include <linux/kernel.h>
13#include <linux/sched.h>
14#include <linux/param.h>
15#include <linux/init.h>
16#include <linux/interrupt.h>
17#include <asm/irq.h>
18#include <asm/dma.h>
19#include <asm/traps.h>
20#include <asm/machdep.h>
21#include <asm/coldfire.h>
22#include <asm/mcftimer.h>
23#include <asm/mcfsim.h>
24#include <asm/mcfdma.h>
25
26/***************************************************************************/
27
28void coldfire_tick(void);
Greg Ungerereaefd5f2007-02-07 12:03:19 +100029void coldfire_timer_init(irq_handler_t handler);
Linus Torvalds1da177e2005-04-16 15:20:36 -070030unsigned long coldfire_timer_offset(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070031void coldfire_reset(void);
32
33extern unsigned int mcf_timervector;
34extern unsigned int mcf_profilevector;
35extern unsigned int mcf_timerlevel;
36
37/***************************************************************************/
38
39/*
40 * Some platforms need software versions of the GPIO data registers.
41 */
42unsigned short ppdata;
43unsigned char ledbank = 0xff;
44
45/***************************************************************************/
46
47/*
48 * DMA channel base address table.
49 */
50unsigned int dma_base_addr[MAX_M68K_DMA_CHANNELS] = {
51 MCF_MBAR + MCFDMA_BASE0,
52};
53
54unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS];
55
56/***************************************************************************/
57
58void mcf_disableall(void)
59{
60 volatile unsigned long *icrp;
61
62 icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
63 icrp[0] = 0x88888888;
64 icrp[1] = 0x88888888;
65 icrp[2] = 0x88888888;
66 icrp[3] = 0x88888888;
67}
68
69/***************************************************************************/
70
71void mcf_autovector(unsigned int vec)
72{
73 /* Everything is auto-vectored on the 5272 */
74}
75
76/***************************************************************************/
77
78void mcf_settimericr(int timer, int level)
79{
80 volatile unsigned long *icrp;
81
82 if ((timer >= 1 ) && (timer <= 4)) {
83 icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
84 *icrp = (0x8 | level) << ((4 - timer) * 4);
85 }
86}
87
88/***************************************************************************/
89
90int mcf_timerirqpending(int timer)
91{
92 volatile unsigned long *icrp;
93
94 if ((timer >= 1 ) && (timer <= 4)) {
95 icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
96 return (*icrp & (0x8 << ((4 - timer) * 4)));
97 }
98 return 0;
99}
100
101/***************************************************************************/
102
103void config_BSP(char *commandp, int size)
104{
Greg Ungerera7962662005-09-09 09:32:14 +1000105#if defined (CONFIG_MOD5272)
106 volatile unsigned char *pivrp;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107
108 /* Set base of device vectors to be 64 */
Greg Ungerera7962662005-09-09 09:32:14 +1000109 pivrp = (volatile unsigned char *) (MCF_MBAR + MCFSIM_PIVR);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700110 *pivrp = 0x40;
111#endif
112
113 mcf_disableall();
114
Greg Ungererbc724502007-07-25 22:07:20 +1000115#if defined(CONFIG_NETtel) || defined(CONFIG_SCALES)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116 /* Copy command line from FLASH to local buffer... */
117 memcpy(commandp, (char *) 0xf0004000, size);
118 commandp[size-1] = 0;
119#elif defined(CONFIG_MTD_KeyTechnology)
120 /* Copy command line from FLASH to local buffer... */
121 memcpy(commandp, (char *) 0xffe06000, size);
122 commandp[size-1] = 0;
123#elif defined(CONFIG_CANCam)
124 /* Copy command line from FLASH to local buffer... */
125 memcpy(commandp, (char *) 0xf0010000, size);
126 commandp[size-1] = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700127#endif
128
129 mcf_timervector = 69;
130 mcf_profilevector = 70;
131 mach_sched_init = coldfire_timer_init;
132 mach_tick = coldfire_tick;
133 mach_gettimeoffset = coldfire_timer_offset;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700134 mach_reset = coldfire_reset;
135}
136
137/***************************************************************************/