Skip to contentSkip to conversation

ARM: SAMSUNG: Set clock parent if provided

PATCH In review Shaik Ameer Basha 5 participants 8 messages Mar 7, 2013 – Apr 8, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: SAMSUNG: Set clock parent if provided

s3c_set_clksrc() updates the clock source as per u-boot settings. This patch adds the functionality to overwrite u-boot settings, if user provides the clock parent field. In case of wrong source provided by the user, it will retain the u-boot settings.

---
 arch/arm/plat-samsung/clock-clksrc.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
arch/arm/plat-samsung/clock-clksrc.c +6 -1
index 786a410..4fecd80 100644
@@ -150,7 +150,12 @@ void __init_or_cpufreq s3c_set_clksrc(struct clksrc_clk *clk, bool announce)
 		return;
 	}
 
-	clk->clk.parent = srcs->sources[clksrc];
+	if (clk->clk.parent) {
+		if (s3c_setparent_clksrc(&clk->clk, clk->clk.parent))
+			clk->clk.parent = srcs->sources[clksrc];
+	} else {
+		clk->clk.parent = srcs->sources[clksrc];
+	}
 
 	if (announce)
 		printk(KERN_INFO "%s: source is %s (%d), rate is %ld\n",
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 15 lines · Shaik Ameer Basha

s3c_set_clksrc() updates the clock source as per u-boot settings. This patch adds the functionality to overwrite u-boot settings, if user provides the clock parent field. In case of wrong source provided by the user, it will retain the u-boot settings.

---
 arch/arm/plat-samsung/clock-clksrc.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
arch/arm/plat-samsung/clock-clksrc.c +0 -0
index 786a410..4fecd80 100644

arch/arm/plat-samsung/clock-clksrc.c void __init_or_cpufreq s3c_set_clksrc(struct clksrc_clk *clk, bool announce) · line 155

Quoted 7 lines
arch/arm/plat-samsung/clock-clksrc.c +3 -1
@@ -150,7 +150,12 @@ void __init_or_cpufreq s3c_set_clksrc(struct clksrc_clk *clk, bool announce)
                return;
        }
 
-       clk->clk.parent = srcs->sources[clksrc];
+       if (clk->clk.parent) {
+               if (s3c_setparent_clksrc(&clk->clk, clk->clk.parent))
+                       clk->clk.parent = srcs->sources[clksrc];

IMO, it make sense to return the error value if failed. Now you are masking the failed cases (due to invalid parent clk) and proceeding with uboot values which is not the intention when parent clock is provided.

Regards,
Rahul Sharma,

Quoted 9 lines
arch/arm/plat-samsung/clock-clksrc.c +3 -1
+       } else {
+               clk->clk.parent = srcs->sources[clksrc];
+       }
 
        if (announce)
                printk(KERN_INFO "%s: source is %s (%d), rate is %ld\n",
--

1.7.9.5

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--

#2 lore raw

Hi Rahul,

Quoted 20 lines · Rahul Sharma
Quoted 18 lines · Shaik Ameer Basha

s3c_set_clksrc() updates the clock source as per u-boot settings. This patch adds the functionality to overwrite u-boot settings, if user provides the clock parent field. In case of wrong source provided by the user, it will retain the u-boot settings.

---
 arch/arm/plat-samsung/clock-clksrc.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
arch/arm/plat-samsung/clock-clksrc.c +0 -0
index 786a410..4fecd80 100644
@@ -150,7 +150,12 @@ void __init_or_cpufreq s3c_set_clksrc(struct clksrc_clk *clk, bool announce)
                return;
        }
 
Quoted 9 lines

arch/arm/plat-samsung/clock-clksrc.c void __init_or_cpufreq s3c_set_clksrc(struct clksrc_clk *clk, bool announce) · line 155

