Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ description: |
CMU_MISC supplies the firmware-owned watchdog bus clock paths.
CMU_HSI0 supplies the USB, eUSB2 PHY and touchscreen USI2 clocks; its
ALT and TCXO inputs are board-level fixed clocks.
CMU_G3D supplies the GPU's core, coregroup and stacks clocks from its two
PLLs and CMU_TOP's G3D NoC, global and switch clocks.
The external oscillator supplies the PLL reference and oscillator mux
paths.
Clock identifiers are defined in dt-bindings/clock/google,zumapro.h.
Expand All @@ -23,6 +25,7 @@ properties:
compatible:
enum:
- google,zumapro-cmu-top
- google,zumapro-cmu-g3d
- google,zumapro-cmu-hsi0
- google,zumapro-cmu-hsi2
- google,zumapro-cmu-peric0
Expand Down Expand Up @@ -88,6 +91,24 @@ allOf:
else:
properties:
power-domains: false
- if:
properties:
compatible:
const: google,zumapro-cmu-g3d
then:
properties:
clocks:
items:
- description: External oscillator reference clock
- description: G3D NoC clock from CMU_TOP
- description: G3D global clock from CMU_TOP
- description: G3D switch clock from CMU_TOP
clock-names:
items:
- const: oscclk
- const: bus
- const: glb
- const: switch
- if:
properties:
compatible:
Expand Down Expand Up @@ -171,5 +192,13 @@ examples:
clocks = <&oscclk>, <&cmu_top CLK_DOUT_PERIC0_NOC>;
clock-names = "oscclk", "bus";
};
...

clock-controller@1ee00000 {
compatible = "google,zumapro-cmu-g3d";
reg = <0x1ee00000 0x8000>;
#clock-cells = <1>;
clocks = <&oscclk>, <&cmu_top CLK_DOUT_G3D_NOCD>,
<&cmu_top CLK_DOUT_G3D_GLB>, <&cmu_top CLK_DOUT_G3D_SWITCH>;
clock-names = "oscclk", "bus", "glb", "switch";
};
...
126 changes: 125 additions & 1 deletion drivers/clk/samsung/clk-zumapro.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ static const struct samsung_pll_clock top_plls[] __initconst = {
};

static const struct samsung_fixed_factor_clock top_factors[] __initconst = {
FFACTOR(CLK_SHARED0_D2, "zumapro_shared0_d2", "zumapro_shared0", 1, 2, 0),
FFACTOR(CLK_SHARED0_D3, "zumapro_shared0_d3", "zumapro_shared0", 1, 3, 0),
FFACTOR(CLK_SHARED1_D2, "zumapro_shared1_d2", "zumapro_shared1", 1, 2, 0),
FFACTOR(CLK_SHARED1_D3, "zumapro_shared1_d3", "zumapro_shared1", 1, 3, 0),
FFACTOR(CLK_SHARED0_D4, "zumapro_shared0_d4", "zumapro_shared0", 1, 4, 0),
FFACTOR(CLK_SHARED1_D4, "zumapro_shared1_d4", "zumapro_shared1", 1, 4, 0),
FFACTOR(CLK_SHARED2_D2, "zumapro_shared2_d2", "zumapro_shared2", 1, 2, 0),
Expand All @@ -60,6 +64,18 @@ PNAME(peric0_noc_parents) = {
"zumapro_spare",
};

PNAME(g3d_glb_parents) = {
"zumapro_shared0_d2", "zumapro_shared1_d2", "zumapro_shared2",
"zumapro_shared3", "zumapro_shared0_d3", "zumapro_shared1_d3",
"zumapro_shared0_d4", "zumapro_spare",
};

PNAME(g3d_switch_parents) = {
"zumapro_shared2", "zumapro_shared0_d3", "zumapro_shared3",
"zumapro_shared1_d3", "zumapro_shared0_d4", "zumapro_shared1_d4",
"zumapro_spare", "zumapro_spare",
};

static const struct samsung_mux_clock top_muxes[] __initconst = {
MUX_F(CLK_MOUT_HSI2_NOC, "zumapro_mout_hsi2_noc", hsi2_noc_parents,
0x10b0, 0, 3, 0, CLK_MUX_READ_ONLY),
Expand All @@ -75,6 +91,12 @@ static const struct samsung_mux_clock top_muxes[] __initconst = {
0x10b4, 0, 1, 0, CLK_MUX_READ_ONLY),
MUX_F(CLK_MOUT_MISC_NOC, "zumapro_mout_misc_noc", peric0_noc_parents,
0x10d0, 0, 2, 0, CLK_MUX_READ_ONLY),
MUX_F(CLK_MOUT_G3D_GLB, "zumapro_mout_g3d_glb", g3d_glb_parents,
0x106c, 0, 3, 0, CLK_MUX_READ_ONLY),
MUX_F(CLK_MOUT_G3D_NOCD, "zumapro_mout_g3d_nocd", g3d_glb_parents,
0x1070, 0, 3, 0, CLK_MUX_READ_ONLY),
MUX_F(CLK_MOUT_G3D_SWITCH, "zumapro_mout_g3d_switch", g3d_switch_parents,
0x1074, 0, 3, 0, CLK_MUX_READ_ONLY),
};

/* The hardware order is mux -> gate -> divider. */
Expand All @@ -97,6 +119,12 @@ static const struct samsung_gate_clock top_ro_gates[] __initconst = {
0x20bc, 21, CLK_IGNORE_UNUSED, 0),
GATE(CLK_GOUT_HSI0_PERI, "zumapro_gout_hsi0_peri", "zumapro_mout_hsi0_peri",
0x20c0, 21, CLK_IGNORE_UNUSED, 0),
GATE(CLK_GOUT_G3D_GLB, "zumapro_gout_g3d_glb", "zumapro_mout_g3d_glb",
0x2094, 21, CLK_IGNORE_UNUSED, 0),
GATE(CLK_GOUT_G3D_NOCD, "zumapro_gout_g3d_nocd", "zumapro_mout_g3d_nocd",
0x2098, 21, CLK_IGNORE_UNUSED, 0),
GATE(CLK_GOUT_G3D_SWITCH, "zumapro_gout_g3d_switch",
"zumapro_mout_g3d_switch", 0x209c, 21, CLK_IGNORE_UNUSED, 0),
};

