ACPI: video: DMI workaround broken eMachines E510 BIOS enabling display brightness
[linux-2.6/linux-acpi-2.6.git] / arch / m68knommu / platform / 523x / config.c
blob74133f27b30c4ce290fc4a9d21da49afc541fb9d
1 /***************************************************************************/
3 /*
4 * linux/arch/m68knommu/platform/523x/config.c
6 * Sub-architcture dependant initialization code for the Freescale
7 * 523x CPUs.
9 * Copyright (C) 1999-2005, Greg Ungerer (gerg@snapgear.com)
10 * Copyright (C) 2001-2003, SnapGear Inc. (www.snapgear.com)
13 /***************************************************************************/
15 #include <linux/kernel.h>
16 #include <linux/param.h>
17 #include <linux/init.h>
18 #include <linux/interrupt.h>
19 #include <linux/io.h>
20 #include <asm/machdep.h>
21 #include <asm/coldfire.h>
22 #include <asm/mcfsim.h>
23 #include <asm/mcfuart.h>
25 /***************************************************************************/
27 void coldfire_reset(void);
29 /***************************************************************************/
31 static struct mcf_platform_uart m523x_uart_platform[] = {
33 .mapbase = MCF_MBAR + MCFUART_BASE1,
34 .irq = MCFINT_VECBASE + MCFINT_UART0,
37 .mapbase = MCF_MBAR + MCFUART_BASE2,
38 .irq = MCFINT_VECBASE + MCFINT_UART0 + 1,
41 .mapbase = MCF_MBAR + MCFUART_BASE3,
42 .irq = MCFINT_VECBASE + MCFINT_UART0 + 2,
44 { },
47 static struct platform_device m523x_uart = {
48 .name = "mcfuart",
49 .id = 0,
50 .dev.platform_data = m523x_uart_platform,
53 static struct resource m523x_fec_resources[] = {
55 .start = MCF_MBAR + 0x1000,
56 .end = MCF_MBAR + 0x1000 + 0x7ff,
57 .flags = IORESOURCE_MEM,
60 .start = 64 + 23,
61 .end = 64 + 23,
62 .flags = IORESOURCE_IRQ,
65 .start = 64 + 27,
66 .end = 64 + 27,
67 .flags = IORESOURCE_IRQ,
70 .start = 64 + 29,
71 .end = 64 + 29,
72 .flags = IORESOURCE_IRQ,
76 static struct platform_device m523x_fec = {
77 .name = "fec",
78 .id = 0,
79 .num_resources = ARRAY_SIZE(m523x_fec_resources),
80 .resource = m523x_fec_resources,
83 static struct platform_device *m523x_devices[] __initdata = {
84 &m523x_uart,
85 &m523x_fec,
88 /***************************************************************************/
90 #define INTC0 (MCF_MBAR + MCFICM_INTC0)
92 static void __init m523x_uart_init_line(int line, int irq)
94 u32 imr;
96 if ((line < 0) || (line > 2))
97 return;
99 writeb(0x30+line, (INTC0 + MCFINTC_ICR0 + MCFINT_UART0 + line));
101 imr = readl(INTC0 + MCFINTC_IMRL);
102 imr &= ~((1 << (irq - MCFINT_VECBASE)) | 1);
103 writel(imr, INTC0 + MCFINTC_IMRL);
106 static void __init m523x_uarts_init(void)
108 const int nrlines = ARRAY_SIZE(m523x_uart_platform);
109 int line;
111 for (line = 0; (line < nrlines); line++)
112 m523x_uart_init_line(line, m523x_uart_platform[line].irq);
115 /***************************************************************************/
117 static void __init m523x_fec_init(void)
119 u32 imr;
121 /* Unmask FEC interrupts at ColdFire interrupt controller */
122 writeb(0x28, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_ICR0 + 23);
123 writeb(0x27, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_ICR0 + 27);
124 writeb(0x26, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_ICR0 + 29);
126 imr = readl(MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRH);
127 imr &= ~0xf;
128 writel(imr, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRH);
129 imr = readl(MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRL);
130 imr &= ~0xff800001;
131 writel(imr, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRL);
134 /***************************************************************************/
136 void mcf_disableall(void)
138 *((volatile unsigned long *) (MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRH)) = 0xffffffff;
139 *((volatile unsigned long *) (MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRL)) = 0xffffffff;
142 /***************************************************************************/
144 void mcf_autovector(unsigned int vec)
146 /* Everything is auto-vectored on the 523x */
149 /***************************************************************************/
151 void __init config_BSP(char *commandp, int size)
153 mcf_disableall();
154 mach_reset = coldfire_reset;
155 m523x_uarts_init();
156 m523x_fec_init();
159 /***************************************************************************/
161 static int __init init_BSP(void)
163 platform_add_devices(m523x_devices, ARRAY_SIZE(m523x_devices));
164 return 0;
167 arch_initcall(init_BSP);
169 /***************************************************************************/