1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30#ifndef __RTL_EFUSE_H_
31#define __RTL_EFUSE_H_
32
33#define EFUSE_IC_ID_OFFSET 506
34
35
36
37
38
39
40
41
42
43#define EFUSE_MAX_WORD_UNIT 4
44
45#define EFUSE_INIT_MAP 0
46#define EFUSE_MODIFY_MAP 1
47
48#define PG_STATE_HEADER 0x01
49#define PG_STATE_WORD_0 0x02
50#define PG_STATE_WORD_1 0x04
51#define PG_STATE_WORD_2 0x08
52#define PG_STATE_WORD_3 0x10
53#define PG_STATE_DATA 0x20
54
55#define PG_SWBYTE_H 0x01
56#define PG_SWBYTE_L 0x02
57
58#define _POWERON_DELAY_
59#define _PRE_EXECUTE_READ_CMD_
60
61#define EFUSE_REPEAT_THRESHOLD_ 3
62#define EFUSE_ERROE_HANDLE 1
63
64struct efuse_map {
65 u8 offset;
66 u8 word_start;
67 u8 byte_start;
68 u8 byte_cnts;
69};
70
71struct pgpkt_struct {
72 u8 offset;
73 u8 word_en;
74 u8 data[8];
75};
76
77enum efuse_data_item {
78 EFUSE_CHIP_ID = 0,
79 EFUSE_LDO_SETTING,
80 EFUSE_CLK_SETTING,
81 EFUSE_SDIO_SETTING,
82 EFUSE_CCCR,
83 EFUSE_SDIO_MODE,
84 EFUSE_OCR,
85 EFUSE_F0CIS,
86 EFUSE_F1CIS,
87 EFUSE_MAC_ADDR,
88 EFUSE_EEPROM_VER,
89 EFUSE_CHAN_PLAN,
90 EFUSE_TXPW_TAB
91};
92
93enum {
94 VOLTAGE_V25 = 0x03,
95 LDOE25_SHIFT = 28,
96};
97
98struct efuse_priv {
99 u8 id[2];
100 u8 ldo_setting[2];
101 u8 clk_setting[2];
102 u8 cccr;
103 u8 sdio_mode;
104 u8 ocr[3];
105 u8 cis0[17];
106 u8 cis1[48];
107 u8 mac_addr[6];
108 u8 eeprom_verno;
109 u8 channel_plan;
110 u8 tx_power_b[14];
111 u8 tx_power_g[14];
112};
113
114extern void read_efuse_byte(struct ieee80211_hw *hw, u16 _offset, u8 *pbuf);
115extern void efuse_initialize(struct ieee80211_hw *hw);
116extern u8 efuse_read_1byte(struct ieee80211_hw *hw, u16 address);
117extern int efuse_one_byte_read(struct ieee80211_hw *hw, u16 addr, u8 *data);
118extern void efuse_write_1byte(struct ieee80211_hw *hw, u16 address, u8 value);
119extern void read_efuse(struct ieee80211_hw *hw, u16 _offset,
120 u16 _size_byte, u8 * pbuf);
121extern void efuse_shadow_read(struct ieee80211_hw *hw, u8 type,
122 u16 offset, u32 * value);
123extern void efuse_shadow_write(struct ieee80211_hw *hw, u8 type,
124 u16 offset, u32 value);
125extern bool efuse_shadow_update(struct ieee80211_hw *hw);
126extern bool efuse_shadow_update_chk(struct ieee80211_hw *hw);
127extern void rtl_efuse_shadow_map_update(struct ieee80211_hw *hw);
128extern void efuse_force_write_vendor_Id(struct ieee80211_hw *hw);
129extern void efuse_re_pg_section(struct ieee80211_hw *hw, u8 section_idx);
130#endif
131