Skip to content

Commit e8c047b

Browse files
hpalaciomiquelraynal
authored andcommitted
mtd: rawnand: hynix: fix up bit 0 of sdr_timing_mode
According to the ONFI specification, bit 0 of 'SDR timing mode support' (bytes 129-130) "shall be 1". That means the NAND supports at least timing mode 0. NAND chip Hynix H27U4G8F2GDA-BI (at least) is reading a 0 on this field which makes nand_choose_best_sdr_timings() return with error and the probe function to eventually fail. Given that sdr_timing_modes bit 0 must be 1 by specification, force it in case the NAND reports it is not set. This is a safe assumption because the mode 0 is the minimum (safer) set of timings that the NAND can work with. Signed-off-by: Hector Palacios <hector.palacios@digi.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20230223165104.525852-1-hector.palacios@digi.com Link: https://lore.kernel.org/linux-mtd/20230310080609.1930869-1-hector.palacios@digi.com
1 parent 4080d53 commit e8c047b

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

drivers/mtd/nand/raw/nand_hynix.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,8 +728,21 @@ static int hynix_nand_init(struct nand_chip *chip)
728728
return ret;
729729
}
730730

731+
static void hynix_fixup_onfi_param_page(struct nand_chip *chip,
732+
struct nand_onfi_params *p)
733+
{
734+
/*
735+
* Certain chips might report a 0 on sdr_timing_mode field
736+
* (bytes 129-130). This has been seen on H27U4G8F2GDA-BI.
737+
* According to ONFI specification, bit 0 of this field "shall be 1".
738+
* Forcibly set this bit.
739+
*/
740+
p->sdr_timing_modes |= cpu_to_le16(BIT(0));
741+
}
742+
731743
const struct nand_manufacturer_ops hynix_nand_manuf_ops = {
732744
.detect = hynix_nand_decode_id,
733745
.init = hynix_nand_init,
734746
.cleanup = hynix_nand_cleanup,
747+
.fixup_onfi_param_page = hynix_fixup_onfi_param_page,
735748
};

0 commit comments

Comments
 (0)