diff options
author | Marek BehĂșn <marek.behun@nic.cz> | 2018-04-24 17:21:27 +0200 |
---|---|---|
committer | Stefan Roese <sr@denx.de> | 2018-05-14 10:00:15 +0200 |
commit | dd77690c434f02b985c9c30be66943ffc1fea48c (patch) | |
tree | a33cd99f73fde5067ad60f4515a5876f1825665e /drivers/clk/mvebu/armada-37xx-periph.c | |
parent | dbbd5bdd27437909dac5c664303cd6e0fe420f39 (diff) |
clk: armada-37xx: Support soc_clk_dump
Add support for the clk dump command on Armada 37xx.
Signed-off-by: Marek Behun <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'drivers/clk/mvebu/armada-37xx-periph.c')
-rw-r--r-- | drivers/clk/mvebu/armada-37xx-periph.c | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/drivers/clk/mvebu/armada-37xx-periph.c b/drivers/clk/mvebu/armada-37xx-periph.c index af08e3df08..902a6cc9ef 100644 --- a/drivers/clk/mvebu/armada-37xx-periph.c +++ b/drivers/clk/mvebu/armada-37xx-periph.c @@ -337,7 +337,8 @@ static int armada_37xx_periph_clk_disable(struct clk *clk) return periph_clk_enable(clk, 0); } -int armada_37xx_periph_clk_dump(struct udevice *dev) +#if defined(CONFIG_CMD_CLK) && defined(CONFIG_CLK_ARMADA_3720) +static int armada_37xx_periph_clk_dump(struct udevice *dev) { struct a37xx_periphclk *priv = dev_get_priv(dev); const struct clk_periph *clks; @@ -356,6 +357,39 @@ int armada_37xx_periph_clk_dump(struct udevice *dev) return 0; } +static int clk_dump(const char *name, int (*func)(struct udevice *)) +{ + struct udevice *dev; + + if (uclass_get_device_by_name(UCLASS_CLK, name, &dev)) { + printf("Cannot find device %s\n", name); + return -ENODEV; + } + + return func(dev); +} + +int armada_37xx_tbg_clk_dump(struct udevice *); + +int soc_clk_dump(void) +{ + printf(" xtal at %u000000 Hz\n\n", get_ref_clk()); + + if (clk_dump("tbg@13200", armada_37xx_tbg_clk_dump)) + return 1; + + if (clk_dump("nb-periph-clk@13000", + armada_37xx_periph_clk_dump)) + return 1; + + if (clk_dump("sb-periph-clk@18000", + armada_37xx_periph_clk_dump)) + return 1; + + return 0; +} +#endif + static int armada_37xx_periph_clk_probe(struct udevice *dev) { struct a37xx_periphclk *priv = dev_get_priv(dev); |