1 /* linux/arch/arm/mach-s3c2410/mach-jive.c
3 * Copyright 2007 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 #include <linux/kernel.h>
14 #include <linux/types.h>
15 #include <linux/interrupt.h>
16 #include <linux/list.h>
17 #include <linux/timer.h>
18 #include <linux/init.h>
19 #include <linux/sysdev.h>
20 #include <linux/serial_core.h>
21 #include <linux/platform_device.h>
23 #include <linux/mtd/mtd.h>
24 #include <linux/mtd/partitions.h>
26 #include <asm/mach/arch.h>
27 #include <asm/mach/map.h>
28 #include <asm/mach/irq.h>
30 #include <asm/plat-s3c/regs-serial.h>
31 #include <asm/plat-s3c/nand.h>
33 #include <asm/arch/regs-power.h>
34 #include <asm/arch/regs-gpio.h>
35 #include <asm/arch/regs-mem.h>
36 #include <asm/arch/regs-lcd.h>
38 #include <asm/mach-types.h>
40 #include <linux/mtd/mtd.h>
41 #include <linux/mtd/nand.h>
42 #include <linux/mtd/nand_ecc.h>
43 #include <linux/mtd/partitions.h>
45 #include <asm/plat-s3c24xx/clock.h>
46 #include <asm/plat-s3c24xx/devs.h>
47 #include <asm/plat-s3c24xx/cpu.h>
48 #include <asm/plat-s3c24xx/pm.h>
49 #include <asm/plat-s3c24xx/udc.h>
51 static struct map_desc jive_iodesc[] __initdata = {
54 #define UCON S3C2410_UCON_DEFAULT
55 #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE
56 #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
58 static struct s3c2410_uartcfg jive_uartcfgs[] = {
82 /* Jive flash assignment
84 * 0x00000000-0x00028000 : uboot
85 * 0x00028000-0x0002c000 : uboot env
86 * 0x0002c000-0x00030000 : spare
87 * 0x00030000-0x00200000 : zimage A
88 * 0x00200000-0x01600000 : cramfs A
89 * 0x01600000-0x017d0000 : zimage B
90 * 0x017d0000-0x02bd0000 : cramfs B
91 * 0x02bd0000-0x03fd0000 : yaffs
93 static struct mtd_partition jive_imageA_nand_part[] = {
95 #ifdef CONFIG_MACH_JIVE_SHOW_BOOTLOADER
96 /* Don't allow access to the bootloader from linux */
100 .size = (160 * SZ_1K),
101 .mask_flags = MTD_WRITEABLE, /* force read-only */
107 .offset = (176 * SZ_1K),
108 .size = (16 * SZ_1K),
114 .name = "kernel (ro)",
115 .offset = (192 * SZ_1K),
116 .size = (SZ_2M) - (192 * SZ_1K),
117 .mask_flags = MTD_WRITEABLE, /* force read-only */
121 .size = (20 * SZ_1M),
122 .mask_flags = MTD_WRITEABLE, /* force read-only */
128 .offset = (44 * SZ_1M),
129 .size = (20 * SZ_1M),
132 /* bootloader environment */
135 .offset = (160 * SZ_1K),
136 .size = (16 * SZ_1K),
142 .offset = (22 * SZ_1M),
143 .size = (2 * SZ_1M) - (192 * SZ_1K),
146 .offset = (24 * SZ_1M) - (192*SZ_1K),
147 .size = (20 * SZ_1M),
151 static struct mtd_partition jive_imageB_nand_part[] = {
153 #ifdef CONFIG_MACH_JIVE_SHOW_BOOTLOADER
154 /* Don't allow access to the bootloader from linux */
158 .size = (160 * SZ_1K),
159 .mask_flags = MTD_WRITEABLE, /* force read-only */
165 .offset = (176 * SZ_1K),
166 .size = (16 * SZ_1K),
172 .name = "kernel (ro)",
173 .offset = (22 * SZ_1M),
174 .size = (2 * SZ_1M) - (192 * SZ_1K),
175 .mask_flags = MTD_WRITEABLE, /* force read-only */
179 .offset = (24 * SZ_1M) - (192 * SZ_1K),
180 .size = (20 * SZ_1M),
181 .mask_flags = MTD_WRITEABLE, /* force read-only */
187 .offset = (44 * SZ_1M),
188 .size = (20 * SZ_1M),
191 /* bootloader environment */
194 .offset = (160 * SZ_1K),
195 .size = (16 * SZ_1K),
201 .offset = (192 * SZ_1K),
202 .size = (2 * SZ_1M) - (192 * SZ_1K),
205 .offset = (2 * SZ_1M),
206 .size = (20 * SZ_1M),
210 static struct s3c2410_nand_set jive_nand_sets[] = {
214 .nr_partitions = ARRAY_SIZE(jive_imageA_nand_part),
215 .partitions = jive_imageA_nand_part,
219 static struct s3c2410_platform_nand jive_nand_info = {
220 /* set taken from osiris nand timings, possibly still conservative */
224 .sets = jive_nand_sets,
225 .nr_sets = ARRAY_SIZE(jive_nand_sets),
228 static int __init jive_mtdset(char *options)
230 struct s3c2410_nand_set *nand = &jive_nand_sets[0];
233 if (options == NULL || options[0] == '\0')
236 if (strict_strtoul(options, 10, &set)) {
237 printk(KERN_ERR "failed to parse mtdset=%s\n", options);
243 nand->nr_partitions = ARRAY_SIZE(jive_imageB_nand_part);
244 nand->partitions = jive_imageB_nand_part;
246 /* this is already setup in the nand info */
249 printk(KERN_ERR "Unknown mtd set %ld specified,"
250 "using default.", set);
256 /* parse the mtdset= option given to the kernel command line */
257 __setup("mtdset=", jive_mtdset);
259 static struct platform_device *jive_devices[] __initdata = {
265 &s3c_device_usbgadget,
268 static struct s3c2410_udc_mach_info jive_udc_cfg __initdata = {
269 .vbus_pin = S3C2410_GPG1, /* detect is on GPG1 */
272 /* Jive power management device */
275 static int jive_pm_suspend(struct sys_device *sd, pm_message_t state)
277 /* Write the magic value u-boot uses to check for resume into
278 * the INFORM0 register, and ensure INFORM1 is set to the
279 * correct address to resume from. */
281 __raw_writel(0x2BED, S3C2412_INFORM0);
282 __raw_writel(virt_to_phys(s3c2410_cpu_resume), S3C2412_INFORM1);
287 static int jive_pm_resume(struct sys_device *sd)
289 __raw_writel(0x0, S3C2412_INFORM0);
294 #define jive_pm_suspend NULL
295 #define jive_pm_resume NULL
298 static struct sysdev_class jive_pm_sysclass = {
300 .suspend = jive_pm_suspend,
301 .resume = jive_pm_resume,
304 static struct sys_device jive_pm_sysdev = {
305 .cls = &jive_pm_sysclass,
308 static void __init jive_map_io(void)
310 s3c24xx_init_io(jive_iodesc, ARRAY_SIZE(jive_iodesc));
311 s3c24xx_init_clocks(12000000);
312 s3c24xx_init_uarts(jive_uartcfgs, ARRAY_SIZE(jive_uartcfgs));
315 static void __init jive_machine_init(void)
317 /* register system devices for managing low level suspend */
319 sysdev_class_register(&jive_pm_sysclass);
320 sysdev_register(&jive_pm_sysdev);
324 s3c_device_nand.dev.platform_data = &jive_nand_info;
326 /* Turn off suspend on both USB ports, and switch the
327 * selectable USB port to USB device mode. */
329 s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
330 S3C2410_MISCCR_USBSUSPND0 |
331 S3C2410_MISCCR_USBSUSPND1, 0x0);
333 s3c24xx_udc_set_platdata(&jive_udc_cfg);
335 platform_add_devices(jive_devices, ARRAY_SIZE(jive_devices));
338 MACHINE_START(JIVE, "JIVE")
339 /* Maintainer: Ben Dooks <ben@fluff.org> */
340 .phys_io = S3C2410_PA_UART,
341 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
342 .boot_params = S3C2410_SDRAM_PA + 0x100,
344 .init_irq = s3c24xx_init_irq,
345 .map_io = jive_map_io,
346 .init_machine = jive_machine_init,
347 .timer = &s3c24xx_timer,