2 * linux/arch/arm/mach-sa1100/simpad.c
5 #include <linux/config.h>
6 #include <linux/module.h>
7 #include <linux/init.h>
8 #include <linux/kernel.h>
10 #include <linux/proc_fs.h>
11 #include <linux/string.h>
15 #include <asm/hardware.h>
16 #include <asm/setup.h>
18 #include <asm/mach-types.h>
19 #include <asm/mach/arch.h>
20 #include <asm/mach/map.h>
21 #include <asm/mach/serial_sa1100.h>
22 #include <asm/arch/simpad.h>
23 #include <asm/arch/registry.h>
25 #include <linux/serial_core.h>
26 #include <linux/ioport.h>
33 long get_cs3_shadow(void)
38 void set_cs3(long value)
40 *(CS3BUSTYPE *)(CS3_BASE) = cs3_shadow = value;
43 void set_cs3_bit(int value)
46 *(CS3BUSTYPE *)(CS3_BASE) = cs3_shadow;
49 void clear_cs3_bit(int value)
52 *(CS3BUSTYPE *)(CS3_BASE) = cs3_shadow;
55 EXPORT_SYMBOL(set_cs3_bit);
56 EXPORT_SYMBOL(clear_cs3_bit);
58 static struct map_desc simpad_io_desc[] __initdata = {
59 /* virtual physical length type */
61 { 0xf2800000, 0x4b800000, 0x00800000, MT_DEVICE },
62 /* Paules CS3, write only */
63 { 0xf1000000, 0x18000000, 0x00100000, MT_DEVICE },
67 static void simpad_uart_pm(struct uart_port *port, u_int state, u_int oldstate)
69 if (port->mapbase == (u_int)&Ser1UTCR0) {
72 clear_cs3_bit(RS232_ON);
73 clear_cs3_bit(DECT_POWER_ON);
76 set_cs3_bit(RS232_ON);
77 set_cs3_bit(DECT_POWER_ON);
82 static struct sa1100_port_fns simpad_port_fns __initdata = {
86 static void __init simpad_map_io(void)
90 iotable_init(simpad_io_desc, ARRAY_SIZE(simpad_io_desc));
92 set_cs3_bit (EN1 | EN0 | LED2_ON | DISPLAY_ON | RS232_ON |
93 ENABLE_5V | RESET_SIMCARD | DECT_POWER_ON);
96 sa1100_register_uart_fns(&simpad_port_fns);
97 sa1100_register_uart(0, 3); /* serial interface */
98 sa1100_register_uart(1, 1); /* DECT */
100 // Reassign UART 1 pins
101 GAFR |= GPIO_UART_TXD | GPIO_UART_RXD;
102 GPDR |= GPIO_UART_TXD | GPIO_LDD13 | GPIO_LDD15;
103 GPDR &= ~GPIO_UART_RXD;
107 * Set up registers for sleep mode.
111 PWER = PWER_GPIO0| PWER_RTC;
119 #ifdef CONFIG_PROC_FS
121 static char* name[]={
140 static int proc_cs3_read(char *page, char **start, off_t off,
141 int count, int *eof, void *data)
146 p += sprintf(p, "Chipselect3 : %x\n", (uint)cs3_shadow);
147 for (i = 0; i <= 15; i++) {
148 if(cs3_shadow & (1<<i)) {
149 p += sprintf(p, "%s\t: TRUE \n",name[i]);
151 p += sprintf(p, "%s\t: FALSE \n",name[i]);
153 len = (p - page) - off;
157 *eof = (len <= count) ? 1 : 0;
163 static int proc_cs3_write(struct file * file, const char * buffer,
164 size_t count, loff_t *ppos)
166 unsigned long newRegValue;
169 newRegValue = simple_strtoul(buffer,&endp,0);
170 set_cs3( newRegValue );
171 return (count+endp-buffer);
176 static int __init cs3_init(void)
179 #ifdef CONFIG_PROC_FS
180 struct proc_dir_entry *proc_cs3 = create_proc_entry("CS3", 0, 0);
183 proc_cs3->read_proc = proc_cs3_read;
184 proc_cs3->write_proc = (void*)proc_cs3_write;
193 arch_initcall(cs3_init);
195 static void simpad_power_off(void)
197 local_irq_disable(); // was cli
198 set_cs3(0x800); /* only SD_MEDIAQ */
200 /* disable internal oscillator, float CS lines */
201 PCFR = (PCFR_OPDE | PCFR_FP | PCFR_FS);
202 /* enable wake-up on GPIO0 (Assabet...) */
203 PWER = GFER = GRER = 1;
205 * set scratchpad to zero, just in case it is used as a
206 * restart address by the bootloader.
210 /* enter sleep mode */
214 local_irq_enable(); /* we won't ever call it */
219 static int __init simpad_init(void)
221 set_power_off_handler( simpad_power_off );
225 arch_initcall(simpad_init);
228 MACHINE_START(SIMPAD, "Simpad")
229 MAINTAINER("Juergen Messerer")
230 BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000)
231 BOOT_PARAMS(0xc0000100)
233 INITIRQ(sa1100_init_irq)
234 INITTIME(sa1100_init_time)