1 /***************************************************************************/
4 * linux/arch/m68knommu/platform/5272/config.c
6 * Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com)
7 * Copyright (C) 2001-2002, SnapGear Inc. (www.snapgear.com)
10 /***************************************************************************/
12 #include <linux/kernel.h>
13 #include <linux/param.h>
14 #include <linux/init.h>
16 #include <asm/machdep.h>
17 #include <asm/coldfire.h>
18 #include <asm/mcfsim.h>
19 #include <asm/mcfuart.h>
21 /***************************************************************************/
24 * Some platforms need software versions of the GPIO data registers.
26 unsigned short ppdata
;
27 unsigned char ledbank
= 0xff;
29 /***************************************************************************/
31 static struct mcf_platform_uart m5272_uart_platform
[] = {
33 .mapbase
= MCF_MBAR
+ MCFUART_BASE1
,
37 .mapbase
= MCF_MBAR
+ MCFUART_BASE2
,
43 static struct platform_device m5272_uart
= {
46 .dev
.platform_data
= m5272_uart_platform
,
49 static struct resource m5272_fec_resources
[] = {
51 .start
= MCF_MBAR
+ 0x840,
52 .end
= MCF_MBAR
+ 0x840 + 0x1cf,
53 .flags
= IORESOURCE_MEM
,
58 .flags
= IORESOURCE_IRQ
,
63 .flags
= IORESOURCE_IRQ
,
66 .start
= MCF_IRQ_ENTC
,
68 .flags
= IORESOURCE_IRQ
,
72 static struct platform_device m5272_fec
= {
75 .num_resources
= ARRAY_SIZE(m5272_fec_resources
),
76 .resource
= m5272_fec_resources
,
79 static struct platform_device
*m5272_devices
[] __initdata
= {
84 /***************************************************************************/
86 static void __init
m5272_uart_init_line(int line
, int irq
)
90 if ((line
>= 0) && (line
< 2)) {
91 /* Enable the output lines for the serial ports */
92 v
= readl(MCF_MBAR
+ MCFSIM_PBCNT
);
93 v
= (v
& ~0x000000ff) | 0x00000055;
94 writel(v
, MCF_MBAR
+ MCFSIM_PBCNT
);
96 v
= readl(MCF_MBAR
+ MCFSIM_PDCNT
);
97 v
= (v
& ~0x000003fc) | 0x000002a8;
98 writel(v
, MCF_MBAR
+ MCFSIM_PDCNT
);
102 static void __init
m5272_uarts_init(void)
104 const int nrlines
= ARRAY_SIZE(m5272_uart_platform
);
107 for (line
= 0; (line
< nrlines
); line
++)
108 m5272_uart_init_line(line
, m5272_uart_platform
[line
].irq
);
111 /***************************************************************************/
113 static void m5272_cpu_reset(void)
116 /* Set watchdog to reset, and enabled */
117 __raw_writew(0, MCF_MBAR
+ MCFSIM_WIRR
);
118 __raw_writew(1, MCF_MBAR
+ MCFSIM_WRRR
);
119 __raw_writew(0, MCF_MBAR
+ MCFSIM_WCR
);
121 /* wait for watchdog to timeout */;
124 /***************************************************************************/
126 void __init
config_BSP(char *commandp
, int size
)
128 #if defined (CONFIG_MOD5272)
129 volatile unsigned char *pivrp
;
131 /* Set base of device vectors to be 64 */
132 pivrp
= (volatile unsigned char *) (MCF_MBAR
+ MCFSIM_PIVR
);
136 #if defined(CONFIG_NETtel) || defined(CONFIG_SCALES)
137 /* Copy command line from FLASH to local buffer... */
138 memcpy(commandp
, (char *) 0xf0004000, size
);
139 commandp
[size
-1] = 0;
140 #elif defined(CONFIG_CANCam)
141 /* Copy command line from FLASH to local buffer... */
142 memcpy(commandp
, (char *) 0xf0010000, size
);
143 commandp
[size
-1] = 0;
146 mach_reset
= m5272_cpu_reset
;
149 /***************************************************************************/
151 static int __init
init_BSP(void)
154 platform_add_devices(m5272_devices
, ARRAY_SIZE(m5272_devices
));
158 arch_initcall(init_BSP
);
160 /***************************************************************************/