linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] fixes for at91 clocks
@ 2020-08-25  6:59 Claudiu Beznea
  2020-08-25  6:59 ` [PATCH v2 1/3] clk: at91: remove the checking of parent_name Claudiu Beznea
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Claudiu Beznea @ 2020-08-25  6:59 UTC (permalink / raw)
  To: mturquette, sboyd, nicolas.ferre, alexandre.belloni, ludovic.desroches
  Cc: bbrezillon, linux-clk, linux-arm-kernel, linux-kernel, Claudiu Beznea

Hi,

In this series I collected 2 patches send previously and add another that
fixes a compilation warning.

Changes in v2:
- add patches "clk: at91: remove the checking of parent_name" and
  "clk: at91: clk-main: update key before writing AT91_CKGR_MOR" in the same
  series and collect Reviewed-by tags
- in patch "clk: at91: remove the checking of parent_name" kept only
  the changes in at91_clk_register_peripheral() function as the changes in
  at91_clk_register_sam9x5_peripheral() introduced in v1 were included in
  commit b4c115c76184 ("clk: at91: clk-peripheral: add support for changeable parent rate");
  also adapt commit message for this patch;
- add "clk: at91: clk-sam9x60-pll: remove unused variable" in this series

Claudiu Beznea (3):
  clk: at91: remove the checking of parent_name
  clk: at91: clk-main: update key before writing AT91_CKGR_MOR
  clk: at91: clk-sam9x60-pll: remove unused variable

 drivers/clk/at91/clk-main.c        | 11 ++++++++---
 drivers/clk/at91/clk-peripheral.c  |  4 ++--
 drivers/clk/at91/clk-sam9x60-pll.c |  3 +--
 3 files changed, 11 insertions(+), 7 deletions(-)

-- 
2.7.4


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

* [PATCH v2 1/3] clk: at91: remove the checking of parent_name
  2020-08-25  6:59 [PATCH v2 0/3] fixes for at91 clocks Claudiu Beznea
@ 2020-08-25  6:59 ` Claudiu Beznea
  2020-10-14  2:59   ` Stephen Boyd
  2020-08-25  6:59 ` [PATCH v2 2/3] clk: at91: clk-main: update key before writing AT91_CKGR_MOR Claudiu Beznea
  2020-08-25  6:59 ` [PATCH v2 3/3] clk: at91: clk-sam9x60-pll: remove unused variable Claudiu Beznea
  2 siblings, 1 reply; 7+ messages in thread
From: Claudiu Beznea @ 2020-08-25  6:59 UTC (permalink / raw)
  To: mturquette, sboyd, nicolas.ferre, alexandre.belloni, ludovic.desroches
  Cc: bbrezillon, linux-clk, linux-arm-kernel, linux-kernel, Claudiu Beznea

There is no need to check parent_name variable while assigning it to
init.parent_names. parent_name variable is already checked at
the beginning of at91_clk_register_peripheral() function.

Fixes: 6114067e437eb ("clk: at91: add PMC peripheral clocks")
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
 drivers/clk/at91/clk-peripheral.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/at91/clk-peripheral.c b/drivers/clk/at91/clk-peripheral.c
index 7867eaf0447f..7a27ba8e0577 100644
--- a/drivers/clk/at91/clk-peripheral.c
+++ b/drivers/clk/at91/clk-peripheral.c
@@ -112,8 +112,8 @@ at91_clk_register_peripheral(struct regmap *regmap, const char *name,
 
 	init.name = name;
 	init.ops = &peripheral_ops;
-	init.parent_names = (parent_name ? &parent_name : NULL);
-	init.num_parents = (parent_name ? 1 : 0);
+	init.parent_names = &parent_name;
+	init.num_parents = 1;
 	init.flags = 0;
 
 	periph->id = id;
-- 
2.7.4


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

* [PATCH v2 2/3] clk: at91: clk-main: update key before writing AT91_CKGR_MOR
  2020-08-25  6:59 [PATCH v2 0/3] fixes for at91 clocks Claudiu Beznea
  2020-08-25  6:59 ` [PATCH v2 1/3] clk: at91: remove the checking of parent_name Claudiu Beznea
