Skip to contentSkip to conversation

clk: ralink: mtmips: fix clock plan for Ralink SoC RT3883

PATCH In review Sergio Paracuellos 2 participants 4 messages Aug 6, 2024 – Sep 10, 2024

Subsystems (2)
lore
Share & tools
lore

Sergio Paracuellos

author maintainer
#0 lore raw

PATCH 1/1 clk: ralink: mtmips: fix clock plan for Ralink SoC RT3883

Clock plan for Ralink SoC RT3883 needs an extra 'periph' clock to properly set some peripherals that has this clock as their parent. When this driver was mainlined we could not find any active users of this SoC so we cannot perform any real tests for it. Now, one user of a Belkin f9k1109 version 1 device which uses this SoC appear and reported some issues in openWRT:
- https://github.com/openwrt/openwrt/issues/16054
The peripherals that are wrong are 'uart', 'i2c', 'i2s' and 'uartlite' which has a not defined 'periph' clock as parent. Hence, introduce it to have a properly working clock plan for this SoC.

Fixes 6f3b15586eef ("clk: ralink: add clock and reset driver for MTMIPS SoCs")
---
 drivers/clk/ralink/clk-mtmips.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/clk/ralink/clk-mtmips.c +7 -2
index 50a443bf79ec..787ff3e66b34 100644
@@ -267,6 +267,11 @@ static struct mtmips_clk_fixed rt305x_fixed_clocks[] = {
 	CLK_FIXED("xtal", NULL, 40000000)
 };
 
+static struct mtmips_clk_fixed rt3383_fixed_clocks[] = {
+	CLK_FIXED("xtal", NULL, 40000000),
+	CLK_FIXED("periph", "xtal", 40000000)
+};
+
 static struct mtmips_clk_fixed rt3352_fixed_clocks[] = {
 	CLK_FIXED("periph", "xtal", 40000000)
 };
