aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-sa1100/simpad.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/arm/mach-sa1100/simpad.c
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/arm/mach-sa1100/simpad.c')
-rw-r--r--arch/arm/mach-sa1100/simpad.c224
1 files changed, 224 insertions, 0 deletions
diff --git a/arch/arm/mach-sa1100/simpad.c b/arch/arm/mach-sa1100/simpad.c
new file mode 100644
index 000000000000..8d113d629867
--- /dev/null
+++ b/arch/arm/mach-sa1100/simpad.c
@@ -0,0 +1,224 @@
1/*
2 * linux/arch/arm/mach-sa1100/simpad.c
3 */
4
5#include <linux/config.h>
6#include <linux/module.h>
7#include <linux/init.h>
8#include <linux/kernel.h>
9#include <linux/tty.h>
10#include <linux/proc_fs.h>
11#include <linux/string.h>
12#include <linux/pm.h>
13#include <linux/device.h>
14#include <linux/mtd/mtd.h>
15#include <linux/mtd/partitions.h>
16
17#include <asm/irq.h>
18#include <asm/hardware.h>
19#include <asm/setup.h>
20
21#include <asm/mach-types.h>
22#include <asm/mach/arch.h>
23#include <asm/mach/flash.h>
24#include <asm/mach/map.h>
25#include <asm/mach/serial_sa1100.h>
26#include <asm/arch/simpad.h>
27
28#include <linux/serial_core.h>
29#include <linux/ioport.h>
30#include <asm/io.h>
31
32#include "generic.h"
33
34long cs3_shadow;
35
36long get_cs3_shadow(void)
37{
38 return cs3_shadow;
39}
40
41void set_cs3(long value)
42{
43 *(CS3BUSTYPE *)(CS3_BASE) = cs3_shadow = value;
44}
45
46void set_cs3_bit(int value)
47{
48 cs3_shadow |= value;
49 *(CS3BUSTYPE *)(CS3_BASE) = cs3_shadow;
50}
51
52void clear_cs3_bit(int value)
53{
54 cs3_shadow &= ~value;
55 *(CS3BUSTYPE *)(CS3_BASE) = cs3_shadow;
56}
57
58EXPORT_SYMBOL(set_cs3_bit);
59EXPORT_SYMBOL(clear_cs3_bit);
60
61static struct map_desc simpad_io_desc[] __initdata = {
62 /* virtual physical length type */
63 /* MQ200 */
64 { 0xf2800000, 0x4b800000, 0x00800000, MT_DEVICE },
65 /* Paules CS3, write only */
66 { 0xf1000000, 0x18000000, 0x00100000, MT_DEVICE },
67};
68
69
70static void simpad_uart_pm(struct uart_port *port, u_int state, u_int oldstate)
71{
72 if (port->mapbase == (u_int)&Ser1UTCR0) {
73 if (state)
74 {
75 clear_cs3_bit(RS232_ON);
76 clear_cs3_bit(DECT_POWER_ON);
77 }else
78 {
79 set_cs3_bit(RS232_ON);
80 set_cs3_bit(DECT_POWER_ON);
81 }
82 }
83}
84
85static struct sa1100_port_fns simpad_port_fns __initdata = {
86 .pm = simpad_uart_pm,
87};
88
89
90static struct mtd_partition simpad_partitions[] = {
91 {
92 .name = "SIMpad boot firmware",
93 .size = 0x00080000,
94 .offset = 0,
95 .mask_flags = MTD_WRITEABLE,
96 }, {
97 .name = "SIMpad kernel",
98 .size = 0x0010000,
99 .offset = MTDPART_OFS_APPEND,
100 }, {
101 .name = "SIMpad root jffs2",
102 .size = MTDPART_SIZ_FULL,
103 .offset = MTDPART_OFS_APPEND,
104 }
105};
106
107static struct flash_platform_data simpad_flash_data = {
108 .map_name = "cfi_probe",
109 .parts = simpad_partitions,
110 .nr_parts = ARRAY_SIZE(simpad_partitions),
111};
112
113
114static struct resource simpad_flash_resources [] = {
115 {
116 .start = SA1100_CS0_PHYS,
117 .end = SA1100_CS0_PHYS + SZ_16M -1,
118 .flags = IORESOURCE_MEM,
119 }, {
120 .start = SA1100_CS1_PHYS,
121 .end = SA1100_CS1_PHYS + SZ_16M -1,
122 .flags = IORESOURCE_MEM,
123 }
124};
125
126
127
128static void __init simpad_map_io(void)
129{
130 sa1100_map_io();
131
132 iotable_init(simpad_io_desc, ARRAY_SIZE(simpad_io_desc));
133
134 set_cs3_bit (EN1 | EN0 | LED2_ON | DISPLAY_ON | RS232_ON |
135 ENABLE_5V | RESET_SIMCARD | DECT_POWER_ON);
136
137
138 sa1100_register_uart_fns(&simpad_port_fns);
139 sa1100_register_uart(0, 3); /* serial interface */
140 sa1100_register_uart(1, 1); /* DECT */
141
142 // Reassign UART 1 pins
143 GAFR |= GPIO_UART_TXD | GPIO_UART_RXD;
144 GPDR |= GPIO_UART_TXD | GPIO_LDD13 | GPIO_LDD15;
145 GPDR &= ~GPIO_UART_RXD;
146 PPAR |= PPAR_UPR;
147
148 /*
149 * Set up registers for sleep mode.
150 */
151
152
153 PWER = PWER_GPIO0| PWER_RTC;
154 PGSR = 0x818;
155 PCFR = 0;
156 PSDR = 0;
157
158 sa11x0_set_flash_data(&simpad_flash_data, simpad_flash_resources,
159 ARRAY_SIZE(simpad_flash_resources));
160}
161
162static void simpad_power_off(void)
163{
164 local_irq_disable(); // was cli
165 set_cs3(0x800); /* only SD_MEDIAQ */
166
167 /* disable internal oscillator, float CS lines */
168 PCFR = (PCFR_OPDE | PCFR_FP | PCFR_FS);
169 /* enable wake-up on GPIO0 (Assabet...) */
170 PWER = GFER = GRER = 1;
171 /*
172 * set scratchpad to zero, just in case it is used as a
173 * restart address by the bootloader.
174 */
175 PSPR = 0;
176 PGSR = 0;
177 /* enter sleep mode */
178 PMCR = PMCR_SF;
179 while(1);
180
181 local_irq_enable(); /* we won't ever call it */
182
183
184}
185
186
187/*
188 * MediaQ Video Device
189 */
190static struct platform_device simpad_mq200fb = {
191 .name = "simpad-mq200",
192 .id = 0,
193};
194
195static struct platform_device *devices[] __initdata = {
196 &simpad_mq200fb
197};
198
199
200
201static int __init simpad_init(void)
202{
203 int ret;
204
205 pm_power_off = simpad_power_off;
206
207 ret = platform_add_devices(devices, ARRAY_SIZE(devices));
208 if(ret)
209 printk(KERN_WARNING "simpad: Unable to register mq200 framebuffer device");
210
211 return 0;
212}
213
214arch_initcall(simpad_init);
215
216
217MACHINE_START(SIMPAD, "Simpad")
218 MAINTAINER("Holger Freyther")
219 BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000)
220 BOOT_PARAMS(0xc0000100)
221 MAPIO(simpad_map_io)
222 INITIRQ(sa1100_init_irq)
223 .timer = &sa1100_timer,
224MACHINE_END