• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/src/linux/linux-2.6/arch/m68knommu/platform/5272/
1/***************************************************************************/
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
12#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);
29void coldfire_timer_init(irq_handler_t handler);
30unsigned long coldfire_timer_offset(void);
31void coldfire_trap_init(void);
32void coldfire_reset(void);
33
34extern unsigned int mcf_timervector;
35extern unsigned int mcf_profilevector;
36extern unsigned int mcf_timerlevel;
37
38/***************************************************************************/
39
40/*
41 *	Some platforms need software versions of the GPIO data registers.
42 */
43unsigned short ppdata;
44unsigned char ledbank = 0xff;
45
46/***************************************************************************/
47
48/*
49 *	DMA channel base address table.
50 */
51unsigned int   dma_base_addr[MAX_M68K_DMA_CHANNELS] = {
52        MCF_MBAR + MCFDMA_BASE0,
53};
54
55unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS];
56
57/***************************************************************************/
58
59void mcf_disableall(void)
60{
61	volatile unsigned long	*icrp;
62
63	icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
64	icrp[0] = 0x88888888;
65	icrp[1] = 0x88888888;
66	icrp[2] = 0x88888888;
67	icrp[3] = 0x88888888;
68}
69
70/***************************************************************************/
71
72void mcf_autovector(unsigned int vec)
73{
74	/* Everything is auto-vectored on the 5272 */
75}
76
77/***************************************************************************/
78
79void mcf_settimericr(int timer, int level)
80{
81	volatile unsigned long *icrp;
82
83	if ((timer >= 1 ) && (timer <= 4)) {
84		icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
85		*icrp = (0x8 | level) << ((4 - timer) * 4);
86	}
87}
88
89/***************************************************************************/
90
91int mcf_timerirqpending(int timer)
92{
93	volatile unsigned long *icrp;
94
95	if ((timer >= 1 ) && (timer <= 4)) {
96		icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
97		return (*icrp & (0x8 << ((4 - timer) * 4)));
98	}
99	return 0;
100}
101
102/***************************************************************************/
103
104void config_BSP(char *commandp, int size)
105{
106#if defined(CONFIG_MOD5272)
107	volatile unsigned char	*pivrp;
108
109	/* Set base of device vectors to be 64 */
110	pivrp = (volatile unsigned char *) (MCF_MBAR + MCFSIM_PIVR);
111	*pivrp = 0x40;
112#endif
113
114	mcf_disableall();
115
116#if defined(CONFIG_BOOTPARAM)
117	strncpy(commandp, CONFIG_BOOTPARAM_STRING, size);
118	commandp[size-1] = 0;
119#elif defined(CONFIG_NETtel) || defined(CONFIG_SCALES)
120	/* Copy command line from FLASH to local buffer... */
121	memcpy(commandp, (char *) 0xf0004000, size);
122	commandp[size-1] = 0;
123#elif defined(CONFIG_MTD_KeyTechnology)
124	/* Copy command line from FLASH to local buffer... */
125	memcpy(commandp, (char *) 0xffe06000, size);
126	commandp[size-1] = 0;
127#elif defined(CONFIG_CANCam)
128	/* Copy command line from FLASH to local buffer... */
129	memcpy(commandp, (char *) 0xf0010000, size);
130	commandp[size-1] = 0;
131#else
132	memset(commandp, 0, size);
133#endif
134
135	mcf_timervector = 69;
136	mcf_profilevector = 70;
137	mach_sched_init = coldfire_timer_init;
138	mach_tick = coldfire_tick;
139	mach_gettimeoffset = coldfire_timer_offset;
140	mach_trap_init = coldfire_trap_init;
141	mach_reset = coldfire_reset;
142}
143
144/***************************************************************************/
145