Ben Dooks | d3f4c57 | 2006-04-01 18:33:42 +0100 | [diff] [blame] | 1 | /* linux/arch/arm/mach-s3c2410/common-smdk.c |
| 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> |
| 21 | #include <linux/platform_device.h> |
| 22 | |
Ben Dooks | dee9b2e | 2006-04-02 10:00:09 +0100 | [diff] [blame] | 23 | #include <linux/mtd/mtd.h> |
| 24 | #include <linux/mtd/nand.h> |
| 25 | #include <linux/mtd/nand_ecc.h> |
| 26 | #include <linux/mtd/partitions.h> |
| 27 | |
Ben Dooks | d3f4c57 | 2006-04-01 18:33:42 +0100 | [diff] [blame] | 28 | #include <asm/mach/arch.h> |
| 29 | #include <asm/mach/map.h> |
| 30 | #include <asm/mach/irq.h> |
| 31 | |
| 32 | #include <asm/hardware.h> |
| 33 | #include <asm/io.h> |
| 34 | #include <asm/irq.h> |
Ben Dooks | d3f4c57 | 2006-04-01 18:33:42 +0100 | [diff] [blame] | 35 | |
| 36 | #include <asm/arch/regs-gpio.h> |
| 37 | |
Ben Dooks | dee9b2e | 2006-04-02 10:00:09 +0100 | [diff] [blame] | 38 | #include <asm/arch/nand.h> |
| 39 | |
Ben Dooks | 13011d0 | 2006-04-09 22:21:09 +0100 | [diff] [blame] | 40 | #include "common-smdk.h" |
Ben Dooks | dee9b2e | 2006-04-02 10:00:09 +0100 | [diff] [blame] | 41 | #include "devs.h" |
Ben Dooks | d3f4c57 | 2006-04-01 18:33:42 +0100 | [diff] [blame] | 42 | #include "pm.h" |
| 43 | |
Ben Dooks | dee9b2e | 2006-04-02 10:00:09 +0100 | [diff] [blame] | 44 | /* NAND parititon from 2.4.18-swl5 */ |
| 45 | |
| 46 | static struct mtd_partition smdk_default_nand_part[] = { |
| 47 | [0] = { |
| 48 | .name = "Boot Agent", |
| 49 | .size = SZ_16K, |
| 50 | .offset = 0, |
| 51 | }, |
| 52 | [1] = { |
Ben Dooks | f683554 | 2006-04-13 09:57:15 +0100 | [diff] [blame^] | 53 | .name = "S3C2410 flash partition 1", |
Ben Dooks | dee9b2e | 2006-04-02 10:00:09 +0100 | [diff] [blame] | 54 | .offset = 0, |
| 55 | .size = SZ_2M, |
| 56 | }, |
| 57 | [2] = { |
| 58 | .name = "S3C2410 flash partition 2", |
| 59 | .offset = SZ_4M, |
| 60 | .size = SZ_4M, |
| 61 | }, |
| 62 | [3] = { |
| 63 | .name = "S3C2410 flash partition 3", |
| 64 | .offset = SZ_8M, |
| 65 | .size = SZ_2M, |
| 66 | }, |
| 67 | [4] = { |
| 68 | .name = "S3C2410 flash partition 4", |
| 69 | .offset = SZ_1M * 10, |
| 70 | .size = SZ_4M, |
| 71 | }, |
| 72 | [5] = { |
| 73 | .name = "S3C2410 flash partition 5", |
| 74 | .offset = SZ_1M * 14, |
| 75 | .size = SZ_1M * 10, |
| 76 | }, |
| 77 | [6] = { |
| 78 | .name = "S3C2410 flash partition 6", |
| 79 | .offset = SZ_1M * 24, |
| 80 | .size = SZ_1M * 24, |
| 81 | }, |
| 82 | [7] = { |
| 83 | .name = "S3C2410 flash partition 7", |
| 84 | .offset = SZ_1M * 48, |
| 85 | .size = SZ_16M, |
| 86 | } |
| 87 | }; |
| 88 | |
| 89 | static struct s3c2410_nand_set smdk_nand_sets[] = { |
| 90 | [0] = { |
| 91 | .name = "NAND", |
| 92 | .nr_chips = 1, |
| 93 | .nr_partitions = ARRAY_SIZE(smdk_default_nand_part), |
| 94 | .partitions = smdk_default_nand_part, |
| 95 | }, |
| 96 | }; |
| 97 | |
| 98 | /* choose a set of timings which should suit most 512Mbit |
| 99 | * chips and beyond. |
| 100 | */ |
| 101 | |
| 102 | static struct s3c2410_platform_nand smdk_nand_info = { |
| 103 | .tacls = 20, |
| 104 | .twrph0 = 60, |
| 105 | .twrph1 = 20, |
| 106 | .nr_sets = ARRAY_SIZE(smdk_nand_sets), |
| 107 | .sets = smdk_nand_sets, |
| 108 | }; |
| 109 | |
| 110 | /* devices we initialise */ |
| 111 | |
| 112 | static struct platform_device __initdata *smdk_devs[] = { |
| 113 | &s3c_device_nand, |
| 114 | }; |
| 115 | |
Ben Dooks | d3f4c57 | 2006-04-01 18:33:42 +0100 | [diff] [blame] | 116 | void __init smdk_machine_init(void) |
| 117 | { |
| 118 | /* Configure the LEDs (even if we have no LED support)*/ |
| 119 | |
| 120 | s3c2410_gpio_cfgpin(S3C2410_GPF4, S3C2410_GPF4_OUTP); |
| 121 | s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP); |
| 122 | s3c2410_gpio_cfgpin(S3C2410_GPF6, S3C2410_GPF6_OUTP); |
| 123 | s3c2410_gpio_cfgpin(S3C2410_GPF7, S3C2410_GPF7_OUTP); |
| 124 | |
Ben Dooks | 66ce229 | 2006-04-02 10:00:08 +0100 | [diff] [blame] | 125 | s3c2410_gpio_setpin(S3C2410_GPF4, 1); |
| 126 | s3c2410_gpio_setpin(S3C2410_GPF5, 1); |
| 127 | s3c2410_gpio_setpin(S3C2410_GPF6, 1); |
| 128 | s3c2410_gpio_setpin(S3C2410_GPF7, 1); |
Ben Dooks | d3f4c57 | 2006-04-01 18:33:42 +0100 | [diff] [blame] | 129 | |
Ben Dooks | dee9b2e | 2006-04-02 10:00:09 +0100 | [diff] [blame] | 130 | s3c_device_nand.dev.platform_data = &smdk_nand_info; |
| 131 | |
| 132 | platform_add_devices(smdk_devs, ARRAY_SIZE(smdk_devs)); |
| 133 | |
Ben Dooks | d3f4c57 | 2006-04-01 18:33:42 +0100 | [diff] [blame] | 134 | s3c2410_pm_init(); |
| 135 | } |