1/*
2 * Copyright (C) 2014-2016, Toradex AG
3 *
4 * SPDX-License-Identifier:	GPL-2.0+
5 */
6
7// Register Output for PF0100 programmer
8// Customer: Toradex AG
9// Program: Colibri iMX6
10// Sample marking:
11// Date: 24.07.2015
12// Time: 10:52:58
13// Generated from Spreadsheet Revision: P1.8
14
15/* sed commands to get from programmer script to struct */
16/* sed -e 's/^WRITE_I2C:\(..\):\(..\)/\{pmic_i2c, 0x\1, 0x\2\},/g' -e 's/^DELAY:\([0-9]*\)/\{pmic_delay, 0, \1\},/g' pf0100_otp_Colibri_iMX6.txt > pf0100_otp.inc
17   sed -i -e 's/^VPGM:ON/\{pmic_vpgm, 0, 1},/g' -e 's/^VPGM:OFF/\{pmic_vpgm, 0, 0},/g' pf0100_otp.inc
18   sed -i -e 's/^PWRON: HIGH/\{pmic_pwr, 0, 1},/g' -e 's/^PWRON:LOW/\{pmic_pwr, 0, 0},/g' pf0100_otp.inc */
19
20enum { pmic_i2c, pmic_delay, pmic_vpgm, pmic_pwr };
21struct pmic_otp_prog_t{
22	unsigned char cmd;
23	unsigned char reg;
24	unsigned short value;
25};
26
27struct pmic_otp_prog_t pmic_otp_prog[] = {
28{pmic_i2c, 0x7F, 0x01}, // Access FSL EXT Page 1
29{pmic_i2c, 0xA0, 0x2B}, // Auto gen from Row94
30{pmic_i2c, 0xA1, 0x01}, // Auto gen from Row95
31{pmic_i2c, 0xA2, 0x05}, // Auto gen from Row96
32{pmic_i2c, 0xA8, 0x2B}, // Auto gen from Row102
33{pmic_i2c, 0xA9, 0x02}, // Auto gen from Row103
34{pmic_i2c, 0xAA, 0x01}, // Auto gen from Row104
35{pmic_i2c, 0xAC, 0x18}, // Auto gen from Row106
36{pmic_i2c, 0xAE, 0x01}, // Auto gen from Row108
37{pmic_i2c, 0xB0, 0x2C}, // Auto gen from Row110
38{pmic_i2c, 0xB1, 0x04}, // Auto gen from Row111
39{pmic_i2c, 0xB2, 0x01}, // Auto gen from Row112
40{pmic_i2c, 0xB4, 0x2C}, // Auto gen from Row114
41{pmic_i2c, 0xB5, 0x04}, // Auto gen from Row115
42{pmic_i2c, 0xB6, 0x01}, // Auto gen from Row116
43{pmic_i2c, 0xB8, 0x18}, // Auto gen from Row118
44{pmic_i2c, 0xBA, 0x01}, // Auto gen from Row120
45{pmic_i2c, 0xBD, 0x0E}, // Auto gen from Row123
46{pmic_i2c, 0xC0, 0x06}, // Auto gen from Row126
47{pmic_i2c, 0xC4, 0x04}, // Auto gen from Row130
48{pmic_i2c, 0xC8, 0x0E}, // Auto gen from Row134
49{pmic_i2c, 0xCC, 0x0E}, // Auto gen from Row138
50{pmic_i2c, 0xCD, 0x05}, // Auto gen from Row139
51{pmic_i2c, 0xD0, 0x0C}, // Auto gen from Row142
52{pmic_i2c, 0xD5, 0x07}, // Auto gen from Row147
53{pmic_i2c, 0xD8, 0x07}, // Auto gen from Row150
54{pmic_i2c, 0xD9, 0x06}, // Auto gen from Row151
55{pmic_i2c, 0xDC, 0x0A}, // Auto gen from Row154
56{pmic_i2c, 0xDD, 0x03}, // Auto gen from Row155
57{pmic_i2c, 0xE0, 0x05}, // Auto gen from Row158
58
59#if 0 /* TBB mode */
60{pmic_i2c, 0xE4, 0x80}, // TBB_POR = 1
61{pmic_delay, 0, 10},
62#else
63// Write OTP
64{pmic_i2c, 0xE4, 0x02}, // FUSE POR1=1
65{pmic_i2c, 0xE5, 0x02}, // FUSE POR2=1
66{pmic_i2c, 0xE6, 0x02}, // FUSE POR3=1
67{pmic_i2c, 0xF0, 0x1F}, // Enable ECC for fuse banks 1 to 5 by writing to OTP EN ECC0 register
68{pmic_i2c, 0xF1, 0x1F}, // Enable ECC for fuse banks 6 to 10 by writing to OTP EN ECC1 register
69{pmic_i2c, 0x7F, 0x02}, // Access PF0100 EXT Page2
70{pmic_i2c, 0xD0, 0x1F}, // Set Auto ECC for fuse banks 1 to 5 by writing to OTP AUTO ECC0 register
71{pmic_i2c, 0xD1, 0x1F}, // Set Auto ECC for fuse banks 6 to 10 by writing to OTP AUTO ECC1 register
72//-----------------------------------------------------------------------------------
73{pmic_i2c, 0xF1, 0x00}, // Reset Bank 1 ANTIFUSE_RW and ANTIFUSE_BYPASS bits
74{pmic_i2c, 0xF2, 0x00}, // Reset Bank 2 ANTIFUSE_RW and ANTIFUSE_BYPASS bits
75{pmic_i2c, 0xF3, 0x00}, // Reset Bank 3 ANTIFUSE_RW and ANTIFUSE_BYPASS bits
76{pmic_i2c, 0xF4, 0x00}, // Reset Bank 4 ANTIFUSE_RW and ANTIFUSE_BYPASS bits
77{pmic_i2c, 0xF5, 0x00}, // Reset Bank 5 ANTIFUSE_RW and ANTIFUSE_BYPASS bits
78{pmic_i2c, 0xF6, 0x00}, // Reset Bank 6 ANTIFUSE_RW and ANTIFUSE_BYPASS bits
79{pmic_i2c, 0xF7, 0x00}, // Reset Bank 7 ANTIFUSE_RW and ANTIFUSE_BYPASS bits
80{pmic_i2c, 0xF8, 0x00}, // Reset Bank 8 ANTIFUSE_RW and ANTIFUSE_BYPASS bits
81{pmic_i2c, 0xF9, 0x00}, // Reset Bank 9 ANTIFUSE_RW and ANTIFUSE_BYPASS bits
82{pmic_i2c, 0xFA, 0x00}, // Reset Bank 10 ANTIFUSE_RW and ANTIFUSE_BYPASS bits
83//-----------------------------------------------------------------------------------
84{pmic_vpgm, 0, 1}, // Turn ON 8V SWBST
85//VPGM:DOWN:n
86//VPGM:UP:n
87{pmic_delay, 0, 500}, // Adds 500msec delay to allow VPGM time to ramp up
88//-----------------------------------------------------------------------------------
89// PF0100 OTP MANUAL-PROGRAMMING (BANK 1 thru 10)
90//-----------------------------------------------------------------------------------
91// BANK 1
92//-----------------------------------------------------------------------------------
93{pmic_i2c, 0xF1, 0x00}, // Reset Bank 1 ANTIFUSE_RW and ANTIFUSE_BYPASS bits
94{pmic_i2c, 0xF1, 0x03}, // Set Bank 1 ANTIFUSE_RW and ANTIFUSE_BYPASS bits
95{pmic_i2c, 0xF1, 0x0B}, // Set Bank 1 ANTIFUSE_EN
96{pmic_delay, 0, 10}, // Allow time for bank programming to complete
97{pmic_i2c, 0xF1, 0x03}, // Reset Bank 1 ANTIFUSE_EN
98{pmic_i2c, 0xF1, 0x00}, // Reset Bank 1 ANTIFUSE_RW and ANTIFUSE_BYPASS bits
99//-----------------------------------------------------------------------------------
100// BANK 2
101//-----------------------------------------------------------------------------------
102{pmic_i2c, 0xF2, 0x00}, // Reset Bank 2 ANTIFUSE_RW and ANTIFUSE_BYPASS bits
103{pmic_i2c, 0xF2, 0x03}, // Set Bank 2 ANTIFUSE_RW and ANTIFUSE_BYPASS bits
104{pmic_i2c, 0xF2, 0x0B}, // Set Bank 2 ANTIFUSE_EN
105{pmic_delay, 0, 10}, // Allow time for bank programming to complete
106{pmic_i2c, 0xF2, 0x03}, // Reset Bank 2 ANTIFUSE_EN
107{pmic_i2c, 0xF2, 0x00}, // Reset Bank 2 ANTIFUSE_RW and ANTIFUSE_BYPASS bits
108//-----------------------------------------------------------------------------------
109// BANK 3
110//-----------------------------------------------------------------------------------
111{pmic_i2c, 0xF3, 0x00}, // Reset Bank 3 ANTIFUSE_RW and ANTIFUSE_BYPASS bits
112{pmic_i2c, 0xF3, 0x03}, // Set Bank 3 ANTIFUSE_RW and ANTIFUSE_BYPASS bits
113{pmic_i2c, 0xF3, 0x0B}, // Set Bank 3 ANTIFUSE_EN
114{pmic_delay, 0, 10}, // Allow time for bank programming to complete
115{pmic_i2c, 0xF3, 0x03}, // Reset Bank 3 ANTIFUSE_EN
116{pmic_i2c, 0xF3, 0x00}, // Reset Bank 3 ANTIFUSE_RW and ANTIFUSE_BYPASS bits
117//-----------------------------------------------------------------------------------
118// BANK 4
119//-----------------------------------------------------------------------------------
120{pmic_i2c, 0xF4, 0x00}, // Reset Bank 4 ANTIFUSE_RW and ANTIFUSE_BYPASS bits
121{pmic_i2c, 0xF4, 0x03}, // Set Bank 4 ANTIFUSE_RW and ANTIFUSE_BYPASS bits
122{pmic_i2c, 0xF4, 0x0B}, // Set Bank 4 ANTIFUSE_EN
123{pmic_delay, 0, 10}, // Allow time for bank programming to complete
124{pmic_i2c, 0xF4, 0x03}, // Reset Bank 4 ANTIFUSE_EN
125{pmic_i2c, 0xF4, 0x00}, // Reset Bank 4 ANTIFUSE_RW and ANTIFUSE_BYPASS bits
126//-----------------------------------------------------------------------------------
127// BANK 5
128//-----------------------------------------------------------------------------------
129{pmic_i2c, 0xF5, 0x00}, // Reset Bank 5 ANTIFUSE_RW and ANTIFUSE_BYPASS bits
130{pmic_i2c, 0xF5, 0x03}, // Set Bank 5 ANTIFUSE_RW and ANTIFUSE_BYPASS bits
131{pmic_i2c, 0xF5, 0x0B}, // Set Bank 5 ANTIFUSE_EN
132{pmic_delay, 0, 10}, // Allow time for bank programming to complete
133{pmic_i2c, 0xF5, 0x03}, // Reset Bank 5 ANTIFUSE_EN
134{pmic_i2c, 0xF5, 0x00}, // Reset Bank 5 ANTIFUSE_RW and ANTIFUSE_BYPASS bits
135//-----------------------------------------------------------------------------------
136// BANK 6
137//-----------------------------------------------------------------------------------
138{pmic_i2c, 0xF6, 0x00}, // Reset Bank 6 ANTIFUSE_RW and ANTIFUSE_BYPASS bits
139{pmic_i2c, 0xF6, 0x03}, // Set Bank 6 ANTIFUSE_RW and ANTIFUSE_BYPASS bits
140{pmic_i2c, 0xF6, 0x0B}, // Set Bank 6 ANTIFUSE_EN
141{pmic_delay, 0, 10}, // Allow time for bank programming to complete
142{pmic_i2c, 0xF6, 0x03}, // Reset Bank 6 ANTIFUSE_EN
143{pmic_i2c, 0xF6, 0x00}, // Reset Bank 6 ANTIFUSE_RW and ANTIFUSE_BYPASS bits
144//-----------------------------------------------------------------------------------
145// BANK 7
146//-----------------------------------------------------------------------------------
147{pmic_i2c, 0xF7, 0x00}, // Reset Bank 7 ANTIFUSE_RW and ANTIFUSE_BYPASS bits
148{pmic_i2c, 0xF7, 0x03}, // Set Bank 7 ANTIFUSE_RW and ANTIFUSE_BYPASS bits
149{pmic_i2c, 0xF7, 0x0B}, // Set Bank 7 ANTIFUSE_EN
150{pmic_delay, 0, 10}, // Allow time for bank programming to complete
151{pmic_i2c, 0xF7, 0x03}, // Reset Bank 7 ANTIFUSE_EN
152{pmic_i2c, 0xF7, 0x00}, // Reset Bank 7 ANTIFUSE_RW and ANTIFUSE_BYPASS bits
153//-----------------------------------------------------------------------------------
154// BANK 8
155//-----------------------------------------------------------------------------------
156{pmic_i2c, 0xF8, 0x00}, // Reset Bank 8 ANTIFUSE_RW and ANTIFUSE_BYPASS bits
157{pmic_i2c, 0xF8, 0x03}, // Set Bank 8 ANTIFUSE_RW and ANTIFUSE_BYPASS bits
158{pmic_i2c, 0xF8, 0x0B}, // Set Bank 8 ANTIFUSE_EN
159{pmic_delay, 0, 10}, // Allow time for bank programming to complete
160{pmic_i2c, 0xF8, 0x03}, // Reset Bank 8 ANTIFUSE_EN
161{pmic_i2c, 0xF8, 0x00}, // Reset Bank 8 ANTIFUSE_RW and ANTIFUSE_BYPASS bits
162//-----------------------------------------------------------------------------------
163// BANK 9
164//-----------------------------------------------------------------------------------
165{pmic_i2c, 0xF9, 0x00}, // Reset Bank 9 ANTIFUSE_RW and ANTIFUSE_BYPASS bits
166{pmic_i2c, 0xF9, 0x03}, // Set Bank 9 ANTIFUSE_RW and ANTIFUSE_BYPASS bits
167{pmic_i2c, 0xF9, 0x0B}, // Set Bank 9 ANTIFUSE_EN
168{pmic_delay, 0, 10}, // Allow time for bank programming to complete
169{pmic_i2c, 0xF9, 0x03}, // Reset Bank 9 ANTIFUSE_EN
170{pmic_i2c, 0xF9, 0x00}, // Reset Bank 9 ANTIFUSE_RW and ANTIFUSE_BYPASS bits
171//-----------------------------------------------------------------------------------
172// BANK 10
173//-----------------------------------------------------------------------------------
174{pmic_i2c, 0xFA, 0x00}, // Reset Bank 10 ANTIFUSE_RW and ANTIFUSE_BYPASS bits
175{pmic_i2c, 0xFA, 0x03}, // Set Bank 10 ANTIFUSE_RW and ANTIFUSE_BYPASS bits
176{pmic_i2c, 0xFA, 0x0B}, // Set Bank 10 ANTIFUSE_EN
177{pmic_delay, 0, 10}, // Allow time for bank programming to complete
178{pmic_i2c, 0xFA, 0x03}, // Reset Bank 10 ANTIFUSE_EN
179{pmic_i2c, 0xFA, 0x00}, // Reset Bank 10 ANTIFUSE_RW and ANTIFUSE_BYPASS bits
180//-----------------------------------------------------------------------------------
181{pmic_vpgm, 0, 0}, // Turn off 8V SWBST
182{pmic_delay, 0, 500}, // Adds delay to allow VPGM to bleed off
183{pmic_i2c, 0xD0, 0x00}, // Clear
184{pmic_i2c, 0xD1, 0x00}, // Clear
185{pmic_pwr, 0, 0}, // PWRON LOW to reload new OTP data
186{pmic_delay, 0, 500},
187{pmic_pwr, 0, 1},
188#endif
189};