Matt Spinler | d4cf3a3 | 2016-12-20 10:59:13 -0600 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
Matt Spinler | 8b5a993 | 2017-12-05 15:17:32 -0600 | [diff] [blame] | 3 | # ensure VCS ON_OFF_CONFIG set correctly from prior FW drivers |
| 4 | # A side |
| 5 | i2cset -y 4 0x70 0x00 0x01 b |
| 6 | i2cset -y 4 0x70 0x02 0x16 b #respond to ENABLE pin |
| 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 0x16 b #respond to ENABLE pin |
| 11 | i2cset -y 5 0x70 0x00 0x00 b |
| 12 | |
| 13 | # vddio = 1.0V, mdat/sdat PU enabled |
| 14 | i2cset -y 4 0x12 0xFF 0x00 b # VDD/VCS 0 |
| 15 | i2cset -y 4 0x12 0x2E 0x03 b # VDD/VCS 0 |
| 16 | i2cset -y 4 0x13 0xFF 0x00 b # VDN 0 |
| 17 | i2cset -y 4 0x13 0x2E 0x03 b # VDN 0 |
| 18 | i2cset -y 5 0x12 0xFF 0x00 b # VDD/VCS 1 |
| 19 | i2cset -y 5 0x12 0x2E 0x03 b # VDD/VCS 1 |
| 20 | i2cset -y 5 0x13 0xFF 0x00 b # VDN 1 |
| 21 | i2cset -y 5 0x13 0x2E 0x03 b # VDN 1 |
Matt Spinler | d4cf3a3 | 2016-12-20 10:59:13 -0600 | [diff] [blame] | 22 | |
Andrew Geissler | 7e9e9f0 | 2017-07-28 15:55:06 -0500 | [diff] [blame] | 23 | # A side VDDR - set to 1.23V |
| 24 | i2cset -y 4 0x71 0x00 0x01 |
| 25 | i2cset -y 4 0x71 0x21 0x3B 0x01 i |
| 26 | i2cset -y 4 0x71 0x00 0x00 |
| 27 | |
| 28 | # B side VDDR - set to 1.23V |
| 29 | i2cset -y 5 0x71 0x00 0x01 |
| 30 | i2cset -y 5 0x71 0x21 0x3B 0x01 i |
| 31 | i2cset -y 5 0x71 0x00 0x00 |
Andrew Geissler | 7e1ed0c | 2017-07-28 16:07:27 -0500 | [diff] [blame] | 32 | |
| 33 | # VDN A - PGOOD_ON threshold |
| 34 | i2cset -y 4 0x71 0x00 0x00 b # PAGE |
| 35 | i2cset -y 4 0x71 0x5E 0xCD 0x00 i # set to 0.8V |
| 36 | |
| 37 | # VDN B - PGOOD_ON threshold |
| 38 | i2cset -y 5 0x71 0x00 0x00 b # PAGE |
| 39 | i2cset -y 5 0x71 0x5E 0xCD 0x00 i # set to 0.8V |
Andrew Geissler | 2bba0b8 | 2017-08-07 16:26:39 -0500 | [diff] [blame] | 40 | |
| 41 | # unbind ucd driver to permit i2cset |
| 42 | ucd_retries=5 |
| 43 | ucd= |
| 44 | |
| 45 | ucdpath="/sys/bus/i2c/drivers/ucd9000" |
| 46 | if [ -e $ucdpath ] |
| 47 | then |
| 48 | ucd=`ls -1 $ucdpath | grep 64` |
| 49 | if [ -n "$ucd" ] |
| 50 | then |
| 51 | echo $ucd > $ucdpath/unbind |
| 52 | fi |
| 53 | fi |
| 54 | |
Matt Spinler | 8b5a993 | 2017-12-05 15:17:32 -0600 | [diff] [blame] | 55 | # make sure VCS ON_OFF_CONFIG set correctly from old FW releases |
| 56 | i2cset -y 11 0x64 0x00 0x0E i |
| 57 | i2cset -y 11 0x64 0x02 0x16 i |
| 58 | i2cset -y 11 0x64 0x00 0x0F i |
| 59 | i2cset -y 11 0x64 0x02 0x16 i |
| 60 | |
| 61 | ## move memory enables to align with VDN (VDN to VDDR leakage issue) |
| 62 | #GPO_CONFIG_1 (GPIO15) : mem 0 reg enables |
| 63 | i2cset -y 11 0x64 0xF7 0x00 i |
| 64 | 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 |
| 65 | #GPO_CONFIG_2 (GPIO7) : mem 1 reg enables |
| 66 | i2cset -y 11 0x64 0xF7 0x01 i |
| 67 | 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 |
| 68 | |
| 69 | # change VDN delays based on UCD MFR_REVISION setting |
| 70 | REV=`i2cget -y 11 0x64 0x9B i 2|cut -f2 -d' '` |
| 71 | if [ "$REV" == "0x01" -o "$REV" == "0x02" ] ; then |
| 72 | # use 20ms delay for VDN |
| 73 | #TON_DELAY rail 8 |
| 74 | i2cset -y 11 0x64 0x00 0x07 i |
| 75 | i2cset -y 11 0x64 0x60 0x80 0xDA i |
| 76 | #TON_DELAY rail 9 |
| 77 | i2cset -y 11 0x64 0x00 0x08 i |
| 78 | i2cset -y 11 0x64 0x60 0x80 0xDA i |
| 79 | else |
| 80 | # use 70ms delay for VDN |
| 81 | #TON_DELAY rail 8 |
| 82 | i2cset -y 11 0x64 0x00 0x07 i |
| 83 | i2cset -y 11 0x64 0x60 0x30 0xEA i |
| 84 | #TON_DELAY rail 9 |
| 85 | i2cset -y 11 0x64 0x00 0x08 i |
| 86 | i2cset -y 11 0x64 0x60 0x30 0xEA i |
| 87 | fi |
| 88 | |
Andrew Geissler | 2bba0b8 | 2017-08-07 16:26:39 -0500 | [diff] [blame] | 89 | # Raise AVDD +100mV |
| 90 | i2cset -y 11 0x64 0x00 0x09 i # set PAGE |
| 91 | i2cset -y 11 0x64 0xF5 0x81 i # set margin_config |
| 92 | i2cset -y 11 0x64 0x21 0x85 0x33 i # set VOUT_COMMAND |
| 93 | |
Andrew Geissler | ff44a26 | 2017-10-02 10:46:42 -0500 | [diff] [blame] | 94 | # Increase over-current settings |
| 95 | #VDD A phase current |
| 96 | i2cset -y 4 0x12 0xFF 0x04 b # set window register high byte to 4 |
Matt Spinler | 8b5a993 | 2017-12-05 15:17:32 -0600 | [diff] [blame] | 97 | i2cset -y 4 0x12 0x3C 0x80 b # Set to 64A |
Andrew Geissler | ff44a26 | 2017-10-02 10:46:42 -0500 | [diff] [blame] | 98 | #VDD B phase current |
| 99 | i2cset -y 5 0x12 0xFF 0x04 b # set window register high byte to 4 |
Matt Spinler | 8b5a993 | 2017-12-05 15:17:32 -0600 | [diff] [blame] | 100 | i2cset -y 5 0x12 0x3C 0x80 b # Set to 64A |
Andrew Geissler | ff44a26 | 2017-10-02 10:46:42 -0500 | [diff] [blame] | 101 | #VDD A master OC fault to 445A |
| 102 | i2cset -y 4 0x70 0x00 0x00 b # PAGE |
| 103 | i2cset -y 4 0x70 0x46 0x08DE w |
| 104 | # VDD A master OC warn to 384A |
| 105 | i2cset -y 4 0x70 0x4A 0x08C0 w |
| 106 | #VDD B master OC fault to 445A |
| 107 | i2cset -y 5 0x70 0x00 0x00 b # PAGE |
| 108 | i2cset -y 5 0x70 0x46 0x08DE w |
| 109 | # VDD B master OC warn to 384A |
| 110 | i2cset -y 5 0x70 0x4A 0x08C0 w |
Matt Spinler | 8b5a993 | 2017-12-05 15:17:32 -0600 | [diff] [blame] | 111 | #VCS phase current to 30A C/C |
| 112 | i2cset -y 4 0x12 0xFF 0x08 b # set window register to 8 |
| 113 | i2cset -y 4 0x12 0x3C 0x3C b # 30A |
| 114 | i2cset -y 5 0x12 0xFF 0x08 b # set window register to 8 |
| 115 | i2cset -y 5 0x12 0x3C 0x3C b # 30A |
| 116 | #VCS master OC to 43A |
| 117 | i2cset -y 4 0x70 0x00 0x01 # PAGE 1 |
| 118 | i2cset -y 4 0x70 0x46 0x0816 w # OC to 43A |
| 119 | i2cset -y 5 0x70 0x00 0x01 # PAGE 1 |
| 120 | i2cset -y 5 0x70 0x46 0x0816 w # OC to 43A |
Andrew Geissler | ff44a26 | 2017-10-02 10:46:42 -0500 | [diff] [blame] | 121 | |
Andrew Geissler | 2bba0b8 | 2017-08-07 16:26:39 -0500 | [diff] [blame] | 122 | # re-bind ucd driver only if we unbound it (i.e. ucd has been set with a value) |
| 123 | if [ -e $ucdpath -a -n "$ucd" ]; then |
| 124 | j=0 |
| 125 | until [ $j -ge $ucd_retries ] || [ -e $ucdpath/$ucd ]; do |
| 126 | j=$((j+1)) |
| 127 | echo $ucd > $ucdpath/bind || ret=$? |
| 128 | if [ $j -gt 1 ]; then |
| 129 | echo "rebinding UCD driver. Retry number $j" |
| 130 | sleep 1 |
| 131 | fi |
| 132 | done |
| 133 | if [ ! -e $ucdpath/$ucd ]; then exit $ret; fi |
| 134 | fi |