aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEddie James <eajames@linux.ibm.com>2019-04-02 14:25:03 -0400
committerStephen Boyd <sboyd@kernel.org>2019-04-18 17:56:19 -0400
commitdefb149ba42f571017fb4bc265eecf3648ab7d6e (patch)
tree7abcfb273a0583dd6f64c89fd7d35b0baf53ac5a
parent9e98c678c2d6ae3a17cb2de55d17f69dddaa231b (diff)
clk: Aspeed: Setup video engine clocking
Add eclk mux and clock divider table. Also change the video engine reset to the correct clock; it was previously on the video capture but needs to be on the video engine clock. Signed-off-by: Eddie James <eajames@linux.ibm.com> Reviewed-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
-rw-r--r--drivers/clk/clk-aspeed.c42
1 files changed, 39 insertions, 3 deletions
diff --git a/drivers/clk/clk-aspeed.c b/drivers/clk/clk-aspeed.c
index 596136793fc4..42b4df6ba249 100644
--- a/drivers/clk/clk-aspeed.c
+++ b/drivers/clk/clk-aspeed.c
@@ -87,10 +87,10 @@ struct aspeed_clk_gate {
87/* TODO: ask Aspeed about the actual parent data */ 87/* TODO: ask Aspeed about the actual parent data */
88static const struct aspeed_gate_data aspeed_gates[] = { 88static const struct aspeed_gate_data aspeed_gates[] = {
89 /* clk rst name parent flags */ 89 /* clk rst name parent flags */
90 [ASPEED_CLK_GATE_ECLK] = { 0, -1, "eclk-gate", "eclk", 0 }, /* Video Engine */ 90 [ASPEED_CLK_GATE_ECLK] = { 0, 6, "eclk-gate", "eclk", 0 }, /* Video Engine */
91 [ASPEED_CLK_GATE_GCLK] = { 1, 7, "gclk-gate", NULL, 0 }, /* 2D engine */ 91 [ASPEED_CLK_GATE_GCLK] = { 1, 7, "gclk-gate", NULL, 0 }, /* 2D engine */
92 [ASPEED_CLK_GATE_MCLK] = { 2, -1, "mclk-gate", "mpll", CLK_IS_CRITICAL }, /* SDRAM */ 92 [ASPEED_CLK_GATE_MCLK] = { 2, -1, "mclk-gate", "mpll", CLK_IS_CRITICAL }, /* SDRAM */
93 [ASPEED_CLK_GATE_VCLK] = { 3, 6, "vclk-gate", NULL, 0 }, /* Video Capture */ 93 [ASPEED_CLK_GATE_VCLK] = { 3, -1, "vclk-gate", NULL, 0 }, /* Video Capture */
94 [ASPEED_CLK_GATE_BCLK] = { 4, 8, "bclk-gate", "bclk", CLK_IS_CRITICAL }, /* PCIe/PCI */ 94 [ASPEED_CLK_GATE_BCLK] = { 4, 8, "bclk-gate", "bclk", CLK_IS_CRITICAL }, /* PCIe/PCI */
95 [ASPEED_CLK_GATE_DCLK] = { 5, -1, "dclk-gate", NULL, CLK_IS_CRITICAL }, /* DAC */ 95 [ASPEED_CLK_GATE_DCLK] = { 5, -1, "dclk-gate", NULL, CLK_IS_CRITICAL }, /* DAC */
96 [ASPEED_CLK_GATE_REFCLK] = { 6, -1, "refclk-gate", "clkin", CLK_IS_CRITICAL }, 96 [ASPEED_CLK_GATE_REFCLK] = { 6, -1, "refclk-gate", "clkin", CLK_IS_CRITICAL },
@@ -113,6 +113,24 @@ static const struct aspeed_gate_data aspeed_gates[] = {
113 [ASPEED_CLK_GATE_LHCCLK] = { 28, -1, "lhclk-gate", "lhclk", 0 }, /* LPC master/LPC+ */ 113 [ASPEED_CLK_GATE_LHCCLK] = { 28, -1, "lhclk-gate", "lhclk", 0 }, /* LPC master/LPC+ */
114}; 114};
115 115
116static const char * const eclk_parent_names[] = {
117 "mpll",
118 "hpll",
119 "dpll",
120};
121
122static const struct clk_div_table ast2500_eclk_div_table[] = {
123 { 0x0, 2 },
124 { 0x1, 2 },
125 { 0x2, 3 },
126 { 0x3, 4 },
127 { 0x4, 5 },
128 { 0x5, 6 },
129 { 0x6, 7 },
130 { 0x7, 8 },
131 { 0 }
132};
133
116static const struct clk_div_table ast2500_mac_div_table[] = { 134static const struct clk_div_table ast2500_mac_div_table[] = {
117 { 0x0, 4 }, /* Yep, really. Aspeed confirmed this is correct */ 135 { 0x0, 4 }, /* Yep, really. Aspeed confirmed this is correct */
118 { 0x1, 4 }, 136 { 0x1, 4 },
@@ -192,18 +210,21 @@ static struct clk_hw *aspeed_ast2500_calc_pll(const char *name, u32 val)
192 210
193struct aspeed_clk_soc_data { 211struct aspeed_clk_soc_data {
194 const struct clk_div_table *div_table; 212 const struct clk_div_table *div_table;
213 const struct clk_div_table *eclk_div_table;
195 const struct clk_div_table *mac_div_table; 214 const struct clk_div_table *mac_div_table;
196 struct clk_hw *(*calc_pll)(const char *name, u32 val); 215 struct clk_hw *(*calc_pll)(const char *name, u32 val);
197}; 216};
198 217
199static const struct aspeed_clk_soc_data ast2500_data = { 218static const struct aspeed_clk_soc_data ast2500_data = {
200 .div_table = ast2500_div_table, 219 .div_table = ast2500_div_table,
220 .eclk_div_table = ast2500_eclk_div_table,
201 .mac_div_table = ast2500_mac_div_table, 221 .mac_div_table = ast2500_mac_div_table,
202 .calc_pll = aspeed_ast2500_calc_pll, 222 .calc_pll = aspeed_ast2500_calc_pll,
203}; 223};
204 224
205static const struct aspeed_clk_soc_data ast2400_data = { 225static const struct aspeed_clk_soc_data ast2400_data = {
206 .div_table = ast2400_div_table, 226 .div_table = ast2400_div_table,
227 .eclk_div_table = ast2400_div_table,
207 .mac_div_table = ast2400_div_table, 228 .mac_div_table = ast2400_div_table,
208 .calc_pll = aspeed_ast2400_calc_pll, 229 .calc_pll = aspeed_ast2400_calc_pll,
209}; 230};
@@ -522,6 +543,22 @@ static int aspeed_clk_probe(struct platform_device *pdev)
522 return PTR_ERR(hw); 543 return PTR_ERR(hw);
523 aspeed_clk_data->hws[ASPEED_CLK_24M] = hw; 544 aspeed_clk_data->hws[ASPEED_CLK_24M] = hw;
524 545
546 hw = clk_hw_register_mux(dev, "eclk-mux", eclk_parent_names,
547 ARRAY_SIZE(eclk_parent_names), 0,
548 scu_base + ASPEED_CLK_SELECTION, 2, 0x3, 0,
549 &aspeed_clk_lock);
550 if (IS_ERR(hw))
551 return PTR_ERR(hw);
552 aspeed_clk_data->hws[ASPEED_CLK_ECLK_MUX] = hw;
553
554 hw = clk_hw_register_divider_table(dev, "eclk", "eclk-mux", 0,
555 scu_base + ASPEED_CLK_SELECTION, 28,
556 3, 0, soc_data->eclk_div_table,
557 &aspeed_clk_lock);
558 if (IS_ERR(hw))
559 return PTR_ERR(hw);
560 aspeed_clk_data->hws[ASPEED_CLK_ECLK] = hw;
561
525 /* 562 /*
526 * TODO: There are a number of clocks that not included in this driver 563 * TODO: There are a number of clocks that not included in this driver
527 * as more information is required: 564 * as more information is required:
@@ -531,7 +568,6 @@ static int aspeed_clk_probe(struct platform_device *pdev)
531 * RGMII 568 * RGMII
532 * RMII 569 * RMII
533 * UART[1..5] clock source mux 570 * UART[1..5] clock source mux
534 * Video Engine (ECLK) mux and clock divider
535 */ 571 */
536 572
537 for (i = 0; i < ARRAY_SIZE(aspeed_gates); i++) { 573 for (i = 0; i < ARRAY_SIZE(aspeed_gates); i++) {