Quoted 4 lines
arch/arm/plat-samsung/clock-clksrc.c +3 -1
-       clk->clk.parent = srcs->sources[clksrc];
+       if (clk->clk.parent) {
+               if (s3c_setparent_clksrc(&clk->clk, clk->clk.parent))
+                       clk->clk.parent = srcs->sources[clksrc];

IMO, it make sense to return the error value if failed. Now you are masking the failed cases (due to invalid parent clk) and proceeding with uboot values which is not the intention when parent clock is provided.

yes you are right. But as the function s3c_set_clksrc() is not expected to return any error codes,
I tried to use default u-boot settings.
We can add a warning message to let user know in case of wrong parent assignment.

Regards,
Shaik Ameer Basha

Quoted 19 lines

Regards,
Rahul Sharma,

Quoted 9 lines
arch/arm/plat-samsung/clock-clksrc.c +3 -1
+       } else {
+               clk->clk.parent = srcs->sources[clksrc];
+       }
 
        if (announce)
                printk(KERN_INFO "%s: source is %s (%d), rate is %ld\n",
--

1.7.9.5

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--

#3 lore raw
Quoted 33 lines · Shaik Ameer Basha

Hi Rahul,

Quoted 20 lines · Rahul Sharma
Quoted 18 lines · Shaik Ameer Basha

s3c_set_clksrc() updates the clock source as per u-boot settings. This patch adds the functionality to overwrite u-boot settings, if user provides the clock parent field. In case of wrong source provided by the user, it will retain the u-boot settings.

---
 arch/arm/plat-samsung/clock-clksrc.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
arch/arm/plat-samsung/clock-clksrc.c +0 -0
index 786a410..4fecd80 100644
@@ -150,7 +150,12 @@ void __init_or_cpufreq s3c_set_clksrc(struct clksrc_clk *clk, bool announce)
                return;
        }
 
Quoted 9 lines

arch/arm/plat-samsung/clock-clksrc.c void __init_or_cpufreq s3c_set_clksrc(struct clksrc_clk *clk, bool announce) · line 155

Quoted 4 lines
arch/arm/plat-samsung/clock-clksrc.c +3 -1
-       clk->clk.parent = srcs->sources[clksrc];
+       if (clk->clk.parent) {
+               if (s3c_setparent_clksrc(&clk->clk, clk->clk.parent))
+                       clk->clk.parent = srcs->sources[clksrc];

IMO, it make sense to return the error value if failed. Now you are masking the failed cases (due to invalid parent clk) and proceeding with uboot values which is not the intention when parent clock is provided.

Quoted 6 lines

yes you are right. But as the function s3c_set_clksrc() is not expected to return any error codes,
I tried to use default u-boot settings.
We can add a warning message to let user know in case of wrong parent assignment.

Agreed. Printing error val with KERN_ERR and return would be better.

Quoted 22 lines

Regards,
Shaik Ameer Basha

Quoted 19 lines

Regards,
Rahul Sharma,

Quoted 9 lines
arch/arm/plat-samsung/clock-clksrc.c +3 -1
+       } else {
+               clk->clk.parent = srcs->sources[clksrc];
+       }
 
        if (announce)
                printk(KERN_INFO "%s: source is %s (%d), rate is %ld\n",
--

1.7.9.5

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--

Signature · 4 lines
Regards,
Rahul Sharma,
email to: [email protected]
Samsung India.
#4 lore raw
In reply to Shaik Ameer Basha
Quoted 15 lines · Shaik Ameer Basha

s3c_set_clksrc() updates the clock source as per u-boot settings. This patch adds the functionality to overwrite u-boot settings, if user provides the clock parent field. In case of wrong source provided by the user, it will retain the u-boot settings.

---
 arch/arm/plat-samsung/clock-clksrc.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
arch/arm/plat-samsung/clock-clksrc.c +0 -0
index 786a410..4fecd80 100644

arch/arm/plat-samsung/clock-clksrc.c void __init_or_cpufreq s3c_set_clksrc(struct clksrc_clk *clk, bool announce) · line 158

Quoted 10 lines
arch/arm/plat-samsung/clock-clksrc.c +6 -1
@@ -150,7 +150,12 @@ void __init_or_cpufreq s3c_set_clksrc(struct clksrc_clk *clk, bool announce)
 		return;
 	}
 
-	clk->clk.parent = srcs->sources[clksrc];
+	if (clk->clk.parent) {
+		if (s3c_setparent_clksrc(&clk->clk, clk->clk.parent))
+			clk->clk.parent = srcs->sources[clksrc];
+	} else {
+		clk->clk.parent = srcs->sources[clksrc];
+	}

