| Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 1 | /* linux/arch/arm/mach-s3c2412/mach-vstms.c | 
| Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 2 |  * | 
 | 3 |  * (C) 2006 Thomas Gleixner <tglx@linutronix.de> | 
 | 4 |  * | 
 | 5 |  * Derived from mach-smdk2413.c - (C) 2006 Simtec Electronics | 
 | 6 |  * | 
 | 7 |  * This program is free software; you can redistribute it and/or modify | 
 | 8 |  * it under the terms of the GNU General Public License version 2 as | 
 | 9 |  * published by the Free Software Foundation. | 
 | 10 |  */ | 
 | 11 |  | 
 | 12 | #include <linux/kernel.h> | 
 | 13 | #include <linux/types.h> | 
 | 14 | #include <linux/interrupt.h> | 
 | 15 | #include <linux/list.h> | 
 | 16 | #include <linux/timer.h> | 
 | 17 | #include <linux/init.h> | 
| Ben Dooks | b6d1f54 | 2006-12-17 23:22:26 +0100 | [diff] [blame] | 18 | #include <linux/serial_core.h> | 
| Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 19 | #include <linux/platform_device.h> | 
| Russell King | fced80c | 2008-09-06 12:10:45 +0100 | [diff] [blame] | 20 | #include <linux/io.h> | 
| Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 21 | #include <linux/mtd/mtd.h> | 
 | 22 | #include <linux/mtd/nand.h> | 
 | 23 | #include <linux/mtd/nand_ecc.h> | 
 | 24 | #include <linux/mtd/partitions.h> | 
 | 25 |  | 
 | 26 | #include <asm/mach/arch.h> | 
 | 27 | #include <asm/mach/map.h> | 
 | 28 | #include <asm/mach/irq.h> | 
 | 29 |  | 
| Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 30 | #include <mach/hardware.h> | 
| Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 31 | #include <asm/setup.h> | 
| Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 32 | #include <asm/irq.h> | 
 | 33 | #include <asm/mach-types.h> | 
 | 34 |  | 
| Ben Dooks | a2b7ba9 | 2008-10-07 22:26:09 +0100 | [diff] [blame] | 35 | #include <plat/regs-serial.h> | 
| Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 36 | #include <mach/regs-gpio.h> | 
 | 37 | #include <mach/regs-lcd.h> | 
| Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 38 |  | 
| Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 39 | #include <mach/idle.h> | 
 | 40 | #include <mach/fb.h> | 
| Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 41 |  | 
| Ben Dooks | 3e1b776 | 2008-10-31 16:14:40 +0000 | [diff] [blame] | 42 | #include <plat/iic.h> | 
| Ben Dooks | 7926b5a | 2008-10-30 10:14:35 +0000 | [diff] [blame] | 43 | #include <plat/nand.h> | 
| Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 44 |  | 
| Ben Dooks | a2b7ba9 | 2008-10-07 22:26:09 +0100 | [diff] [blame] | 45 | #include <plat/s3c2410.h> | 
| Ben Dooks | d5120ae | 2008-10-07 23:09:51 +0100 | [diff] [blame] | 46 | #include <plat/s3c2412.h> | 
 | 47 | #include <plat/clock.h> | 
| Ben Dooks | a2b7ba9 | 2008-10-07 22:26:09 +0100 | [diff] [blame] | 48 | #include <plat/devs.h> | 
 | 49 | #include <plat/cpu.h> | 
| Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 50 |  | 
 | 51 |  | 
 | 52 | static struct map_desc vstms_iodesc[] __initdata = { | 
 | 53 | }; | 
 | 54 |  | 
 | 55 | static struct s3c2410_uartcfg vstms_uartcfgs[] __initdata = { | 
 | 56 | 	[0] = { | 
 | 57 | 		.hwport	     = 0, | 
 | 58 | 		.flags	     = 0, | 
 | 59 | 		.ucon	     = 0x3c5, | 
 | 60 | 		.ulcon	     = 0x03, | 
 | 61 | 		.ufcon	     = 0x51, | 
 | 62 | 	}, | 
 | 63 | 	[1] = { | 
 | 64 | 		.hwport	     = 1, | 
 | 65 | 		.flags	     = 0, | 
 | 66 | 		.ucon	     = 0x3c5, | 
 | 67 | 		.ulcon	     = 0x03, | 
 | 68 | 		.ufcon	     = 0x51, | 
 | 69 | 	}, | 
 | 70 | 	[2] = { | 
 | 71 | 		.hwport	     = 2, | 
 | 72 | 		.flags	     = 0, | 
 | 73 | 		.ucon	     = 0x3c5, | 
 | 74 | 		.ulcon	     = 0x03, | 
 | 75 | 		.ufcon	     = 0x51, | 
 | 76 | 	} | 
 | 77 | }; | 
 | 78 |  | 
| Ben Dooks | 2a3a180 | 2009-09-28 13:59:49 +0300 | [diff] [blame] | 79 | static struct mtd_partition __initdata vstms_nand_part[] = { | 
| Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 80 | 	[0] = { | 
 | 81 | 		.name	= "Boot Agent", | 
 | 82 | 		.size	= 0x7C000, | 
 | 83 | 		.offset	= 0, | 
 | 84 | 	}, | 
 | 85 | 	[1] = { | 
 | 86 | 		.name	= "UBoot Config", | 
 | 87 | 		.offset = 0x7C000, | 
 | 88 | 		.size	= 0x4000, | 
 | 89 | 	}, | 
 | 90 | 	[2] = { | 
 | 91 | 		.name	= "Kernel", | 
 | 92 | 		.offset = 0x80000, | 
 | 93 | 		.size	= 0x200000, | 
 | 94 | 	}, | 
 | 95 | 	[3] = { | 
 | 96 | 		.name	= "RFS", | 
 | 97 | 		.offset	= 0x280000, | 
 | 98 | 		.size	= 0x3d80000, | 
 | 99 | 	}, | 
 | 100 | }; | 
 | 101 |  | 
