diff options
author | Philipp Tomsich <philipp.tomsich@theobroma-systems.com> | 2017-03-02 10:37:16 +0100 |
---|---|---|
committer | Philipp Tomsich <philipp.tomsich@theobroma-systems.com> | 2017-03-09 01:40:25 +0100 |
commit | c79568857424c47889695e5ae60e3a4721f94038 (patch) | |
tree | 2e4799097b35e6113c940c27c2a218544930a763 | |
parent | f006a8e343e8e85307771021fe88afb8ea15b1d2 (diff) |
sunxi: clk-ccu: implement lookup callback
-rw-r--r-- | drivers/clk/sunxi/clk-sunxi-ccu.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/clk/sunxi/clk-sunxi-ccu.c b/drivers/clk/sunxi/clk-sunxi-ccu.c index 8a26dd49bf..0485404927 100644 --- a/drivers/clk/sunxi/clk-sunxi-ccu.c +++ b/drivers/clk/sunxi/clk-sunxi-ccu.c @@ -397,11 +397,34 @@ static int sunxi_clk_ccu_disable(struct clk *clk) return clk_hw_disable(hw); } +static int sunxi_clk_ccu_lookup(struct clk *clock, const char *name) +{ + struct udevice *dev = clock->dev; + const struct sunxi_ccu_desc *desc = + (const struct sunxi_ccu_desc *)dev_get_driver_data(dev); + int i; + + for (i = 0; i < desc->hw_clks->num ; i++) { + struct clk_hw *hw = desc->hw_clks->hws[i]; + + if (!hw) + continue; + + if (!strcmp(clk_hw_get_name(hw), name)) { + clock->id = i; + return 0; + } + } + + return -ENOENT; +} + static struct clk_ops sunxi_clk_ccu_ops = { .enable = sunxi_clk_ccu_enable, .disable = sunxi_clk_ccu_disable, .set_rate = sunxi_clk_ccu_set_rate, .get_rate = sunxi_clk_ccu_get_rate, + .lookup = sunxi_clk_ccu_lookup, }; static int sunxi_clk_ccu_probe(struct udevice *dev) |