1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (C) 2015 Reinhard Pfau <reinhard.pfau@gdsys.cc>
4  */
5 
6 #ifndef _MVEBU_EFUSE_H
7 #define _MVEBU_EFUSE_H
8 
9 #include <common.h>
10 
11 struct efuse_val {
12 	union {
13 		struct {
14 			u8 d[8];
15 		} bytes;
16 		struct {
17 			u16 d[4];
18 		} words;
19 		struct {
20 			u32 d[2];
21 		} dwords;
22 	};
23 	u32 lock;
24 };
25 
26 #if defined(CONFIG_ARMADA_38X)
27 
28 enum efuse_line {
29 	EFUSE_LINE_SECURE_BOOT = 24,
30 	EFUSE_LINE_PUBKEY_DIGEST_0 = 26,
31 	EFUSE_LINE_PUBKEY_DIGEST_1 = 27,
32 	EFUSE_LINE_PUBKEY_DIGEST_2 = 28,
33 	EFUSE_LINE_PUBKEY_DIGEST_3 = 29,
34 	EFUSE_LINE_PUBKEY_DIGEST_4 = 30,
35 	EFUSE_LINE_CSK_0_VALID = 31,
36 	EFUSE_LINE_CSK_1_VALID = 32,
37 	EFUSE_LINE_CSK_2_VALID = 33,
38 	EFUSE_LINE_CSK_3_VALID = 34,
39 	EFUSE_LINE_CSK_4_VALID = 35,
40 	EFUSE_LINE_CSK_5_VALID = 36,
41 	EFUSE_LINE_CSK_6_VALID = 37,
42 	EFUSE_LINE_CSK_7_VALID = 38,
43 	EFUSE_LINE_CSK_8_VALID = 39,
44 	EFUSE_LINE_CSK_9_VALID = 40,
45 	EFUSE_LINE_CSK_10_VALID = 41,
46 	EFUSE_LINE_CSK_11_VALID = 42,
47 	EFUSE_LINE_CSK_12_VALID = 43,
48 	EFUSE_LINE_CSK_13_VALID = 44,
49 	EFUSE_LINE_CSK_14_VALID = 45,
50 	EFUSE_LINE_CSK_15_VALID = 46,
51 	EFUSE_LINE_FLASH_ID = 47,
52 	EFUSE_LINE_BOX_ID = 48,
53 
54 	EFUSE_LINE_MIN = 0,
55 	EFUSE_LINE_MAX = 63,
56 };
57 
58 #endif
59 
60 int mvebu_efuse_init_hw(void);
61 
62 int mvebu_read_efuse(int nr, struct efuse_val *val);
63 
64 int mvebu_write_efuse(int nr, struct efuse_val *val);
65 
66 int mvebu_lock_efuse(int nr);
67 
68 #endif
69