Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mtd: OneNAND: Detect the correct NOP when 4KiB pagesize

There are two different 4KiB pagesize chips
KFM4G16Q4M series have NOP 4 with version ID 0x0131
But KFM4G16Q5M has NOP 1 with versoin ID 0x013e

Note that Q5M means that it has NOP 1.

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>

authored by

Kyungmin Park and committed by
Artem Bityutskiy
e1c10243 b2a5a487

+19
+15
drivers/mtd/onenand/onenand_base.c
··· 3429 3429 else if (numbufs == 1) { 3430 3430 this->options |= ONENAND_HAS_4KB_PAGE; 3431 3431 this->options |= ONENAND_HAS_CACHE_PROGRAM; 3432 + /* 3433 + * There are two different 4KiB pagesize chips 3434 + * and no way to detect it by H/W config values. 3435 + * 3436 + * To detect the correct NOP for each chips, 3437 + * It should check the version ID as workaround. 3438 + * 3439 + * Now it has as following 3440 + * KFM4G16Q4M has NOP 4 with version ID 0x0131 3441 + * KFM4G16Q5M has NOP 1 with versoin ID 0x013e 3442 + */ 3443 + if ((this->version_id & 0xf) == 0xe) 3444 + this->options |= ONENAND_HAS_NOP_1; 3432 3445 } 3433 3446 3434 3447 case ONENAND_DEVICE_DENSITY_2Gb: ··· 4067 4054 this->ecclayout = &onenand_oob_128; 4068 4055 mtd->subpage_sft = 2; 4069 4056 } 4057 + if (ONENAND_IS_NOP_1(this)) 4058 + mtd->subpage_sft = 0; 4070 4059 break; 4071 4060 case 64: 4072 4061 this->ecclayout = &onenand_oob_64;
+4
include/linux/mtd/onenand.h
··· 184 184 #define ONENAND_IS_CACHE_PROGRAM(this) \ 185 185 (this->options & ONENAND_HAS_CACHE_PROGRAM) 186 186 187 + #define ONENAND_IS_NOP_1(this) \ 188 + (this->options & ONENAND_HAS_NOP_1) 189 + 187 190 /* Check byte access in OneNAND */ 188 191 #define ONENAND_CHECK_BYTE_ACCESS(addr) (addr & 0x1) 189 192 ··· 198 195 #define ONENAND_HAS_2PLANE (0x0004) 199 196 #define ONENAND_HAS_4KB_PAGE (0x0008) 200 197 #define ONENAND_HAS_CACHE_PROGRAM (0x0010) 198 + #define ONENAND_HAS_NOP_1 (0x0020) 201 199 #define ONENAND_SKIP_UNLOCK_CHECK (0x0100) 202 200 #define ONENAND_PAGEBUF_ALLOC (0x1000) 203 201 #define ONENAND_OOBBUF_ALLOC (0x2000)