Commit a339bdf6 authored by Stephen Boyd's avatar Stephen Boyd

Merge branches 'clk-stratix10', 'clk-imx', 'clk-bcm', 'clk-cs2000' and 'clk-imx6sll' into clk-next

* clk-stratix10:
  clk: socfpga: stratix10: add clock driver for Stratix10 platform
  dt-bindings: documentation: add clock bindings information for Stratix10

* clk-imx:
  clk: imx7d: Move clks_init_on before any clock operations
  clk: imx7d: Correct ahb clk parent select
  clk: imx7d: Correct dram pll type
  clk: imx7d: Add USB clock information
  clk: imx: pllv2: avoid using uninitialized values
  clk: imx6ull: Add epdc_podf instead of sim_podf
  clk: imx: imx7d: correct video pll clock tree
  clk: imx: imx7d: add the Keypad Port module clock
  clk: imx7d: add CAAM clock
  clk: imx: imx7d: add the snvs clock
  clk: imx: imx6sx: update cko mux options

* clk-bcm:
  clk: bcm2835: De-assert/assert PLL reset signal when appropriate

* clk-cs2000:
  clk: cs2000: set pm_ops in hibernate-compatible way

* clk-imx6sll:
  clk: imx: add clock driver for imx6sll
  dt-bindings: imx: update clock doc for imx6sll
  clk: imx: add new gate/gate2 wrapper funtion
  clk: imx: Add CLK_IS_CRITICAL flag for busy divider and busy mux
