linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] PowerPC/FSL/CPM: Configure clock correctly for SCC
@ 2010-04-03 14:11 Wolfgang Ocker
  2010-04-05 18:05 ` Scott Wood
  2010-04-20  4:13 ` Kumar Gala
  0 siblings, 2 replies; 3+ messages in thread
From: Wolfgang Ocker @ 2010-04-03 14:11 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Wolfgang Ocker

Some board setup functions call cpm1_clk_setup() or cmp2_clk_setup()
to configure the clock source.

If CPM_CLK_RTX has been used for the parameter mode,
the clock has been configured only for TX but not for RX.

With this patch CPM_CLK_RTX configures the clock for both directions
correctly.

Signed-off-by: Wolfgang Ocker <weo@reccoware.de>
---

v2: Scott Wood encouraged me to include a similar fix for CPM2.

 arch/powerpc/sysdev/cpm1.c |   14 +++++++++++---
 arch/powerpc/sysdev/cpm2.c |   11 ++++++++---
 2 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/sysdev/cpm1.c b/arch/powerpc/sysdev/cpm1.c
index a4b41db..786e178 100644
--- a/arch/powerpc/sysdev/cpm1.c
+++ b/arch/powerpc/sysdev/cpm1.c
@@ -485,9 +485,6 @@ int cpm1_clk_setup(enum cpm_clk_target target, int clock, int mode)
 		return -EINVAL;
 	}
 
-	if (reg == &mpc8xx_immr->im_cpm.cp_sicr && mode == CPM_CLK_RX)
-		shift += 3;
-
 	for (i = 0; i < ARRAY_SIZE(clk_map); i++) {
 		if (clk_map[i][0] == target && clk_map[i][1] == clock) {
 			bits = clk_map[i][2];
@@ -502,6 +499,17 @@ int cpm1_clk_setup(enum cpm_clk_target target, int clock, int mode)
 
 	bits <<= shift;
 	mask <<= shift;
+
+	if (reg == &mpc8xx_immr->im_cpm.cp_sicr) {
+		if (mode == CPM_CLK_RTX) {
+			bits |= bits << 3;
+			mask |= mask << 3;
+		} else if (mode == CPM_CLK_RX) {
+			bits <<= 3;
+			mask <<= 3;
+		}
+	}
+
 	out_be32(reg, (in_be32(reg) & ~mask) | bits);
 
 	return 0;
diff --git a/arch/powerpc/sysdev/cpm2.c b/arch/powerpc/sysdev/cpm2.c
index eb59272..8dc1e24 100644
--- a/arch/powerpc/sysdev/cpm2.c
+++ b/arch/powerpc/sysdev/cpm2.c
@@ -244,9 +244,6 @@ int cpm2_clk_setup(enum cpm_clk_target target, int clock, int mode)
 		return -EINVAL;
 	}
 
-	if (mode == CPM_CLK_RX)
-		shift += 3;
-
 	for (i = 0; i < ARRAY_SIZE(clk_map); i++) {
 		if (clk_map[i][0] == target && clk_map[i][1] == clock) {
 			bits = clk_map[i][2];
@@ -259,6 +256,14 @@ int cpm2_clk_setup(enum cpm_clk_target target, int clock, int mode)
 	bits <<= shift;
 	mask <<= shift;
 
+	if (mode == CPM_CLK_RTX) {
+		bits |= bits << 3;
+		mask |= mask << 3;
+	} else if (mode == CPM_CLK_RX) {
+		bits <<= 3;
+		mask <<= 3;
+	}
+
 	out_be32(reg, (in_be32(reg) & ~mask) | bits);
 
 	cpm2_unmap(im_cpmux);
-- 
1.6.6.1

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

* Re: [PATCH v2] PowerPC/FSL/CPM: Configure clock correctly for SCC
  2010-04-03 14:11 [PATCH v2] PowerPC/FSL/CPM: Configure clock correctly for SCC Wolfgang Ocker
@ 2010-04-05 18:05 ` Scott Wood
  2010-04-20  4:13 ` Kumar Gala
  1 sibling, 0 replies; 3+ messages in thread
From: Scott Wood @ 2010-04-05 18:05 UTC (permalink / raw)
  To: Wolfgang Ocker; +Cc: linuxppc-dev

Wolfgang Ocker wrote:
> Some board setup functions call cpm1_clk_setup() or cmp2_clk_setup()
> to configure the clock source.
> 
> If CPM_CLK_RTX has been used for the parameter mode,
> the clock has been configured only for TX but not for RX.
> 
> With this patch CPM_CLK_RTX configures the clock for both directions
> correctly.
> 
> Signed-off-by: Wolfgang Ocker <weo@reccoware.de>
> ---
> 
> v2: Scott Wood encouraged me to include a similar fix for CPM2.
> 
>  arch/powerpc/sysdev/cpm1.c |   14 +++++++++++---
>  arch/powerpc/sysdev/cpm2.c |   11 ++++++++---
>  2 files changed, 19 insertions(+), 6 deletions(-)

Acked-by: Scott Wood <scottwood@freescale.com>

-Scott

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

* Re: [PATCH v2] PowerPC/FSL/CPM: Configure clock correctly for SCC
  2010-04-03 14:11 [PATCH v2] PowerPC/FSL/CPM: Configure clock correctly for SCC Wolfgang Ocker
  2010-04-05 18:05 ` Scott Wood
@ 2010-04-20  4:13 ` Kumar Gala
  1 sibling, 0 replies; 3+ messages in thread
From: Kumar Gala @ 2010-04-20  4:13 UTC (permalink / raw)
  To: Wolfgang Ocker; +Cc: linuxppc-dev


On Apr 3, 2010, at 9:11 AM, Wolfgang Ocker wrote:

> Some board setup functions call cpm1_clk_setup() or cmp2_clk_setup()
> to configure the clock source.
> 
> If CPM_CLK_RTX has been used for the parameter mode,
> the clock has been configured only for TX but not for RX.
> 
> With this patch CPM_CLK_RTX configures the clock for both directions
> correctly.
> 
> Signed-off-by: Wolfgang Ocker <weo@reccoware.de>
> ---
> 
> v2: Scott Wood encouraged me to include a similar fix for CPM2.
> 
> arch/powerpc/sysdev/cpm1.c |   14 +++++++++++---
> arch/powerpc/sysdev/cpm2.c |   11 ++++++++---
> 2 files changed, 19 insertions(+), 6 deletions(-)


applied to merge.

- k

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

end of thread, other threads:[~2010-04-20  4:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-03 14:11 [PATCH v2] PowerPC/FSL/CPM: Configure clock correctly for SCC Wolfgang Ocker
2010-04-05 18:05 ` Scott Wood
2010-04-20  4:13 ` Kumar Gala

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).