Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/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

+41 -35
+8 -8
Documentation/devicetree/bindings/clock/uniphier-clock.txt
··· 24 24 reg = <0x61840000 0x4000>; 25 25 26 26 clock { 27 - compatible = "socionext,uniphier-ld20-clock"; 27 + compatible = "socionext,uniphier-ld11-clock"; 28 28 #clock-cells = <1>; 29 29 }; 30 30 ··· 43 43 21: USB3 ch1 PHY1 44 44 45 45 46 - Media I/O (MIO) clock 47 - --------------------- 46 + Media I/O (MIO) clock, SD clock 47 + ------------------------------- 48 48 49 49 Required properties: 50 50 - compatible: should be one of the following: ··· 52 52 "socionext,uniphier-ld4-mio-clock" - for LD4 SoC. 53 53 "socionext,uniphier-pro4-mio-clock" - for Pro4 SoC. 54 54 "socionext,uniphier-sld8-mio-clock" - for sLD8 SoC. 55 - "socionext,uniphier-pro5-mio-clock" - for Pro5 SoC. 56 - "socionext,uniphier-pxs2-mio-clock" - for PXs2/LD6b SoC. 55 + "socionext,uniphier-pro5-sd-clock" - for Pro5 SoC. 56 + "socionext,uniphier-pxs2-sd-clock" - for PXs2/LD6b SoC. 57 57 "socionext,uniphier-ld11-mio-clock" - for LD11 SoC. 58 - "socionext,uniphier-ld20-mio-clock" - for LD20 SoC. 58 + "socionext,uniphier-ld20-sd-clock" - for LD20 SoC. 59 59 - #clock-cells: should be 1. 60 60 61 61 Example: ··· 66 66 reg = <0x59810000 0x800>; 67 67 68 68 clock { 69 - compatible = "socionext,uniphier-ld20-mio-clock"; 69 + compatible = "socionext,uniphier-ld11-mio-clock"; 70 70 #clock-cells = <1>; 71 71 }; 72 72 ··· 112 112 reg = <0x59820000 0x200>; 113 113 114 114 clock { 115 - compatible = "socionext,uniphier-ld20-peri-clock"; 115 + compatible = "socionext,uniphier-ld11-peri-clock"; 116 116 #clock-cells = <1>; 117 117 }; 118 118
+1 -1
drivers/clk/at91/clk-programmable.c
··· 203 203 ret = clk_hw_register(NULL, &prog->hw); 204 204 if (ret) { 205 205 kfree(prog); 206 - hw = &prog->hw; 206 + hw = ERR_PTR(ret); 207 207 } 208 208 209 209 return hw;
+4 -7
drivers/clk/bcm/clk-bcm2835.c
··· 502 502 static long bcm2835_pll_round_rate(struct clk_hw *hw, unsigned long rate, 503 503 unsigned long *parent_rate) 504 504 { 505 + struct bcm2835_pll *pll = container_of(hw, struct bcm2835_pll, hw); 506 + const struct bcm2835_pll_data *data = pll->data; 505 507 u32 ndiv, fdiv; 508 + 509 + rate = clamp(rate, data->min_rate, data->max_rate); 506 510 507 511 bcm2835_pll_choose_ndiv_and_fdiv(rate, *parent_rate, &ndiv, &fdiv); 508 512 ··· 611 607 u32 ndiv, fdiv, a2w_ctl; 612 608 u32 ana[4]; 613 609 int i; 614 - 615 - if (rate < data->min_rate || rate > data->max_rate) { 616 - dev_err(cprman->dev, "%s: rate out of spec: %lu vs (%lu, %lu)\n", 617 - clk_hw_get_name(hw), rate, 618 - data->min_rate, data->max_rate); 619 - return -EINVAL; 620 - } 621 610 622 611 if (rate > data->max_fb_rate) { 623 612 use_fb_prediv = true;
+1
drivers/clk/clk-max77686.c
··· 216 216 return -EINVAL; 217 217 } 218 218 219 + drv_data->num_clks = num_clks; 219 220 drv_data->max_clk_data = devm_kcalloc(dev, num_clks, 220 221 sizeof(*drv_data->max_clk_data), 221 222 GFP_KERNEL);
+2 -2
drivers/clk/hisilicon/clk-hi6220.c
··· 195 195 hi6220_clk_register_divider(hi6220_div_clks_sys, 196 196 ARRAY_SIZE(hi6220_div_clks_sys), clk_data); 197 197 } 198 - CLK_OF_DECLARE(hi6220_clk_sys, "hisilicon,hi6220-sysctrl", hi6220_clk_sys_init); 198 + CLK_OF_DECLARE_DRIVER(hi6220_clk_sys, "hisilicon,hi6220-sysctrl", hi6220_clk_sys_init); 199 199 200 200 201 201 /* clocks in media controller */ ··· 252 252 hi6220_clk_register_divider(hi6220_div_clks_media, 253 253 ARRAY_SIZE(hi6220_div_clks_media), clk_data); 254 254 } 255 - CLK_OF_DECLARE(hi6220_clk_media, "hisilicon,hi6220-mediactrl", hi6220_clk_media_init); 255 + CLK_OF_DECLARE_DRIVER(hi6220_clk_media, "hisilicon,hi6220-mediactrl", hi6220_clk_media_init); 256 256 257 257 258 258 /* clocks in pmctrl */
+2
drivers/clk/mediatek/Kconfig
··· 8 8 9 9 config COMMON_CLK_MT8135 10 10 bool "Clock driver for Mediatek MT8135" 11 + depends on ARCH_MEDIATEK || COMPILE_TEST 11 12 select COMMON_CLK_MEDIATEK 12 13 default ARCH_MEDIATEK 13 14 ---help--- ··· 16 15 17 16 config COMMON_CLK_MT8173 18 17 bool "Clock driver for Mediatek MT8173" 18 + depends on ARCH_MEDIATEK || COMPILE_TEST 19 19 select COMMON_CLK_MEDIATEK 20 20 default ARCH_MEDIATEK 21 21 ---help---
+6 -5
drivers/clk/mvebu/armada-37xx-periph.c
··· 305 305 }; 306 306 static int armada_3700_add_composite_clk(const struct clk_periph_data *data, 307 307 void __iomem *reg, spinlock_t *lock, 308 - struct device *dev, struct clk_hw *hw) 308 + struct device *dev, struct clk_hw **hw) 309 309 { 310 310 const struct clk_ops *mux_ops = NULL, *gate_ops = NULL, 311 311 *rate_ops = NULL; ··· 329 329 gate->lock = lock; 330 330 gate_ops = gate_hw->init->ops; 331 331 gate->reg = reg + (u64)gate->reg; 332 + gate->flags = CLK_GATE_SET_TO_DISABLE; 332 333 } 333 334 334 335 if (data->rate_hw) { ··· 354 353 } 355 354 } 356 355 357 - hw = clk_hw_register_composite(dev, data->name, data->parent_names, 356 + *hw = clk_hw_register_composite(dev, data->name, data->parent_names, 358 357 data->num_parents, mux_hw, 359 358 mux_ops, rate_hw, rate_ops, 360 359 gate_hw, gate_ops, CLK_IGNORE_UNUSED); 361 360 362 - if (IS_ERR(hw)) 363 - return PTR_ERR(hw); 361 + if (IS_ERR(*hw)) 362 + return PTR_ERR(*hw); 364 363 365 364 return 0; 366 365 } ··· 401 400 spin_lock_init(&driver_data->lock); 402 401 403 402 for (i = 0; i < num_periph; i++) { 404 - struct clk_hw *hw = driver_data->hw_data->hws[i]; 403 + struct clk_hw **hw = &driver_data->hw_data->hws[i]; 405 404 406 405 if (armada_3700_add_composite_clk(&data[i], reg, 407 406 &driver_data->lock, dev, hw))
+1
drivers/clk/samsung/clk-exynos-audss.c
··· 106 106 }, 107 107 { }, 108 108 }; 109 + MODULE_DEVICE_TABLE(of, exynos_audss_clk_of_match); 109 110 110 111 static void exynos_audss_clk_teardown(void) 111 112 {
+12 -8
drivers/clk/uniphier/clk-uniphier-core.c
··· 79 79 hw_data->num = clk_num; 80 80 81 81 /* avoid returning NULL for unused idx */ 82 - for (; clk_num >= 0; clk_num--) 82 + while (--clk_num >= 0) 83 83 hw_data->hws[clk_num] = ERR_PTR(-EINVAL); 84 84 85 85 for (p = data; p->name; p++) { ··· 111 111 static const struct of_device_id uniphier_clk_match[] = { 112 112 /* System clock */ 113 113 { 114 + .compatible = "socionext,uniphier-sld3-clock", 115 + .data = uniphier_sld3_sys_clk_data, 116 + }, 117 + { 114 118 .compatible = "socionext,uniphier-ld4-clock", 115 119 .data = uniphier_ld4_sys_clk_data, 116 120 }, ··· 142 138 .compatible = "socionext,uniphier-ld20-clock", 143 139 .data = uniphier_ld20_sys_clk_data, 144 140 }, 145 - /* Media I/O clock */ 141 + /* Media I/O clock, SD clock */ 146 142 { 147 143 .compatible = "socionext,uniphier-sld3-mio-clock", 148 144 .data = uniphier_sld3_mio_clk_data, ··· 160 156 .data = uniphier_sld3_mio_clk_data, 161 157 }, 162 158 { 163 - .compatible = "socionext,uniphier-pro5-mio-clock", 164 - .data = uniphier_pro5_mio_clk_data, 159 + .compatible = "socionext,uniphier-pro5-sd-clock", 160 + .data = uniphier_pro5_sd_clk_data, 165 161 }, 166 162 { 167 - .compatible = "socionext,uniphier-pxs2-mio-clock", 168 - .data = uniphier_pro5_mio_clk_data, 163 + .compatible = "socionext,uniphier-pxs2-sd-clock", 164 + .data = uniphier_pro5_sd_clk_data, 169 165 }, 170 166 { 171 167 .compatible = "socionext,uniphier-ld11-mio-clock", 172 168 .data = uniphier_sld3_mio_clk_data, 173 169 }, 174 170 { 175 - .compatible = "socionext,uniphier-ld20-mio-clock", 176 - .data = uniphier_pro5_mio_clk_data, 171 + .compatible = "socionext,uniphier-ld20-sd-clock", 172 + .data = uniphier_pro5_sd_clk_data, 177 173 }, 178 174 /* Peripheral clock */ 179 175 {
+1 -1
drivers/clk/uniphier/clk-uniphier-mio.c
··· 93 93 { /* sentinel */ } 94 94 }; 95 95 96 - const struct uniphier_clk_data uniphier_pro5_mio_clk_data[] = { 96 + const struct uniphier_clk_data uniphier_pro5_sd_clk_data[] = { 97 97 UNIPHIER_MIO_CLK_SD_FIXED, 98 98 UNIPHIER_MIO_CLK_SD(0, 0), 99 99 UNIPHIER_MIO_CLK_SD(1, 1),
+1 -1
drivers/clk/uniphier/clk-uniphier-mux.c
··· 42 42 struct uniphier_clk_mux *mux = to_uniphier_clk_mux(hw); 43 43 int num_parents = clk_hw_get_num_parents(hw); 44 44 int ret; 45 - u32 val; 45 + unsigned int val; 46 46 u8 i; 47 47 48 48 ret = regmap_read(mux->regmap, mux->reg, &val);
+1 -1
drivers/clk/uniphier/clk-uniphier.h
··· 115 115 extern const struct uniphier_clk_data uniphier_ld11_sys_clk_data[]; 116 116 extern const struct uniphier_clk_data uniphier_ld20_sys_clk_data[]; 117 117 extern const struct uniphier_clk_data uniphier_sld3_mio_clk_data[]; 118 - extern const struct uniphier_clk_data uniphier_pro5_mio_clk_data[]; 118 + extern const struct uniphier_clk_data uniphier_pro5_sd_clk_data[]; 119 119 extern const struct uniphier_clk_data uniphier_ld4_peri_clk_data[]; 120 120 extern const struct uniphier_clk_data uniphier_pro4_peri_clk_data[]; 121 121
+1 -1
include/linux/clk-provider.h
··· 785 785 * routines, one at of_clk_init(), and one at platform device probe 786 786 */ 787 787 #define CLK_OF_DECLARE_DRIVER(name, compat, fn) \ 788 - static void name##_of_clk_init_driver(struct device_node *np) \ 788 + static void __init name##_of_clk_init_driver(struct device_node *np) \ 789 789 { \ 790 790 of_node_clear_flag(np, OF_POPULATED); \ 791 791 fn(np); \