nand: fix the bad block awareness error of K9F4G08U0F

PD#153602: fix the bad block awareness error of K9F4G08U0F

The slc-nand K9F4G08U0F has a factory bug, we need send a pre-command
before we send read command to get the block status.

Change-Id: I6468f05d8cf984d70f40abd997395d740c22d5e4
Signed-off-by: Yi Zeng <yi.zeng@amlogic.com>
This commit is contained in:
Yi Zeng
2017-11-02 13:42:21 +08:00
committed by Jianxin Pan
parent 3c0ea5f05f
commit 92b67373dc
3 changed files with 33 additions and 0 deletions

View File

@@ -878,5 +878,9 @@ extern struct aml_nand_flash_dev aml_nand_flash_ids[];
void aml_nand_new_nand_param_init(struct mtd_info *mtd,
struct aml_nand_flash_dev *type);
int aml_nand_get_fbb_issue(void);
void aml_nand_check_fbb_issue(u8 *dev_id);
#endif

View File

@@ -17,6 +17,7 @@
#include "aml_mtd.h"
int nand_fbb_issue_flag;
struct aml_nand_flash_dev aml_nand_flash_ids[] = {
{"A revision NAND 2GiB H27UAG8T2A",
{NAND_MFR_HYNIX, 0xd5, 0x94, 0x25, 0x44, 0x41},
@@ -1041,6 +1042,21 @@ struct aml_nand_flash_dev aml_nand_flash_ids[] = {
{NULL,}
};
int aml_nand_get_fbb_issue(void)
{
return nand_fbb_issue_flag;
}
void aml_nand_check_fbb_issue(u8 *dev_id)
{
u8 samsung_nand_id[MAX_ID_LEN] = {
NAND_MFR_SAMSUNG, 0xdc, 0x10, 0x95, 0x56};
if (!strncmp((char *)samsung_nand_id, (char *)dev_id,
strlen((const char *)samsung_nand_id)))
nand_fbb_issue_flag = 1;
}
/* ******************** */
#ifdef CONFIG_PARAMETER_PAGE
struct parameter_page para_page;
@@ -1241,6 +1257,7 @@ static struct aml_nand_flash_dev *aml_nand_get_flash_type(struct mtd_info *mtd,
if (!type)
return ERR_PTR(-ENODEV);
}
aml_nand_check_fbb_issue(dev_id);
if (type->new_type) {
pr_info("new nand support!!!\n");

View File

@@ -192,6 +192,12 @@ int aml_nand_scan_shipped_bbt(struct mtd_info *mtd)
if (aml_chip->plane_num == 2) {
chip->select_chip(mtd, i);
aml_chip->aml_nand_wait_devready(aml_chip, i);
if (aml_nand_get_fbb_issue()) {
chip->cmd_ctrl(mtd,
NAND_CMD_SEQIN, NAND_CTRL_CLE);
chip->cmd_ctrl(mtd,
0, NAND_CTRL_ALE);
}
aml_chip->aml_nand_command(aml_chip,
NAND_CMD_READ0,
0x00, aml_chip->page_addr, i);
@@ -232,6 +238,12 @@ int aml_nand_scan_shipped_bbt(struct mtd_info *mtd)
chip->select_chip(mtd, i);
/* nand_get_chip(); */
/*aml_chip->aml_nand_select_chip(aml_chip, i);*/
if (aml_nand_get_fbb_issue()) {
chip->cmd_ctrl(mtd,
NAND_CMD_SEQIN, NAND_CTRL_CLE);
chip->cmd_ctrl(mtd,
0, NAND_CTRL_ALE);
}
aml_chip->aml_nand_command(aml_chip,
NAND_CMD_READ0, 0x00,
aml_chip->page_addr, i);