1
2
3
4
5
6#ifndef __CVMX_FUSE_H__
7#define __CVMX_FUSE_H__
8
9
10
11
12
13
14
15
16static inline u8 cvmx_fuse_read_byte_node(u8 node, int byte_addr)
17{
18 u64 val;
19
20 val = FIELD_PREP(MIO_FUS_RCMD_ADDR, byte_addr) | MIO_FUS_RCMD_PEND;
21 csr_wr_node(node, CVMX_MIO_FUS_RCMD, val);
22
23 do {
24 val = csr_rd_node(node, CVMX_MIO_FUS_RCMD);
25 } while (val & MIO_FUS_RCMD_PEND);
26
27 return FIELD_GET(MIO_FUS_RCMD_DAT, val);
28}
29
30
31
32
33
34
35
36static inline u8 cvmx_fuse_read_byte(int byte_addr)
37{
38 return cvmx_fuse_read_byte_node(0, byte_addr);
39}
40
41
42
43
44
45
46
47
48
49static inline int cvmx_fuse_read_node(u8 node, int fuse)
50{
51 return (cvmx_fuse_read_byte_node(node, fuse >> 3) >> (fuse & 0x7)) & 1;
52}
53
54
55
56
57
58
59
60
61static inline int cvmx_fuse_read(int fuse)
62{
63 return cvmx_fuse_read_node(0, fuse);
64}
65
66static inline int cvmx_octeon_fuse_locked(void)
67{
68 return cvmx_fuse_read(123);
69}
70
71#endif
72