RT-AC66 3.0.0.4.374.130 core
[tomato.git] / release / src-rt-6.x / linux / linux-2.6 / arch / arm / mach-sa1100 / pleb.c
blobc7bf7e0038f07922bb294860ed75c284fbb1a811
1 /*
2 * linux/arch/arm/mach-sa1100/pleb.c
3 */
5 #include <linux/init.h>
6 #include <linux/kernel.h>
7 #include <linux/tty.h>
8 #include <linux/ioport.h>
9 #include <linux/platform_device.h>
10 #include <linux/irq.h>
12 #include <linux/mtd/partitions.h>
14 #include <asm/hardware.h>
15 #include <asm/io.h>
16 #include <asm/setup.h>
17 #include <asm/mach-types.h>
19 #include <asm/mach/arch.h>
20 #include <asm/mach/map.h>
21 #include <asm/mach/flash.h>
22 #include <asm/mach/serial_sa1100.h>
23 #include <asm/arch/irqs.h>
25 #include "generic.h"
29 * Ethernet IRQ mappings
32 #define PLEB_ETH0_P (0x20000300) /* Ethernet 0 in PCMCIA0 IO */
33 #define PLEB_ETH0_V (0xf6000300)
35 #define GPIO_ETH0_IRQ GPIO_GPIO(21)
36 #define GPIO_ETH0_EN GPIO_GPIO(26)
38 #define IRQ_GPIO_ETH0_IRQ IRQ_GPIO21
40 static struct resource smc91x_resources[] = {
41 [0] = {
42 .start = PLEB_ETH0_P,
43 .end = PLEB_ETH0_P | 0x03ffffff,
44 .flags = IORESOURCE_MEM,
46 #if 0 /* Autoprobe instead, to get rising/falling edge characteristic right */
47 [1] = {
48 .start = IRQ_GPIO_ETH0_IRQ,
49 .end = IRQ_GPIO_ETH0_IRQ,
50 .flags = IORESOURCE_IRQ,
52 #endif
56 static struct platform_device smc91x_device = {
57 .name = "smc91x",
58 .id = 0,
59 .num_resources = ARRAY_SIZE(smc91x_resources),
60 .resource = smc91x_resources,
63 static struct platform_device *devices[] __initdata = {
64 &smc91x_device,
69 * Pleb's memory map
70 * has flash memory (typically 4 or 8 meg) selected by
71 * the two SA1100 lowest chip select outputs.
73 static struct resource pleb_flash_resources[] = {
74 [0] = {
75 .start = SA1100_CS0_PHYS,
76 .end = SA1100_CS0_PHYS + SZ_8M - 1,
77 .flags = IORESOURCE_MEM,
79 [1] = {
80 .start = SA1100_CS1_PHYS,
81 .end = SA1100_CS1_PHYS + SZ_8M - 1,
82 .flags = IORESOURCE_MEM,
87 static struct mtd_partition pleb_partitions[] = {
89 .name = "blob",
90 .offset = 0,
91 .size = 0x00020000,
92 }, {
93 .name = "kernel",
94 .offset = MTDPART_OFS_APPEND,
95 .size = 0x000e0000,
96 }, {
97 .name = "rootfs",
98 .offset = MTDPART_OFS_APPEND,
99 .size = 0x00300000,
104 static struct flash_platform_data pleb_flash_data = {
105 .map_name = "cfi_probe",
106 .parts = pleb_partitions,
107 .nr_parts = ARRAY_SIZE(pleb_partitions),
111 static void __init pleb_init(void)
113 sa11x0_set_flash_data(&pleb_flash_data, pleb_flash_resources,
114 ARRAY_SIZE(pleb_flash_resources));
117 platform_add_devices(devices, ARRAY_SIZE(devices));
121 static void __init pleb_map_io(void)
123 sa1100_map_io();
125 sa1100_register_uart(0, 3);
126 sa1100_register_uart(1, 1);
128 GAFR |= (GPIO_UART_TXD | GPIO_UART_RXD);
129 GPDR |= GPIO_UART_TXD;
130 GPDR &= ~GPIO_UART_RXD;
131 PPAR |= PPAR_UPR;
134 * Fix expansion memory timing for network card
136 MECR = ((2<<10) | (2<<5) | (2<<0));
139 * Enable the SMC ethernet controller
141 GPDR |= GPIO_ETH0_EN; /* set to output */
142 GPCR = GPIO_ETH0_EN; /* clear MCLK (enable smc) */
144 GPDR &= ~GPIO_ETH0_IRQ;
146 set_irq_type(GPIO_ETH0_IRQ, IRQT_FALLING);
149 MACHINE_START(PLEB, "PLEB")
150 .phys_io = 0x80000000,
151 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc,
152 .map_io = pleb_map_io,
153 .init_irq = sa1100_init_irq,
154 .timer = &sa1100_timer,
155 .init_machine = pleb_init,
156 MACHINE_END