mtd: rawnand: hynix: fix up bit 0 of sdr_timing_mode
Subsystems (2)
PATCH v5 1/1 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.
---
v5:
Simplify bitwise operation.
v4:
Fix bitwise operation on __le16 type, per sparse warning.
v3:
Forcibly set bit 0.
v2:
Move patch to Hynix specific fixup hook.
Use BIT(0) macro.
v1:
Implement generic patch in nand_base.c.
drivers/mtd/nand/raw/nand_hynix.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/mtd/nand/raw/nand_hynix.c +13 -0
@@ -728,8 +728,21 @@ static int hynix_nand_init(struct nand_chip *chip)return ret; } +static void hynix_fixup_onfi_param_page (struct nand_chip *chip, +struct nand_onfi_params *p) +{ +/* +* Certain chips might report a 0 on sdr_timing_mode field +* (bytes 129-130). This has been seen on H27U4G8F2GDA-BI. +* According to ONFI specification, bit 0 of this field "shall be 1". +* Forcibly set this bit. +*/ + p->sdr_timing_modes |=cpu_to_le16 (BIT (0 )); +} +const struct nand_manufacturer_ops hynix_nand_manuf_ops = { .detect = hynix_nand_decode_id, .init = hynix_nand_init, .cleanup = hynix_nand_cleanup, + .fixup_onfi_param_page = hynix_fixup_onfi_param_page, };
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Miquel Raynal
maintainerHi Hector,
[email protected] wrote on Fri, 10 Mar 2023 09:06:09 +0100:
Quoted 8 lines
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.
Quoted 7 lines
Given that
sdr_timing_modesbit 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 <[email protected]>Signed-off-by Miquel Raynal <[email protected]>
Actually you should not add my Signed-off-by like that. I will add it when I take your patch.
In order to credit me (and that is very kind to you) you could have instead used Suggested-by. If I had done more than just suggesting something, another solution could have been to add a Co-developed-by tag (and this time, my Signed-off-by would have been required).
Anyway, no need to resend, I'll fix it up when applying.
Quoted 33 lines
---
v5:
Simplify bitwise operation.
v4:
Fix bitwise operation on__le16type, per sparse warning.
v3:
Forcibly set bit 0.
v2:
Move patch to Hynix specific fixup hook.
Use BIT(0) macro.
v1:
Implement generic patch innand_base.c.drivers/mtd/nand/raw/nand_hynix.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)drivers/mtd/nand/raw/nand_hynix.c +8
-0@@ -728,8 +728,21 @@ static int hynix_nand_init(struct nand_chip *chip)return ret; } +static void hynix_fixup_onfi_param_page (struct nand_chip *chip, +struct nand_onfi_params *p) +{ +/* +* Certain chips might report a 0 on sdr_timing_mode field +* (bytes 129-130). This has been seen on H27U4G8F2GDA-BI. +* According to ONFI specification, bit 0 of this field "shall be 1". +* Forcibly set this bit.
drivers/mtd/nand/raw/nand_hynix.c static int hynix_nand_init(struct nand_chip *chip) · line 748
Quoted 10 lines
drivers/mtd/nand/raw/nand_hynix.c +5
-0+*/ + p->sdr_timing_modes |=cpu_to_le16 (BIT (0 )); +} +const struct nand_manufacturer_ops hynix_nand_manuf_ops = { .detect = hynix_nand_decode_id, .init = hynix_nand_init, .cleanup = hynix_nand_cleanup, + .fixup_onfi_param_page = hynix_fixup_onfi_param_page, };
Thanks,
Miquèl
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Hi Miquèl,
Quoted 27 lines · Miquel Raynal
[EXTERNAL E-MAIL] Warning! This email originated outside of the organization! Do not click links or open attachments unless you recognize the sender and know the content is safe.
Hi Hector,
[email protected] wrote on Fri, 10 Mar 2023 09:06:09 +0100:
Quoted 8 lines
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.Quoted 7 lines
Given that
sdr_timing_modesbit 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 <[email protected]>Signed-off-by Miquel Raynal <[email protected]>Actually you should not add my Signed-off-by like that. I will add it when I take your patch.
Quoted 6 lines
In order to credit me (and that is very kind to you) you could have instead used Suggested-by. If I had done more than just suggesting something, another solution could have been to add a Co-developed-by tag (and this time, my Signed-off-by would have been required).
Anyway, no need to resend, I'll fix it up when applying.
Oh, sorry, I think I iterated over the patch in nand-next that already carried your signature. Thanks for all the explanations and patience!
Quoted 48 lines
Quoted 34 lines
---
v5:
Simplify bitwise operation.
v4:
Fix bitwise operation on__le16type, per sparse warning.
v3:
Forcibly set bit 0.
v2:
Move patch to Hynix specific fixup hook.
Use BIT(0) macro.
v1:
Implement generic patch innand_base.c.drivers/mtd/nand/raw/nand_hynix.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)drivers/mtd/nand/raw/nand_hynix.c +8
-0@@ -728,8 +728,21 @@ static int hynix_nand_init(struct nand_chip *chip)return ret; } +static void hynix_fixup_onfi_param_page (struct nand_chip *chip, +struct nand_onfi_params *p) +{ +/* +* Certain chips might report a 0 on sdr_timing_mode field +* (bytes 129-130). This has been seen on H27U4G8F2GDA-BI. +* According to ONFI specification, bit 0 of this field "shall be 1". +* Forcibly set this bit. drivers/mtd/nand/raw/nand_hynix.c static int hynix_nand_init(struct nand_chip *chip) · line 748
Quoted 10 lines
drivers/mtd/nand/raw/nand_hynix.c +5
-0+*/ + p->sdr_timing_modes |=cpu_to_le16 (BIT (0 )); +} +const struct nand_manufacturer_ops hynix_nand_manuf_ops = { .detect = hynix_nand_decode_id, .init = hynix_nand_init, .cleanup = hynix_nand_cleanup, + .fixup_onfi_param_page = hynix_fixup_onfi_param_page, };Thanks,
Miquèl
Signature · 6 lines
Héctor Palacios ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Quoted 8 lines · Hector Palacios
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.
Quoted 8 lines
Given that
sdr_timing_modesbit 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 <[email protected]>Signed-off-by Miquel Raynal <[email protected]>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.
Miquel
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/