2 * linux/arch/arm/mach-sa1100/simpad.c
5 #include <linux/module.h>
6 #include <linux/init.h>
7 #include <linux/kernel.h>
9 #include <linux/proc_fs.h>
10 #include <linux/string.h>
12 #include <linux/platform_device.h>
13 #include <linux/mtd/mtd.h>
14 #include <linux/mtd/partitions.h>
17 #include <asm/hardware.h>
18 #include <asm/setup.h>
20 #include <asm/mach-types.h>
21 #include <asm/mach/arch.h>
22 #include <asm/mach/flash.h>
23 #include <asm/mach/map.h>
24 #include <asm/mach/serial_sa1100.h>
25 #include <asm/arch/mcp.h>
26 #include <asm/arch/simpad.h>
28 #include <linux/serial_core.h>
29 #include <linux/ioport.h>
36 long get_cs3_shadow(void)
41 void set_cs3(long value
)
43 *(CS3BUSTYPE
*)(CS3_BASE
) = cs3_shadow
= value
;
46 void set_cs3_bit(int value
)
49 *(CS3BUSTYPE
*)(CS3_BASE
) = cs3_shadow
;
52 void clear_cs3_bit(int value
)
55 *(CS3BUSTYPE
*)(CS3_BASE
) = cs3_shadow
;
58 EXPORT_SYMBOL(set_cs3_bit
);
59 EXPORT_SYMBOL(clear_cs3_bit
);
61 static struct map_desc simpad_io_desc
[] __initdata
= {
63 .virtual = 0xf2800000,
64 .pfn
= __phys_to_pfn(0x4b800000),
67 }, { /* Paules CS3, write only */
68 .virtual = 0xf1000000,
69 .pfn
= __phys_to_pfn(0x18000000),
76 static void simpad_uart_pm(struct uart_port
*port
, u_int state
, u_int oldstate
)
78 if (port
->mapbase
== (u_int
)&Ser1UTCR0
) {
81 clear_cs3_bit(RS232_ON
);
82 clear_cs3_bit(DECT_POWER_ON
);
85 set_cs3_bit(RS232_ON
);
86 set_cs3_bit(DECT_POWER_ON
);
91 static struct sa1100_port_fns simpad_port_fns __initdata
= {
96 static struct mtd_partition simpad_partitions
[] = {
98 .name
= "SIMpad boot firmware",
101 .mask_flags
= MTD_WRITEABLE
,
103 .name
= "SIMpad kernel",
105 .offset
= MTDPART_OFS_APPEND
,
107 .name
= "SIMpad root jffs2",
108 .size
= MTDPART_SIZ_FULL
,
109 .offset
= MTDPART_OFS_APPEND
,
113 static struct flash_platform_data simpad_flash_data
= {
114 .map_name
= "cfi_probe",
115 .parts
= simpad_partitions
,
116 .nr_parts
= ARRAY_SIZE(simpad_partitions
),
120 static struct resource simpad_flash_resources
[] = {
122 .start
= SA1100_CS0_PHYS
,
123 .end
= SA1100_CS0_PHYS
+ SZ_16M
-1,
124 .flags
= IORESOURCE_MEM
,
126 .start
= SA1100_CS1_PHYS
,
127 .end
= SA1100_CS1_PHYS
+ SZ_16M
-1,
128 .flags
= IORESOURCE_MEM
,
132 static struct mcp_plat_data simpad_mcp_data
= {
134 .sclk_rate
= 11981000,
139 static void __init
simpad_map_io(void)
143 iotable_init(simpad_io_desc
, ARRAY_SIZE(simpad_io_desc
));
145 set_cs3_bit (EN1
| EN0
| LED2_ON
| DISPLAY_ON
| RS232_ON
|
146 ENABLE_5V
| RESET_SIMCARD
| DECT_POWER_ON
);
149 sa1100_register_uart_fns(&simpad_port_fns
);
150 sa1100_register_uart(0, 3); /* serial interface */
151 sa1100_register_uart(1, 1); /* DECT */
153 // Reassign UART 1 pins
154 GAFR
|= GPIO_UART_TXD
| GPIO_UART_RXD
;
155 GPDR
|= GPIO_UART_TXD
| GPIO_LDD13
| GPIO_LDD15
;
156 GPDR
&= ~GPIO_UART_RXD
;
160 * Set up registers for sleep mode.
164 PWER
= PWER_GPIO0
| PWER_RTC
;
169 sa11x0_set_flash_data(&simpad_flash_data
, simpad_flash_resources
,
170 ARRAY_SIZE(simpad_flash_resources
));
171 sa11x0_set_mcp_data(&simpad_mcp_data
);
174 static void simpad_power_off(void)
176 local_irq_disable(); // was cli
177 set_cs3(0x800); /* only SD_MEDIAQ */
179 /* disable internal oscillator, float CS lines */
180 PCFR
= (PCFR_OPDE
| PCFR_FP
| PCFR_FS
);
181 /* enable wake-up on GPIO0 (Assabet...) */
182 PWER
= GFER
= GRER
= 1;
184 * set scratchpad to zero, just in case it is used as a
185 * restart address by the bootloader.
189 /* enter sleep mode */
193 local_irq_enable(); /* we won't ever call it */
200 * MediaQ Video Device
202 static struct platform_device simpad_mq200fb
= {
203 .name
= "simpad-mq200",
207 static struct platform_device
*devices
[] __initdata
= {
213 static int __init
simpad_init(void)
217 pm_power_off
= simpad_power_off
;
219 ret
= platform_add_devices(devices
, ARRAY_SIZE(devices
));
221 printk(KERN_WARNING
"simpad: Unable to register mq200 framebuffer device");
226 arch_initcall(simpad_init
);
229 MACHINE_START(SIMPAD
, "Simpad")
230 /* Maintainer: Holger Freyther */
231 .phys_io
= 0x80000000,
232 .io_pg_offst
= ((0xf8000000) >> 18) & 0xfffc,
233 .boot_params
= 0xc0000100,
234 .map_io
= simpad_map_io
,
235 .init_irq
= sa1100_init_irq
,
236 .timer
= &sa1100_timer
,