Sergey Solomin | 11d63cf | 2016-11-28 15:03:24 -0600 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # ############################################################# |
| 3 | # script to disable UCD VCS rails. |
| 4 | # This REQUIRES unaltered/original UCD cfg file. |
| 5 | # 10/28/16 PGR - |
| 6 | # 11/10/16 PGR - unbind/bind UCD driver |
| 7 | |
Saqib Khan | c8c939e | 2017-03-13 12:37:16 -0500 | [diff] [blame] | 8 | ucd_retries=5 |
Andrew Jeffery | f1c6322 | 2017-03-23 10:54:24 +1030 | [diff] [blame] | 9 | ucd= |
Saqib Khan | c8c939e | 2017-03-13 12:37:16 -0500 | [diff] [blame] | 10 | |
Sergey Solomin | 11d63cf | 2016-11-28 15:03:24 -0600 | [diff] [blame] | 11 | # unbind ucd driver to permit i2cset |
| 12 | ucdpath="/sys/bus/i2c/drivers/ucd9000" |
| 13 | if [ -e $ucdpath ] |
| 14 | then |
Andrew Jeffery | f1c6322 | 2017-03-23 10:54:24 +1030 | [diff] [blame] | 15 | ucd=`ls -1 $ucdpath | grep 64` |
| 16 | if [ -n "$ucd" ] |
| 17 | then |
| 18 | echo $ucd > $ucdpath/unbind |
| 19 | fi |
Sergey Solomin | 11d63cf | 2016-11-28 15:03:24 -0600 | [diff] [blame] | 20 | fi |
| 21 | |
Andrew Geissler | ba9d64a | 2017-07-29 16:06:05 -0500 | [diff] [blame] | 22 | ## program UCD to bypass VCS (DD1 issue) |
| 23 | ## move memory enables to align with VDN (VDN to VDDR leakage issue) |
| 24 | ## remove GPU PGOOD from system reset. |
| 25 | #GPO_CONFIG_1 (GPIO15) |
Sergey Solomin | 11d63cf | 2016-11-28 15:03:24 -0600 | [diff] [blame] | 26 | i2cset -y 11 0x64 0xF7 0x00 i |
Andrew Geissler | ba9d64a | 2017-07-29 16:06:05 -0500 | [diff] [blame] | 27 | i2cset -y 11 0x64 0xF8 0x15 0x6E 0x80 0x08 0x00 0x00 0x00 0x40 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 i |
| 28 | #GPO_CONFIG_2 (GPIO7) |
Sergey Solomin | 11d63cf | 2016-11-28 15:03:24 -0600 | [diff] [blame] | 29 | i2cset -y 11 0x64 0xF7 0x01 i |
Andrew Geissler | ba9d64a | 2017-07-29 16:06:05 -0500 | [diff] [blame] | 30 | i2cset -y 11 0x64 0xF8 0x15 0x16 0x80 0x08 0x00 0x00 0x20 0x40 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 i |
| 31 | #SYSTEM_RESET_CONFIG |
| 32 | i2cset -y 11 0x64 0xD2 0x09 0x3F 0xFF 0x27 0x0A 0x00 0x06 0x00 0x00 0x02 i |
| 33 | #ON_OFF_CONFIG rail 15 |
Sergey Solomin | 11d63cf | 2016-11-28 15:03:24 -0600 | [diff] [blame] | 34 | i2cset -y 11 0x64 0x00 0x0E i |
| 35 | i2cset -y 11 0x64 0x02 0x1A i |
Andrew Geissler | ba9d64a | 2017-07-29 16:06:05 -0500 | [diff] [blame] | 36 | #ON_OFF_CONFIG rail 16 |
Sergey Solomin | 11d63cf | 2016-11-28 15:03:24 -0600 | [diff] [blame] | 37 | i2cset -y 11 0x64 0x00 0x0F i |
| 38 | i2cset -y 11 0x64 0x02 0x1A i |
Andrew Geissler | ba9d64a | 2017-07-29 16:06:05 -0500 | [diff] [blame] | 39 | # change VDN delays based on UCD MFR_REVISION setting |
| 40 | REV=`i2cget -y 11 0x64 0x9B i 2|cut -f2 -d' '` |
| 41 | if [ "$REV" == "0x01" -o "$REV" == "0x02" ] ; then |
| 42 | # use 20ms delay for VDN |
| 43 | #TON_DELAY rail 8 |
| 44 | i2cset -y 11 0x64 0x00 0x07 i |
| 45 | i2cset -y 11 0x64 0x60 0x80 0xDA i |
| 46 | #TON_DELAY rail 9 |
| 47 | i2cset -y 11 0x64 0x00 0x08 i |
| 48 | i2cset -y 11 0x64 0x60 0x80 0xDA i |
| 49 | else |
| 50 | # use 70ms delay for VDN |
| 51 | #TON_DELAY rail 8 |
| 52 | i2cset -y 11 0x64 0x00 0x07 i |
| 53 | i2cset -y 11 0x64 0x60 0x30 0xEA i |
| 54 | #TON_DELAY rail 9 |
| 55 | i2cset -y 11 0x64 0x00 0x08 i |
| 56 | i2cset -y 11 0x64 0x60 0x30 0xEA i |
| 57 | fi |
Sergey Solomin | 11d63cf | 2016-11-28 15:03:24 -0600 | [diff] [blame] | 58 | |
Andrew Jeffery | f1c6322 | 2017-03-23 10:54:24 +1030 | [diff] [blame] | 59 | # re-bind ucd driver only if we unbound it (i.e. ucd has been set with a value) |
| 60 | if [ -e $ucdpath -a -n "$ucd" ]; then |
Saqib Khan | c8c939e | 2017-03-13 12:37:16 -0500 | [diff] [blame] | 61 | j=0 |
| 62 | until [ $j -ge $ucd_retries ] || [ -e $ucdpath/$ucd ]; do |
| 63 | j=$((j+1)) |
Saqib Khan | e71ba0b | 2017-02-08 10:13:01 -0600 | [diff] [blame] | 64 | echo $ucd > $ucdpath/bind || ret=$? |
Andrew Geissler | ba9d64a | 2017-07-29 16:06:05 -0500 | [diff] [blame] | 65 | if [ $j -gt 1 ]; then |
| 66 | echo "rebinding UCD driver. Retry number $j" |
| 67 | sleep 1 |
Saqib Khan | c8c939e | 2017-03-13 12:37:16 -0500 | [diff] [blame] | 68 | fi |
Saqib Khan | e71ba0b | 2017-02-08 10:13:01 -0600 | [diff] [blame] | 69 | done |
| 70 | if [ ! -e $ucdpath/$ucd ]; then exit $ret; fi |
Sergey Solomin | 11d63cf | 2016-11-28 15:03:24 -0600 | [diff] [blame] | 71 | fi |
Saqib Khan | e71ba0b | 2017-02-08 10:13:01 -0600 | [diff] [blame] | 72 | |