1 /***************************************************************************/
4 * linux/arch/m68knommu/platform/528x/config.c
6 * Sub-architcture dependant initialization code for the Freescale
7 * 5280, 5281 and 5282 CPUs.
9 * Copyright (C) 1999-2003, 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/platform_device.h>
20 #include <asm/machdep.h>
21 #include <asm/coldfire.h>
22 #include <asm/mcfsim.h>
23 #include <asm/mcfuart.h>
25 /***************************************************************************/
27 static struct mcf_platform_uart m528x_uart_platform
[] = {
29 .mapbase
= MCF_MBAR
+ MCFUART_BASE1
,
30 .irq
= MCFINT_VECBASE
+ MCFINT_UART0
,
33 .mapbase
= MCF_MBAR
+ MCFUART_BASE2
,
34 .irq
= MCFINT_VECBASE
+ MCFINT_UART0
+ 1,
37 .mapbase
= MCF_MBAR
+ MCFUART_BASE3
,
38 .irq
= MCFINT_VECBASE
+ MCFINT_UART0
+ 2,
43 static struct platform_device m528x_uart
= {
46 .dev
.platform_data
= m528x_uart_platform
,
49 static struct resource m528x_fec_resources
[] = {
51 .start
= MCF_MBAR
+ 0x1000,
52 .end
= MCF_MBAR
+ 0x1000 + 0x7ff,
53 .flags
= IORESOURCE_MEM
,
58 .flags
= IORESOURCE_IRQ
,
63 .flags
= IORESOURCE_IRQ
,
68 .flags
= IORESOURCE_IRQ
,
72 static struct platform_device m528x_fec
= {
75 .num_resources
= ARRAY_SIZE(m528x_fec_resources
),
76 .resource
= m528x_fec_resources
,
80 static struct platform_device
*m528x_devices
[] __initdata
= {
85 /***************************************************************************/
87 static void __init
m528x_uart_init_line(int line
, int irq
)
91 if ((line
< 0) || (line
> 2))
94 /* make sure PUAPAR is set for UART0 and UART1 */
96 port
= readb(MCF_MBAR
+ MCF5282_GPIO_PUAPAR
);
97 port
|= (0x03 << (line
* 2));
98 writeb(port
, MCF_MBAR
+ MCF5282_GPIO_PUAPAR
);
102 static void __init
m528x_uarts_init(void)
104 const int nrlines
= ARRAY_SIZE(m528x_uart_platform
);
107 for (line
= 0; (line
< nrlines
); line
++)
108 m528x_uart_init_line(line
, m528x_uart_platform
[line
].irq
);
111 /***************************************************************************/
113 static void __init
m528x_fec_init(void)
117 /* Set multi-function pins to ethernet mode for fec0 */
118 v16
= readw(MCF_IPSBAR
+ 0x100056);
119 writew(v16
| 0xf00, MCF_IPSBAR
+ 0x100056);
120 writeb(0xc0, MCF_IPSBAR
+ 0x100058);
123 /***************************************************************************/
125 static void m528x_cpu_reset(void)
128 __raw_writeb(MCF_RCR_SWRESET
, MCF_IPSBAR
+ MCF_RCR
);
131 /***************************************************************************/
133 #ifdef CONFIG_WILDFIRE
134 void wildfire_halt(void)
136 writeb(0, 0x30000007);
137 writeb(0x2, 0x30000007);
141 #ifdef CONFIG_WILDFIREMOD
142 void wildfiremod_halt(void)
144 printk(KERN_INFO
"WildFireMod hibernating...\n");
146 /* Set portE.5 to Digital IO */
147 MCF5282_GPIO_PEPAR
&= ~(1 << (5 * 2));
149 /* Make portE.5 an output */
150 MCF5282_GPIO_DDRE
|= (1 << 5);
152 /* Now toggle portE.5 from low to high */
153 MCF5282_GPIO_PORTE
&= ~(1 << 5);
154 MCF5282_GPIO_PORTE
|= (1 << 5);
156 printk(KERN_EMERG
"Failed to hibernate. Halting!\n");
160 void __init
config_BSP(char *commandp
, int size
)
162 #ifdef CONFIG_WILDFIRE
163 mach_halt
= wildfire_halt
;
165 #ifdef CONFIG_WILDFIREMOD
166 mach_halt
= wildfiremod_halt
;
170 /***************************************************************************/
172 static int __init
init_BSP(void)
174 mach_reset
= m528x_cpu_reset
;
177 platform_add_devices(m528x_devices
, ARRAY_SIZE(m528x_devices
));
181 arch_initcall(init_BSP
);
183 /***************************************************************************/