Skip to content

Commit

Permalink
Merge tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux…
Browse files Browse the repository at this point in the history
…/kernel/git/clk/linux

Pull clk fixes from Stephen Boyd:
 "This is the first batch of clk driver fixes for this release.

  We have a handful of fixes for the uniphier clk driver that was
  introduced recently, as well as Kconfig option hiding, module
  autoloading markings, and a few fixes for clk_hw based registration
  patches that went in this merge window"

* tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux:
  clk: at91: Fix a return value in case of error
  clk: uniphier: rename MIO clock to SD clock for Pro5, PXs2, LD20 SoCs
  clk: uniphier: fix memory overrun bug
  clk: hi6220: use CLK_OF_DECLARE_DRIVER for sysctrl and mediactrl clock init
  clk: mvebu: armada-37xx-periph: Fix the clock gate flag
  clk: bcm2835: Clamp the PLL's requested rate to the hardware limits.
  clk: max77686: fix number of clocks setup for clk_hw based registration
  clk: mvebu: armada-37xx-periph: Fix the clock provider registration
  clk: core: add __init decoration for CLK_OF_DECLARE_DRIVER function
  clk: mediatek: Add hardware dependency
  clk: samsung: clk-exynos-audss: Fix module autoload
  clk: uniphier: fix type of variable passed to regmap_read()
  clk: uniphier: add system clock support for sLD3 SoC
  • Loading branch information
torvalds committed Oct 25, 2016
2 parents 1ce5bdb + 91bbc17 commit b5cd891
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 35 deletions.
16 changes: 8 additions & 8 deletions Documentation/devicetree/bindings/clock/uniphier-clock.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Example:
reg = <0x61840000 0x4000>;

clock {
compatible = "socionext,uniphier-ld20-clock";
compatible = "socionext,uniphier-ld11-clock";
#clock-cells = <1>;
};

Expand All @@ -43,19 +43,19 @@ Provided clocks:
21: USB3 ch1 PHY1


Media I/O (MIO) clock
---------------------
Media I/O (MIO) clock, SD clock
-------------------------------

Required properties:
- compatible: should be one of the following:
"socionext,uniphier-sld3-mio-clock" - for sLD3 SoC.
"socionext,uniphier-ld4-mio-clock" - for LD4 SoC.
"socionext,uniphier-pro4-mio-clock" - for Pro4 SoC.
"socionext,uniphier-sld8-mio-clock" - for sLD8 SoC.
"socionext,uniphier-pro5-mio-clock" - for Pro5 SoC.
"socionext,uniphier-pxs2-mio-clock" - for PXs2/LD6b SoC.
"socionext,uniphier-pro5-sd-clock" - for Pro5 SoC.
"socionext,uniphier-pxs2-sd-clock" - for PXs2/LD6b SoC.
"socionext,uniphier-ld11-mio-clock" - for LD11 SoC.
"socionext,uniphier-ld20-mio-clock" - for LD20 SoC.
"socionext,uniphier-ld20-sd-clock" - for LD20 SoC.
- #clock-cells: should be 1.

Example:
Expand All @@ -66,7 +66,7 @@ Example:
reg = <0x59810000 0x800>;

clock {
compatible = "socionext,uniphier-ld20-mio-clock";
compatible = "socionext,uniphier-ld11-mio-clock";
#clock-cells = <1>;
};

Expand Down Expand Up @@ -112,7 +112,7 @@ Example:
reg = <0x59820000 0x200>;

