drivers: mtd: nand: cadence: Support cmd SET_FEATURES & GET_FEATURES
Support NAND_CMD_SET_FEATURES & NAND_CMD_GET_FEATURES. These commands is one of the basic commands of NAND. The parameters get from these commands will be used to set timing mode of NAND data interface. Signed-off-by: Dinesh Maniyam <dinesh.maniyam@intel.com>
This commit is contained in:

committed by
Michael Trimarchi

parent
dfba71f965
commit
36b2a5d676
@@ -2010,6 +2010,29 @@ static int cadence_nand_reset(struct mtd_info *mtd, unsigned int command)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cadence_nand_features(struct mtd_info *mtd, u8 offset_in_page, u32 command)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
int ret = 0;
|
||||
|
||||
ret = cadence_nand_cmd_opcode(chip, command);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = cadence_nand_cmd_address(chip, ONE_CYCLE, &offset_in_page);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (command == NAND_CMD_GET_FEATURES)
|
||||
ret = cadence_nand_cmd_data(chip, ONFI_SUBFEATURE_PARAM_LEN,
|
||||
GCMD_DIR_READ);
|
||||
else
|
||||
ret = cadence_nand_cmd_data(chip, ONFI_SUBFEATURE_PARAM_LEN,
|
||||
GCMD_DIR_WRITE);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void cadence_nand_cmdfunc(struct mtd_info *mtd, unsigned int command,
|
||||
int offset_in_page, int page)
|
||||
{
|
||||
@@ -2034,6 +2057,11 @@ static void cadence_nand_cmdfunc(struct mtd_info *mtd, unsigned int command,
|
||||
case NAND_CMD_RESET:
|
||||
ret = cadence_nand_reset(mtd, command);
|
||||
break;
|
||||
|
||||
case NAND_CMD_SET_FEATURES:
|
||||
case NAND_CMD_GET_FEATURES:
|
||||
ret = cadence_nand_features(mtd, offset_in_page, command);
|
||||
break;
|
||||
/*
|
||||
* ecc will override other command for read, write and erase
|
||||
*/
|
||||
@@ -2076,6 +2104,8 @@ static u8 cadence_nand_read_byte(struct mtd_info *mtd)
|
||||
size = 8;
|
||||
else if (cadence->cmd == NAND_CMD_PARAM)
|
||||
size = sizeof(struct nand_jedec_params);
|
||||
else if (cadence->cmd == NAND_CMD_GET_FEATURES)
|
||||
size = ONFI_SUBFEATURE_PARAM_LEN;
|
||||
|
||||
cadence_nand_read_buf(mtd, &cadence->buf[0], size);
|
||||
}
|
||||
|
Reference in New Issue
Block a user