<?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>i.MX ProcessorsのトピックRe: Issue with mxc_spi.c when DM_SPI_FLASH is enabled. u-boot-imx v2020</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/Issue-with-mxc-spi-c-when-DM-SPI-FLASH-is-enabled-u-boot-imx/m-p/1417966#M187395</link>
    <description>&lt;P&gt;i.MX6Q SabreSD board and the u-boot version&amp;nbsp;rel_imx_5.4.70_2.3.2. We don't meet the issue. It should not be a driver problem. Please double check the dts compare with the SabreSD board.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://source.codeaurora.org/external/imx/uboot-imx/tree/arch/arm/dts/imx6q-sabresd.dts?h=rel_imx_5.4.70_2.3.2" target="_blank" rel="nofollow noopener noreferrer"&gt;https://source.codeaurora.org/external/imx/uboot-imx/tree/arch/arm/dts/imx6q-sabresd.dts?h=rel_imx_5...&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Log from i.MX6Q SabreSD board:&lt;/P&gt;
&lt;P&gt;U-Boot 2020.04-dirty&lt;/P&gt;
&lt;P&gt;CPU: i.MX6Q rev1.2 996 MHz (running at 792 MHz)&lt;BR /&gt;CPU: Extended Commercial temperature grade (-20C to 105C) at 44C&lt;BR /&gt;Reset cause: POR&lt;BR /&gt;Model: i.MX6 Quad SABRE Smart Device Board&lt;BR /&gt;Board: MX6-SabreSD&lt;BR /&gt;DRAM: 1 GiB&lt;BR /&gt;dev &lt;STRONG&gt;m25p80@0&lt;/STRONG&gt; spi_child_post_bind&lt;BR /&gt;spi_slave_ofdata_to_platdata &lt;STRONG&gt;cs 0&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Normal Boot&lt;BR /&gt;Hit any key to stop autoboot: 0&lt;BR /&gt;=&amp;gt;&lt;BR /&gt;=&amp;gt; sf probe&lt;BR /&gt;spi_find_bus_and_cs: No bus 0&lt;BR /&gt;spi_find_chip_select: plat=4df6c480, cs=0&lt;BR /&gt;mxc_spi_cs_activate &lt;STRONG&gt;m25p80@0 cs 0&lt;/STRONG&gt;&lt;BR /&gt;SF: Detected m25p32 with page size 256 Bytes, erase size 64 KiB, total 4 MiB&lt;BR /&gt;spi_get_bus_and_cs: bus=4df6c318, slave=4df75d08&lt;/P&gt;</description>
    <pubDate>Wed, 23 Feb 2022 06:46:54 GMT</pubDate>
    <dc:creator>jimmychan</dc:creator>
    <dc:date>2022-02-23T06:46:54Z</dc:date>
    <item>
      <title>Issue with mxc_spi.c when DM_SPI_FLASH is enabled. u-boot-imx v2020</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Issue-with-mxc-spi-c-when-DM-SPI-FLASH-is-enabled-u-boot-imx/m-p/1407581#M186541</link>
      <description>&lt;DIV&gt;Hi everyone,&lt;BR /&gt;&lt;BR /&gt;Recently I've been working on the upgrade of an old u-boot-imx to u-boot-imx v2020, and I encountered an issue when I enabled DM_SPI and DM_SPI_FLASH ! My board (based on IMX6) uses a NOR flash SPI to store the u-boot environment and the SPI interface is initialized early in boot.&lt;BR /&gt;Using the mxc_spi.c as a SPI driver for my IMX6 soc, after I enabled the two configs above I got a data abort !&lt;BR /&gt;&lt;BR /&gt;after thorough analysis and backtracking, i found the origin of the data abort (access to invalid memory region) which is in the function below from NXPs driver mxc_spi.c:&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;static void mxc_spi_cs_activate(struct mxc_spi_slave *mxcs)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;{&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;#if CONFIG_IS_ENABLED(DM_SPI)&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp;struct udevice *dev = mxcs-&amp;gt;dev;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp;struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev);&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp;u32 cs = slave_plat-&amp;gt;cs;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp;if (!dm_gpio_is_valid(&amp;amp;mxcs-&amp;gt;cs_gpios[cs]))&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;return;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp;dm_gpio_set_value(&amp;amp;mxcs-&amp;gt;cs_gpios[cs], 1);&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;#else&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp;if (mxcs-&amp;gt;gpio &amp;gt; 0)&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;gpio_set_value(mxcs-&amp;gt;gpio, mxcs-&amp;gt;ss_pol);&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;#endif&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;}&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;In this function the logic in activating the cs (chip select) is by getting the pin from the platdata of the device's parent and enabling it, as any DM driver would do.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;However, This function expects that the cs number from platdata (slave_plat-&amp;gt;cs in above code) corresponds to the position of the gpio tuple in the "cs-gpios" property from the FDT (e.g. tuple position in : cs-gpios = &amp;lt;&amp;amp;gpio1 0 0&amp;gt;, &amp;lt;0&amp;gt;, &amp;lt;&amp;amp;gpio1 1 0&amp;gt;, &amp;lt;&amp;amp;gpio1 2 0&amp;gt;;) and not the actual number of the cs gpio pin. But the issue is that what it gets from the platdata is the latter i.e. the cs gpio pin number ! And in my case the actual number of the cs gpio pin is 120 (GPIO4_IO24) which results in accessing the mxcs-&amp;gt;cs_gpios[120] knowing that the size of the table is only 4 ! which in turn leads to a data abort !&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;this issue is related also to spi_uclass.c, because, from what I could understand by reading the source code, the platdata for the device is not initialized properly ! the function spi-uclass.c/spi_slave_ofdata_to_platdata() responsible for initializing correctly the platdata from the values in the FDT, is never called ! because the "node" udevice property is null for the device, and node=null is set when binding the device to the driver via the function device_bind_driver() and never filled afterwards.&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I would like to know if there is an&amp;nbsp;issue about this in either drivers, or I'm missing something&amp;nbsp;in the code ?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Any help is greatly appreciated !&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thank you&lt;/DIV&gt;&lt;DIV&gt;--&lt;/DIV&gt;&lt;DIV&gt;Abder&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 01 Feb 2022 13:16:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Issue-with-mxc-spi-c-when-DM-SPI-FLASH-is-enabled-u-boot-imx/m-p/1407581#M186541</guid>
      <dc:creator>Abder</dc:creator>
      <dc:date>2022-02-01T13:16:36Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with mxc_spi.c when DM_SPI_FLASH is enabled. u-boot-imx v2020</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Issue-with-mxc-spi-c-when-DM-SPI-FLASH-is-enabled-u-boot-imx/m-p/1415032#M187103</link>
      <description>&lt;P&gt;Which version of Yocto BSP are you using?&lt;/P&gt;
