blob: 0f67320b4031aaea269cfc7e7004ed9ce6ef905c [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/***************************************************************************/
2
3/*
4 * linux/arch/m68knommu/platform/5206e/config.c
5 *
6 * Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com)
7 */
8
9/***************************************************************************/
10
Linus Torvalds1da177e2005-04-16 15:20:36 -070011#include <linux/kernel.h>
12#include <linux/sched.h>
13#include <linux/param.h>
14#include <linux/interrupt.h>
15#include <asm/irq.h>
16#include <asm/dma.h>
17#include <asm/traps.h>
18#include <asm/machdep.h>
19#include <asm/coldfire.h>
20#include <asm/mcftimer.h>
21#include <asm/mcfsim.h>
22#include <asm/mcfdma.h>
23#include <asm/irq.h>
24
25/***************************************************************************/
26
27void coldfire_tick(void);
Greg Ungerereaefd5f2007-02-07 12:03:19 +100028void coldfire_timer_init(irq_handler_t handler);
Linus Torvalds1da177e2005-04-16 15:20:36 -070029unsigned long coldfire_timer_offset(void);
30void coldfire_trap_init(void);
31void coldfire_reset(void);
32
33/***************************************************************************/
34
35/*
36 * DMA channel base address table.
37 */
38unsigned int dma_base_addr[MAX_M68K_DMA_CHANNELS] = {
39 MCF_MBAR + MCFDMA_BASE0,
40 MCF_MBAR + MCFDMA_BASE1,
41};
42
43unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS];
44
45/***************************************************************************/
46
47void mcf_autovector(unsigned int vec)
48{
49 volatile unsigned char *mbar;
50 unsigned char icr;
51
52 if ((vec >= 25) && (vec <= 31)) {
53 vec -= 25;
54 mbar = (volatile unsigned char *) MCF_MBAR;
55 icr = MCFSIM_ICR_AUTOVEC | (vec << 3);
56 *(mbar + MCFSIM_ICR1 + vec) = icr;
57 vec = 0x1 << (vec + 1);
58 mcf_setimr(mcf_getimr() & ~vec);
59 }
60}
61
62/***************************************************************************/
63
64void mcf_settimericr(unsigned int timer, unsigned int level)
65{
66 volatile unsigned char *icrp;
67 unsigned int icr, imr;
68
69 if (timer <= 2) {
70 switch (timer) {
71 case 2: icr = MCFSIM_TIMER2ICR; imr = MCFSIM_IMR_TIMER2; break;
72 default: icr = MCFSIM_TIMER1ICR; imr = MCFSIM_IMR_TIMER1; break;
73 }
74
75 icrp = (volatile unsigned char *) (MCF_MBAR + icr);
76 *icrp = MCFSIM_ICR_AUTOVEC | (level << 2) | MCFSIM_ICR_PRI3;
77 mcf_setimr(mcf_getimr() & ~imr);
78 }
79}
80
81/***************************************************************************/
82
83int mcf_timerirqpending(int timer)
84{
85 unsigned int imr = 0;
86
87 switch (timer) {
88 case 1: imr = MCFSIM_IMR_TIMER1; break;
89 case 2: imr = MCFSIM_IMR_TIMER2; break;
90 default: break;
91 }
92 return (mcf_getipr() & imr);
93}
94
95/***************************************************************************/
96
97void config_BSP(char *commandp, int size)
98{
99 mcf_setimr(MCFSIM_IMR_MASKALL);
100
101#if defined(CONFIG_BOOTPARAM)
102 strncpy(commandp, CONFIG_BOOTPARAM_STRING, size);
103 commandp[size-1] = 0;
104#elif defined(CONFIG_NETtel)
105 /* Copy command line from FLASH to local buffer... */
106 memcpy(commandp, (char *) 0xf0004000, size);
107 commandp[size-1] = 0;
108#else
109 memset(commandp, 0, size);
110#endif /* CONFIG_NETtel */
111
112 mach_sched_init = coldfire_timer_init;
113 mach_tick = coldfire_tick;
114 mach_gettimeoffset = coldfire_timer_offset;
115 mach_trap_init = coldfire_trap_init;
116 mach_reset = coldfire_reset;
117}
118
119/***************************************************************************/