| Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 1 | /* linux/arch/arm/plat-s3c24xx/common-smdk.c | 
| Ben Dooks | d3f4c57 | 2006-04-01 18:33:42 +0100 | [diff] [blame] | 2 |  * | 
 | 3 |  * Copyright (c) 2006 Simtec Electronics | 
 | 4 |  *	Ben Dooks <ben@simtec.co.uk> | 
 | 5 |  * | 
 | 6 |  * Common code for SMDK2410 and SMDK2440 boards | 
 | 7 |  * | 
 | 8 |  * http://www.fluff.org/ben/smdk2440/ | 
 | 9 |  * | 
 | 10 |  * This program is free software; you can redistribute it and/or modify | 
 | 11 |  * it under the terms of the GNU General Public License version 2 as | 
 | 12 |  * published by the Free Software Foundation. | 
 | 13 | */ | 
 | 14 |  | 
 | 15 | #include <linux/kernel.h> | 
 | 16 | #include <linux/types.h> | 
 | 17 | #include <linux/interrupt.h> | 
 | 18 | #include <linux/list.h> | 
 | 19 | #include <linux/timer.h> | 
 | 20 | #include <linux/init.h> | 
| Ben Dooks | 333a42e | 2007-05-20 11:55:53 +0100 | [diff] [blame] | 21 | #include <linux/sysdev.h> | 
| Ben Dooks | d3f4c57 | 2006-04-01 18:33:42 +0100 | [diff] [blame] | 22 | #include <linux/platform_device.h> | 
 | 23 |  | 
| Ben Dooks | dee9b2e | 2006-04-02 10:00:09 +0100 | [diff] [blame] | 24 | #include <linux/mtd/mtd.h> | 
 | 25 | #include <linux/mtd/nand.h> | 
 | 26 | #include <linux/mtd/nand_ecc.h> | 
 | 27 | #include <linux/mtd/partitions.h> | 
 | 28 |  | 
| Ben Dooks | d3f4c57 | 2006-04-01 18:33:42 +0100 | [diff] [blame] | 29 | #include <asm/mach/arch.h> | 
 | 30 | #include <asm/mach/map.h> | 
 | 31 | #include <asm/mach/irq.h> | 
 | 32 |  | 
| Ben Dooks | 42482e3 | 2007-05-20 19:58:10 +0100 | [diff] [blame] | 33 | #include <asm/mach-types.h> | 
| Ben Dooks | d3f4c57 | 2006-04-01 18:33:42 +0100 | [diff] [blame] | 34 | #include <asm/hardware.h> | 
 | 35 | #include <asm/io.h> | 
 | 36 | #include <asm/irq.h> | 
| Ben Dooks | d3f4c57 | 2006-04-01 18:33:42 +0100 | [diff] [blame] | 37 |  | 
 | 38 | #include <asm/arch/regs-gpio.h> | 
| Ben Dooks | 810c894 | 2006-06-18 22:56:37 +0100 | [diff] [blame] | 39 | #include <asm/arch/leds-gpio.h> | 
| Ben Dooks | d3f4c57 | 2006-04-01 18:33:42 +0100 | [diff] [blame] | 40 |  | 
| Ben Dooks | 531b617 | 2007-07-22 16:05:25 +0100 | [diff] [blame] | 41 | #include <asm/plat-s3c/nand.h> | 
| Ben Dooks | dee9b2e | 2006-04-02 10:00:09 +0100 | [diff] [blame] | 42 |  | 
| Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 43 | #include <asm/plat-s3c24xx/common-smdk.h> | 
 | 44 | #include <asm/plat-s3c24xx/devs.h> | 
 | 45 | #include <asm/plat-s3c24xx/pm.h> | 
