summaryrefslogtreecommitdiff
path: root/drivers/mtd/nand
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2017-10-14 02:21:18 +0900
committerMasahiro Yamada <yamada.masahiro@socionext.com>2017-10-15 22:32:25 +0900
commita89b9bc0950b7dd5f43a88e211be4b2acd58dad7 (patch)
tree1ab773039d9b040a03614a1fb4af8066c774d3cc /drivers/mtd/nand
parentc7372d61fd38c32c410bcab86dd39494ebe1fb06 (diff)
mtd: nand: denali_dt: add clock support
Enable clock in the probe hook. The clock rate will be necessary when setup_data_interface hook is supported. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r--drivers/mtd/nand/denali.h1
-rw-r--r--drivers/mtd/nand/denali_dt.c12
2 files changed, 13 insertions, 0 deletions
diff --git a/drivers/mtd/nand/denali.h b/drivers/mtd/nand/denali.h
index 08db48843d..f796f0dad1 100644
--- a/drivers/mtd/nand/denali.h
+++ b/drivers/mtd/nand/denali.h
@@ -435,6 +435,7 @@ struct nand_buf {
struct denali_nand_info {
struct nand_chip nand;
+ unsigned long clk_x_rate; /* bus interface clock rate */
int flash_bank; /* currently selected chip */
int status;
int platform;
diff --git a/drivers/mtd/nand/denali_dt.c b/drivers/mtd/nand/denali_dt.c
index 4afd679a04..805c066b40 100644
--- a/drivers/mtd/nand/denali_dt.c
+++ b/drivers/mtd/nand/denali_dt.c
@@ -6,6 +6,7 @@
*/
#include <common.h>
+#include <clk.h>
#include <dm.h>
#include <linux/io.h>
#include <linux/ioport.h>
@@ -52,6 +53,7 @@ static int denali_dt_probe(struct udevice *dev)
{
struct denali_nand_info *denali = dev_get_priv(dev);
const struct denali_dt_data *data;
+ struct clk clk;
struct resource res;
int ret;
@@ -73,6 +75,16 @@ static int denali_dt_probe(struct udevice *dev)
denali->flash_mem = devm_ioremap(dev, res.start, resource_size(&res));
+ ret = clk_get_by_index(dev, 0, &clk);
+ if (ret)
+ return ret;
+
+ ret = clk_enable(&clk);
+ if (ret)
+ return ret;
+
+ denali->clk_x_rate = clk_get_rate(&clk);
+
return denali_init(denali);
}