Skip to contentSkip to conversation

mtd: rawnand: rockchip: reject NVDDR timings when checked

PATCH In review Val Packett 2 participants 4 messages May 18, 2024 – May 27, 2024

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtd: rawnand: rockchip: reject NVDDR timings when checked

.setup_interface first gets called with a negative "target" value NAND_DATA_IFACE_CHECK_ONLY, in which case an error is expected if the controller driver does not support the timing mode (NVDDR).

---
Hello everyone, first Linux patch from a long time FreeBSD person :)

This was required to get the NAND controller to attach on the random old RK3066 tablet I'm bringing up mainline on.

---
 drivers/mtd/nand/raw/rockchip-nand-controller.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/mtd/nand/raw/rockchip-nand-controller.c +3 -3
index 7baaef69d..555804476 100644
@@ -420,13 +420,13 @@ static int rk_nfc_setup_interface(struct nand_chip *chip, int target,
 	u32 rate, tc2rw, trwpw, trw2c;
 	u32 temp;
 
-	if (target < 0)
-		return 0;
-
 	timings = nand_get_sdr_timings(conf);
 	if (IS_ERR(timings))
 		return -EOPNOTSUPP;
 
+	if (target < 0)
+		return 0;
+
 	if (IS_ERR(nfc->nfc_clk))
 		rate = clk_get_rate(nfc->ahb_clk);
 	else
Signature · 1 line
2.45.0
maintainer
#1 lore raw

Hi Val,

I might propose a slightly different title which I think better describes the situation:
"mtd: rawnand: rockchip: ensure NVDDR timings are rejected"

[email protected] wrote on Sat, 18 May 2024 00:31:13 -0300:

Quoted 1 line

.setup_interface first gets called with a negative "target" value

Just as an FYI, the fact that it is negative is an implementation detail, but you mention the #define of the value below, so that's fine.

Quoted 3 lines

NAND_DATA_IFACE_CHECK_ONLY, in which case an error is expected if the controller driver does not support the timing mode (NVDDR).

Here I would welcome two tags in order to get this backported as early as needed in stable kernels:

Fixes a9ecc8c814e9 ("mtd: rawnand: Choose the best timings, NV-DDR included")
Quoted 6 lines

---
Hello everyone, first Linux patch from a long time FreeBSD person :)

This was required to get the NAND controller to attach on the random old RK3066 tablet I'm bringing up mainline on.

Welcome! The fix looks right besides minor nits in the commit log. I'll probably take the v2 when it's out after -rc1 has been tagged.

Thanks,
Miquèl

#2 lore raw

PATCH v2 1/1 mtd: rawnand: rockchip: ensure NVDDR timings are rejected

.setup_interface first gets called with a "target" value of NAND_DATA_IFACE_CHECK_ONLY, in which case an error is expected if the controller driver does not support the timing mode (NVDDR).

Fixes a9ecc8c814e9 ("mtd: rawnand: Choose the best timings, NV-DDR included")
---
 drivers/mtd/nand/raw/rockchip-nand-controller.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/mtd/nand/raw/rockchip-nand-controller.c +3 -3
index 7baaef69d..555804476 100644
@@ -420,13 +420,13 @@ static int rk_nfc_setup_interface(struct nand_chip *chip, int target,
 	u32 rate, tc2rw, trwpw, trw2c;
 	u32 temp;
 
-	if (target < 0)
-		return 0;
-
 	timings = nand_get_sdr_timings(conf);
 	if (IS_ERR(timings))
 		return -EOPNOTSUPP;
 
+	if (target < 0)
+		return 0;
+
 	if (IS_ERR(nfc->nfc_clk))
 		rate = clk_get_rate(nfc->ahb_clk);
 	else
Signature · 1 line
2.45.0
maintainer Applied
#3 lore raw

Re: [PATCH v2] mtd: rawnand: rockchip: ensure NVDDR timings are rejected

Quoted 7 lines · Val Packett

.setup_interface first gets called with a "target" value of NAND_DATA_IFACE_CHECK_ONLY, in which case an error is expected if the controller driver does not support the timing mode (NVDDR).

Fixes a9ecc8c814e9 ("mtd: rawnand: Choose the best timings, NV-DDR included")

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/fixes, thanks.

Miquel