.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org> |
---|
3 | 4 | * Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl> |
---|
4 | | - * |
---|
5 | | - * This program is free software; you can redistribute it and/or modify |
---|
6 | | - * it under the terms of the GNU General Public License version 2 |
---|
7 | | - * as published by the Free Software Foundation |
---|
8 | | - * |
---|
9 | | - * This program is distributed in the hope that it will be useful, |
---|
10 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
11 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
12 | | - * GNU General Public License for more details. |
---|
13 | 5 | */ |
---|
14 | 6 | |
---|
15 | 7 | #ifndef __MT76X0U_MCU_H |
---|
16 | 8 | #define __MT76X0U_MCU_H |
---|
17 | 9 | |
---|
18 | | -struct mt76x0_dev; |
---|
| 10 | +#include "../mt76x02_mcu.h" |
---|
19 | 11 | |
---|
20 | | -/* Register definitions */ |
---|
21 | | -#define MT_MCU_RESET_CTL 0x070C |
---|
22 | | -#define MT_MCU_INT_LEVEL 0x0718 |
---|
23 | | -#define MT_MCU_COM_REG0 0x0730 |
---|
24 | | -#define MT_MCU_COM_REG1 0x0734 |
---|
25 | | -#define MT_MCU_COM_REG2 0x0738 |
---|
26 | | -#define MT_MCU_COM_REG3 0x073C |
---|
| 12 | +struct mt76x02_dev; |
---|
27 | 13 | |
---|
28 | 14 | #define MT_MCU_IVB_SIZE 0x40 |
---|
29 | 15 | #define MT_MCU_DLM_OFFSET 0x80000 |
---|
30 | 16 | |
---|
31 | | -#define MT_MCU_MEMMAP_WLAN 0x00410000 |
---|
32 | 17 | /* We use same space for BBP as for MAC regs |
---|
33 | 18 | * #define MT_MCU_MEMMAP_BBP 0x40000000 |
---|
34 | 19 | */ |
---|
35 | 20 | #define MT_MCU_MEMMAP_RF 0x80000000 |
---|
36 | | - |
---|
37 | | -#define INBAND_PACKET_MAX_LEN 192 |
---|
38 | | - |
---|
39 | | -enum mcu_cmd { |
---|
40 | | - CMD_FUN_SET_OP = 1, |
---|
41 | | - CMD_LOAD_CR = 2, |
---|
42 | | - CMD_INIT_GAIN_OP = 3, |
---|
43 | | - CMD_DYNC_VGA_OP = 6, |
---|
44 | | - CMD_TDLS_CH_SW = 7, |
---|
45 | | - CMD_BURST_WRITE = 8, |
---|
46 | | - CMD_READ_MODIFY_WRITE = 9, |
---|
47 | | - CMD_RANDOM_READ = 10, |
---|
48 | | - CMD_BURST_READ = 11, |
---|
49 | | - CMD_RANDOM_WRITE = 12, |
---|
50 | | - CMD_LED_MODE_OP = 16, |
---|
51 | | - CMD_POWER_SAVING_OP = 20, |
---|
52 | | - CMD_WOW_CONFIG = 21, |
---|
53 | | - CMD_WOW_QUERY = 22, |
---|
54 | | - CMD_WOW_FEATURE = 24, |
---|
55 | | - CMD_CARRIER_DETECT_OP = 28, |
---|
56 | | - CMD_RADOR_DETECT_OP = 29, |
---|
57 | | - CMD_SWITCH_CHANNEL_OP = 30, |
---|
58 | | - CMD_CALIBRATION_OP = 31, |
---|
59 | | - CMD_BEACON_OP = 32, |
---|
60 | | - CMD_ANTENNA_OP = 33, |
---|
61 | | -}; |
---|
62 | | - |
---|
63 | | -enum mcu_function { |
---|
64 | | - Q_SELECT = 1, |
---|
65 | | - BW_SETTING = 2, |
---|
66 | | - ATOMIC_TSSI_SETTING = 5, |
---|
67 | | -}; |
---|
68 | | - |
---|
69 | | -enum mcu_power_mode { |
---|
70 | | - RADIO_OFF = 0x30, |
---|
71 | | - RADIO_ON = 0x31, |
---|
72 | | - RADIO_OFF_AUTO_WAKEUP = 0x32, |
---|
73 | | - RADIO_OFF_ADVANCE = 0x33, |
---|
74 | | - RADIO_ON_ADVANCE = 0x34, |
---|
75 | | -}; |
---|
76 | 21 | |
---|
77 | 22 | enum mcu_calibrate { |
---|
78 | 23 | MCU_CAL_R = 1, |
---|
.. | .. |
---|
86 | 31 | MCU_CAL_TXDCOC, |
---|
87 | 32 | MCU_CAL_RX_GROUP_DELAY, |
---|
88 | 33 | MCU_CAL_TX_GROUP_DELAY, |
---|
| 34 | + MCU_CAL_VCO, |
---|
| 35 | + MCU_CAL_NO_SIGNAL = 0xfe, |
---|
| 36 | + MCU_CAL_FULL = 0xff, |
---|
89 | 37 | }; |
---|
90 | 38 | |
---|
91 | | -int mt76x0_mcu_init(struct mt76x0_dev *dev); |
---|
92 | | -int mt76x0_mcu_cmd_init(struct mt76x0_dev *dev); |
---|
93 | | -void mt76x0_mcu_cmd_deinit(struct mt76x0_dev *dev); |
---|
94 | | - |
---|
95 | | -int |
---|
96 | | -mt76x0_mcu_calibrate(struct mt76x0_dev *dev, enum mcu_calibrate cal, u32 val); |
---|
97 | | - |
---|
98 | | -int |
---|
99 | | -mt76x0_mcu_function_select(struct mt76x0_dev *dev, enum mcu_function func, u32 val); |
---|
| 39 | +int mt76x0e_mcu_init(struct mt76x02_dev *dev); |
---|
| 40 | +int mt76x0u_mcu_init(struct mt76x02_dev *dev); |
---|
| 41 | +static inline int mt76x0_firmware_running(struct mt76x02_dev *dev) |
---|
| 42 | +{ |
---|
| 43 | + return mt76_rr(dev, MT_MCU_COM_REG0) == 1; |
---|
| 44 | +} |
---|
100 | 45 | |
---|
101 | 46 | #endif |
---|