<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic u-boot mx535 mmc init code bug in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/u-boot-mx535-mmc-init-code-bug/m-p/163987#M4037</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone, we have recently updated to version 11.09 of the u-boot &amp;amp; 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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this new 11.09 version there is a new field &lt;EM&gt;has_init&lt;/EM&gt; in the mmc struct of the u-boot.&lt;/P&gt;&lt;P&gt;This struct is allocated using a malloc in file drivers/mmc/imx_esdhc.c function f&lt;EM&gt;sl_esdhc_initialize&lt;/EM&gt;, however the returned memory is not initialized to zero neither the &lt;EM&gt;has_init&lt;/EM&gt; field of this struct is set to zero.&lt;/P&gt;&lt;P&gt;So when the function &lt;EM&gt;mmc_init&lt;/EM&gt; checks if it has been initialized &lt;EM&gt;if (mmc-&amp;gt;has_init){&lt;/EM&gt; ... the value &lt;EM&gt;has_init&lt;/EM&gt; 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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;With the freescale standard evaluation boards there is no problem, because they do not have NAND.&lt;/P&gt;&lt;P&gt;There is no problem either if you boot from the NAND, because you dont use the MMC software.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Conclusion:&lt;/P&gt;&lt;P&gt;I think the function f&lt;EM&gt;sl_esdhc_initialize&lt;/EM&gt; should initialized the has_init to zero, even a memset to zero of the whole struct would be better a solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;#ifdef CONFIG_EMMC_DDR_PORT_DETECT&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (detect_mmc_emmc_ddr_port(cfg))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mmc-&amp;gt;host_caps |= EMMC_MODE_4BIT_DDR;&lt;BR /&gt;#endif&lt;BR /&gt;#endif /* #ifndef CONFIG_MX50_ENABLE_USDHC_SDR */&lt;BR /&gt;mmc-&amp;gt;f_min = 400000;&lt;/P&gt;&lt;P&gt;mmc-&amp;gt;f_max = MIN(mxc_get_clock(MXC_ESDHC_CLK), 52000000);&lt;BR /&gt;mmc-&amp;gt;has_init=0;&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any comments about this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards, Pedro.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 May 2012 16:14:20 GMT</pubDate>
    <dc:creator>marzo_pedro</dc:creator>
    <dc:date>2012-05-29T16:14:20Z</dc:date>
    <item>
      <title>u-boot mx535 mmc init code bug</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/u-boot-mx535-mmc-init-code-bug/m-p/163987#M4037</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone, we have recently updated to version 11.09 of the u-boot &amp;amp; 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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this new 11.09 version there is a new field &lt;EM&gt;has_init&lt;/EM&gt; in the mmc struct of the u-boot.&lt;/P&gt;&lt;P&gt;This struct is allocated using a malloc in file drivers/mmc/imx_esdhc.c function f&lt;EM&gt;sl_esdhc_initialize&lt;/EM&gt;, however the returned memory is not initialized to zero neither the &lt;EM&gt;has_init&lt;/EM&gt; field of this struct is set to zero.&lt;/P&gt;&lt;P&gt;So when the function &lt;EM&gt;mmc_init&lt;/EM&gt; checks if it has been initialized &lt;EM&gt;if (mmc-&amp;gt;has_init){&lt;/EM&gt; ... the value &lt;EM&gt;has_init&lt;/EM&gt; 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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;With the freescale standard evaluation boards there is no problem, because they do not have NAND.&lt;/P&gt;&lt;P&gt;There is no problem either if you boot from the NAND, because you dont use the MMC software.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Conclusion:&lt;/P&gt;&lt;P&gt;I think the function f&lt;EM&gt;sl_esdhc_initialize&lt;/EM&gt; should initialized the has_init to zero, even a memset to zero of the whole struct would be better a solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;#ifdef CONFIG_EMMC_DDR_PORT_DETECT&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (detect_mmc_emmc_ddr_port(cfg))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mmc-&amp;gt;host_caps |= EMMC_MODE_4BIT_DDR;&lt;BR /&gt;#endif&lt;BR /&gt;#endif /* #ifndef CONFIG_MX50_ENABLE_USDHC_SDR */&lt;BR /&gt;mmc-&amp;gt;f_min = 400000;&lt;/P&gt;&lt;P&gt;mmc-&amp;gt;f_max = MIN(mxc_get_clock(MXC_ESDHC_CLK), 52000000);&lt;BR /&gt;mmc-&amp;gt;has_init=0;&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any comments about this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards, Pedro.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 May 2012 16:14:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/u-boot-mx535-mmc-init-code-bug/m-p/163987#M4037</guid>
      <dc:creator>marzo_pedro</dc:creator>
      <dc:date>2012-05-29T16:14:20Z</dc:date>
    </item>
  </channel>
</rss>