* Clock bindings for Freescale i.MX6 SLL
Required properties:
- compatible: Should be "fsl,imx6sll-ccm"
- reg: Address and length of the register set
- #clock-cells: Should be <1>
- clocks: list of clock specifiers, must contain an entry for each required
entry in clock-names
- clock-names: should include entries "ckil", "osc", "ipp_di0" and "ipp_di1"
The clock consumer should specify the desired clock by having the clock
ID in its "clocks" phandle cell. See include/dt-bindings/clock/imx6sll-clock.h
for the full list of i.MX6 SLL clock IDs.
Examples:
#include <dt-bindings/clock/imx6sll-clock.h>
clks: clock-controller@20c4000 {
compatible = "fsl,imx6sll-ccm";
reg = <0x020c4000 0x4000>;
interrupts = <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 88 IRQ_TYPE_LEVEL_HIGH>;
#clock-cells = <1>;
clocks = <&ckil>, <&osc>, <&ipp_di0>, <&ipp_di1>;
clock-names = "ckil", "osc", "ipp_di0", "ipp_di1";
};
uart1: serial@2020000 {
compatible = "fsl,imx6sl-uart", "fsl,imx6q-uart", "fsl,imx21-uart";
reg = <0x02020000 0x4000>;
interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clks IMX6SLL_CLK_UART1_IPG>,
<&clks IMX6SLL_CLK_UART1_SERIAL>;
clock-names = "ipg", "per";
};
Device Tree Clock bindings for Intel's SoCFPGA Stratix10 platform
This binding uses the common clock binding[1].
[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
Required properties:
- compatible : shall be
"intel,stratix10-clkmgr"
- reg : shall be the control register offset from CLOCK_MANAGER's base for the clock.
- #clock-cells : from common clock binding, shall be set to 1.
Example:
clkmgr: clock-controller@ffd10000 {
compatible = "intel,stratix10-clkmgr";
reg = <0xffd10000 0x1000>;
#clock-cells = <1>;
};
......@@ -91,6 +91,7 @@ obj-$(CONFIG_ARCH_SOCFPGA) += socfpga/
obj-$(CONFIG_PLAT_SPEAR) += spear/
obj-$(CONFIG_ARCH_SPRD) += sprd/
obj-$(CONFIG_ARCH_STI) += st/
obj-$(CONFIG_ARCH_STRATIX10) += socfpga/
obj-$(CONFIG_ARCH_SUNXI) += sunxi/
obj-$(CONFIG_ARCH_SUNXI) += sunxi-ng/
obj-$(CONFIG_ARCH_TEGRA) += tegra/
......
......@@ -602,9 +602,7 @@ static void bcm2835_pll_off(struct clk_hw *hw)
const struct bcm2835_pll_data *data = pll->data;
spin_lock(&cprman->regs_lock);
cprman_write(cprman, data->cm_ctrl_reg,
cprman_read(cprman, data->cm_ctrl_reg) |
CM_PLL_ANARST);
cprman_write(cprman, data->cm_ctrl_reg, CM_PLL_ANARST);
cprman_write(cprman, data->a2w_ctrl_reg,
cprman_read(cprman, data->a2w_ctrl_reg) |
A2W_PLL_CTRL_PWRDN);
......@@ -638,6 +636,10 @@ static int bcm2835_pll_on(struct clk_hw *hw)
cpu_relax();
}
cprman_write(cprman, data->a2w_ctrl_reg,
cprman_read(cprman, data->a2w_ctrl_reg) |
A2W_PLL_CTRL_PRST_DISABLE);
return 0;
}
......
......@@ -549,7 +549,7 @@ static int cs2000_resume(struct device *dev)
}
static const struct dev_pm_ops cs2000_pm_ops = {
.resume_early = cs2000_resume,
SET_LATE_SYSTEM_SLEEP_PM_OPS(NULL, cs2000_resume)
};
static struct i2c_driver cs2000_driver = {
......
......@@ -22,6 +22,7 @@ obj-$(CONFIG_SOC_IMX35) += clk-imx35.o
obj-$(CONFIG_SOC_IMX5) += clk-imx51-imx53.o
obj-$(CONFIG_SOC_IMX6Q) += clk-imx6q.o
obj-$(CONFIG_SOC_IMX6SL) += clk-imx6sl.o
obj-$(CONFIG_SOC_IMX6SLL) += clk-imx6sll.o
obj-$(CONFIG_SOC_IMX6SX) += clk-imx6sx.o
obj-$(CONFIG_SOC_IMX6UL) += clk-imx6ul.o
obj-$(CONFIG_SOC_IMX7D) += clk-imx7d.o
......
......@@ -101,7 +101,7 @@ struct clk *imx_clk_busy_divider(const char *name, const char *parent_name,
init.name = name;
init.ops = &clk_busy_divider_ops;
init.flags = CLK_SET_RATE_PARENT;
init.flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL;
init.parent_names = &parent_name;
init.num_parents = 1;
......@@ -175,7 +175,7 @@ struct clk *imx_clk_busy_mux(const char *name, void __iomem *reg, u8 shift,
init.name = name;
init.ops = &clk_busy_mux_ops;
init.flags = 0;
init.flags = CLK_IS_CRITICAL;
init.parent_names = parent_names;
init.num_parents = num_parents;
......
This diff is collapsed.
......@@ -63,17 +63,17 @@ static const char *lcdif2_sels[] = { "lcdif2_podf", "ipp_di0", "ipp_di1", "ldb_d
static const char *display_sels[] = { "pll2_bus", "pll2_pfd2_396m", "pll3_usb_otg", "pll3_pfd1_540m", };
static const char *csi_sels[] = { "osc", "pll2_pfd2_396m", "pll3_120m", "pll3_pfd1_540m", };
static const char *cko1_sels[] = {
"pll3_usb_otg", "pll2_bus", "pll1_sys", "pll5_video_div",
"dummy", "ocram", "dummy", "pxp_axi", "epdc_axi", "lcdif_pix",
"epdc_pix", "ahb", "ipg", "perclk", "ckil", "pll4_audio_div",
"dummy", "dummy", "dummy", "dummy",
"vadc", "ocram", "qspi2", "m4", "enet_ahb", "lcdif2_pix",
"lcdif1_pix", "ahb", "ipg", "perclk", "ckil", "pll4_audio_div",
};
static const char *cko2_sels[] = {
"dummy", "mmdc_p0_fast", "usdhc4", "usdhc1", "dummy", "wrck",
"ecspi_root", "dummy", "usdhc3", "pcie", "arm", "csi_core",
"lcdif_axi", "dummy", "osc", "dummy", "gpu2d_ovg_core",
"usdhc2", "ssi1", "ssi2", "ssi3", "gpu2d_core", "dummy",
"dummy", "dummy", "dummy", "esai_extal", "eim_slow", "uart_serial",
"spdif", "asrc", "dummy",
"display_axi", "dummy", "osc", "dummy", "dummy",
"usdhc2", "ssi1", "ssi2", "ssi3", "gpu_axi_podf", "dummy",
"can_podf", "lvds1_out", "qspi1", "esai_extal", "eim_slow",
"uart_serial", "spdif", "audio", "dummy",
};
static const char *cko_sels[] = { "cko1", "cko2", };
static const char *lvds_sels[] = {
......
......@@ -308,7 +308,10 @@ static void __init imx6ul_clocks_init(struct device_node *ccm_node)
clks[IMX6UL_CLK_SAI2_PODF] = imx_clk_divider("sai2_podf", "sai2_pred", base + 0x2c, 0, 6);
clks[IMX6UL_CLK_SPDIF_PRED] = imx_clk_divider("spdif_pred", "spdif_sel", base + 0x30, 25, 3);
clks[IMX6UL_CLK_SPDIF_PODF] = imx_clk_divider("spdif_podf", "spdif_pred", base + 0x30, 22, 3);
if (clk_on_imx6ul())
clks[IMX6UL_CLK_SIM_PODF] = imx_clk_divider("sim_podf", "sim_pre_sel", base + 0x34, 12, 3);
else if (clk_on_imx6ull())
clks[IMX6ULL_CLK_EPDC_PODF] = imx_clk_divider("epdc_podf", "epdc_pre_sel", base + 0x34, 12, 3);
clks[IMX6UL_CLK_ECSPI_PODF] = imx_clk_divider("ecspi_podf", "ecspi_sel", base + 0x38, 19, 6);
clks[IMX6UL_CLK_LCDIF_PRED] = imx_clk_divider("lcdif_pred", "lcdif_pre_sel", base + 0x38, 12, 3);
clks[IMX6UL_CLK_CSI_PODF] = imx_clk_divider("csi_podf", "csi_sel", base + 0x3c, 11, 3);
......
This diff is collapsed.
......@@ -182,8 +182,12 @@ static long clk_pllv2_round_rate(struct clk_hw *hw, unsigned long rate,
unsigned long *prate)
{
u32 dp_op, dp_mfd, dp_mfn;
int ret;
ret = __clk_pllv2_set_rate(rate, *prate, &dp_op, &dp_mfd, &dp_mfn);
if (ret)
return ret;
__clk_pllv2_set_rate(rate, *prate, &dp_op, &dp_mfd, &dp_mfn);
return __clk_pllv2_recalc_rate(*prate, MXC_PLL_DP_CTL_DPDCK0_2_EN,
dp_op, dp_mfd, dp_mfn);
}
......
......@@ -123,6 +123,13 @@ static inline struct clk *imx_clk_gate(const char *name, const char *parent,
shift, 0, &imx_ccm_lock);
}
static inline struct clk *imx_clk_gate_flags(const char *name, const char *parent,
void __iomem *reg, u8 shift, unsigned long flags)
{
return clk_register_gate(NULL, name, parent, flags | CLK_SET_RATE_PARENT, reg,
shift, 0, &imx_ccm_lock);
}
static inline struct clk *imx_clk_gate_dis(const char *name, const char *parent,
void __iomem *reg, u8 shift)
{
......@@ -137,6 +144,13 @@ static inline struct clk *imx_clk_gate2(const char *name, const char *parent,
shift, 0x3, 0, &imx_ccm_lock, NULL);
}
static inline struct clk *imx_clk_gate2_flags(const char *name, const char *parent,
void __iomem *reg, u8 shift, unsigned long flags)
{
return clk_register_gate2(NULL, name, parent, flags | CLK_SET_RATE_PARENT, reg,
shift, 0x3, 0, &imx_ccm_lock, NULL);
}
static inline struct clk *imx_clk_gate2_shared(const char *name,
const char *parent, void __iomem *reg, u8 shift,
unsigned int *share_count)
......
# SPDX-License-Identifier: GPL-2.0
obj-y += clk.o
obj-y += clk-gate.o
obj-y += clk-pll.o
obj-y += clk-periph.o
obj-y += clk-pll-a10.o clk-periph-a10.o clk-gate-a10.o
obj-$(CONFIG_ARCH_SOCFPGA) += clk.o clk-gate.o clk-pll.o clk-periph.o
obj-$(CONFIG_ARCH_SOCFPGA) += clk-pll-a10.o clk-periph-a10.o clk-gate-a10.o
obj-$(CONFIG_ARCH_STRATIX10) += clk-s10.o
obj-$(CONFIG_ARCH_STRATIX10) += clk-pll-s10.o clk-periph-s10.o clk-gate-s10.o
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2017, Intel Corporation
*/
#include <linux/clk-provider.h>
#include <linux/slab.h>
#include "stratix10-clk.h"
#include "clk.h"
#define SOCFPGA_CS_PDBG_CLK "cs_pdbg_clk"
#define to_socfpga_gate_clk(p) container_of(p, struct socfpga_gate_clk, hw.hw)
static unsigned long socfpga_gate_clk_recalc_rate(struct clk_hw *hwclk,
unsigned long parent_rate)
{
struct socfpga_gate_clk *socfpgaclk = to_socfpga_gate_clk(hwclk);
u32 div = 1, val;
if (socfpgaclk->fixed_div) {
div = socfpgaclk->fixed_div;
} else if (socfpgaclk->div_reg) {
val = readl(socfpgaclk->div_reg) >> socfpgaclk->shift;
val &= GENMASK(socfpgaclk->width - 1, 0);
div = (1 << val);
}
return parent_rate / div;
}
static unsigned long socfpga_dbg_clk_recalc_rate(struct clk_hw *hwclk,
unsigned long parent_rate)
{
struct socfpga_gate_clk *socfpgaclk = to_socfpga_gate_clk(hwclk);
u32 div = 1, val;
val = readl(socfpgaclk->div_reg) >> socfpgaclk->shift;
val &= GENMASK(socfpgaclk->width - 1, 0);
div = (1 << val);
div = div ? 4 : 1;
return parent_rate / div;
}
static u8 socfpga_gate_get_parent(struct clk_hw *hwclk)
{
struct socfpga_gate_clk *socfpgaclk = to_socfpga_gate_clk(hwclk);
u32 mask;
u8 parent = 0;
if (socfpgaclk->bypass_reg) {
mask = (0x1 << socfpgaclk->bypass_shift);
parent = ((readl(socfpgaclk->bypass_reg) & mask) >>
socfpgaclk->bypass_shift);
}
return parent;
}
static struct clk_ops gateclk_ops = {
.recalc_rate = socfpga_gate_clk_recalc_rate,
.get_parent = socfpga_gate_get_parent,
};
static const struct clk_ops dbgclk_ops = {
.recalc_rate = socfpga_dbg_clk_recalc_rate,
.get_parent = socfpga_gate_get_parent,
};
struct clk *s10_register_gate(const char *name, const char *parent_name,
const char * const *parent_names,
u8 num_parents, unsigned long flags,
void __iomem *regbase, unsigned long gate_reg,
unsigned long gate_idx, unsigned long div_reg,
unsigned long div_offset, u8 div_width,
unsigned long bypass_reg, u8 bypass_shift,
u8 fixed_div)
{
struct clk *clk;
struct socfpga_gate_clk *socfpga_clk;
struct clk_init_data init;
socfpga_clk = kzalloc(sizeof(*socfpga_clk), GFP_KERNEL);
if (!socfpga_clk)
return NULL;
socfpga_clk->hw.reg = regbase + gate_reg;
socfpga_clk->hw.bit_idx = gate_idx;
gateclk_ops.enable = clk_gate_ops.enable;
gateclk_ops.disable = clk_gate_ops.disable;
socfpga_clk->fixed_div = fixed_div;
if (div_reg)
socfpga_clk->div_reg = regbase + div_reg;
else
socfpga_clk->div_reg = NULL;
socfpga_clk->width = div_width;
socfpga_clk->shift = div_offset;
if (bypass_reg)
socfpga_clk->bypass_reg = regbase + bypass_reg;
else
socfpga_clk->bypass_reg = NULL;
socfpga_clk->bypass_shift = bypass_shift;
if (streq(name, "cs_pdbg_clk"))
init.ops = &dbgclk_ops;
else
init.ops = &gateclk_ops;
init.name = name;
init.flags = flags;
init.num_parents = num_parents;
init.parent_names = parent_names ? parent_names : &parent_name;
socfpga_clk->hw.hw.init = &init;
clk = clk_register(NULL, &socfpga_clk->hw.hw);
if (WARN_ON(IS_ERR(clk))) {
kfree(socfpga_clk);
return NULL;
}
return clk;
}
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2017, Intel Corporation
*/
#include <linux/slab.h>
#include <linux/clk-provider.h>
#include "stratix10-clk.h"
#include "clk.h"
#define CLK_MGR_FREE_SHIFT 16
#define CLK_MGR_FREE_MASK 0x7
#define SWCTRLBTCLKSEN_SHIFT 8
#define to_periph_clk(p) container_of(p, struct socfpga_periph_clk, hw.hw)
static unsigned long clk_peri_c_clk_recalc_rate(struct clk_hw *hwclk,
unsigned long parent_rate)
{
struct socfpga_periph_clk *socfpgaclk = to_periph_clk(hwclk);
unsigned long div = 1;
u32 val;
val = readl(socfpgaclk->hw.reg);
val &= GENMASK(SWCTRLBTCLKSEN_SHIFT - 1, 0);
parent_rate /= val;
return parent_rate / div;
}
static unsigned long clk_peri_cnt_clk_recalc_rate(struct clk_hw *hwclk,
unsigned long parent_rate)
{
struct socfpga_periph_clk *socfpgaclk = to_periph_clk(hwclk);
unsigned long div = 1;
if (socfpgaclk->fixed_div) {
div = socfpgaclk->fixed_div;
} else {
if (!socfpgaclk->bypass_reg)
div = ((readl(socfpgaclk->hw.reg) & 0x7ff) + 1);
}
return parent_rate / div;
}
static u8 clk_periclk_get_parent(struct clk_hw *hwclk)
{
struct socfpga_periph_clk *socfpgaclk = to_periph_clk(hwclk);
u32 clk_src, mask;
u8 parent;
if (socfpgaclk->bypass_reg) {
mask = (0x1 << socfpgaclk->bypass_shift);
parent = ((readl(socfpgaclk->bypass_reg) & mask) >>
socfpgaclk->bypass_shift);
} else {
clk_src = readl(socfpgaclk->hw.reg);
parent = (clk_src >> CLK_MGR_FREE_SHIFT) &
CLK_MGR_FREE_MASK;
}
return parent;
}
static const struct clk_ops peri_c_clk_ops = {
.recalc_rate = clk_peri_c_clk_recalc_rate,
.get_parent = clk_periclk_get_parent,
};
static const struct clk_ops peri_cnt_clk_ops = {
.recalc_rate = clk_peri_cnt_clk_recalc_rate,
.get_parent = clk_periclk_get_parent,
};
struct clk *s10_register_periph(const char *name, const char *parent_name,
const char * const *parent_names,
u8 num_parents, unsigned long flags,
void __iomem *reg, unsigned long offset)
{
struct clk *clk;
struct socfpga_periph_clk *periph_clk;
struct clk_init_data init;
periph_clk = kzalloc(sizeof(*periph_clk), GFP_KERNEL);
if (WARN_ON(!periph_clk))
return NULL;
periph_clk->hw.reg = reg + offset;
init.name = name;
init.ops = &peri_c_clk_ops;
init.flags = flags;
init.num_parents = num_parents;
init.parent_names = parent_names ? parent_names : &parent_name;
periph_clk->hw.hw.init = &init;
clk = clk_register(NULL, &periph_clk->hw.hw);
if (WARN_ON(IS_ERR(clk))) {
kfree(periph_clk);
return NULL;
}
return clk;
}
struct clk *s10_register_cnt_periph(const char *name, const char *parent_name,
const char * const *parent_names,
u8 num_parents, unsigned long flags,
void __iomem *regbase, unsigned long offset,
u8 fixed_divider, unsigned long bypass_reg,
unsigned long bypass_shift)
{
struct clk *clk;
struct socfpga_periph_clk *periph_clk;
struct clk_init_data init;
periph_clk = kzalloc(sizeof(*periph_clk), GFP_KERNEL);
if (WARN_ON(!periph_clk))
return NULL;
if (offset)
periph_clk->hw.reg = regbase + offset;
else
periph_clk->hw.reg = NULL;
if (bypass_reg)
periph_clk->bypass_reg = regbase + bypass_reg;
else
periph_clk->bypass_reg = NULL;
periph_clk->bypass_shift = bypass_shift;
periph_clk->fixed_div = fixed_divider;
init.name = name;
init.ops = &peri_cnt_clk_ops;
init.flags = flags;
init.num_parents = num_parents;
init.parent_names = parent_names ? parent_names : &parent_name;
periph_clk->hw.hw.init = &init;
clk = clk_register(NULL, &periph_clk->hw.hw);
if (WARN_ON(IS_ERR(clk))) {
kfree(periph_clk);
return NULL;
}
return clk;
}
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2017, Intel Corporation
*/
#include <linux/slab.h>
#include <linux/clk-provider.h>
#include "stratix10-clk.h"
#include "clk.h"
/* Clock Manager offsets */
#define CLK_MGR_PLL_CLK_SRC_SHIFT 16
#define CLK_MGR_PLL_CLK_SRC_MASK 0x3
/* PLL Clock enable bits */
#define SOCFPGA_PLL_POWER 0
#define SOCFPGA_PLL_RESET_MASK 0x2
#define SOCFPGA_PLL_REFDIV_MASK 0x00003F00
#define SOCFPGA_PLL_REFDIV_SHIFT 8
#define SOCFPGA_PLL_MDIV_MASK 0xFF000000
#define SOCFPGA_PLL_MDIV_SHIFT 24
#define SWCTRLBTCLKSEL_MASK 0x200
#define SWCTRLBTCLKSEL_SHIFT 9
#define SOCFPGA_BOOT_CLK "boot_clk"
#define to_socfpga_clk(p) container_of(p, struct socfpga_pll, hw.hw)
static unsigned long clk_pll_recalc_rate(struct clk_hw *hwclk,
unsigned long parent_rate)
{
struct socfpga_pll *socfpgaclk = to_socfpga_clk(hwclk);
unsigned long mdiv;
unsigned long refdiv;
unsigned long reg;
unsigned long long vco_freq;
/* read VCO1 reg for numerator and denominator */
reg = readl(socfpgaclk->hw.reg);
refdiv = (reg & SOCFPGA_PLL_REFDIV_MASK) >> SOCFPGA_PLL_REFDIV_SHIFT;
vco_freq = (unsigned long long)parent_rate / refdiv;
/* Read mdiv and fdiv from the fdbck register */
reg = readl(socfpgaclk->hw.reg + 0x4);
mdiv = (reg & SOCFPGA_PLL_MDIV_MASK) >> SOCFPGA_PLL_MDIV_SHIFT;
vco_freq = (unsigned long long)parent_rate * (mdiv + 6);
return (unsigned long)vco_freq;
}
static unsigned long clk_boot_clk_recalc_rate(struct clk_hw *hwclk,
unsigned long parent_rate)
{
struct socfpga_pll *socfpgaclk = to_socfpga_clk(hwclk);
u32 div = 1;
div = ((readl(socfpgaclk->hw.reg) &
SWCTRLBTCLKSEL_MASK) >>
SWCTRLBTCLKSEL_SHIFT);
div += 1;
return parent_rate /= div;
}
static u8 clk_pll_get_parent(struct clk_hw *hwclk)
{
struct socfpga_pll *socfpgaclk = to_socfpga_clk(hwclk);
u32 pll_src;
pll_src = readl(socfpgaclk->hw.reg);
return (pll_src >> CLK_MGR_PLL_CLK_SRC_SHIFT) &
CLK_MGR_PLL_CLK_SRC_MASK;
}
static u8 clk_boot_get_parent(struct clk_hw *hwclk)
{
struct socfpga_pll *socfpgaclk = to_socfpga_clk(hwclk);
u32 pll_src;
pll_src = readl(socfpgaclk->hw.reg);
return (pll_src >> SWCTRLBTCLKSEL_SHIFT) &
SWCTRLBTCLKSEL_MASK;
}
static int clk_pll_prepare(struct clk_hw *hwclk)
{
struct socfpga_pll *socfpgaclk = to_socfpga_clk(hwclk);
u32 reg;
/* Bring PLL out of reset */
reg = readl(socfpgaclk->hw.reg);
reg |= SOCFPGA_PLL_RESET_MASK;
writel(reg, socfpgaclk->hw.reg);
return 0;
}
static struct clk_ops clk_pll_ops = {
.recalc_rate = clk_pll_recalc_rate,
.get_parent = clk_pll_get_parent,
.prepare = clk_pll_prepare,
};
static struct clk_ops clk_boot_ops = {
.recalc_rate = clk_boot_clk_recalc_rate,
.get_parent = clk_boot_get_parent,
.prepare = clk_pll_prepare,
};
struct clk *s10_register_pll(const char *name, const char * const *parent_names,
u8 num_parents, unsigned long flags,
void __iomem *reg, unsigned long offset)
{
struct clk *clk;
struct socfpga_pll *pll_clk;
struct clk_init_data init;
pll_clk = kzalloc(sizeof(*pll_clk), GFP_KERNEL);
if (WARN_ON(!pll_clk))
return NULL;
pll_clk->hw.reg = reg + offset;
if (streq(name, SOCFPGA_BOOT_CLK))
init.ops = &clk_boot_ops;
else
init.ops = &clk_pll_ops;
init.name = name;
init.flags = flags;
init.num_parents = num_parents;
init.parent_names = parent_names;
pll_clk->hw.hw.init = &init;
pll_clk->hw.bit_idx = SOCFPGA_PLL_POWER;
clk_pll_ops.enable = clk_gate_ops.enable;
clk_pll_ops.disable = clk_gate_ops.disable;
clk = clk_register(NULL, &pll_clk->hw.hw);
if (WARN_ON(IS_ERR(clk))) {
kfree(pll_clk);
return NULL;
}
return clk;
}
This diff is collapsed.
......@@ -54,9 +54,11 @@ struct socfpga_gate_clk {
char *parent_name;
u32 fixed_div;
void __iomem *div_reg;
void __iomem *bypass_reg;
struct regmap *sys_mgr_base_addr;
u32 width; /* only valid if div_reg != 0 */
u32 shift; /* only valid if div_reg != 0 */
u32 bypass_shift; /* only valid if bypass_reg != 0 */
u32 clk_phase[2];
};
......@@ -65,8 +67,10 @@ struct socfpga_periph_clk {
char *parent_name;
u32 fixed_div;
void __iomem *div_reg;
void __iomem *bypass_reg;
u32 width; /* only valid if div_reg != 0 */
u32 shift; /* only valid if div_reg != 0 */
u32 bypass_shift; /* only valid if bypass_reg != 0 */
};
#endif /* SOCFPGA_CLK_H */
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2017, Intel Corporation
*/
#ifndef __STRATIX10_CLK_H
#define __STRATIX10_CLK_H
struct stratix10_clock_data {
struct clk_onecell_data clk_data;
void __iomem *base;
};
struct stratix10_pll_clock {
unsigned int id;
const char *name;
const char *const *parent_names;
u8 num_parents;
unsigned long flags;
unsigned long offset;
};
struct stratix10_perip_c_clock {
unsigned int id;
const char *name;
const char *parent_name;
const char *const *parent_names;
u8 num_parents;
unsigned long flags;
unsigned long offset;
};
struct stratix10_perip_cnt_clock {
unsigned int id;
const char *name;
const char *parent_name;
const char *const *parent_names;
u8 num_parents;
unsigned long flags;
unsigned long offset;
u8 fixed_divider;
unsigned long bypass_reg;
unsigned long bypass_shift;
};
struct stratix10_gate_clock {
unsigned int id;
const char *name;
const char *parent_name;
const char *const *parent_names;
u8 num_parents;
unsigned long flags;
unsigned long gate_reg;
u8 gate_idx;
unsigned long div_reg;
u8 div_offset;
u8 div_width;
unsigned long bypass_reg;
u8 bypass_shift;
u8 fixed_div;
};
struct clk *s10_register_pll(const char *, const char *const *, u8,
unsigned long, void __iomem *, unsigned long);
struct clk *s10_register_periph(const char *, const char *,
const char * const *, u8, unsigned long,
void __iomem *, unsigned long);
struct clk *s10_register_cnt_periph(const char *, const char *,
const char * const *, u8,
unsigned long, void __iomem *,
unsigned long, u8, unsigned long,
unsigned long);
struct clk *s10_register_gate(const char *, const char *,
const char * const *, u8,
unsigned long, void __iomem *,
unsigned long, unsigned long,
unsigned long, unsigned long, u8,
unsigned long, u8, u8);
#endif /* __STRATIX10_CLK_H */
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2016 Freescale Semiconductor, Inc.
* Copyright 2017-2018 NXP.
*
*/
#ifndef __DT_BINDINGS_CLOCK_IMX6SLL_H
#define __DT_BINDINGS_CLOCK_IMX6SLL_H
#define IMX6SLL_CLK_DUMMY 0
#define IMX6SLL_CLK_CKIL 1
#define IMX6SLL_CLK_OSC 2
#define IMX6SLL_PLL1_BYPASS_SRC 3
#define IMX6SLL_PLL2_BYPASS_SRC 4
#define IMX6SLL_PLL3_BYPASS_SRC 5
#define IMX6SLL_PLL4_BYPASS_SRC 6
#define IMX6SLL_PLL5_BYPASS_SRC 7
#define IMX6SLL_PLL6_BYPASS_SRC 8
#define IMX6SLL_PLL7_BYPASS_SRC 9
#define IMX6SLL_CLK_PLL1 10
#define IMX6SLL_CLK_PLL2 11
#define IMX6SLL_CLK_PLL3 12
#define IMX6SLL_CLK_PLL4 13
#define IMX6SLL_CLK_PLL5 14
#define IMX6SLL_CLK_PLL6 15
#define IMX6SLL_CLK_PLL7 16
#define IMX6SLL_PLL1_BYPASS 17
#define IMX6SLL_PLL2_BYPASS 18
#define IMX6SLL_PLL3_BYPASS 19
#define IMX6SLL_PLL4_BYPASS 20
#define IMX6SLL_PLL5_BYPASS 21
#define IMX6SLL_PLL6_BYPASS 22
#define IMX6SLL_PLL7_BYPASS 23
#define IMX6SLL_CLK_PLL1_SYS 24
#define IMX6SLL_CLK_PLL2_BUS 25
#define IMX6SLL_CLK_PLL3_USB_OTG 26
#define IMX6SLL_CLK_PLL4_AUDIO 27
#define IMX6SLL_CLK_PLL5_VIDEO 28
#define IMX6SLL_CLK_PLL6_ENET 29
#define IMX6SLL_CLK_PLL7_USB_HOST 30
#define IMX6SLL_CLK_USBPHY1 31
#define IMX6SLL_CLK_USBPHY2 32
#define IMX6SLL_CLK_USBPHY1_GATE 33
#define IMX6SLL_CLK_USBPHY2_GATE 34
#define IMX6SLL_CLK_PLL2_PFD0 35
#define IMX6SLL_CLK_PLL2_PFD1 36
#define IMX6SLL_CLK_PLL2_PFD2 37
#define IMX6SLL_CLK_PLL2_PFD3 38
#define IMX6SLL_CLK_PLL3_PFD0 39
#define IMX6SLL_CLK_PLL3_PFD1 40
#define IMX6SLL_CLK_PLL3_PFD2 41
#define IMX6SLL_CLK_PLL3_PFD3 42
#define IMX6SLL_CLK_PLL4_POST_DIV 43
#define IMX6SLL_CLK_PLL4_AUDIO_DIV 44
#define IMX6SLL_CLK_PLL5_POST_DIV 45
#define IMX6SLL_CLK_PLL5_VIDEO_DIV 46
#define IMX6SLL_CLK_PLL2_198M 47
#define IMX6SLL_CLK_PLL3_120M 48
#define IMX6SLL_CLK_PLL3_80M 49
#define IMX6SLL_CLK_PLL3_60M 50
#define IMX6SLL_CLK_STEP 51
#define IMX6SLL_CLK_PLL1_SW 52
#define IMX6SLL_CLK_AXI_ALT_SEL 53
#define IMX6SLL_CLK_AXI_SEL 54
#define IMX6SLL_CLK_PERIPH_PRE 55
#define IMX6SLL_CLK_PERIPH2_PRE 56
#define IMX6SLL_CLK_PERIPH_CLK2_SEL 57
#define IMX6SLL_CLK_PERIPH2_CLK2_SEL 58
#define IMX6SLL_CLK_PERCLK_SEL 59
#define IMX6SLL_CLK_USDHC1_SEL 60
#define IMX6SLL_CLK_USDHC2_SEL 61
#define IMX6SLL_CLK_USDHC3_SEL 62
#define IMX6SLL_CLK_SSI1_SEL 63
#define IMX6SLL_CLK_SSI2_SEL 64
#define IMX6SLL_CLK_SSI3_SEL 65
#define IMX6SLL_CLK_PXP_SEL 66
#define IMX6SLL_CLK_LCDIF_PRE_SEL 67
#define IMX6SLL_CLK_LCDIF_SEL 68
#define IMX6SLL_CLK_EPDC_PRE_SEL 69
#define IMX6SLL_CLK_SPDIF_SEL 70
#define IMX6SLL_CLK_ECSPI_SEL 71
#define IMX6SLL_CLK_UART_SEL 72
#define IMX6SLL_CLK_ARM 73
#define IMX6SLL_CLK_PERIPH 74
#define IMX6SLL_CLK_PERIPH2 75
#define IMX6SLL_CLK_PERIPH2_CLK2 76
#define IMX6SLL_CLK_PERIPH_CLK2 77
#define IMX6SLL_CLK_MMDC_PODF 78
#define IMX6SLL_CLK_AXI_PODF 79
#define IMX6SLL_CLK_AHB 80
#define IMX6SLL_CLK_IPG 81
#define IMX6SLL_CLK_PERCLK 82
#define IMX6SLL_CLK_USDHC1_PODF 83
#define IMX6SLL_CLK_USDHC2_PODF 84
#define IMX6SLL_CLK_USDHC3_PODF 85
#define IMX6SLL_CLK_SSI1_PRED 86
#define IMX6SLL_CLK_SSI2_PRED 87
#define IMX6SLL_CLK_SSI3_PRED 88
#define IMX6SLL_CLK_SSI1_PODF 89
#define IMX6SLL_CLK_SSI2_PODF 90
#define IMX6SLL_CLK_SSI3_PODF 91
#define IMX6SLL_CLK_PXP_PODF 92
#define IMX6SLL_CLK_LCDIF_PRED 93
#define IMX6SLL_CLK_LCDIF_PODF 94
#define IMX6SLL_CLK_EPDC_SEL 95
#define IMX6SLL_CLK_EPDC_PODF 96
#define IMX6SLL_CLK_SPDIF_PRED 97
#define IMX6SLL_CLK_SPDIF_PODF 98
#define IMX6SLL_CLK_ECSPI_PODF 99
#define IMX6SLL_CLK_UART_PODF 100
/* CCGR 0 */
#define IMX6SLL_CLK_AIPSTZ1 101
#define IMX6SLL_CLK_AIPSTZ2 102
#define IMX6SLL_CLK_DCP 103
#define IMX6SLL_CLK_UART2_IPG 104
#define IMX6SLL_CLK_UART2_SERIAL 105
/* CCGR 1 */
#define IMX6SLL_CLK_ECSPI1 106
#define IMX6SLL_CLK_ECSPI2 107
#define IMX6SLL_CLK_ECSPI3 108
#define IMX6SLL_CLK_ECSPI4 109
#define IMX6SLL_CLK_UART3_IPG 110
#define IMX6SLL_CLK_UART3_SERIAL 111
#define IMX6SLL_CLK_UART4_IPG 112
#define IMX6SLL_CLK_UART4_SERIAL 113
#define IMX6SLL_CLK_EPIT1 114
#define IMX6SLL_CLK_EPIT2 115
#define IMX6SLL_CLK_GPT_BUS 116
#define IMX6SLL_CLK_GPT_SERIAL 117
/* CCGR2 */
#define IMX6SLL_CLK_CSI 118
#define IMX6SLL_CLK_I2C1 119
#define IMX6SLL_CLK_I2C2 120
#define IMX6SLL_CLK_I2C3 121
#define IMX6SLL_CLK_OCOTP 122
#define IMX6SLL_CLK_LCDIF_APB 123
#define IMX6SLL_CLK_PXP 124
/* CCGR3 */
#define IMX6SLL_CLK_UART5_IPG 125
#define IMX6SLL_CLK_UART5_SERIAL 126
#define IMX6SLL_CLK_EPDC_AXI 127
#define IMX6SLL_CLK_EPDC_PIX 128
#define IMX6SLL_CLK_LCDIF_PIX 129
#define IMX6SLL_CLK_WDOG1 130
#define IMX6SLL_CLK_MMDC_P0_FAST 131
#define IMX6SLL_CLK_MMDC_P0_IPG 132
#define IMX6SLL_CLK_OCRAM 133
/* CCGR4 */
#define IMX6SLL_CLK_PWM1 134
#define IMX6SLL_CLK_PWM2 135
#define IMX6SLL_CLK_PWM3 136
#define IMX6SLL_CLK_PWM4 137
/* CCGR 5 */
#define IMX6SLL_CLK_ROM 138
#define IMX6SLL_CLK_SDMA 139
#define IMX6SLL_CLK_KPP 140
#define IMX6SLL_CLK_WDOG2 141
#define IMX6SLL_CLK_SPBA 142
#define IMX6SLL_CLK_SPDIF 143
#define IMX6SLL_CLK_SPDIF_GCLK 144
#define IMX6SLL_CLK_SSI1 145
#define IMX6SLL_CLK_SSI1_IPG 146
#define IMX6SLL_CLK_SSI2 147
#define IMX6SLL_CLK_SSI2_IPG 148
#define IMX6SLL_CLK_SSI3 149
#define IMX6SLL_CLK_SSI3_IPG 150
#define IMX6SLL_CLK_UART1_IPG 151
#define IMX6SLL_CLK_UART1_SERIAL 152
/* CCGR 6 */
#define IMX6SLL_CLK_USBOH3 153
#define IMX6SLL_CLK_USDHC1 154
#define IMX6SLL_CLK_USDHC2 155
#define IMX6SLL_CLK_USDHC3 156
#define IMX6SLL_CLK_IPP_DI0 157
#define IMX6SLL_CLK_IPP_DI1 158
#define IMX6SLL_CLK_LDB_DI0_SEL 159
#define IMX6SLL_CLK_LDB_DI0_DIV_3_5 160
#define IMX6SLL_CLK_LDB_DI0_DIV_7 161
#define IMX6SLL_CLK_LDB_DI0_DIV_SEL 162
#define IMX6SLL_CLK_LDB_DI0 163
#define IMX6SLL_CLK_LDB_DI1_SEL 164
#define IMX6SLL_CLK_LDB_DI1_DIV_3_5 165
#define IMX6SLL_CLK_LDB_DI1_DIV_7 166
#define IMX6SLL_CLK_LDB_DI1_DIV_SEL 167
#define IMX6SLL_CLK_LDB_DI1 168
#define IMX6SLL_CLK_EXTERN_AUDIO_SEL 169
#define IMX6SLL_CLK_EXTERN_AUDIO_PRED 170
#define IMX6SLL_CLK_EXTERN_AUDIO_PODF 171
#define IMX6SLL_CLK_EXTERN_AUDIO 172
#define IMX6SLL_CLK_END 173
#endif /* __DT_BINDINGS_CLOCK_IMX6SLL_H */
......@@ -452,5 +452,8 @@
#define IMX7D_OCOTP_CLK 439
#define IMX7D_NAND_RAWNAND_CLK 440
#define IMX7D_NAND_USDHC_BUS_RAWNAND_CLK 441
#define IMX7D_CLK_END 442
#define IMX7D_SNVS_CLK 442
#define IMX7D_CAAM_CLK 443
#define IMX7D_KPP_ROOT_CLK 444
#define IMX7D_CLK_END 445
#endif /* __DT_BINDINGS_CLOCK_IMX7D_H */
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2017, Intel Corporation
*/
#ifndef __STRATIX10_CLOCK_H
#define __STRATIX10_CLOCK_H
/* fixed rate clocks */
#define STRATIX10_OSC1 0
#define STRATIX10_CB_INTOSC_HS_DIV2_CLK 1
#define STRATIX10_CB_INTOSC_LS_CLK 2
#define STRATIX10_F2S_FREE_CLK 3
/* fixed factor clocks */
#define STRATIX10_L4_SYS_FREE_CLK 4
#define STRATIX10_MPU_PERIPH_CLK 5
#define STRATIX10_MPU_L2RAM_CLK 6
#define STRATIX10_SDMMC_CIU_CLK 7
/* PLL clocks */
#define STRATIX10_MAIN_PLL_CLK 8
#define STRATIX10_PERIPH_PLL_CLK 9
#define STRATIX10_BOOT_CLK 10
/* Periph clocks */
#define STRATIX10_MAIN_MPU_BASE_CLK 11
#define STRATIX10_MAIN_NOC_BASE_CLK 12
#define STRATIX10_MAIN_EMACA_CLK 13
#define STRATIX10_MAIN_EMACB_CLK 14
#define STRATIX10_MAIN_EMAC_PTP_CLK 15
#define STRATIX10_MAIN_GPIO_DB_CLK 16
#define STRATIX10_MAIN_SDMMC_CLK 17
#define STRATIX10_MAIN_S2F_USR0_CLK 18
#define STRATIX10_MAIN_S2F_USR1_CLK 19
#define STRATIX10_MAIN_PSI_REF_CLK 20
#define STRATIX10_PERI_MPU_BASE_CLK 21
#define STRATIX10_PERI_NOC_BASE_CLK 22
#define STRATIX10_PERI_EMACA_CLK 23
#define STRATIX10_PERI_EMACB_CLK 24
#define STRATIX10_PERI_EMAC_PTP_CLK 25
#define STRATIX10_PERI_GPIO_DB_CLK 26
#define STRATIX10_PERI_SDMMC_CLK 27
#define STRATIX10_PERI_S2F_USR0_CLK 28
#define STRATIX10_PERI_S2F_USR1_CLK 29
#define STRATIX10_PERI_PSI_REF_CLK 30
#define STRATIX10_MPU_FREE_CLK 31
#define STRATIX10_NOC_FREE_CLK 32
#define STRATIX10_S2F_USR0_CLK 33
#define STRATIX10_NOC_CLK 34
#define STRATIX10_EMAC_A_FREE_CLK 35
#define STRATIX10_EMAC_B_FREE_CLK 36
#define STRATIX10_EMAC_PTP_FREE_CLK 37
#define STRATIX10_GPIO_DB_FREE_CLK 38
#define STRATIX10_SDMMC_FREE_CLK 39
#define STRATIX10_S2F_USER1_FREE_CLK 40
#define STRATIX10_PSI_REF_FREE_CLK 41
/* Gate clocks */
#define STRATIX10_MPU_CLK 42
#define STRATIX10_L4_MAIN_CLK 43
#define STRATIX10_L4_MP_CLK 44
#define STRATIX10_L4_SP_CLK 45
#define STRATIX10_CS_AT_CLK 46
#define STRATIX10_CS_TRACE_CLK 47
#define STRATIX10_CS_PDBG_CLK 48
#define STRATIX10_CS_TIMER_CLK 49
#define STRATIX10_S2F_USER0_CLK 50
#define STRATIX10_S2F_USER1_CLK 51
#define STRATIX10_EMAC0_CLK 52
#define STRATIX10_EMAC1_CLK 53
#define STRATIX10_EMAC2_CLK 54
#define STRATIX10_EMAC_PTP_CLK 55
#define STRATIX10_GPIO_DB_CLK 56
#define STRATIX10_SDMMC_CLK 57
#define STRATIX10_PSI_REF_CLK 58
#define STRATIX10_USB_CLK 59
#define STRATIX10_SPI_M_CLK 60
#define STRATIX10_NAND_CLK 61
#define STRATIX10_NUM_CLKS 62
#endif /* __STRATIX10_CLOCK_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment