diff options
Diffstat (limited to 'firmware/target/mips/ingenic_x1000/nand-x1000.c')
-rw-r--r-- | firmware/target/mips/ingenic_x1000/nand-x1000.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/firmware/target/mips/ingenic_x1000/nand-x1000.c b/firmware/target/mips/ingenic_x1000/nand-x1000.c index 18d548ba8c..382fd761b3 100644 --- a/firmware/target/mips/ingenic_x1000/nand-x1000.c +++ b/firmware/target/mips/ingenic_x1000/nand-x1000.c | |||
@@ -98,21 +98,24 @@ static bool identify_chip(nand_drv* drv) | |||
98 | * - 1 byte address, no dummy byte | 98 | * - 1 byte address, no dummy byte |
99 | * - no address byte, 1 byte dummy | 99 | * - no address byte, 1 byte dummy |
100 | * | 100 | * |
101 | * Right now there is only a need for the 2nd variation, as that is | 101 | * Currently we use the 2nd method, aka. address read ID. |
102 | * the method used by the ATO25D1GA. | ||
103 | * | ||
104 | * Some chips also output more than 2 ID bytes. | ||
105 | */ | 102 | */ |
106 | sfc_exec(NANDCMD_READID(1, 0), 0, drv->scratch_buf, 2|SFC_READ); | 103 | sfc_exec(NANDCMD_READID(1, 0), 0, drv->scratch_buf, 4|SFC_READ); |
107 | drv->mf_id = drv->scratch_buf[0]; | 104 | drv->mf_id = drv->scratch_buf[0]; |
108 | drv->dev_id = drv->scratch_buf[1]; | 105 | drv->dev_id = drv->scratch_buf[1]; |
106 | drv->dev_id2 = drv->scratch_buf[2]; | ||
109 | 107 | ||
110 | for(size_t i = 0; i < nr_supported_nand_chips; ++i) { | 108 | for(size_t i = 0; i < nr_supported_nand_chips; ++i) { |
111 | const nand_chip* chip = &supported_nand_chips[i]; | 109 | const nand_chip* chip = &supported_nand_chips[i]; |
112 | if(chip->mf_id == drv->mf_id && chip->dev_id == drv->dev_id) { | 110 | if(chip->mf_id != drv->mf_id || chip->dev_id != drv->dev_id) |
113 | drv->chip = chip; | 111 | continue; |
114 | return true; | 112 | |
115 | } | 113 | if((chip->flags & NAND_CHIPFLAG_HAS_DEVID2) && |
114 | chip->dev_id2 != drv->dev_id2) | ||
115 | continue; | ||
116 | |||
117 | drv->chip = chip; | ||
118 | return true; | ||
116 | } | 119 | } |
117 | 120 | ||
118 | return false; | 121 | return false; |