|
@@ -845,6 +845,112 @@ static struct clk_mux gxbb_mali = {
|
|
},
|
|
},
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+static struct clk_mux gxbb_cts_amclk_sel = {
|
|
|
|
+ .reg = (void *) HHI_AUD_CLK_CNTL,
|
|
|
|
+ .mask = 0x3,
|
|
|
|
+ .shift = 9,
|
|
|
|
+ /* Default parent unknown (register reset value: 0) */
|
|
|
|
+ .table = (u32[]){ 1, 2, 3 },
|
|
|
|
+ .lock = &clk_lock,
|
|
|
|
+ .hw.init = &(struct clk_init_data){
|
|
|
|
+ .name = "cts_amclk_sel",
|
|
|
|
+ .ops = &clk_mux_ops,
|
|
|
|
+ .parent_names = (const char *[]){ "mpll0", "mpll1", "mpll2" },
|
|
|
|
+ .num_parents = 3,
|
|
|
|
+ .flags = CLK_SET_RATE_PARENT,
|
|
|
|
+ },
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static struct meson_clk_audio_divider gxbb_cts_amclk_div = {
|
|
|
|
+ .div = {
|
|
|
|
+ .reg_off = HHI_AUD_CLK_CNTL,
|
|
|
|
+ .shift = 0,
|
|
|
|
+ .width = 8,
|
|
|
|
+ },
|
|
|
|
+ .lock = &clk_lock,
|
|
|
|
+ .hw.init = &(struct clk_init_data){
|
|
|
|
+ .name = "cts_amclk_div",
|
|
|
|
+ .ops = &meson_clk_audio_divider_ops,
|
|
|
|
+ .parent_names = (const char *[]){ "cts_amclk_sel" },
|
|
|
|
+ .num_parents = 1,
|
|
|
|
+ .flags = CLK_SET_RATE_PARENT | CLK_DIVIDER_ROUND_CLOSEST,
|
|
|
|
+ },
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static struct clk_gate gxbb_cts_amclk = {
|
|
|
|
+ .reg = (void *) HHI_AUD_CLK_CNTL,
|
|
|
|
+ .bit_idx = 8,
|
|
|
|
+ .lock = &clk_lock,
|
|
|
|
+ .hw.init = &(struct clk_init_data){
|
|
|
|
+ .name = "cts_amclk",
|
|
|
|
+ .ops = &clk_gate_ops,
|
|
|
|
+ .parent_names = (const char *[]){ "cts_amclk_div" },
|
|
|
|
+ .num_parents = 1,
|
|
|
|
+ .flags = CLK_SET_RATE_PARENT,
|
|
|
|
+ },
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static struct clk_mux gxbb_cts_mclk_i958_sel = {
|
|
|
|
+ .reg = (void *)HHI_AUD_CLK_CNTL2,
|
|
|
|
+ .mask = 0x3,
|
|
|
|
+ .shift = 25,
|
|
|
|
+ /* Default parent unknown (register reset value: 0) */
|
|
|
|
+ .table = (u32[]){ 1, 2, 3 },
|
|
|
|
+ .lock = &clk_lock,
|
|
|
|
+ .hw.init = &(struct clk_init_data){
|
|
|
|
+ .name = "cts_mclk_i958_sel",
|
|
|
|
+ .ops = &clk_mux_ops,
|
|
|
|
+ .parent_names = (const char *[]){ "mpll0", "mpll1", "mpll2" },
|
|
|
|
+ .num_parents = 3,
|
|
|
|
+ .flags = CLK_SET_RATE_PARENT,
|
|
|
|
+ },
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static struct clk_divider gxbb_cts_mclk_i958_div = {
|
|
|
|
+ .reg = (void *)HHI_AUD_CLK_CNTL2,
|
|
|
|
+ .shift = 16,
|
|
|
|
+ .width = 8,
|
|
|
|
+ .lock = &clk_lock,
|
|
|
|
+ .hw.init = &(struct clk_init_data){
|
|
|
|
+ .name = "cts_mclk_i958_div",
|
|
|
|
+ .ops = &clk_divider_ops,
|
|
|
|
+ .parent_names = (const char *[]){ "cts_mclk_i958_sel" },
|
|
|
|
+ .num_parents = 1,
|
|
|
|
+ .flags = CLK_SET_RATE_PARENT | CLK_DIVIDER_ROUND_CLOSEST,
|
|
|
|
+ },
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static struct clk_gate gxbb_cts_mclk_i958 = {
|
|
|
|
+ .reg = (void *)HHI_AUD_CLK_CNTL2,
|
|
|
|
+ .bit_idx = 24,
|
|
|
|
+ .lock = &clk_lock,
|
|
|
|
+ .hw.init = &(struct clk_init_data){
|
|
|
|
+ .name = "cts_mclk_i958",
|
|
|
|
+ .ops = &clk_gate_ops,
|
|
|
|
+ .parent_names = (const char *[]){ "cts_mclk_i958_div" },
|
|
|
|
+ .num_parents = 1,
|
|
|
|
+ .flags = CLK_SET_RATE_PARENT,
|
|
|
|
+ },
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static struct clk_mux gxbb_cts_i958 = {
|
|
|
|
+ .reg = (void *)HHI_AUD_CLK_CNTL2,
|
|
|
|
+ .mask = 0x1,
|
|
|
|
+ .shift = 27,
|
|
|
|
+ .lock = &clk_lock,
|
|
|
|
+ .hw.init = &(struct clk_init_data){
|
|
|
|
+ .name = "cts_i958",
|
|
|
|
+ .ops = &clk_mux_ops,
|
|
|
|
+ .parent_names = (const char *[]){ "cts_amclk", "cts_mclk_i958" },
|
|
|
|
+ .num_parents = 2,
|
|
|
|
+ /*
|
|
|
|
+ *The parent is specific to origin of the audio data. Let the
|
|
|
|
+ * consumer choose the appropriate parent
|
|
|
|
+ */
|
|
|
|
+ .flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
|
|
|
|
+ },
|
|
|
|
+};
|
|
|
|
+
|
|
/* Everything Else (EE) domain gates */
|
|
/* Everything Else (EE) domain gates */
|
|
static MESON_GATE(gxbb_ddr, HHI_GCLK_MPEG0, 0);
|
|
static MESON_GATE(gxbb_ddr, HHI_GCLK_MPEG0, 0);
|
|
static MESON_GATE(gxbb_dos, HHI_GCLK_MPEG0, 1);
|
|
static MESON_GATE(gxbb_dos, HHI_GCLK_MPEG0, 1);
|
|
@@ -1045,6 +1151,13 @@ static struct clk_hw_onecell_data gxbb_hw_onecell_data = {
|
|
[CLKID_MALI_1_DIV] = &gxbb_mali_1_div.hw,
|
|
[CLKID_MALI_1_DIV] = &gxbb_mali_1_div.hw,
|
|
[CLKID_MALI_1] = &gxbb_mali_1.hw,
|
|
[CLKID_MALI_1] = &gxbb_mali_1.hw,
|
|
[CLKID_MALI] = &gxbb_mali.hw,
|
|
[CLKID_MALI] = &gxbb_mali.hw,
|
|
|
|
+ [CLKID_CTS_AMCLK] = &gxbb_cts_amclk.hw,
|
|
|
|
+ [CLKID_CTS_AMCLK_SEL] = &gxbb_cts_amclk_sel.hw,
|
|
|
|
+ [CLKID_CTS_AMCLK_DIV] = &gxbb_cts_amclk_div.hw,
|
|
|
|
+ [CLKID_CTS_MCLK_I958] = &gxbb_cts_mclk_i958.hw,
|
|
|
|
+ [CLKID_CTS_MCLK_I958_SEL] = &gxbb_cts_mclk_i958_sel.hw,
|
|
|
|
+ [CLKID_CTS_MCLK_I958_DIV] = &gxbb_cts_mclk_i958_div.hw,
|
|
|
|
+ [CLKID_CTS_I958] = &gxbb_cts_i958.hw,
|
|
},
|
|
},
|
|
.num = NR_CLKS,
|
|
.num = NR_CLKS,
|
|
};
|
|
};
|
|
@@ -1158,6 +1271,13 @@ static struct clk_hw_onecell_data gxl_hw_onecell_data = {
|
|
[CLKID_MALI_1_DIV] = &gxbb_mali_1_div.hw,
|
|
[CLKID_MALI_1_DIV] = &gxbb_mali_1_div.hw,
|
|
[CLKID_MALI_1] = &gxbb_mali_1.hw,
|
|
[CLKID_MALI_1] = &gxbb_mali_1.hw,
|
|
[CLKID_MALI] = &gxbb_mali.hw,
|
|
[CLKID_MALI] = &gxbb_mali.hw,
|
|
|
|
+ [CLKID_CTS_AMCLK] = &gxbb_cts_amclk.hw,
|
|
|
|
+ [CLKID_CTS_AMCLK_SEL] = &gxbb_cts_amclk_sel.hw,
|
|
|
|
+ [CLKID_CTS_AMCLK_DIV] = &gxbb_cts_amclk_div.hw,
|
|
|
|
+ [CLKID_CTS_MCLK_I958] = &gxbb_cts_mclk_i958.hw,
|
|
|
|
+ [CLKID_CTS_MCLK_I958_SEL] = &gxbb_cts_mclk_i958_sel.hw,
|
|
|
|
+ [CLKID_CTS_MCLK_I958_DIV] = &gxbb_cts_mclk_i958_div.hw,
|
|
|
|
+ [CLKID_CTS_I958] = &gxbb_cts_i958.hw,
|
|
},
|
|
},
|
|
.num = NR_CLKS,
|
|
.num = NR_CLKS,
|
|
};
|
|
};
|
|
@@ -1270,6 +1390,8 @@ static struct clk_gate *const gxbb_clk_gates[] = {
|
|
&gxbb_sar_adc_clk,
|
|
&gxbb_sar_adc_clk,
|
|
&gxbb_mali_0,
|
|
&gxbb_mali_0,
|
|
&gxbb_mali_1,
|
|
&gxbb_mali_1,
|
|
|
|
+ &gxbb_cts_amclk,
|
|
|
|
+ &gxbb_cts_mclk_i958,
|
|
};
|
|
};
|
|
|
|
|
|
static struct clk_mux *const gxbb_clk_muxes[] = {
|
|
static struct clk_mux *const gxbb_clk_muxes[] = {
|
|
@@ -1278,6 +1400,9 @@ static struct clk_mux *const gxbb_clk_muxes[] = {
|
|
&gxbb_mali_0_sel,
|
|
&gxbb_mali_0_sel,
|
|
&gxbb_mali_1_sel,
|
|
&gxbb_mali_1_sel,
|
|
&gxbb_mali,
|
|
&gxbb_mali,
|
|
|
|
+ &gxbb_cts_amclk_sel,
|
|
|
|
+ &gxbb_cts_mclk_i958_sel,
|
|
|
|
+ &gxbb_cts_i958,
|
|
};
|
|
};
|
|
|
|
|
|
static struct clk_divider *const gxbb_clk_dividers[] = {
|
|
static struct clk_divider *const gxbb_clk_dividers[] = {
|
|
@@ -1285,6 +1410,11 @@ static struct clk_divider *const gxbb_clk_dividers[] = {
|
|
&gxbb_sar_adc_clk_div,
|
|
&gxbb_sar_adc_clk_div,
|
|
&gxbb_mali_0_div,
|
|
&gxbb_mali_0_div,
|
|
&gxbb_mali_1_div,
|
|
&gxbb_mali_1_div,
|
|
|
|
+ &gxbb_cts_mclk_i958_div,
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static struct meson_clk_audio_divider *const gxbb_audio_dividers[] = {
|
|
|
|
+ &gxbb_cts_amclk_div,
|
|
};
|
|
};
|
|
|
|
|
|
struct clkc_data {
|
|
struct clkc_data {
|
|
@@ -1298,6 +1428,8 @@ struct clkc_data {
|
|
unsigned int clk_muxes_count;
|
|
unsigned int clk_muxes_count;
|
|
struct clk_divider *const *clk_dividers;
|
|
struct clk_divider *const *clk_dividers;
|
|
unsigned int clk_dividers_count;
|
|
unsigned int clk_dividers_count;
|
|
|
|
+ struct meson_clk_audio_divider *const *clk_audio_dividers;
|
|
|
|
+ unsigned int clk_audio_dividers_count;
|
|
struct meson_clk_cpu *cpu_clk;
|
|
struct meson_clk_cpu *cpu_clk;
|
|
struct clk_hw_onecell_data *hw_onecell_data;
|
|
struct clk_hw_onecell_data *hw_onecell_data;
|
|
};
|
|
};
|
|
@@ -1313,6 +1445,8 @@ static const struct clkc_data gxbb_clkc_data = {
|
|
.clk_muxes_count = ARRAY_SIZE(gxbb_clk_muxes),
|
|
.clk_muxes_count = ARRAY_SIZE(gxbb_clk_muxes),
|
|
.clk_dividers = gxbb_clk_dividers,
|
|
.clk_dividers = gxbb_clk_dividers,
|
|
.clk_dividers_count = ARRAY_SIZE(gxbb_clk_dividers),
|
|
.clk_dividers_count = ARRAY_SIZE(gxbb_clk_dividers),
|
|
|
|
+ .clk_audio_dividers = gxbb_audio_dividers,
|
|
|
|
+ .clk_audio_dividers_count = ARRAY_SIZE(gxbb_audio_dividers),
|
|
.cpu_clk = &gxbb_cpu_clk,
|
|
.cpu_clk = &gxbb_cpu_clk,
|
|
.hw_onecell_data = &gxbb_hw_onecell_data,
|
|
.hw_onecell_data = &gxbb_hw_onecell_data,
|
|
};
|
|
};
|
|
@@ -1328,6 +1462,8 @@ static const struct clkc_data gxl_clkc_data = {
|
|
.clk_muxes_count = ARRAY_SIZE(gxbb_clk_muxes),
|
|
.clk_muxes_count = ARRAY_SIZE(gxbb_clk_muxes),
|
|
.clk_dividers = gxbb_clk_dividers,
|
|
.clk_dividers = gxbb_clk_dividers,
|
|
.clk_dividers_count = ARRAY_SIZE(gxbb_clk_dividers),
|
|
.clk_dividers_count = ARRAY_SIZE(gxbb_clk_dividers),
|
|
|
|
+ .clk_audio_dividers = gxbb_audio_dividers,
|
|
|
|
+ .clk_audio_dividers_count = ARRAY_SIZE(gxbb_audio_dividers),
|
|
.cpu_clk = &gxbb_cpu_clk,
|
|
.cpu_clk = &gxbb_cpu_clk,
|
|
.hw_onecell_data = &gxl_hw_onecell_data,
|
|
.hw_onecell_data = &gxl_hw_onecell_data,
|
|
};
|
|
};
|
|
@@ -1384,10 +1520,18 @@ static int gxbb_clkc_probe(struct platform_device *pdev)
|
|
clkc_data->clk_dividers[i]->reg = clk_base +
|
|
clkc_data->clk_dividers[i]->reg = clk_base +
|
|
(u64)clkc_data->clk_dividers[i]->reg;
|
|
(u64)clkc_data->clk_dividers[i]->reg;
|
|
|
|
|
|
|
|
+ /* Populate base address for the audio dividers */
|
|
|
|
+ for (i = 0; i < clkc_data->clk_audio_dividers_count; i++)
|
|
|
|
+ clkc_data->clk_audio_dividers[i]->base = clk_base;
|
|
|
|
+
|
|
/*
|
|
/*
|
|
* register all clks
|
|
* register all clks
|
|
*/
|
|
*/
|
|
for (clkid = 0; clkid < clkc_data->hw_onecell_data->num; clkid++) {
|
|
for (clkid = 0; clkid < clkc_data->hw_onecell_data->num; clkid++) {
|
|
|
|
+ /* array might be sparse */
|
|
|
|
+ if (!clkc_data->hw_onecell_data->hws[clkid])
|
|
|
|
+ continue;
|
|
|
|
+
|
|
ret = devm_clk_hw_register(dev,
|
|
ret = devm_clk_hw_register(dev,
|
|
clkc_data->hw_onecell_data->hws[clkid]);
|
|
clkc_data->hw_onecell_data->hws[clkid]);
|
|
if (ret)
|
|
if (ret)
|