Sergey Solomin | 7944ec7 | 2016-11-03 15:01:08 -0500 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | # enable VCS rail with OPERATION |
| 4 | # A side |
| 5 | i2cset -y 4 0x70 0x00 0x01 b |
| 6 | i2cset -y 4 0x70 0x02 0x1A b #respond to OPERATION |
| 7 | i2cset -y 4 0x70 0x00 0x00 b |
| 8 | # B side |
| 9 | i2cset -y 5 0x70 0x00 0x01 b |
| 10 | i2cset -y 5 0x70 0x02 0x1A b #respond to OPERATION |
| 11 | i2cset -y 5 0x70 0x00 0x00 b |
Andrew Geissler | ba9d64a | 2017-07-29 16:06:05 -0500 | [diff] [blame] | 12 | |
| 13 | # unbind ucd driver to permit i2cset |
| 14 | ucd_retries=5 |
| 15 | ucd= |
| 16 | |
| 17 | ucdpath="/sys/bus/i2c/drivers/ucd9000" |
| 18 | if [ -e $ucdpath ] |
| 19 | then |
| 20 | ucd=`ls -1 $ucdpath | grep 64` |
| 21 | if [ -n "$ucd" ] |
| 22 | then |
| 23 | echo $ucd > $ucdpath/unbind |
| 24 | fi |
| 25 | fi |
| 26 | |
| 27 | |
| 28 | # re-enable VCS in system PGOOD |
| 29 | sleep 1 |
| 30 | #SYSTEM_RESET_CONFIG |
| 31 | i2cset -y 11 0x64 0xD2 0x09 0xFF 0xFF 0x27 0x0A 0x00 0x06 0x00 0x00 0x02 i |
| 32 | |
| 33 | # re-bind ucd driver only if we unbound it (i.e. ucd has been set with a value) |
| 34 | if [ -e $ucdpath -a -n "$ucd" ]; then |
| 35 | j=0 |
| 36 | until [ $j -ge $ucd_retries ] || [ -e $ucdpath/$ucd ]; do |
| 37 | j=$((j+1)) |
| 38 | echo $ucd > $ucdpath/bind || ret=$? |
| 39 | if [ $j -gt 1 ]; then |
| 40 | echo "rebinding UCD driver. Retry number $j" |
| 41 | sleep 1 |
| 42 | fi |
| 43 | done |
| 44 | if [ ! -e $ucdpath/$ucd ]; then exit $ret; fi |
| 45 | fi |