Skip to content

Commit fb2c603

Browse files
Andre-ARMwens
authored andcommitted
clk: sunxi-ng: a523: add USB mod clocks
Add the clocks driving the USB subsystem: this just covers the two clocks creating the 12 MHz rate for the OHCI (USB 1.x) device. The rest of the USB clocks are either gate clocks (added later) or created internal to the USB IP. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com> Link: https://patch.msgid.link/20250307002628.10684-11-andre.przywara@arm.com Signed-off-by: Chen-Yu Tsai <wens@csie.org>
1 parent ed064e6 commit fb2c603

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

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

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,59 @@ static SUNXI_CCU_M_WITH_GATE(gpadc1_clk, "gpadc1", "hosc", 0x9e4,
684684
BIT(31), /* gate */
685685
0);
686686

687+
/*
688+
* The first parent is a 48 MHz input clock divided by 4. That 48 MHz clock is
689+
* a 2x multiplier from osc24M synchronized by pll-periph0, and is also used by
690+
* the OHCI module.
691+
*/
692+
static const struct clk_parent_data usb_ohci_parents[] = {
693+
{ .hw = &pll_periph0_4x_clk.common.hw },
694+
{ .fw_name = "hosc" },
695+
{ .fw_name = "losc" },
696+
{ .fw_name = "iosc" },
697+
};
698+
static const struct ccu_mux_fixed_prediv usb_ohci_predivs[] = {
699+
{ .index = 0, .div = 50 },
700+
{ .index = 1, .div = 2 },
701+
};
702+
703+
static struct ccu_mux usb_ohci0_clk = {
704+
.enable = BIT(31),
705+
.mux = {
706+
.shift = 24,
707+
.width = 2,
708+
.fixed_predivs = usb_ohci_predivs,
709+
.n_predivs = ARRAY_SIZE(usb_ohci_predivs),
710+
},
711+
.common = {
712+
.reg = 0xa70,
713+
.features = CCU_FEATURE_FIXED_PREDIV,
714+
.hw.init = CLK_HW_INIT_PARENTS_DATA("usb-ohci0",
715+
usb_ohci_parents,
716+
&ccu_mux_ops,
717+
0),
718+
},
719+
};
720+
721+
static struct ccu_mux usb_ohci1_clk = {
722+
.enable = BIT(31),
723+
.mux = {
724+
.shift = 24,
725+
.width = 2,
726+
.fixed_predivs = usb_ohci_predivs,
727+
.n_predivs = ARRAY_SIZE(usb_ohci_predivs),
728+
},
729+
.common = {
730+
.reg = 0xa74,
731+
.features = CCU_FEATURE_FIXED_PREDIV,
732+
.hw.init = CLK_HW_INIT_PARENTS_DATA("usb-ohci1",
733+
usb_ohci_parents,
734+
&ccu_mux_ops,
735+
0),
736+
},
737+
};
738+
739+
687740
static const struct clk_parent_data losc_hosc_parents[] = {
688741
{ .fw_name = "hosc" },
689742
{ .fw_name = "losc" },
@@ -869,6 +922,8 @@ static struct ccu_common *sun55i_a523_ccu_clks[] = {
869922
&ir_tx_clk.common,
870923
&gpadc0_clk.common,
871924
&gpadc1_clk.common,
925+
&usb_ohci0_clk.common,
926+
&usb_ohci1_clk.common,
872927
&pcie_aux_clk.common,
873928
&hdmi_24M_clk.common,
874929
&hdmi_cec_32k_clk.common,
@@ -960,6 +1015,8 @@ static struct clk_hw_onecell_data sun55i_a523_hw_clks = {
9601015
[CLK_IR_TX] = &ir_tx_clk.common.hw,
9611016
[CLK_GPADC0] = &gpadc0_clk.common.hw,
9621017
[CLK_GPADC1] = &gpadc1_clk.common.hw,
1018+
[CLK_USB_OHCI0] = &usb_ohci0_clk.common.hw,
1019+
[CLK_USB_OHCI1] = &usb_ohci1_clk.common.hw,
9631020
[CLK_PCIE_AUX] = &pcie_aux_clk.common.hw,
9641021
[CLK_HDMI_24M] = &hdmi_24M_clk.common.hw,
9651022
[CLK_HDMI_CEC_32K] = &hdmi_cec_32k_clk.common.hw,

0 commit comments

Comments
 (0)