summaryrefslogtreecommitdiff
path: root/recipes-kernel/linux/files/0001-Revert-colibri_t20-initial-16-bit-BCH-ECC-support.patch
blob: b823fff9d34ec92d2b1e0974501d50c7d40b9777 (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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
From 96342c6c5d642c5fc762e73aac1b916aaeee017b Mon Sep 17 00:00:00 2001
From: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Date: Thu, 8 Nov 2018 13:05:42 +0100
Subject: [PATCH] Revert "colibri_t20: initial 16-bit BCH ECC support"

This reverts commit 834b98d0367931d6bec5a48fe87fddd9b877f688.

For compatibility with BSP V2.3 which still uses RS4 ECC.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
---

 arch/arm/configs/colibri_t20_android_defconfig |  3 ++-
 arch/arm/configs/colibri_t20_defconfig         |  3 ++-
 drivers/mtd/devices/tegra_nand.c               | 16 +++++-----------
 drivers/mtd/devices/tegra_nand.h               |  7 -------
 4 files changed, 9 insertions(+), 20 deletions(-)

diff --git a/arch/arm/configs/colibri_t20_android_defconfig b/arch/arm/configs/colibri_t20_android_defconfig
index 09780945a35a..eebe621e7f84 100644
--- a/arch/arm/configs/colibri_t20_android_defconfig
+++ b/arch/arm/configs/colibri_t20_android_defconfig
@@ -186,7 +186,6 @@ CONFIG_MTD_BLOCK=y
 CONFIG_MTD_NAND_TEGRA=y
 CONFIG_MTD_NAND=y
 CONFIG_MTD_UBI=y
-CONFIG_MTD_UBI_FASTMAP=y
 CONFIG_BLK_DEV_LOOP=y
 CONFIG_MISC_DEVICES=y
 CONFIG_UID_STAT=y
@@ -367,6 +366,8 @@ CONFIG_VFAT_FS=y
 CONFIG_NTFS_FS=y
 CONFIG_TMPFS=y
 CONFIG_TMPFS_POSIX_ACL=y
+CONFIG_YAFFS_FS=y
+CONFIG_YAFFS_DISABLE_TAGS_ECC=y
 CONFIG_UBIFS_FS=y
 CONFIG_NFS_FS=y
 CONFIG_NFS_V3=y
diff --git a/arch/arm/configs/colibri_t20_defconfig b/arch/arm/configs/colibri_t20_defconfig
index 552c34ee42b8..dc0133d7223d 100644
--- a/arch/arm/configs/colibri_t20_defconfig
+++ b/arch/arm/configs/colibri_t20_defconfig
@@ -152,7 +152,6 @@ CONFIG_MTD_BLOCK=y
 CONFIG_MTD_NAND_TEGRA=y
 CONFIG_MTD_NAND=y
 CONFIG_MTD_UBI=y
-CONFIG_MTD_UBI_FASTMAP=y
 CONFIG_BLK_DEV_LOOP=y
 CONFIG_MISC_DEVICES=y
 CONFIG_UID_STAT=y
@@ -325,6 +324,8 @@ CONFIG_FUSE_FS=y
 CONFIG_CUSE=y
 CONFIG_VFAT_FS=y
 CONFIG_TMPFS=y
+CONFIG_YAFFS_FS=y
+CONFIG_YAFFS_DISABLE_TAGS_ECC=y
 CONFIG_UBIFS_FS=y
 CONFIG_NFS_FS=y
 CONFIG_NFS_V3=y
diff --git a/drivers/mtd/devices/tegra_nand.c b/drivers/mtd/devices/tegra_nand.c
index 0a9edfdb8ba2..6034f0b2f239 100644
--- a/drivers/mtd/devices/tegra_nand.c
+++ b/drivers/mtd/devices/tegra_nand.c
@@ -121,7 +121,6 @@ struct tegra_nand_info {
 	uint32_t command_reg;
 	uint32_t config_reg;
 	uint32_t dmactrl_reg;
-	uint32_t bch_config_reg;
 
 	struct completion cmd_complete;
 	struct completion dma_complete;
@@ -234,7 +233,6 @@ static struct {
 	REG_NAME(DEC_STATUS_REG),
 	REG_NAME(HWSTATUS_CMD_REG),
 	REG_NAME(HWSTATUS_MASK_REG),
-	REG_NAME(BCH_CONFIG_REG),
 	{0, NULL},
 };
 
@@ -394,7 +392,6 @@ static void tegra_nand_prep_readid(struct tegra_nand_info *info)
 	writel(0, ADDR_REG1);
 	writel(0, ADDR_REG2);
 	writel(0, CONFIG_REG);
-	writel(0, BCH_CONFIG_REG);
 }
 
 static int
@@ -454,7 +451,6 @@ static int tegra_nand_cmd_reset(struct tegra_nand_info *info,
 	writel(0, ADDR_REG1);
 	writel(0, ADDR_REG2);
 	writel(0, CONFIG_REG);
-	writel(0, BCH_CONFIG_REG);
 
 	err = tegra_nand_go(info);
 	if (err != 0)
@@ -793,7 +789,6 @@ static inline void clear_regs(struct tegra_nand_info *info)
 	info->command_reg = 0;
 	info->config_reg = 0;
 	info->dmactrl_reg = 0;
-	info->bch_config_reg = 0;
 }
 
 static void
@@ -825,7 +820,7 @@ prep_transfer_dma(struct tegra_nand_info *info, int rx, int do_ecc,
 
 	if (rx) {
 		if (do_ecc)
-			info->bch_config_reg |= (BCH_CONFIG_BCH_TVALUE(3) | BCH_CONFIG_BCH_ECC);
+			info->config_reg |= CONFIG_HW_ERR_CORRECTION;
 		info->command_reg |= COMMAND_RX;
 		info->dmactrl_reg |= DMA_CTRL_REUSE_BUFFER;
 		writel(NAND_CMD_READ0, CMD_REG1);
@@ -838,8 +833,10 @@ prep_transfer_dma(struct tegra_nand_info *info, int rx, int do_ecc,
 	}
 
 	if (data_len) {
+		if (do_ecc)
+			info->config_reg |= CONFIG_HW_ECC | CONFIG_ECC_SEL;
 		info->config_reg |=
-		    CONFIG_PAGE_SIZE_SEL(page_size_sel) |
+		    CONFIG_PAGE_SIZE_SEL(page_size_sel) | CONFIG_TVALUE(0) |
 		    CONFIG_SKIP_SPARE | CONFIG_SKIP_SPARE_SEL(0);
 		info->command_reg |= COMMAND_A_VALID;
 		info->dmactrl_reg |= DMA_CTRL_DMA_EN_A;
@@ -860,6 +857,7 @@ prep_transfer_dma(struct tegra_nand_info *info, int rx, int do_ecc,
 			tag_sz += 4;	/* size of tag ecc */
 			if (rx)
 				oob_len += 4; /* size of tag ecc */
+			info->config_reg |= CONFIG_ECC_EN_TAG;
 		}
 		if (data_len && rx)
 			oob_len += 4; /* num of skipped bytes */
@@ -1041,7 +1039,6 @@ do_read_oob(struct mtd_info *mtd, loff_t from, struct mtd_oob_ops *ops)
 				  datbuf_dma_addr, a_len, info->oob_dma_addr,
 				  b_len);
 		writel(info->config_reg, CONFIG_REG);
-		writel(info->bch_config_reg, BCH_CONFIG_REG);
 		writel(info->dmactrl_reg, DMA_MST_CTRL_REG);
 
 		INIT_COMPLETION(info->dma_complete);
@@ -1245,7 +1242,6 @@ do_write_oob(struct mtd_info *mtd, loff_t to, struct mtd_oob_ops *ops)
 				  b_len);
 
 		writel(info->config_reg, CONFIG_REG);
-		writel(info->bch_config_reg, BCH_CONFIG_REG);
 		writel(info->dmactrl_reg, DMA_MST_CTRL_REG);
 
 		INIT_COMPLETION(info->dma_complete);
@@ -1378,7 +1374,6 @@ static void tegra_nand_resume(struct mtd_info *mtd)
 		    IER_ECC_ERR | IER_GIE);
 
 	writel(0, CONFIG_REG);
-	writel(0, BCH_CONFIG_REG);
 
 	set_chip_timing(info, info->vendor_id,
 				info->device_id, info->dev_parms);
@@ -1432,7 +1427,6 @@ static int tegra_nand_scan(struct mtd_info *mtd, int maxchips)
 	writel(SCAN_TIMING_VAL, TIMING_REG);
 	writel(SCAN_TIMING2_VAL, TIMING2_REG);
 	writel(0, CONFIG_REG);
-	writel(0, BCH_CONFIG_REG);
 
 	select_chip(info, 0);
 
diff --git a/drivers/mtd/devices/tegra_nand.h b/drivers/mtd/devices/tegra_nand.h
index 64d66381f8b1..339d6cc7330c 100644
--- a/drivers/mtd/devices/tegra_nand.h
+++ b/drivers/mtd/devices/tegra_nand.h
@@ -56,9 +56,6 @@
 #define LL_CONFIG_REG				(TEGRA_NAND_BASE + 0x58)
 #define LL_PTR_REG				(TEGRA_NAND_BASE + 0x5c)
 #define LL_STATUS_REG				(TEGRA_NAND_BASE + 0x60)
-#define BCH_CONFIG_REG				(TEGRA_NAND_BASE + 0xcc)
-#define BCH_DEC_RESULT_REG			(TEGRA_NAND_BASE + 0xd0)
-#define BCH_DEC_STATUS_BUF_REG			(TEGRA_NAND_BASE + 0xd4)
 
 /* nand_command bits */
 #define COMMAND_GO				REG_BIT(31)
@@ -147,9 +144,5 @@
 #define HWSTATUS_RBSY_MASK(val)			REG_FIELD((val), 8, 8)
 #define HWSTATUS_RBSY_EXP_VAL(val)		REG_FIELD((val), 0, 8)
 
-/* nand bch config bits */
-#define BCH_CONFIG_BCH_TVALUE(val)		REG_FIELD((val), 4, 2)
-#define BCH_CONFIG_BCH_ECC			REG_BIT(0)
-
 #endif
 
-- 
2.14.5