Skip to content

Commit e407810

Browse files
finley1226mmind
authored andcommitted
clk: rockchip: Add div50 clocks for px30 sdmmc, emmc, sdio and nandc
Some IPs, such as NAND, EMMC, SDIO and SDMMC need clock of 50% duty cycle, divfree50 can generate clock of 50% duty cycle even in odd value divisor. Signed-off-by: Finley Xiao <[email protected]> Signed-off-by: Heiko Stuebner <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 762539d commit e407810

File tree

1 file changed

+40
-4
lines changed

1 file changed

+40
-4
lines changed

drivers/clk/rockchip/clk-px30.c

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ PNAME(mux_uart5_p) = { "clk_uart5_src", "clk_uart5_np5", "clk_uart5_frac" };
167167
PNAME(mux_cif_out_p) = { "xin24m", "dummy_cpll", "npll", "usb480m" };
168168
PNAME(mux_dclk_vopb_p) = { "dclk_vopb_src", "dclk_vopb_frac", "xin24m" };
169169
PNAME(mux_dclk_vopl_p) = { "dclk_vopl_src", "dclk_vopl_frac", "xin24m" };
170+
PNAME(mux_nandc_p) = { "clk_nandc_div", "clk_nandc_div50" };
171+
PNAME(mux_sdio_p) = { "clk_sdio_div", "clk_sdio_div50" };
172+
PNAME(mux_emmc_p) = { "clk_emmc_div", "clk_emmc_div50" };
173+
PNAME(mux_sdmmc_p) = { "clk_sdmmc_div", "clk_sdmmc_div50" };
170174
PNAME(mux_gmac_p) = { "clk_gmac_src", "gmac_clkin" };
171175
PNAME(mux_gmac_rmii_sel_p) = { "clk_gmac_rx_tx_div20", "clk_gmac_rx_tx_div2" };
172176
PNAME(mux_rtc32k_pmu_p) = { "xin32k", "pmu_pvtm_32k", "clk_rtc32k_frac", };
@@ -460,16 +464,40 @@ static struct rockchip_clk_branch px30_clk_branches[] __initdata = {
460464
/* PD_MMC_NAND */
461465
GATE(HCLK_MMC_NAND, "hclk_mmc_nand", "hclk_peri_pre", 0,
462466
PX30_CLKGATE_CON(6), 0, GFLAGS),
463-
COMPOSITE(SCLK_NANDC, "clk_nandc", mux_gpll_cpll_npll_p, 0,
467+
COMPOSITE(SCLK_NANDC_DIV, "clk_nandc_div", mux_gpll_cpll_npll_p, 0,
464468
PX30_CLKSEL_CON(15), 6, 2, MFLAGS, 0, 5, DFLAGS,
469+
PX30_CLKGATE_CON(5), 11, GFLAGS),
470+
COMPOSITE(SCLK_NANDC_DIV50, "clk_nandc_div50", mux_gpll_cpll_npll_p, 0,
471+
PX30_CLKSEL_CON(15), 6, 2, MFLAGS, 8, 5, DFLAGS,
472+
PX30_CLKGATE_CON(5), 12, GFLAGS),
473+
COMPOSITE_NODIV(SCLK_NANDC, "clk_nandc", mux_nandc_p,
474+
CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
475+
PX30_CLKSEL_CON(15), 15, 1, MFLAGS,
465476
PX30_CLKGATE_CON(5), 13, GFLAGS),
466477

467-
COMPOSITE(SCLK_SDIO, "clk_sdio", mux_gpll_cpll_npll_xin24m_p, 0,
478+
COMPOSITE(SCLK_SDIO_DIV, "clk_sdio_div", mux_gpll_cpll_npll_xin24m_p, 0,
468479
PX30_CLKSEL_CON(18), 14, 2, MFLAGS, 0, 8, DFLAGS,
480+
PX30_CLKGATE_CON(6), 1, GFLAGS),
481+
COMPOSITE_DIV_OFFSET(SCLK_SDIO_DIV50, "clk_sdio_div50",
482+
mux_gpll_cpll_npll_xin24m_p, 0,
483+
PX30_CLKSEL_CON(18), 14, 2, MFLAGS,
484+
PX30_CLKSEL_CON(19), 0, 8, DFLAGS,
485+
PX30_CLKGATE_CON(6), 2, GFLAGS),
486+
COMPOSITE_NODIV(SCLK_SDIO, "clk_sdio", mux_sdio_p,
487+
CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
488+
PX30_CLKSEL_CON(19), 15, 1, MFLAGS,
469489
PX30_CLKGATE_CON(6), 3, GFLAGS),
470490

471-
COMPOSITE(SCLK_EMMC, "clk_emmc", mux_gpll_cpll_npll_xin24m_p, 0,
491+
COMPOSITE(SCLK_EMMC_DIV, "clk_emmc_div", mux_gpll_cpll_npll_xin24m_p, 0,
472492
PX30_CLKSEL_CON(20), 14, 2, MFLAGS, 0, 8, DFLAGS,
493+
PX30_CLKGATE_CON(6), 4, GFLAGS),
494+
COMPOSITE_DIV_OFFSET(SCLK_EMMC_DIV50, "clk_emmc_div50", mux_gpll_cpll_npll_xin24m_p, 0,
495+
PX30_CLKSEL_CON(20), 14, 2, MFLAGS,
496+
PX30_CLKSEL_CON(21), 0, 8, DFLAGS,
497+
PX30_CLKGATE_CON(6), 5, GFLAGS),
498+
COMPOSITE_NODIV(SCLK_EMMC, "clk_emmc", mux_emmc_p,
499+
CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
500+
PX30_CLKSEL_CON(21), 15, 1, MFLAGS,
473501
PX30_CLKGATE_CON(6), 6, GFLAGS),
474502

475503
COMPOSITE(SCLK_SFC, "clk_sfc", mux_gpll_cpll_p, 0,
@@ -494,8 +522,16 @@ static struct rockchip_clk_branch px30_clk_branches[] __initdata = {
494522
/* PD_SDCARD */
495523
GATE(0, "hclk_sdmmc_pre", "hclk_peri_pre", 0,
496524
PX30_CLKGATE_CON(6), 12, GFLAGS),
497-
COMPOSITE(SCLK_SDMMC, "clk_sdmmc", mux_gpll_cpll_npll_xin24m_p, 0,
525+
COMPOSITE(SCLK_SDMMC_DIV, "clk_sdmmc_div", mux_gpll_cpll_npll_xin24m_p, 0,
498526
PX30_CLKSEL_CON(16), 14, 2, MFLAGS, 0, 8, DFLAGS,
527+
PX30_CLKGATE_CON(6), 13, GFLAGS),
528+
COMPOSITE_DIV_OFFSET(SCLK_SDMMC_DIV50, "clk_sdmmc_div50", mux_gpll_cpll_npll_xin24m_p, 0,
529+
PX30_CLKSEL_CON(16), 14, 2, MFLAGS,
530+
PX30_CLKSEL_CON(17), 0, 8, DFLAGS,
531+
PX30_CLKGATE_CON(6), 14, GFLAGS),
532+
COMPOSITE_NODIV(SCLK_SDMMC, "clk_sdmmc", mux_sdmmc_p,
533+
CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
534+
PX30_CLKSEL_CON(17), 15, 1, MFLAGS,
499535
PX30_CLKGATE_CON(6), 15, GFLAGS),
500536

501537
/* PD_USB */

0 commit comments

Comments
 (0)