天天看點

access sd card in uboot

1.show all command of sd card

ZynqMP> mmc --help                                                              

mmc - MMC sub system                                                            

Usage:                                                                          

mmc info - display info of the current MMC device                               

mmc read addr blk# cnt                                                          

mmc write addr blk# cnt                                                         

mmc erase blk# cnt                                                              

mmc rescan                                                                      

mmc part - lists available partition on current mmc device                      

mmc dev [dev] [part] - show or set current mmc device [partition]               

mmc list - lists available devices                                              

mmc hwpartition [args...] - does hardware partitioning                          

  arguments (sizes in 512-byte blocks):                                         

    [user [enh start cnt] [wrrel {on|off}]] - sets user data area attributes    

    [gp1|gp2|gp3|gp4 cnt [enh] [wrrel {on|off}]] - general purpose partition    

    [check|set|complete] - mode, complete set partitioning completed            

  WARNING: Partitioning is a write-once setting once it is set to complete.     

  Power cycling is required to initialize partitions after set to complete.     

mmc bootbus dev boot_bus_width reset_boot_bus_width boot_mode                   

 - Set the BOOT_BUS_WIDTH field of the specified device                         

mmc bootpart-resize <dev> <boot part size MB> <RPMB part size MB>               

 - Change sizes of boot and RPMB partitions of specified device                 

mmc partconf dev [boot_ack boot_partition partition_access]                     

 - Show or change the bits of the PARTITION_CONFIG field of the specified device

mmc rst-function dev value                                                      

 - Change the RST_n_FUNCTION field of the specified device                      

   WARNING: This is a write-once field and 0 / 1 / 2 are the only valid values. 

mmc setdsr <value> - set DSR register value  

2.show the table of sdcard

ZynqMP> mmc part                                                                

Partition Map for MMC device 0  --   Partition Type: DOS                        

Part    Start Sector    Num Sectors     UUID            Type                    

  1     2048            1048576         1383d36e-01     0c                      

  2     1050624         14473216        1383d36e-02     83  

3.use fatls command to list file of sdcard

ZynqMP> fatls mmc 0:1                                                           

   153400   bl31.elf                                                            

 27658520   BOOT.BIN                                                            

            .Trash-1000/                                                        

 79314128   image.ub                                                            

            .Trash-0/                                                           

   154072   pmufw.elf                                                           

 26510901   system.bit                                                          

    41288   system.dtb                                                          

      415   uEnv.txt~                                                           

   903216   u-boot.elf                                                          

   141848   zynqmp_fsbl.elf                                                     

9 file(s), 2 dir(s)  

4.load file to ram

ZynqMP> fatload mmc 0:1 0x22000000 image.ub                                     

79314128 bytes read in 5183 ms (14.6 MiB/s)