Commit e1c10243 authored by Kyungmin Park's avatar Kyungmin Park Committed by Artem Bityutskiy

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: default avatarKyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
parent b2a5a487
...@@ -3429,6 +3429,19 @@ static void onenand_check_features(struct mtd_info *mtd) ...@@ -3429,6 +3429,19 @@ static void onenand_check_features(struct mtd_info *mtd)
else if (numbufs == 1) { else if (numbufs == 1) {
this->options |= ONENAND_HAS_4KB_PAGE; this->options |= ONENAND_HAS_4KB_PAGE;
this->options |= ONENAND_HAS_CACHE_PROGRAM; this->options |= ONENAND_HAS_CACHE_PROGRAM;
/*
* There are two different 4KiB pagesize chips
* and no way to detect it by H/W config values.
*
* To detect the correct NOP for each chips,
* It should check the version ID as workaround.
*
* Now it has as following
* KFM4G16Q4M has NOP 4 with version ID 0x0131
* KFM4G16Q5M has NOP 1 with versoin ID 0x013e
*/
if ((this->version_id & 0xf) == 0xe)
this->options |= ONENAND_HAS_NOP_1;
} }
case ONENAND_DEVICE_DENSITY_2Gb: case ONENAND_DEVICE_DENSITY_2Gb:
...@@ -4054,6 +4067,8 @@ int onenand_scan(struct mtd_info *mtd, int maxchips) ...@@ -4054,6 +4067,8 @@ int onenand_scan(struct mtd_info *mtd, int maxchips)
this->ecclayout = &onenand_oob_128; this->ecclayout = &onenand_oob_128;
mtd->subpage_sft = 2; mtd->subpage_sft = 2;
} }
if (ONENAND_IS_NOP_1(this))
mtd->subpage_sft = 0;
break; break;
case 64: case 64:
this->ecclayout = &onenand_oob_64; this->ecclayout = &onenand_oob_64;
......
...@@ -184,6 +184,9 @@ struct onenand_chip { ...@@ -184,6 +184,9 @@ struct onenand_chip {
#define ONENAND_IS_CACHE_PROGRAM(this) \ #define ONENAND_IS_CACHE_PROGRAM(this) \
(this->options & ONENAND_HAS_CACHE_PROGRAM) (this->options & ONENAND_HAS_CACHE_PROGRAM)
#define ONENAND_IS_NOP_1(this) \
(this->options & ONENAND_HAS_NOP_1)
/* Check byte access in OneNAND */ /* Check byte access in OneNAND */
#define ONENAND_CHECK_BYTE_ACCESS(addr) (addr & 0x1) #define ONENAND_CHECK_BYTE_ACCESS(addr) (addr & 0x1)
...@@ -195,6 +198,7 @@ struct onenand_chip { ...@@ -195,6 +198,7 @@ struct onenand_chip {
#define ONENAND_HAS_2PLANE (0x0004) #define ONENAND_HAS_2PLANE (0x0004)
#define ONENAND_HAS_4KB_PAGE (0x0008) #define ONENAND_HAS_4KB_PAGE (0x0008)
#define ONENAND_HAS_CACHE_PROGRAM (0x0010) #define ONENAND_HAS_CACHE_PROGRAM (0x0010)
#define ONENAND_HAS_NOP_1 (0x0020)
#define ONENAND_SKIP_UNLOCK_CHECK (0x0100) #define ONENAND_SKIP_UNLOCK_CHECK (0x0100)
#define ONENAND_PAGEBUF_ALLOC (0x1000) #define ONENAND_PAGEBUF_ALLOC (0x1000)
#define ONENAND_OOBBUF_ALLOC (0x2000) #define ONENAND_OOBBUF_ALLOC (0x2000)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment