aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWolfgang Ocker <weo@reccoware.de>2010-04-03 10:11:43 -0400
committerKumar Gala <galak@kernel.crashing.org>2010-04-20 00:13:03 -0400
commit1cca2d2b99f3d7eea6aa627b96bffc3b0999eca2 (patch)
tree8896708d7926109e2176bcd715b32ff97c6431e7
parente8137341b1bb9bbdc29d9fd8980485ec7dcb4109 (diff)
powerpc/fsl-cpm: Configure clock correctly for SCC
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> Acked-by: Scott Wood <scottwood@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
-rw-r--r--arch/powerpc/sysdev/cpm1.c14
-rw-r--r--arch/powerpc/sysdev/cpm2.c11
2 files changed, 19 insertions, 6 deletions
diff --git a/arch/powerpc/sysdev/cpm1.c b/arch/powerpc/sysdev/cpm1.c
index 4dae3698bf24..8d103ca6d6ab 100644
--- a/arch/powerpc/sysdev/cpm1.c
+++ b/arch/powerpc/sysdev/cpm1.c
@@ -486,9 +486,6 @@ int cpm1_clk_setup(enum cpm_clk_target target, int clock, int mode)
486 return -EINVAL; 486 return -EINVAL;
487 } 487 }
488 488
489 if (reg == &mpc8xx_immr->im_cpm.cp_sicr && mode == CPM_CLK_RX)
490 shift += 3;
491
492 for (i = 0; i < ARRAY_SIZE(clk_map); i++) { 489 for (i = 0; i < ARRAY_SIZE(clk_map); i++) {
493 if (clk_map[i][0] == target && clk_map[i][1] == clock) { 490 if (clk_map[i][0] == target && clk_map[i][1] == clock) {
494 bits = clk_map[i][2]; 491 bits = clk_map[i][2];
@@ -503,6 +500,17 @@ int cpm1_clk_setup(enum cpm_clk_target target, int clock, int mode)
503 500
504 bits <<= shift; 501 bits <<= shift;
505 mask <<= shift; 502 mask <<= shift;
503
504 if (reg == &mpc8xx_immr->im_cpm.cp_sicr) {
505 if (mode == CPM_CLK_RTX) {
506 bits |= bits << 3;
507 mask |= mask << 3;
508 } else if (mode == CPM_CLK_RX) {
509 bits <<= 3;
510 mask <<= 3;
511 }
512 }
513
506 out_be32(reg, (in_be32(reg) & ~mask) | bits); 514 out_be32(reg, (in_be32(reg) & ~mask) | bits);
507 515
508 return 0; 516 return 0;
diff --git a/arch/powerpc/sysdev/cpm2.c b/arch/powerpc/sysdev/cpm2.c
index eb5927212fab..8dc1e24f3c23 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)
244 return -EINVAL; 244 return -EINVAL;
245 } 245 }
246 246
247 if (mode == CPM_CLK_RX)
248 shift += 3;
249
250 for (i = 0; i < ARRAY_SIZE(clk_map); i++) { 247 for (i = 0; i < ARRAY_SIZE(clk_map); i++) {
251 if (clk_map[i][0] == target && clk_map[i][1] == clock) { 248 if (clk_map[i][0] == target && clk_map[i][1] == clock) {
252 bits = clk_map[i][2]; 249 bits = clk_map[i][2];
@@ -259,6 +256,14 @@ int cpm2_clk_setup(enum cpm_clk_target target, int clock, int mode)
259 bits <<= shift; 256 bits <<= shift;
260 mask <<= shift; 257 mask <<= shift;
261 258
259 if (mode == CPM_CLK_RTX) {
260 bits |= bits << 3;
261 mask |= mask << 3;
262 } else if (mode == CPM_CLK_RX) {
263 bits <<= 3;
264 mask <<= 3;
265 }
266
262 out_be32(reg, (in_be32(reg) & ~mask) | bits); 267 out_be32(reg, (in_be32(reg) & ~mask) | bits);
263 268
264 cpm2_unmap(im_cpmux); 269 cpm2_unmap(im_cpmux);