Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Mario Six | 10d1449 | 2017-01-11 16:01:00 +0100 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2015 Reinhard Pfau <reinhard.pfau@gdsys.cc> |
Mario Six | 10d1449 | 2017-01-11 16:01:00 +0100 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #ifndef _MVEBU_EFUSE_H |
| 7 | #define _MVEBU_EFUSE_H |
| 8 | |
Mario Six | 10d1449 | 2017-01-11 16:01:00 +0100 | [diff] [blame] | 9 | struct efuse_val { |
| 10 | union { |
| 11 | struct { |
| 12 | u8 d[8]; |
| 13 | } bytes; |
| 14 | struct { |
| 15 | u16 d[4]; |
| 16 | } words; |
| 17 | struct { |
| 18 | u32 d[2]; |
| 19 | } dwords; |
| 20 | }; |
| 21 | u32 lock; |
| 22 | }; |
| 23 | |
| 24 | #if defined(CONFIG_ARMADA_38X) |
| 25 | |
| 26 | enum efuse_line { |
| 27 | EFUSE_LINE_SECURE_BOOT = 24, |
| 28 | EFUSE_LINE_PUBKEY_DIGEST_0 = 26, |
| 29 | EFUSE_LINE_PUBKEY_DIGEST_1 = 27, |
| 30 | EFUSE_LINE_PUBKEY_DIGEST_2 = 28, |
| 31 | EFUSE_LINE_PUBKEY_DIGEST_3 = 29, |
| 32 | EFUSE_LINE_PUBKEY_DIGEST_4 = 30, |
| 33 | EFUSE_LINE_CSK_0_VALID = 31, |
| 34 | EFUSE_LINE_CSK_1_VALID = 32, |
| 35 | EFUSE_LINE_CSK_2_VALID = 33, |
| 36 | EFUSE_LINE_CSK_3_VALID = 34, |
| 37 | EFUSE_LINE_CSK_4_VALID = 35, |
| 38 | EFUSE_LINE_CSK_5_VALID = 36, |
| 39 | EFUSE_LINE_CSK_6_VALID = 37, |
| 40 | EFUSE_LINE_CSK_7_VALID = 38, |
| 41 | EFUSE_LINE_CSK_8_VALID = 39, |
| 42 | EFUSE_LINE_CSK_9_VALID = 40, |
| 43 | EFUSE_LINE_CSK_10_VALID = 41, |
| 44 | EFUSE_LINE_CSK_11_VALID = 42, |
| 45 | EFUSE_LINE_CSK_12_VALID = 43, |
| 46 | EFUSE_LINE_CSK_13_VALID = 44, |
| 47 | EFUSE_LINE_CSK_14_VALID = 45, |
| 48 | EFUSE_LINE_CSK_15_VALID = 46, |
| 49 | EFUSE_LINE_FLASH_ID = 47, |
| 50 | EFUSE_LINE_BOX_ID = 48, |
| 51 | |
| 52 | EFUSE_LINE_MIN = 0, |
| 53 | EFUSE_LINE_MAX = 63, |
Pali Rohár | df1da73 | 2022-04-06 14:18:18 +0200 | [diff] [blame] | 54 | |
| 55 | EFUSE_LD0_LINE = 64, |
| 56 | EFUSE_LD1_LINE = 65, |
Mario Six | 10d1449 | 2017-01-11 16:01:00 +0100 | [diff] [blame] | 57 | }; |
| 58 | |
Pali Rohár | df1da73 | 2022-04-06 14:18:18 +0200 | [diff] [blame] | 59 | #define EFUSE_LD_WORDS 9 |
| 60 | |
Mario Six | 10d1449 | 2017-01-11 16:01:00 +0100 | [diff] [blame] | 61 | #endif |
| 62 | |
| 63 | int mvebu_efuse_init_hw(void); |
| 64 | |
| 65 | int mvebu_read_efuse(int nr, struct efuse_val *val); |
| 66 | |
| 67 | int mvebu_write_efuse(int nr, struct efuse_val *val); |
| 68 | |
| 69 | int mvebu_lock_efuse(int nr); |
| 70 | |
Pali Rohár | 666252d | 2022-09-22 13:43:44 +0200 | [diff] [blame] | 71 | void mvebu_read_ld_efuse(int ld1, u32 *line); |
| 72 | |
| 73 | int mvebu_prog_ld_efuse(int ld1, u32 word, u32 val); |
| 74 | |
Mario Six | 10d1449 | 2017-01-11 16:01:00 +0100 | [diff] [blame] | 75 | #endif |