From: Stefan Roese Date: Thu, 19 Mar 2015 13:34:29 +0000 (+0100) Subject: mtd: fsmc_nand.c: Use default timings if none are provided in the dts X-Git-Tag: firefly_0821_release~176^2~1880^2~26 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=62b57f4c1475a4c452000192e5cad2ae86164be5;p=firefly-linux-kernel-4.4.55.git 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. Signed-off-by: Stefan Roese Acked-by: Linus Walleij Cc: Viresh Kumar Cc: Mian Yousaf Kaukab Signed-off-by: Brian Norris --- diff --git a/drivers/mtd/nand/fsmc_nand.c b/drivers/mtd/nand/fsmc_nand.c index edfaa21b1817..e58af4bfa8c8 100644 --- a/drivers/mtd/nand/fsmc_nand.c +++ b/drivers/mtd/nand/fsmc_nand.c @@ -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;