1 /***************************************************************************/
4 * linux/arch/m68knommu/platform/520x/config.c
6 * Copyright (C) 2005, Freescale (www.freescale.com)
7 * Copyright (C) 2005, Intec Automation (mike@steroidmicros.com)
8 * Copyright (C) 1999-2007, Greg Ungerer (gerg@snapgear.com)
9 * Copyright (C) 2001-2003, SnapGear Inc. (www.snapgear.com)
12 /***************************************************************************/
14 #include <linux/kernel.h>
15 #include <linux/param.h>
16 #include <linux/init.h>
18 #include <asm/machdep.h>
19 #include <asm/coldfire.h>
20 #include <asm/mcfsim.h>
21 #include <asm/mcfuart.h>
23 /***************************************************************************/
25 static struct mcf_platform_uart m520x_uart_platform
[] = {
27 .mapbase
= MCF_MBAR
+ MCFUART_BASE1
,
28 .irq
= MCFINT_VECBASE
+ MCFINT_UART0
,
31 .mapbase
= MCF_MBAR
+ MCFUART_BASE2
,
32 .irq
= MCFINT_VECBASE
+ MCFINT_UART1
,
35 .mapbase
= MCF_MBAR
+ MCFUART_BASE3
,
36 .irq
= MCFINT_VECBASE
+ MCFINT_UART2
,
41 static struct platform_device m520x_uart
= {
44 .dev
.platform_data
= m520x_uart_platform
,
47 static struct resource m520x_fec_resources
[] = {
49 .start
= MCF_MBAR
+ 0x30000,
50 .end
= MCF_MBAR
+ 0x30000 + 0x7ff,
51 .flags
= IORESOURCE_MEM
,
56 .flags
= IORESOURCE_IRQ
,
61 .flags
= IORESOURCE_IRQ
,
66 .flags
= IORESOURCE_IRQ
,
70 static struct platform_device m520x_fec
= {
73 .num_resources
= ARRAY_SIZE(m520x_fec_resources
),
74 .resource
= m520x_fec_resources
,
77 static struct platform_device
*m520x_devices
[] __initdata
= {
82 /***************************************************************************/
84 #define INTC0 (MCF_MBAR + MCFICM_INTC0)
86 static void __init
m520x_uart_init_line(int line
, int irq
)
92 writeb(0x03, INTC0
+ MCFINTC_ICR0
+ MCFINT_UART0
+ line
);
94 imr
= readl(INTC0
+ MCFINTC_IMRL
);
95 imr
&= ~((1 << (irq
- MCFINT_VECBASE
)) | 1);
96 writel(imr
, INTC0
+ MCFINTC_IMRL
);
100 par
= readw(MCF_IPSBAR
+ MCF_GPIO_PAR_UART
);
101 par
|= MCF_GPIO_PAR_UART_PAR_UTXD0
|
102 MCF_GPIO_PAR_UART_PAR_URXD0
;
103 writew(par
, MCF_IPSBAR
+ MCF_GPIO_PAR_UART
);
106 par
= readw(MCF_IPSBAR
+ MCF_GPIO_PAR_UART
);
107 par
|= MCF_GPIO_PAR_UART_PAR_UTXD1
|
108 MCF_GPIO_PAR_UART_PAR_URXD1
;
109 writew(par
, MCF_IPSBAR
+ MCF_GPIO_PAR_UART
);
112 par2
= readb(MCF_IPSBAR
+ MCF_GPIO_PAR_FECI2C
);
114 par2
|= MCF_GPIO_PAR_FECI2C_PAR_SCL_UTXD2
|
115 MCF_GPIO_PAR_FECI2C_PAR_SDA_URXD2
;
116 writeb(par2
, MCF_IPSBAR
+ MCF_GPIO_PAR_FECI2C
);
121 static void __init
m520x_uarts_init(void)
123 const int nrlines
= ARRAY_SIZE(m520x_uart_platform
);
126 for (line
= 0; (line
< nrlines
); line
++)
127 m520x_uart_init_line(line
, m520x_uart_platform
[line
].irq
);
130 /***************************************************************************/
132 static void __init
m520x_fec_init(void)
137 /* Unmask FEC interrupts at ColdFire interrupt controller */
138 writeb(0x4, MCF_IPSBAR
+ MCFICM_INTC0
+ MCFINTC_ICR0
+ 36);
139 writeb(0x4, MCF_IPSBAR
+ MCFICM_INTC0
+ MCFINTC_ICR0
+ 40);
140 writeb(0x4, MCF_IPSBAR
+ MCFICM_INTC0
+ MCFINTC_ICR0
+ 42);
142 imr
= readl(MCF_IPSBAR
+ MCFICM_INTC0
+ MCFINTC_IMRH
);
144 writel(imr
, MCF_IPSBAR
+ MCFICM_INTC0
+ MCFINTC_IMRH
);
146 /* Set multi-function pins to ethernet mode */
147 v
= readb(MCF_IPSBAR
+ MCF_GPIO_PAR_FEC
);
148 writeb(v
| 0xf0, MCF_IPSBAR
+ MCF_GPIO_PAR_FEC
);
150 v
= readb(MCF_IPSBAR
+ MCF_GPIO_PAR_FECI2C
);
151 writeb(v
| 0x0f, MCF_IPSBAR
+ MCF_GPIO_PAR_FECI2C
);
154 /***************************************************************************/
157 * Program the vector to be an auto-vectored.
160 void mcf_autovector(unsigned int vec
)
162 /* Everything is auto-vectored on the 520x devices */
165 /***************************************************************************/
167 static void m520x_cpu_reset(void)
170 __raw_writeb(MCF_RCR_SWRESET
, MCF_RCR
);
173 /***************************************************************************/
175 void __init
config_BSP(char *commandp
, int size
)
177 mach_reset
= m520x_cpu_reset
;
182 /***************************************************************************/
184 static int __init
init_BSP(void)
186 platform_add_devices(m520x_devices
, ARRAY_SIZE(m520x_devices
));
190 arch_initcall(init_BSP
);
192 /***************************************************************************/