@@ -1965,10 +1965,28 @@ static int cadence_nand_param(struct mtd_info *mtd, u8 offset_in_page, unsigned
return 0;
}
+static int cadence_nand_reset(struct mtd_info *mtd, unsigned int command)
+{
+ struct cadence_nand_info *cadence = mtd_to_cadence(mtd);
+ struct nand_chip *chip = mtd_to_nand(mtd);
+ int ret = 0;
+
+ ret = cadence_nand_cmd_opcode(cadence, command);
+ if (ret)
+ return ret;
+
+ ret = cadence_nand_waitfunc(mtd, chip);
+ if (ret)
+ return ret;
+
+ return 0;
+}
+
static void cadence_nand_cmdfunc(struct mtd_info *mtd, unsigned int command,
int offset_in_page, int page)
{
struct cadence_nand_info *cadence = mtd_to_cadence(mtd);
+ struct nand_chip *chip = mtd_to_nand(mtd);
int ret = 0;
cadence->cmd = command;
@@ -1984,6 +2002,10 @@ static void cadence_nand_cmdfunc(struct mtd_info *mtd, unsigned int command,
case NAND_CMD_PARAM:
ret = cadence_nand_param(mtd, offset_in_page, command);
break;
+
+ case NAND_CMD_RESET:
+ ret = cadence_nand_reset(mtd, command);
+ break;
/*
* ecc will override other command for read, write and erase
*/
@@ -1991,6 +2013,12 @@ static void cadence_nand_cmdfunc(struct mtd_info *mtd, unsigned int command,
break;
}
+ if (cadence->cmd == NAND_CMD_RESET) {
+ ret = cadence_nand_select_target(cadence, chip);
+ if (ret)
+ dev_err(cadence->dev, "Chip select failure after reset\n");
+ }
+
if (ret != 0)
printf("ERROR:%s:command:0x%x\n", __func__, cadence->cmd);
}