<?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 Re: Kernel panic when disabling usb gadget in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/Kernel-panic-when-disabling-usb-gadget/m-p/1201501#M166697</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As patch shows,the&amp;nbsp;&lt;SPAN&gt;gadget&amp;nbsp;&lt;/SPAN&gt; is in&amp;nbsp;&lt;/P&gt;
&lt;PRE class="content"&gt;&lt;SPAN class="p_header"&gt;/include/linux/usb/gadget.h&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Zhiming&lt;/P&gt;</description>
    <pubDate>Fri, 18 Dec 2020 02:43:30 GMT</pubDate>
    <dc:creator>Zhiming_Liu</dc:creator>
    <dc:date>2020-12-18T02:43:30Z</dc:date>
    <item>
      <title>Kernel panic when disabling usb gadget</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Kernel-panic-when-disabling-usb-gadget/m-p/1201271#M166665</link>
      <description>&lt;P&gt;I'm using kernel 4.9.88 on an iMX6ULL.&lt;/P&gt;&lt;P&gt;Sometimes, when disabling the usb gadget (by echo "" &amp;gt; UDC) the module locks completely.&lt;/P&gt;&lt;P&gt;I found this patch from&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/33301"&gt;@PeterChen&lt;/a&gt;&amp;nbsp;for kernel 5.4:&lt;/P&gt;&lt;P&gt;&lt;A href="https://patches.linaro.org/patch/223191/" target="_blank"&gt;https://patches.linaro.org/patch/223191/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;and note that a similar problem was reported for kernel 4.4 (though patch was rejected) so assume it's the same issue in 4.9:&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.spinics.net/lists/linux-usb/msg159075.html" target="_blank"&gt;https://www.spinics.net/lists/linux-usb/msg159075.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Could someone advise how to back-port Peter's patch to 4.9.88?&lt;/P&gt;&lt;P&gt;I can see what needs applying to udc/core.c but can't see yet where the usb_gadget structure is created so I can add the irq member.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Dec 2020 14:09:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Kernel-panic-when-disabling-usb-gadget/m-p/1201271#M166665</guid>
      <dc:creator>chris_f</dc:creator>
      <dc:date>2020-12-17T14:09:37Z</dc:date>
    </item>
    <item>
      <title>Re: Kernel panic when disabling usb gadget</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Kernel-panic-when-disabling-usb-gadget/m-p/1201501#M166697</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As patch shows,the&amp;nbsp;&lt;SPAN&gt;gadget&amp;nbsp;&lt;/SPAN&gt; is in&amp;nbsp;&lt;/P&gt;
&lt;PRE class="content"&gt;&lt;SPAN class="p_header"&gt;/include/linux/usb/gadget.h&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Zhiming&lt;/P&gt;</description>
      <pubDate>Fri, 18 Dec 2020 02:43:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Kernel-panic-when-disabling-usb-gadget/m-p/1201501#M166697</guid>
      <dc:creator>Zhiming_Liu</dc:creator>
      <dc:date>2020-12-18T02:43:30Z</dc:date>
    </item>
    <item>
      <title>Re: Kernel panic when disabling usb gadget</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Kernel-panic-when-disabling-usb-gadget/m-p/1201659#M166711</link>
      <description>&lt;P&gt;Thanks Zhiming but I can't see where the new member gadget.irq is set?&lt;/P&gt;&lt;P&gt;There's a struct fsl_udc in fsl_udc_core which also has an irq member (and a gadget struct). That is set with platform_get_irq in fsl_udc_probe.&lt;/P&gt;&lt;P&gt;The patch creates a new member gadget.irq but it's never set?&lt;/P&gt;</description>
      <pubDate>Fri, 18 Dec 2020 08:00:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Kernel-panic-when-disabling-usb-gadget/m-p/1201659#M166711</guid>
      <dc:creator>chris_f</dc:creator>
      <dc:date>2020-12-18T08:00:49Z</dc:date>
    </item>
    <item>
      <title>Re: Kernel panic when disabling usb gadget</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Kernel-panic-when-disabling-usb-gadget/m-p/1202117#M166761</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, I saw the source code and it isn't used in&amp;nbsp;&lt;STRONG&gt;fsl_udc_remove&lt;/STRONG&gt;.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Dec 2020 02:04:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Kernel-panic-when-disabling-usb-gadget/m-p/1202117#M166761</guid>
      <dc:creator>Zhiming_Liu</dc:creator>
      <dc:date>2020-12-21T02:04:26Z</dc:date>
    </item>
    <item>
      <title>Re: Kernel panic when disabling usb gadget</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Kernel-panic-when-disabling-usb-gadget/m-p/1205481#M167125</link>
      <description>&lt;P&gt;I've now found the cause of the problem (the patch from&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/33301"&gt;@PeterChen&lt;/a&gt;&amp;nbsp;isn't relevant).&lt;/P&gt;&lt;P&gt;It is not a kernel panic, it's a kernel lock up in the ChipIdea udc driver.&lt;/P&gt;&lt;P&gt;The function hw_ep_flush never returns. It is waiting for the hardware to complete endpoint flush that never happens.&lt;/P&gt;&lt;P&gt;&lt;A href="https://elixir.bootlin.com/linux/latest/source/drivers/usb/chipidea/udc.c#L101" target="_blank"&gt;https://elixir.bootlin.com/linux/latest/source/drivers/usb/chipidea/udc.c#L101&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I've fixed this lock up by simply adding a timeout to that loop. If the flush doesn't complete we just continue as if it had. The next connection still works.&lt;/P&gt;&lt;P&gt;Further testing shows that there are other lock conditions that can occur (approx 1 in 200 connections) during connection/disconnection. There are a number of other loops in that code that will not exit unless the hardware complies.&lt;/P&gt;&lt;P&gt;I don't know if this hardware problem exists in other implementations using the ChipIdea driver but I can recreate it on multiple boards.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Dec 2020 11:13:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Kernel-panic-when-disabling-usb-gadget/m-p/1205481#M167125</guid>
      <dc:creator>chris_f</dc:creator>
      <dc:date>2020-12-31T11:13:23Z</dc:date>
    </item>
  </channel>
</rss>

