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

repository service svn at openfirmware.info
Thu May 31 22:07:15 CEST 2012


Author: wmb
Date: Thu May 31 22:07:15 2012
New Revision: 2993
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2993

Log:
OLPC XO-1.75 - Added support for 910 MHz and 1 GHz (actually 988 MHz) operating points.

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

Modified: cpu/arm/mmp2/clocks.fth
==============================================================================
--- cpu/arm/mmp2/clocks.fth	Thu May 31 20:33:33 2012	(r2992)
+++ cpu/arm/mmp2/clocks.fth	Thu May 31 22:07:15 2012	(r2993)
@@ -1,5 +1,44 @@
 purpose: Change the clock frequency
 
+0 [if]
+: set-pll2-520mhz  ( -- )
+   \ select PLL2 frequency, 520MHz
+   h# 08600322 h# 414 mpmu!  \ PMUM_PLL2_CTRL1 \ Bandgap+charge pump+VCO loading+regulator defaults, 486.3-528.55 PLL2 (bits 10:6)
+   h# 00FFFE00 h#  34 mpmu!  \ PMUM_PLL2_CTRL2 \ refclk divisor and feedback divisors at max, software controls activation
+   h# 0021da00 h#  34 mpmu!  \ PMUM_PLL2_CTRL2 \ refclk divisor=4, feedback divisor=0x76=118, software controls activation
+   h# 0021db00 h#  34 mpmu!  \ PMUM_PLL2_CTRL2 \ same plus enable
+   h# 28600322 h# 414 mpmu!  \ PMUM_PLL2_CTRL1 \ same as above plus release PLL loop filter
+;
+[then]
+: set-pll2-910mhz  ( -- )
+   \ select PLL2 frequency, 910MHz
+   h# 086005a2 h# 414 mpmu!  \ PMUM_PLL2_CTRL1 \ Bandgap+charge pump+VCO loading+regulator defaults, 486.3-528.55 PLL2 (bits 10:6)
+   h# 00FFFE00 h#  34 mpmu!  \ PMUM_PLL2_CTRL2 \ refclk divisor and feedback divisors at max, software controls activation
+   h# 00234200 h#  34 mpmu!  \ PMUM_PLL2_CTRL2 \ refclk divisor=4, feedback divisor=0xd0=208, software controls activation
+   h# 00234300 h#  34 mpmu!  \ PMUM_PLL2_CTRL2 \ same plus enable
+   h# 286005a2 h# 414 mpmu!  \ PMUM_PLL2_CTRL1 \ same as above plus release PLL loop filter
+;
+: set-pll2-988mhz  ( -- )
+   \ select PLL2 frequency, 988MHz
+   h# 08600622 h# 414 mpmu!  \ PMUM_PLL2_CTRL1 \ Bandgap+charge pump+VCO loading+regulator defaults, 971.35-1011.65 PLL2 (bits 10:6)
+   h# 00FFFE00 h#  34 mpmu!  \ PMUM_PLL2_CTRL2 \ refclk divisor and feedback divisors at max, software controls activation
+   h# 00238a00 h#  34 mpmu!  \ PMUM_PLL2_CTRL2 \ refclk divisor=4, feedback divisor=0xe2=226, software controls activation
+   h# 00238b00 h#  34 mpmu!  \ PMUM_PLL2_CTRL2 \ same plus enable
+   h# 28600622 h# 414 mpmu!  \ PMUM_PLL2_CTRL1 \ same as above plus release PLL loop filter
+;
+: pll2-off  ( -- )
+   h# 2000.0000 h#  414 +mpmu io-clr  \ PLL2_RESETB in PMUM_PLL2_CTRL1
+   h#       100 h#   34 +mpmu io-clr  \ PLL2_SW_EN in PMUM_PLL2CR
+;
+: gate-pll2  ( -- )
+   h#      4000 h# 1024 +mpmu io-clr  \ APMU_PLL2 in PMUM_CGR_PJ
+   h#      4000 h#   24 +mpmu io-clr  \ APMU_PLL2 in PMUM_CGR_SP
+;
+: ungate-pll2  ( -- )
+   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
+;
+
 : fccr@    ( -- n )  h# 05.0008 io@  ;
 : fccr!    ( n -- )  h# 05.0008 io!  ;
 : pj4-clksel  ( n -- )
@@ -25,6 +64,9 @@
 : pj4-200mhz ( -- )  0 pj4-clksel  o# 37042301101 pj4-cc!  ;  \ A 200, D 400, XP 200, B 200, P 200
 : pj4-400mhz ( -- )  0 pj4-clksel  o# 37042301100 pj4-cc!  ;  \ A 200, D 400, XP 200, B 200, P 400
 : pj4-800mhz ( -- )  1 pj4-clksel  o# 37042201100 pj4-cc!  ;  \ A 266, D 400, XP 400, B 400, P 800
