mtd: Use kasprintf() instead of fixed buffer formatting
[linux/fpc-iii.git] / drivers / staging / rtlwifi / efuse.h
blob5335d3ee6da771fd700cba57c00671f78e847522
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /******************************************************************************
4 * Copyright(c) 2009-2012 Realtek Corporation.
6 * Contact Information:
7 * wlanfae <wlanfae@realtek.com>
8 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
9 * Hsinchu 300, Taiwan.
11 * Larry Finger <Larry.Finger@lwfinger.net>
13 *****************************************************************************/
15 #ifndef __RTL_EFUSE_H_
16 #define __RTL_EFUSE_H_
18 #define EFUSE_IC_ID_OFFSET 506
20 #define EFUSE_MAX_WORD_UNIT 4
22 #define EFUSE_INIT_MAP 0
23 #define EFUSE_MODIFY_MAP 1
25 #define PG_STATE_HEADER 0x01
26 #define PG_STATE_WORD_0 0x02
27 #define PG_STATE_WORD_1 0x04
28 #define PG_STATE_WORD_2 0x08
29 #define PG_STATE_WORD_3 0x10
30 #define PG_STATE_DATA 0x20
32 #define EFUSE_REPEAT_THRESHOLD_ 3
33 #define EFUSE_ERROE_HANDLE 1
35 struct efuse_map {
36 u8 offset;
37 u8 word_start;
38 u8 byte_start;
39 u8 byte_cnts;
42 struct pgpkt_struct {
43 u8 offset;
44 u8 word_en;
45 u8 data[8];
48 enum efuse_data_item {
49 EFUSE_CHIP_ID = 0,
50 EFUSE_LDO_SETTING,
51 EFUSE_CLK_SETTING,
52 EFUSE_SDIO_SETTING,
53 EFUSE_CCCR,
54 EFUSE_SDIO_MODE,
55 EFUSE_OCR,
56 EFUSE_F0CIS,
57 EFUSE_F1CIS,
58 EFUSE_MAC_ADDR,
59 EFUSE_EEPROM_VER,
60 EFUSE_CHAN_PLAN,
61 EFUSE_TXPW_TAB
64 enum {
65 VOLTAGE_V25 = 0x03,
66 LDOE25_SHIFT = 28,
69 struct efuse_priv {
70 u8 id[2];
71 u8 ldo_setting[2];
72 u8 clk_setting[2];
73 u8 cccr;
74 u8 sdio_mode;
75 u8 ocr[3];
76 u8 cis0[17];
77 u8 cis1[48];
78 u8 mac_addr[6];
79 u8 eeprom_verno;
80 u8 channel_plan;
81 u8 tx_power_b[14];
82 u8 tx_power_g[14];
85 void read_efuse_byte(struct ieee80211_hw *hw, u16 _offset, u8 *pbuf);
86 void efuse_initialize(struct ieee80211_hw *hw);
87 u8 efuse_read_1byte(struct ieee80211_hw *hw, u16 address);
88 int efuse_one_byte_read(struct ieee80211_hw *hw, u16 addr, u8 *data);
89 void efuse_write_1byte(struct ieee80211_hw *hw, u16 address, u8 value);
90 void read_efuse(struct ieee80211_hw *hw, u16 _offset,
91 u16 _size_byte, u8 *pbuf);
92 void efuse_shadow_read(struct ieee80211_hw *hw, u8 type,
93 u16 offset, u32 *value);
94 void efuse_shadow_write(struct ieee80211_hw *hw, u8 type,
95 u16 offset, u32 value);
96 bool efuse_shadow_update(struct ieee80211_hw *hw);
97 bool efuse_shadow_update_chk(struct ieee80211_hw *hw);
98 void rtl_efuse_shadow_map_update(struct ieee80211_hw *hw);
99 void efuse_force_write_vendor_id(struct ieee80211_hw *hw);
100 void efuse_re_pg_section(struct ieee80211_hw *hw, u8 section_idx);
101 void efuse_power_switch(struct ieee80211_hw *hw, u8 write, u8 pwrstate);
102 int rtl_get_hwinfo(struct ieee80211_hw *hw, struct rtl_priv *rtlpriv,
103 int max_size, u8 *hwinfo, int *params);
104 void rtl_fill_dummy(u8 *pfwbuf, u32 *pfwlen);
105 void rtl_fw_page_write(struct ieee80211_hw *hw, u32 page, const u8 *buffer,
106 u32 size);
107 void rtl_fw_block_write(struct ieee80211_hw *hw, const u8 *buffer, u32 size);
109 #endif