diff options
| -rw-r--r-- | drivers/clk/rockchip/clk-mmc-phase.c | 22 | ||||
| -rw-r--r-- | drivers/clk/rockchip/clk-rk3228.c | 2 | ||||
| -rw-r--r-- | drivers/clk/rockchip/clk-rk3328.c | 16 | ||||
| -rw-r--r-- | drivers/clk/rockchip/clk-rk3399.c | 4 |
4 files changed, 29 insertions, 15 deletions
diff --git a/drivers/clk/rockchip/clk-mmc-phase.c b/drivers/clk/rockchip/clk-mmc-phase.c index dc4c227732bd..026a26bb702d 100644 --- a/drivers/clk/rockchip/clk-mmc-phase.c +++ b/drivers/clk/rockchip/clk-mmc-phase.c | |||
| @@ -170,18 +170,30 @@ static int rockchip_mmc_clk_rate_notify(struct notifier_block *nb, | |||
| 170 | unsigned long event, void *data) | 170 | unsigned long event, void *data) |
| 171 | { | 171 | { |
| 172 | struct rockchip_mmc_clock *mmc_clock = to_rockchip_mmc_clock(nb); | 172 | struct rockchip_mmc_clock *mmc_clock = to_rockchip_mmc_clock(nb); |
| 173 | struct clk_notifier_data *ndata = data; | ||
| 173 | 174 | ||
| 174 | /* | 175 | /* |
| 175 | * rockchip_mmc_clk is mostly used by mmc controllers to sample | 176 | * rockchip_mmc_clk is mostly used by mmc controllers to sample |
| 176 | * the intput data, which expects the fixed phase after the tuning | 177 | * the intput data, which expects the fixed phase after the tuning |
| 177 | * process. However if the clock rate is changed, the phase is stale | 178 | * process. However if the clock rate is changed, the phase is stale |
| 178 | * and may break the data sampling. So here we try to restore the phase | 179 | * and may break the data sampling. So here we try to restore the phase |
| 179 | * for that case. | 180 | * for that case, except that |
| 181 | * (1) cached_phase is invaild since we inevitably cached it when the | ||
| 182 | * clock provider be reparented from orphan to its real parent in the | ||
| 183 | * first place. Otherwise we may mess up the initialization of MMC cards | ||
| 184 | * since we only set the default sample phase and drive phase later on. | ||
| 185 | * (2) the new coming rate is higher than the older one since mmc driver | ||
| 186 | * set the max-frequency to match the boards' ability but we can't go | ||
| 187 | * over the heads of that, otherwise the tests smoke out the issue. | ||
| 180 | */ | 188 | */ |
| 189 | if (ndata->old_rate <= ndata->new_rate) | ||
| 190 | return NOTIFY_DONE; | ||
| 191 | |||
| 181 | if (event == PRE_RATE_CHANGE) | 192 | if (event == PRE_RATE_CHANGE) |
| 182 | mmc_clock->cached_phase = | 193 | mmc_clock->cached_phase = |
| 183 | rockchip_mmc_get_phase(&mmc_clock->hw); | 194 | rockchip_mmc_get_phase(&mmc_clock->hw); |
| 184 | else if (event == POST_RATE_CHANGE) | 195 | else if (mmc_clock->cached_phase != -EINVAL && |
| 196 | event == POST_RATE_CHANGE) | ||
| 185 | rockchip_mmc_set_phase(&mmc_clock->hw, mmc_clock->cached_phase); | 197 | rockchip_mmc_set_phase(&mmc_clock->hw, mmc_clock->cached_phase); |
| 186 | 198 | ||
| 187 | return NOTIFY_DONE; | 199 | return NOTIFY_DONE; |
| @@ -211,8 +223,10 @@ struct clk *rockchip_clk_register_mmc(const char *name, | |||
| 211 | mmc_clock->shift = shift; | 223 | mmc_clock->shift = shift; |
| 212 | 224 | ||
| 213 | clk = clk_register(NULL, &mmc_clock->hw); | 225 | clk = clk_register(NULL, &mmc_clock->hw); |
| 214 | if (IS_ERR(clk)) | 226 | if (IS_ERR(clk)) { |
| 227 | ret = PTR_ERR(clk); | ||
| 215 | goto err_register; | 228 | goto err_register; |
| 229 | } | ||
| 216 | 230 | ||
| 217 | mmc_clock->clk_rate_change_nb.notifier_call = | 231 | mmc_clock->clk_rate_change_nb.notifier_call = |
| 218 | &rockchip_mmc_clk_rate_notify; | 232 | &rockchip_mmc_clk_rate_notify; |
| @@ -225,5 +239,5 @@ err_notifier: | |||
| 225 | clk_unregister(clk); | 239 | clk_unregister(clk); |
| 226 | err_register: | 240 | err_register: |
| 227 | kfree(mmc_clock); | 241 | kfree(mmc_clock); |
| 228 | return clk; | 242 | return ERR_PTR(ret); |
| 229 | } | 243 | } |
diff --git a/drivers/clk/rockchip/clk-rk3228.c b/drivers/clk/rockchip/clk-rk3228.c index 11e7f2d1c054..7af48184b022 100644 --- a/drivers/clk/rockchip/clk-rk3228.c +++ b/drivers/clk/rockchip/clk-rk3228.c | |||
| @@ -387,7 +387,7 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = { | |||
| 387 | RK2928_CLKSEL_CON(23), 5, 2, MFLAGS, 0, 6, DFLAGS, | 387 | RK2928_CLKSEL_CON(23), 5, 2, MFLAGS, 0, 6, DFLAGS, |
| 388 | RK2928_CLKGATE_CON(2), 15, GFLAGS), | 388 | RK2928_CLKGATE_CON(2), 15, GFLAGS), |
| 389 | 389 | ||
| 390 | COMPOSITE(SCLK_SDMMC, "sclk_sdmmc0", mux_mmc_src_p, 0, | 390 | COMPOSITE(SCLK_SDMMC, "sclk_sdmmc", mux_mmc_src_p, 0, |
| 391 | RK2928_CLKSEL_CON(11), 8, 2, MFLAGS, 0, 8, DFLAGS, | 391 | RK2928_CLKSEL_CON(11), 8, 2, MFLAGS, 0, 8, DFLAGS, |
| 392 | RK2928_CLKGATE_CON(2), 11, GFLAGS), | 392 | RK2928_CLKGATE_CON(2), 11, GFLAGS), |
| 393 | 393 | ||
diff --git a/drivers/clk/rockchip/clk-rk3328.c b/drivers/clk/rockchip/clk-rk3328.c index f680b421b6d5..252366a5231f 100644 --- a/drivers/clk/rockchip/clk-rk3328.c +++ b/drivers/clk/rockchip/clk-rk3328.c | |||
| @@ -810,24 +810,24 @@ static struct rockchip_clk_branch rk3328_clk_branches[] __initdata = { | |||
| 810 | GATE(0, "pclk_phy_niu", "pclk_phy_pre", 0, RK3328_CLKGATE_CON(15), 15, GFLAGS), | 810 | GATE(0, "pclk_phy_niu", "pclk_phy_pre", 0, RK3328_CLKGATE_CON(15), 15, GFLAGS), |
| 811 | 811 | ||
| 812 | /* PD_MMC */ | 812 | /* PD_MMC */ |
| 813 | MMC(SCLK_SDMMC_DRV, "sdmmc_drv", "sclk_sdmmc", | 813 | MMC(SCLK_SDMMC_DRV, "sdmmc_drv", "clk_sdmmc", |
| 814 | RK3328_SDMMC_CON0, 1), | 814 | RK3328_SDMMC_CON0, 1), |
| 815 | MMC(SCLK_SDMMC_SAMPLE, "sdmmc_sample", "sclk_sdmmc", | 815 | MMC(SCLK_SDMMC_SAMPLE, "sdmmc_sample", "clk_sdmmc", |
| 816 | RK3328_SDMMC_CON1, 1), | 816 | RK3328_SDMMC_CON1, 1), |
| 817 | 817 | ||
| 818 | MMC(SCLK_SDIO_DRV, "sdio_drv", "sclk_sdio", | 818 | MMC(SCLK_SDIO_DRV, "sdio_drv", "clk_sdio", |
| 819 | RK3328_SDIO_CON0, 1), | 819 | RK3328_SDIO_CON0, 1), |
| 820 | MMC(SCLK_SDIO_SAMPLE, "sdio_sample", "sclk_sdio", | 820 | MMC(SCLK_SDIO_SAMPLE, "sdio_sample", "clk_sdio", |
| 821 | RK3328_SDIO_CON1, 1), | 821 | RK3328_SDIO_CON1, 1), |
| 822 | 822 | ||
| 823 | MMC(SCLK_EMMC_DRV, "emmc_drv", "sclk_emmc", | 823 | MMC(SCLK_EMMC_DRV, "emmc_drv", "clk_emmc", |
| 824 | RK3328_EMMC_CON0, 1), | 824 | RK3328_EMMC_CON0, 1), |
| 825 | MMC(SCLK_EMMC_SAMPLE, "emmc_sample", "sclk_emmc", | 825 | MMC(SCLK_EMMC_SAMPLE, "emmc_sample", "clk_emmc", |
| 826 | RK3328_EMMC_CON1, 1), | 826 | RK3328_EMMC_CON1, 1), |
| 827 | 827 | ||
| 828 | MMC(SCLK_SDMMC_EXT_DRV, "sdmmc_ext_drv", "sclk_sdmmc_ext", | 828 | MMC(SCLK_SDMMC_EXT_DRV, "sdmmc_ext_drv", "clk_sdmmc_ext", |
| 829 | RK3328_SDMMC_EXT_CON0, 1), | 829 | RK3328_SDMMC_EXT_CON0, 1), |
| 830 | MMC(SCLK_SDMMC_EXT_SAMPLE, "sdmmc_ext_sample", "sclk_sdmmc_ext", | 830 | MMC(SCLK_SDMMC_EXT_SAMPLE, "sdmmc_ext_sample", "clk_sdmmc_ext", |
| 831 | RK3328_SDMMC_EXT_CON1, 1), | 831 | RK3328_SDMMC_EXT_CON1, 1), |
| 832 | }; | 832 | }; |
| 833 | 833 | ||
diff --git a/drivers/clk/rockchip/clk-rk3399.c b/drivers/clk/rockchip/clk-rk3399.c index 3e57c6eef93d..bca10d618f0a 100644 --- a/drivers/clk/rockchip/clk-rk3399.c +++ b/drivers/clk/rockchip/clk-rk3399.c | |||
| @@ -671,7 +671,7 @@ static struct rockchip_clk_branch rk3399_clk_branches[] __initdata = { | |||
| 671 | RK3399_CLKGATE_CON(9), 7, GFLAGS, | 671 | RK3399_CLKGATE_CON(9), 7, GFLAGS, |
| 672 | &rk3399_uart3_fracmux), | 672 | &rk3399_uart3_fracmux), |
| 673 | 673 | ||
| 674 | COMPOSITE(0, "pclk_ddr", mux_pll_src_cpll_gpll_p, CLK_IGNORE_UNUSED, | 674 | COMPOSITE(PCLK_DDR, "pclk_ddr", mux_pll_src_cpll_gpll_p, CLK_IGNORE_UNUSED, |
| 675 | RK3399_CLKSEL_CON(6), 15, 1, MFLAGS, 8, 5, DFLAGS, | 675 | RK3399_CLKSEL_CON(6), 15, 1, MFLAGS, 8, 5, DFLAGS, |
| 676 | RK3399_CLKGATE_CON(3), 4, GFLAGS), | 676 | RK3399_CLKGATE_CON(3), 4, GFLAGS), |
| 677 | 677 | ||
| @@ -887,7 +887,7 @@ static struct rockchip_clk_branch rk3399_clk_branches[] __initdata = { | |||
| 887 | RK3399_CLKGATE_CON(31), 8, GFLAGS), | 887 | RK3399_CLKGATE_CON(31), 8, GFLAGS), |
| 888 | 888 | ||
| 889 | /* sdio & sdmmc */ | 889 | /* sdio & sdmmc */ |
| 890 | COMPOSITE(0, "hclk_sd", mux_pll_src_cpll_gpll_p, 0, | 890 | COMPOSITE(HCLK_SD, "hclk_sd", mux_pll_src_cpll_gpll_p, 0, |
| 891 | RK3399_CLKSEL_CON(13), 15, 1, MFLAGS, 8, 5, DFLAGS, | 891 | RK3399_CLKSEL_CON(13), 15, 1, MFLAGS, 8, 5, DFLAGS, |
| 892 | RK3399_CLKGATE_CON(12), 13, GFLAGS), | 892 | RK3399_CLKGATE_CON(12), 13, GFLAGS), |
| 893 | GATE(HCLK_SDMMC, "hclk_sdmmc", "hclk_sd", 0, | 893 | GATE(HCLK_SDMMC, "hclk_sdmmc", "hclk_sd", 0, |
