2 * Copyright (c) 2016 Andriy Voskoboinyk <avos@FreeBSD.org>
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 #ifndef R12A_ROM_IMAGE_H
30 #define R12A_ROM_IMAGE_H
32 #include <dev/rtwn/rtl8812a/r12a_rom_defs.h>
34 #define R12A_DEF_TX_PWR_2G 0x2d
35 #define R12A_DEF_TX_PWR_5G 0xfe
37 struct r12a_tx_pwr_2g {
38 uint8_t cck[R12A_GROUP_2G];
39 uint8_t ht40[R12A_GROUP_2G - 1];
42 struct r12a_tx_pwr_diff_2g {
47 } __packed diff123[R12A_MAX_TX_COUNT - 1];
50 struct r12a_tx_pwr_5g {
51 uint8_t ht40[R12A_GROUP_5G];
54 struct r12a_tx_pwr_diff_5g {
56 uint8_t ht40_ht20[R12A_MAX_TX_COUNT - 1];
58 uint8_t ht80_ht160[R12A_MAX_TX_COUNT];
62 struct r12a_tx_pwr_2g pwr_2g;
63 struct r12a_tx_pwr_diff_2g pwr_diff_2g;
64 struct r12a_tx_pwr_5g pwr_5g;
65 struct r12a_tx_pwr_diff_5g pwr_diff_5g;
69 * RTL8812AU/RTL8821AU ROM image.
72 uint8_t reserved1[16];
73 struct r12a_tx_pwr tx_pwr[R12A_MAX_RF_PATH];
76 #define R12A_ROM_CRYSTALCAP_DEF 0x20
78 uint8_t thermal_meter;
81 #define R12A_ROM_IS_PA_EXT_2GHZ(pa_type) (((pa_type) & 0x30) == 0x30)
82 #define R12A_ROM_IS_PA_EXT_5GHZ(pa_type) (((pa_type) & 0x03) == 0x03)
83 #define R21A_ROM_IS_PA_EXT_2GHZ(pa_type) (((pa_type) & 0x10) == 0x10)
84 #define R21A_ROM_IS_PA_EXT_5GHZ(pa_type) (((pa_type) & 0x01) == 0x01)
87 #define R12A_ROM_IS_LNA_EXT(lna_type) (((lna_type) & 0x88) == 0x88)
88 #define R21A_ROM_IS_LNA_EXT(lna_type) (((lna_type) & 0x08) == 0x08)
90 #define R12A_GET_ROM_PA_TYPE(lna_type, chain) \
91 (((lna_type) >> ((chain) * 4 + 2)) & 0x01)
92 #define R12A_GET_ROM_LNA_TYPE(lna_type, chain) \
93 (((lna_type) >> ((chain) * 4)) & 0x03)
99 #define R12A_BOARD_TYPE_COMBO_MF 5
101 uint8_t rf_feature_opt;
103 #define R12A_RF_BT_OPT_ANT_NUM 0x01
107 uint8_t tx_bbswing_2g;
108 uint8_t tx_bbswing_5g;
109 uint8_t tx_pwr_calib_rate;
112 uint8_t reserved4[5];
115 uint8_t reserved5[3];
116 uint8_t macaddr_12a[IEEE80211_ADDR_LEN];
117 uint8_t reserved6[2];
118 uint8_t string_12a[8]; /* "Realtek " */
119 uint8_t reserved7[25];
122 uint8_t reserved8[3];
123 uint8_t macaddr_21a[IEEE80211_ADDR_LEN];
124 uint8_t reserved9[2];
125 uint8_t string_21a[8]; /* "Realtek " */
126 uint8_t reserved10[2];
127 uint8_t string_ven[23]; /* XXX variable length? */
128 uint8_t reserved11[208];
131 _Static_assert(sizeof(struct r12a_rom) == R12A_EFUSE_MAP_LEN,
132 "R12A_EFUSE_MAP_LEN must be equal to sizeof(struct r12a_rom)!");
134 #endif /* R12A_ROM_IMAGE_H */