Skip to contentSkip to conversation

clk: sprd: fix to get a correct ibias of pll

PATCH Applied Chunyan Zhang 2 participants 3 messages Mar 30, 2020 – Apr 8, 2020

Subsystems (2)
lore
Share & tools
lore

Chunyan Zhang

author reviewer
#0 lore raw

PATCH 1/1 clk: sprd: fix to get a correct ibias of pll

From: Chunyan Zhang <[email protected]>

The current driver is getting a wrong ibias index of pll clocks from number 1. This patch fix that issue, then getting ibias index from 0.

Fixes 3e37b005580b ("clk: sprd: add adjustable pll support")
---
 drivers/clk/sprd/pll.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/clk/sprd/pll.c +4 -3
index 640270f51aa5..15791484388f 100644
@@ -87,11 +87,12 @@ static u32 pll_get_ibias(u64 rate, const u64 *table)
 {
 	u32 i, num = table[0];
 
-	for (i = 1; i < num + 1; i++)
-		if (rate <= table[i])
+	/* table[0] indicates the number of items in this table */
+	for (i = 0; i < num; i++)
+		if (rate <= table[i + 1])
 			break;
 
-	return (i == num + 1) ? num : i;
+	return i == num ? num - 1 : i;
 }
 
 static unsigned long _sprd_pll_recalc_rate(const struct sprd_pll *pll,
Signature · 1 line
2.20.1
maintainer Applied
#1 lore raw

Quoting Chunyan Zhang (2020-03-29 19:16:40)

Quoted 8 lines

From: Chunyan Zhang <[email protected]>

The current driver is getting a wrong ibias index of pll clocks from number 1. This patch fix that issue, then getting ibias index from 0.

Fixes 3e37b005580b ("clk: sprd: add adjustable pll support")

---

Applied to clk-next

author reviewer
#2 lore raw

PATCH 1/1 clk: sprd: don't gate uart console clock

In reply to Chunyan Zhang

From: Chunyan Zhang <[email protected]>

Don't gate uart1_eb which provides console clock, gating that clock would make serial stop working if serial driver didn't enable that explicitly.

Fixes 0e4b8a2349f3 ("clk: sprd: add clocks support for SC9863A")
---
 drivers/clk/sprd/sc9863a-clk.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/clk/sprd/sc9863a-clk.c +2 -1
index 24f064262814..6c6ac158ef61 100644
@@ -1671,8 +1671,9 @@ static SPRD_SC_GATE_CLK_FW_NAME(i2c4_eb,	"i2c4-eb",	"ext-26m", 0x0,
 				0x1000, BIT(12), 0, 0);
 static SPRD_SC_GATE_CLK_FW_NAME(uart0_eb,	"uart0-eb",	"ext-26m", 0x0,
 				0x1000, BIT(13), 0, 0);
+/* uart1_eb is for console, don't gate even if unused */
 static SPRD_SC_GATE_CLK_FW_NAME(uart1_eb,	"uart1-eb",	"ext-26m", 0x0,
-				0x1000, BIT(14), 0, 0);
+				0x1000, BIT(14), CLK_IGNORE_UNUSED, 0);
 static SPRD_SC_GATE_CLK_FW_NAME(uart2_eb,	"uart2-eb",	"ext-26m", 0x0,
 				0x1000, BIT(15), 0, 0);
 static SPRD_SC_GATE_CLK_FW_NAME(uart3_eb,	"uart3-eb",	"ext-26m", 0x0,
Signature · 1 line
2.20.1