blob: 4ab614f1ecdabb82b94e578ea42230e2e02c9776 [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);
Linus Torvalds1da177e2005-04-16 15:20:36 -070030void coldfire_reset(void);
31
32/***************************************************************************/
33
34/*
35 * DMA channel base address table.
36 */
37unsigned int dma_base_addr[MAX_M68K_DMA_CHANNELS] = {
38 MCF_MBAR + MCFDMA_BASE0,
39 MCF_MBAR + MCFDMA_BASE1,
40};
41
42unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS];
43
44/***************************************************************************/
45
46void mcf_autovector(unsigned int vec)
47{
48 volatile unsigned char *mbar;
49 unsigned char icr;
50
51 if ((vec >= 25) && (vec <= 31)) {
52 vec -= 25;
53 mbar = (volatile unsigned char *) MCF_MBAR;
54 icr = MCFSIM_ICR_AUTOVEC | (vec << 3);
55 *(mbar + MCFSIM_ICR1 + vec) = icr;
56 vec = 0x1 << (vec + 1);
57 mcf_setimr(mcf_getimr() & ~vec);
58 }
59}
60
61/***************************************************************************/
62
63void mcf_settimericr(unsigned int timer, unsigned int level)
64{
65 volatile unsigned char *icrp;
66 unsigned int icr, imr;
67
68 if (timer <= 2) {
69 switch (timer) {
70 case 2: icr = MCFSIM_TIMER2ICR; imr = MCFSIM_IMR_TIMER2; break;
71 default: icr = MCFSIM_TIMER1ICR; imr = MCFSIM_IMR_TIMER1; break;
72 }
73
74 icrp = (volatile unsigned char *) (MCF_MBAR + icr);
75 *icrp = MCFSIM_ICR_AUTOVEC | (level << 2) | MCFSIM_ICR_PRI3;
76 mcf_setimr(mcf_getimr() & ~imr);
77 }
78}
79
80/***************************************************************************/
81
82int mcf_timerirqpending(int timer)
83{
84 unsigned int imr = 0;
85
86 switch (timer) {
87 case 1: imr = MCFSIM_IMR_TIMER1; break;
88 case 2: imr = MCFSIM_IMR_TIMER2; break;
89 default: break;
90 }
91 return (mcf_getipr() & imr);
92}
93
94/***************************************************************************/
95
96void config_BSP(char *commandp, int size)
97{
98 mcf_setimr(MCFSIM_IMR_MASKALL);
99
Greg Ungererbc724502007-07-25 22:07:20 +1000100#if defined(CONFIG_NETtel)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101 /* Copy command line from FLASH to local buffer... */
102 memcpy(commandp, (char *) 0xf0004000, size);
103 commandp[size-1] = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700104#endif /* CONFIG_NETtel */
105
106 mach_sched_init = coldfire_timer_init;
107 mach_tick = coldfire_tick;
108 mach_gettimeoffset = coldfire_timer_offset;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700109 mach_reset = coldfire_reset;
110}
111
112/***************************************************************************/