| Ben Dooks | d3f4c57 | 2006-04-01 18:33:42 +0100 | [diff] [blame] | 46 |  | 
| Ben Dooks | 810c894 | 2006-06-18 22:56:37 +0100 | [diff] [blame] | 47 | /* LED devices */ | 
 | 48 |  | 
 | 49 | static struct s3c24xx_led_platdata smdk_pdata_led4 = { | 
 | 50 | 	.gpio		= S3C2410_GPF4, | 
 | 51 | 	.flags		= S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE, | 
 | 52 | 	.name		= "led4", | 
 | 53 | 	.def_trigger	= "timer", | 
 | 54 | }; | 
 | 55 |  | 
 | 56 | static struct s3c24xx_led_platdata smdk_pdata_led5 = { | 
 | 57 | 	.gpio		= S3C2410_GPF5, | 
 | 58 | 	.flags		= S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE, | 
 | 59 | 	.name		= "led5", | 
 | 60 | 	.def_trigger	= "nand-disk", | 
 | 61 | }; | 
 | 62 |  | 
 | 63 | static struct s3c24xx_led_platdata smdk_pdata_led6 = { | 
 | 64 | 	.gpio		= S3C2410_GPF6, | 
 | 65 | 	.flags		= S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE, | 
 | 66 | 	.name		= "led6", | 
 | 67 | }; | 
 | 68 |  | 
 | 69 | static struct s3c24xx_led_platdata smdk_pdata_led7 = { | 
 | 70 | 	.gpio		= S3C2410_GPF7, | 
 | 71 | 	.flags		= S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE, | 
 | 72 | 	.name		= "led7", | 
 | 73 | }; | 
 | 74 |  | 
 | 75 | static struct platform_device smdk_led4 = { | 
 | 76 | 	.name		= "s3c24xx_led", | 
 | 77 | 	.id		= 0, | 
 | 78 | 	.dev		= { | 
 | 79 | 		.platform_data = &smdk_pdata_led4, | 
 | 80 | 	}, | 
 | 81 | }; | 
 | 82 |  | 
 | 83 | static struct platform_device smdk_led5 = { | 
 | 84 | 	.name		= "s3c24xx_led", | 
 | 85 | 	.id		= 1, | 
 | 86 | 	.dev		= { | 
 | 87 | 		.platform_data = &smdk_pdata_led5, | 
 | 88 | 	}, | 
 | 89 | }; | 
 | 90 |  | 
 | 91 | static struct platform_device smdk_led6 = { | 
 | 92 | 	.name		= "s3c24xx_led", | 
 | 93 | 	.id		= 2, | 
 | 94 | 	.dev		= { | 
 | 95 | 		.platform_data = &smdk_pdata_led6, | 
 | 96 | 	}, | 
 | 97 | }; | 
 | 98 |  | 
 | 99 | static struct platform_device smdk_led7 = { | 
 | 100 | 	.name		= "s3c24xx_led", | 
 | 101 | 	.id		= 3, | 
 | 102 | 	.dev		= { | 
 | 103 | 		.platform_data = &smdk_pdata_led7, | 
 | 104 | 	}, | 
 | 105 | }; | 
 | 106 |  | 
