Skip to contentSkip to conversation

clk: at91: fix at91sam9x5 peripheral clock number

PATCH Applied Alexandre Belloni 3 participants 7 messages Feb 19, 2019 – Feb 20, 2019

Subsystems (2)
lore
Share & tools
lore

Alexandre Belloni

author maintainer
#0 lore raw

PATCH 1/1 clk: at91: fix at91sam9x5 peripheral clock number

nck() looks at the last id in an array and unfortunately, at91sam9x35_periphck has a sentinel, hence the id is 0 and the calculated number of peripheral clocks is 1 instead of a maximum of 31.

Fixes 1eabdc2f9dd8 ("clk: at91: add at91sam9x5 PMCs driver")
---
 drivers/clk/at91/at91sam9x5.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/clk/at91/at91sam9x5.c +1 -2
index 2fe225a697df..d37e7ed9eb90 100644
@@ -144,8 +144,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
 		return;
 
 	at91sam9x5_pmc = pmc_data_allocate(PMC_MAIN + 1,
-					   nck(at91sam9x5_systemck),
-					   nck(at91sam9x35_periphck), 0);
+					   nck(at91sam9x5_systemck), 31, 0);
 	if (!at91sam9x5_pmc)
 		return;
 
Signature · 1 line
2.20.1
#1 lore raw
Quoted 2 lines · Alexandre Belloni

nck() looks at the last id in an array and unfortunately, at91sam9x35_periphck has a sentinel, hence the id is 0 and the calculated

Well, the logic for all other SoC clk files is to not have such a sentinel and deal differently with this type of array: why not modify this file to match with others?

Quoted 13 lines

number of peripheral clocks is 1 instead of a maximum of 31.

Fixes 1eabdc2f9dd8 ("clk: at91: add at91sam9x5 PMCs driver")
---
  drivers/clk/at91/at91sam9x5.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
drivers/clk/at91/at91sam9x5.c +0 -0
index 2fe225a697df..d37e7ed9eb90 100644

drivers/clk/at91/at91sam9x5.c static void __init at91sam9x5_pmc_setup(struct device_node *np, · line 147

Quoted 6 lines
drivers/clk/at91/at91sam9x5.c +1 -2
@@ -144,8 +144,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
  		return;
 
  	at91sam9x5_pmc = pmc_data_allocate(PMC_MAIN + 1,
-					   nck(at91sam9x5_systemck),
-					   nck(at91sam9x35_periphck), 0);
+					   nck(at91sam9x5_systemck), 31, 0);

I would prefer like it's done on other SoC clk files.

Quoted 4 lines
drivers/clk/at91/at91sam9x5.c +0 -0
  	if (!at91sam9x5_pmc)
  		return;
 
Signature · 5 lines
Nicolas Ferre
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author maintainer
#2 lore raw
Quoted 24 lines · Nicolas Ferre
Quoted 2 lines · Alexandre Belloni

nck() looks at the last id in an array and unfortunately, at91sam9x35_periphck has a sentinel, hence the id is 0 and the calculated

Well, the logic for all other SoC clk files is to not have such a sentinel and deal differently with this type of array: why not modify this file to match with others?

Quoted 15 lines

number of peripheral clocks is 1 instead of a maximum of 31.

Fixes 1eabdc2f9dd8 ("clk: at91: add at91sam9x5 PMCs driver")
---
  drivers/clk/at91/at91sam9x5.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
drivers/clk/at91/at91sam9x5.c +0 -0
index 2fe225a697df..d37e7ed9eb90 100644
@@ -144,8 +144,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
  		return;
 
Quoted 7 lines

drivers/clk/at91/at91sam9x5.c static void __init at91sam9x5_pmc_setup(struct device_node *np, · line 147

Quoted 4 lines
drivers/clk/at91/at91sam9x5.c +1 -2
  	at91sam9x5_pmc = pmc_data_allocate(PMC_MAIN + 1,
-					   nck(at91sam9x5_systemck),
-					   nck(at91sam9x35_periphck), 0);
+					   nck(at91sam9x5_systemck), 31, 0);

I would prefer like it's done on other SoC clk files.

Well, that is not possible, what do you suggest?

Quoted 8 lines
Quoted 4 lines
drivers/clk/at91/at91sam9x5.c +0 -0
  	if (!at91sam9x5_pmc)
  		return;
 
