Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * linux/arch/arm/mach-sa1100/cerf.c | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License version 2 as | |
6 | * published by the Free Software Foundation. | |
7 | * | |
8 | * Apr-2003 : Removed some old PDA crud [FB] | |
9 | * Oct-2003 : Added uart2 resource [FB] | |
10 | * Jan-2004 : Removed io map for flash [FB] | |
11 | */ | |
12 | ||
1da177e4 LT |
13 | #include <linux/init.h> |
14 | #include <linux/kernel.h> | |
15 | #include <linux/tty.h> | |
d052d1be | 16 | #include <linux/platform_device.h> |
119c641c | 17 | #include <linux/irq.h> |
1da177e4 LT |
18 | #include <linux/mtd/mtd.h> |
19 | #include <linux/mtd/partitions.h> | |
20 | ||
21 | #include <asm/irq.h> | |
a09e64fb | 22 | #include <mach/hardware.h> |
1da177e4 LT |
23 | #include <asm/setup.h> |
24 | ||
25 | #include <asm/mach-types.h> | |
26 | #include <asm/mach/arch.h> | |
27 | #include <asm/mach/flash.h> | |
28 | #include <asm/mach/map.h> | |
29 | #include <asm/mach/serial_sa1100.h> | |
30 | ||
a09e64fb RK |
31 | #include <mach/cerf.h> |
32 | #include <mach/mcp.h> | |
1da177e4 LT |
33 | #include "generic.h" |
34 | ||
35 | static struct resource cerfuart2_resources[] = { | |
36 | [0] = { | |
37 | .start = 0x80030000, | |
38 | .end = 0x8003ffff, | |
39 | .flags = IORESOURCE_MEM, | |
40 | }, | |
41 | }; | |
42 | ||
43 | static struct platform_device cerfuart2_device = { | |
44 | .name = "sa11x0-uart", | |
45 | .id = 2, | |
46 | .num_resources = ARRAY_SIZE(cerfuart2_resources), | |
47 | .resource = cerfuart2_resources, | |
48 | }; | |
49 | ||
50 | static struct platform_device *cerf_devices[] __initdata = { | |
51 | &cerfuart2_device, | |
52 | }; | |
53 | ||
54 | #ifdef CONFIG_SA1100_CERF_FLASH_32MB | |
55 | # define CERF_FLASH_SIZE 0x02000000 | |
56 | #elif defined CONFIG_SA1100_CERF_FLASH_16MB | |
57 | # define CERF_FLASH_SIZE 0x01000000 | |
58 | #elif defined CONFIG_SA1100_CERF_FLASH_8MB | |
59 | # define CERF_FLASH_SIZE 0x00800000 | |
60 | #else | |
61 | # error "Undefined flash size for CERF" | |
62 | #endif | |
63 | ||
64 | static struct mtd_partition cerf_partitions[] = { | |
65 | { | |
66 | .name = "Bootloader", | |
67 | .size = 0x00020000, | |
68 | .offset = 0x00000000, | |
69 | }, { | |
70 | .name = "Params", | |
71 | .size = 0x00040000, | |
72 | .offset = 0x00020000, | |
73 | }, { | |
74 | .name = "Kernel", | |
75 | .size = 0x00100000, | |
76 | .offset = 0x00060000, | |
77 | }, { | |
78 | .name = "Filesystem", | |
79 | .size = CERF_FLASH_SIZE-0x00160000, | |
80 | .offset = 0x00160000, | |
81 | } | |
82 | }; | |
83 | ||
84 | static struct flash_platform_data cerf_flash_data = { | |
85 | .map_name = "cfi_probe", | |
86 | .parts = cerf_partitions, | |
87 | .nr_parts = ARRAY_SIZE(cerf_partitions), | |
88 | }; | |
89 | ||
90 | static struct resource cerf_flash_resource = { | |
91 | .start = SA1100_CS0_PHYS, | |
92 | .end = SA1100_CS0_PHYS + SZ_32M - 1, | |
93 | .flags = IORESOURCE_MEM, | |
94 | }; | |
95 | ||
96 | static void __init cerf_init_irq(void) | |
97 | { | |
98 | sa1100_init_irq(); | |
6845664a | 99 | irq_set_irq_type(CERF_ETH_IRQ, IRQ_TYPE_EDGE_RISING); |
1da177e4 LT |
100 | } |
101 | ||
102 | static struct map_desc cerf_io_desc[] __initdata = { | |
92519d82 DS |
103 | { /* Crystal Ethernet Chip */ |
104 | .virtual = 0xf0000000, | |
105 | .pfn = __phys_to_pfn(0x08000000), | |
106 | .length = 0x00100000, | |
107 | .type = MT_DEVICE | |
108 | } | |
1da177e4 LT |
109 | }; |
110 | ||
111 | static void __init cerf_map_io(void) | |
112 | { | |
113 | sa1100_map_io(); | |
114 | iotable_init(cerf_io_desc, ARRAY_SIZE(cerf_io_desc)); | |
115 | ||
116 | sa1100_register_uart(0, 3); | |
117 | sa1100_register_uart(1, 2); /* disable this and the uart2 device for sa1100_fir */ | |
118 | sa1100_register_uart(2, 1); | |
119 | ||
120 | /* set some GPDR bits here while it's safe */ | |
121 | GPDR |= CERF_GPIO_CF_RESET; | |
122 | } | |
123 | ||
323cdfc1 RK |
124 | static struct mcp_plat_data cerf_mcp_data = { |
125 | .mccr0 = MCCR0_ADM, | |
126 | .sclk_rate = 11981000, | |
5dd7bf59 | 127 | .codec = "ucb1x00", |
323cdfc1 RK |
128 | }; |
129 | ||
1da177e4 LT |
130 | static void __init cerf_init(void) |
131 | { | |
132 | platform_add_devices(cerf_devices, ARRAY_SIZE(cerf_devices)); | |
7a5b4e16 | 133 | sa11x0_register_mtd(&cerf_flash_data, &cerf_flash_resource, 1); |
af9081ae JF |
134 | |
135 | /* | |
136 | * Setup the PPC unit correctly. | |
137 | */ | |
138 | PPDR &= ~PPC_RXD4; | |
139 | PPDR |= PPC_TXD4 | PPC_SCLK | PPC_SFRM; | |
140 | PSDR |= PPC_RXD4; | |
141 | PSDR &= ~(PPC_TXD4 | PPC_SCLK | PPC_SFRM); | |
142 | PPSR &= ~(PPC_TXD4 | PPC_SCLK | PPC_SFRM); | |
143 | ||
7a5b4e16 | 144 | sa11x0_register_mcp(&cerf_mcp_data); |
1da177e4 LT |
145 | } |
146 | ||
147 | MACHINE_START(CERF, "Intrinsyc CerfBoard/CerfCube") | |
e9dea0c6 | 148 | /* Maintainer: support@intrinsyc.com */ |
e9dea0c6 RK |
149 | .map_io = cerf_map_io, |
150 | .init_irq = cerf_init_irq, | |
1da177e4 LT |
151 | .timer = &sa1100_timer, |
152 | .init_machine = cerf_init, | |
d9ca5839 | 153 | .restart = sa11x0_restart, |
1da177e4 | 154 | MACHINE_END |