mirror of
https://github.com/Fishwaldo/build.git
synced 2025-03-27 09:11:49 +00:00
209 lines
5.7 KiB
Diff
209 lines
5.7 KiB
Diff
From af43b8d8c91eda0e1cb78e758690a4a282656d48 Mon Sep 17 00:00:00 2001
|
|
From: Jerome Brunet <jbrunet@baylibre.com>
|
|
Date: Mon, 30 Jan 2017 11:34:32 +0100
|
|
Subject: [PATCH 68/93] clk: meson8b: add mplls clocks
|
|
|
|
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
|
|
---
|
|
drivers/clk/meson/meson8b.c | 123 ++++++++++++++++++++++++++++++++++++++++++++
|
|
drivers/clk/meson/meson8b.h | 21 +++++++-
|
|
2 files changed, 143 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/drivers/clk/meson/meson8b.c b/drivers/clk/meson/meson8b.c
|
|
index 3f1be46..08644fb 100644
|
|
--- a/drivers/clk/meson/meson8b.c
|
|
+++ b/drivers/clk/meson/meson8b.c
|
|
@@ -246,6 +246,115 @@
|
|
};
|
|
|
|
/*
|
|
+ * Unlike mpll1 and mpll2, mpll0 has an additional enable / disable bit. Let's
|
|
+ * model this using a clock gate. To make this oddity transparent to the clock
|
|
+ * consumer, let's give the CLKID_MPLL0 id to the gate and let the rate
|
|
+ * propagate to the pll itself.
|
|
+ */
|
|
+static struct meson_clk_mpll meson8b_mpll0_pll = {
|
|
+ .sdm = {
|
|
+ .reg_off = HHI_MPLL_CNTL7,
|
|
+ .shift = 0,
|
|
+ .width = 14,
|
|
+ },
|
|
+ .sdm_en = {
|
|
+ .reg_off = HHI_MPLL_CNTL7,
|
|
+ .shift = 15,
|
|
+ .width = 1,
|
|
+ },
|
|
+ .n2 = {
|
|
+ .reg_off = HHI_MPLL_CNTL7,
|
|
+ .shift = 16,
|
|
+ .width = 9,
|
|
+ },
|
|
+ .en = {
|
|
+ .reg_off = HHI_MPLL_CNTL7,
|
|
+ .shift = 14,
|
|
+ .width = 1,
|
|
+ },
|
|
+ .lock = &clk_lock,
|
|
+ .hw.init = &(struct clk_init_data){
|
|
+ .name = "mpll0_pll",
|
|
+ .ops = &meson_clk_mpll_ops,
|
|
+ .parent_names = (const char *[]){ "fixed_pll" },
|
|
+ .num_parents = 1,
|
|
+ },
|
|
+};
|
|
+
|
|
+static struct clk_gate meson8b_mpll0 = {
|
|
+ .reg = (void *)HHI_MPLL_CNTL,
|
|
+ .bit_idx = 25,
|
|
+ .lock = &clk_lock,
|
|
+ .hw.init = &(struct clk_init_data){
|
|
+ .name = "mpll0",
|
|
+ .ops = &clk_gate_ops,
|
|
+ .parent_names = (const char *[]){ "mpll0_pll" },
|
|
+ .num_parents = 1,
|
|
+ .flags = (CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED),
|
|
+ },
|
|
+};
|
|
+
|
|
+static struct meson_clk_mpll meson8b_mpll1 = {
|
|
+ .sdm = {
|
|
+ .reg_off = HHI_MPLL_CNTL8,
|
|
+ .shift = 0,
|
|
+ .width = 14,
|
|
+ },
|
|
+ .sdm_en = {
|
|
+ .reg_off = HHI_MPLL_CNTL8,
|
|
+ .shift = 15,
|
|
+ .width = 1,
|
|
+ },
|
|
+ .n2 = {
|
|
+ .reg_off = HHI_MPLL_CNTL8,
|
|
+ .shift = 16,
|
|
+ .width = 9,
|
|
+ },
|
|
+ .en = {
|
|
+ .reg_off = HHI_MPLL_CNTL8,
|
|
+ .shift = 14,
|
|
+ .width = 1,
|
|
+ },
|
|
+ .lock = &clk_lock,
|
|
+ .hw.init = &(struct clk_init_data){
|
|
+ .name = "mpll1",
|
|
+ .ops = &meson_clk_mpll_ops,
|
|
+ .parent_names = (const char *[]){ "fixed_pll" },
|
|
+ .num_parents = 1,
|
|
+ },
|
|
+};
|
|
+
|
|
+static struct meson_clk_mpll meson8b_mpll2 = {
|
|
+ .sdm = {
|
|
+ .reg_off = HHI_MPLL_CNTL9,
|
|
+ .shift = 0,
|
|
+ .width = 14,
|
|
+ },
|
|
+ .sdm_en = {
|
|
+ .reg_off = HHI_MPLL_CNTL9,
|
|
+ .shift = 15,
|
|
+ .width = 1,
|
|
+ },
|
|
+ .n2 = {
|
|
+ .reg_off = HHI_MPLL_CNTL9,
|
|
+ .shift = 16,
|
|
+ .width = 9,
|
|
+ },
|
|
+ .en = {
|
|
+ .reg_off = HHI_MPLL_CNTL9,
|
|
+ .shift = 14,
|
|
+ .width = 1,
|
|
+ },
|
|
+ .lock = &clk_lock,
|
|
+ .hw.init = &(struct clk_init_data){
|
|
+ .name = "mpll2",
|
|
+ .ops = &meson_clk_mpll_ops,
|
|
+ .parent_names = (const char *[]){ "fixed_pll" },
|
|
+ .num_parents = 1,
|
|
+ },
|
|
+};
|
|
+
|
|
+/*
|
|
* FIXME cpu clocks and the legacy composite clocks (e.g. clk81) are both PLL
|
|
* post-dividers and should be modeled with their respective PLLs via the
|
|
* forthcoming coordinated clock rates feature
|
|
@@ -491,6 +600,10 @@ struct clk_gate meson8b_clk81 = {
|
|
[CLKID_AO_AHB_SRAM] = &meson8b_ao_ahb_sram.hw,
|
|
[CLKID_AO_AHB_BUS] = &meson8b_ao_ahb_bus.hw,
|
|
[CLKID_AO_IFACE] = &meson8b_ao_iface.hw,
|
|
+ [CLKID_MPLL0_PLL] = &meson8b_mpll0_pll.hw,
|
|
+ [CLKID_MPLL0] = &meson8b_mpll0.hw,
|
|
+ [CLKID_MPLL1] = &meson8b_mpll1.hw,
|
|
+ [CLKID_MPLL2] = &meson8b_mpll2.hw,
|
|
},
|
|
.num = CLK_NR_CLKS,
|
|
};
|
|
@@ -501,6 +614,12 @@ struct clk_gate meson8b_clk81 = {
|
|
&meson8b_sys_pll,
|
|
};
|
|
|
|
+static struct meson_clk_mpll *const meson8b_clk_mplls[] = {
|
|
+ &meson8b_mpll0_pll,
|
|
+ &meson8b_mpll1,
|
|
+ &meson8b_mpll2,
|
|
+};
|
|
+
|
|
static struct clk_gate *meson8b_clk_gates[] = {
|
|
&meson8b_clk81,
|
|
&meson8b_ddr,
|
|
@@ -601,6 +720,10 @@ static int meson8b_clkc_probe(struct platform_device *pdev)
|
|
for (i = 0; i < ARRAY_SIZE(meson8b_clk_plls); i++)
|
|
meson8b_clk_plls[i]->base = clk_base;
|
|
|
|
+ /* Populate base address for MPLLs */
|
|
+ for (i = 0; i < ARRAY_SIZE(meson8b_clk_mplls); i++)
|
|
+ meson8b_clk_mplls[i]->base = clk_base;
|
|
+
|
|
/* Populate the base address for CPU clk */
|
|
meson8b_cpu_clk.base = clk_base;
|
|
|
|
diff --git a/drivers/clk/meson/meson8b.h b/drivers/clk/meson/meson8b.h
|
|
index 010e958..0f1f05b 100644
|
|
--- a/drivers/clk/meson/meson8b.h
|
|
+++ b/drivers/clk/meson/meson8b.h
|
|
@@ -42,6 +42,21 @@
|
|
#define HHI_VID_PLL_CNTL 0x320 /* 0xc8 offset in data sheet */
|
|
|
|
/*
|
|
+ * MPLL register offeset taken from the S905 datasheet. Vendor kernel source
|
|
+ * confirm these are the same for the S805.
|
|
+ */
|
|
+#define HHI_MPLL_CNTL 0x280 /* 0xa0 offset in data sheet */
|
|
+#define HHI_MPLL_CNTL2 0x284 /* 0xa1 offset in data sheet */
|
|
+#define HHI_MPLL_CNTL3 0x288 /* 0xa2 offset in data sheet */
|
|
+#define HHI_MPLL_CNTL4 0x28C /* 0xa3 offset in data sheet */
|
|
+#define HHI_MPLL_CNTL5 0x290 /* 0xa4 offset in data sheet */
|
|
+#define HHI_MPLL_CNTL6 0x294 /* 0xa5 offset in data sheet */
|
|
+#define HHI_MPLL_CNTL7 0x298 /* MP0, 0xa6 offset in data sheet */
|
|
+#define HHI_MPLL_CNTL8 0x29C /* MP1, 0xa7 offset in data sheet */
|
|
+#define HHI_MPLL_CNTL9 0x2A0 /* MP2, 0xa8 offset in data sheet */
|
|
+#define HHI_MPLL_CNTL10 0x2A4 /* MP2, 0xa9 offset in data sheet */
|
|
+
|
|
+/*
|
|
* CLKID index values
|
|
*
|
|
* These indices are entirely contrived and do not map onto the hardware.
|
|
@@ -142,8 +157,12 @@
|
|
#define CLKID_AO_AHB_SRAM 90
|
|
#define CLKID_AO_AHB_BUS 91
|
|
#define CLKID_AO_IFACE 92
|
|
+#define CLKID_MPLL0_PLL 93
|
|
+#define CLKID_MPLL0 94
|
|
+#define CLKID_MPLL1 95
|
|
+#define CLKID_MPLL2 96
|
|
|
|
-#define CLK_NR_CLKS 93
|
|
+#define CLK_NR_CLKS 97
|
|
|
|
/* include the CLKIDs that have been made part of the stable DT binding */
|
|
#include <dt-bindings/clock/meson8b-clkc.h>
|
|
--
|
|
1.9.1
|
|
|