mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] clk: sprd: fix to get a correct ibias of pll
@ 2020-03-30  2:16 Chunyan Zhang
  2020-04-03  1:08 ` Stephen Boyd
  2020-04-08  2:00 ` [PATCH] clk: sprd: don't gate uart console clock Chunyan Zhang
  0 siblings, 2 replies; 10+ messages in thread
From: Chunyan Zhang @ 2020-03-30  2:16 UTC (permalink / raw)
  To: Stephen Boyd, Michael Turquette
  Cc: linux-clk, linux-kernel, Orson Zhai, Baolin Wang, Chunyan Zhang,
	Chunyan Zhang

From: Chunyan Zhang <chunyan.zhang@unisoc.com>

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")
Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com>
---
 drivers/clk/sprd/pll.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/sprd/pll.c b/drivers/clk/sprd/pll.c
index 640270f51aa5..15791484388f 100644
--- a/drivers/clk/sprd/pll.c
+++ b/drivers/clk/sprd/pll.c
@@ -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,
-- 
2.20.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] clk: sprd: fix to get a correct ibias of pll
  2020-03-30  2:16 [PATCH] clk: sprd: fix to get a correct ibias of pll Chunyan Zhang
@ 2020-04-03  1:08 ` Stephen Boyd
  2020-04-08  2:00 ` [PATCH] clk: sprd: don't gate uart console clock Chunyan Zhang
  1 sibling, 0 replies; 10+ messages in thread
From: Stephen Boyd @ 2020-04-03  1:08 UTC (permalink / raw)
  To: Chunyan Zhang, Michael Turquette
  Cc: linux-clk, linux-kernel, Orson Zhai, Baolin Wang, Chunyan Zhang,
	Chunyan Zhang

Quoting Chunyan Zhang (2020-03-29 19:16:40)
> From: Chunyan Zhang <chunyan.zhang@unisoc.com>
> 
> 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")
> Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] clk: sprd: don't gate uart console clock
  2020-03-30  2:16 [PATCH] clk: sprd: fix to get a correct ibias of pll Chunyan Zhang
  2020-04-03  1:08 ` Stephen Boyd
@ 2020-04-08  2:00 ` Chunyan Zhang
  1 sibling, 0 replies; 10+ messages in thread
From: Chunyan Zhang @ 2020-04-08  2:00 UTC (permalink / raw)
  To: Stephen Boyd, Michael Turquette
  Cc: linux-clk, linux-kernel, Orson Zhai, Baolin Wang, Chunyan Zhang,
	Chunyan Zhang

From: Chunyan Zhang <chunyan.zhang@unisoc.com>

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")
Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com>
---
 drivers/clk/sprd/sc9863a-clk.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/sprd/sc9863a-clk.c b/drivers/clk/sprd/sc9863a-clk.c
index 24f064262814..6c6ac158ef61 100644
--- a/drivers/clk/sprd/sc9863a-clk.c
+++ b/drivers/clk/sprd/sc9863a-clk.c
@@ -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,
-- 
2.20.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] clk: sprd: don't gate uart console clock
  2020-04-08  2:02 ` Chunyan Zhang
@ 2020-04-11  2:21   ` Stephen Boyd
  0 siblings, 0 replies; 10+ messages in thread
From: Stephen Boyd @ 2020-04-11  2:21 UTC (permalink / raw)
  To: Chunyan Zhang, Michael Turquette
  Cc: linux-clk, linux-kernel, Orson Zhai, Baolin Wang, Chunyan Zhang,
	Chunyan Zhang

Quoting Chunyan Zhang (2020-04-07 19:02:34)
> From: Chunyan Zhang <chunyan.zhang@unisoc.com>
> 
> 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")
> Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com>
> ---

Applied to clk-fixes

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] clk: sprd: don't gate uart console clock
  2020-03-31 10:45 Chunyan Zhang
  2020-04-03  1:56 ` Chunyan Zhang
  2020-04-05  3:08 ` Stephen Boyd
@ 2020-04-08  2:02 ` Chunyan Zhang
  2020-04-11  2:21   ` Stephen Boyd
  2 siblings, 1 reply; 10+ messages in thread
From: Chunyan Zhang @ 2020-04-08  2:02 UTC (permalink / raw)
  To: Stephen Boyd, Michael Turquette
  Cc: linux-clk, linux-kernel, Orson Zhai, Baolin Wang, Chunyan Zhang,
	Chunyan Zhang

From: Chunyan Zhang <chunyan.zhang@unisoc.com>

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")
Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com>
---
 drivers/clk/sprd/sc9863a-clk.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/sprd/sc9863a-clk.c b/drivers/clk/sprd/sc9863a-clk.c
index 24f064262814..6c6ac158ef61 100644
--- a/drivers/clk/sprd/sc9863a-clk.c
+++ b/drivers/clk/sprd/sc9863a-clk.c
@@ -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,
-- 
2.20.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] clk: sprd: don't gate uart console clock
  2020-04-07  2:02   ` Chunyan Zhang
@ 2020-04-07 20:34     ` Stephen Boyd
  0 siblings, 0 replies; 10+ messages in thread
From: Stephen Boyd @ 2020-04-07 20:34 UTC (permalink / raw)
  To: Chunyan Zhang
  Cc: Michael Turquette, linux-clk, Linux Kernel Mailing List,
	Orson Zhai, Baolin Wang, Chunyan Zhang