@@ -779,8 +784,8 @@ static const struct mtmips_clk_data rt3352_clk_data = {
 static const struct mtmips_clk_data rt3883_clk_data = {
 	.clk_base = rt3883_clks_base,
 	.num_clk_base = ARRAY_SIZE(rt3883_clks_base),
-	.clk_fixed = rt305x_fixed_clocks,
-	.num_clk_fixed = ARRAY_SIZE(rt305x_fixed_clocks),
+	.clk_fixed = rt3383_fixed_clocks,
+	.num_clk_fixed = ARRAY_SIZE(rt3383_fixed_clocks),
 	.clk_factor = NULL,
 	.num_clk_factor = 0,
 	.clk_periph = rt5350_pherip_clks,
Signature · 1 line
2.25.1
author maintainer
#1 lore raw

Hi Stephen,

Quoted 45 lines · Sergio Paracuellos

Clock plan for Ralink SoC RT3883 needs an extra 'periph' clock to properly set some peripherals that has this clock as their parent. When this driver was mainlined we could not find any active users of this SoC so we cannot perform any real tests for it. Now, one user of a Belkin f9k1109 version 1 device which uses this SoC appear and reported some issues in openWRT:
- https://github.com/openwrt/openwrt/issues/16054
The peripherals that are wrong are 'uart', 'i2c', 'i2s' and 'uartlite' which has a not defined 'periph' clock as parent. Hence, introduce it to have a properly working clock plan for this SoC.

Fixes 6f3b15586eef ("clk: ralink: add clock and reset driver for MTMIPS SoCs")
---
 drivers/clk/ralink/clk-mtmips.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/clk/ralink/clk-mtmips.c +7 -3
index 50a443bf79ec..787ff3e66b34 100644
@@ -267,6 +267,11 @@ static struct mtmips_clk_fixed rt305x_fixed_clocks[] = {
        CLK_FIXED("xtal", NULL, 40000000)
 };
 
+static struct mtmips_clk_fixed rt3383_fixed_clocks[] = {
+       CLK_FIXED("xtal", NULL, 40000000),
+       CLK_FIXED("periph", "xtal", 40000000)
+};
+
 static struct mtmips_clk_fixed rt3352_fixed_clocks[] = {
        CLK_FIXED("periph", "xtal", 40000000)
 };
@@ -779,8 +784,8 @@ static const struct mtmips_clk_data rt3352_clk_data = {
 static const struct mtmips_clk_data rt3883_clk_data = {
        .clk_base = rt3883_clks_base,
        .num_clk_base = ARRAY_SIZE(rt3883_clks_base),
-       .clk_fixed = rt305x_fixed_clocks,
-       .num_clk_fixed = ARRAY_SIZE(rt305x_fixed_clocks),
+       .clk_fixed = rt3383_fixed_clocks,
+       .num_clk_fixed = ARRAY_SIZE(rt3383_fixed_clocks),
        .clk_factor = NULL,
        .num_clk_factor = 0,
        .clk_periph = rt5350_pherip_clks,
--
Quoted 2 lines

2.25.1

Gentle ping on this patch :)

Thanks,
Sergio Paracuellos

#2 lore raw
In reply to Sergio Paracuellos

drivers/clk/ralink/clk-mtmips.c static struct mtmips_clk_fixed rt305x_fixed_clocks[] = { · line 270

Quoted 9 lines · Sergio Paracuellos
drivers/clk/ralink/clk-mtmips.c +1 -0
index 50a443bf79ec..787ff3e66b34 100644
@@ -267,6 +267,11 @@ static struct mtmips_clk_fixed rt305x_fixed_clocks[] = {
 	CLK_FIXED("xtal", NULL, 40000000)
 };
 
+static struct mtmips_clk_fixed rt3383_fixed_clocks[] = {

Hi! I found a small issue. The SoC name is rt3883 instead of rt3383.

Quoted 8 lines
drivers/clk/ralink/clk-mtmips.c +4 -0
+	CLK_FIXED("xtal", NULL, 40000000),
+	CLK_FIXED("periph", "xtal", 40000000)
+};
+
 static struct mtmips_clk_fixed rt3352_fixed_clocks[] = {
 	CLK_FIXED("periph", "xtal", 40000000)
 };

drivers/clk/ralink/clk-mtmips.c static const struct mtmips_clk_data rt3352_clk_data = { · line 791

Quoted 10 lines
drivers/clk/ralink/clk-mtmips.c +2 -2
@@ -779,8 +784,8 @@ static const struct mtmips_clk_data rt3352_clk_data = {
 static const struct mtmips_clk_data rt3883_clk_data = {
 	.clk_base = rt3883_clks_base,
 	.num_clk_base = ARRAY_SIZE(rt3883_clks_base),
-	.clk_fixed = rt305x_fixed_clocks,
-	.num_clk_fixed = ARRAY_SIZE(rt305x_fixed_clocks),
+	.clk_fixed = rt3383_fixed_clocks,
+	.num_clk_fixed = ARRAY_SIZE(rt3383_fixed_clocks),
 	.clk_factor = NULL,
 	.num_clk_factor = 0,
 	.clk_periph = rt5350_pherip_clks,

Regards,
Shiji Yang

author maintainer
#3 lore raw

Hi Shiji,

Quoted 11 lines · Shiji Yang
Quoted 8 lines · Sergio Paracuellos
drivers/clk/ralink/clk-mtmips.c +0 -0
index 50a443bf79ec..787ff3e66b34 100644
@@ -267,6 +267,11 @@ static struct mtmips_clk_fixed rt305x_fixed_clocks[] = {
      CLK_FIXED("xtal", NULL, 40000000)
 };
 
Quoted 3 lines

drivers/clk/ralink/clk-mtmips.c static struct mtmips_clk_fixed rt305x_fixed_clocks[] = { · line 270

Quoted 1 line
drivers/clk/ralink/clk-mtmips.c +1 -0
+static struct mtmips_clk_fixed rt3383_fixed_clocks[] = {

Hi! I found a small issue. The SoC name is rt3883 instead of rt3383.

Ouch :). True. Since I have some other pending patches of this driver I will fix this and
send a new patchset including this fixed.

Thanks,
Sergio Paracuellos

Quoted 22 lines
Quoted 9 lines
drivers/clk/ralink/clk-mtmips.c +4 -0
+      CLK_FIXED("xtal", NULL, 40000000),
+      CLK_FIXED("periph", "xtal", 40000000)
+};
+
 static struct mtmips_clk_fixed rt3352_fixed_clocks[] = {
      CLK_FIXED("periph", "xtal", 40000000)
 };

drivers/clk/ralink/clk-mtmips.c static const struct mtmips_clk_data rt3352_clk_data = { · line 791

Quoted 10 lines
drivers/clk/ralink/clk-mtmips.c +2 -2
@@ -779,8 +784,8 @@ static const struct mtmips_clk_data rt3352_clk_data = {
 static const struct mtmips_clk_data rt3883_clk_data = {
      .clk_base = rt3883_clks_base,
      .num_clk_base = ARRAY_SIZE(rt3883_clks_base),
-      .clk_fixed = rt305x_fixed_clocks,
-      .num_clk_fixed = ARRAY_SIZE(rt305x_fixed_clocks),
+      .clk_fixed = rt3383_fixed_clocks,
+      .num_clk_fixed = ARRAY_SIZE(rt3383_fixed_clocks),
      .clk_factor = NULL,
      .num_clk_factor = 0,
      .clk_periph = rt5350_pherip_clks,

Regards,
Shiji Yang