.flags = (CLK_GET_RATE_NOCACHE | CLK_IGNORE_UNUSED),
},
};
-#if 0
-static struct clk_gate axg_pcie_input_gate = {
- .reg = (void *)HHI_PCIE_PLL_CNTL6,
- .bit_idx = 1,
- .lock = &clk_lock,
- .hw.init = &(struct clk_init_data) {
- .name = "axg_pcie_input_gate",
- .ops = &clk_gate_ops,
- .parent_names = (const char *[]){ "pcie_input" },
- .num_parents = 1,
- .flags = (CLK_GET_RATE_NOCACHE | CLK_IGNORE_UNUSED),
- },
-};
-#endif
+
static struct clk_mux axg_pcie_ref = {
.reg = (void *)HHI_PCIE_PLL_CNTL6,
.mask = 0x1,
.flags = (CLK_GET_RATE_NOCACHE | CLK_IGNORE_UNUSED),
},
};
+
+static struct clk_gate axg_mipi_enable_gate = {
+ .reg = (void *)HHI_MIPI_CNTL0,
+ .bit_idx = 29,
+ .lock = &clk_lock,
+ .hw.init = &(struct clk_init_data) {
+ .name = "axg_mipi_enable_gate",
+ .ops = &clk_gate_ops,
+ .parent_names = (const char *[]){ "NULL" },
+ .num_parents = 0,
+ .flags = (CLK_GET_RATE_NOCACHE | CLK_IGNORE_UNUSED),
+ },
+};
+
+static struct clk_gate axg_mipi_bandgap_gate = {
+ .reg = (void *)HHI_MIPI_CNTL0,
+ .bit_idx = 26,
+ .lock = &clk_lock,
+ .hw.init = &(struct clk_init_data) {
+ .name = "axg_mipi_bandgap_gate",
+ .ops = &clk_gate_ops,
+ .parent_names = (const char *[]){ "NULL" },
+ .num_parents = 0,
+ .flags = (CLK_GET_RATE_NOCACHE | CLK_IGNORE_UNUSED),
+ },
+};
+
/*
* FIXME cpu clocks and the legacy composite clocks (e.g. clk81) are both PLL
* post-dividers and should be modelled with their respective PLLs via the
[CLKID_PCIE_REF] = &axg_pcie_ref.hw,
[CLKID_PCIE_CML_EN0] = &axg_pcie_cml_en0.hw,
[CLKID_PCIE_CML_EN1] = &axg_pcie_cml_en1.hw,
+ [CLKID_MIPI_ENABLE_GATE] = &axg_mipi_enable_gate.hw,
+ [CLKID_MIPI_BANDGAP_GATE] = &axg_mipi_bandgap_gate.hw,
};
/* Convenience tables to populate base addresses in .probe */
&axg_ao_ahb_bus,
&axg_ao_iface,
&axg_ao_i2c,
+ &axg_mipi_enable_gate,
+ &axg_mipi_bandgap_gate,
};
static void __init axg_clkc_init(struct device_node *np)
*/
#include <linux/clk-provider.h>
+#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/io.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/amlogic/cpu_version.h>
-#include <linux/clk.h>
+#include <dt-bindings/clock/amlogic,axg-clkc.h>
#ifdef CONFIG_ARM64
#include "../clkc.h"
void *cntlbase = pll->base + p->reg_off;
if (!strcmp(clk_hw_get_name(hw), "pcie_pll")) {
- reg = readl(pll->base);
- reg |= (AXG_MIPI_CNTL0_ENABLE | AXG_MIPI_CNTL0_BANDGAP);
- writel(reg, pll->base);
writel(AXG_PCIE_PLL_CNTL, cntlbase + (u64)(0*4));
writel(AXG_PCIE_PLL_CNTL1, cntlbase + (u64)(1*4));
writel(AXG_PCIE_PLL_CNTL2, cntlbase + (u64)(2*4));
void *cntlbase = pll->base + p->reg_off;
if (!strcmp(clk_hw_get_name(hw), "pcie_pll")) {
+ clk_prepare_enable(clks[CLKID_MIPI_ENABLE_GATE]);
+ clk_prepare_enable(clks[CLKID_MIPI_BANDGAP_GATE]);
if (readl(cntlbase + (u64)(6*4)) == AXG_PCIE_PLL_CNTL6)
first_set = 0;
} else if (!strcmp(clk_hw_get_name(hw), "hifi_pll")) {
writel(readl(pll->base + p->reg_off) & (~MESON_PLL_ENABLE),
pll->base + p->reg_off);
+ if (!strcmp(clk_hw_get_name(hw), "pcie_pll")) {
+ clk_disable_unprepare(clks[CLKID_MIPI_ENABLE_GATE]);
+ clk_disable_unprepare(clks[CLKID_MIPI_BANDGAP_GATE]);
+ };
+
if (pll->lock)
spin_unlock_irqrestore(pll->lock, flags);
}