Cyclone5 - Uboot based on SOCFPGA


I have a Terasic SOCkit for Altera’s Cyclone 5 fpga. I’m bringing up U-Boot and customizing it to adopt our development environment. I downloaded U-Boot v2017.11.

What I want to achieve is: initialize mmc in dram_init so that I can access u-boot environment early. But when I call mmc_initialize() in dram_init; mmc_initialize() reports it has already been initialized (though a static variable controlling this is ‘0’). And when mmc_initialize() is called later (from initr_mmc); it initializes correctly. How can I get mmc_initialize to work properly while I’m running board_f functions (not from board_r).
Much appreciate the help.