From 49043cbad1db2e97daffe54d5ee32103c11dd4fd Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sat, 8 Aug 2015 12:36:44 +0200 Subject: sunxi: clock: Add clock_get_pll3() helper function Add a helper function to get the pll3 clock rate. Signed-off-by: Hans de Goede Acked-by: Ian Campbell --- arch/arm/cpu/armv7/sunxi/clock_sun4i.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'arch/arm/cpu/armv7/sunxi/clock_sun4i.c') diff --git a/arch/arm/cpu/armv7/sunxi/clock_sun4i.c b/arch/arm/cpu/armv7/sunxi/clock_sun4i.c index c3e04af36d..7c8eff959b 100644 --- a/arch/arm/cpu/armv7/sunxi/clock_sun4i.c +++ b/arch/arm/cpu/armv7/sunxi/clock_sun4i.c @@ -198,6 +198,15 @@ void clock_set_pll3(unsigned int clk) CCM_PLL3_CTRL_M(clk / 3000000), &ccm->pll3_cfg); } +unsigned int clock_get_pll3(void) +{ + struct sunxi_ccm_reg *const ccm = + (struct sunxi_ccm_reg *)SUNXI_CCM_BASE; + uint32_t rval = readl(&ccm->pll3_cfg); + int m = ((rval & CCM_PLL3_CTRL_M_MASK) >> CCM_PLL3_CTRL_M_SHIFT); + return 3000000 * m; +} + unsigned int clock_get_pll5p(void) { struct sunxi_ccm_reg *const ccm = -- cgit