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