Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * linux/arch/arm/mach-sa1100/pleb.c | |
3 | */ | |
4 | ||
5 | #include <linux/init.h> | |
6 | #include <linux/kernel.h> | |
7 | #include <linux/tty.h> | |
8 | #include <linux/ioport.h> | |
6920b5a7 | 9 | #include <linux/platform_data/sa11x0-serial.h> |
d052d1be | 10 | #include <linux/platform_device.h> |
119c641c | 11 | #include <linux/irq.h> |
fced80c7 | 12 | #include <linux/io.h> |
1da177e4 | 13 | #include <linux/mtd/partitions.h> |
b70661c7 | 14 | #include <linux/smc91x.h> |
1da177e4 | 15 | |
a09e64fb | 16 | #include <mach/hardware.h> |
1da177e4 LT |
17 | #include <asm/setup.h> |
18 | #include <asm/mach-types.h> | |
19 | ||
20 | #include <asm/mach/arch.h> | |
21 | #include <asm/mach/map.h> | |
22 | #include <asm/mach/flash.h> | |
a09e64fb | 23 | #include <mach/irqs.h> |
1da177e4 LT |
24 | |
25 | #include "generic.h" | |
26 | ||
27 | ||
28 | /* | |
29 | * Ethernet IRQ mappings | |
30 | */ | |
31 | ||
32 | #define PLEB_ETH0_P (0x20000300) /* Ethernet 0 in PCMCIA0 IO */ | |
33 | #define PLEB_ETH0_V (0xf6000300) | |
34 | ||
35 | #define GPIO_ETH0_IRQ GPIO_GPIO(21) | |
36 | #define GPIO_ETH0_EN GPIO_GPIO(26) | |
37 | ||
38 | #define IRQ_GPIO_ETH0_IRQ IRQ_GPIO21 | |
39 | ||
40 | static struct resource smc91x_resources[] = { | |
a181099e | 41 | [0] = DEFINE_RES_MEM(PLEB_ETH0_P, 0x04000000), |
1da177e4 | 42 | #if 0 /* Autoprobe instead, to get rising/falling edge characteristic right */ |
a181099e | 43 | [1] = DEFINE_RES_IRQ(IRQ_GPIO_ETH0_IRQ), |
1da177e4 LT |
44 | #endif |
45 | }; | |
46 | ||
b70661c7 AB |
47 | static struct smc91x_platdata smc91x_platdata = { |
48 | .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT, | |
49 | }; | |
1da177e4 LT |
50 | |
51 | static struct platform_device smc91x_device = { | |
52 | .name = "smc91x", | |
53 | .id = 0, | |
54 | .num_resources = ARRAY_SIZE(smc91x_resources), | |
55 | .resource = smc91x_resources, | |
b70661c7 | 56 | .dev = { |
04b91701 | 57 | .platform_data = &smc91x_platdata, |
b70661c7 | 58 | }, |
1da177e4 LT |
59 | }; |
60 | ||
61 | static struct platform_device *devices[] __initdata = { | |
62 | &smc91x_device, | |
63 | }; | |
64 | ||
65 | ||
66 | /* | |
67 | * Pleb's memory map | |
68 | * has flash memory (typically 4 or 8 meg) selected by | |
69 | * the two SA1100 lowest chip select outputs. | |
70 | */ | |
71 | static struct resource pleb_flash_resources[] = { | |
a181099e RK |
72 | [0] = DEFINE_RES_MEM(SA1100_CS0_PHYS, SZ_8M), |
73 | [1] = DEFINE_RES_MEM(SA1100_CS1_PHYS, SZ_8M), | |
1da177e4 LT |
74 | }; |
75 | ||
76 | ||
77 | static struct mtd_partition pleb_partitions[] = { | |
78 | { | |
79 | .name = "blob", | |
bda03086 | 80 | .offset = 0, |
1da177e4 LT |
81 | .size = 0x00020000, |
82 | }, { | |
83 | .name = "kernel", | |
bda03086 | 84 | .offset = MTDPART_OFS_APPEND, |
1da177e4 LT |
85 | .size = 0x000e0000, |
86 | }, { | |
87 | .name = "rootfs", | |
bda03086 | 88 | .offset = MTDPART_OFS_APPEND, |
1da177e4 LT |
89 | .size = 0x00300000, |
90 | } | |
91 | }; | |
92 | ||
93 | ||
94 | static struct flash_platform_data pleb_flash_data = { | |
95 | .map_name = "cfi_probe", | |
96 | .parts = pleb_partitions, | |
97 | .nr_parts = ARRAY_SIZE(pleb_partitions), | |
98 | }; | |
99 | ||
100 | ||
101 | static void __init pleb_init(void) | |
102 | { | |
7a5b4e16 | 103 | sa11x0_register_mtd(&pleb_flash_data, pleb_flash_resources, |
1da177e4 LT |
104 | ARRAY_SIZE(pleb_flash_resources)); |
105 | ||
106 | ||
107 | platform_add_devices(devices, ARRAY_SIZE(devices)); | |
108 | } | |
109 | ||
110 | ||
111 | static void __init pleb_map_io(void) | |
112 | { | |
113 | sa1100_map_io(); | |
114 | ||
115 | sa1100_register_uart(0, 3); | |
93982535 | 116 | sa1100_register_uart(1, 1); |
1da177e4 | 117 | |
93982535 KE |
118 | GAFR |= (GPIO_UART_TXD | GPIO_UART_RXD); |
119 | GPDR |= GPIO_UART_TXD; | |
120 | GPDR &= ~GPIO_UART_RXD; | |
121 | PPAR |= PPAR_UPR; | |
1da177e4 LT |
122 | |
123 | /* | |
124 | * Fix expansion memory timing for network card | |
125 | */ | |
126 | MECR = ((2<<10) | (2<<5) | (2<<0)); | |
127 | ||
128 | /* | |
129 | * Enable the SMC ethernet controller | |
130 | */ | |
131 | GPDR |= GPIO_ETH0_EN; /* set to output */ | |
132 | GPCR = GPIO_ETH0_EN; /* clear MCLK (enable smc) */ | |
133 | ||
134 | GPDR &= ~GPIO_ETH0_IRQ; | |
135 | ||
6845664a | 136 | irq_set_irq_type(GPIO_ETH0_IRQ, IRQ_TYPE_EDGE_FALLING); |
1da177e4 LT |
137 | } |
138 | ||
139 | MACHINE_START(PLEB, "PLEB") | |
e9dea0c6 | 140 | .map_io = pleb_map_io, |
f314f33b | 141 | .nr_irqs = SA1100_NR_IRQS, |
e9dea0c6 | 142 | .init_irq = sa1100_init_irq, |
6bb27d73 | 143 | .init_time = sa1100_timer_init, |
1da177e4 | 144 | .init_machine = pleb_init, |
7fea1ba5 | 145 | .init_late = sa11x0_init_late, |
d9ca5839 | 146 | .restart = sa11x0_restart, |
1da177e4 | 147 | MACHINE_END |