u-boot mx535 mmc init code bug

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

u-boot mx535 mmc init code bug

706 次查看
marzo_pedro
Contributor I

Hello everyone, we have recently updated to version 11.09 of the u-boot & kernel for the Mx535, we use this code as a base to develop a Q7 MX535 module capable of booting from NAND or from SD using a dip switch.

In this new 11.09 version there is a new field has_init in the mmc struct of the u-boot.

This struct is allocated using a malloc in file drivers/mmc/imx_esdhc.c function fsl_esdhc_initialize, however the returned memory is not initialized to zero neither the has_init field of this struct is set to zero.

So when the function mmc_init checks if it has been initialized if (mmc->has_init){ ... the value has_init has a non zero value although it has never been initialized, and the mmc card (clocks and stuff like that) is never initialized, so it does not work.

I wondered why the freescale evaluation board was working, so I checked that this memory was written by a NAND function doing a malloc over this zone and then a free, if this NAND code is not executed the memory is returned initialized to zero (just a coincidence, but it is) so the problem arises when NAND is present.

With the freescale standard evaluation boards there is no problem, because they do not have NAND.

There is no problem either if you boot from the NAND, because you dont use the MMC software.

Conclusion:

I think the function fsl_esdhc_initialize should initialized the has_init to zero, even a memset to zero of the whole struct would be better a solution.

....

#ifdef CONFIG_EMMC_DDR_PORT_DETECT
        if (detect_mmc_emmc_ddr_port(cfg))
                mmc->host_caps |= EMMC_MODE_4BIT_DDR;
#endif
#endif /* #ifndef CONFIG_MX50_ENABLE_USDHC_SDR */
mmc->f_min = 400000;

mmc->f_max = MIN(mxc_get_clock(MXC_ESDHC_CLK), 52000000);
mmc->has_init=0;

....

Any comments about this?

Best Regards, Pedro.

标记 (2)
0 项奖励
回复
0 回复数