1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org>
4  * Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl>
5  */
6 
7 #ifndef __MT76X0U_MCU_H
8 #define __MT76X0U_MCU_H
9 
10 #include "../mt76x02_mcu.h"
11 
12 struct mt76x02_dev;
13 
14 #define MT_MCU_IVB_SIZE			0x40
15 #define MT_MCU_DLM_OFFSET		0x80000
16 
17 /* We use same space for BBP as for MAC regs
18  * #define MT_MCU_MEMMAP_BBP		0x40000000
19  */
20 #define MT_MCU_MEMMAP_RF		0x80000000
21 
22 enum mcu_calibrate {
23 	MCU_CAL_R = 1,
24 	MCU_CAL_RXDCOC,
25 	MCU_CAL_LC,
26 	MCU_CAL_LOFT,
27 	MCU_CAL_TXIQ,
28 	MCU_CAL_BW,
29 	MCU_CAL_DPD,
30 	MCU_CAL_RXIQ,
31 	MCU_CAL_TXDCOC,
32 	MCU_CAL_RX_GROUP_DELAY,
33 	MCU_CAL_TX_GROUP_DELAY,
34 	MCU_CAL_VCO,
35 	MCU_CAL_NO_SIGNAL = 0xfe,
36 	MCU_CAL_FULL = 0xff,
37 };
38 
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 }
45 
46 #endif
47