+: pj4-910mhz ( -- )  set-pll2-910mhz ungate-pll2  2 pj4-clksel  o# 37042201100 pj4-cc!  ;  \ A 266, D 400, XP 400, B 400, P 910
+: pj4-988mhz ( -- )  set-pll2-988mhz ungate-pll2  2 pj4-clksel  o# 37042201100 pj4-cc!  ;  \ A 266, D 400, XP 400, B 400, P 910
+: .speed  ( -- )  t( d# 10,000,000 0 do loop )t   ;
 
 0 [if]
 \ PJ4 versions using voting           cvr52ADXBCP
@@ -32,4 +74,6 @@
 : pj4-200mhz ( -- )  0 pj4-clksel  o# 21742301101 pj4-cc!  ;  \ A 200, D 400, XP 200, B 200, P 200
 : pj4-400mhz ( -- )  0 pj4-clksel  o# 21742301100 pj4-cc!  ;  \ A 200, D 400, XP 200, B 200, P 400
 : pj4-800mhz ( -- )  1 pj4-clksel  o# 21742201100 pj4-cc!  ;  \ A 266, D 400, XP 400, B 400, P 800
+: 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]

Modified: cpu/arm/mmp2/fuse.fth
==============================================================================
--- cpu/arm/mmp2/fuse.fth	Thu May 31 20:33:33 2012	(r2992)
+++ cpu/arm/mmp2/fuse.fth	Thu May 31 22:07:15 2012	(r2993)
@@ -36,10 +36,11 @@
 ;
 : .3bits  ( n -- n' )  dup 7 and .d  3 rshift  ;
 string-array freqs  ," 800" ," 910" ," 1001" ," ??? " end-string-array
-: .max-freq  ( n -- ) ."  Max Freq: " 3 and freqs count type   ;
+: rated-speed  ( -- n )  h# 28a4 fuse@  d# 14 rshift 3 and  ;
+: .max-freq  ( -- ) ."  Max Freq: " rated-speed freqs count type   ;
 : .block3-brief  ( -- )
    ." Block 3 - Voltages: "  h# 28a0 fuse@  5 0 do  .3bits  loop  2/  .3bits drop
-   h# 28a4 fuse@  d# 14 rshift .max-freq  cr
+   .max-freq  cr
 ;
 : .block3  ( -- )
    ." Block 3" cr

Added: cpu/arm/olpc/banner.fth
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ cpu/arm/olpc/banner.fth	Thu May 31 22:07:15 2012	(r2993)
@@ -0,0 +1,180 @@
+\ See license at end of file
+purpose: Banner customization for this system
+
+headerless
+
+[ifdef] get-partition-from-driver
+: partition-end  ( name$ -- false | d.end true )
+   open-dev  ?dup  if                ( ihandle )
+      >r                             ( r: ihandle )
+      " offset-low" r@ $call-method  ( offset.low r: ihandle )
+      " offset-high" r@ $call-method ( d.offset r: ihandle )
+      " size" r@ $call-method        ( d.offset d.size r: ihandle )
+      d+                             ( d.end r: ihandle )
+      r> close-dev                   ( d.end )
+      true                           ( d.end true )
+   else                              ( )
+      false                          ( false )
+   then                              ( false | d.end true )
+;
+
+: .storage  ( -- )
+   " int:0" partition-end  if    ( d.size )
+      d# 200,000,000. d+         ( d.size' )  \ Round up
+      d# 1,000,000,000 um/mod    ( rem Gb )
+      nip  .d ." GB "            ( )
+   else                          ( )
+      ." No "                    ( )
+   then                          ( )
+   ." internal storage"          ( )
+;
+[then]
+
+h# 40 buffer: partition-map
+: partition-end  ( offset -- sector# )
+   partition-map +  dup le-l@    ( adr start )
+   swap la1+ le-l@ +             ( sector# )
+;
+
+0 value internal-disk-present?
+0. 2value internal-disk-size
+0. 2value internal-partition-end
+
+: get-internal-disk-info  ( -- )
+   " int:0" open-dev  ?dup  if          ( ihandle )
+      true to internal-disk-present?    ( ihandle )
+      >r                                                ( r: ihandle )
+      " size" r@ $call-method to internal-disk-size     ( r: ihandle )
+
+      h# 1be. " seek" r@ $call-method drop              ( r: ihandle )
+      partition-map h# 40 " read" r@ $call-method drop  ( r: ihandle )
+      r> close-dev                   ( )
+
+      0                              ( max-sector )
+      h# 40 h# 8  do                 ( max-sector )
+         i partition-end max         ( max-sector' )
+      h# 10 +loop                    ( max-sector' )
+      dup 0<  if                     ( max-sector' )
+         2drop                       ( )
+      else
+         d# 512 um* to internal-partition-end
+      then
+   else                              ( )
+      false to internal-disk-present?
+   then
+;
+
+: .storage  ( -- )
+   internal-disk-present? 0=  if ( )
+      get-internal-disk-info     ( )
+   then
+   internal-disk-present?  if    ( )
+      internal-disk-size         ( d.size )
+      d# 200,000,000.  d+        ( d.size' )  \ Round up
+      d# 1,000,000,000 um/mod    ( rem Gb )
+      nip  .d ." GB "            ( )
+   else                          ( )
+      ." No "                    ( )
+   then                          ( )
+   ." internal storage"          ( )
+;
+
+: check-internal-partitions  ( -- )
+   internal-disk-present?  0=  if  exit  then     ( )
+   internal-partition-end  d0=  if  exit  then    ( )
+
+   internal-disk-size internal-partition-end d<  if    ( )
+      red-letters
+      ." WARNING!  OS image larger than internal storage device!"  cr
+      cancel
+      exit
+   then
+
+   internal-partition-end d# 1,000,000,000. d+   internal-disk-size  d<  if
+      red-letters
+      ." WARNING!  OS image much smaller than internal storage device"  cr
+      cancel
+   then
+;
+
+: ofw-model$  ( -- adr len )
+   " /openprom" find-package drop  ( phandle )
+   " model" rot get-package-property  if  ( )
+      " ???   ?????  ???"          ( adr len )
+   else                            ( adr len )
+      decode-string 2nip           ( adr len' )
+   then                            ( adr len )
+;
+: ofw-version$  ( -- adr len )
+   ofw-model$ drop 6 +  7  -trailing
+;
+: .rom  ( -- )
+   ." OpenFirmware  "  ofw-version$ type
+;
+
+: .ec
+   " ec-name" ['] root-node  get-package-property  0=  if  ( adr len )
+      get-encoded-string  ." EC Firmware "  type
+   then
+;
+
+: .cpu-speed  ( -- )
+   rated-speed  case
+      0 of  ." 800 MHz"  endof
+      1 of  ." 910 MHz"  endof
+            ." 1 GHz"
+   endcase
+;
+: .memory-brief  ( -- )
+   memory-size dup d# 1024 / ?dup  if  ( mb gb )
+      nip " GiB" rot                   ( gb$ gb )
+   else                                ( mb )
+      " MiB" rot                       ( mb$ mb )
+   then                                ( m$ m )
+   .d  type ."  memory"                ( )
+;
+
+: (xbanner-basics)  ( -- )
+   ?spaces  cpu-model type  ." , " .cpu-speed  ." , "   .memory-brief
+   ." , " .storage
+   ." , S/N "  " SN" find-tag  if  type  else  ." Unknown"  then  cr
+   ?spaces  .rom  ."    " .ec  ."    " .clock
+   check-internal-partitions
+;
+' (xbanner-basics) to banner-basics
+
+' (banner-warnings) to banner-warnings
+
+: stop-auto?  ( -- flag )  idprom-valid? 0=  auto-boot?  and ;
+
+defer gui-banner  ' true to gui-banner
+: ?gui-banner  ( -- )
+   stop-auto?  if  suppress-auto-boot  then
+
+   gui-banner drop
+;
+
+headers
+\ LICENSE_BEGIN
+\ Copyright (c) 2006 FirmWorks
+\ 
+\ Permission is hereby granted, free of charge, to any person obtaining
+\ a copy of this software and associated documentation files (the
+\ "Software"), to deal in the Software without restriction, including
+\ without limitation the rights to use, copy, modify, merge, publish,
+\ distribute, sublicense, and/or sell copies of the Software, and to
+\ permit persons to whom the Software is furnished to do so, subject to
+\ the following conditions:
+\ 
+\ The above copyright notice and this permission notice shall be
+\ included in all copies or substantial portions of the Software.
+\ 
+\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+\
+\ LICENSE_END

Modified: cpu/arm/olpc/build-fw.fth
==============================================================================
--- cpu/arm/olpc/build-fw.fth	Thu May 31 20:33:33 2012	(r2992)
+++ cpu/arm/olpc/build-fw.fth	Thu May 31 22:07:15 2012	(r2993)
@@ -567,7 +567,7 @@
    then
 ;
 
-fload ${BP}/cpu/x86/pc/olpc/via/banner.fth
+fload ${BP}/cpu/arm/olpc/banner.fth
 
 \- olpc-cl3  devalias keyboard /ap-sp/keyboard
 \- olpc-cl3  devalias mouse    /ap-sp/mouse



More information about the openfirmware mailing list