Commit 93e85d02b21cdcd431df2237b883218f5c4059af

Authored by Christophe Leroy
Committed by Tom Rini
1 parent 0819450fdd

powerpc, timer: Does 8xx specific actions in 8xx cpu_init

The actions inside #ifdef CONFIG_8xx in arch/powerpc/lib/time.c
can be performed before, in a 8xx dedicated function.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>

Showing 2 changed files with 4 additions and 12 deletions Side-by-side Diff

arch/powerpc/cpu/mpc8xx/cpu_init.c
... ... @@ -38,7 +38,10 @@
38 38 /* unlock TBSCRK */
39 39  
40 40 out_be32(&immr->im_sitk.sitk_tbscrk, KAPWR_KEY);
41   - out_be16(&immr->im_sit.sit_tbscr, CONFIG_SYS_TBSCR);
  41 + out_be16(&immr->im_sit.sit_tbscr, CONFIG_SYS_TBSCR | TBSCR_TBE);
  42 +
  43 + /* Unlock timebase register */
  44 + out_be32(&immr->im_sitk.sitk_tbk, KAPWR_KEY);
42 45  
43 46 /* initialize the PIT (11-31) */
44 47  
arch/powerpc/lib/time.c
... ... @@ -65,21 +65,10 @@
65 65 {
66 66 unsigned long temp;
67 67  
68   -#if defined(CONFIG_8xx)
69   - immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
70   -
71   - /* unlock */
72   - out_be32(&immap->im_sitk.sitk_tbk, KAPWR_KEY);
73   -#endif
74   -
75 68 /* reset */
76 69 asm volatile("li %0,0 ; mttbu %0 ; mttbl %0;"
77 70 : "=&r"(temp) );
78 71  
79   -#if defined(CONFIG_8xx)
80   - /* enable */
81   - setbits_be16(&immap->im_sit.sit_tbscr, TBSCR_TBE);
82   -#endif
83 72 return (0);
84 73 }
85 74 /* ------------------------------------------------------------------------- */