| 1 | #ifndef __CB_BDK_FUSE_H__ |
| 2 | #define __CB_BDK_FUSE_H__ |
| 3 | |
| 4 | /***********************license start*********************************** |
| 5 | * Copyright (c) 2003-2017 Cavium Inc. ([email protected]). All rights |
| 6 | * reserved. |
| 7 | * |
| 8 | * |
| 9 | * Redistribution and use in source and binary forms, with or without |
| 10 | * modification, are permitted provided that the following conditions are |
| 11 | * met: |
| 12 | * |
| 13 | * * Redistributions of source code must retain the above copyright |
| 14 | * notice, this list of conditions and the following disclaimer. |
| 15 | * |
| 16 | * * Redistributions in binary form must reproduce the above |
| 17 | * copyright notice, this list of conditions and the following |
| 18 | * disclaimer in the documentation and/or other materials provided |
| 19 | * with the distribution. |
| 20 | * |
| 21 | * * Neither the name of Cavium Inc. nor the names of |
| 22 | * its contributors may be used to endorse or promote products |
| 23 | * derived from this software without specific prior written |
| 24 | * permission. |
| 25 | * |
| 26 | * This Software, including technical data, may be subject to U.S. export |
| 27 | * control laws, including the U.S. Export Administration Act and its |
| 28 | * associated regulations, and may be subject to export or import |
| 29 | * regulations in other countries. |
| 30 | * |
| 31 | * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" |
| 32 | * AND WITH ALL FAULTS AND CAVIUM INC. MAKES NO PROMISES, REPRESENTATIONS OR |
| 33 | * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT |
| 34 | * TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY |
| 35 | * REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT |
| 36 | * DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES |
| 37 | * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR |
| 38 | * PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, |
| 39 | * QUIET POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK |
| 40 | * ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU. |
| 41 | ***********************license end**************************************/ |
| 42 | |
| 43 | /** |
| 44 | * @file |
| 45 | * |
| 46 | * Functions for reading Cavium chip fuses. |
| 47 | * |
| 48 | * <hr>$Revision: 49448 $<hr> |
| 49 | */ |
| 50 | |
| 51 | |
| 52 | /** |
| 53 | * Read a single fuse bit |
| 54 | * |
| 55 | * @param fuse Fuse number (0-1024) |
| 56 | * |
| 57 | * @return fuse value: 0 or 1 |
| 58 | */ |
| 59 | extern int bdk_fuse_read(bdk_node_t node, int fuse); |
| 60 | |
| 61 | /** |
| 62 | * Read a range of fuses |
| 63 | * |
| 64 | * @param node Node to read from |
| 65 | * @param fuse Fuse number |
| 66 | * @param width Number of fuses to read, max of 64 |
| 67 | * |
| 68 | * @return Fuse value |
| 69 | */ |
| 70 | extern uint64_t bdk_fuse_read_range(bdk_node_t node, int fuse, int width); |
| 71 | |
| 72 | /** |
| 73 | * Soft blow a fuse. Soft blown fuses keep there new value over soft resets, but |
| 74 | * not power cycles. |
| 75 | * |
| 76 | * @param node Node to blow |
| 77 | * @param fuse Fuse to blow |
| 78 | * |
| 79 | * @return Zero on success, negative on failure |
| 80 | */ |
| 81 | extern int bdk_fuse_soft_blow(bdk_node_t node, int fuse); |
| 82 | |
| 83 | /** |
| 84 | * Read a single fuse bit from the field set (FUSF) |
| 85 | * |
| 86 | * @param fuse Fuse number (0-1024) |
| 87 | * |
| 88 | * @return fuse value: 0 or 1 |
| 89 | */ |
| 90 | extern int bdk_fuse_field_read(bdk_node_t node, int fuse); |
| 91 | |
| 92 | /** |
| 93 | * Soft blow a fuse in the field set (FUSF). Soft blown fuses |
| 94 | * keep there new value over soft resets, but not power cycles. |
| 95 | * |
| 96 | * @param node Node to blow |
| 97 | * @param fuse Fuse to blow |
| 98 | * |
| 99 | * @return Zero on success, negative on failure |
| 100 | */ |
| 101 | extern int bdk_fuse_field_soft_blow(bdk_node_t node, int fuse); |
| 102 | |
| 103 | /** |
| 104 | * Hard blow fuses in the field set (FUSF). Up to 128 fuses in a bank |
| 105 | * are blown at the same time |
| 106 | * |
| 107 | * @param node Node to blow |
| 108 | * @param start_fuse First fuses to blow. Must be on a 128 bit boundary. |
| 109 | * This fuse is blown to match the LSB of fuse 0. |
| 110 | * @param fuses0 First 64 fuse values. Bits with a 1 are blown. LSB |
| 111 | * of fuses0 maps to start_fuse. MSB of fuses0 maps to |
| 112 | * (start_fuse + 63). |
| 113 | * @param fuses1 Second 64 fuse values. Bits with a 1 are blown. LSB |
| 114 | * of fuses1 maps to (start_fuse + 64). MSB of fuses1 |
| 115 | * maps to (start_fuse + 127). |
| 116 | * |
| 117 | * @return Zero on success, negative on failure |
| 118 | */ |
| 119 | extern int bdk_fuse_field_hard_blow(bdk_node_t node, int start_fuse, uint64_t fuses0, uint64_t fuses1); |
| 120 | |
| 121 | #endif |