&lt;P&gt;Do you set the pinmux setting for the gpio pin?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;e.g. in this u-boot imx6qdl-sabresd.dtsi, there is cs-gpios setting under the node &amp;amp;ecspi1.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://source.codeaurora.org/external/imx/uboot-imx/tree/arch/arm/dts/imx6qdl-sabresd.dtsi?h=imx_v2020.04_5.4.70_2.3.0" target="_blank"&gt;https://source.codeaurora.org/external/imx/uboot-imx/tree/arch/arm/dts/imx6qdl-sabresd.dtsi?h=imx_v2020.04_5.4.70_2.3.0&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;in this example, it use the gpio4_io09&lt;/P&gt;
&lt;P&gt;cs-gpios = &amp;lt;&amp;amp;gpio4 9 0&amp;gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And the pinmux setting of the gpio pin under pinctrl_ecspi1.&lt;/P&gt;
&lt;P&gt;MX6QDL_PAD_KEY_ROW1__GPIO4_IO09&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x1b0b0&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Feb 2022 06:47:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Issue-with-mxc-spi-c-when-DM-SPI-FLASH-is-enabled-u-boot-imx/m-p/1415032#M187103</guid>
      <dc:creator>jimmychan</dc:creator>
      <dc:date>2022-02-17T06:47:25Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with mxc_spi.c when DM_SPI_FLASH is enabled. u-boot-imx v2020</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Issue-with-mxc-spi-c-when-DM-SPI-FLASH-is-enabled-u-boot-imx/m-p/1415152#M187115</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Jimmychan,&lt;/P&gt;&lt;P&gt;am using Yocto dunfell for my build.&lt;/P&gt;&lt;P&gt;and the issue is not in the pin muxing for the cs pin, because that is correctly set in my DTB. In fact, if I replace mxcs-&amp;gt;cs_gpios[cs] by mxcs-&amp;gt;cs_gpios[0] in above code, everything works fine ! but that should be the value of the cs variable automatically... The slave_plat-&amp;gt;cs should return the number 0 as am defining only one cs gpio in the DTB e.g. cs-gpios = &amp;lt;&amp;amp;gpio4 24 0&amp;gt;;.&lt;/P&gt;&lt;P&gt;Best regards&lt;BR /&gt;--&lt;BR /&gt;Abder&lt;/P&gt;</description>
      <pubDate>Thu, 17 Feb 2022 09:13:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Issue-with-mxc-spi-c-when-DM-SPI-FLASH-is-enabled-u-boot-imx/m-p/1415152#M187115</guid>
      <dc:creator>Abder</dc:creator>
      <dc:date>2022-02-17T09:13:58Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with mxc_spi.c when DM_SPI_FLASH is enabled. u-boot-imx v2020</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Issue-with-mxc-spi-c-when-DM-SPI-FLASH-is-enabled-u-boot-imx/m-p/1417966#M187395</link>
      <description>&lt;P&gt;i.MX6Q SabreSD board and the u-boot version&amp;nbsp;rel_imx_5.4.70_2.3.2. We don't meet the issue. It should not be a driver problem. Please double check the dts compare with the SabreSD board.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://source.codeaurora.org/external/imx/uboot-imx/tree/arch/arm/dts/imx6q-sabresd.dts?h=rel_imx_5.4.70_2.3.2" target="_blank" rel="nofollow noopener noreferrer"&gt;https://source.codeaurora.org/external/imx/uboot-imx/tree/arch/arm/dts/imx6q-sabresd.dts?h=rel_imx_5...&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Log from i.MX6Q SabreSD board:&lt;/P&gt;
