2 * linux/arch/arm/mach-sa1100/cerf.c
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.
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]
13 #include <linux/init.h>
14 #include <linux/gpio/machine.h>
15 #include <linux/kernel.h>
16 #include <linux/tty.h>
17 #include <linux/platform_data/sa11x0-serial.h>
18 #include <linux/platform_device.h>
19 #include <linux/irq.h>
20 #include <linux/mtd/mtd.h>
21 #include <linux/mtd/partitions.h>
22 #include <linux/gpio.h>
23 #include <linux/leds.h>
25 #include <mach/hardware.h>
26 #include <asm/setup.h>
28 #include <asm/mach-types.h>
29 #include <asm/mach/arch.h>
30 #include <asm/mach/flash.h>
31 #include <asm/mach/map.h>
33 #include <mach/cerf.h>
34 #include <linux/platform_data/mfd-mcp-sa11x0.h>
35 #include <mach/irqs.h>
38 static struct resource cerfuart2_resources
[] = {
39 [0] = DEFINE_RES_MEM(0x80030000, SZ_64K
),
42 static struct platform_device cerfuart2_device
= {
43 .name
= "sa11x0-uart",
45 .num_resources
= ARRAY_SIZE(cerfuart2_resources
),
46 .resource
= cerfuart2_resources
,
50 static struct gpiod_lookup_table cerf_cf_gpio_table
= {
51 .dev_id
= "sa11x0-pcmcia.1",
53 GPIO_LOOKUP("gpio", 19, "bvd2", GPIO_ACTIVE_HIGH
),
54 GPIO_LOOKUP("gpio", 20, "bvd1", GPIO_ACTIVE_HIGH
),
55 GPIO_LOOKUP("gpio", 21, "reset", GPIO_ACTIVE_HIGH
),
56 GPIO_LOOKUP("gpio", 22, "ready", GPIO_ACTIVE_HIGH
),
57 GPIO_LOOKUP("gpio", 23, "detect", GPIO_ACTIVE_LOW
),
63 struct gpio_led cerf_gpio_leds
[] = {
66 .default_trigger
= "heartbeat",
71 .default_trigger
= "cpu0",
76 .default_trigger
= "default-on",
81 .default_trigger
= "default-on",
87 static struct gpio_led_platform_data cerf_gpio_led_info
= {
88 .leds
= cerf_gpio_leds
,
89 .num_leds
= ARRAY_SIZE(cerf_gpio_leds
),
92 static struct platform_device cerf_leds
= {
96 .platform_data
= &cerf_gpio_led_info
,
101 static struct platform_device
*cerf_devices
[] __initdata
= {
106 #ifdef CONFIG_SA1100_CERF_FLASH_32MB
107 # define CERF_FLASH_SIZE 0x02000000
108 #elif defined CONFIG_SA1100_CERF_FLASH_16MB
109 # define CERF_FLASH_SIZE 0x01000000
110 #elif defined CONFIG_SA1100_CERF_FLASH_8MB
111 # define CERF_FLASH_SIZE 0x00800000
113 # error "Undefined flash size for CERF"
116 static struct mtd_partition cerf_partitions
[] = {
118 .name
= "Bootloader",
120 .offset
= 0x00000000,
124 .offset
= 0x00020000,
128 .offset
= 0x00060000,
130 .name
= "Filesystem",
131 .size
= CERF_FLASH_SIZE
-0x00160000,
132 .offset
= 0x00160000,
136 static struct flash_platform_data cerf_flash_data
= {
137 .map_name
= "cfi_probe",
138 .parts
= cerf_partitions
,
139 .nr_parts
= ARRAY_SIZE(cerf_partitions
),
142 static struct resource cerf_flash_resource
=
143 DEFINE_RES_MEM(SA1100_CS0_PHYS
, SZ_32M
);
145 static void __init
cerf_init_irq(void)
148 irq_set_irq_type(CERF_ETH_IRQ
, IRQ_TYPE_EDGE_RISING
);
151 static struct map_desc cerf_io_desc
[] __initdata
= {
152 { /* Crystal Ethernet Chip */
153 .virtual = 0xf0000000,
154 .pfn
= __phys_to_pfn(0x08000000),
155 .length
= 0x00100000,
160 static void __init
cerf_map_io(void)
163 iotable_init(cerf_io_desc
, ARRAY_SIZE(cerf_io_desc
));
165 sa1100_register_uart(0, 3);
166 sa1100_register_uart(1, 2); /* disable this and the uart2 device for sa1100_fir */
167 sa1100_register_uart(2, 1);
170 static struct mcp_plat_data cerf_mcp_data
= {
172 .sclk_rate
= 11981000,
175 static void __init
cerf_init(void)
177 sa11x0_ppc_configure_mcp();
178 platform_add_devices(cerf_devices
, ARRAY_SIZE(cerf_devices
));
179 sa11x0_register_mtd(&cerf_flash_data
, &cerf_flash_resource
, 1);
180 sa11x0_register_mcp(&cerf_mcp_data
);
181 sa11x0_register_pcmcia(1, &cerf_cf_gpio_table
);
184 MACHINE_START(CERF
, "Intrinsyc CerfBoard/CerfCube")
185 /* Maintainer: support@intrinsyc.com */
186 .map_io
= cerf_map_io
,
187 .nr_irqs
= SA1100_NR_IRQS
,
188 .init_irq
= cerf_init_irq
,
189 .init_time
= sa1100_timer_init
,
190 .init_machine
= cerf_init
,
191 .init_late
= sa11x0_init_late
,
192 .restart
= sa11x0_restart
,