aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Blumenstingl <martin.blumenstingl@googlemail.com>2019-03-24 11:11:03 -0400
committerNeil Armstrong <narmstrong@baylibre.com>2019-04-01 07:34:09 -0400
commitb882964b376f214ef3d96d8a643c7c46121c30a8 (patch)
tree6dc0ac81f09c913b586d06f28dc3a91cdfecbb35
parent32cd198a1a505566f8e9d2c925bcfc8b889bbc23 (diff)
clk: meson: meson8b: add support for the GP_PLL clock on Meson8m2
Meson8m2 has a GP_PLL clock (similar to GP0_PLL on GXBB/GXL/GXM) which is used as input for the VPU clocks. The only supported frequency (based on Amlogic's vendor kernel sources) is 364MHz which is achieved using the following parameters: - input: XTAL (24MHz) - M = 182 - N = 3 - OD = 2 ^ 2 Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Reviewed-by: Neil Armstrong <narmstrong@baylibre.com> Acked-by: Jerome Brunet <jbrunet@baylibre.com> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com> Link: https://lkml.kernel.org/r/20190324151104.18397-4-martin.blumenstingl@googlemail.com
-rw-r--r--drivers/clk/meson/meson8b.c62
-rw-r--r--drivers/clk/meson/meson8b.h5
2 files changed, 66 insertions, 1 deletions
diff --git a/drivers/clk/meson/meson8b.c b/drivers/clk/meson/meson8b.c
index c9e6ec67d649..0d08f1ef7af8 100644
--- a/drivers/clk/meson/meson8b.c
+++ b/drivers/clk/meson/meson8b.c
@@ -1703,6 +1703,64 @@ static struct clk_regmap meson8b_mali = {
1703 }, 1703 },
1704}; 1704};
1705 1705
1706static const struct pll_params_table meson8m2_gp_pll_params_table[] = {
1707 PLL_PARAMS(182, 3),
1708 { /* sentinel */ },
1709};
1710
1711static struct clk_regmap meson8m2_gp_pll_dco = {
1712 .data = &(struct meson_clk_pll_data){
1713 .en = {
1714 .reg_off = HHI_GP_PLL_CNTL,
1715 .shift = 30,
1716 .width = 1,
1717 },
1718 .m = {
1719 .reg_off = HHI_GP_PLL_CNTL,
1720 .shift = 0,
1721 .width = 9,
1722 },
1723 .n = {
1724 .reg_off = HHI_GP_PLL_CNTL,
1725 .shift = 9,
1726 .width = 5,
1727 },
1728 .l = {
1729 .reg_off = HHI_GP_PLL_CNTL,
1730 .shift = 31,
1731 .width = 1,
1732 },
1733 .rst = {
1734 .reg_off = HHI_GP_PLL_CNTL,
1735 .shift = 29,
1736 .width = 1,
1737 },
1738 .table = meson8m2_gp_pll_params_table,
1739 },
1740 .hw.init = &(struct clk_init_data){
1741 .name = "gp_pll_dco",
1742 .ops = &meson_clk_pll_ops,
1743 .parent_names = (const char *[]){ "xtal" },
1744 .num_parents = 1,
1745 },
1746};
1747
1748static struct clk_regmap meson8m2_gp_pll = {
1749 .data = &(struct clk_regmap_div_data){
1750 .offset = HHI_GP_PLL_CNTL,
1751 .shift = 16,
1752 .width = 2,
1753 .flags = CLK_DIVIDER_POWER_OF_TWO,
1754 },
1755 .hw.init = &(struct clk_init_data){
1756 .name = "gp_pll",
1757 .ops = &clk_regmap_divider_ops,
1758 .parent_names = (const char *[]){ "gp_pll_dco" },
1759 .num_parents = 1,
1760 .flags = CLK_SET_RATE_PARENT,
1761 },
1762};
1763
1706/* Everything Else (EE) domain gates */ 1764/* Everything Else (EE) domain gates */
1707 1765
1708static MESON_GATE(meson8b_ddr, HHI_GCLK_MPEG0, 0); 1766static MESON_GATE(meson8b_ddr, HHI_GCLK_MPEG0, 0);
@@ -2338,6 +2396,8 @@ static struct clk_hw_onecell_data meson8m2_hw_onecell_data = {
2338 [CLKID_MALI_1_DIV] = &meson8b_mali_1_div.hw, 2396 [CLKID_MALI_1_DIV] = &meson8b_mali_1_div.hw,
2339 [CLKID_MALI_1] = &meson8b_mali_1.hw, 2397 [CLKID_MALI_1] = &meson8b_mali_1.hw,
2340 [CLKID_MALI] = &meson8b_mali.hw, 2398 [CLKID_MALI] = &meson8b_mali.hw,
2399 [CLKID_GP_PLL_DCO] = &meson8m2_gp_pll_dco.hw,
2400 [CLKID_GP_PLL] = &meson8m2_gp_pll.hw,
2341 [CLK_NR_CLKS] = NULL, 2401 [CLK_NR_CLKS] = NULL,
2342 }, 2402 },
2343 .num = CLK_NR_CLKS, 2403 .num = CLK_NR_CLKS,
@@ -2500,6 +2560,8 @@ static struct clk_regmap *const meson8b_clk_regmaps[] = {
2500 &meson8b_mali_1_div, 2560 &meson8b_mali_1_div,
2501 &meson8b_mali_1, 2561 &meson8b_mali_1,
2502 &meson8b_mali, 2562 &meson8b_mali,
2563 &meson8m2_gp_pll_dco,
2564 &meson8m2_gp_pll,
2503}; 2565};
2504 2566
2505static const struct meson8b_clk_reset_line { 2567static const struct meson8b_clk_reset_line {
diff --git a/drivers/clk/meson/meson8b.h b/drivers/clk/meson/meson8b.h
index b8c58faeae52..a45f7102c558 100644
--- a/drivers/clk/meson/meson8b.h
+++ b/drivers/clk/meson/meson8b.h
@@ -19,6 +19,7 @@
19 * 19 *
20 * [0] http://dn.odroid.com/S805/Datasheet/S805_Datasheet%20V0.8%2020150126.pdf 20 * [0] http://dn.odroid.com/S805/Datasheet/S805_Datasheet%20V0.8%2020150126.pdf
21 */ 21 */
22#define HHI_GP_PLL_CNTL 0x40 /* 0x10 offset in data sheet */
22#define HHI_VIID_CLK_DIV 0x128 /* 0x4a offset in data sheet */ 23#define HHI_VIID_CLK_DIV 0x128 /* 0x4a offset in data sheet */
23#define HHI_VIID_CLK_CNTL 0x12c /* 0x4b offset in data sheet */ 24#define HHI_VIID_CLK_CNTL 0x12c /* 0x4b offset in data sheet */
24#define HHI_GCLK_MPEG0 0x140 /* 0x50 offset in data sheet */ 25#define HHI_GCLK_MPEG0 0x140 /* 0x50 offset in data sheet */
@@ -146,8 +147,10 @@
146#define CLKID_MALI_1_SEL 178 147#define CLKID_MALI_1_SEL 178
147#define CLKID_MALI_1_DIV 179 148#define CLKID_MALI_1_DIV 179
148#define CLKID_MALI_1 180 149#define CLKID_MALI_1 180
150#define CLKID_GP_PLL_DCO 181
151#define CLKID_GP_PLL 182
149 152
150#define CLK_NR_CLKS 181 153#define CLK_NR_CLKS 183
151 154
152/* 155/*
153 * include the CLKID and RESETID that have 156 * include the CLKID and RESETID that have