Changes between Version 3 and Version 4 of linux/OTG


Ignore:
Timestamp:
04/24/2020 04:40:53 PM (2 years ago)
Author:
Tim Harvey
Comment:

added details about OTG mode selection

Legend:

Unmodified
Added
Removed
Modified
  • linux/OTG

    v3 v4  
    375375lsmod | grep g_*
    376376}}}
     377
     378
     379[=#dual-role]
     380== OTG Mode selection
     381USB OTG host controllers are 'dual-role' controllers in that they can behave as a {{{USB host}}} or a {{{USB peripheral}}}. The decision on which mode to be in is typically controlled by the state of the OTG ID pin which is grounded on OTG to host cables, and left floating on OTG to device cables.
     382
     383Dual-role controllers can be forced into 'host' mode or 'peripheral' mode via the device-tree 'dr_mode' property. For example to force an IMX6 OTG controller to peripheral mode add 'dr_mode = "peripheral";' to the dt such as:
     384{{{
     385&usbotg {
     386        vbus-supply = <&reg_5p0v>;
     387        pinctrl-names = "default";
     388        pinctrl-0 = <&pinctrl_usbotg>;
     389        disable-over-current;
     390        dr_mode = "peripheral";
     391        status = "okay";
     392};
     393}}}
     394
     395Additionally some host controllers such as the Chips and Media controller used on the IMX6 have hooks that allow them to be configured at runtime in Linux Userspace. For example on IMX6 boards:
     396{{{#!bash
     397cat /sys/kernel/debug/ci_hdrc.0/role # see current role; default dictated by dr_mode dt property or state of OTG_ID pin if not set
     398echo gadget > /sys/kernel/debug/ci_hdrc.0/role # specify device mode
     399echo host > /sys/kernel/debug/ci_hdrc.0/role # specify host mode
     400}}}