blob: d1674caa138cf0e56bfe188ee54c351be1d251e0 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Benoît Thébaudeau20db6312013-04-23 10:17:44 +00002/*
3 * (C) Copyright 2013 ADVANSEE
4 * Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
5 *
6 * Based on Dirk Behme's
7 * https://github.com/dirkbehme/u-boot-imx6/blob/28b17e9/drivers/misc/imx_otp.c,
8 * which is based on Freescale's
Pali Rohár4ce7e6b2022-03-25 10:51:46 +01009 * https://source.codeaurora.org/external/imx/uboot-imx/tree/drivers/misc/imx_otp.c?id=9aa74e6,
Benoît Thébaudeau20db6312013-04-23 10:17:44 +000010 * which is:
11 * Copyright (C) 2011 Freescale Semiconductor, Inc.
Benoît Thébaudeau20db6312013-04-23 10:17:44 +000012 */
13
Benoît Thébaudeau20db6312013-04-23 10:17:44 +000014#include <fuse.h>
Simon Glassdbd79542020-05-10 11:40:11 -060015#include <linux/delay.h>
Masahiro Yamada56a931c2016-09-21 11:28:55 +090016#include <linux/errno.h>
Benoît Thébaudeau20db6312013-04-23 10:17:44 +000017#include <asm/io.h>
18#include <asm/arch/clock.h>
19#include <asm/arch/imx-regs.h>
Stefano Babic33731bc2017-06-29 10:16:06 +020020#include <asm/mach-imx/sys_proto.h>
Benoît Thébaudeau20db6312013-04-23 10:17:44 +000021
22#define BO_CTRL_WR_UNLOCK 16
23#define BM_CTRL_WR_UNLOCK 0xffff0000
24#define BV_CTRL_WR_UNLOCK_KEY 0x3e77
25#define BM_CTRL_ERROR 0x00000200
26#define BM_CTRL_BUSY 0x00000100
27#define BO_CTRL_ADDR 0
Adrian Alonso57b00132015-08-11 11:19:52 -050028#ifdef CONFIG_MX7
29#define BM_CTRL_ADDR 0x0000000f
30#define BM_CTRL_RELOAD 0x00000400
Peng Fan98c57822017-02-22 16:21:46 +080031#elif defined(CONFIG_MX7ULP)
32#define BM_CTRL_ADDR 0x000000FF
33#define BM_CTRL_RELOAD 0x00000400
34#define BM_OUT_STATUS_DED 0x00000400
35#define BM_OUT_STATUS_LOCKED 0x00000800
36#define BM_OUT_STATUS_PROGFAIL 0x00001000
Peng Fan39945c12018-11-20 10:19:25 +000037#elif defined(CONFIG_IMX8M)
Peng Fandc3accc2019-12-24 11:26:41 +080038#ifdef CONFIG_IMX8MP
39#undef BM_CTRL_ADDR
40#undef BM_CTRL_ERROR
41#undef BM_CTRL_BUSY
42#define BM_CTRL_ADDR 0x000001ff
43#define BM_CTRL_ERROR 0x00000400
44#define BM_CTRL_BUSY 0x00000200
45#else
Peng Fan716d4962018-01-10 13:20:39 +080046#define BM_CTRL_ADDR 0x000000ff
Peng Fandc3accc2019-12-24 11:26:41 +080047#endif
Adrian Alonso57b00132015-08-11 11:19:52 -050048#else
Benoît Thébaudeau20db6312013-04-23 10:17:44 +000049#define BM_CTRL_ADDR 0x0000007f
Adrian Alonso57b00132015-08-11 11:19:52 -050050#endif
Benoît Thébaudeau20db6312013-04-23 10:17:44 +000051
Adrian Alonso57b00132015-08-11 11:19:52 -050052#ifdef CONFIG_MX7
53#define BO_TIMING_FSOURCE 12
54#define BM_TIMING_FSOURCE 0x0007f000
55#define BV_TIMING_FSOURCE_NS 1001
56#define BO_TIMING_PROG 0
57#define BM_TIMING_PROG 0x00000fff
58#define BV_TIMING_PROG_US 10
59#else
Benoît Thébaudeau20db6312013-04-23 10:17:44 +000060#define BO_TIMING_STROBE_READ 16
61#define BM_TIMING_STROBE_READ 0x003f0000
62#define BV_TIMING_STROBE_READ_NS 37
63#define BO_TIMING_RELAX 12
64#define BM_TIMING_RELAX 0x0000f000
65#define BV_TIMING_RELAX_NS 17
66#define BO_TIMING_STROBE_PROG 0
67#define BM_TIMING_STROBE_PROG 0x00000fff
68#define BV_TIMING_STROBE_PROG_US 10
Adrian Alonso57b00132015-08-11 11:19:52 -050069#endif
Benoît Thébaudeau20db6312013-04-23 10:17:44 +000070
71#define BM_READ_CTRL_READ_FUSE 0x00000001
72
73#define BF(value, field) (((value) << BO_##field) & BM_##field)
74
75#define WRITE_POSTAMBLE_US 2
76
Peng Fan52bae462015-08-26 15:40:47 +080077#if defined(CONFIG_MX6) || defined(CONFIG_VF610)
78#define FUSE_BANK_SIZE 0x80
79#ifdef CONFIG_MX6SL
80#define FUSE_BANKS 8
Peng Fana2c2f6c2016-12-11 19:24:33 +080081#elif defined(CONFIG_MX6ULL) || defined(CONFIG_MX6SLL)
Peng Fancb356f92016-08-11 14:02:41 +080082#define FUSE_BANKS 9
Peng Fan52bae462015-08-26 15:40:47 +080083#else
84#define FUSE_BANKS 16
85#endif
86#elif defined CONFIG_MX7
87#define FUSE_BANK_SIZE 0x40
88#define FUSE_BANKS 16
Peng Fan98c57822017-02-22 16:21:46 +080089#elif defined(CONFIG_MX7ULP)
90#define FUSE_BANK_SIZE 0x80
91#define FUSE_BANKS 31
Peng Fan39945c12018-11-20 10:19:25 +000092#elif defined(CONFIG_IMX8M)
Peng Fan716d4962018-01-10 13:20:39 +080093#define FUSE_BANK_SIZE 0x40
Peng Fandc3accc2019-12-24 11:26:41 +080094#ifdef CONFIG_IMX8MP
95#define FUSE_BANKS 96
96#else
Peng Fan716d4962018-01-10 13:20:39 +080097#define FUSE_BANKS 64
Peng Fandc3accc2019-12-24 11:26:41 +080098#endif
Peng Fan52bae462015-08-26 15:40:47 +080099#else
100#error "Unsupported architecture\n"
101#endif
102
103#if defined(CONFIG_MX6)
Peng Fan52bae462015-08-26 15:40:47 +0800104
105/*
106 * There is a hole in shadow registers address map of size 0x100
Peng Fancb356f92016-08-11 14:02:41 +0800107 * between bank 5 and bank 6 on iMX6QP, iMX6DQ, iMX6SDL, iMX6SX,
Peng Fana2c2f6c2016-12-11 19:24:33 +0800108 * iMX6UL, i.MX6ULL and i.MX6SLL.
Peng Fan52bae462015-08-26 15:40:47 +0800109 * Bank 5 ends at 0x6F0 and Bank 6 starts at 0x800. When reading the fuses,
110 * we should account for this hole in address space.
111 *
112 * Similar hole exists between bank 14 and bank 15 of size
113 * 0x80 on iMX6QP, iMX6DQ, iMX6SDL and iMX6SX.
114 * Note: iMX6SL has only 0-7 banks and there is no hole.
115 * Note: iMX6UL doesn't have this one.
116 *
117 * This function is to covert user input to physical bank index.
118 * Only needed when read fuse, because we use register offset, so
119 * need to calculate real register offset.
120 * When write, no need to consider hole, always use the bank/word
121 * index from fuse map.
122 */
123u32 fuse_bank_physical(int index)
124{
125 u32 phy_index;
126
Peng Fan98c57822017-02-22 16:21:46 +0800127 if (is_mx6sl() || is_mx7ulp()) {
Peng Fan52bae462015-08-26 15:40:47 +0800128 phy_index = index;
Peng Fana2c2f6c2016-12-11 19:24:33 +0800129 } else if (is_mx6ul() || is_mx6ull() || is_mx6sll()) {
130 if ((is_mx6ull() || is_mx6sll()) && index == 8)
Peng Fancb356f92016-08-11 14:02:41 +0800131 index = 7;
132
Peng Fan52bae462015-08-26 15:40:47 +0800133 if (index >= 6)
134 phy_index = fuse_bank_physical(5) + (index - 6) + 3;
135 else
136 phy_index = index;
137 } else {
138 if (index >= 15)
139 phy_index = fuse_bank_physical(14) + (index - 15) + 2;
140 else if (index >= 6)
141 phy_index = fuse_bank_physical(5) + (index - 6) + 3;
142 else
143 phy_index = index;
144 }
145 return phy_index;
146}
Peng Fancb356f92016-08-11 14:02:41 +0800147
148u32 fuse_word_physical(u32 bank, u32 word_index)
149{
Peng Fana2c2f6c2016-12-11 19:24:33 +0800150 if (is_mx6ull() || is_mx6sll()) {
Peng Fancb356f92016-08-11 14:02:41 +0800151 if (bank == 8)
152 word_index = word_index + 4;
153 }
154
155 return word_index;
156}
Peng Fan52bae462015-08-26 15:40:47 +0800157#else
158u32 fuse_bank_physical(int index)
159{
160 return index;
161}
Peng Fancb356f92016-08-11 14:02:41 +0800162
163u32 fuse_word_physical(u32 bank, u32 word_index)
164{
165 return word_index;
166}
167
Peng Fan52bae462015-08-26 15:40:47 +0800168#endif
169
Benoît Thébaudeau20db6312013-04-23 10:17:44 +0000170static void wait_busy(struct ocotp_regs *regs, unsigned int delay_us)
171{
172 while (readl(&regs->ctrl) & BM_CTRL_BUSY)
173 udelay(delay_us);
174}
175
176static void clear_error(struct ocotp_regs *regs)
177{
178 writel(BM_CTRL_ERROR, &regs->ctrl_clr);
179}
180
181static int prepare_access(struct ocotp_regs **regs, u32 bank, u32 word,
182 int assert, const char *caller)
183{
184 *regs = (struct ocotp_regs *)OCOTP_BASE_ADDR;
185
Peng Fan52bae462015-08-26 15:40:47 +0800186 if (bank >= FUSE_BANKS ||
187 word >= ARRAY_SIZE((*regs)->bank[0].fuse_regs) >> 2 ||
188 !assert) {
Benoît Thébaudeau20db6312013-04-23 10:17:44 +0000189 printf("mxc_ocotp %s(): Invalid argument\n", caller);
190 return -EINVAL;
191 }
192
Peng Fana2c2f6c2016-12-11 19:24:33 +0800193 if (is_mx6ull() || is_mx6sll()) {
Peng Fancb356f92016-08-11 14:02:41 +0800194 if ((bank == 7 || bank == 8) &&
195 word >= ARRAY_SIZE((*regs)->bank[0].fuse_regs) >> 3) {
Peng Fana2c2f6c2016-12-11 19:24:33 +0800196 printf("mxc_ocotp %s(): Invalid argument\n", caller);
Peng Fancb356f92016-08-11 14:02:41 +0800197 return -EINVAL;
198 }
199 }
200
Benoît Thébaudeau20db6312013-04-23 10:17:44 +0000201 enable_ocotp_clk(1);
202
203 wait_busy(*regs, 1);
204 clear_error(*regs);
205
206 return 0;
207}
208
209static int finish_access(struct ocotp_regs *regs, const char *caller)
210{
211 u32 err;
212
213 err = !!(readl(&regs->ctrl) & BM_CTRL_ERROR);
214 clear_error(regs);
215
Peng Fan98c57822017-02-22 16:21:46 +0800216#ifdef CONFIG_MX7ULP
217 /* Need to power down the OTP memory */
218 writel(1, &regs->pdn);
219#endif
Benoît Thébaudeau20db6312013-04-23 10:17:44 +0000220 if (err) {
221 printf("mxc_ocotp %s(): Access protect error\n", caller);
222 return -EIO;
223 }
224
225 return 0;
226}
227
228static int prepare_read(struct ocotp_regs **regs, u32 bank, u32 word, u32 *val,
229 const char *caller)
230{
231 return prepare_access(regs, bank, word, val != NULL, caller);
232}
233
234int fuse_read(u32 bank, u32 word, u32 *val)
235{
236 struct ocotp_regs *regs;
237 int ret;
Peng Fan52bae462015-08-26 15:40:47 +0800238 u32 phy_bank;
Peng Fancb356f92016-08-11 14:02:41 +0800239 u32 phy_word;
Benoît Thébaudeau20db6312013-04-23 10:17:44 +0000240
241 ret = prepare_read(&regs, bank, word, val, __func__);
242 if (ret)
243 return ret;
244
Peng Fan52bae462015-08-26 15:40:47 +0800245 phy_bank = fuse_bank_physical(bank);
Peng Fancb356f92016-08-11 14:02:41 +0800246 phy_word = fuse_word_physical(bank, word);
Peng Fan52bae462015-08-26 15:40:47 +0800247
Peng Fancb356f92016-08-11 14:02:41 +0800248 *val = readl(&regs->bank[phy_bank].fuse_regs[phy_word << 2]);
Benoît Thébaudeau20db6312013-04-23 10:17:44 +0000249
Peng Fan98c57822017-02-22 16:21:46 +0800250#ifdef CONFIG_MX7ULP
251 if (readl(&regs->out_status) & BM_OUT_STATUS_DED) {
252 writel(BM_OUT_STATUS_DED, &regs->out_status_clr);
253 printf("mxc_ocotp %s(): fuse read wrong\n", __func__);
254 return -EIO;
255 }
256#endif
Benoît Thébaudeau20db6312013-04-23 10:17:44 +0000257 return finish_access(regs, __func__);
258}
259
Adrian Alonso57b00132015-08-11 11:19:52 -0500260#ifdef CONFIG_MX7
Benoît Thébaudeau20db6312013-04-23 10:17:44 +0000261static void set_timing(struct ocotp_regs *regs)
262{
263 u32 ipg_clk;
Adrian Alonso57b00132015-08-11 11:19:52 -0500264 u32 fsource, prog;
265 u32 timing;
266
267 ipg_clk = mxc_get_clock(MXC_IPG_CLK);
268
269 fsource = DIV_ROUND_UP((ipg_clk / 1000) * BV_TIMING_FSOURCE_NS,
270 + 1000000) + 1;
271 prog = DIV_ROUND_CLOSEST(ipg_clk * BV_TIMING_PROG_US, 1000000) + 1;
272
273 timing = BF(fsource, TIMING_FSOURCE) | BF(prog, TIMING_PROG);
274
275 clrsetbits_le32(&regs->timing, BM_TIMING_FSOURCE | BM_TIMING_PROG,
276 timing);
277}
Peng Fan98c57822017-02-22 16:21:46 +0800278#elif defined(CONFIG_MX7ULP)
279static void set_timing(struct ocotp_regs *regs)
280{
281 /* No timing set for MX7ULP */
282}
283
Adrian Alonso57b00132015-08-11 11:19:52 -0500284#else
285static void set_timing(struct ocotp_regs *regs)
286{
287 u32 ipg_clk;
Benoît Thébaudeau20db6312013-04-23 10:17:44 +0000288 u32 relax, strobe_read, strobe_prog;
289 u32 timing;
290
291 ipg_clk = mxc_get_clock(MXC_IPG_CLK);
292
293 relax = DIV_ROUND_UP(ipg_clk * BV_TIMING_RELAX_NS, 1000000000) - 1;
294 strobe_read = DIV_ROUND_UP(ipg_clk * BV_TIMING_STROBE_READ_NS,
295 1000000000) + 2 * (relax + 1) - 1;
Masahiro Yamadaeff8e682014-11-07 03:03:26 +0900296 strobe_prog = DIV_ROUND_CLOSEST(ipg_clk * BV_TIMING_STROBE_PROG_US,
297 1000000) + 2 * (relax + 1) - 1;
Benoît Thébaudeau20db6312013-04-23 10:17:44 +0000298
299 timing = BF(strobe_read, TIMING_STROBE_READ) |
300 BF(relax, TIMING_RELAX) |
301 BF(strobe_prog, TIMING_STROBE_PROG);
302
303 clrsetbits_le32(&regs->timing, BM_TIMING_STROBE_READ | BM_TIMING_RELAX |
304 BM_TIMING_STROBE_PROG, timing);
305}
Adrian Alonso57b00132015-08-11 11:19:52 -0500306#endif
Benoît Thébaudeau20db6312013-04-23 10:17:44 +0000307
308static void setup_direct_access(struct ocotp_regs *regs, u32 bank, u32 word,
309 int write)
310{
311 u32 wr_unlock = write ? BV_CTRL_WR_UNLOCK_KEY : 0;
Adrian Alonso57b00132015-08-11 11:19:52 -0500312#ifdef CONFIG_MX7
313 u32 addr = bank;
Peng Fan39945c12018-11-20 10:19:25 +0000314#elif defined CONFIG_IMX8M
Peng Fan716d4962018-01-10 13:20:39 +0800315 u32 addr = bank << 2 | word;
Adrian Alonso57b00132015-08-11 11:19:52 -0500316#else
Peng Fancb356f92016-08-11 14:02:41 +0800317 u32 addr;
318 /* Bank 7 and Bank 8 only supports 4 words each for i.MX6ULL */
Peng Fana2c2f6c2016-12-11 19:24:33 +0800319 if ((is_mx6ull() || is_mx6sll()) && (bank > 7)) {
Peng Fancb356f92016-08-11 14:02:41 +0800320 bank = bank - 1;
321 word += 4;
322 }
323 addr = bank << 3 | word;
Adrian Alonso57b00132015-08-11 11:19:52 -0500324#endif
Benoît Thébaudeau20db6312013-04-23 10:17:44 +0000325
326 set_timing(regs);
327 clrsetbits_le32(&regs->ctrl, BM_CTRL_WR_UNLOCK | BM_CTRL_ADDR,
328 BF(wr_unlock, CTRL_WR_UNLOCK) |
329 BF(addr, CTRL_ADDR));
330}
331
332int fuse_sense(u32 bank, u32 word, u32 *val)
333{
334 struct ocotp_regs *regs;
335 int ret;
336
Ye Lic29b7c72021-03-19 15:57:17 +0800337 if (is_imx8mq() && (soc_rev() >= CHIP_REV_2_1)) {
Ye Li4d5e0a22019-04-17 09:41:23 +0000338 printf("mxc_ocotp %s(): fuse sense is disabled\n", __func__);
339 return -EPERM;
340 }
341
Benoît Thébaudeau20db6312013-04-23 10:17:44 +0000342 ret = prepare_read(&regs, bank, word, val, __func__);
343 if (ret)
344 return ret;
345
346 setup_direct_access(regs, bank, word, false);
347 writel(BM_READ_CTRL_READ_FUSE, &regs->read_ctrl);
348 wait_busy(regs, 1);
Adrian Alonso57b00132015-08-11 11:19:52 -0500349#ifdef CONFIG_MX7
350 *val = readl((&regs->read_fuse_data0) + (word << 2));
351#else
Benoît Thébaudeau20db6312013-04-23 10:17:44 +0000352 *val = readl(&regs->read_fuse_data);
Adrian Alonso57b00132015-08-11 11:19:52 -0500353#endif
Benoît Thébaudeau20db6312013-04-23 10:17:44 +0000354
Peng Fan98c57822017-02-22 16:21:46 +0800355#ifdef CONFIG_MX7ULP
356 if (readl(&regs->out_status) & BM_OUT_STATUS_DED) {
357 writel(BM_OUT_STATUS_DED, &regs->out_status_clr);
358 printf("mxc_ocotp %s(): fuse read wrong\n", __func__);
359 return -EIO;
360 }
361#endif
362
Benoît Thébaudeau20db6312013-04-23 10:17:44 +0000363 return finish_access(regs, __func__);
364}
365
366static int prepare_write(struct ocotp_regs **regs, u32 bank, u32 word,
367 const char *caller)
368{
Peng Fan235ba332018-01-02 15:51:20 +0800369#ifdef CONFIG_MX7ULP
370 u32 val;
371 int ret;
372
373 /* Only bank 0 and 1 are redundancy mode, others are ECC mode */
374 if (bank != 0 && bank != 1) {
Ye Li2cb89e32019-04-17 09:41:20 +0000375 if ((soc_rev() < CHIP_REV_2_0) ||
376 ((soc_rev() >= CHIP_REV_2_0) &&
377 bank != 9 && bank != 10 && bank != 28)) {
378 ret = fuse_sense(bank, word, &val);
379 if (ret)
380 return ret;
Peng Fan235ba332018-01-02 15:51:20 +0800381
Ye Li2cb89e32019-04-17 09:41:20 +0000382 if (val != 0) {
383 printf("mxc_ocotp: The word has been programmed, no more write\n");
384 return -EPERM;
385 }
Peng Fan235ba332018-01-02 15:51:20 +0800386 }
387 }
388#endif
389
Benoît Thébaudeau20db6312013-04-23 10:17:44 +0000390 return prepare_access(regs, bank, word, true, caller);
391}
392
393int fuse_prog(u32 bank, u32 word, u32 val)
394{
395 struct ocotp_regs *regs;
396 int ret;
397
398 ret = prepare_write(&regs, bank, word, __func__);
399 if (ret)
400 return ret;
401
402 setup_direct_access(regs, bank, word, true);
Adrian Alonso57b00132015-08-11 11:19:52 -0500403#ifdef CONFIG_MX7
404 switch (word) {
405 case 0:
406 writel(0, &regs->data1);
407 writel(0, &regs->data2);
408 writel(0, &regs->data3);
409 writel(val, &regs->data0);
410 break;
411 case 1:
412 writel(val, &regs->data1);
413 writel(0, &regs->data2);
414 writel(0, &regs->data3);
415 writel(0, &regs->data0);
416 break;
417 case 2:
418 writel(0, &regs->data1);
419 writel(val, &regs->data2);
420 writel(0, &regs->data3);
421 writel(0, &regs->data0);
422 break;
423 case 3:
424 writel(0, &regs->data1);
425 writel(0, &regs->data2);
426 writel(val, &regs->data3);
427 writel(0, &regs->data0);
428 break;
429 }
430 wait_busy(regs, BV_TIMING_PROG_US);
431#else
Benoît Thébaudeau20db6312013-04-23 10:17:44 +0000432 writel(val, &regs->data);
433 wait_busy(regs, BV_TIMING_STROBE_PROG_US);
Adrian Alonso57b00132015-08-11 11:19:52 -0500434#endif
Benoît Thébaudeau20db6312013-04-23 10:17:44 +0000435 udelay(WRITE_POSTAMBLE_US);
436
Peng Fan98c57822017-02-22 16:21:46 +0800437#ifdef CONFIG_MX7ULP
438 if (readl(&regs->out_status) & (BM_OUT_STATUS_PROGFAIL | BM_OUT_STATUS_LOCKED)) {
439 writel((BM_OUT_STATUS_PROGFAIL | BM_OUT_STATUS_LOCKED), &regs->out_status_clr);
440 printf("mxc_ocotp %s(): fuse write is failed\n", __func__);
441 return -EIO;
442 }
443#endif
444
Benoît Thébaudeau20db6312013-04-23 10:17:44 +0000445 return finish_access(regs, __func__);
446}
447
448int fuse_override(u32 bank, u32 word, u32 val)
449{
450 struct ocotp_regs *regs;
451 int ret;
Peng Fan52bae462015-08-26 15:40:47 +0800452 u32 phy_bank;
Peng Fancb356f92016-08-11 14:02:41 +0800453 u32 phy_word;
Benoît Thébaudeau20db6312013-04-23 10:17:44 +0000454
455 ret = prepare_write(&regs, bank, word, __func__);
456 if (ret)
457 return ret;
458
Peng Fan52bae462015-08-26 15:40:47 +0800459 phy_bank = fuse_bank_physical(bank);
Peng Fancb356f92016-08-11 14:02:41 +0800460 phy_word = fuse_word_physical(bank, word);
Peng Fan52bae462015-08-26 15:40:47 +0800461
Peng Fancb356f92016-08-11 14:02:41 +0800462 writel(val, &regs->bank[phy_bank].fuse_regs[phy_word << 2]);
Benoît Thébaudeau20db6312013-04-23 10:17:44 +0000463
Peng Fan98c57822017-02-22 16:21:46 +0800464#ifdef CONFIG_MX7ULP
465 if (readl(&regs->out_status) & (BM_OUT_STATUS_PROGFAIL | BM_OUT_STATUS_LOCKED)) {
466 writel((BM_OUT_STATUS_PROGFAIL | BM_OUT_STATUS_LOCKED), &regs->out_status_clr);
467 printf("mxc_ocotp %s(): fuse write is failed\n", __func__);
468 return -EIO;
469 }
470#endif
471
Benoît Thébaudeau20db6312013-04-23 10:17:44 +0000472 return finish_access(regs, __func__);
473}