1*4882a593SmuzhiyunFuse API functions and commands 2*4882a593Smuzhiyun 3*4882a593SmuzhiyunThe fuse API allows to control a fusebox and how it is used by the upper 4*4882a593Smuzhiyunhardware layers. 5*4882a593Smuzhiyun 6*4882a593SmuzhiyunA fuse corresponds to a single non-volatile memory bit that can be programmed 7*4882a593Smuzhiyun(i.e. blown, set to 1) only once. The programming operation is irreversible. A 8*4882a593Smuzhiyunfuse that has not been programmed reads 0. 9*4882a593Smuzhiyun 10*4882a593SmuzhiyunFuses can be used by SoCs to store various permanent configuration and data, 11*4882a593Smuzhiyune.g. boot configuration, security configuration, MAC addresses, etc. 12*4882a593Smuzhiyun 13*4882a593SmuzhiyunA fuse word is the smallest group of fuses that can be read at once from the 14*4882a593Smuzhiyunfusebox control IP registers. This is limited to 32 bits with the current API. 15*4882a593Smuzhiyun 16*4882a593SmuzhiyunA fuse bank is the smallest group of fuse words having a common ID, as defined 17*4882a593Smuzhiyunby each SoC. 18*4882a593Smuzhiyun 19*4882a593SmuzhiyunUpon startup, the fusebox control IP reads the fuse values and stores them to a 20*4882a593Smuzhiyunvolatile shadow cache. 21*4882a593Smuzhiyun 22*4882a593SmuzhiyunSee the README files of the drivers implementing this API in order to know the 23*4882a593SmuzhiyunSoC- and implementation-specific details. 24*4882a593Smuzhiyun 25*4882a593SmuzhiyunFunctions / commands: 26*4882a593Smuzhiyun 27*4882a593Smuzhiyun int fuse_read(u32 bank, u32 word, u32 *val); 28*4882a593Smuzhiyun fuse read <bank> <word> [<cnt>] 29*4882a593Smuzhiyun Read fuse words from the shadow cache. 30*4882a593Smuzhiyun 31*4882a593Smuzhiyun int fuse_sense(u32 bank, u32 word, u32 *val); 32*4882a593Smuzhiyun fuse sense <bank> <word> [<cnt>] 33*4882a593Smuzhiyun Sense - i.e. read directly from the fusebox, skipping the shadow cache - 34*4882a593Smuzhiyun fuse words. This operation does not update the shadow cache. 35*4882a593Smuzhiyun 36*4882a593Smuzhiyun This is useful to know the true value of fuses if an override has been 37*4882a593Smuzhiyun performed (see below). 38*4882a593Smuzhiyun 39*4882a593Smuzhiyun int fuse_prog(u32 bank, u32 word, u32 val); 40*4882a593Smuzhiyun fuse prog [-y] <bank> <word> <hexval> [<hexval>...] 41*4882a593Smuzhiyun Program fuse words. This operation directly affects the fusebox and is 42*4882a593Smuzhiyun irreversible. The shadow cache is updated accordingly or not, depending on 43*4882a593Smuzhiyun each IP. 44*4882a593Smuzhiyun 45*4882a593Smuzhiyun Only the bits to be programmed should be set in the input value (i.e. for 46*4882a593Smuzhiyun fuse bits that have already been programmed and hence should be left 47*4882a593Smuzhiyun unchanged by a further programming, it is preferable to clear the 48*4882a593Smuzhiyun corresponding bits in the input value in order not to perform a new 49*4882a593Smuzhiyun hardware programming operation on these fuse bits). 50*4882a593Smuzhiyun 51*4882a593Smuzhiyun int fuse_override(u32 bank, u32 word, u32 val); 52*4882a593Smuzhiyun fuse override <bank> <word> <hexval> [<hexval>...] 53*4882a593Smuzhiyun Override fuse words in the shadow cache. 54*4882a593Smuzhiyun 55*4882a593Smuzhiyun The fusebox is unaffected, so following this operation, the shadow cache 56*4882a593Smuzhiyun may differ from the fusebox values. Read or sense operations can then be 57*4882a593Smuzhiyun used to get the values from the shadow cache or from the fusebox. 58*4882a593Smuzhiyun 59*4882a593Smuzhiyun This is useful to change the behaviors linked to some cached fuse values, 60*4882a593Smuzhiyun either because this is needed only temporarily, or because some of the 61*4882a593Smuzhiyun fuses have already been programmed or are locked (if the SoC allows to 62*4882a593Smuzhiyun override a locked fuse). 63*4882a593Smuzhiyun 64*4882a593SmuzhiyunConfiguration: 65*4882a593Smuzhiyun 66*4882a593Smuzhiyun CONFIG_CMD_FUSE 67*4882a593Smuzhiyun Define this to enable the fuse commands. 68