Signature · 1 line
Nicolas Ferre
Signature · 3 lines
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#3 lore raw
Quoted 33 lines · Alexandre Belloni
Quoted 24 lines · Nicolas Ferre
Quoted 2 lines · Alexandre Belloni

nck() looks at the last id in an array and unfortunately, at91sam9x35_periphck has a sentinel, hence the id is 0 and the calculated

Well, the logic for all other SoC clk files is to not have such a sentinel and deal differently with this type of array: why not modify this file to match with others?

Quoted 15 lines

number of peripheral clocks is 1 instead of a maximum of 31.

Fixes 1eabdc2f9dd8 ("clk: at91: add at91sam9x5 PMCs driver")
---
   drivers/clk/at91/at91sam9x5.c | 3 +--
   1 file changed, 1 insertion(+), 2 deletions(-)
drivers/clk/at91/at91sam9x5.c +0 -0
index 2fe225a697df..d37e7ed9eb90 100644
@@ -144,8 +144,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
   		return;
 
Quoted 7 lines

drivers/clk/at91/at91sam9x5.c static void __init at91sam9x5_pmc_setup(struct device_node *np, · line 147

Quoted 4 lines
drivers/clk/at91/at91sam9x5.c +1 -2
   	at91sam9x5_pmc = pmc_data_allocate(PMC_MAIN + 1,
-					   nck(at91sam9x5_systemck),
-					   nck(at91sam9x35_periphck), 0);
+					   nck(at91sam9x5_systemck), 31, 0);

I would prefer like it's done on other SoC clk files.

Quoted 1 line

Well, that is not possible, what do you suggest?

Okay: seen: let's keep it like this.

Quoted 10 lines
Quoted 9 lines
Quoted 5 lines
drivers/clk/at91/at91sam9x5.c +0 -0
   	if (!at91sam9x5_pmc)
   		return;
 
Signature · 1 line
Nicolas Ferre
Signature · 1 line
Nicolas Ferre
maintainer Acked-by on v1 1/1
#4 lore raw
In reply to Alexandre Belloni
Quoted 6 lines · Alexandre Belloni

nck() looks at the last id in an array and unfortunately, at91sam9x35_periphck has a sentinel, hence the id is 0 and the calculated number of peripheral clocks is 1 instead of a maximum of 31.

Fixes 1eabdc2f9dd8 ("clk: at91: add at91sam9x5 PMCs driver")

It would be nice to queue it as a fix the soonest, as it impacts 5.0 but not 4.20 due to a switch from one DT binding to another (read: a real regression)... But I know it's a bit late in the cycle...

Regards,
Nicolas

Quoted 19 lines
---
  drivers/clk/at91/at91sam9x5.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
drivers/clk/at91/at91sam9x5.c +1 -2
index 2fe225a697df..d37e7ed9eb90 100644
@@ -144,8 +144,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
  		return;
 
  	at91sam9x5_pmc = pmc_data_allocate(PMC_MAIN + 1,
-					   nck(at91sam9x5_systemck),
-					   nck(at91sam9x35_periphck), 0);
+					   nck(at91sam9x5_systemck), 31, 0);
  	if (!at91sam9x5_pmc)
  		return;
 
Signature · 1 line
Nicolas Ferre
maintainer
#5 lore raw

Quoting [email protected] (2019-02-20 03:18:40)

Quoted 8 lines · Alexandre Belloni
Quoted 6 lines

nck() looks at the last id in an array and unfortunately, at91sam9x35_periphck has a sentinel, hence the id is 0 and the calculated number of peripheral clocks is 1 instead of a maximum of 31.

Fixes 1eabdc2f9dd8 ("clk: at91: add at91sam9x5 PMCs driver")
Quoted 7 lines

It would be nice to queue it as a fix the soonest, as it impacts 5.0 but not 4.20 due to a switch from one DT binding to another (read: a real regression)... But I know it's a bit late in the cycle...

Ok. Let's send it off tomorrow.

maintainer Applied
#6 lore raw
In reply to Alexandre Belloni

Quoting Alexandre Belloni (2019-02-19 08:51:14)

Quoted 7 lines

nck() looks at the last id in an array and unfortunately, at91sam9x35_periphck has a sentinel, hence the id is 0 and the calculated number of peripheral clocks is 1 instead of a maximum of 31.

Fixes 1eabdc2f9dd8 ("clk: at91: add at91sam9x5 PMCs driver")

---

Applied to clk-fixes