Quoting Chunyan Zhang (2020-04-06 19:02:38)
> On Sun, 5 Apr 2020 at 11:08, Stephen Boyd <sboyd@kernel.org> wrote:
> >
> > Quoting Chunyan Zhang (2020-03-31 03:45:32)
> > > 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.
> > >
> > > Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com>
> > > ---
> >
> > Do you have a Fixes: tag?
> 
> I didn't leave a Fixed tag since that commit [1] will be merged into v5.7-rc1
> 
> [1] https://www.spinics.net/lists/linux-clk/msg46430.html

Please still provide a Fixes tag. It helps track what commit is fixed
regardless.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] clk: sprd: don't gate uart console clock
  2020-04-05  3:08 ` Stephen Boyd
@ 2020-04-07  2:02   ` Chunyan Zhang
  2020-04-07 20:34     ` Stephen Boyd
  0 siblings, 1 reply; 10+ messages in thread
From: Chunyan Zhang @ 2020-04-07  2:02 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Michael Turquette, linux-clk, Linux Kernel Mailing List,
	Orson Zhai, Baolin Wang, Chunyan Zhang

On Sun, 5 Apr 2020 at 11:08, Stephen Boyd <sboyd@kernel.org> wrote:
>
> Quoting Chunyan Zhang (2020-03-31 03:45:32)
> > 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.
> >
> > Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com>
> > ---
>
> Do you have a Fixes: tag?

I didn't leave a Fixed tag since that commit [1] will be merged into v5.7-rc1

[1] https://www.spinics.net/lists/linux-clk/msg46430.html

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] clk: sprd: don't gate uart console clock
  2020-03-31 10:45 Chunyan Zhang
  2020-04-03  1:56 ` Chunyan Zhang
@ 2020-04-05  3:08 ` Stephen Boyd
  2020-04-07  2:02   ` Chunyan Zhang
  2020-04-08  2:02 ` Chunyan Zhang
  2 siblings, 1 reply; 10+ messages in thread
From: Stephen Boyd @ 2020-04-05  3:08 UTC (permalink / raw)
  To: Chunyan Zhang, Michael Turquette
  Cc: linux-clk, linux-kernel, Orson Zhai, Baolin Wang, Chunyan Zhang,
	Chunyan Zhang

Quoting Chunyan Zhang (2020-03-31 03:45:32)
> 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.
> 
> Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com>
> ---

Do you have a Fixes: tag?

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] clk: sprd: don't gate uart console clock
  2020-03-31 10:45 Chunyan Zhang
@ 2020-04-03  1:56 ` Chunyan Zhang
  2020-04-05  3:08 ` Stephen Boyd
  2020-04-08  2:02 ` Chunyan Zhang
  2 siblings, 0 replies; 10+ messages in thread
From: Chunyan Zhang @ 2020-04-03  1:56 UTC (permalink / raw)
  To: Stephen Boyd, Michael Turquette
  Cc: linux-clk, Linux Kernel Mailing List, Orson Zhai, Baolin Wang,
	Chunyan Zhang

Hi Stephen,

This is also a fix, could you please take it into clk-next as well?

Thanks,
Chunyan

On Tue, 31 Mar 2020 at 18:45, Chunyan Zhang <zhang.lyra@gmail.com> wrote:
>
> 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.
>
> Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com>
> ---
>  drivers/clk/sprd/sc9863a-clk.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clk/sprd/sc9863a-clk.c b/drivers/clk/sprd/sc9863a-clk.c
> index 24f064262814..6c6ac158ef61 100644
> --- a/drivers/clk/sprd/sc9863a-clk.c
> +++ b/drivers/clk/sprd/sc9863a-clk.c
> @@ -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,
> --
> 2.20.1
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] clk: sprd: don't gate uart console clock
@ 2020-03-31 10:45 Chunyan Zhang
  2020-04-03  1:56 ` Chunyan Zhang
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Chunyan Zhang @ 2020-03-31 10:45 UTC (permalink / raw)
  To: Stephen Boyd, Michael Turquette
  Cc: linux-clk, linux-kernel, Orson Zhai, Baolin Wang, Chunyan Zhang,
	Chunyan Zhang

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.

Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com>
---
 drivers/clk/sprd/sc9863a-clk.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/sprd/sc9863a-clk.c b/drivers/clk/sprd/sc9863a-clk.c
index 24f064262814..6c6ac158ef61 100644
--- a/drivers/clk/sprd/sc9863a-clk.c
+++ b/drivers/clk/sprd/sc9863a-clk.c
@@ -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,
-- 
2.20.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-04-11  2:21 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-30  2:16 [PATCH] clk: sprd: fix to get a correct ibias of pll Chunyan Zhang
2020-04-03  1:08 ` Stephen Boyd
2020-04-08  2:00 ` [PATCH] clk: sprd: don't gate uart console clock Chunyan Zhang
2020-03-31 10:45 Chunyan Zhang
2020-04-03  1:56 ` Chunyan Zhang
2020-04-05  3:08 ` Stephen Boyd
2020-04-07  2:02   ` Chunyan Zhang
2020-04-07 20:34     ` Stephen Boyd
2020-04-08  2:02 ` Chunyan Zhang
2020-04-11  2:21   ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®