]> git.sur5r.net Git - u-boot/commitdiff
mtd: nand: denali_dt: add clock support
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Fri, 13 Oct 2017 17:21:18 +0000 (02:21 +0900)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Sun, 15 Oct 2017 13:32:25 +0000 (22:32 +0900)
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>
drivers/mtd/nand/denali.h
drivers/mtd/nand/denali_dt.c

index 08db48843da357ee1ef0412e7a9e5a200b70c4c8..f796f0dad1188f571ebdec8ef6258feaec0779be 100644 (file)
@@ -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;
index 4afd679a04b2c9eeb559d3e22ed65b09513979ec..805c066b40569574346341e71876748da07ea4cf 100644 (file)
@@ -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);
 }