static const struct samsung_div_clock top_dividers[] __initconst = {
Expand All @@ -114,6 +142,12 @@ static const struct samsung_div_clock top_dividers[] __initconst = {
0x18ac, 0, 3, 0, CLK_DIVIDER_READ_ONLY),
DIV_F(CLK_DOUT_MISC_NOC, "zumapro_dout_misc_noc", "zumapro_gout_misc_noc",
0x18c4, 0, 4, 0, CLK_DIVIDER_READ_ONLY),
DIV_F(CLK_DOUT_G3D_GLB, "zumapro_dout_g3d_glb", "zumapro_gout_g3d_glb",
0x1864, 0, 4, 0, CLK_DIVIDER_READ_ONLY),
DIV_F(CLK_DOUT_G3D_NOCD, "zumapro_dout_g3d_nocd", "zumapro_gout_g3d_nocd",
0x1868, 0, 4, 0, CLK_DIVIDER_READ_ONLY),
DIV_F(CLK_DOUT_G3D_SWITCH, "zumapro_dout_g3d_switch",
"zumapro_gout_g3d_switch", 0x186c, 0, 3, 0, CLK_DIVIDER_READ_ONLY),
};

/* Only these branch gates are put under manual CCF control. */
Expand All @@ -134,7 +168,7 @@ static const struct samsung_cmu_info top_cmu __initconst = {
.nr_ro_gate_clks = ARRAY_SIZE(top_ro_gates),
.div_clks = top_dividers,
.nr_div_clks = ARRAY_SIZE(top_dividers),
.nr_clk_ids = CLK_GOUT_HSI0_PERI + 1,
.nr_clk_ids = CLK_SHARED1_D3 + 1,
.clk_regs = top_regs,
.nr_clk_regs = ARRAY_SIZE(top_regs),
};
Expand Down Expand Up @@ -231,6 +265,95 @@ static const struct samsung_cmu_info hsi2_cmu __initconst = {
.clk_name = "bus",
};

/*
* CMU_G3D. Firmware sets it up and keeps its domain on: the PLLs, muxes and
* dividers are read-only (the PLLs use the PLL0822x M/P/S layout, with no
* rate table), and the GPU's gates are read-only gates. The GPU's own rate
* changes go through the ACPM firmware, not this CMU.
*/
PNAME(g3d_switch_user_parents) = { "oscclk", "zumapro_dout_g3d_switch" };
PNAME(g3d_glb_user_parents) = { "oscclk", "zumapro_dout_g3d_glb" };
PNAME(g3d_nocd_user_parents) = { "oscclk", "zumapro_dout_g3d_nocd" };
PNAME(g3d_l2_glb_parents) = { "zumapro_fout_g3d_l2", "zumapro_mout_g3d_glb_user" };
PNAME(g3d_stacks_parents) = { "zumapro_fout_g3d", "zumapro_mout_g3d_switch_user" };
PNAME(g3d_top_parents) = {
"zumapro_mout_g3d_stacks", "zumapro_mout_g3d_nocd_user",
"zumapro_mout_g3d_l2_glb", "oscclk",
};

