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

Merge tag 'v4.7-rockchip-clk4' of git://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip into clk-next

Pull rockchip clk updates from Heiko Stuebner:

Another small rk3399 fixup as well as simplifications around
our handling of the General-Register-Files syscon.

* tag 'v4.7-rockchip-clk4' of git://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip:
clk: rockchip: drop old_rate calculation on pll rate changes
clk: rockchip: simplify GRF handling in pll clocks
clk: rockchip: lookup General Register Files in rockchip_clk_init
clk: rockchip: fix the rk3399 sdmmc sample / drv name

+14 -47
+9 -36
drivers/clk/rockchip/clk-pll.c
··· 92 92 */ 93 93 static int rockchip_pll_wait_lock(struct rockchip_clk_pll *pll) 94 94 { 95 - struct regmap *grf = rockchip_clk_get_grf(pll->ctx); 95 + struct regmap *grf = pll->ctx->grf; 96 96 unsigned int val; 97 97 int delay = 24000000, ret; 98 - 99 - if (IS_ERR(grf)) { 100 - pr_err("%s: grf regmap not available\n", __func__); 101 - return PTR_ERR(grf); 102 - } 103 98 104 99 while (delay > 0) { 105 100 ret = regmap_read(grf, pll->lock_offset, &val); ··· 247 252 { 248 253 struct rockchip_clk_pll *pll = to_rockchip_clk_pll(hw); 249 254 const struct rockchip_pll_rate_table *rate; 250 - unsigned long old_rate = rockchip_rk3036_pll_recalc_rate(hw, prate); 251 - struct regmap *grf = rockchip_clk_get_grf(pll->ctx); 252 255 253 - if (IS_ERR(grf)) { 254 - pr_debug("%s: grf regmap not available, aborting rate change\n", 255 - __func__); 256 - return PTR_ERR(grf); 257 - } 258 - 259 - pr_debug("%s: changing %s from %lu to %lu with a parent rate of %lu\n", 260 - __func__, __clk_get_name(hw->clk), old_rate, drate, prate); 256 + pr_debug("%s: changing %s to %lu with a parent rate of %lu\n", 257 + __func__, __clk_get_name(hw->clk), drate, prate); 261 258 262 259 /* Get required rate settings from table */ 263 260 rate = rockchip_get_pll_settings(pll, drate); ··· 478 491 { 479 492 struct rockchip_clk_pll *pll = to_rockchip_clk_pll(hw); 480 493 const struct rockchip_pll_rate_table *rate; 481 - unsigned long old_rate = rockchip_rk3066_pll_recalc_rate(hw, prate); 482 - struct regmap *grf = rockchip_clk_get_grf(pll->ctx); 483 494 484 - if (IS_ERR(grf)) { 485 - pr_debug("%s: grf regmap not available, aborting rate change\n", 486 - __func__); 487 - return PTR_ERR(grf); 488 - } 489 - 490 - pr_debug("%s: changing %s from %lu to %lu with a parent rate of %lu\n", 491 - __func__, clk_hw_get_name(hw), old_rate, drate, prate); 495 + pr_debug("%s: changing %s to %lu with a parent rate of %lu\n", 496 + __func__, clk_hw_get_name(hw), drate, prate); 492 497 493 498 /* Get required rate settings from table */ 494 499 rate = rockchip_get_pll_settings(pll, drate); ··· 544 565 rate->no, cur.no, rate->nf, cur.nf, rate->nb, cur.nb); 545 566 if (rate->nr != cur.nr || rate->no != cur.no || rate->nf != cur.nf 546 567 || rate->nb != cur.nb) { 547 - struct regmap *grf = rockchip_clk_get_grf(pll->ctx); 548 - 549 - if (IS_ERR(grf)) 550 - return; 551 - 552 568 pr_debug("%s: pll %s: rate params do not match rate table, adjusting\n", 553 569 __func__, clk_hw_get_name(hw)); 554 570 rockchip_rk3066_pll_set_params(pll, rate); ··· 723 749 { 724 750 struct rockchip_clk_pll *pll = to_rockchip_clk_pll(hw); 725 751 const struct rockchip_pll_rate_table *rate; 726 - unsigned long old_rate = rockchip_rk3399_pll_recalc_rate(hw, prate); 727 752 728 - pr_debug("%s: changing %s from %lu to %lu with a parent rate of %lu\n", 729 - __func__, __clk_get_name(hw->clk), old_rate, drate, prate); 753 + pr_debug("%s: changing %s to %lu with a parent rate of %lu\n", 754 + __func__, __clk_get_name(hw->clk), drate, prate); 730 755 731 756 /* Get required rate settings from table */ 732 757 rate = rockchip_get_pll_settings(pll, drate); ··· 916 943 917 944 switch (pll_type) { 918 945 case pll_rk3036: 919 - if (!pll->rate_table) 946 + if (!pll->rate_table || IS_ERR(ctx->grf)) 920 947 init.ops = &rockchip_rk3036_pll_clk_norate_ops; 921 948 else 922 949 init.ops = &rockchip_rk3036_pll_clk_ops; 923 950 break; 924 951 case pll_rk3066: 925 - if (!pll->rate_table) 952 + if (!pll->rate_table || IS_ERR(ctx->grf)) 926 953 init.ops = &rockchip_rk3066_pll_clk_norate_ops; 927 954 else 928 955 init.ops = &rockchip_rk3066_pll_clk_ops;
+2 -2
drivers/clk/rockchip/clk-rk3399.c
··· 894 894 RK3399_CLKSEL_CON(16), 8, 3, MFLAGS, 0, 7, DFLAGS, 895 895 RK3399_CLKGATE_CON(6), 1, GFLAGS), 896 896 897 - MMC(SCLK_SDMMC_DRV, "emmc_drv", "clk_sdmmc", RK3399_SDMMC_CON0, 1), 898 - MMC(SCLK_SDMMC_SAMPLE, "emmc_sample", "clk_sdmmc", RK3399_SDMMC_CON1, 1), 897 + MMC(SCLK_SDMMC_DRV, "sdmmc_drv", "clk_sdmmc", RK3399_SDMMC_CON0, 1), 898 + MMC(SCLK_SDMMC_SAMPLE, "sdmmc_sample", "clk_sdmmc", RK3399_SDMMC_CON1, 1), 899 899 900 900 MMC(SCLK_SDIO_DRV, "sdio_drv", "clk_sdio", RK3399_SDIO_CON0, 1), 901 901 MMC(SCLK_SDIO_SAMPLE, "sdio_sample", "clk_sdio", RK3399_SDIO_CON1, 1),
+3 -8
drivers/clk/rockchip/clk.c
··· 347 347 ctx->grf = ERR_PTR(-EPROBE_DEFER); 348 348 spin_lock_init(&ctx->lock); 349 349 350 + ctx->grf = syscon_regmap_lookup_by_phandle(ctx->cru_node, 351 + "rockchip,grf"); 352 + 350 353 return ctx; 351 354 352 355 err_free: ··· 363 360 if (of_clk_add_provider(np, of_clk_src_onecell_get, 364 361 &ctx->clk_data)) 365 362 pr_err("%s: could not register clk provider\n", __func__); 366 - } 367 - 368 - struct regmap *rockchip_clk_get_grf(struct rockchip_clk_provider *ctx) 369 - { 370 - if (IS_ERR(ctx->grf)) 371 - ctx->grf = syscon_regmap_lookup_by_phandle(ctx->cru_node, 372 - "rockchip,grf"); 373 - return ctx->grf; 374 363 } 375 364 376 365 void rockchip_clk_add_lookup(struct rockchip_clk_provider *ctx,
-1
drivers/clk/rockchip/clk.h
··· 600 600 void __iomem *base, unsigned long nr_clks); 601 601 void rockchip_clk_of_add_provider(struct device_node *np, 602 602 struct rockchip_clk_provider *ctx); 603 - struct regmap *rockchip_clk_get_grf(struct rockchip_clk_provider *ctx); 604 603 void rockchip_clk_add_lookup(struct rockchip_clk_provider *ctx, 605 604 struct clk *clk, unsigned int id); 606 605 void rockchip_clk_register_branches(struct rockchip_clk_provider *ctx,