aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/linux-yocto-3.14/h1940/0006-ARM-s3c24xx-h1940-Add-nand-device.patch
blob: c23984aec5f5c20e83cc428e6495bc0f8c6c64e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
From a63933b7f6b410c478a4fad08ec61f13ef1549a8 Mon Sep 17 00:00:00 2001
From: Vasily Khoruzhick <anarsoul@gmail.com>
Date: Thu, 17 Oct 2013 12:13:29 +0300
Subject: [PATCH 06/17] ARM: s3c24xx: h1940: Add nand device

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
 arch/arm/mach-s3c24xx/mach-h1940.c | 74 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 74 insertions(+)

diff --git a/arch/arm/mach-s3c24xx/mach-h1940.c b/arch/arm/mach-s3c24xx/mach-h1940.c
index de08321..1b3807e 100644
--- a/arch/arm/mach-s3c24xx/mach-h1940.c
+++ b/arch/arm/mach-s3c24xx/mach-h1940.c
@@ -31,6 +31,9 @@
 #include <linux/s3c_adc_battery.h>
 #include <linux/delay.h>
 
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
+
 #include <video/platform_lcd.h>
 
 #include <linux/mmc/host.h>
@@ -46,6 +49,7 @@
 #include <linux/platform_data/mmc-s3cmci.h>
 #include <linux/platform_data/touchscreen-s3c2410.h>
 #include <linux/platform_data/usb-s3c2410_udc.h>
+#include <linux/platform_data/mtd-nand-s3c2410.h>
 
 #include <sound/uda1380.h>
 
@@ -466,6 +470,74 @@ static struct s3c24xx_mci_pdata h1940_mmc_cfg __initdata = {
 	.ocr_avail     = MMC_VDD_32_33,
 };
 
+static struct mtd_partition h1940_nand_part[] = {
+	[0] = {
+			.name = "Boot0",
+			.offset = 0,
+			.size = SZ_16K,
+			.mask_flags = MTD_WRITEABLE,
+	},
+	[1] = {
+			.name = "Boot1",
+			.offset = MTDPART_OFS_APPEND,
+			.size = SZ_1K * 240,
+			.mask_flags = 0,
+	},
+	[2] = {
+			.name = "Env",
+			.offset = MTDPART_OFS_APPEND,
+			.size = SZ_16K,
+			.mask_flags = 0,
+	},
+	[3] = {
+			.name = "Opts",
+			.offset = MTDPART_OFS_APPEND,
+			.size = SZ_32K,
+			.mask_flags = 0,
+	},
+	[4] = {
+			.name = "Kernel",
+			.offset = MTDPART_OFS_APPEND,
+			.size = SZ_1M * 3,
+			.mask_flags = 0,
+	},
+	[5] = {
+			.name = "Filesystem",
+			.offset = MTDPART_OFS_APPEND,
+			.size = MTDPART_SIZ_FULL,
+			.mask_flags = 0,
+	},
+};
+
+static struct nand_ecclayout h1940_ecc_layout = {
+	.eccbytes = 3,
+	.eccpos = {
+		8, 9, 10
+	},
+	.oobfree = {
+		{2, 6},
+		{11, 5}
+	}
+};
+
+static struct s3c2410_nand_set h1940_nand_sets[] = {
+	[0] = {
+		.name = "Internal",
+		.nr_chips = 1,
+		.nr_partitions = ARRAY_SIZE(h1940_nand_part),
+		.partitions = h1940_nand_part,
+		.ecc_layout = &h1940_ecc_layout,
+	},
+};
+
+static struct s3c2410_platform_nand h1940_nand_info = {
+	.tacls = 14,
+	.twrph0 = 44,
+	.twrph1 = 20,
+	.nr_sets = ARRAY_SIZE(h1940_nand_sets),
+	.sets = h1940_nand_sets,
+};
+
 static int h1940_backlight_init(struct device *dev)
 {
 	gpio_request(S3C2410_GPB(0), "Backlight");
@@ -634,6 +706,7 @@ static struct platform_device *h1940_devices[] __initdata = {
 	&h1940_device_bluetooth,
 	&s3c_device_sdi,
 	&s3c_device_rtc,
+	&s3c_device_nand,
 	&samsung_device_pwm,
 	&h1940_backlight,
 	&h1940_lcd_powerdev,
@@ -678,6 +751,7 @@ static void __init h1940_init(void)
  	s3c24xx_udc_set_platdata(&h1940_udc_cfg);
 	s3c24xx_ts_set_platdata(&h1940_ts_cfg);
 	s3c_i2c0_set_platdata(NULL);
+	s3c_nand_set_platdata(&h1940_nand_info);
 
 	/* Turn off suspend on both USB ports, and switch the
 	 * selectable USB port to USB device mode. */
-- 
1.9.3