Commit f821878d authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

fixed: system halt if the flash chip was not found

parent e9d8bd29
...@@ -279,6 +279,7 @@ static int zynq_nand_init_nand_flash(int option) ...@@ -279,6 +279,7 @@ static int zynq_nand_init_nand_flash(int option)
status = zynq_nand_waitfor_ecc_completion(); status = zynq_nand_waitfor_ecc_completion();
if (status < 0) { if (status < 0) {
printf("%s: Timeout\n", __func__); printf("%s: Timeout\n", __func__);
udelay(100);
return status; return status;
} }
...@@ -776,6 +777,9 @@ static void zynq_nand_cmd_function(struct mtd_info *mtd, unsigned int command, ...@@ -776,6 +777,9 @@ static void zynq_nand_cmd_function(struct mtd_info *mtd, unsigned int command,
unsigned long end_cmd_valid = 0; unsigned long end_cmd_valid = 0;
unsigned long i; unsigned long i;
/* Wait max 10 time units */
int timeout = 10;
//printf(" zynq_nand(): Command=0x%02x Column=0x%02x PageAddr=0x%08x\n",command,column,page_addr); //printf(" zynq_nand(): Command=0x%02x Column=0x%02x PageAddr=0x%08x\n",command,column,page_addr);
xnand = (struct zynq_nand_info *)chip->priv; xnand = (struct zynq_nand_info *)chip->priv;
...@@ -896,8 +900,14 @@ static void zynq_nand_cmd_function(struct mtd_info *mtd, unsigned int command, ...@@ -896,8 +900,14 @@ static void zynq_nand_cmd_function(struct mtd_info *mtd, unsigned int command,
(command == NAND_CMD_RESET) || (command == NAND_CMD_RESET) ||
(command == NAND_CMD_PARAM) || (command == NAND_CMD_PARAM) ||
(command == NAND_CMD_GET_FEATURES)) { (command == NAND_CMD_GET_FEATURES)) {
while (!chip->dev_ready(mtd)) while (!chip->dev_ready(mtd)){
; if (timeout==0) {
printf("ERROR: nand flash command timeout\n");
break;
}
timeout--;
udelay(10);
}
return; return;
} }
} }
......
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