@ 2020-08-25  6:59 ` Claudiu Beznea
  2020-10-14  2:59   ` Stephen Boyd
  2020-08-25  6:59 ` [PATCH v2 3/3] clk: at91: clk-sam9x60-pll: remove unused variable Claudiu Beznea
  2 siblings, 1 reply; 7+ messages in thread
From: Claudiu Beznea @ 2020-08-25  6:59 UTC (permalink / raw)
  To: mturquette, sboyd, nicolas.ferre, alexandre.belloni, ludovic.desroches
  Cc: bbrezillon, linux-clk, linux-arm-kernel, linux-kernel, Claudiu Beznea

SAMA5D2 datasheet specifies on chapter 33.22.8 (PMC Clock Generator
Main Oscillator Register) that writing any value other than
0x37 on KEY field aborts the write operation. Use the key when
selecting main clock parent.

Fixes: 27cb1c2083373 ("clk: at91: rework main clk implementation")
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
 drivers/clk/at91/clk-main.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/at91/clk-main.c b/drivers/clk/at91/clk-main.c
index 5c83e899084f..cfae2f59df66 100644
--- a/drivers/clk/at91/clk-main.c
+++ b/drivers/clk/at91/clk-main.c
@@ -437,12 +437,17 @@ static int clk_sam9x5_main_set_parent(struct clk_hw *hw, u8 index)
 		return -EINVAL;
 
 	regmap_read(regmap, AT91_CKGR_MOR, &tmp);
-	tmp &= ~MOR_KEY_MASK;
 
 	if (index && !(tmp & AT91_PMC_MOSCSEL))
-		regmap_write(regmap, AT91_CKGR_MOR, tmp | AT91_PMC_MOSCSEL);
+		tmp = AT91_PMC_MOSCSEL;
 	else if (!index && (tmp & AT91_PMC_MOSCSEL))
-		regmap_write(regmap, AT91_CKGR_MOR, tmp & ~AT91_PMC_MOSCSEL);
+		tmp = 0;
+	else
+		return 0;
+
+	regmap_update_bits(regmap, AT91_CKGR_MOR,
+			   AT91_PMC_MOSCSEL | MOR_KEY_MASK,
+			   tmp | AT91_PMC_KEY);
 
 	while (!clk_sam9x5_main_ready(regmap))
 		cpu_relax();
-- 
2.7.4


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

* [PATCH v2 3/3] clk: at91: clk-sam9x60-pll: remove unused variable
  2020-08-25  6:59 [PATCH v2 0/3] fixes for at91 clocks Claudiu Beznea
  2020-08-25  6:59 ` [PATCH v2 1/3] clk: at91: remove the checking of parent_name Claudiu Beznea
  2020-08-25  6:59 ` [PATCH v2 2/3] clk: at91: clk-main: update key before writing AT91_CKGR_MOR Claudiu Beznea
@ 2020-08-25  6:59 ` Claudiu Beznea
  2020-10-14  2:59   ` Stephen Boyd
  2 siblings, 1 reply; 7+ messages in thread
From: Claudiu Beznea @ 2020-08-25  6:59 UTC (permalink / raw)
  To: mturquette, sboyd, nicolas.ferre, alexandre.belloni, ludovic.desroches
  Cc: bbrezillon, linux-clk, linux-arm-kernel, linux-kernel, Claudiu Beznea

Fix variable set but not used compilation warning.

Fixes: 43b1bb4a9b3e ("clk: at91: clk-sam9x60-pll: re-factor to support plls with multiple outputs")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 drivers/clk/at91/clk-sam9x60-pll.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/clk/at91/clk-sam9x60-pll.c b/drivers/clk/at91/clk-sam9x60-pll.c
index b473298ef7e6..78f458a7b2ef 100644
--- a/drivers/clk/at91/clk-sam9x60-pll.c
+++ b/drivers/clk/at91/clk-sam9x60-pll.c
@@ -331,7 +331,7 @@ static long sam9x60_div_pll_compute_div(struct sam9x60_pll_core *core,
 	struct clk_hw *parent = clk_hw_get_parent(&core->hw);
 	unsigned long tmp_rate, tmp_parent_rate, tmp_diff;
 	long best_diff = -1, best_rate = -EINVAL;
-	u32 divid, best_div;
+	u32 divid;
 
 	if (!rate)
 		return 0;
@@ -352,7 +352,6 @@ static long sam9x60_div_pll_compute_div(struct sam9x60_pll_core *core,
 			*parent_rate = tmp_parent_rate;
 			best_rate = tmp_rate;
 			best_diff = tmp_diff;
-			best_div = divid;
 		}
 
 		if (!best_diff)
-- 
2.7.4


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

* Re: [PATCH v2 1/3] clk: at91: remove the checking of parent_name
  2020-08-25  6:59 ` [PATCH v2 1/3] clk: at91: remove the checking of parent_name Claudiu Beznea
