Changes between Version 6 and Version 7 of ventana/gw5200usb


Ignore:
Timestamp:
04/24/2020 04:48:11 PM (5 years ago)
Author:
Tim Harvey
Comment:

remove useless devmem register manipulations

Legend:

Unmodified
Added
Removed
Modified
  • ventana/gw5200usb

    v6 v7  
    1515Setting the GPIO high will route to the Mini-PCIe slot and setting the GPIO low (0) will route it to the front panel connector:
    1616{{{#!bash
     17# export gpio2 for userspace control and configure as output
    1718echo 2 > /sys/class/gpio/export #export control of GPIO-2 to user space
    1819echo out > /sys/class/gpio/gpio2/direction #set to an output
    19 echo 1 > /sys/class/gpio/gpio2/value #set value high
     20# set value low to steer USB OTG to front-panel
     21echo 0 > /sys/class/gpio/gpio2/value
     22# set value high to steer USB OTG to miniPCIe
     23echo 1 > /sys/class/gpio/gpio2/value
    2024}}}
    21 
    22 Additionally, to accomplish this switching back and forth during run time, please use the script below:
    23 {{{#!bash
    24 #!/bin/sh
    25 #
    26 # GW52xx:
    27 #  Dynamically switch USB OTG from front-panel (fp) and PCIe socket (pci)
    28 #  at run-time and trigger re-enumeration
    29 #
    30 # usage: gw52xx-usbswitch fp|pci
    31 #
    32 [ -d /sys/class/gpio/gpio2 ] || {
    33   echo "setup"
    34   devmem 0x20e0224 32 0x15 # hack to set SION bit in case we want read-back
    35   echo 2 > /sys/class/gpio/export
    36   echo out > /sys/class/gpio/gpio2/direction
    37 }
    38 case "$1" in
    39   fp)  echo 0 > /sys/class/gpio/gpio2/value;;
    40   pci) echo 1 > /sys/class/gpio/gpio2/value;;
    41 esac
    42 # set GPIO_2 pad-mux to GPIO1__IO2 to effectively let OTG_ID go interally go
    43 # high and trigger a mode-switch to client-mode and thus disconnect
    44 devmem 0x20e0210 32 0x5
    45 # set GPIO_2 pad-mux back to USBOTG_IDSEL to let OTG_ID get pulled down by
    46 # attached cable and trigger a mode-switch to host-mode and thus enumerate
    47 devmem 0x20e0210 32 0x3
    48 }}}