| Ben Dooks | 2a3a180 | 2009-09-28 13:59:49 +0300 | [diff] [blame] | 102 | static struct s3c2410_nand_set __initdata vstms_nand_sets[] = { | 
| Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 103 | 	[0] = { | 
 | 104 | 		.name		= "NAND", | 
 | 105 | 		.nr_chips	= 1, | 
 | 106 | 		.nr_partitions	= ARRAY_SIZE(vstms_nand_part), | 
 | 107 | 		.partitions	= vstms_nand_part, | 
 | 108 | 	}, | 
 | 109 | }; | 
 | 110 |  | 
 | 111 | /* choose a set of timings which should suit most 512Mbit | 
 | 112 |  * chips and beyond. | 
 | 113 | */ | 
 | 114 |  | 
| Ben Dooks | 2a3a180 | 2009-09-28 13:59:49 +0300 | [diff] [blame] | 115 | static struct s3c2410_platform_nand __initdata vstms_nand_info = { | 
| Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 116 | 	.tacls		= 20, | 
 | 117 | 	.twrph0		= 60, | 
 | 118 | 	.twrph1		= 20, | 
 | 119 | 	.nr_sets	= ARRAY_SIZE(vstms_nand_sets), | 
 | 120 | 	.sets		= vstms_nand_sets, | 
 | 121 | }; | 
 | 122 |  | 
 | 123 | static struct platform_device *vstms_devices[] __initdata = { | 
| Ben Dooks | b813248 | 2009-11-23 00:13:39 +0000 | [diff] [blame] | 124 | 	&s3c_device_ohci, | 
| Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 125 | 	&s3c_device_wdt, | 
| Ben Dooks | 3e1b776 | 2008-10-31 16:14:40 +0000 | [diff] [blame] | 126 | 	&s3c_device_i2c0, | 
| Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 127 | 	&s3c_device_iis, | 
 | 128 | 	&s3c_device_rtc, | 
 | 129 | 	&s3c_device_nand, | 
 | 130 | }; | 
 | 131 |  | 
| Russell King | 0744a3e | 2010-12-20 10:37:50 +0000 | [diff] [blame] | 132 | static void __init vstms_fixup(struct tag *tags, char **cmdline, | 
 | 133 | 			       struct meminfo *mi) | 
| Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 134 | { | 
 | 135 | 	if (tags != phys_to_virt(S3C2410_SDRAM_PA + 0x100)) { | 
 | 136 | 		mi->nr_banks=1; | 
 | 137 | 		mi->bank[0].start = 0x30000000; | 
 | 138 | 		mi->bank[0].size = SZ_64M; | 
| Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 139 | 	} | 
 | 140 | } | 
 | 141 |  | 
 | 142 | static void __init vstms_map_io(void) | 
 | 143 | { | 
| Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 144 | 	s3c24xx_init_io(vstms_iodesc, ARRAY_SIZE(vstms_iodesc)); | 
 | 145 | 	s3c24xx_init_clocks(12000000); | 
 | 146 | 	s3c24xx_init_uarts(vstms_uartcfgs, ARRAY_SIZE(vstms_uartcfgs)); | 
| Ben Dooks | 57e5171 | 2007-04-20 11:19:16 +0100 | [diff] [blame] | 147 | } | 
 | 148 |  | 
 | 149 | static void __init vstms_init(void) | 
 | 150 | { | 
| Ben Dooks | 3e1b776 | 2008-10-31 16:14:40 +0000 | [diff] [blame] | 151 | 	s3c_i2c0_set_platdata(NULL); | 
| Ben Dooks | 2a3a180 | 2009-09-28 13:59:49 +0300 | [diff] [blame] | 152 | 	s3c_nand_set_platdata(&vstms_nand_info); | 
 | 153 |  | 
| Ben Dooks | 57e5171 | 2007-04-20 11:19:16 +0100 | [diff] [blame] | 154 | 	platform_add_devices(vstms_devices, ARRAY_SIZE(vstms_devices)); | 
| Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 155 | } | 
 | 156 |  | 
 | 157 | MACHINE_START(VSTMS, "VSTMS") | 
| Nicolas Pitre | 69d5071 | 2011-07-05 22:38:17 -0400 | [diff] [blame] | 158 | 	.atag_offset	= 0x100, | 
| Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 159 |  | 
 | 160 | 	.fixup		= vstms_fixup, | 
 | 161 | 	.init_irq	= s3c24xx_init_irq, | 
| Ben Dooks | 57e5171 | 2007-04-20 11:19:16 +0100 | [diff] [blame] | 162 | 	.init_machine	= vstms_init, | 
| Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 163 | 	.map_io		= vstms_map_io, | 
 | 164 | 	.timer		= &s3c24xx_timer, | 
| Heiko Stuebner | 5753897 | 2011-12-22 23:37:44 +0100 | [diff] [blame] | 165 | 	.restart	= s3c2412_restart, | 
| Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 166 | MACHINE_END |