Changes between Initial Version and Version 1 of USB


Ignore:
Timestamp:
10/24/2017 04:37:41 AM (7 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • USB

    v1 v1  
     1{{{#!html
     2          <div id="wikipage" class="trac-content"><p>
     3</p><div class="wiki-toc">
     4<ol>
     5  <li>
     6    <a href="#UniversalSerialBusUSB"><b style="color:#000;background:#66ffff">Universal Serial Bus (USB</b>)</a>
     7    <ol>
     8      <li>
     9        <a href="#Versions">Versions</a>
     10      </li>
     11      <li>
     12        <a href="#HostControllers">Host Controllers</a>
     13      </li>
     14      <li>
     15        <a href="#USBSpeeds"><b style="color:#000;background:#ffff66">USB</b> Speeds</a>
     16      </li>
     17      <li>
     18        <a href="#USBTransfertypes"><b style="color:#000;background:#ffff66">USB</b> Transfer types</a>
     19      </li>
     20      <li>
     21        <a href="#USBDeviceClasses"><b style="color:#000;background:#ffff66">USB</b> Device Classes</a>
     22      </li>
     23      <li>
     24        <a href="#HumanInterfaceDevice">Human Interface Device</a>
     25      </li>
     26      <li>
     27        <a href="#VendorSpecific">Vendor Specific</a>
     28      </li>
     29      <li>
     30        <a href="#GateworksUSBdevices">Gateworks <b style="color:#000;background:#ffff66">USB</b> devices</a>
     31      </li>
     32      <li>
     33        <a href="#USBSteering"><b style="color:#000;background:#ffff66">USB</b> Steering</a>
     34      </li>
     35      <li>
     36        <a href="#USBReset"><b style="color:#000;background:#ffff66">USB</b> Reset</a>
     37        <ol>
     38          <li>
     39            <a href="#VBUSreset">VBUS reset</a>
     40          </li>
     41          <li>
     42            <a href="#Softresetviasysfsbindunbindre-enumerate">Soft reset via sysfs bind/unbind (re-enumerate)</a>
     43          </li>
     44          <li>
     45            <a href="#Softresetviaioctl">Soft reset via ioctl</a>
     46          </li>
     47        </ol>
     48      </li>
     49    </ol>
     50  </li>
     51</ol>
     52</div><p>
     53</p>
     54<h1 id="UniversalSerialBusUSB"><b style="color:#000;background:#66ffff">Universal Serial Bus (USB</b>)</h1>
     55<p>
     56<b style="color:#000;background:#66ffff">Universal Serial Bus (USB</b>) is an industry standard developed in the mid-90's that defines cables, connectors and communication protocols used in a bus between computers and peripherals.
     57</p>
     58<p>
     59References:
     60</p>
     61<ul><li><a class="ext-link" href="http://www.cypress.com/?docID=50830"><span class="icon">​</span>AN57294 - <b style="color:#000;background:#ffff66">USB</b> 101: An Introduction to Universal Serial Bus 2.0</a> - Cypress App Note does a good job of summarizing
     62</li><li><a class="ext-link" href="http://en.wikipedia.org/wiki/USB"><span class="icon">​</span>http://en.wikipedia.org/wiki/<b style="color:#000;background:#ffff66">USB</b></a>
     63</li></ul><h2 id="Versions">Versions</h2>
     64<ul><li><b style="color:#000;background:#ffff66">USB</b> 1.0 - <strong><b style="color:#000;background:#ffff66">USB</b> LowSpeed (1.5mbps)</strong> and <b style="color:#000;background:#ffff66">USB</b> <strong>FullSpeed (12mbps)</strong>
     65</li><li><b style="color:#000;background:#ffff66">USB</b> 2.0 - adds <strong><b style="color:#000;background:#ffff66">USB</b> HighSpeed (480mbps)</strong>
     66</li><li><b style="color:#000;background:#ffff66">USB</b> 3.0 - adds <strong><b style="color:#000;background:#ffff66">USB</b> SuperSpeed (10gbps)</strong>
     67</li></ul><h2 id="HostControllers">Host Controllers</h2>
     68<p>
     69The following types of <b style="color:#000;background:#ffff66">USB</b> host controllers exist:
     70</p>
     71<ul><li><strong>Universal Host Controller Interface (UHCI)</strong>: Produced by Intel for <b style="color:#000;background:#ffff66">USB</b> 1.0 and <b style="color:#000;background:#ffff66">USB</b> 1.1. Using UHCI requires a license from Intel. This controller supports both LowSpeed and Full-Speed.
     72</li><li><strong>Open Host Controller Interface (OHCI)</strong>: Produced for <b style="color:#000;background:#ffff66">USB</b> 1.0 and 1.1 by Compaq, Microsoft, and National Semiconductor. Supports Low-Speed and Full-Speed and tends to be more efficient then UHCI by performing more functionality in hardware.
     73</li><li><strong>Extended Host Controller Interface (EHCI)</strong>: Created for <b style="color:#000;background:#ffff66">USB</b> 2.0 after <b style="color:#000;background:#ffff66">USB</b>-IF requested that a single host controller specification be created. EHCI is used for HighSpeed transactions and delegates Low-Speed and FullSpeed transactions to an OHCI or UHCI sister controller.
     74</li></ul><h2 id="USBSpeeds"><b style="color:#000;background:#ffff66">USB</b> Speeds</h2>
     75<p>
     76The following is a set of supported speeds per <b style="color:#000;background:#ffff66">USB</b> specification:
     77</p>
     78<ul><li><strong><b style="color:#000;background:#ffff66">USB</b> LowSpeed (1.5mbps)</strong> (<b style="color:#000;background:#ffff66">USB</b> 1.0 UHCI/OHCI) - Only supports Control and Interrupt transfer types
     79</li><li><strong><b style="color:#000;background:#ffff66">USB</b> FullSpeed (12mbps)</strong> (<b style="color:#000;background:#ffff66">USB</b> 1.0 UHCI/OHCI)
     80</li><li><strong><b style="color:#000;background:#ffff66">USB</b> HighSpeed (480mbps)</strong> (<b style="color:#000;background:#ffff66">USB</b> 2.0 EHCI)
     81</li><li><strong><b style="color:#000;background:#ffff66">USB</b> SuperSpeed (10gbps)</strong> (<b style="color:#000;background:#ffff66">USB</b> 3.0 XHCI)
     82</li></ul><h2 id="USBTransfertypes"><b style="color:#000;background:#ffff66">USB</b> Transfer types</h2>
     83<p>
     84There are four types of transfers in <b style="color:#000;background:#ffff66">USB</b>:
     85</p>
     86<ul><li><strong>Control Transfers</strong> Used for sending commands to the device, make inquiries, and configure the device. This transfer uses the control pipe.
     87</li><li><strong>Interrupt Transfers</strong> Used for sending small amounts of bursty data that requires a guaranteed minimum latency. This transfer uses a data pipe.
     88</li><li><strong>Bulk Transfers</strong> Used for large data transfers that use all available <b style="color:#000;background:#ffff66">USB</b> bandwidth with no guarantee on transfer speed or latency. This transfer uses a data pipe.
     89</li><li><strong>Isochronous Transfers</strong> Used for data that requires a guaranteed data delivery rate. Isochronous transfers are capable of this guaranteed delivery time due to their guaranteed latency, guaranteed bus bandwidth, and lack of error correction. Without the error correction, there is no halt in transmission while packets containing errors are resent. This transfer uses a data pipe.
     90</li></ul><h2 id="USBDeviceClasses"><b style="color:#000;background:#ffff66">USB</b> Device Classes</h2>
     91<p>
     92<b style="color:#000;background:#ffff66">USB</b> has a list of recognized and approved <b style="color:#000;background:#ffff66">USB</b> device classes in order to simplify driver development. The most common device classes are:
     93</p>
     94<ul><li>Human Interface Device (HID):
     95<ul><li>Supports Control and Interrupt transfer types
     96</li><li>has a max FullSpeed rate of ~64KB/s
     97</li><li>standard driver in all modern OS
     98</li></ul></li><li>Mass Storage Device (MSD)
     99<ul><li>standard driver in all modern OS
     100</li></ul></li><li>Communication Device Class (CDC)
     101<ul><li>Supports Bulk and Isochronous transfer types
     102</li><li>has a max FullSpeed rate of ~80KB/s
     103</li><li>standard driver in all modern OS
     104</li></ul></li><li>Vendor (Vendor Specific)
     105<ul><li>Supports all four transfer types
     106</li><li>has a max FullSpeed rate of ~1MB/s
     107</li><li>requires custom driver (but can be userspace through libusb)
     108</li></ul></li></ul><h2 id="HumanInterfaceDevice">Human Interface Device</h2>
     109<p>
     110Often vendors choose <strong>HID device class</strong> to allow control via userspace applications without needing a OS specific driver (as all modern OS's have an HID driver).
     111</p>
     112<p>
     113The <a class="ext-link" href="http://www.signal11.us/oss/hidapi/"><span class="icon">​</span>HIDAPI</a> (open-source and cross-platform Linux/Windows/MacOS) provides simple <b style="color:#000;background:#ffff66">USB</b> HID enumeration, read and write functions.
     114</p>
     115<p>
     116The HID device class uses HID reports to describe details about the data input and output a device supports. The sub class can be 'Generic HID' and the report type can be 'Vendor Defined' which makes it generic. The maximum report size is 64B.
     117</p>
     118<h2 id="VendorSpecific">Vendor Specific</h2>
     119<p>
     120Vendors sometimes choose to implement a <strong>Vendor specific</strong> device which has an undefined class.
     121</p>
     122<p>
     123The <a class="ext-link" href="http://www.libusb.org/"><span class="icon">​</span>libusb</a> (open-source and cross-platform Linux/Windows/MacOS) can be used for generic <b style="color:#000;background:#ffff66">USB</b> communication. Vendor specific commands can be implemented.
     124</p>
     125<p>
     126<span class="wikianchor" id="usb-devices"></span>
     127</p>
     128<h2 id="GateworksUSBdevices">Gateworks <b style="color:#000;background:#ffff66">USB</b> devices</h2>
     129<p>
     130In an effort to define these options available to developers, Gateworks has created the following table with the fields as follows:
     131</p>
     132<ul><li><strong>Family</strong>: Board Product family.
     133</li><li><strong>SBC</strong>: The base SBC (Single Board Computer) model that the proceeding rows apply to.
     134</li><li><strong><b style="color:#000;background:#ffff66">USB</b> Port</strong>: The particular <b style="color:#000;background:#ffff66">USB</b> port and controller in question.
     135</li><li><strong>Ref</strong>: The reference part designator that can be found on the PCB silkscreen (white lettering).
     136</li><li><strong>Reset Type</strong>: How the <b style="color:#000;background:#ffff66">usb</b> device is re-enumerated and/or reset, which will be either:
     137<ul><li><em>Soft</em> - Both data lines of the <b style="color:#000;background:#ffff66">usb</b> bus are driven low, signalling a reset condition that is handled differently from device to device.
     138</li><li><em>VBUS</em> - The 5V power rail of the port is brought down (when indicated with the manual control of a gpio).
     139</li></ul></li><li><strong>Bus-Device[.Port]</strong>: The bus, device, and port (if behind a hub) of the port in question.
     140</li><li><strong>Bus Steering</strong>: The conditions for the bus to be electrically steered to this port if applicable.
     141</li></ul><p>
     142In all cases the miniPCIe slots get their VBUS directly from the board power rail, which has no power control.
     143</p>
     144<p>
     145Gateworks <b style="color:#000;background:#ffff66">USB</b> device Table:
     146</p>
     147<table class="wiki">
     148<tr><th style="text-align: left"><strong>Family</strong> </th><th> <strong>SBC</strong> </th><th> <strong><b style="color:#000;background:#ffff66">USB</b> Port</strong>         </th><th> <strong>Ref</strong>   </th><th> <strong>Reset</strong>      </th><th> <strong>Bus-Device[.Port]</strong> </th><th> <strong>Bus Steering</strong>
     149</th></tr><tr><td style="text-align: center">  Ventana      </td><td style="text-align: center">  GW51xx     </td><td> Front Panel OTG          </td><td style="text-align: center">  J20          </td><td style="text-align: center">  Soft/VBUS         </td><td> 1-1                       </td><td>
     150</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">             </td><td> miniPCIe <b style="color:#000;background:#ffff66">USB</b> EHCI        </td><td style="text-align: center">  J6           </td><td style="text-align: center">  Soft              </td><td> 2-1                       </td><td>
     151</td></tr><tr><td>
     152</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">  GW52xx     </td><td> Front Panel OTG          </td><td style="text-align: center">  J15          </td><td style="text-align: center">  Soft/VBUS         </td><td> 1-1                       </td><td> gpio2 low (default)
     153</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">             </td><td> Bot Right miniPCIe EHCI  </td><td style="text-align: center">  J7           </td><td style="text-align: center">  Soft              </td><td> 2-1                       </td><td>
     154</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">             </td><td> Bot Left miniPCIe OTG    </td><td style="text-align: center">  J8           </td><td style="text-align: center">  Soft              </td><td> 2-1                       </td><td> gpio2 high         
     155</td></tr><tr><td>
     156</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">  GW53xx     </td><td> Front Panel OTG          </td><td style="text-align: center">  J20          </td><td style="text-align: center">  Soft/VBUS         </td><td> 1-1                       </td><td>
     157</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">             </td><td> Front Panel EHCI         </td><td style="text-align: center">  J18          </td><td style="text-align: center">  Soft/VBUS         </td><td> 2-1.1                     </td><td>
     158</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">             </td><td> Bot Left miniPCIe EHCI   </td><td style="text-align: center">  J9           </td><td style="text-align: center">  Soft              </td><td> 2-1.2                     </td><td>
     159</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">             </td><td> Bot Center miniPCIe EHCI </td><td style="text-align: center">  J8           </td><td style="text-align: center">  Soft              </td><td> 2-1.3                     </td><td>
     160</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">             </td><td> Bot Right miniPCIe EHCI  </td><td style="text-align: center">  J6           </td><td style="text-align: center">  Soft              </td><td> 2-1.4                     </td><td>
     161</td></tr><tr><td>
     162</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">  GW54xx     </td><td> Front Panel OTG          </td><td style="text-align: center">  J23          </td><td style="text-align: center">  Soft/VBUS         </td><td> 1-1                       </td><td>
     163</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">             </td><td> Bot Right miniPCIe EHCI  </td><td style="text-align: center">  J6           </td><td style="text-align: center">  Soft              </td><td> 2-1.1                     </td><td>
     164</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">             </td><td> Top Right miniPCIe EHCI  </td><td style="text-align: center">  J9           </td><td style="text-align: center">  Soft              </td><td> 2-1.2                     </td><td>
     165</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">             </td><td> Top Left miniPCIe EHCI   </td><td style="text-align: center">  J7           </td><td style="text-align: center">  Soft              </td><td> 2-1.3                     </td><td>
     166</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">             </td><td> Front Panel EHCI         </td><td style="text-align: center">  J21          </td><td style="text-align: center">  Soft/VBUS         </td><td> 2-1.4                     </td><td>
     167</td></tr><tr><td>
     168</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">  GW551x     </td><td> Adapter Board OTG        </td><td>J3 (J9 on Adapter)</td><td style="text-align: center">  Soft           </td><td> 1-1                       </td><td>
     169</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">             </td><td> Bot miniPCIe EHCI        </td><td style="text-align: center">  J2           </td><td style="text-align: center">  Soft              </td><td> 2-1                       </td><td>
     170</td></tr><tr><td>
     171</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">  GW552x     </td><td> Bot Left miniPCIe EHCI   </td><td style="text-align: center">  J6           </td><td style="text-align: center">  Soft              </td><td> 1-1.1                     </td><td>
     172</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">             </td><td> Bot Right miniPCIe EHCI  </td><td style="text-align: center">  J5           </td><td style="text-align: center">  Soft              </td><td> 1-1.2                     </td><td>
     173</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">             </td><td> Front Panel EHCI         </td><td style="text-align: center">  J10 (Top)    </td><td style="text-align: center">  Soft/VBUS         </td><td> 1-1.3                     </td><td>
     174</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">             </td><td> Front Panel EHCI         </td><td style="text-align: center">  J10 (Bot)    </td><td style="text-align: center">  Soft/VBUS         </td><td> 1-1.4                     </td><td>
     175</td></tr><tr><td>
     176</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">  GW553x     </td><td> Front Panel OTG          </td><td style="text-align: center">  J8           </td><td style="text-align: center">  Soft/VBUS         </td><td> 1-1                       </td><td>
     177</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">             </td><td> miniPCIe EHCI            </td><td style="text-align: center">  J5           </td><td style="text-align: center">  Soft              </td><td> 2-1                       </td><td>
     178</td></tr><tr><td>
     179</td></tr><tr><td style="text-align: center">  Laguna       </td><td style="text-align: center">  GW2380     </td><td> MiniPCIe EHCI            </td><td style="text-align: center">  J5           </td><td style="text-align: center">  Soft              </td><td> 1-1                       </td><td>
     180</td></tr><tr><td>
     181</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">  GW2382     </td><td> Front Panel EHCI         </td><td style="text-align: center">  J4           </td><td>  Soft/VBUS (gpio9) </td><td> 1-1                       </td><td> gpio10 high (default)
     182</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">             </td><td> MiniPCIe EHCI            </td><td style="text-align: center">  J5           </td><td style="text-align: center">  Soft              </td><td> 1-1                       </td><td> gpio10 low
     183</td></tr><tr><td>
     184</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">  GW2383     </td><td> Front Panel OTG          </td><td style="text-align: center">  J4           </td><td style="text-align: center">  Soft/VBUS         </td><td> 1-1                       </td><td>
     185</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">             </td><td> MiniPCIe EHCI            </td><td style="text-align: center">  J6           </td><td style="text-align: center">  Soft              </td><td> 1-2                       </td><td>
     186</td></tr><tr><td>
     187</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">  GW2387     </td><td> Front Panel OTG          </td><td style="text-align: center">  J12 (Top)    </td><td>  Soft/VBUS (gpio6) </td><td> 1-1                       </td><td>
     188</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">             </td><td> Front Panel EHCI         </td><td style="text-align: center">  J12 (Bot)    </td><td>  Soft/VBUS (gpio6) </td><td> 2-1                       </td><td> gpio5 low (default)
     189</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">             </td><td> MiniPCI EHCI             </td><td style="text-align: center">  J5  (Bot)    </td><td style="text-align: center">  Soft              </td><td> 2-1                       </td><td> gpio5 high         
     190</td></tr><tr><td>
     191</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">  GW2388     </td><td> Front Panel OTG          </td><td style="text-align: center">  J19 (Top)    </td><td>  Soft/VBUS (gpio6) </td><td> 1-1                       </td><td> (loading option)<sup></sup><sup>(1)</sup><sup></sup>
     192</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">             </td><td> Front Panel EHCI         </td><td style="text-align: center">  J19 (Bot)    </td><td>  Soft/VBUS (gpio6) </td><td> 2-1                       </td><td> (loading option)<sup></sup><sup>(1)</sup><sup></sup>
     193</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">             </td><td> MiniPCI EHCI <sup></sup><sup>(1)</sup><sup></sup>   </td><td style="text-align: center">  J4 (Bot)     </td><td style="text-align: center">  Soft              </td><td> 2-1                       </td><td> (resistor loading option)<sup></sup><sup>(1)</sup><sup></sup>
     194</td></tr><tr><td>
     195</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">  GW2391     </td><td> Front Panel OTG          </td><td style="text-align: center">  J14 (Top)    </td><td>  Soft/VBUS (gpio6) </td><td> 1-1                       </td><td> gpio5 low (default)
     196</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">             </td><td> Front Panel EHCI         </td><td style="text-align: center">  J14 (Bot)    </td><td>  Soft/VBUS (gpio6) </td><td> 2-1                       </td><td> gpio7 low (default)
     197</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">             </td><td> MiniPCIe OTG             </td><td style="text-align: center">  J4 (Bot)     </td><td style="text-align: center">  Soft              </td><td> 1-1                       </td><td> gpio5 high
     198</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">             </td><td> MiniPCIe EHCI            </td><td style="text-align: center">  J3 (Top)     </td><td style="text-align: center">  Soft              </td><td> 2-1                       </td><td> gpio7 high
     199</td></tr><tr><td>
     200</td></tr><tr><td style="text-align: center">  Cambria      </td><td style="text-align: center">  GW2350     </td><td> Front Panel EHCI         </td><td style="text-align: center">  J9 (Top)     </td><td style="text-align: center">  Soft/VBUS         </td><td> 1-1                       </td><td>
     201</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">             </td><td> Front Panel EHCI         </td><td style="text-align: center">  J9 (Bot)     </td><td style="text-align: center">  Soft/VBUS         </td><td> 2-1                       </td><td>
     202</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">             </td><td> MiniPCI EHCI <sup></sup><sup>(1)</sup><sup></sup>   </td><td style="text-align: center">  J4           </td><td style="text-align: center">  Soft              </td><td> 2-1                       </td><td style="text-align: right"> (resistor loading option)<sup></sup><sup>(1)</sup><sup></sup>
     203</td></tr><tr><td>
     204</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">  GW2358     </td><td> Front Panel EHCI         </td><td style="text-align: center">  J16 (Top)    </td><td style="text-align: center">  Soft/VBUS         </td><td> 1-1                       </td><td>
     205</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">             </td><td> Front Panel EHCI         </td><td style="text-align: center">  J16 (Bot)    </td><td style="text-align: center">  Soft/VBUS         </td><td> 2-1                       </td><td>
     206</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">             </td><td> MiniPCI EHCI  <sup></sup><sup>(1)</sup><sup></sup>  </td><td style="text-align: center">  J8           </td><td style="text-align: center">  Soft              </td><td> 2-1                       </td><td style="text-align: right"> (resistor loading option)<sup></sup><sup>(1)</sup><sup></sup>
     207</td></tr><tr><td>
     208</td></tr><tr><td style="text-align: center">  Avila        </td><td style="text-align: left">GW2348-SP107 </td><td> Front Panel EHCI         </td><td style="text-align: center">  J18 (Top)     </td><td style="text-align: center">  Soft/VBUS        </td><td> 1-1                       </td><td>
     209</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">             </td><td> Front Panel EHCI         </td><td style="text-align: center">  J18 (Bot)     </td><td style="text-align: center">  Soft/VBUS        </td><td> 2-1                       </td><td>
     210</td></tr><tr><td style="text-align: center">               </td><td style="text-align: center">             </td><td> MiniPCI EHCI  <sup></sup><sup>(1)</sup><sup></sup>  </td><td style="text-align: center">  J4            </td><td style="text-align: center">  Soft             </td><td> 2-1                       </td><td style="text-align: right"> (resistor loading option)<sup></sup><sup>(1)</sup><sup></sup>
     211</td></tr></table>
     212<ol><li>This is a loading option available on specials - contact ​sales@…
     213<ul><li>Cambria GW2350 (Bottom MiniPCI socket J4)
     214<ul><li>R164, R163 = Load to route <b style="color:#000;background:#ffff66">USB</b> to MiniPCI connector J8 (bottom slot)
     215</li></ul></li><li>Cambria GW2358 (Bottom MiniPCI socket J8)
     216<ul><li>R146, R153 = Load to route <b style="color:#000;background:#ffff66">USB</b> to MiniPCI connector J8 (bottom slot)
     217</li><li>R138, R140 = Load to route <b style="color:#000;background:#ffff66">USB</b> to frontpanel connector J16 (top <b style="color:#000;background:#ffff66">USB</b> port)
     218</li></ul></li><li>Laguna GW2388-D+ (Bottom MiniPCI socket J4)
     219<ul><li>R240, R244 = Load to route <b style="color:#000;background:#ffff66">USB</b> to MiniPCI connector J4 (bottom slot) (default on GW2388-4)
     220</li><li>R241, R242 = Load to route <b style="color:#000;background:#ffff66">USB</b> to frontpanel connector J19 (top <b style="color:#000;background:#ffff66">USB</b> port) (default on GW2388-SP208, SP212 and SP213 w/front panel <b style="color:#000;background:#ffff66">USB</b> loaded)
     221</li></ul></li></ul></li></ol><p>
     222<span class="wikianchor" id="steering"></span>
     223</p>
     224<h2 id="USBSteering"><b style="color:#000;background:#ffff66">USB</b> Steering</h2>
     225<p>
     226Some boards allow <b style="color:#000;background:#ffff66">USB</b> to be steered via a software controlled gpio. Refer to the 'bus steering' column for details which show which gpio to use, what the default is set to (via bootloader), and where it can be steered to. Typically a bus may be steerable between a front-panel connector and a miniPCIe socket in which case the front-panel is always the default configured by the bootloader. You can change the steering at run-time if you whish which would be like physically removing a <b style="color:#000;background:#ffff66">USB</b> device from the bus and adding another (re-enumerates).
     227</p>
     228<p>
     229Examples:
     230</p>
     231<ul><li>Ventana GW52xx: steer the <b style="color:#000;background:#ffff66">USB</b> OTG bus to the miniPCIe socket (device-mode only) which uses gpio2:
     232<div class="code"><pre><span class="c"># export and configure the GPIO as an output high
     233</span><span class="nb">echo </span>2 &gt; /sys/class/gpio/export
     234<span class="nb">echo </span>out &gt; /sys/class/gpio/gpio2/direction
     235<span class="nb">echo </span>1 &gt; /sys/class/gpio/gpio2/value <span class="c"># 0=front-panel 1=miniPCIe-j8
     236</span></pre></div></li><li>Laguna GW2387/GW2388/GW2391: steer <b style="color:#000;background:#ffff66">USB</b> OTG bus to miniPCIe socket (device mode only) which uses gpio 5:
     237<div class="code"><pre><span class="nb">echo </span>1 &gt; /sys/class/gpio/gpio5/value <span class="c"># 0=front-panel 1=miniPCIe
     238</span></pre></div></li></ul><p>
     239<span class="wikianchor" id="reset"></span>
     240</p>
     241<h2 id="USBReset"><b style="color:#000;background:#ffff66">USB</b> Reset</h2>
     242<p>
     243The best way to reset a <b style="color:#000;background:#ffff66">USB</b> device is to 'hot plug' the device by physically removing and reinserting it. However this is not typically possible and there are other options.
     244</p>
     245<p>
     246Note that <a class="wiki" href="/wiki/USB#steering">BUS Steering</a> can sometimes be a useful alternative to resetting a device as it forces a re-enumeration of the device.
     247</p>
     248<p>
     249<span class="wikianchor" id="vbus-reset"></span>
     250</p>
     251<h3 id="VBUSreset">VBUS reset</h3>
     252<p>
     253The next best thing to physically removing and re-inserting a <b style="color:#000;background:#ffff66">USB</b> device is to toggle power to that device. While this is not possible on the <b style="color:#000;background:#ffff66">USB</b> bus routed to miniPCIe sockets (which run off an always 3.3V power rail) this is possible on:
     254</p>
     255<ul><li>OTG ports with Host capability (because they must have the ability to turn on and off their VBUS)
     256</li><li>Front panel ports that have over-current/fault-detect capability
     257</li><li>Ports that have a gpio controlled VBUS
     258</li></ul><p>
     259Ports provided by a <b style="color:#000;background:#ffff66">USB</b> OTG controller ('OTG' in <b style="color:#000;background:#ffff66">USB</b> Port name) which support host mode can have their VBUS reset by unbinding and rebinding the host controller via sysfs:
     260</p>
     261<ul><li>Ventana (where the OTG controller is '2184000.<b style="color:#000;background:#ffff66">usb</b>'):
     262<div class="code"><pre><span class="nb">echo </span>2184000.<b style="color:#000;background:#ffff66">usb</b> &gt; /sys/bus/platform/drivers/imx_<b style="color:#000;background:#ffff66">usb</b>/unbind
     263sleep 1
     264<span class="nb">echo </span>2184000.<b style="color:#000;background:#ffff66">usb</b> &gt; /sys/bus/platform/drivers/imx_<b style="color:#000;background:#ffff66">usb</b>/bind
     265</pre></div></li><li>Laguna (where the OTG controlleris 'dwc2.0'):
     266<div class="code"><pre><span class="nb">echo </span>dwc2.0 &gt; /sys/bus/platform/drivers/dwc2/unbind
     267sleep 1
     268<span class="nb">echo </span>dwc2.0 &gt; /sys/bus/platform/drivers/dwc2/bind
     269</pre></div></li></ul><p>
     270Ports provided by a <b style="color:#000;background:#ffff66">USB</b> Hub's (will have a '.&lt;port&gt;' in their bus-device.port entry in the table above) with over-current/fault detection such as those found on a GW530x/GW540x can have their VBUS reset by unbinding their upstream bus-dev from the <b style="color:#000;background:#ffff66">USB</b> bus:
     271</p>
     272<div class="code"><pre><span class="nb">echo </span>2-1 &gt; /sys/bus/<b style="color:#000;background:#ffff66">usb</b>/drivers/<b style="color:#000;background:#ffff66">usb</b>/unbind
     273sleep 1
     274<span class="nb">echo </span>2-1 &gt; /sys/bus/<b style="color:#000;background:#ffff66">usb</b>/drivers/<b style="color:#000;background:#ffff66">usb</b>/bind
     275</pre></div><ul><li>this is not possible for MiniPCIe sockets as their VBUS comes from the 3.0V rail
     276</li></ul><p>
     277Ports with GPIO controlled VBUS such as the Laguna boards can be reset by turning them on/off via gpio control:
     278</p>
     279<ul><li>GW2382 (gpio9):
     280<div class="code"><pre><span class="nb">echo </span>0 &gt; /sys/class/gpio/gpio9/value <span class="c"># de-assert GW2382 VUSB_EN
     281</span>sleep 1
     282<span class="nb">echo </span>1 &gt; /sys/class/gpio/gpio9/value <span class="c"># assert GW2382 VUSB_EN
     283</span></pre></div></li><li>GW2387/GW2388/GW2391 (gpio6):
     284<div class="code"><pre><span class="nb">echo </span>0 &gt; /sys/class/gpio/gpio9/value <span class="c"># de-assert GW2387/GW2388/GW2391 VUSB_EN
     285</span>sleep 1
     286<span class="nb">echo </span>1 &gt; /sys/class/gpio/gpio9/value <span class="c"># assert  GW2387/GW2388/GW2391 VUSB_EN
     287</span></pre></div></li></ul><p>
     288Refer to the <b style="color:#000;background:#ffff66">USB</b> device table above for the bus-dev and/or VBUS capabilities per board.
     289</p>
     290<p>
     291<span class="wikianchor" id="sysfs-reset"></span>
     292</p>
     293<h3 id="Softresetviasysfsbindunbindre-enumerate">Soft reset via sysfs bind/unbind (re-enumerate)</h3>
     294<p>
     295In some scenarios (ie Mini-PCIe modem) having command line options to reset these devices via sysfs is preferable and can be found via modern kernel drivers. Refer to the <b style="color:#000;background:#ffff66">USB</b> Device Table above for the bus-device.port reference for your board/port.
     296</p>
     297<p>
     298Note that commands targeting a hub cause a soft reset for all child devices which include the front panel and any pcie ports with "<b style="color:#000;background:#ffff66">usb</b>" on the silk screen. VBUS is only brought down on the front panel port(s) connected to the internal hub.
     299</p>
     300<p>
     301Examples:
     302</p>
     303<ul><li>Reset GW54xx Front panel OTG device (bus-device 1-1). Note this will cause VBUS to be toggled for a full power reset - see above:
     304<div class="code"><pre><span class="nb">echo </span>1-1 &gt; /sys/bus/<b style="color:#000;background:#ffff66">usb</b>/drivers/<b style="color:#000;background:#ffff66">usb</b>/unbind
     305sleep 1
     306<span class="nb">echo </span>1-1 &gt; /sys/bus/<b style="color:#000;background:#ffff66">usb</b>/drivers/<b style="color:#000;background:#ffff66">usb</b>/bind
     307</pre></div></li><li>Reset GW54xx EHCI devices by unbinding/binding the <b style="color:#000;background:#ffff66">USB</b> hub (bus-device 2-1). The bot right, top right, top left miniPCIe sockets will get a 'soft reset' (because they power off 3P3V which can't be toggled) and front panel EHCI will get a full VBUS power cycle:
     308<div class="code"><pre><span class="nb">echo </span>2-1 &gt; /sys/bus/<b style="color:#000;background:#ffff66">usb</b>/drivers/<b style="color:#000;background:#ffff66">usb</b>/unbind
     309sleep 1
     310<span class="nb">echo </span>2-1 &gt; /sys/bus/<b style="color:#000;background:#ffff66">usb</b>/drivers/<b style="color:#000;background:#ffff66">usb</b>/bind
     311</pre></div></li><li>Reset GW54xx EHCI device in the top right miniPCIe socket J6 (bus-device 2-1.1):
     312<div class="code"><pre><span class="nb">echo </span>2-1.1 &gt; /sys/bus/<b style="color:#000;background:#ffff66">usb</b>/drivers/<b style="color:#000;background:#ffff66">usb</b>/unbind
     313sleep 1
     314<span class="nb">echo </span>2-1.1 &gt; /sys/bus/<b style="color:#000;background:#ffff66">usb</b>/drivers/<b style="color:#000;background:#ffff66">usb</b>/bind
     315</pre></div></li></ul><p>
     316<span class="wikianchor" id="ioctl-reset"></span>
     317</p>
     318<h3 id="Softresetviaioctl">Soft reset via ioctl</h3>
     319<p>
     320There are also ioctls that can accomplish the same results programmaticlly and in some cases give even finer control than the above table. An example of a simple program that uses some of these ioctls is the <tt>usbreset</tt> command (present in <a class="wiki" href="/wiki/OpenWrt">OpenWrt</a>):
     321</p>
     322<ul><li><a class="ext-link" href="https://github.com/Gateworks/openwrt/blob/16.02/package/utils/usbreset/src/usbreset.c"><span class="icon">​</span>usbreset.c</a>
     323</li></ul><p>
     324Further information regarding these ioctls can be found throughout the Linux source <a class="ext-link" href="http://lxr.free-electrons.com/source/Documentation/"><span class="icon">​</span>documentation</a>.
     325</p>
     326}}}