Skip to content

Commit 14c735c

Browse files
superna9999jbrun3t
authored andcommitted
clk: meson-gxbb: Add EE 32K Clock for CEC
On Amlogic GX SoCs, there is two CEC controllers : - An Amlogic CEC custom in the AO domain - The Synopsys HDMI-TX Controller in the EE domain Each of these controllers needs a 32.768KHz clock, but there is two paths : - In the EE domain, the "32k_clk" this patchs is adding - In the AO domain, with a more complex dual divider more precise setup The AO 32K clock support will be pushed later in the corresponding gxbb-aoclk driver when the AE CEC driver is ready. The EE 32k_clk must be pushed earlier since mainline support for CEC in the Synopsys HDMI-TX controller is nearby. Signed-off-by: Neil Armstrong <[email protected]> [Rebased patch on top of last changes] Signed-off-by: Jerome Brunet <[email protected]>
1 parent 39c42ca commit 14c735c

File tree

2 files changed

+58
-1
lines changed

2 files changed

+58
-1
lines changed

drivers/clk/meson/gxbb.c

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -926,6 +926,51 @@ static struct clk_mux gxbb_cts_i958 = {
926926
},
927927
};
928928

929+
static struct clk_divider gxbb_32k_clk_div = {
930+
.reg = (void *)HHI_32K_CLK_CNTL,
931+
.shift = 0,
932+
.width = 14,
933+
.lock = &clk_lock,
934+
.hw.init = &(struct clk_init_data){
935+
.name = "32k_clk_div",
936+
.ops = &clk_divider_ops,
937+
.parent_names = (const char *[]){ "32k_clk_sel" },
938+
.num_parents = 1,
939+
.flags = CLK_SET_RATE_PARENT | CLK_DIVIDER_ROUND_CLOSEST,
940+
},
941+
};
942+
943+
static struct clk_gate gxbb_32k_clk = {
944+
.reg = (void *)HHI_32K_CLK_CNTL,
945+
.bit_idx = 15,
946+
.lock = &clk_lock,
947+
.hw.init = &(struct clk_init_data){
948+
.name = "32k_clk",
949+
.ops = &clk_gate_ops,
950+
.parent_names = (const char *[]){ "32k_clk_div" },
951+
.num_parents = 1,
952+
.flags = CLK_SET_RATE_PARENT,
953+
},
954+
};
955+
956+
static const char *gxbb_32k_clk_parent_names[] = {
957+
"xtal", "cts_slow_oscin", "fclk_div3", "fclk_div5"
958+
};
959+
960+
static struct clk_mux gxbb_32k_clk_sel = {
961+
.reg = (void *)HHI_32K_CLK_CNTL,
962+
.mask = 0x3,
963+
.shift = 16,
964+
.lock = &clk_lock,
965+
.hw.init = &(struct clk_init_data){
966+
.name = "32k_clk_sel",
967+
.ops = &clk_mux_ops,
968+
.parent_names = gxbb_32k_clk_parent_names,
969+
.num_parents = 4,
970+
.flags = CLK_SET_RATE_PARENT,
971+
},
972+
};
973+
929974
/* Everything Else (EE) domain gates */
930975
static MESON_GATE(gxbb_ddr, HHI_GCLK_MPEG0, 0);
931976
static MESON_GATE(gxbb_dos, HHI_GCLK_MPEG0, 1);
@@ -1132,6 +1177,9 @@ static struct clk_hw_onecell_data gxbb_hw_onecell_data = {
11321177
[CLKID_CTS_MCLK_I958_SEL] = &gxbb_cts_mclk_i958_sel.hw,
11331178
[CLKID_CTS_MCLK_I958_DIV] = &gxbb_cts_mclk_i958_div.hw,
11341179
[CLKID_CTS_I958] = &gxbb_cts_i958.hw,
1180+
[CLKID_32K_CLK] = &gxbb_32k_clk.hw,
1181+
[CLKID_32K_CLK_SEL] = &gxbb_32k_clk_sel.hw,
1182+
[CLKID_32K_CLK_DIV] = &gxbb_32k_clk_div.hw,
11351183
},
11361184
.num = NR_CLKS,
11371185
};
@@ -1251,6 +1299,9 @@ static struct clk_hw_onecell_data gxl_hw_onecell_data = {
12511299
[CLKID_CTS_MCLK_I958_SEL] = &gxbb_cts_mclk_i958_sel.hw,
12521300
[CLKID_CTS_MCLK_I958_DIV] = &gxbb_cts_mclk_i958_div.hw,
12531301
[CLKID_CTS_I958] = &gxbb_cts_i958.hw,
1302+
[CLKID_32K_CLK] = &gxbb_32k_clk.hw,
1303+
[CLKID_32K_CLK_SEL] = &gxbb_32k_clk_sel.hw,
1304+
[CLKID_32K_CLK_DIV] = &gxbb_32k_clk_div.hw,
12541305
},
12551306
.num = NR_CLKS,
12561307
};
@@ -1365,6 +1416,7 @@ static struct clk_gate *const gxbb_clk_gates[] = {
13651416
&gxbb_mali_1,
13661417
&gxbb_cts_amclk,
13671418
&gxbb_cts_mclk_i958,
1419+
&gxbb_32k_clk,
13681420
};
13691421

13701422
static struct clk_mux *const gxbb_clk_muxes[] = {
@@ -1376,6 +1428,7 @@ static struct clk_mux *const gxbb_clk_muxes[] = {
13761428
&gxbb_cts_amclk_sel,
13771429
&gxbb_cts_mclk_i958_sel,
13781430
&gxbb_cts_i958,
1431+
&gxbb_32k_clk_sel,
13791432
};
13801433

13811434
static struct clk_divider *const gxbb_clk_dividers[] = {
@@ -1384,6 +1437,7 @@ static struct clk_divider *const gxbb_clk_dividers[] = {
13841437
&gxbb_mali_0_div,
13851438
&gxbb_mali_1_div,
13861439
&gxbb_cts_mclk_i958_div,
1440+
&gxbb_32k_clk_div,
13871441
};
13881442

13891443
static struct meson_clk_audio_divider *const gxbb_audio_dividers[] = {

drivers/clk/meson/gxbb.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,11 @@
284284
#define CLKID_CTS_MCLK_I958_SEL 111
285285
#define CLKID_CTS_MCLK_I958_DIV 112
286286
/* CLKID_CTS_I958 */
287+
#define CLKID_32K_CLK 114
288+
#define CLKID_32K_CLK_SEL 115
289+
#define CLKID_32K_CLK_DIV 116
287290

288-
#define NR_CLKS 114
291+
#define NR_CLKS 117
289292

290293
/* include the CLKIDs that have been made part of the stable DT binding */
291294
#include <dt-bindings/clock/gxbb-clkc.h>

0 commit comments

Comments
 (0)