May I ask what do you need this for ? This code won't be used for Exynos4 and Exynos5 SoCs starting from 3.10. And it is going to be removed once other platforms are converted to the new Samsung clocks driver.

Regards,
Sylwester

#5 lore raw

Hi Sylwester,

Quoted 19 lines · Sylwester Nawrocki
Quoted 18 lines · Shaik Ameer Basha

s3c_set_clksrc() updates the clock source as per u-boot settings. This patch adds the functionality to overwrite u-boot settings, if user provides the clock parent field. In case of wrong source provided by the user, it will retain the u-boot settings.

---
 arch/arm/plat-samsung/clock-clksrc.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
arch/arm/plat-samsung/clock-clksrc.c +0 -0
index 786a410..4fecd80 100644
@@ -150,7 +150,12 @@ void __init_or_cpufreq s3c_set_clksrc(struct clksrc_clk *clk, bool announce)
              return;
      }
 
Quoted 12 lines

arch/arm/plat-samsung/clock-clksrc.c void __init_or_cpufreq s3c_set_clksrc(struct clksrc_clk *clk, bool announce) · line 158

Quoted 7 lines
arch/arm/plat-samsung/clock-clksrc.c +6 -1
-     clk->clk.parent = srcs->sources[clksrc];
+     if (clk->clk.parent) {
+             if (s3c_setparent_clksrc(&clk->clk, clk->clk.parent))
+                     clk->clk.parent = srcs->sources[clksrc];
+     } else {
+             clk->clk.parent = srcs->sources[clksrc];
+     }

May I ask what do you need this for ? This code won't be used for Exynos4 and Exynos5 SoCs starting from 3.10. And it is going to be removed once other platforms are converted to the new Samsung clocks driver.

I had some issues in exynos5 with out this implementation. But yes... you are right, once we move to common clock framework (CCF) we don't require this change, as CCF doesn't use this (for exynos 4/5).

What about all old non-dt based platforms?
Cant they use this change until they move to DT and CCF?

Regards,
Shaik Ameer Basha

Quoted 3 lines

Regards,
Sylwester

#6 lore raw

Hi Shaik,

Quoted 2 lines · Shaik Ameer Basha

On Thu, Mar 7, 2013 at 9:05 PM, Sylwester Nawrocki <[email protected]> wrote:

...

Quoted 11 lines
Quoted 4 lines

May I ask what do you need this for ? This code won't be used for Exynos4 and Exynos5 SoCs starting from 3.10. And it is going to be removed once other platforms are converted to the new Samsung clocks driver.

I had some issues in exynos5 with out this implementation. But yes... you are right, once we move to common clock framework (CCF) we don't require this change, as CCF doesn't use this (for exynos 4/5).

What about all old non-dt based platforms?
Cant they use this change until they move to DT and CCF?

I have nothing against the patch, I was just curious if you need it for the new SOCs where the new clocks driver is supposed to be used. Of course other Samsung platforms could switch to CCF before having support for the device tree.

Regards,
Sylwester

#7 lore raw
Quoted 16 lines · Sylwester Nawrocki

Hi Shaik,

Quoted 2 lines · Shaik Ameer Basha

On Thu, Mar 7, 2013 at 9:05 PM, Sylwester Nawrocki <[email protected]> wrote:

...

Quoted 9 lines
Quoted 4 lines

May I ask what do you need this for ? This code won't be used for Exynos4 and Exynos5 SoCs starting from 3.10. And it is going to be removed once other platforms are converted to the new Samsung clocks driver.

I had some issues in exynos5 with out this implementation. But yes... you are right, once we move to common clock framework (CCF) we don't require this change, as CCF doesn't use this (for exynos 4/5).

Quoted 8 lines
Quoted 2 lines

What about all old non-dt based platforms?
Cant they use this change until they move to DT and CCF?

I have nothing against the patch, I was just curious if you need it for the new SOCs where the new clocks driver is supposed to be used. Of course other Samsung platforms could switch to CCF before having support for the device tree.

Sorry for late response on this...

Yes, I think, as many guys said, this is not required for now for exynos4/5.

But the reason is different, I think, because the parent clock should be set depends on each board. That's why there are many parent clocks hardware providing. Sometimes just one parent clock can be used as a default though.

- Kukjin