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