blob: d40579731195fe39d135f8160802f0617a1766e3 [file] [log] [blame]
Matt Spinlerd4cf3a32016-12-20 10:59:13 -06001#!/bin/sh
2
Matt Spinler8b5a9932017-12-05 15:17:32 -06003# ensure VCS ON_OFF_CONFIG set correctly from prior FW drivers
4# A side
5i2cset -y 4 0x70 0x00 0x01 b
6i2cset -y 4 0x70 0x02 0x16 b #respond to ENABLE pin
7i2cset -y 4 0x70 0x00 0x00 b
8# B side
9i2cset -y 5 0x70 0x00 0x01 b
10i2cset -y 5 0x70 0x02 0x16 b #respond to ENABLE pin
11i2cset -y 5 0x70 0x00 0x00 b
12
13# vddio = 1.0V, mdat/sdat PU enabled
14i2cset -y 4 0x12 0xFF 0x00 b # VDD/VCS 0
15i2cset -y 4 0x12 0x2E 0x03 b # VDD/VCS 0
16i2cset -y 4 0x13 0xFF 0x00 b # VDN 0
17i2cset -y 4 0x13 0x2E 0x03 b # VDN 0
18i2cset -y 5 0x12 0xFF 0x00 b # VDD/VCS 1
19i2cset -y 5 0x12 0x2E 0x03 b # VDD/VCS 1
20i2cset -y 5 0x13 0xFF 0x00 b # VDN 1
21i2cset -y 5 0x13 0x2E 0x03 b # VDN 1
Matt Spinlerd4cf3a32016-12-20 10:59:13 -060022
Andrew Geissler7e9e9f02017-07-28 15:55:06 -050023# A side VDDR - set to 1.23V
24i2cset -y 4 0x71 0x00 0x01
25i2cset -y 4 0x71 0x21 0x3B 0x01 i
26i2cset -y 4 0x71 0x00 0x00
27
28# B side VDDR - set to 1.23V
29i2cset -y 5 0x71 0x00 0x01
30i2cset -y 5 0x71 0x21 0x3B 0x01 i
31i2cset -y 5 0x71 0x00 0x00
Andrew Geissler7e1ed0c2017-07-28 16:07:27 -050032
33# VDN A - PGOOD_ON threshold
34i2cset -y 4 0x71 0x00 0x00 b # PAGE
35i2cset -y 4 0x71 0x5E 0xCD 0x00 i # set to 0.8V
36
37# VDN B - PGOOD_ON threshold
38i2cset -y 5 0x71 0x00 0x00 b # PAGE
39i2cset -y 5 0x71 0x5E 0xCD 0x00 i # set to 0.8V
Andrew Geissler2bba0b82017-08-07 16:26:39 -050040
41# unbind ucd driver to permit i2cset
42ucd_retries=5
43ucd=
44
45ucdpath="/sys/bus/i2c/drivers/ucd9000"
46if [ -e $ucdpath ]
47then
48 ucd=`ls -1 $ucdpath | grep 64`
49 if [ -n "$ucd" ]
50 then
51 echo $ucd > $ucdpath/unbind
52 fi
53fi
54
Matt Spinler8b5a9932017-12-05 15:17:32 -060055# make sure VCS ON_OFF_CONFIG set correctly from old FW releases
56i2cset -y 11 0x64 0x00 0x0E i
57i2cset -y 11 0x64 0x02 0x16 i
58i2cset -y 11 0x64 0x00 0x0F i
59i2cset -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
63i2cset -y 11 0x64 0xF7 0x00 i
64i2cset -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
66i2cset -y 11 0x64 0xF7 0x01 i
67i2cset -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
70REV=`i2cget -y 11 0x64 0x9B i 2|cut -f2 -d' '`
71if [ "$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
79else
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
87fi
88
Andrew Geissler2bba0b82017-08-07 16:26:39 -050089# Raise AVDD +100mV
90i2cset -y 11 0x64 0x00 0x09 i # set PAGE
91i2cset -y 11 0x64 0xF5 0x81 i # set margin_config
92i2cset -y 11 0x64 0x21 0x85 0x33 i # set VOUT_COMMAND
93
Andrew Geisslerff44a262017-10-02 10:46:42 -050094# Increase over-current settings
95#VDD A phase current
96i2cset -y 4 0x12 0xFF 0x04 b # set window register high byte to 4
Matt Spinler8b5a9932017-12-05 15:17:32 -060097i2cset -y 4 0x12 0x3C 0x80 b # Set to 64A
Andrew Geisslerff44a262017-10-02 10:46:42 -050098#VDD B phase current
99i2cset -y 5 0x12 0xFF 0x04 b # set window register high byte to 4
Matt Spinler8b5a9932017-12-05 15:17:32 -0600100i2cset -y 5 0x12 0x3C 0x80 b # Set to 64A
Andrew Geisslerff44a262017-10-02 10:46:42 -0500101#VDD A master OC fault to 445A
102i2cset -y 4 0x70 0x00 0x00 b # PAGE
103i2cset -y 4 0x70 0x46 0x08DE w
Andrew Geissler0f7cd112018-04-16 12:31:05 -0700104# VDD A master OC warn to 326A
105i2cset -y 4 0x70 0x4A 0x08A3 w # A308
Andrew Geisslerff44a262017-10-02 10:46:42 -0500106#VDD B master OC fault to 445A
107i2cset -y 5 0x70 0x00 0x00 b # PAGE
108i2cset -y 5 0x70 0x46 0x08DE w
Andrew Geissler0f7cd112018-04-16 12:31:05 -0700109# VDD B master OC warn to 326A
110i2cset -y 5 0x70 0x4A 0x08A3 w
Matt Spinler8b5a9932017-12-05 15:17:32 -0600111#VCS phase current to 30A C/C
112i2cset -y 4 0x12 0xFF 0x08 b # set window register to 8
113i2cset -y 4 0x12 0x3C 0x3C b # 30A
114i2cset -y 5 0x12 0xFF 0x08 b # set window register to 8
115i2cset -y 5 0x12 0x3C 0x3C b # 30A
116#VCS master OC to 43A
117i2cset -y 4 0x70 0x00 0x01 # PAGE 1
118i2cset -y 4 0x70 0x46 0x0816 w # OC to 43A
119i2cset -y 5 0x70 0x00 0x01 # PAGE 1
120i2cset -y 5 0x70 0x46 0x0816 w # OC to 43A
Andrew Geisslerff44a262017-10-02 10:46:42 -0500121
Andrew Geissler2bba0b82017-08-07 16:26:39 -0500122# re-bind ucd driver only if we unbound it (i.e. ucd has been set with a value)
123if [ -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
134fi