Commit 203f974d authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski

Merge branch 'clk-samsung' of...

Merge branch 'clk-samsung' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux into next/soc64

Before removal of ARCH_EXYNOS7 Kconfig symbol, we need to get rid of
last usage of it (in the clocks Kconfig entries).
parents 92e963f5 85997a7c
...@@ -9,6 +9,8 @@ Required properties: ...@@ -9,6 +9,8 @@ Required properties:
"apm,xgene-socpll-clock" - for a X-Gene SoC PLL clock "apm,xgene-socpll-clock" - for a X-Gene SoC PLL clock
"apm,xgene-pcppll-clock" - for a X-Gene PCP PLL clock "apm,xgene-pcppll-clock" - for a X-Gene PCP PLL clock
"apm,xgene-device-clock" - for a X-Gene device clock "apm,xgene-device-clock" - for a X-Gene device clock
"apm,xgene-socpll-v2-clock" - for a X-Gene SoC PLL v2 clock
"apm,xgene-pcppll-v2-clock" - for a X-Gene PCP PLL v2 clock
Required properties for SoC or PCP PLL clocks: Required properties for SoC or PCP PLL clocks:
- reg : shall be the physical PLL register address for the pll clock. - reg : shall be the physical PLL register address for the pll clock.
......
...@@ -15,6 +15,7 @@ config PLAT_S3C24XX ...@@ -15,6 +15,7 @@ config PLAT_S3C24XX
select NO_IOPORT_MAP select NO_IOPORT_MAP
select S3C_DEV_NAND select S3C_DEV_NAND
select IRQ_DOMAIN select IRQ_DOMAIN
select COMMON_CLK
help help
Base platform code for any Samsung S3C24XX device Base platform code for any Samsung S3C24XX device
......
...@@ -202,11 +202,9 @@ config COMMON_CLK_CDCE706 ...@@ -202,11 +202,9 @@ config COMMON_CLK_CDCE706
source "drivers/clk/bcm/Kconfig" source "drivers/clk/bcm/Kconfig"
source "drivers/clk/hisilicon/Kconfig" source "drivers/clk/hisilicon/Kconfig"
source "drivers/clk/qcom/Kconfig"
endmenu
source "drivers/clk/mvebu/Kconfig" source "drivers/clk/mvebu/Kconfig"
source "drivers/clk/qcom/Kconfig"
source "drivers/clk/samsung/Kconfig" source "drivers/clk/samsung/Kconfig"
source "drivers/clk/tegra/Kconfig" source "drivers/clk/tegra/Kconfig"
endmenu
...@@ -43,7 +43,7 @@ obj-$(CONFIG_COMMON_CLK_SI514) += clk-si514.o ...@@ -43,7 +43,7 @@ obj-$(CONFIG_COMMON_CLK_SI514) += clk-si514.o
obj-$(CONFIG_COMMON_CLK_SI570) += clk-si570.o obj-$(CONFIG_COMMON_CLK_SI570) += clk-si570.o
obj-$(CONFIG_COMMON_CLK_CDCE925) += clk-cdce925.o obj-$(CONFIG_COMMON_CLK_CDCE925) += clk-cdce925.o
obj-$(CONFIG_ARCH_STM32) += clk-stm32f4.o obj-$(CONFIG_ARCH_STM32) += clk-stm32f4.o
obj-$(CONFIG_ARCH_TANGOX) += clk-tango4.o obj-$(CONFIG_ARCH_TANGO) += clk-tango4.o
obj-$(CONFIG_CLK_TWL6040) += clk-twl6040.o obj-$(CONFIG_CLK_TWL6040) += clk-twl6040.o
obj-$(CONFIG_ARCH_U300) += clk-u300.o obj-$(CONFIG_ARCH_U300) += clk-u300.o
obj-$(CONFIG_ARCH_VT8500) += clk-vt8500.o obj-$(CONFIG_ARCH_VT8500) += clk-vt8500.o
......
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
#include <linux/err.h> #include <linux/err.h>
#include <linux/slab.h> #include <linux/slab.h>
#define to_clk_composite(_hw) container_of(_hw, struct clk_composite, hw)
static u8 clk_composite_get_parent(struct clk_hw *hw) static u8 clk_composite_get_parent(struct clk_hw *hw)
{ {
struct clk_composite *composite = to_clk_composite(hw); struct clk_composite *composite = to_clk_composite(hw);
......
...@@ -28,8 +28,6 @@ ...@@ -28,8 +28,6 @@
* parent - fixed parent. No clk_set_parent support * parent - fixed parent. No clk_set_parent support
*/ */
#define to_clk_divider(_hw) container_of(_hw, struct clk_divider, hw)
#define div_mask(width) ((1 << (width)) - 1) #define div_mask(width) ((1 << (width)) - 1)
static unsigned int _get_table_maxdiv(const struct clk_div_table *table, static unsigned int _get_table_maxdiv(const struct clk_div_table *table,
...@@ -423,6 +421,12 @@ const struct clk_ops clk_divider_ops = { ...@@ -423,6 +421,12 @@ const struct clk_ops clk_divider_ops = {
}; };
EXPORT_SYMBOL_GPL(clk_divider_ops); EXPORT_SYMBOL_GPL(clk_divider_ops);
const struct clk_ops clk_divider_ro_ops = {
.recalc_rate = clk_divider_recalc_rate,
.round_rate = clk_divider_round_rate,
};
EXPORT_SYMBOL_GPL(clk_divider_ro_ops);
static struct clk *_register_divider(struct device *dev, const char *name, static struct clk *_register_divider(struct device *dev, const char *name,
const char *parent_name, unsigned long flags, const char *parent_name, unsigned long flags,
void __iomem *reg, u8 shift, u8 width, void __iomem *reg, u8 shift, u8 width,
...@@ -446,7 +450,10 @@ static struct clk *_register_divider(struct device *dev, const char *name, ...@@ -446,7 +450,10 @@ static struct clk *_register_divider(struct device *dev, const char *name,
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
init.name = name; init.name = name;
init.ops = &clk_divider_ops; if (clk_divider_flags & CLK_DIVIDER_READ_ONLY)
init.ops = &clk_divider_ro_ops;
else
init.ops = &clk_divider_ops;
init.flags = flags | CLK_IS_BASIC; init.flags = flags | CLK_IS_BASIC;
init.parent_names = (parent_name ? &parent_name: NULL); init.parent_names = (parent_name ? &parent_name: NULL);
init.num_parents = (parent_name ? 1 : 0); init.num_parents = (parent_name ? 1 : 0);
......
...@@ -23,8 +23,6 @@ ...@@ -23,8 +23,6 @@
* parent - fixed parent. No clk_set_parent support * parent - fixed parent. No clk_set_parent support
*/ */
#define to_clk_fixed_factor(_hw) container_of(_hw, struct clk_fixed_factor, hw)
static unsigned long clk_factor_recalc_rate(struct clk_hw *hw, static unsigned long clk_factor_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate) unsigned long parent_rate)
{ {
......
...@@ -26,8 +26,6 @@ ...@@ -26,8 +26,6 @@
* parent - fixed parent. No clk_set_parent support * parent - fixed parent. No clk_set_parent support
*/ */
#define to_clk_fixed_rate(_hw) container_of(_hw, struct clk_fixed_rate, hw)
static unsigned long clk_fixed_rate_recalc_rate(struct clk_hw *hw, static unsigned long clk_fixed_rate_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate) unsigned long parent_rate)
{ {
......
...@@ -16,8 +16,6 @@ ...@@ -16,8 +16,6 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/rational.h> #include <linux/rational.h>
#define to_clk_fd(_hw) container_of(_hw, struct clk_fractional_divider, hw)
static unsigned long clk_fd_recalc_rate(struct clk_hw *hw, static unsigned long clk_fd_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate) unsigned long parent_rate)
{ {
......
...@@ -26,8 +26,6 @@ ...@@ -26,8 +26,6 @@
* parent - fixed parent. No clk_set_parent support * parent - fixed parent. No clk_set_parent support
*/ */
#define to_clk_gate(_hw) container_of(_hw, struct clk_gate, hw)
/* /*
* It works on following logic: * It works on following logic:
* *
......
...@@ -31,8 +31,6 @@ ...@@ -31,8 +31,6 @@
* parent - fixed parent. No clk_set_parent support * parent - fixed parent. No clk_set_parent support
*/ */
#define to_clk_gpio(_hw) container_of(_hw, struct clk_gpio, hw)
static int clk_gpio_gate_enable(struct clk_hw *hw) static int clk_gpio_gate_enable(struct clk_hw *hw)
{ {
struct clk_gpio *clk = to_clk_gpio(hw); struct clk_gpio *clk = to_clk_gpio(hw);
......
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
#include <linux/of.h> #include <linux/of.h>
#include <linux/slab.h> #include <linux/slab.h>
#define to_clk_multiplier(_hw) container_of(_hw, struct clk_multiplier, hw)
static unsigned long __get_mult(struct clk_multiplier *mult, static unsigned long __get_mult(struct clk_multiplier *mult,
unsigned long rate, unsigned long rate,
unsigned long parent_rate) unsigned long parent_rate)
......
...@@ -26,8 +26,6 @@ ...@@ -26,8 +26,6 @@
* parent - parent is adjustable through clk_set_parent * parent - parent is adjustable through clk_set_parent
*/ */
#define to_clk_mux(_hw) container_of(_hw, struct clk_mux, hw)
static u8 clk_mux_get_parent(struct clk_hw *hw) static u8 clk_mux_get_parent(struct clk_hw *hw)
{ {
struct clk_mux *mux = to_clk_mux(hw); struct clk_mux *mux = to_clk_mux(hw);
......
...@@ -28,11 +28,6 @@ ...@@ -28,11 +28,6 @@
#include <linux/mfd/samsung/s5m8767.h> #include <linux/mfd/samsung/s5m8767.h>
#include <linux/mfd/samsung/core.h> #include <linux/mfd/samsung/core.h>
#define s2mps11_name(a) (a->hw.init->name)
static struct clk **clk_table;
static struct clk_onecell_data clk_data;
enum { enum {
S2MPS11_CLK_AP = 0, S2MPS11_CLK_AP = 0,
S2MPS11_CLK_CP, S2MPS11_CLK_CP,
...@@ -99,6 +94,7 @@ static struct clk_ops s2mps11_clk_ops = { ...@@ -99,6 +94,7 @@ static struct clk_ops s2mps11_clk_ops = {
.recalc_rate = s2mps11_clk_recalc_rate, .recalc_rate = s2mps11_clk_recalc_rate,
}; };
/* This s2mps11_clks_init tructure is common to s2mps11, s2mps13 and s2mps14 */
static struct clk_init_data s2mps11_clks_init[S2MPS11_CLKS_NUM] = { static struct clk_init_data s2mps11_clks_init[S2MPS11_CLKS_NUM] = {
[S2MPS11_CLK_AP] = { [S2MPS11_CLK_AP] = {
.name = "s2mps11_ap", .name = "s2mps11_ap",
...@@ -117,37 +113,6 @@ static struct clk_init_data s2mps11_clks_init[S2MPS11_CLKS_NUM] = { ...@@ -117,37 +113,6 @@ static struct clk_init_data s2mps11_clks_init[S2MPS11_CLKS_NUM] = {
}, },
}; };
static struct clk_init_data s2mps13_clks_init[S2MPS11_CLKS_NUM] = {
[S2MPS11_CLK_AP] = {
.name = "s2mps13_ap",
.ops = &s2mps11_clk_ops,
.flags = CLK_IS_ROOT,
},
[S2MPS11_CLK_CP] = {
.name = "s2mps13_cp",
.ops = &s2mps11_clk_ops,
.flags = CLK_IS_ROOT,
},
[S2MPS11_CLK_BT] = {
.name = "s2mps13_bt",
.ops = &s2mps11_clk_ops,
.flags = CLK_IS_ROOT,
},
};
static struct clk_init_data s2mps14_clks_init[S2MPS11_CLKS_NUM] = {
[S2MPS11_CLK_AP] = {
.name = "s2mps14_ap",
.ops = &s2mps11_clk_ops,
.flags = CLK_IS_ROOT,
},
[S2MPS11_CLK_BT] = {
.name = "s2mps14_bt",
.ops = &s2mps11_clk_ops,
.flags = CLK_IS_ROOT,
},
};
static struct device_node *s2mps11_clk_parse_dt(struct platform_device *pdev, static struct device_node *s2mps11_clk_parse_dt(struct platform_device *pdev,
struct clk_init_data *clks_init) struct clk_init_data *clks_init)
{ {
...@@ -164,12 +129,9 @@ static struct device_node *s2mps11_clk_parse_dt(struct platform_device *pdev, ...@@ -164,12 +129,9 @@ static struct device_node *s2mps11_clk_parse_dt(struct platform_device *pdev,
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
} }
for (i = 0; i < S2MPS11_CLKS_NUM; i++) { for (i = 0; i < S2MPS11_CLKS_NUM; i++)
if (!clks_init[i].name)
continue; /* Skip clocks not present in some devices */
of_property_read_string_index(clk_np, "clock-output-names", i, of_property_read_string_index(clk_np, "clock-output-names", i,
&clks_init[i].name); &clks_init[i].name);
}
return clk_np; return clk_np;
} }
...@@ -177,39 +139,38 @@ static struct device_node *s2mps11_clk_parse_dt(struct platform_device *pdev, ...@@ -177,39 +139,38 @@ static struct device_node *s2mps11_clk_parse_dt(struct platform_device *pdev,
static int s2mps11_clk_probe(struct platform_device *pdev) static int s2mps11_clk_probe(struct platform_device *pdev)
{ {
struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent); struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent);
struct s2mps11_clk *s2mps11_clks, *s2mps11_clk; struct s2mps11_clk *s2mps11_clks;
struct clk_onecell_data *clk_data;
unsigned int s2mps11_reg; unsigned int s2mps11_reg;
struct clk_init_data *clks_init;
int i, ret = 0; int i, ret = 0;
enum sec_device_type hwid = platform_get_device_id(pdev)->driver_data;
s2mps11_clks = devm_kcalloc(&pdev->dev, S2MPS11_CLKS_NUM, s2mps11_clks = devm_kcalloc(&pdev->dev, S2MPS11_CLKS_NUM,
sizeof(*s2mps11_clk), GFP_KERNEL); sizeof(*s2mps11_clks), GFP_KERNEL);
if (!s2mps11_clks) if (!s2mps11_clks)
return -ENOMEM; return -ENOMEM;
s2mps11_clk = s2mps11_clks; clk_data = devm_kzalloc(&pdev->dev, sizeof(*clk_data), GFP_KERNEL);
if (!clk_data)
return -ENOMEM;
clk_table = devm_kcalloc(&pdev->dev, S2MPS11_CLKS_NUM, clk_data->clks = devm_kcalloc(&pdev->dev, S2MPS11_CLKS_NUM,
sizeof(struct clk *), GFP_KERNEL); sizeof(struct clk *), GFP_KERNEL);
if (!clk_table) if (!clk_data->clks)
return -ENOMEM; return -ENOMEM;
switch(platform_get_device_id(pdev)->driver_data) { switch (hwid) {
case S2MPS11X: case S2MPS11X:
s2mps11_reg = S2MPS11_REG_RTC_CTRL; s2mps11_reg = S2MPS11_REG_RTC_CTRL;
clks_init = s2mps11_clks_init;
break; break;
case S2MPS13X: case S2MPS13X:
s2mps11_reg = S2MPS13_REG_RTCCTRL; s2mps11_reg = S2MPS13_REG_RTCCTRL;
clks_init = s2mps13_clks_init;
break; break;
case S2MPS14X: case S2MPS14X:
s2mps11_reg = S2MPS14_REG_RTCCTRL; s2mps11_reg = S2MPS14_REG_RTCCTRL;
clks_init = s2mps14_clks_init;
break; break;
case S5M8767X: case S5M8767X:
s2mps11_reg = S5M8767_REG_CTRL1; s2mps11_reg = S5M8767_REG_CTRL1;
clks_init = s2mps11_clks_init;
break; break;
default: default:
dev_err(&pdev->dev, "Invalid device type\n"); dev_err(&pdev->dev, "Invalid device type\n");
...@@ -217,46 +178,39 @@ static int s2mps11_clk_probe(struct platform_device *pdev) ...@@ -217,46 +178,39 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
} }
/* Store clocks of_node in first element of s2mps11_clks array */ /* Store clocks of_node in first element of s2mps11_clks array */
s2mps11_clks->clk_np = s2mps11_clk_parse_dt(pdev, clks_init); s2mps11_clks->clk_np = s2mps11_clk_parse_dt(pdev, s2mps11_clks_init);
if (IS_ERR(s2mps11_clks->clk_np)) if (IS_ERR(s2mps11_clks->clk_np))
return PTR_ERR(s2mps11_clks->clk_np); return PTR_ERR(s2mps11_clks->clk_np);
for (i = 0; i < S2MPS11_CLKS_NUM; i++, s2mps11_clk++) { for (i = 0; i < S2MPS11_CLKS_NUM; i++) {
if (!clks_init[i].name) if (i == S2MPS11_CLK_CP && hwid == S2MPS14X)
continue; /* Skip clocks not present in some devices */ continue; /* Skip clocks not present in some devices */
s2mps11_clk->iodev = iodev; s2mps11_clks[i].iodev = iodev;
s2mps11_clk->hw.init = &clks_init[i]; s2mps11_clks[i].hw.init = &s2mps11_clks_init[i];
s2mps11_clk->mask = 1 << i; s2mps11_clks[i].mask = 1 << i;
s2mps11_clk->reg = s2mps11_reg; s2mps11_clks[i].reg = s2mps11_reg;
s2mps11_clk->clk = devm_clk_register(&pdev->dev, s2mps11_clks[i].clk = devm_clk_register(&pdev->dev,
&s2mps11_clk->hw); &s2mps11_clks[i].hw);
if (IS_ERR(s2mps11_clk->clk)) { if (IS_ERR(s2mps11_clks[i].clk)) {
dev_err(&pdev->dev, "Fail to register : %s\n", dev_err(&pdev->dev, "Fail to register : %s\n",
s2mps11_name(s2mps11_clk)); s2mps11_clks_init[i].name);
ret = PTR_ERR(s2mps11_clk->clk); ret = PTR_ERR(s2mps11_clks[i].clk);
goto err_reg; goto err_reg;
} }
s2mps11_clk->lookup = clkdev_create(s2mps11_clk->clk, s2mps11_clks[i].lookup = clkdev_create(s2mps11_clks[i].clk,
s2mps11_name(s2mps11_clk), NULL); s2mps11_clks_init[i].name, NULL);
if (!s2mps11_clk->lookup) { if (!s2mps11_clks[i].lookup) {
ret = -ENOMEM; ret = -ENOMEM;
goto err_reg; goto err_reg;
} }
clk_data->clks[i] = s2mps11_clks[i].clk;
} }
for (i = 0; i < S2MPS11_CLKS_NUM; i++) { clk_data->clk_num = S2MPS11_CLKS_NUM;
/* Skip clocks not present on S2MPS14 */
if (!clks_init[i].name)
continue;
clk_table[i] = s2mps11_clks[i].clk;
}
clk_data.clks = clk_table;
clk_data.clk_num = S2MPS11_CLKS_NUM;
of_clk_add_provider(s2mps11_clks->clk_np, of_clk_src_onecell_get, of_clk_add_provider(s2mps11_clks->clk_np, of_clk_src_onecell_get,
&clk_data); clk_data);
platform_set_drvdata(pdev, s2mps11_clks); platform_set_drvdata(pdev, s2mps11_clks);
......
...@@ -299,7 +299,7 @@ static int scpi_clocks_probe(struct platform_device *pdev) ...@@ -299,7 +299,7 @@ static int scpi_clocks_probe(struct platform_device *pdev)
/* Add the virtual cpufreq device */ /* Add the virtual cpufreq device */
cpufreq_dev = platform_device_register_simple("scpi-cpufreq", cpufreq_dev = platform_device_register_simple("scpi-cpufreq",
-1, NULL, 0); -1, NULL, 0);
if (!cpufreq_dev) if (IS_ERR(cpufreq_dev))
pr_warn("unable to register cpufreq device"); pr_warn("unable to register cpufreq device");
return 0; return 0;
......
...@@ -29,7 +29,9 @@ ...@@ -29,7 +29,9 @@
#include <linux/of_address.h> #include <linux/of_address.h>
/* Register SCU_PCPPLL bit fields */ /* Register SCU_PCPPLL bit fields */
#define N_DIV_RD(src) (((src) & 0x000001ff)) #define N_DIV_RD(src) ((src) & 0x000001ff)
#define SC_N_DIV_RD(src) ((src) & 0x0000007f)
#define SC_OUTDIV2(src) (((src) & 0x00000100) >> 8)
/* Register SCU_SOCPLL bit fields */ /* Register SCU_SOCPLL bit fields */
#define CLKR_RD(src) (((src) & 0x07000000)>>24) #define CLKR_RD(src) (((src) & 0x07000000)>>24)
...@@ -48,7 +50,7 @@ static inline u32 xgene_clk_read(void __iomem *csr) ...@@ -48,7 +50,7 @@ static inline u32 xgene_clk_read(void __iomem *csr)
static inline void xgene_clk_write(u32 data, void __iomem *csr) static inline void xgene_clk_write(u32 data, void __iomem *csr)
{ {
return writel_relaxed(data, csr); writel_relaxed(data, csr);
} }
/* PLL Clock */ /* PLL Clock */
...@@ -63,6 +65,7 @@ struct xgene_clk_pll { ...@@ -63,6 +65,7 @@ struct xgene_clk_pll {
spinlock_t *lock; spinlock_t *lock;
u32 pll_offset; u32 pll_offset;
enum xgene_pll_type type; enum xgene_pll_type type;
int version;
}; };
#define to_xgene_clk_pll(_hw) container_of(_hw, struct xgene_clk_pll, hw) #define to_xgene_clk_pll(_hw) container_of(_hw, struct xgene_clk_pll, hw)
...@@ -92,27 +95,37 @@ static unsigned long xgene_clk_pll_recalc_rate(struct clk_hw *hw, ...@@ -92,27 +95,37 @@ static unsigned long xgene_clk_pll_recalc_rate(struct clk_hw *hw,
pll = xgene_clk_read(pllclk->reg + pllclk->pll_offset); pll = xgene_clk_read(pllclk->reg + pllclk->pll_offset);
if (pllclk->type == PLL_TYPE_PCP) { if (pllclk->version <= 1) {
/* if (pllclk->type == PLL_TYPE_PCP) {
* PLL VCO = Reference clock * NF /*
* PCP PLL = PLL_VCO / 2 * PLL VCO = Reference clock * NF
*/ * PCP PLL = PLL_VCO / 2
nout = 2; */
fvco = parent_rate * (N_DIV_RD(pll) + 4); nout = 2;
fvco = parent_rate * (N_DIV_RD(pll) + 4);
} else {
/*
* Fref = Reference Clock / NREF;
* Fvco = Fref * NFB;
* Fout = Fvco / NOUT;
*/
nref = CLKR_RD(pll) + 1;
nout = CLKOD_RD(pll) + 1;
nfb = CLKF_RD(pll);
fref = parent_rate / nref;
fvco = fref * nfb;
}
} else { } else {
/* /*
* Fref = Reference Clock / NREF; * fvco = Reference clock * FBDIVC
* Fvco = Fref * NFB; * PLL freq = fvco / NOUT
* Fout = Fvco / NOUT;
*/ */
nref = CLKR_RD(pll) + 1; nout = SC_OUTDIV2(pll) ? 2 : 3;
nout = CLKOD_RD(pll) + 1; fvco = parent_rate * SC_N_DIV_RD(pll);
nfb = CLKF_RD(pll);
fref = parent_rate / nref;
fvco = fref * nfb;
} }
pr_debug("%s pll recalc rate %ld parent %ld\n", clk_hw_get_name(hw), pr_debug("%s pll recalc rate %ld parent %ld version %d\n",
fvco / nout, parent_rate); clk_hw_get_name(hw), fvco / nout, parent_rate,
pllclk->version);
return fvco / nout; return fvco / nout;
} }
...@@ -125,7 +138,7 @@ static const struct clk_ops xgene_clk_pll_ops = { ...@@ -125,7 +138,7 @@ static const struct clk_ops xgene_clk_pll_ops = {
static struct clk *xgene_register_clk_pll(struct device *dev, static struct clk *xgene_register_clk_pll(struct device *dev,
const char *name, const char *parent_name, const char *name, const char *parent_name,
unsigned long flags, void __iomem *reg, u32 pll_offset, unsigned long flags, void __iomem *reg, u32 pll_offset,
u32 type, spinlock_t *lock) u32 type, spinlock_t *lock, int version)
{ {
struct xgene_clk_pll *apmclk; struct xgene_clk_pll *apmclk;
struct clk *clk; struct clk *clk;
...@@ -144,6 +157,7 @@ static struct clk *xgene_register_clk_pll(struct device *dev, ...@@ -144,6 +157,7 @@ static struct clk *xgene_register_clk_pll(struct device *dev,
init.parent_names = parent_name ? &parent_name : NULL; init.parent_names = parent_name ? &parent_name : NULL;
init.num_parents = parent_name ? 1 : 0; init.num_parents = parent_name ? 1 : 0;
apmclk->version = version;
apmclk->reg = reg; apmclk->reg = reg;
apmclk->lock = lock; apmclk->lock = lock;
apmclk->pll_offset = pll_offset; apmclk->pll_offset = pll_offset;
...@@ -160,26 +174,37 @@ static struct clk *xgene_register_clk_pll(struct device *dev, ...@@ -160,26 +174,37 @@ static struct clk *xgene_register_clk_pll(struct device *dev,
return clk; return clk;
} }
static int xgene_pllclk_version(struct device_node *np)
{
if (of_device_is_compatible(np, "apm,xgene-socpll-clock"))
return 1;
if (of_device_is_compatible(np, "apm,xgene-pcppll-clock"))
return 1;
return 2;
}
static void xgene_pllclk_init(struct device_node *np, enum xgene_pll_type pll_type) static void xgene_pllclk_init(struct device_node *np, enum xgene_pll_type pll_type)
{ {
const char *clk_name = np->full_name; const char *clk_name = np->full_name;
struct clk *clk; struct clk *clk;
void __iomem *reg; void __iomem *reg;
int version = xgene_pllclk_version(np);
reg = of_iomap(np, 0); reg = of_iomap(np, 0);
if (reg == NULL) { if (reg == NULL) {
pr_err("Unable to map CSR register for %s\n", np->full_name); pr_err("Unable to map CSR register for %s\n", np->full_name);
return; return;
} }
of_property_read_string(np, "clock-output-names", &clk_name); of_property_read_string(np, "clock-output-names", &clk_name);
clk = xgene_register_clk_pll(NULL, clk = xgene_register_clk_pll(NULL,
clk_name, of_clk_get_parent_name(np, 0), clk_name, of_clk_get_parent_name(np, 0),
CLK_IS_ROOT, reg, 0, pll_type, &clk_lock); CLK_IS_ROOT, reg, 0, pll_type, &clk_lock,
if (!IS_ERR(clk)) { version);
of_clk_add_provider(np, of_clk_src_simple_get, clk); if (!IS_ERR(clk)) {
clk_register_clkdev(clk, clk_name, NULL); of_clk_add_provider(np, of_clk_src_simple_get, clk);
pr_debug("Add %s clock PLL\n", clk_name); clk_register_clkdev(clk, clk_name, NULL);
} pr_debug("Add %s clock PLL\n", clk_name);
}
} }
static void xgene_socpllclk_init(struct device_node *np) static void xgene_socpllclk_init(struct device_node *np)
...@@ -460,7 +485,7 @@ static void __init xgene_devclk_init(struct device_node *np) ...@@ -460,7 +485,7 @@ static void __init xgene_devclk_init(struct device_node *np)
rc = of_address_to_resource(np, i, &res); rc = of_address_to_resource(np, i, &res);
if (rc != 0) { if (rc != 0) {
if (i == 0) { if (i == 0) {
pr_err("no DTS register for %s\n", pr_err("no DTS register for %s\n",
np->full_name); np->full_name);
return; return;
} }
...@@ -518,4 +543,8 @@ static void __init xgene_devclk_init(struct device_node *np) ...@@ -518,4 +543,8 @@ static void __init xgene_devclk_init(struct device_node *np)
CLK_OF_DECLARE(xgene_socpll_clock, "apm,xgene-socpll-clock", xgene_socpllclk_init); CLK_OF_DECLARE(xgene_socpll_clock, "apm,xgene-socpll-clock", xgene_socpllclk_init);
CLK_OF_DECLARE(xgene_pcppll_clock, "apm,xgene-pcppll-clock", xgene_pcppllclk_init); CLK_OF_DECLARE(xgene_pcppll_clock, "apm,xgene-pcppll-clock", xgene_pcppllclk_init);
CLK_OF_DECLARE(xgene_socpll_v2_clock, "apm,xgene-socpll-v2-clock",
xgene_socpllclk_init);
CLK_OF_DECLARE(xgene_pcppll_v2_clock, "apm,xgene-pcppll-v2-clock",
xgene_pcppllclk_init);
CLK_OF_DECLARE(xgene_dev_clock, "apm,xgene-device-clock", xgene_devclk_init); CLK_OF_DECLARE(xgene_dev_clock, "apm,xgene-device-clock", xgene_devclk_init);
...@@ -38,7 +38,7 @@ struct clk_busy_divider { ...@@ -38,7 +38,7 @@ struct clk_busy_divider {
static inline struct clk_busy_divider *to_clk_busy_divider(struct clk_hw *hw) static inline struct clk_busy_divider *to_clk_busy_divider(struct clk_hw *hw)
{ {
struct clk_divider *div = container_of(hw, struct clk_divider, hw); struct clk_divider *div = to_clk_divider(hw);
return container_of(div, struct clk_busy_divider, div); return container_of(div, struct clk_busy_divider, div);
} }
...@@ -123,7 +123,7 @@ struct clk_busy_mux { ...@@ -123,7 +123,7 @@ struct clk_busy_mux {
static inline struct clk_busy_mux *to_clk_busy_mux(struct clk_hw *hw) static inline struct clk_busy_mux *to_clk_busy_mux(struct clk_hw *hw)
{ {
struct clk_mux *mux = container_of(hw, struct clk_mux, hw); struct clk_mux *mux = to_clk_mux(hw);
return container_of(mux, struct clk_busy_mux, mux); return container_of(mux, struct clk_busy_mux, mux);
} }
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include <linux/slab.h> #include <linux/slab.h>
#include "clk.h" #include "clk.h"
#define to_clk_div(_hw) container_of(_hw, struct clk_divider, hw)
#define div_mask(d) ((1 << (d->width)) - 1) #define div_mask(d) ((1 << (d->width)) - 1)
/** /**
...@@ -35,7 +34,7 @@ struct clk_fixup_div { ...@@ -35,7 +34,7 @@ struct clk_fixup_div {
static inline struct clk_fixup_div *to_clk_fixup_div(struct clk_hw *hw) static inline struct clk_fixup_div *to_clk_fixup_div(struct clk_hw *hw)
{ {
struct clk_divider *divider = to_clk_div(hw); struct clk_divider *divider = to_clk_divider(hw);
return container_of(divider, struct clk_fixup_div, divider); return container_of(divider, struct clk_fixup_div, divider);
} }
...@@ -60,7 +59,7 @@ static int clk_fixup_div_set_rate(struct clk_hw *hw, unsigned long rate, ...@@ -60,7 +59,7 @@ static int clk_fixup_div_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate) unsigned long parent_rate)
{ {
struct clk_fixup_div *fixup_div = to_clk_fixup_div(hw); struct clk_fixup_div *fixup_div = to_clk_fixup_div(hw);
struct clk_divider *div = to_clk_div(hw); struct clk_divider *div = to_clk_divider(hw);
unsigned int divider, value; unsigned int divider, value;
unsigned long flags = 0; unsigned long flags = 0;
u32 val; u32 val;
......
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
#include <linux/slab.h> #include <linux/slab.h>
#include "clk.h" #include "clk.h"
#define to_clk_mux(_hw) container_of(_hw, struct clk_mux, hw)
/** /**
* struct clk_fixup_mux - imx integer fixup multiplexer clock * struct clk_fixup_mux - imx integer fixup multiplexer clock
* @mux: the parent class * @mux: the parent class
......
...@@ -31,7 +31,7 @@ struct clk_gate_exclusive { ...@@ -31,7 +31,7 @@ struct clk_gate_exclusive {
static int clk_gate_exclusive_enable(struct clk_hw *hw) static int clk_gate_exclusive_enable(struct clk_hw *hw)
{ {
struct clk_gate *gate = container_of(hw, struct clk_gate, hw); struct clk_gate *gate = to_clk_gate(hw);
struct clk_gate_exclusive *exgate = container_of(gate, struct clk_gate_exclusive *exgate = container_of(gate,
struct clk_gate_exclusive, gate); struct clk_gate_exclusive, gate);
u32 val = readl(gate->reg); u32 val = readl(gate->reg);
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
static int mtk_cg_bit_is_cleared(struct clk_hw *hw) static int mtk_cg_bit_is_cleared(struct clk_hw *hw)
{ {
struct mtk_clk_gate *cg = to_clk_gate(hw); struct mtk_clk_gate *cg = to_mtk_clk_gate(hw);
u32 val; u32 val;
regmap_read(cg->regmap, cg->sta_ofs, &val); regmap_read(cg->regmap, cg->sta_ofs, &val);
...@@ -37,7 +37,7 @@ static int mtk_cg_bit_is_cleared(struct clk_hw *hw) ...@@ -37,7 +37,7 @@ static int mtk_cg_bit_is_cleared(struct clk_hw *hw)
static int mtk_cg_bit_is_set(struct clk_hw *hw) static int mtk_cg_bit_is_set(struct clk_hw *hw)
{ {
struct mtk_clk_gate *cg = to_clk_gate(hw); struct mtk_clk_gate *cg = to_mtk_clk_gate(hw);
u32 val; u32 val;
regmap_read(cg->regmap, cg->sta_ofs, &val); regmap_read(cg->regmap, cg->sta_ofs, &val);
...@@ -49,14 +49,14 @@ static int mtk_cg_bit_is_set(struct clk_hw *hw) ...@@ -49,14 +49,14 @@ static int mtk_cg_bit_is_set(struct clk_hw *hw)
static void mtk_cg_set_bit(struct clk_hw *hw) static void mtk_cg_set_bit(struct clk_hw *hw)
{ {
struct mtk_clk_gate *cg = to_clk_gate(hw); struct mtk_clk_gate *cg = to_mtk_clk_gate(hw);
regmap_write(cg->regmap, cg->set_ofs, BIT(cg->bit)); regmap_write(cg->regmap, cg->set_ofs, BIT(cg->bit));
} }
static void mtk_cg_clr_bit(struct clk_hw *hw) static void mtk_cg_clr_bit(struct clk_hw *hw)
{ {
struct mtk_clk_gate *cg = to_clk_gate(hw); struct mtk_clk_gate *cg = to_mtk_clk_gate(hw);
regmap_write(cg->regmap, cg->clr_ofs, BIT(cg->bit)); regmap_write(cg->regmap, cg->clr_ofs, BIT(cg->bit));
} }
......
...@@ -29,7 +29,7 @@ struct mtk_clk_gate { ...@@ -29,7 +29,7 @@ struct mtk_clk_gate {
u8 bit; u8 bit;
}; };
static inline struct mtk_clk_gate *to_clk_gate(struct clk_hw *hw) static inline struct mtk_clk_gate *to_mtk_clk_gate(struct clk_hw *hw)
{ {
return container_of(hw, struct mtk_clk_gate, hw); return container_of(hw, struct mtk_clk_gate, hw);
} }
......
...@@ -209,12 +209,14 @@ struct clk * __init mtk_clk_register_composite(const struct mtk_composite *mc, ...@@ -209,12 +209,14 @@ struct clk * __init mtk_clk_register_composite(const struct mtk_composite *mc,
mc->flags); mc->flags);
if (IS_ERR(clk)) { if (IS_ERR(clk)) {
kfree(gate); ret = PTR_ERR(clk);
kfree(mux); goto err_out;
} }
return clk; return clk;
err_out: err_out:
kfree(div);
kfree(gate);
kfree(mux); kfree(mux);
return ERR_PTR(ret); return ERR_PTR(ret);
......
...@@ -199,8 +199,6 @@ struct clk_gating_ctrl { ...@@ -199,8 +199,6 @@ struct clk_gating_ctrl {
u32 saved_reg; u32 saved_reg;
}; };
#define to_clk_gate(_hw) container_of(_hw, struct clk_gate, hw)
static struct clk_gating_ctrl *ctrl; static struct clk_gating_ctrl *ctrl;
static struct clk *clk_gating_get_src( static struct clk *clk_gating_get_src(
......
...@@ -247,7 +247,7 @@ static struct clk_onecell_data dove_divider_data = { ...@@ -247,7 +247,7 @@ static struct clk_onecell_data dove_divider_data = {
void __init dove_divider_clk_init(struct device_node *np) void __init dove_divider_clk_init(struct device_node *np)
{ {
void *base; void __iomem *base;
base = of_iomap(np, 0); base = of_iomap(np, 0);
if (WARN_ON(!base)) if (WARN_ON(!base))
......
...@@ -256,8 +256,6 @@ static const struct clk_muxing_soc_desc kirkwood_mux_desc[] __initconst = { ...@@ -256,8 +256,6 @@ static const struct clk_muxing_soc_desc kirkwood_mux_desc[] __initconst = {
11, 1, 0 }, 11, 1, 0 },
}; };
#define to_clk_mux(_hw) container_of(_hw, struct clk_mux, hw)
static struct clk *clk_muxing_get_src( static struct clk *clk_muxing_get_src(
struct of_phandle_args *clkspec, void *data) struct of_phandle_args *clkspec, void *data)
{ {
......
...@@ -33,7 +33,7 @@ struct clk_div { ...@@ -33,7 +33,7 @@ struct clk_div {
static inline struct clk_div *to_clk_div(struct clk_hw *hw) static inline struct clk_div *to_clk_div(struct clk_hw *hw)
{ {
struct clk_divider *divider = container_of(hw, struct clk_divider, hw); struct clk_divider *divider = to_clk_divider(hw);
return container_of(divider, struct clk_div, divider); return container_of(divider, struct clk_div, divider);
} }
......
...@@ -28,8 +28,6 @@ ...@@ -28,8 +28,6 @@
#define CCU_BRANCH_IS_BUS BIT(0) #define CCU_BRANCH_IS_BUS BIT(0)
#define CCU_BRANCH_HAVE_DIV2 BIT(1) #define CCU_BRANCH_HAVE_DIV2 BIT(1)
#define to_clk_gate(_hw) container_of(_hw, struct clk_gate, hw)
struct lpc18xx_branch_clk_data { struct lpc18xx_branch_clk_data {
const char **name; const char **name;
int num; int num;
...@@ -222,7 +220,7 @@ static void lpc18xx_ccu_register_branch_gate_div(struct lpc18xx_clk_branch *bran ...@@ -222,7 +220,7 @@ static void lpc18xx_ccu_register_branch_gate_div(struct lpc18xx_clk_branch *bran
div->width = 1; div->width = 1;
div_hw = &div->hw; div_hw = &div->hw;
div_ops = &clk_divider_ops; div_ops = &clk_divider_ro_ops;
} }
branch->gate.reg = branch->offset + reg_base; branch->gate.reg = branch->offset + reg_base;
......
...@@ -90,7 +90,9 @@ static struct clk *rockchip_clk_register_branch(const char *name, ...@@ -90,7 +90,9 @@ static struct clk *rockchip_clk_register_branch(const char *name,
div->width = div_width; div->width = div_width;
div->lock = lock; div->lock = lock;
div->table = div_table; div->table = div_table;
div_ops = &clk_divider_ops; div_ops = (div_flags & CLK_DIVIDER_READ_ONLY)
? &clk_divider_ro_ops
: &clk_divider_ops;
} }
clk = clk_register_composite(NULL, name, parent_names, num_parents, clk = clk_register_composite(NULL, name, parent_names, num_parents,
......
# Recent Exynos platforms should just select COMMON_CLK_SAMSUNG:
config COMMON_CLK_SAMSUNG config COMMON_CLK_SAMSUNG
bool bool "Samsung Exynos clock controller support" if COMPILE_TEST
select COMMON_CLK # Clocks on ARM64 SoCs (e.g. Exynos5433, Exynos7) are chosen by
# EXYNOS_ARM64_COMMON_CLK to avoid building them on ARMv7:
select EXYNOS_ARM64_COMMON_CLK if ARM64 && ARCH_EXYNOS
config EXYNOS_ARM64_COMMON_CLK
bool "Samsung Exynos ARMv8-family clock controller support" if COMPILE_TEST
depends on COMMON_CLK_SAMSUNG
# For S3C24XX platforms, select following symbols:
config S3C2410_COMMON_CLK config S3C2410_COMMON_CLK
bool bool "Samsung S3C2410 clock controller support" if COMPILE_TEST
select COMMON_CLK_SAMSUNG select COMMON_CLK_SAMSUNG
help help
Build the s3c2410 clock driver based on the common clock framework. Build the s3c2410 clock driver based on the common clock framework.
...@@ -17,10 +25,9 @@ config S3C2410_COMMON_DCLK ...@@ -17,10 +25,9 @@ config S3C2410_COMMON_DCLK
framework. framework.
config S3C2412_COMMON_CLK config S3C2412_COMMON_CLK
bool bool "Samsung S3C2412 clock controller support" if COMPILE_TEST
select COMMON_CLK_SAMSUNG select COMMON_CLK_SAMSUNG
config S3C2443_COMMON_CLK config S3C2443_COMMON_CLK
bool bool "Samsung S3C2443 clock controller support" if COMPILE_TEST
select COMMON_CLK_SAMSUNG select COMMON_CLK_SAMSUNG
...@@ -10,11 +10,11 @@ obj-$(CONFIG_SOC_EXYNOS5250) += clk-exynos5250.o ...@@ -10,11 +10,11 @@ obj-$(CONFIG_SOC_EXYNOS5250) += clk-exynos5250.o
obj-$(CONFIG_SOC_EXYNOS5260) += clk-exynos5260.o obj-$(CONFIG_SOC_EXYNOS5260) += clk-exynos5260.o
obj-$(CONFIG_SOC_EXYNOS5410) += clk-exynos5410.o obj-$(CONFIG_SOC_EXYNOS5410) += clk-exynos5410.o
obj-$(CONFIG_SOC_EXYNOS5420) += clk-exynos5420.o obj-$(CONFIG_SOC_EXYNOS5420) += clk-exynos5420.o
obj-$(CONFIG_ARCH_EXYNOS) += clk-exynos5433.o obj-$(CONFIG_EXYNOS_ARM64_COMMON_CLK) += clk-exynos5433.o
obj-$(CONFIG_SOC_EXYNOS5440) += clk-exynos5440.o obj-$(CONFIG_SOC_EXYNOS5440) += clk-exynos5440.o
obj-$(CONFIG_ARCH_EXYNOS) += clk-exynos-audss.o obj-$(CONFIG_ARCH_EXYNOS) += clk-exynos-audss.o
obj-$(CONFIG_ARCH_EXYNOS) += clk-exynos-clkout.o obj-$(CONFIG_ARCH_EXYNOS) += clk-exynos-clkout.o
obj-$(CONFIG_ARCH_EXYNOS7) += clk-exynos7.o obj-$(CONFIG_EXYNOS_ARM64_COMMON_CLK) += clk-exynos7.o
obj-$(CONFIG_S3C2410_COMMON_CLK)+= clk-s3c2410.o obj-$(CONFIG_S3C2410_COMMON_CLK)+= clk-s3c2410.o
obj-$(CONFIG_S3C2410_COMMON_DCLK)+= clk-s3c2410-dclk.o obj-$(CONFIG_S3C2410_COMMON_DCLK)+= clk-s3c2410-dclk.o
obj-$(CONFIG_S3C2412_COMMON_CLK)+= clk-s3c2412.o obj-$(CONFIG_S3C2412_COMMON_CLK)+= clk-s3c2412.o
......
...@@ -822,11 +822,10 @@ static void __init st_of_clkgen_vcc_setup(struct device_node *np) ...@@ -822,11 +822,10 @@ static void __init st_of_clkgen_vcc_setup(struct device_node *np)
if (!clk_data->clks[i]) if (!clk_data->clks[i])
continue; continue;
composite = container_of(__clk_get_hw(clk_data->clks[i]), composite = to_clk_composite(__clk_get_hw(clk_data->clks[i]));
struct clk_composite, hw); kfree(to_clk_gate(composite->gate_hw));
kfree(container_of(composite->gate_hw, struct clk_gate, hw)); kfree(to_clk_divider(composite->rate_hw));
kfree(container_of(composite->rate_hw, struct clk_divider, hw)); kfree(to_clk_mux(composite->mux_hw));
kfree(container_of(composite->mux_hw, struct clk_mux, hw));
} }
kfree(clk_data->clks); kfree(clk_data->clks);
......
...@@ -28,8 +28,6 @@ ...@@ -28,8 +28,6 @@
#undef pr_fmt #undef pr_fmt
#define pr_fmt(fmt) "%s: " fmt, __func__ #define pr_fmt(fmt) "%s: " fmt, __func__
#define to_clk_divider(_hw) container_of(_hw, struct clk_divider, hw)
static unsigned long ti_composite_recalc_rate(struct clk_hw *hw, static unsigned long ti_composite_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate) unsigned long parent_rate)
{ {
......
...@@ -26,8 +26,6 @@ ...@@ -26,8 +26,6 @@
#undef pr_fmt #undef pr_fmt
#define pr_fmt(fmt) "%s: " fmt, __func__ #define pr_fmt(fmt) "%s: " fmt, __func__
#define to_clk_divider(_hw) container_of(_hw, struct clk_divider, hw)
#define div_mask(d) ((1 << ((d)->width)) - 1) #define div_mask(d) ((1 << ((d)->width)) - 1)
static unsigned int _get_table_maxdiv(const struct clk_div_table *table) static unsigned int _get_table_maxdiv(const struct clk_div_table *table)
......
...@@ -24,8 +24,6 @@ ...@@ -24,8 +24,6 @@
#include "clock.h" #include "clock.h"
#define to_clk_divider(_hw) container_of(_hw, struct clk_divider, hw)
#undef pr_fmt #undef pr_fmt
#define pr_fmt(fmt) "%s: " fmt, __func__ #define pr_fmt(fmt) "%s: " fmt, __func__
......
...@@ -26,8 +26,6 @@ ...@@ -26,8 +26,6 @@
#undef pr_fmt #undef pr_fmt
#define pr_fmt(fmt) "%s: " fmt, __func__ #define pr_fmt(fmt) "%s: " fmt, __func__
#define to_clk_mux(_hw) container_of(_hw, struct clk_mux, hw)
static u8 ti_clk_mux_get_parent(struct clk_hw *hw) static u8 ti_clk_mux_get_parent(struct clk_hw *hw)
{ {
struct clk_mux *mux = to_clk_mux(hw); struct clk_mux *mux = to_clk_mux(hw);
......
...@@ -276,6 +276,8 @@ struct clk_fixed_rate { ...@@ -276,6 +276,8 @@ struct clk_fixed_rate {
u8 flags; u8 flags;
}; };
#define to_clk_fixed_rate(_hw) container_of(_hw, struct clk_fixed_rate, hw)
extern const struct clk_ops clk_fixed_rate_ops; extern const struct clk_ops clk_fixed_rate_ops;
struct clk *clk_register_fixed_rate(struct device *dev, const char *name, struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
const char *parent_name, unsigned long flags, const char *parent_name, unsigned long flags,
...@@ -314,6 +316,8 @@ struct clk_gate { ...@@ -314,6 +316,8 @@ struct clk_gate {
spinlock_t *lock; spinlock_t *lock;
}; };
#define to_clk_gate(_hw) container_of(_hw, struct clk_gate, hw)
#define CLK_GATE_SET_TO_DISABLE BIT(0) #define CLK_GATE_SET_TO_DISABLE BIT(0)
#define CLK_GATE_HIWORD_MASK BIT(1) #define CLK_GATE_HIWORD_MASK BIT(1)
...@@ -376,6 +380,8 @@ struct clk_divider { ...@@ -376,6 +380,8 @@ struct clk_divider {
spinlock_t *lock; spinlock_t *lock;
}; };
#define to_clk_divider(_hw) container_of(_hw, struct clk_divider, hw)
#define CLK_DIVIDER_ONE_BASED BIT(0) #define CLK_DIVIDER_ONE_BASED BIT(0)
#define CLK_DIVIDER_POWER_OF_TWO BIT(1) #define CLK_DIVIDER_POWER_OF_TWO BIT(1)
#define CLK_DIVIDER_ALLOW_ZERO BIT(2) #define CLK_DIVIDER_ALLOW_ZERO BIT(2)
...@@ -385,6 +391,7 @@ struct clk_divider { ...@@ -385,6 +391,7 @@ struct clk_divider {
#define CLK_DIVIDER_MAX_AT_ZERO BIT(6) #define CLK_DIVIDER_MAX_AT_ZERO BIT(6)
extern const struct clk_ops clk_divider_ops; extern const struct clk_ops clk_divider_ops;
extern const struct clk_ops clk_divider_ro_ops;
unsigned long divider_recalc_rate(struct clk_hw *hw, unsigned long parent_rate, unsigned long divider_recalc_rate(struct clk_hw *hw, unsigned long parent_rate,
unsigned int val, const struct clk_div_table *table, unsigned int val, const struct clk_div_table *table,
...@@ -440,6 +447,8 @@ struct clk_mux { ...@@ -440,6 +447,8 @@ struct clk_mux {
spinlock_t *lock; spinlock_t *lock;
}; };
#define to_clk_mux(_hw) container_of(_hw, struct clk_mux, hw)
#define CLK_MUX_INDEX_ONE BIT(0) #define CLK_MUX_INDEX_ONE BIT(0)
#define CLK_MUX_INDEX_BIT BIT(1) #define CLK_MUX_INDEX_BIT BIT(1)
#define CLK_MUX_HIWORD_MASK BIT(2) #define CLK_MUX_HIWORD_MASK BIT(2)
...@@ -483,6 +492,8 @@ struct clk_fixed_factor { ...@@ -483,6 +492,8 @@ struct clk_fixed_factor {
unsigned int div; unsigned int div;
}; };
#define to_clk_fixed_factor(_hw) container_of(_hw, struct clk_fixed_factor, hw)
extern const struct clk_ops clk_fixed_factor_ops; extern const struct clk_ops clk_fixed_factor_ops;
struct clk *clk_register_fixed_factor(struct device *dev, const char *name, struct clk *clk_register_fixed_factor(struct device *dev, const char *name,
const char *parent_name, unsigned long flags, const char *parent_name, unsigned long flags,
...@@ -514,6 +525,8 @@ struct clk_fractional_divider { ...@@ -514,6 +525,8 @@ struct clk_fractional_divider {
spinlock_t *lock; spinlock_t *lock;
}; };
#define to_clk_fd(_hw) container_of(_hw, struct clk_fractional_divider, hw)
extern const struct clk_ops clk_fractional_divider_ops; extern const struct clk_ops clk_fractional_divider_ops;
struct clk *clk_register_fractional_divider(struct device *dev, struct clk *clk_register_fractional_divider(struct device *dev,
const char *name, const char *parent_name, unsigned long flags, const char *name, const char *parent_name, unsigned long flags,
...@@ -550,6 +563,8 @@ struct clk_multiplier { ...@@ -550,6 +563,8 @@ struct clk_multiplier {
spinlock_t *lock; spinlock_t *lock;
}; };
#define to_clk_multiplier(_hw) container_of(_hw, struct clk_multiplier, hw)
#define CLK_MULTIPLIER_ZERO_BYPASS BIT(0) #define CLK_MULTIPLIER_ZERO_BYPASS BIT(0)
#define CLK_MULTIPLIER_ROUND_CLOSEST BIT(1) #define CLK_MULTIPLIER_ROUND_CLOSEST BIT(1)
...@@ -579,6 +594,8 @@ struct clk_composite { ...@@ -579,6 +594,8 @@ struct clk_composite {
const struct clk_ops *gate_ops; const struct clk_ops *gate_ops;
}; };
#define to_clk_composite(_hw) container_of(_hw, struct clk_composite, hw)
struct clk *clk_register_composite(struct device *dev, const char *name, struct clk *clk_register_composite(struct device *dev, const char *name,
const char * const *parent_names, int num_parents, const char * const *parent_names, int num_parents,
struct clk_hw *mux_hw, const struct clk_ops *mux_ops, struct clk_hw *mux_hw, const struct clk_ops *mux_ops,
...@@ -601,6 +618,8 @@ struct clk_gpio { ...@@ -601,6 +618,8 @@ struct clk_gpio {
struct gpio_desc *gpiod; struct gpio_desc *gpiod;
}; };
#define to_clk_gpio(_hw) container_of(_hw, struct clk_gpio, hw)
extern const struct clk_ops clk_gpio_gate_ops; extern const struct clk_ops clk_gpio_gate_ops;
struct clk *clk_register_gpio_gate(struct device *dev, const char *name, struct clk *clk_register_gpio_gate(struct device *dev, const char *name,
const char *parent_name, unsigned gpio, bool active_low, const char *parent_name, unsigned gpio, bool active_low,
......
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