blob: 37136629844adea2134582f0957713386b749a7c [file] [log] [blame]
Sergey Solomin7944ec72016-11-03 15:01:08 -05001#!/bin/sh
2
3# enable VCS rail with OPERATION
4# A side
5i2cset -y 4 0x70 0x00 0x01 b
6i2cset -y 4 0x70 0x02 0x1A b #respond to OPERATION
7i2cset -y 4 0x70 0x00 0x00 b
8# B side
9i2cset -y 5 0x70 0x00 0x01 b
10i2cset -y 5 0x70 0x02 0x1A b #respond to OPERATION
11i2cset -y 5 0x70 0x00 0x00 b
Andrew Geisslerba9d64a2017-07-29 16:06:05 -050012
13# unbind ucd driver to permit i2cset
14ucd_retries=5
15ucd=
16
17ucdpath="/sys/bus/i2c/drivers/ucd9000"
18if [ -e $ucdpath ]
19then
20 ucd=`ls -1 $ucdpath | grep 64`
21 if [ -n "$ucd" ]
22 then
23 echo $ucd > $ucdpath/unbind
24 fi
25fi
26
27
28# re-enable VCS in system PGOOD
29sleep 1
30#SYSTEM_RESET_CONFIG
31i2cset -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)
34if [ -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
45fi