PNAME(g3d_coregroup_user_parents) = { "oscclk", "zumapro_dout_g3d_l2_glb" };
PNAME(g3d_stacks_user_parents) = { "oscclk", "zumapro_dout_g3d_stacks" };
PNAME(g3d_top_user_parents) = { "oscclk", "zumapro_dout_g3d_top" };

static const struct samsung_pll_clock g3d_plls[] __initconst = {
PLL(pll_0822x, CLK_FOUT_G3D, "zumapro_fout_g3d", "oscclk",
0x000, 0x10c, NULL),
PLL(pll_0822x, CLK_FOUT_G3D_L2, "zumapro_fout_g3d_l2", "oscclk",
0x008, 0x18c, NULL),
};

static const struct samsung_mux_clock g3d_muxes[] __initconst = {
MUX_F(CLK_MOUT_G3D_SWITCH_USER, "zumapro_mout_g3d_switch_user",
g3d_switch_user_parents, 0x620, 4, 1, 0, CLK_MUX_READ_ONLY),
MUX_F(CLK_MOUT_G3D_GLB_USER, "zumapro_mout_g3d_glb_user",
g3d_glb_user_parents, 0x600, 4, 1, 0, CLK_MUX_READ_ONLY),
MUX_F(CLK_MOUT_G3D_NOCD_USER, "zumapro_mout_g3d_nocd_user",
g3d_nocd_user_parents, 0x610, 4, 1, 0, CLK_MUX_READ_ONLY),
MUX_F(CLK_MOUT_G3D_L2_GLB, "zumapro_mout_g3d_l2_glb",
g3d_l2_glb_parents, 0x1000, 0, 1, 0, CLK_MUX_READ_ONLY),
MUX_F(CLK_MOUT_G3D_STACKS, "zumapro_mout_g3d_stacks",
g3d_stacks_parents, 0x1004, 0, 1, 0, CLK_MUX_READ_ONLY),
MUX_F(CLK_MOUT_G3D_TOP, "zumapro_mout_g3d_top",
g3d_top_parents, 0x1008, 0, 2, 0, CLK_MUX_READ_ONLY),
MUX_F(CLK_MOUT_G3D_COREGROUP_USER, "zumapro_mout_g3d_coregroup_user",
g3d_coregroup_user_parents, 0x630, 4, 1, 0, CLK_MUX_READ_ONLY),
MUX_F(CLK_MOUT_G3D_STACKS_USER, "zumapro_mout_g3d_stacks_user",
g3d_stacks_user_parents, 0x640, 4, 1, 0, CLK_MUX_READ_ONLY),
MUX_F(CLK_MOUT_G3D_TOP_USER, "zumapro_mout_g3d_top_user",
g3d_top_user_parents, 0x650, 4, 1, 0, CLK_MUX_READ_ONLY),
};

/* CAL exposes no ratio field for these two paths: they are pass-through. */
static const struct samsung_fixed_factor_clock g3d_factors[] __initconst = {
FFACTOR(CLK_DOUT_G3D_L2_GLB, "zumapro_dout_g3d_l2_glb",
"zumapro_mout_g3d_l2_glb", 1, 1, 0),
FFACTOR(CLK_DOUT_G3D_STACKS, "zumapro_dout_g3d_stacks",
"zumapro_mout_g3d_stacks", 1, 1, 0),
};

static const struct samsung_div_clock g3d_dividers[] __initconst = {
DIV_F(CLK_DOUT_G3D_TOP, "zumapro_dout_g3d_top", "zumapro_mout_g3d_top",
0x1814, 0, 3, 0, CLK_DIVIDER_READ_ONLY),
DIV_F(CLK_DOUT_G3D_NOCP, "zumapro_dout_g3d_nocp", "zumapro_dout_g3d_l2_glb",
0x1808, 0, 3, 0, CLK_DIVIDER_READ_ONLY),
};

static const struct samsung_gate_clock g3d_ro_gates[] __initconst = {
GATE(CLK_GOUT_G3D_CMU, "zumapro_gout_g3d_cmu", "zumapro_dout_g3d_nocp",
0x2018, 21, CLK_IGNORE_UNUSED, 0),
GATE(CLK_GOUT_G3D_CORE, "zumapro_gout_g3d_core", "zumapro_mout_g3d_top_user",
0x201c, 21, CLK_IGNORE_UNUSED, 0),
GATE(CLK_GOUT_G3D_COREGROUP, "zumapro_gout_g3d_coregroup",
"zumapro_mout_g3d_coregroup_user", 0x2020, 21, CLK_IGNORE_UNUSED, 0),
GATE(CLK_GOUT_G3D_STACKS, "zumapro_gout_g3d_stacks",
"zumapro_mout_g3d_stacks_user", 0x2024, 21, CLK_IGNORE_UNUSED, 0),
};

