@@ -1919,6 +1919,27 @@ static int cadence_nand_status(struct mtd_info *mtd, unsigned int command)
return 0;
}
+static int cadence_nand_readid(struct mtd_info *mtd, int offset_in_page, unsigned int command)
+{
+ struct cadence_nand_info *cadence = mtd_to_cadence(mtd);
+ u8 addrs = (u8)offset_in_page;
+ int ret = 0;
+
+ ret = cadence_nand_cmd_opcode(cadence, command);
+ if (ret)
+ return ret;
+
+ ret = cadence_nand_cmd_address(cadence, ONE_CYCLE, &addrs);
+ if (ret)
+ return ret;
+
+ ret = cadence_nand_cmd_data(cadence, 8, GCMD_DIR_READ);
+ if (ret)
+ return ret;
+
+ return 0;
+}
+
static void cadence_nand_cmdfunc(struct mtd_info *mtd, unsigned int command,
int offset_in_page, int page)
{
@@ -1930,6 +1951,11 @@ static void cadence_nand_cmdfunc(struct mtd_info *mtd, unsigned int command,
case NAND_CMD_STATUS:
ret = cadence_nand_status(mtd, command);
break;
+
+ case NAND_CMD_READID:
+ ret = cadence_nand_readid(mtd, offset_in_page, command);
+ break;
+
/*
* ecc will override other command for read, write and erase
*/
@@ -1959,8 +1985,12 @@ static u8 cadence_nand_read_byte(struct mtd_info *mtd)
u32 size = 1;
u8 val;
- if (cadence->buf_index == 0)
+ if (cadence->buf_index == 0) {
+ if (cadence->cmd == NAND_CMD_READID)
+ size = 8;
+
cadence_nand_read_buf(mtd, &cadence->buf[0], size);
+ }
val = *(&cadence->buf[0] + cadence->buf_index);
cadence->buf_index++;