<?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 Control USB Vbus in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/Control-USB-Vbus/m-p/1334620#M179537</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am working on i.MX6 Quad. I want to set vbus on/off through &lt;STRONG&gt;libusb&lt;/STRONG&gt;, but it seems that chipidea driver doesn't allow this because it check for&amp;nbsp;CI_HDRC_TURN_VBUS_EARLY_ON in&amp;nbsp;&lt;STRONG&gt;host_start&amp;nbsp;&lt;/STRONG&gt;function so&amp;nbsp; the&amp;nbsp;&lt;STRONG&gt;priv-&amp;gt;reg_vbus&lt;/STRONG&gt; is always &lt;STRONG&gt;NULL&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;EM&gt;priv-&amp;gt;reg_vbus = NULL;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;if (ci-&amp;gt;platdata-&amp;gt;reg_vbus &amp;amp;&amp;amp; !ci_otg_is_fsm_mode(ci)) {&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; if (ci-&amp;gt;platdata-&amp;gt;flags &amp;amp; &lt;FONT color="#FF0000"&gt;CI_HDRC_TURN_VBUS_EARLY_ON&lt;/FONT&gt;) {&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ret = regulator_enable(ci-&amp;gt;platdata-&amp;gt;reg_vbus);&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (ret) {&amp;nbsp;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dev_err(ci-&amp;gt;dev,&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Failed to enable vbus regulator, ret=%d\n",ret);&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; goto put_hcd;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; } else {&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;FONT color="#FF0000"&gt;priv-&amp;gt;reg_vbus = ci-&amp;gt;platdata-&amp;gt;reg_vbus;&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;because&amp;nbsp;&lt;STRONG&gt;priv-&amp;gt;reg_vbus = NULL&lt;/STRONG&gt;&amp;nbsp;the following condition is not satisfied in&amp;nbsp;&lt;STRONG&gt;ehci_ci_portpower&amp;nbsp;&lt;/STRONG&gt;function:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;if (priv-&amp;gt;reg_vbus &amp;amp;&amp;amp; enable != priv-&amp;gt;enabled)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;So the&amp;nbsp;&lt;EM&gt;regulator_enable(priv-&amp;gt;reg_vbus)&lt;/EM&gt;/&lt;EM&gt;regulator_disable(priv-&amp;gt;reg_vbus)&lt;/EM&gt; are not called.&lt;/P&gt;&lt;P&gt;The question is: it is safe to do always&amp;nbsp;&lt;STRONG&gt;priv-&amp;gt;reg_vbus =&lt;EM&gt;ci-&amp;gt;platdata-&amp;gt;reg_vbus &lt;/EM&gt;&lt;/STRONG&gt;in&amp;nbsp;&lt;STRONG&gt;host_start ?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;if (ci-&amp;gt;platdata-&amp;gt;reg_vbus &amp;amp;&amp;amp; !ci_otg_is_fsm_mode(ci)) {&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; if (ci-&amp;gt;platdata-&amp;gt;flags &amp;amp; CI_HDRC_TURN_VBUS_EARLY_ON) {&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;FONT color="#008000"&gt;priv-&amp;gt;reg_vbus = ci-&amp;gt;platdata-&amp;gt;reg_vbus;&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ret = regulator_enable(ci-&amp;gt;platdata-&amp;gt;reg_vbus);&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (ret) {&amp;nbsp;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dev_err(ci-&amp;gt;dev,&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Failed to enable vbus regulator, ret=%d\n",ret);&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; goto put_hcd;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; }&amp;nbsp;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;So the condition&amp;nbsp;if (priv-&amp;gt;reg_vbus &amp;amp;&amp;amp; enable != priv-&amp;gt;enabled) in&amp;nbsp;&lt;STRONG&gt;ehci_ci_portpower &lt;/STRONG&gt;&lt;/EM&gt;is true and&amp;nbsp;regulator_disable/regulator_enable can be called.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Best Regards&lt;/EM&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 03 Sep 2021 06:55:08 GMT</pubDate>
    <dc:creator>mohamed-ali_fod</dc:creator>
    <dc:date>2021-09-03T06:55:08Z</dc:date>
    <item>
      <title>Control USB Vbus</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Control-USB-Vbus/m-p/1334620#M179537</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am working on i.MX6 Quad. I want to set vbus on/off through &lt;STRONG&gt;libusb&lt;/STRONG&gt;, but it seems that chipidea driver doesn't allow this because it check for&amp;nbsp;CI_HDRC_TURN_VBUS_EARLY_ON in&amp;nbsp;&lt;STRONG&gt;host_start&amp;nbsp;&lt;/STRONG&gt;function so&amp;nbsp; the&amp;nbsp;&lt;STRONG&gt;priv-&amp;gt;reg_vbus&lt;/STRONG&gt; is always &lt;STRONG&gt;NULL&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;EM&gt;priv-&amp;gt;reg_vbus = NULL;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;if (ci-&amp;gt;platdata-&amp;gt;reg_vbus &amp;amp;&amp;amp; !ci_otg_is_fsm_mode(ci)) {&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; if (ci-&amp;gt;platdata-&amp;gt;flags &amp;amp; &lt;FONT color="#FF0000"&gt;CI_HDRC_TURN_VBUS_EARLY_ON&lt;/FONT&gt;) {&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ret = regulator_enable(ci-&amp;gt;platdata-&amp;gt;reg_vbus);&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (ret) {&amp;nbsp;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dev_err(ci-&amp;gt;dev,&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Failed to enable vbus regulator, ret=%d\n",ret);&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; goto put_hcd;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; } else {&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;FONT color="#FF0000"&gt;priv-&amp;gt;reg_vbus = ci-&amp;gt;platdata-&amp;gt;reg_vbus;&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;because&amp;nbsp;&lt;STRONG&gt;priv-&amp;gt;reg_vbus = NULL&lt;/STRONG&gt;&amp;nbsp;the following condition is not satisfied in&amp;nbsp;&lt;STRONG&gt;ehci_ci_portpower&amp;nbsp;&lt;/STRONG&gt;function:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;if (priv-&amp;gt;reg_vbus &amp;amp;&amp;amp; enable != priv-&amp;gt;enabled)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;So the&amp;nbsp;&lt;EM&gt;regulator_enable(priv-&amp;gt;reg_vbus)&lt;/EM&gt;/&lt;EM&gt;regulator_disable(priv-&amp;gt;reg_vbus)&lt;/EM&gt; are not called.&lt;/P&gt;&lt;P&gt;The question is: it is safe to do always&amp;nbsp;&lt;STRONG&gt;priv-&amp;gt;reg_vbus =&lt;EM&gt;ci-&amp;gt;platdata-&amp;gt;reg_vbus &lt;/EM&gt;&lt;/STRONG&gt;in&amp;nbsp;&lt;STRONG&gt;host_start ?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;if (ci-&amp;gt;platdata-&amp;gt;reg_vbus &amp;amp;&amp;amp; !ci_otg_is_fsm_mode(ci)) {&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; if (ci-&amp;gt;platdata-&amp;gt;flags &amp;amp; CI_HDRC_TURN_VBUS_EARLY_ON) {&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;FONT color="#008000"&gt;priv-&amp;gt;reg_vbus = ci-&amp;gt;platdata-&amp;gt;reg_vbus;&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ret = regulator_enable(ci-&amp;gt;platdata-&amp;gt;reg_vbus);&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (ret) {&amp;nbsp;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dev_err(ci-&amp;gt;dev,&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Failed to enable vbus regulator, ret=%d\n",ret);&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; goto put_hcd;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; }&amp;nbsp;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;So the condition&amp;nbsp;if (priv-&amp;gt;reg_vbus &amp;amp;&amp;amp; enable != priv-&amp;gt;enabled) in&amp;nbsp;&lt;STRONG&gt;ehci_ci_portpower &lt;/STRONG&gt;&lt;/EM&gt;is true and&amp;nbsp;regulator_disable/regulator_enable can be called.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Best Regards&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Sep 2021 06:55:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Control-USB-Vbus/m-p/1334620#M179537</guid>
      <dc:creator>mohamed-ali_fod</dc:creator>
      <dc:date>2021-09-03T06:55:08Z</dc:date>
    </item>
    <item>
      <title>Re: Control USB Vbus</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Control-USB-Vbus/m-p/1336729#M179759</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;The purpose is to disable Vbus in case of over-current from user space or is it already managed in the driver?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Mohamed Ali&lt;/P&gt;</description>
      <pubDate>Wed, 08 Sep 2021 09:07:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Control-USB-Vbus/m-p/1336729#M179759</guid>
      <dc:creator>mohamed-ali_fod</dc:creator>
      <dc:date>2021-09-08T09:07:43Z</dc:date>
    </item>
    <item>
      <title>Re: Control USB Vbus</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Control-USB-Vbus/m-p/1341832#M180262</link>
      <description>&lt;P&gt;You can refer to this &lt;A href="https://community.nxp.com/t5/i-MX-Processors/Disable-USB-VBUS-power-supply/m-p/884711" target="_blank"&gt;https://community.nxp.com/t5/i-MX-Processors/Disable-USB-VBUS-power-supply/m-p/884711&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Sep 2021 02:17:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Control-USB-Vbus/m-p/1341832#M180262</guid>
      <dc:creator>Rita_Wang</dc:creator>
      <dc:date>2021-09-17T02:17:27Z</dc:date>
    </item>
  </channel>
</rss>