clock {
compatible = "socionext,uniphier-ld20-peri-clock";
compatible = "socionext,uniphier-ld11-peri-clock";
#clock-cells = <1>;
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/clk/at91/clk-programmable.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ at91_clk_register_programmable(struct regmap *regmap,
ret = clk_hw_register(NULL, &prog->hw);
if (ret) {
kfree(prog);
hw = &prog->hw;
hw = ERR_PTR(ret);
}

return hw;
Expand Down
11 changes: 4 additions & 7 deletions drivers/clk/bcm/clk-bcm2835.c
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,12 @@ static long bcm2835_pll_rate_from_divisors(unsigned long parent_rate,
static long bcm2835_pll_round_rate(struct clk_hw *hw, unsigned long rate,
unsigned long *parent_rate)
{
struct bcm2835_pll *pll = container_of(hw, struct bcm2835_pll, hw);
const struct bcm2835_pll_data *data = pll->data;
u32 ndiv, fdiv;

rate = clamp(rate, data->min_rate, data->max_rate);

bcm2835_pll_choose_ndiv_and_fdiv(rate, *parent_rate, &ndiv, &fdiv);

return bcm2835_pll_rate_from_divisors(*parent_rate, ndiv, fdiv, 1);
Expand Down Expand Up @@ -608,13 +612,6 @@ static int bcm2835_pll_set_rate(struct clk_hw *hw,
u32 ana[4];
int i;

if (rate < data->min_rate || rate > data->max_rate) {
dev_err(cprman->dev, "%s: rate out of spec: %lu vs (%lu, %lu)\n",
clk_hw_get_name(hw), rate,
data->min_rate, data->max_rate);
return -EINVAL;
}

if (rate > data->max_fb_rate) {
use_fb_prediv = true;
rate /= 2;
Expand Down
1 change: 1 addition & 0 deletions drivers/clk/clk-max77686.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ static int max77686_clk_probe(struct platform_device *pdev)
return -EINVAL;
}

drv_data->num_clks = num_clks;
drv_data->max_clk_data = devm_kcalloc(dev, num_clks,
sizeof(*drv_data->max_clk_data),
GFP_KERNEL);
Expand Down
4 changes: 2 additions & 2 deletions drivers/clk/hisilicon/clk-hi6220.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ static void __init hi6220_clk_sys_init(struct device_node *np)
hi6220_clk_register_divider(hi6220_div_clks_sys,
ARRAY_SIZE(hi6220_div_clks_sys), clk_data);
}
CLK_OF_DECLARE(hi6220_clk_sys, "hisilicon,hi6220-sysctrl", hi6220_clk_sys_init);
CLK_OF_DECLARE_DRIVER(hi6220_clk_sys, "hisilicon,hi6220-sysctrl", hi6220_clk_sys_init);


/* clocks in media controller */
Expand Down Expand Up @@ -252,7 +252,7 @@ static void __init hi6220_clk_media_init(struct device_node *np)
hi6220_clk_register_divider(hi6220_div_clks_media,
ARRAY_SIZE(hi6220_div_clks_media), clk_data);
}
CLK_OF_DECLARE(hi6220_clk_media, "hisilicon,hi6220-mediactrl", hi6220_clk_media_init);
CLK_OF_DECLARE_DRIVER(hi6220_clk_media, "hisilicon,hi6220-mediactrl", hi6220_clk_media_init);


/* clocks in pmctrl */
Expand Down
2 changes: 2 additions & 0 deletions drivers/clk/mediatek/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ config COMMON_CLK_MEDIATEK

config COMMON_CLK_MT8135
bool "Clock driver for Mediatek MT8135"
depends on ARCH_MEDIATEK || COMPILE_TEST
select COMMON_CLK_MEDIATEK
default ARCH_MEDIATEK
---help---
This driver supports Mediatek MT8135 clocks.

config COMMON_CLK_MT8173
bool "Clock driver for Mediatek MT8173"
depends on ARCH_MEDIATEK || COMPILE_TEST
select COMMON_CLK_MEDIATEK
default ARCH_MEDIATEK
---help---
Expand Down
11 changes: 6 additions & 5 deletions drivers/clk/mvebu/armada-37xx-periph.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ static const struct of_device_id armada_3700_periph_clock_of_match[] = {
};
static int armada_3700_add_composite_clk(const struct clk_periph_data *data,
void __iomem *reg, spinlock_t *lock,
struct device *dev, struct clk_hw *hw)
struct device *dev, struct clk_hw **hw)
{
const struct clk_ops *mux_ops = NULL, *gate_ops = NULL,
*rate_ops = NULL;
Expand All @@ -329,6 +329,7 @@ static int armada_3700_add_composite_clk(const struct clk_periph_data *data,
gate->lock = lock;
gate_ops = gate_hw->init->ops;
gate->reg = reg + (u64)gate->reg;
gate->flags = CLK_GATE_SET_TO_DISABLE;
}

if (data->rate_hw) {
Expand All @@ -353,13 +354,13 @@ static int armada_3700_add_composite_clk(const struct clk_periph_data *data,
}
}

hw = clk_hw_register_composite(dev, data->name, data->parent_names,
*hw = clk_hw_register_composite(dev, data->name, data->parent_names,
data->num_parents, mux_hw,
mux_ops, rate_hw, rate_ops,
gate_hw, gate_ops, CLK_IGNORE_UNUSED);

if (IS_ERR(hw))
return PTR_ERR(hw);
if (IS_ERR(*hw))
return PTR_ERR(*hw);

return 0;
}
Expand Down Expand Up @@ -400,7 +401,7 @@ static int armada_3700_periph_clock_probe(struct platform_device *pdev)
spin_lock_init(&driver_data->lock);

for (i = 0; i < num_periph; i++) {
struct clk_hw *hw = driver_data->hw_data->hws[i];
struct clk_hw **hw = &driver_data->hw_data->hws[i];

if (armada_3700_add_composite_clk(&data[i], reg,
&driver_data->lock, dev, hw))
Expand Down
1 change: 1 addition & 0 deletions drivers/clk/samsung/clk-exynos-audss.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ static const struct of_device_id exynos_audss_clk_of_match[] = {
},
{ },
};
MODULE_DEVICE_TABLE(of, exynos_audss_clk_of_match);

static void exynos_audss_clk_teardown(void)
{
Expand Down
20 changes: 12 additions & 8 deletions drivers/clk/uniphier/clk-uniphier-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ static int uniphier_clk_probe(struct platform_device *pdev)
hw_data->num = clk_num;

/* avoid returning NULL for unused idx */
for (; clk_num >= 0; clk_num--)
while (--clk_num >= 0)
hw_data->hws[clk_num] = ERR_PTR(-EINVAL);

for (p = data; p->name; p++) {
Expand Down Expand Up @@ -110,6 +110,10 @@ static int uniphier_clk_remove(struct platform_device *pdev)

static const struct of_device_id uniphier_clk_match[] = {
/* System clock */
{
.compatible = "socionext,uniphier-sld3-clock",
.data = uniphier_sld3_sys_clk_data,
},
{
.compatible = "socionext,uniphier-ld4-clock",
.data = uniphier_ld4_sys_clk_data,
Expand Down Expand Up @@ -138,7 +142,7 @@ static const struct of_device_id uniphier_clk_match[] = {
.compatible = "socionext,uniphier-ld20-clock",
.data = uniphier_ld20_sys_clk_data,
},
/* Media I/O clock */
/* Media I/O clock, SD clock */
{
.compatible = "socionext,uniphier-sld3-mio-clock",
.data = uniphier_sld3_mio_clk_data,
Expand All @@ -156,20 +160,20 @@ static const struct of_device_id uniphier_clk_match[] = {
.data = uniphier_sld3_mio_clk_data,
},
{
.compatible = "socionext,uniphier-pro5-mio-clock",
.data = uniphier_pro5_mio_clk_data,
.compatible = "socionext,uniphier-pro5-sd-clock",
.data = uniphier_pro5_sd_clk_data,
},
{
.compatible = "socionext,uniphier-pxs2-mio-clock",
.data = uniphier_pro5_mio_clk_data,
.compatible = "socionext,uniphier-pxs2-sd-clock",
.data = uniphier_pro5_sd_clk_data,
},
{
.compatible = "socionext,uniphier-ld11-mio-clock",
.data = uniphier_sld3_mio_clk_data,
},
{
.compatible = "socionext,uniphier-ld20-mio-clock",
.data = uniphier_pro5_mio_clk_data,
.compatible = "socionext,uniphier-ld20-sd-clock",
.data = uniphier_pro5_sd_clk_data,
},
/* Peripheral clock */
{
Expand Down
2 changes: 1 addition & 1 deletion drivers/clk/uniphier/clk-uniphier-mio.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const struct uniphier_clk_data uniphier_sld3_mio_clk_data[] = {
{ /* sentinel */ }
};

const struct uniphier_clk_data uniphier_pro5_mio_clk_data[] = {
const struct uniphier_clk_data uniphier_pro5_sd_clk_data[] = {
UNIPHIER_MIO_CLK_SD_FIXED,
UNIPHIER_MIO_CLK_SD(0, 0),
UNIPHIER_MIO_CLK_SD(1, 1),
Expand Down
2 changes: 1 addition & 1 deletion drivers/clk/uniphier/clk-uniphier-mux.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static u8 uniphier_clk_mux_get_parent(struct clk_hw *hw)
struct uniphier_clk_mux *mux = to_uniphier_clk_mux(hw);
int num_parents = clk_hw_get_num_parents(hw);
int ret;
u32 val;
unsigned int val;
u8 i;

ret = regmap_read(mux->regmap, mux->reg, &val);
Expand Down
2 changes: 1 addition & 1 deletion drivers/clk/uniphier/clk-uniphier.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ extern const struct uniphier_clk_data uniphier_pxs2_sys_clk_data[];
extern const struct uniphier_clk_data uniphier_ld11_sys_clk_data[];
extern const struct uniphier_clk_data uniphier_ld20_sys_clk_data[];
extern const struct uniphier_clk_data uniphier_sld3_mio_clk_data[];
extern const struct uniphier_clk_data uniphier_pro5_mio_clk_data[];
extern const struct uniphier_clk_data uniphier_pro5_sd_clk_data[];
extern const struct uniphier_clk_data uniphier_ld4_peri_clk_data[];
extern const struct uniphier_clk_data uniphier_pro4_peri_clk_data[];

Expand Down
2 changes: 1 addition & 1 deletion include/linux/clk-provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ extern struct of_device_id __clk_of_table;
* routines, one at of_clk_init(), and one at platform device probe
*/
#define CLK_OF_DECLARE_DRIVER(name, compat, fn) \
static void name##_of_clk_init_driver(struct device_node *np) \
static void __init name##_of_clk_init_driver(struct device_node *np) \
{ \
of_node_clear_flag(np, OF_POPULATED); \
fn(np); \
Expand Down

0 comments on commit b5cd891

Please sign in to comment.