Skip to content

Instantly share code, notes, and snippets.

@openedev
Created October 16, 2018 18:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save openedev/84b07590c9f111886a46310e9fde9310 to your computer and use it in GitHub Desktop.
Save openedev/84b07590c9f111886a46310e9fde9310 to your computer and use it in GitHub Desktop.
diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c
index 1b4192ed6ab5..b3e794a4aadf 100644
--- a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c
+++ b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c
@@ -167,7 +167,7 @@ static struct ccu_nkm pll_mipi_clk = {
.n = _SUNXI_CCU_MULT(8, 4),
.k = _SUNXI_CCU_MULT_MIN(4, 2, 2),
.m = _SUNXI_CCU_DIV(0, 4),
- .min_rate = 500000000,
+ .min_rate = 300000000,
.max_rate = 1400000000UL,
.common = {
.reg = 0x040,
@@ -519,14 +519,14 @@ static const char * const de_parents[] = { "pll-periph0-2x", "pll-de" };
static SUNXI_CCU_M_WITH_MUX_GATE(de_clk, "de", de_parents,
0x104, 0, 4, 24, 3, BIT(31), 0);
-static const char * const tcon0_parents[] = { "pll-mipi", "pll-video0-2x" };
-static const u8 tcon0_table[] = { 0, 2, };
+static const char * const tcon0_parents[] = { "pll-mipi" };
+static const u8 tcon0_table[] = { 0, };
static SUNXI_CCU_MUX_TABLE_WITH_GATE(tcon0_clk, "tcon0", tcon0_parents,
tcon0_table, 0x118, 24, 3, BIT(31),
CLK_SET_RATE_PARENT);
-static const char * const tcon1_parents[] = { "pll-video0", "pll-video1" };
-static const u8 tcon1_table[] = { 0, 2, };
+static const char * const tcon1_parents[] = { "pll-video1" };
+static const u8 tcon1_table[] = { 2, };
static struct ccu_div tcon1_clk = {
.enable = BIT(31),
.div = _SUNXI_CCU_DIV(0, 4),
@@ -579,8 +579,8 @@ static const char * const mbus_parents[] = { "osc24M", "pll-periph0-2x",
static SUNXI_CCU_M_WITH_MUX_GATE(mbus_clk, "mbus", mbus_parents,
0x15c, 0, 3, 24, 2, BIT(31), CLK_IS_CRITICAL);
-static const char * const dsi_dphy_parents[] = { "pll-video0", "pll-periph0" };
-static const u8 dsi_dphy_table[] = { 0, 2, };
+static const char * const dsi_dphy_parents[] = { "pll-video0" };
+static const u8 dsi_dphy_table[] = { 0, };
static SUNXI_CCU_M_WITH_MUX_TABLE_GATE(dsi_dphy_clk, "dsi-dphy",
dsi_dphy_parents, dsi_dphy_table,
0x168, 0, 4, 8, 2, BIT(15), CLK_SET_RATE_PARENT);
diff --git a/drivers/clk/sunxi-ng/ccu_nkm.c b/drivers/clk/sunxi-ng/ccu_nkm.c
index 574fd2cd2a79..b6e2f1c5bd9e 100644
--- a/drivers/clk/sunxi-ng/ccu_nkm.c
+++ b/drivers/clk/sunxi-ng/ccu_nkm.c
@@ -124,7 +124,7 @@ static unsigned long ccu_nkm_round_rate(struct ccu_mux_internal *mux,
-static const char * const dsi_dphy_parents[] = { "pll-video0", "pll-periph0" };
-static const u8 dsi_dphy_table[] = { 0, 2, };
+static const char * const dsi_dphy_parents[] = { "pll-video0" };
+static const u8 dsi_dphy_table[] = { 0, };
static SUNXI_CCU_M_WITH_MUX_TABLE_GATE(dsi_dphy_clk, "dsi-dphy",
dsi_dphy_parents, dsi_dphy_table,
0x168, 0, 4, 8, 2, BIT(15), CLK_SET_RATE_PARENT);
diff --git a/drivers/clk/sunxi-ng/ccu_nkm.c b/drivers/clk/sunxi-ng/ccu_nkm.c
index 841840e35e61..d17539dc88dd 100644
--- a/drivers/clk/sunxi-ng/ccu_nkm.c
+++ b/drivers/clk/sunxi-ng/ccu_nkm.c
@@ -125,6 +125,13 @@ static unsigned long ccu_nkm_round_rate(struct ccu_mux_internal *mux,
if (nkm->common.features & CCU_FEATURE_FIXED_POSTDIV)
rate *= nkm->fixed_post_div;
+ if (rate < nkm->min_rate) {
+ rate = nkm->min_rate;
+ if (nkm->common.features & CCU_FEATURE_FIXED_POSTDIV)
+ rate /= nkm->fixed_post_div;
+ return rate;
+ }
+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment