Skip to content

Commit ed064e6

Browse files
Andre-ARMwens
authored andcommitted
clk: sunxi-ng: a523: add interface mod clocks
Add the clocks driving what the user manual summarises under "interface" devices: raw NAND flash, MMC, SPI, EMAC, "IR" infrared, and the "GPADC" general purpose analogue/digital converter. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com> Link: https://patch.msgid.link/20250307002628.10684-10-andre.przywara@arm.com Signed-off-by: Chen-Yu Tsai <wens@csie.org>
1 parent 74b0443 commit ed064e6

File tree

1 file changed

+159
-0
lines changed

1 file changed

+159
-0
lines changed

drivers/clk/sunxi-ng/ccu-sun55i-a523.c

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ static CLK_FIXED_FACTOR_HWS(pll_periph0_150M_clk, "pll-periph0-150M",
113113
pll_periph0_2x_hws, 8, 1, 0);
114114
static CLK_FIXED_FACTOR_HWS(pll_periph0_160M_clk, "pll-periph0-160M",
115115
pll_periph0_480M_hws, 3, 1, 0);
116+
static const struct clk_hw *pll_periph0_150M_hws[] = {
117+
&pll_periph0_150M_clk.hw
118+
};
116119

117120
#define SUN55I_A523_PLL_PERIPH1_REG 0x028
118121
static struct ccu_nm pll_periph1_4x_clk = {
@@ -555,6 +558,132 @@ static SUNXI_CCU_MP_DATA_WITH_MUX_GATE_FEAT(dram_clk, "dram", dram_parents,
555558
CLK_IS_CRITICAL,
556559
CCU_FEATURE_UPDATE_BIT);
557560

561+
static const struct clk_parent_data nand_mmc_parents[] = {
562+
{ .fw_name = "hosc" },
563+
{ .hw = &pll_periph0_400M_clk.hw },
564+
{ .hw = &pll_periph0_300M_clk.hw },
565+
{ .hw = &pll_periph1_400M_clk.hw },
566+
{ .hw = &pll_periph1_300M_clk.hw },
567+
};
568+
569+
static SUNXI_CCU_M_DATA_WITH_MUX_GATE(nand0_clk, "nand0", nand_mmc_parents,
570+
0x810,
571+
0, 5, /* M */
572+
24, 3, /* mux */
573+
BIT(31), /* gate */
574+
0);
575+
576+
static SUNXI_CCU_M_DATA_WITH_MUX_GATE(nand1_clk, "nand1", nand_mmc_parents,
577+
0x814,
578+
0, 5, /* M */
579+
24, 3, /* mux */
580+
BIT(31), /* gate */
581+
0);
582+
583+
static SUNXI_CCU_MP_MUX_GATE_POSTDIV_DUALDIV(mmc0_clk, "mmc0", nand_mmc_parents,
584+
0x830,
585+
0, 5, /* M */
586+
8, 5, /* P */
587+
24, 3, /* mux */
588+
BIT(31), /* gate */
589+
2, /* post div */
590+
0);
591+
592+
static SUNXI_CCU_MP_MUX_GATE_POSTDIV_DUALDIV(mmc1_clk, "mmc1", nand_mmc_parents,
593+
0x834,
594+
0, 5, /* M */
595+
8, 5, /* P */
596+
24, 3, /* mux */
597+
BIT(31), /* gate */
598+
2, /* post div */
599+
0);
600+
601+
static const struct clk_parent_data mmc2_parents[] = {
602+
{ .fw_name = "hosc" },
603+
{ .hw = &pll_periph0_800M_clk.common.hw },
604+
{ .hw = &pll_periph0_600M_clk.hw },
605+
{ .hw = &pll_periph1_800M_clk.common.hw },
606+
{ .hw = &pll_periph1_600M_clk.hw },
607+
};
608+
609+
static SUNXI_CCU_MP_MUX_GATE_POSTDIV_DUALDIV(mmc2_clk, "mmc2", mmc2_parents,
610+
0x838,
611+
0, 5, /* M */
612+
8, 5, /* P */
613+
24, 3, /* mux */
614+
BIT(31), /* gate */
615+
2, /* post div */
616+
0);
617+
618+
static const struct clk_parent_data spi_parents[] = {
619+
{ .fw_name = "hosc" },
620+
{ .hw = &pll_periph0_300M_clk.hw },
621+
{ .hw = &pll_periph0_200M_clk.hw },
622+
{ .hw = &pll_periph1_300M_clk.hw },
623+
{ .hw = &pll_periph1_200M_clk.hw },
624+
};
625+
static SUNXI_CCU_DUALDIV_MUX_GATE(spi0_clk, "spi0", spi_parents, 0x940,
626+
0, 5, /* M */
627+
8, 5, /* P */
628+
24, 3, /* mux */
629+
BIT(31), /* gate */
630+
0);
631+
static SUNXI_CCU_DUALDIV_MUX_GATE(spi1_clk, "spi1", spi_parents, 0x944,
632+
0, 5, /* M */
633+
8, 5, /* P */
634+
24, 3, /* mux */
635+
BIT(31), /* gate */
636+
0);
637+
static SUNXI_CCU_DUALDIV_MUX_GATE(spi2_clk, "spi2", spi_parents, 0x948,
638+
0, 5, /* M */
639+
8, 5, /* P */
640+
24, 3, /* mux */
641+
BIT(31), /* gate */
642+
0);
643+
static SUNXI_CCU_DUALDIV_MUX_GATE(spifc_clk, "spifc", nand_mmc_parents, 0x950,
644+
0, 5, /* M */
645+
8, 5, /* P */
646+
24, 3, /* mux */
647+
BIT(31), /* gate */
648+
0);
649+
650+
static SUNXI_CCU_GATE_HWS_WITH_PREDIV(emac0_25M_clk, "emac0-25M",
651+
pll_periph0_150M_hws,
652+
0x970, BIT(31) | BIT(30), 6, 0);
653+
static SUNXI_CCU_GATE_HWS_WITH_PREDIV(emac1_25M_clk, "emac1-25M",
654+
pll_periph0_150M_hws,
655+
0x974, BIT(31) | BIT(30), 6, 0);
656+
657+
static const struct clk_parent_data ir_rx_parents[] = {
658+
{ .fw_name = "losc" },
659+
{ .fw_name = "hosc" },
660+
};
661+
662+
static SUNXI_CCU_M_DATA_WITH_MUX_GATE(ir_rx_clk, "ir-rx", ir_rx_parents, 0x990,
663+
0, 5, /* M */
664+
24, 1, /* mux */
665+
BIT(31), /* gate */
666+
0);
667+
static const struct clk_parent_data ir_tx_ledc_parents[] = {
668+
{ .fw_name = "hosc" },
669+
{ .hw = &pll_periph1_600M_clk.hw },
670+
};
671+
static SUNXI_CCU_M_DATA_WITH_MUX_GATE(ir_tx_clk, "ir-tx", ir_tx_ledc_parents,
672+
0x9c0,
673+
0, 5, /* M */
674+
24, 1, /* mux */
675+
BIT(31), /* gate */
676+
0);
677+
678+
static SUNXI_CCU_M_WITH_GATE(gpadc0_clk, "gpadc0", "hosc", 0x9e0,
679+
0, 5, /* M */
680+
BIT(31), /* gate */
681+
0);
682+
static SUNXI_CCU_M_WITH_GATE(gpadc1_clk, "gpadc1", "hosc", 0x9e4,
683+
0, 5, /* M */
684+
BIT(31), /* gate */
685+
0);
686+
558687
static const struct clk_parent_data losc_hosc_parents[] = {
559688
{ .fw_name = "hosc" },
560689
{ .fw_name = "losc" },
@@ -725,6 +854,21 @@ static struct ccu_common *sun55i_a523_ccu_clks[] = {
725854
&hstimer5_clk.common,
726855
&iommu_clk.common,
727856
&dram_clk.common,
857+
&nand0_clk.common,
858+
&nand1_clk.common,
859+
&mmc0_clk.common,
860+
&mmc1_clk.common,
861+
&mmc2_clk.common,
862+
&spi0_clk.common,
863+
&spi1_clk.common,
864+
&spi2_clk.common,
865+
&spifc_clk.common,
866+
&emac0_25M_clk.common,
867+
&emac1_25M_clk.common,
868+
&ir_rx_clk.common,
869+
&ir_tx_clk.common,
870+
&gpadc0_clk.common,
871+
&gpadc1_clk.common,
728872
&pcie_aux_clk.common,
729873
&hdmi_24M_clk.common,
730874
&hdmi_cec_32k_clk.common,
@@ -801,6 +945,21 @@ static struct clk_hw_onecell_data sun55i_a523_hw_clks = {
801945
[CLK_HSTIMER5] = &hstimer5_clk.common.hw,
802946
[CLK_IOMMU] = &iommu_clk.common.hw,
803947
[CLK_DRAM] = &dram_clk.common.hw,
948+
[CLK_NAND0] = &nand0_clk.common.hw,
949+
[CLK_NAND1] = &nand1_clk.common.hw,
950+
[CLK_MMC0] = &mmc0_clk.common.hw,
951+
[CLK_MMC1] = &mmc1_clk.common.hw,
952+
[CLK_MMC2] = &mmc2_clk.common.hw,
953+
[CLK_SPI0] = &spi0_clk.common.hw,
954+
[CLK_SPI1] = &spi1_clk.common.hw,
955+
[CLK_SPI2] = &spi2_clk.common.hw,
956+
[CLK_SPIFC] = &spifc_clk.common.hw,
957+
[CLK_EMAC0_25M] = &emac0_25M_clk.common.hw,
958+
[CLK_EMAC1_25M] = &emac1_25M_clk.common.hw,
959+
[CLK_IR_RX] = &ir_rx_clk.common.hw,
960+
[CLK_IR_TX] = &ir_tx_clk.common.hw,
961+
[CLK_GPADC0] = &gpadc0_clk.common.hw,
962+
[CLK_GPADC1] = &gpadc1_clk.common.hw,
804963
[CLK_PCIE_AUX] = &pcie_aux_clk.common.hw,
805964
[CLK_HDMI_24M] = &hdmi_24M_clk.common.hw,
806965
[CLK_HDMI_CEC_32K] = &hdmi_cec_32k_clk.common.hw,

0 commit comments

Comments
 (0)