blob: e0f6d57b506504efcaf0a4fbc5f230a368f6e7df [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#include <linux/init.h>
14#include <linux/kernel.h>
15#include <linux/tty.h>
Russell Kingd052d1b2005-10-29 19:07:23 +010016#include <linux/platform_device.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070017#include <linux/mtd/mtd.h>
18#include <linux/mtd/partitions.h>
19
20#include <asm/irq.h>
21#include <asm/hardware.h>
22#include <asm/setup.h>
23
24#include <asm/mach-types.h>
25#include <asm/mach/arch.h>
26#include <asm/mach/flash.h>
27#include <asm/mach/map.h>
28#include <asm/mach/serial_sa1100.h>
29
30#include <asm/arch/cerf.h>
Russell King323cdfc2005-08-18 10:10:46 +010031#include <asm/arch/mcp.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070032#include "generic.h"
33
34static struct resource cerfuart2_resources[] = {
35 [0] = {
36 .start = 0x80030000,
37 .end = 0x8003ffff,
38 .flags = IORESOURCE_MEM,
39 },
40};
41
42static struct platform_device cerfuart2_device = {
43 .name = "sa11x0-uart",
44 .id = 2,
45 .num_resources = ARRAY_SIZE(cerfuart2_resources),
46 .resource = cerfuart2_resources,
47};
48
49static struct platform_device *cerf_devices[] __initdata = {
50 &cerfuart2_device,
51};
52
53#ifdef CONFIG_SA1100_CERF_FLASH_32MB
54# define CERF_FLASH_SIZE 0x02000000
55#elif defined CONFIG_SA1100_CERF_FLASH_16MB
56# define CERF_FLASH_SIZE 0x01000000
57#elif defined CONFIG_SA1100_CERF_FLASH_8MB
58# define CERF_FLASH_SIZE 0x00800000
59#else
60# error "Undefined flash size for CERF"
61#endif
62
63static struct mtd_partition cerf_partitions[] = {
64 {
65 .name = "Bootloader",
66 .size = 0x00020000,
67 .offset = 0x00000000,
68 }, {
69 .name = "Params",
70 .size = 0x00040000,
71 .offset = 0x00020000,
72 }, {
73 .name = "Kernel",
74 .size = 0x00100000,
75 .offset = 0x00060000,
76 }, {
77 .name = "Filesystem",
78 .size = CERF_FLASH_SIZE-0x00160000,
79 .offset = 0x00160000,
80 }
81};
82
83static struct flash_platform_data cerf_flash_data = {
84 .map_name = "cfi_probe",
85 .parts = cerf_partitions,
86 .nr_parts = ARRAY_SIZE(cerf_partitions),
87};
88
89static struct resource cerf_flash_resource = {
90 .start = SA1100_CS0_PHYS,
91 .end = SA1100_CS0_PHYS + SZ_32M - 1,
92 .flags = IORESOURCE_MEM,
93};
94
95static void __init cerf_init_irq(void)
96{
97 sa1100_init_irq();
98 set_irq_type(CERF_ETH_IRQ, IRQT_RISING);
99}
100
101static struct map_desc cerf_io_desc[] __initdata = {
Deepak Saxena92519d82005-10-28 15:19:04 +0100102 { /* Crystal Ethernet Chip */
103 .virtual = 0xf0000000,
104 .pfn = __phys_to_pfn(0x08000000),
105 .length = 0x00100000,
106 .type = MT_DEVICE
107 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108};
109
110static void __init cerf_map_io(void)
111{
112 sa1100_map_io();
113 iotable_init(cerf_io_desc, ARRAY_SIZE(cerf_io_desc));
114
115 sa1100_register_uart(0, 3);
116 sa1100_register_uart(1, 2); /* disable this and the uart2 device for sa1100_fir */
117 sa1100_register_uart(2, 1);
118
119 /* set some GPDR bits here while it's safe */
120 GPDR |= CERF_GPIO_CF_RESET;
121}
122
Russell King323cdfc2005-08-18 10:10:46 +0100123static struct mcp_plat_data cerf_mcp_data = {
124 .mccr0 = MCCR0_ADM,
125 .sclk_rate = 11981000,
126};
127
Linus Torvalds1da177e2005-04-16 15:20:36 -0700128static void __init cerf_init(void)
129{
130 platform_add_devices(cerf_devices, ARRAY_SIZE(cerf_devices));
131 sa11x0_set_flash_data(&cerf_flash_data, &cerf_flash_resource, 1);
Russell King323cdfc2005-08-18 10:10:46 +0100132 sa11x0_set_mcp_data(&cerf_mcp_data);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700133}
134
135MACHINE_START(CERF, "Intrinsyc CerfBoard/CerfCube")
Russell Kinge9dea0c2005-07-03 17:38:58 +0100136 /* Maintainer: support@intrinsyc.com */
Russell Kinge9dea0c2005-07-03 17:38:58 +0100137 .phys_io = 0x80000000,
138 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc,
139 .map_io = cerf_map_io,
140 .init_irq = cerf_init_irq,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700141 .timer = &sa1100_timer,
142 .init_machine = cerf_init,
143MACHINE_END