static const struct samsung_cmu_info g3d_cmu __initconst = {
.pll_clks = g3d_plls,
.nr_pll_clks = ARRAY_SIZE(g3d_plls),
.mux_clks = g3d_muxes,
.nr_mux_clks = ARRAY_SIZE(g3d_muxes),
.fixed_factor_clks = g3d_factors,
.nr_fixed_factor_clks = ARRAY_SIZE(g3d_factors),
.div_clks = g3d_dividers,
.nr_div_clks = ARRAY_SIZE(g3d_dividers),
.ro_gate_clks = g3d_ro_gates,
.nr_ro_gate_clks = ARRAY_SIZE(g3d_ro_gates),
.nr_clk_ids = CLK_GOUT_G3D_STACKS + 1,
.clk_name = "bus",
};

/* CMU_HSI0. Firmware keeps the domain powered; there is no local PM. */
PNAME(mout_hsi0_tcxo_user_parents) = { "oscclk", "hsi0-tcxo" };
PNAME(mout_hsi0_usb20_ref_parents) = { "zumapro_dout_hsi0_usb", "zumapro_mout_hsi0_tcxo_user" };
Expand Down Expand Up @@ -393,6 +516,7 @@ static int __init zumapro_cmu_probe(struct platform_device *pdev)
}

static const struct of_device_id zumapro_cmu_match[] = {
{ .compatible = "google,zumapro-cmu-g3d", .data = &g3d_cmu },
{ .compatible = "google,zumapro-cmu-hsi0", .data = &hsi0_cmu },
{ .compatible = "google,zumapro-cmu-hsi2", .data = &hsi2_cmu },
{ .compatible = "google,zumapro-cmu-peric0", .data = &peric0_cmu },
Expand Down
34 changes: 34 additions & 0 deletions include/dt-bindings/clock/google,zumapro.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@
#define CLK_DOUT_MISC_NOC 28
#define CLK_GOUT_HSI0_NOC 29
#define CLK_GOUT_HSI0_PERI 30
#define CLK_MOUT_G3D_GLB 31
#define CLK_MOUT_G3D_NOCD 32
#define CLK_MOUT_G3D_SWITCH 33
#define CLK_GOUT_G3D_GLB 34
#define CLK_GOUT_G3D_NOCD 35
#define CLK_GOUT_G3D_SWITCH 36
#define CLK_DOUT_G3D_GLB 37
#define CLK_DOUT_G3D_NOCD 38
#define CLK_DOUT_G3D_SWITCH 39
#define CLK_SHARED0_D2 40
#define CLK_SHARED0_D3 41
#define CLK_SHARED1_D2 42
#define CLK_SHARED1_D3 43

/* CMU_HSI0. */
#define CLK_FOUT_HSI0_USB 1
Expand All @@ -59,6 +72,27 @@
#define CLK_GOUT_HSI0_USB_LINK 21
#define CLK_GOUT_HSI0_USB_SUSPEND 22

/* CMU_G3D. */
#define CLK_FOUT_G3D 1
#define CLK_FOUT_G3D_L2 2
#define CLK_MOUT_G3D_SWITCH_USER 3
#define CLK_MOUT_G3D_GLB_USER 4
#define CLK_MOUT_G3D_NOCD_USER 5
#define CLK_MOUT_G3D_L2_GLB 6
#define CLK_MOUT_G3D_STACKS 7
#define CLK_MOUT_G3D_TOP 8
#define CLK_DOUT_G3D_L2_GLB 9
#define CLK_DOUT_G3D_STACKS 10
#define CLK_DOUT_G3D_TOP 11
#define CLK_MOUT_G3D_COREGROUP_USER 12
#define CLK_MOUT_G3D_STACKS_USER 13
#define CLK_MOUT_G3D_TOP_USER 14
#define CLK_DOUT_G3D_NOCP 15
#define CLK_GOUT_G3D_CMU 16
#define CLK_GOUT_G3D_CORE 17
#define CLK_GOUT_G3D_COREGROUP 18
#define CLK_GOUT_G3D_STACKS 19

/* CMU_HSI2. */
#define CLK_MOUT_HSI2_NOC_USER 1
#define CLK_MOUT_HSI2_UFS_USER 2
Expand Down