mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-08-15 06:33:45 +09:00
![Thomas Abraham](/assets/img/avatar_default.png)
Add a clock driver for Exynos7420 SoC. There are about 25 clock controller blocks in Exynos7420 out of which support for topc, top0 and peric1 blocks are added in this initial version of the driver. Cc: Minkyu Kang <mk7.kang@samsung.com> Cc: Simon Glass <sjg@chromium.org> Signed-off-by: Thomas Abraham <thomas.ab@samsung.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
34 lines
865 B
C
34 lines
865 B
C
/*
|
|
* Exynos PLL helper functions for clock drivers.
|
|
* Copyright (C) 2016 Samsung Electronics
|
|
* Thomas Abraham <thomas.ab@samsung.com>
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0+
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <asm/io.h>
|
|
#include <div64.h>
|
|
|
|
#define PLL145X_MDIV_SHIFT 16
|
|
#define PLL145X_MDIV_MASK 0x3ff
|
|
#define PLL145X_PDIV_SHIFT 8
|
|
#define PLL145X_PDIV_MASK 0x3f
|
|
#define PLL145X_SDIV_SHIFT 0
|
|
#define PLL145X_SDIV_MASK 0x7
|
|
|
|
unsigned long pll145x_get_rate(unsigned int *con1, unsigned long fin_freq)
|
|
{
|
|
unsigned long pll_con1 = readl(con1);
|
|
unsigned long mdiv, sdiv, pdiv;
|
|
uint64_t fvco = fin_freq;
|
|
|
|
mdiv = (pll_con1 >> PLL145X_MDIV_SHIFT) & PLL145X_MDIV_MASK;
|
|
pdiv = (pll_con1 >> PLL145X_PDIV_SHIFT) & PLL145X_PDIV_MASK;
|
|
sdiv = (pll_con1 >> PLL145X_SDIV_SHIFT) & PLL145X_SDIV_MASK;
|
|
|
|
fvco *= mdiv;
|
|
do_div(fvco, (pdiv << sdiv));
|
|
return (unsigned long)fvco;
|
|
}
|