[U-Boot] [PATCH] mtd: nand: denali_dt: Add reset support

Marek Vasut marex at denx.de
Tue Aug 21 13:57:43 UTC 2018


Add optional reset support into the Denali NAND driver. In case there is
a valid reset entry in the DT, the reset gets deasserted before the NAND
controller gets used.

Signed-off-by: Marek Vasut <marex at denx.de>
Cc: Masahiro Yamada <yamada.masahiro at socionext.com>
---
 drivers/mtd/nand/denali_dt.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/mtd/nand/denali_dt.c b/drivers/mtd/nand/denali_dt.c
index 65a7797f0f..6fcd7d3843 100644
--- a/drivers/mtd/nand/denali_dt.c
+++ b/drivers/mtd/nand/denali_dt.c
@@ -9,6 +9,7 @@
 #include <linux/io.h>
 #include <linux/ioport.h>
 #include <linux/printk.h>
+#include <reset.h>
 
 #include "denali.h"
 
@@ -64,6 +65,7 @@ static int denali_dt_probe(struct udevice *dev)
 	const struct denali_dt_data *data;
 	struct clk clk;
 	struct resource res;
+	struct reset_ctl reset_ctl;
 	int ret;
 
 	data = (void *)dev_get_driver_data(dev);
@@ -97,6 +99,13 @@ static int denali_dt_probe(struct udevice *dev)
 
 	denali->clk_x_rate = clk_get_rate(&clk);
 
+	ret = reset_get_by_index(dev, 0, &reset_ctl);
+	if (!ret) {
+		reset_assert(&reset_ctl);
+		udelay(2);
+		reset_deassert(&reset_ctl);
+	}
+
 	return denali_init(denali);
 }
 
-- 
2.17.1



More information about the U-Boot mailing list