&lt;P&gt;U-Boot 2020.04-dirty&lt;/P&gt;
&lt;P&gt;CPU: i.MX6Q rev1.2 996 MHz (running at 792 MHz)&lt;BR /&gt;CPU: Extended Commercial temperature grade (-20C to 105C) at 44C&lt;BR /&gt;Reset cause: POR&lt;BR /&gt;Model: i.MX6 Quad SABRE Smart Device Board&lt;BR /&gt;Board: MX6-SabreSD&lt;BR /&gt;DRAM: 1 GiB&lt;BR /&gt;dev &lt;STRONG&gt;m25p80@0&lt;/STRONG&gt; spi_child_post_bind&lt;BR /&gt;spi_slave_ofdata_to_platdata &lt;STRONG&gt;cs 0&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Normal Boot&lt;BR /&gt;Hit any key to stop autoboot: 0&lt;BR /&gt;=&amp;gt;&lt;BR /&gt;=&amp;gt; sf probe&lt;BR /&gt;spi_find_bus_and_cs: No bus 0&lt;BR /&gt;spi_find_chip_select: plat=4df6c480, cs=0&lt;BR /&gt;mxc_spi_cs_activate &lt;STRONG&gt;m25p80@0 cs 0&lt;/STRONG&gt;&lt;BR /&gt;SF: Detected m25p32 with page size 256 Bytes, erase size 64 KiB, total 4 MiB&lt;BR /&gt;spi_get_bus_and_cs: bus=4df6c318, slave=4df75d08&lt;/P&gt;</description>
      <pubDate>Wed, 23 Feb 2022 06:46:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Issue-with-mxc-spi-c-when-DM-SPI-FLASH-is-enabled-u-boot-imx/m-p/1417966#M187395</guid>
      <dc:creator>jimmychan</dc:creator>
      <dc:date>2022-02-23T06:46:54Z</dc:date>
    </item>
  </channel>
</rss>