| Ben Dooks | dee9b2e | 2006-04-02 10:00:09 +0100 | [diff] [blame] | 107 | /* NAND parititon from 2.4.18-swl5 */ | 
 | 108 |  | 
 | 109 | static struct mtd_partition smdk_default_nand_part[] = { | 
 | 110 | 	[0] = { | 
 | 111 | 		.name	= "Boot Agent", | 
 | 112 | 		.size	= SZ_16K, | 
 | 113 | 		.offset	= 0, | 
 | 114 | 	}, | 
 | 115 | 	[1] = { | 
| Ben Dooks | f683554 | 2006-04-13 09:57:15 +0100 | [diff] [blame] | 116 | 		.name	= "S3C2410 flash partition 1", | 
| Ben Dooks | dee9b2e | 2006-04-02 10:00:09 +0100 | [diff] [blame] | 117 | 		.offset = 0, | 
 | 118 | 		.size	= SZ_2M, | 
 | 119 | 	}, | 
 | 120 | 	[2] = { | 
 | 121 | 		.name	= "S3C2410 flash partition 2", | 
 | 122 | 		.offset = SZ_4M, | 
 | 123 | 		.size	= SZ_4M, | 
 | 124 | 	}, | 
 | 125 | 	[3] = { | 
 | 126 | 		.name	= "S3C2410 flash partition 3", | 
 | 127 | 		.offset	= SZ_8M, | 
 | 128 | 		.size	= SZ_2M, | 
 | 129 | 	}, | 
 | 130 | 	[4] = { | 
 | 131 | 		.name	= "S3C2410 flash partition 4", | 
 | 132 | 		.offset = SZ_1M * 10, | 
 | 133 | 		.size	= SZ_4M, | 
 | 134 | 	}, | 
 | 135 | 	[5] = { | 
 | 136 | 		.name	= "S3C2410 flash partition 5", | 
 | 137 | 		.offset	= SZ_1M * 14, | 
 | 138 | 		.size	= SZ_1M * 10, | 
 | 139 | 	}, | 
 | 140 | 	[6] = { | 
 | 141 | 		.name	= "S3C2410 flash partition 6", | 
 | 142 | 		.offset	= SZ_1M * 24, | 
 | 143 | 		.size	= SZ_1M * 24, | 
 | 144 | 	}, | 
 | 145 | 	[7] = { | 
 | 146 | 		.name	= "S3C2410 flash partition 7", | 
 | 147 | 		.offset = SZ_1M * 48, | 
 | 148 | 		.size	= SZ_16M, | 
 | 149 | 	} | 
 | 150 | }; | 
 | 151 |  | 
 | 152 | static struct s3c2410_nand_set smdk_nand_sets[] = { | 
 | 153 | 	[0] = { | 
 | 154 | 		.name		= "NAND", | 
 | 155 | 		.nr_chips	= 1, | 
 | 156 | 		.nr_partitions	= ARRAY_SIZE(smdk_default_nand_part), | 
 | 157 | 		.partitions	= smdk_default_nand_part, | 
 | 158 | 	}, | 
 | 159 | }; | 
 | 160 |  | 
 | 161 | /* choose a set of timings which should suit most 512Mbit | 
 | 162 |  * chips and beyond. | 
 | 163 | */ | 
 | 164 |  | 
 | 165 | static struct s3c2410_platform_nand smdk_nand_info = { | 
 | 166 | 	.tacls		= 20, | 
 | 167 | 	.twrph0		= 60, | 
 | 168 | 	.twrph1		= 20, | 
 | 169 | 	.nr_sets	= ARRAY_SIZE(smdk_nand_sets), | 
 | 170 | 	.sets		= smdk_nand_sets, | 
 | 171 | }; | 
 | 172 |  | 
 | 173 | /* devices we initialise */ | 
 | 174 |  | 
 | 175 | static struct platform_device __initdata *smdk_devs[] = { | 
 | 176 | 	&s3c_device_nand, | 
| Ben Dooks | 810c894 | 2006-06-18 22:56:37 +0100 | [diff] [blame] | 177 | 	&smdk_led4, | 
 | 178 | 	&smdk_led5, | 
 | 179 | 	&smdk_led6, | 
 | 180 | 	&smdk_led7, | 
| Ben Dooks | dee9b2e | 2006-04-02 10:00:09 +0100 | [diff] [blame] | 181 | }; | 
 | 182 |  | 
| Ben Dooks | d3f4c57 | 2006-04-01 18:33:42 +0100 | [diff] [blame] | 183 | void __init smdk_machine_init(void) | 
 | 184 | { | 
 | 185 | 	/* Configure the LEDs (even if we have no LED support)*/ | 
 | 186 |  | 
 | 187 | 	s3c2410_gpio_cfgpin(S3C2410_GPF4, S3C2410_GPF4_OUTP); | 
 | 188 | 	s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP); | 
 | 189 | 	s3c2410_gpio_cfgpin(S3C2410_GPF6, S3C2410_GPF6_OUTP); | 
 | 190 | 	s3c2410_gpio_cfgpin(S3C2410_GPF7, S3C2410_GPF7_OUTP); | 
 | 191 |  | 
| Ben Dooks | 66ce229 | 2006-04-02 10:00:08 +0100 | [diff] [blame] | 192 | 	s3c2410_gpio_setpin(S3C2410_GPF4, 1); | 
 | 193 | 	s3c2410_gpio_setpin(S3C2410_GPF5, 1); | 
 | 194 | 	s3c2410_gpio_setpin(S3C2410_GPF6, 1); | 
 | 195 | 	s3c2410_gpio_setpin(S3C2410_GPF7, 1); | 
| Ben Dooks | d3f4c57 | 2006-04-01 18:33:42 +0100 | [diff] [blame] | 196 |  | 
| Ben Dooks | 42482e3 | 2007-05-20 19:58:10 +0100 | [diff] [blame] | 197 | 	if (machine_is_smdk2443()) | 
 | 198 | 		smdk_nand_info.twrph0 = 50; | 
 | 199 |  | 
| Ben Dooks | dee9b2e | 2006-04-02 10:00:09 +0100 | [diff] [blame] | 200 | 	s3c_device_nand.dev.platform_data = &smdk_nand_info; | 
 | 201 |  | 
 | 202 | 	platform_add_devices(smdk_devs, ARRAY_SIZE(smdk_devs)); | 
 | 203 |  | 
| Ben Dooks | d3f4c57 | 2006-04-01 18:33:42 +0100 | [diff] [blame] | 204 | 	s3c2410_pm_init(); | 
 | 205 | } |