Skip to contentSkip to conversation

mtd: fsmc_nand.c: Use default timings if none are provided in the dts

PATCH Applied Stefan Roese 3 participants 3 messages Mar 19, 2015 – Mar 31, 2015

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

PATCH 1/1 mtd: fsmc_nand.c: Use default timings if none are provided in the dts

Without this patch the timings are all set to 0 if not specified in the dts. With this patch the driver falls back to use the defaults that are already present in the driver and are known to work okay for some (older) boards.

Tested on a custom SPEAr600 based board.

Cc Viresh Kumar <[email protected]>
Cc Brian Norris <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Mian Yousaf Kaukab <[email protected]>
---
 drivers/mtd/nand/fsmc_nand.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/mtd/nand/fsmc_nand.c +6 -1
index edfaa21..e58af4b 100644
@@ -873,6 +873,7 @@ static int fsmc_nand_probe_config_dt(struct platform_device *pdev,
 {
 	struct fsmc_nand_platform_data *pdata = dev_get_platdata(&pdev->dev);
 	u32 val;
+	int ret;
 
 	/* Set default NAND width to 8 bits */
 	pdata->width = 8;
@@ -891,8 +892,12 @@ static int fsmc_nand_probe_config_dt(struct platform_device *pdev,
 				sizeof(*pdata->nand_timings), GFP_KERNEL);
 	if (!pdata->nand_timings)
 		return -ENOMEM;
-	of_property_read_u8_array(np, "timings", (u8 *)pdata->nand_timings,
+	ret = of_property_read_u8_array(np, "timings", (u8 *)pdata->nand_timings,
 						sizeof(*pdata->nand_timings));
+	if (ret) {
+		dev_info(&pdev->dev, "No timings in dts specified, using default timings!\n");
+		pdata->nand_timings = NULL;
+	}
 
 	/* Set default NAND bank to 0 */
 	pdata->bank = 0;
Signature · 1 line
2.3.3
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · Stefan Roese

Without this patch the timings are all set to 0 if not specified in the dts. With this patch the driver falls back to use the defaults that are already present in the driver and are known to work okay for some (older) boards.

Tested on a custom SPEAr600 based board.

Cc Viresh Kumar <[email protected]>
Cc Brian Norris <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Mian Yousaf Kaukab <[email protected]>

Yours,
Linus Walleij

Applied
#2 lore raw
In reply to Stefan Roese
Quoted 11 lines · Stefan Roese

Without this patch the timings are all set to 0 if not specified in the dts. With this patch the driver falls back to use the defaults that are already present in the driver and are known to work okay for some (older) boards.

Tested on a custom SPEAr600 based board.

Cc Viresh Kumar <[email protected]>
Cc Brian Norris <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Mian Yousaf Kaukab <[email protected]>

Pushed to l2-mtd.git.

Brian