mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] mtd: nand_mxs: fix NAND error when change clk rate
@ 2016-12-21 21:38 Christian Hemp
  2016-12-21 22:29 ` Sam Ravnborg
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Christian Hemp @ 2016-12-21 21:38 UTC (permalink / raw)
  To: barebox

The function "nand_enable_edo_mode" changed the NAND clk rate, without turning
it off. In this case it is posible to get the following errors:
    MXS NAND: Error sending command
    MXS NAND: Error sending command
    MXS NAND: DMA read error

This can be fixed if the NAND clk is disabled before we change the clk
rate.

Tested with:
nand: NAND device: Manufacturer ID: 0x2c, Chip ID: 0xdc (Micron
MT29F4G08ABADAWP), 512MiB, page size: 2048, OOB size: 64

Signed-off-by: Christian Hemp <c.hemp@phytec.de>
---
 drivers/mtd/nand/nand_mxs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mtd/nand/nand_mxs.c b/drivers/mtd/nand/nand_mxs.c
index cba0bee..ce79bca 100644
--- a/drivers/mtd/nand/nand_mxs.c
+++ b/drivers/mtd/nand/nand_mxs.c
@@ -2047,7 +2047,9 @@ static int mxs_nand_enable_edo_mode(struct mxs_nand_info *info)
 	nand->select_chip(mtd, -1);
 
 	/* [3] set the main IO clock, 100MHz for mode 5, 80MHz for mode 4. */
+	clk_disable(info->clk);
 	clk_set_rate(info->clk, (mode == 5) ? 100000000 : 80000000);
+	clk_enable(info->clk);
 
 	dev_dbg(info->dev, "using asynchronous EDO mode %d\n", mode);
 
-- 
1.9.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-08-21 16:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-21 21:38 [PATCH] mtd: nand_mxs: fix NAND error when change clk rate Christian Hemp
2016-12-21 22:29 ` Sam Ravnborg
2016-12-22  8:50   ` Christian Hemp
2016-12-22 17:55     ` Sam Ravnborg
2016-12-23 10:39 ` Sam Ravnborg
2016-12-27 17:07 ` Fabio Estevam
2017-01-09 10:21 ` Sascha Hauer
2017-08-21 16:26   ` Uwe Kleine-König
2017-08-21 16:31     ` Fabio Estevam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox