Author: wmb Date: Tue Nov 23 23:37:52 2010 New Revision: 2034 URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2034
Log: SDHCI - solidified support for SDHCI version 3 clock divisor layout and made 50 MHz operation work reasonably well for XO-1.75.
Modified: cpu/arm/olpc/1.75/sdhci.fth dev/mmc/sdhci/sdhci.fth
Modified: cpu/arm/olpc/1.75/sdhci.fth ============================================================================== --- cpu/arm/olpc/1.75/sdhci.fth Tue Nov 23 23:34:45 2010 (r2033) +++ cpu/arm/olpc/1.75/sdhci.fth Tue Nov 23 23:37:52 2010 (r2034) @@ -5,16 +5,9 @@ fload ${BP}/cpu/arm/olpc/1.75/sdregs.fth fload ${BP}/dev/mmc/sdhci/sdhci.fth
- true to avoid-high-speed? +\ true to avoid-high-speed?
hex - \ The new clock divisor layout is low 8 bits in [15:8] and high 2 bits in [7:6] - \ The resulting 10-bit value is multiplied by 2 to form the divisor for the - \ 200 MHz base clock. - patch 403 103 card-clock-25 \ n is 4, divisor is 8, clk is 25 MHz - patch 203 003 card-clock-50 \ n is 2, divisor is 4, clk is 50 MHz - patch 043 8003 card-clock-slow \ n is h# 100 (high 2 bits in [7:6], for divisor of 512 from 200 MHz clock - : olpc-card-inserted? ( -- flag ) slot 1 = if d# 31 gpio-pin@ 0= else true then ;
Modified: dev/mmc/sdhci/sdhci.fth ============================================================================== --- dev/mmc/sdhci/sdhci.fth Tue Nov 23 23:34:45 2010 (r2033) +++ dev/mmc/sdhci/sdhci.fth Tue Nov 23 23:37:52 2010 (r2034) @@ -135,20 +135,24 @@ : card-clock-on ( -- ) h# 2c cw@ 4 or h# 2c cw! ; : card-clock-off ( -- ) h# 2c cw@ 4 invert and h# 2c cw! ;
+: sdhci-version3? ( -- flag ) h# fe cw@ h# ff and 2 >= ; : card-clock-slow ( -- ) \ Less than 400 kHz, for init card-clock-off - h# 8003 h# 2c cw! \ Set divisor to 2^128, leaving internal clock on + \ Set divisor, leaving internal clock on + sdhci-version3? if h# 43 else h# 8001 then h# 2c cw! card-clock-on ;
: card-clock-25 ( -- ) card-clock-off - h# 103 h# 2c cw! \ Set divisor to 2^1, leaving internal clock on + \ Set divisor, leaving internal clock on + sdhci-version3? if h# 403 else h# 103 then h# 2c cw! card-clock-on ; : card-clock-50 ( -- ) card-clock-off - h# 003 \ division = 2^0, clocks on + \ Set divisor, leaving internal clock on + sdhci-version3? if h# 203 else h# 001 then
?cafe-fpga-quirk
@@ -659,6 +663,7 @@
\ Ask if high-speed is supported h# 00ff.fff1 switch-function d# 13 + c@ 2 and if \ cmd6 + 2 ms h# 80ff.fff1 switch-function drop \ Perform the switch cmd6 \ Bump the host controller clock host-high-speed \ Changes the clock edge