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