[openfirmware] [commit] r1907 - dev/mmc/sdhci

repository service svn at openfirmware.info
Wed Aug 4 06:44:34 CEST 2010


Author: wmb
Date: Wed Aug  4 06:44:34 2010
New Revision: 1907
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/1907

Log:
SD driver - added "show-cid" command.

Modified:
   dev/mmc/sdhci/sdhci.fth
   dev/mmc/sdhci/sdmmc.fth

Modified: dev/mmc/sdhci/sdhci.fth
==============================================================================
--- dev/mmc/sdhci/sdhci.fth	Tue Aug  3 21:52:21 2010	(r1906)
+++ dev/mmc/sdhci/sdhci.fth	Wed Aug  4 06:44:34 2010	(r1907)
@@ -408,7 +408,7 @@
 
 \ Get Card-specific data
 : get-csd    ( -- )  rca  h# 0909 0 cmd  csd get-response136  ;  \ CMD9 R2
-: get-cid    ( -- )  rca  h# 0a09 0 cmd  cid get-response136  ;  \ CMD10 R2 UNTESTED
+: get-cid    ( -- )  rca  h# 0a09 0 cmd  cid get-response136  ;  \ CMD10 R2
 
 : stop-transmission  ( -- )  rca  h# 0c1b 0 cmd  ;        \ CMD12 R1b UNTESTED
 
@@ -824,6 +824,7 @@
    card-clock-25
 
    get-csd           \ Cmd 9 - Get card-specific data
+   get-cid           \ Cmd 10 - Get card ID
 
    select-card       \ Cmd 7 - Select
 
@@ -962,6 +963,21 @@
    unmap-regs
 ;
 
+: cid@  ( offset -- byte )  cid + c@  ;
+: .nospace  <# u#s u#> type  ;
+: show-cid  ( -- )
+   base @ >r hex
+   ." Mfg ID: " d# 14 cid@ ." 0x" .nospace
+   ."   OEM ID: " d# 13 cid@ emit  d# 12 cid@ emit
+   ."   Name: "  7 d# 11  do  i cid@ emit  -1 +loop
+   ."   Rev: " 6 cid@  dup 4 rshift .nospace ." ." h# f and .nospace
+   decimal
+   ."   Date: "  0 cid@ 1 cid@ bwjoin  dup 4 rshift d# 2000 + .nospace ." -" h# f and .nospace
+   hex
+   ."   SN: " 2 cid@ 3 cid@ 4 cid@ 5 cid@ bljoin ." 0x" .nospace
+   r> base !
+;
+
 \ The bit numbering follows the table on page 78 of the
 \ SD Physical Layer Simplified Specification Version 2.00.
 

Modified: dev/mmc/sdhci/sdmmc.fth
==============================================================================
--- dev/mmc/sdhci/sdmmc.fth	Tue Aug  3 21:52:21 2010	(r1906)
+++ dev/mmc/sdhci/sdmmc.fth	Wed Aug  4 06:44:34 2010	(r1907)
@@ -105,6 +105,8 @@
 : load  ( addr -- size )            " load"  label-package $call-method  ;
 
 : size  ( -- d.size )  " size" label-package $call-method  ;
+
+: show-cid  ( -- )  " show-cid" $call-parent  ;
 headers
 
 \ LICENSE_BEGIN



More information about the openfirmware mailing list