@ 2020-10-14  2:59   ` Stephen Boyd
  0 siblings, 0 replies; 7+ messages in thread
From: Stephen Boyd @ 2020-10-14  2:59 UTC (permalink / raw)
  To: Claudiu Beznea, alexandre.belloni, ludovic.desroches, mturquette,
	nicolas.ferre
  Cc: bbrezillon, linux-clk, linux-arm-kernel, linux-kernel, Claudiu Beznea

Quoting Claudiu Beznea (2020-08-24 23:59:09)
> There is no need to check parent_name variable while assigning it to
> init.parent_names. parent_name variable is already checked at
> the beginning of at91_clk_register_peripheral() function.
> 
> Fixes: 6114067e437eb ("clk: at91: add PMC peripheral clocks")
> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
> Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> ---

Applied to clk-next

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

* Re: [PATCH v2 2/3] clk: at91: clk-main: update key before writing AT91_CKGR_MOR
  2020-08-25  6:59 ` [PATCH v2 2/3] clk: at91: clk-main: update key before writing AT91_CKGR_MOR Claudiu Beznea
@ 2020-10-14  2:59   ` Stephen Boyd
  0 siblings, 0 replies; 7+ messages in thread
From: Stephen Boyd @ 2020-10-14  2:59 UTC (permalink / raw)
  To: Claudiu Beznea, alexandre.belloni, ludovic.desroches, mturquette,
	nicolas.ferre
  Cc: bbrezillon, linux-clk, linux-arm-kernel, linux-kernel, Claudiu Beznea

Quoting Claudiu Beznea (2020-08-24 23:59:10)
> SAMA5D2 datasheet specifies on chapter 33.22.8 (PMC Clock Generator
> Main Oscillator Register) that writing any value other than
> 0x37 on KEY field aborts the write operation. Use the key when
> selecting main clock parent.
> 
> Fixes: 27cb1c2083373 ("clk: at91: rework main clk implementation")
> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
> Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> ---

Applied to clk-next

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

* Re: [PATCH v2 3/3] clk: at91: clk-sam9x60-pll: remove unused variable
  2020-08-25  6:59 ` [PATCH v2 3/3] clk: at91: clk-sam9x60-pll: remove unused variable Claudiu Beznea
@ 2020-10-14  2:59   ` Stephen Boyd
  0 siblings, 0 replies; 7+ messages in thread
From: Stephen Boyd @ 2020-10-14  2:59 UTC (permalink / raw)
  To: Claudiu Beznea, alexandre.belloni, ludovic.desroches, mturquette,
	nicolas.ferre
  Cc: bbrezillon, linux-clk, linux-arm-kernel, linux-kernel, Claudiu Beznea

Quoting Claudiu Beznea (2020-08-24 23:59:11)
> Fix variable set but not used compilation warning.
> 
> Fixes: 43b1bb4a9b3e ("clk: at91: clk-sam9x60-pll: re-factor to support plls with multiple outputs")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
> ---

Applied to clk-next

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

end of thread, other threads:[~2020-10-14  2:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-25  6:59 [PATCH v2 0/3] fixes for at91 clocks Claudiu Beznea
2020-08-25  6:59 ` [PATCH v2 1/3] clk: at91: remove the checking of parent_name Claudiu Beznea
2020-10-14  2:59   ` Stephen Boyd
2020-08-25  6:59 ` [PATCH v2 2/3] clk: at91: clk-main: update key before writing AT91_CKGR_MOR Claudiu Beznea
2020-10-14  2:59   ` Stephen Boyd
2020-08-25  6:59 ` [PATCH v2 3/3] clk: at91: clk-sam9x60-pll: remove unused variable Claudiu Beznea
2020-10-14  2:59   ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).