Linus 2.6.34
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / arch / m68knommu / platform / 523x / config.c
CommitLineData
b5aaf3f7
GU
1/***************************************************************************/
2
3/*
4 * linux/arch/m68knommu/platform/523x/config.c
5 *
6 * Sub-architcture dependant initialization code for the Freescale
7 * 523x CPUs.
8 *
9 * Copyright (C) 1999-2005, Greg Ungerer (gerg@snapgear.com)
10 * Copyright (C) 2001-2003, SnapGear Inc. (www.snapgear.com)
11 */
12
13/***************************************************************************/
14
b5aaf3f7 15#include <linux/kernel.h>
b5aaf3f7
GU
16#include <linux/param.h>
17#include <linux/init.h>
4b61a353 18#include <linux/io.h>
b5aaf3f7
GU
19#include <asm/machdep.h>
20#include <asm/coldfire.h>
21#include <asm/mcfsim.h>
4b61a353 22#include <asm/mcfuart.h>
b5aaf3f7
GU
23
24/***************************************************************************/
25
4b61a353
GU
26static struct mcf_platform_uart m523x_uart_platform[] = {
27 {
28 .mapbase = MCF_MBAR + MCFUART_BASE1,
29 .irq = MCFINT_VECBASE + MCFINT_UART0,
30 },
31 {
32 .mapbase = MCF_MBAR + MCFUART_BASE2,
33 .irq = MCFINT_VECBASE + MCFINT_UART0 + 1,
34 },
35 {
36 .mapbase = MCF_MBAR + MCFUART_BASE3,
37 .irq = MCFINT_VECBASE + MCFINT_UART0 + 2,
38 },
39 { },
40};
41
42static struct platform_device m523x_uart = {
43 .name = "mcfuart",
44 .id = 0,
45 .dev.platform_data = m523x_uart_platform,
46};
47
ffba3f48
GU
48static struct resource m523x_fec_resources[] = {
49 {
50 .start = MCF_MBAR + 0x1000,
51 .end = MCF_MBAR + 0x1000 + 0x7ff,
52 .flags = IORESOURCE_MEM,
53 },
54 {
55 .start = 64 + 23,
56 .end = 64 + 23,
57 .flags = IORESOURCE_IRQ,
58 },
59 {
60 .start = 64 + 27,
61 .end = 64 + 27,
62 .flags = IORESOURCE_IRQ,
63 },
64 {
65 .start = 64 + 29,
66 .end = 64 + 29,
67 .flags = IORESOURCE_IRQ,
68 },
69};
70
71static struct platform_device m523x_fec = {
72 .name = "fec",
73 .id = 0,
74 .num_resources = ARRAY_SIZE(m523x_fec_resources),
75 .resource = m523x_fec_resources,
76};
77
4b61a353
GU
78static struct platform_device *m523x_devices[] __initdata = {
79 &m523x_uart,
ffba3f48 80 &m523x_fec,
b5aaf3f7
GU
81};
82
4b61a353
GU
83/***************************************************************************/
84
14c16db3
GU
85static void __init m523x_fec_init(void)
86{
87 u16 par;
88 u8 v;
89
90 /* Set multi-function pins to ethernet use */
91 par = readw(MCF_IPSBAR + 0x100082);
92 writew(par | 0xf00, MCF_IPSBAR + 0x100082);
93 v = readb(MCF_IPSBAR + 0x100078);
94 writeb(v | 0xc0, MCF_IPSBAR + 0x100078);
95}
96
97/***************************************************************************/
98
55b33f31
GU
99static void m523x_cpu_reset(void)
100{
101 local_irq_disable();
102 __raw_writeb(MCF_RCR_SWRESET, MCF_IPSBAR + MCF_RCR);
103}
b5aaf3f7
GU
104
105/***************************************************************************/
106
4b61a353 107void __init config_BSP(char *commandp, int size)
b5aaf3f7 108{
55b33f31 109 mach_reset = m523x_cpu_reset;
b5aaf3f7
GU
110}
111
112/***************************************************************************/
4b61a353
GU
113
114static int __init init_BSP(void)
115{
14c16db3 116 m523x_fec_init();
4b61a353
GU
117 platform_add_devices(m523x_devices, ARRAY_SIZE(m523x_devices));
118 return 0;
119}
120
121arch_initcall(init_BSP);
122
123/***************************************************************************/