[openfirmware] [commit] r3005 - in cpu/arm: mmp2 olpc

repository service svn at openfirmware.info
Sat Jun 9 05:54:00 CEST 2012


Author: quozl
Date: Sat Jun  9 05:53:59 2012
New Revision: 3005
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3005

Log:
OLPC XO-1.75 - banner, calculate and display actual processor core frequency instead of only displaying what the processor fuses say.

Modified:
   cpu/arm/mmp2/clocks.fth
   cpu/arm/olpc/banner.fth
   cpu/arm/olpc/build-fw.fth

Modified: cpu/arm/mmp2/clocks.fth
==============================================================================
--- cpu/arm/mmp2/clocks.fth	Thu Jun  7 08:05:24 2012	(r3004)
+++ cpu/arm/mmp2/clocks.fth	Sat Jun  9 05:53:59 2012	(r3005)
@@ -38,6 +38,11 @@
    h#      4000 h# 1024 +mpmu io-set  \ APMU_PLL2 in PMUM_CGR_PJ
    h#      4000 h#   24 +mpmu io-set  \ APMU_PLL2 in PMUM_CGR_SP
 ;
+: pll2-ungated?  ( -- flag )
+   h#      4000 h# 1024 +mpmu io@  and
+;
+: pll2-fbdiv  ( -- N )  h# 34 mpmu@ d# 10 rshift h# 1ff and  2+  ;
+: pll2-refdiv  ( -- M )  h# 34 mpmu@ d# 19 rshift h# 1f and  2+  ;
 
 : fccr@    ( -- n )  h# 05.0008 io@  ;
 : fccr!    ( n -- )  h# 05.0008 io!  ;
@@ -45,11 +50,18 @@
    d# 29 lshift                               ( field )
    fccr@  h# e000.0000 invert and  or  fccr!  ( )
 ;
+: pj4-clksel@  ( -- n )
+   fccr@  h# e000.0000 and  d# 29 rshift
+;
+
 : sp-clksel  ( n -- )
    d# 26 lshift                               ( field )
    fccr@  h# 1c00.0000 invert and  or  fccr!  ( )
 ;
+
 : pj4-cc!  ( n -- )  h# 28.2804 io!  ;
+: pj4-cc@  ( -- n )  h# 28.2804 io@  ;
+: pj4-clkdiv  ( -- n )  pj4-cc@  h# 7  and  ;
 
 : sp-cc!     ( n -- )  h# 28.2800 io!  ;
 \                                     cfraaADXBpP
@@ -77,3 +89,14 @@
 : pj4-910mhz ( -- )  set-pll2-910mhz 2 pj4-clksel  o# 21742201100 pj4-cc!  ;  \ A 266, D 400, XP 400, B 400, P 910
 : pj4-988mhz ( -- )  set-pll2-988mhz 2 pj4-clksel  o# 21742201100 pj4-cc!  ;  \ A 266, D 400, XP 400, B 400, P 988
 [then]
+
+: pj4-speed  ( -- frequency )
+   pj4-clksel@
+   case
+      0  of  d# 400,000,000 pj4-clkdiv 1+ /            endof  ( hz )
+      1  of  d# 800,000,000                            endof  ( hz )
+      2  of  d#  26,000,000 pll2-fbdiv pll2-refdiv */  endof  ( hz )
+   endcase
+   d# 1,000,000 /                                             ( mhz )
+;
+\ FIXME: should be a property clock-frequency of /cpu at 0

Modified: cpu/arm/olpc/banner.fth
==============================================================================
--- cpu/arm/olpc/banner.fth	Thu Jun  7 08:05:24 2012	(r3004)
+++ cpu/arm/olpc/banner.fth	Sat Jun  9 05:53:59 2012	(r3005)
@@ -119,12 +119,10 @@
 ;
 
 : .cpu-speed  ( -- )
-   rated-speed  case
-      0 of  ." 800 MHz"  endof
-      1 of  ." 910 MHz"  endof
-            ." 1 GHz"
-   endcase
+   pj4-speed
+   dup d# 988 =  if ." 1 GHz" else .d ." MHz" then
 ;
+
 : .memory-brief  ( -- )
    memory-size dup d# 1024 / ?dup  if  ( mb gb )
       nip " GiB" rot                   ( gb$ gb )

Modified: cpu/arm/olpc/build-fw.fth
==============================================================================
--- cpu/arm/olpc/build-fw.fth	Thu Jun  7 08:05:24 2012	(r3004)
+++ cpu/arm/olpc/build-fw.fth	Sat Jun  9 05:53:59 2012	(r3005)
@@ -567,6 +567,7 @@
    then
 ;
 
+fload ${BP}/cpu/arm/mmp2/clocks.fth
 fload ${BP}/cpu/arm/olpc/banner.fth
 
 \- olpc-cl3  devalias keyboard /ap-sp/keyboard
@@ -966,8 +967,6 @@
 \+ olpc-cl3 fload ${BP}/cpu/arm/olpc/3.0/testinstructions.fth
 \+ olpc-cl2 fload ${BP}/cpu/arm/olpc/1.75/testinstructions.fth
 
-fload ${BP}/cpu/arm/mmp2/clocks.fth
-
 : startup  ( -- )
    standalone?  0=  if  exit  then
 



More information about the openfirmware mailing list