1 /*
2  * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org>
3  * 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  */
14 
15 #ifndef __MT76X0U_MCU_H
16 #define __MT76X0U_MCU_H
17 
18 #include "../mt76x02_mcu.h"
19 
20 struct mt76x02_dev;
21 
22 #define MT_MCU_IVB_SIZE			0x40
23 #define MT_MCU_DLM_OFFSET		0x80000
24 
25 /* We use same space for BBP as for MAC regs
26  * #define MT_MCU_MEMMAP_BBP		0x40000000
27  */
28 #define MT_MCU_MEMMAP_RF		0x80000000
29 
30 enum mcu_calibrate {
31 	MCU_CAL_R = 1,
32 	MCU_CAL_RXDCOC,
33 	MCU_CAL_LC,
34 	MCU_CAL_LOFT,
35 	MCU_CAL_TXIQ,
36 	MCU_CAL_BW,
37 	MCU_CAL_DPD,
38 	MCU_CAL_RXIQ,
39 	MCU_CAL_TXDCOC,
40 	MCU_CAL_RX_GROUP_DELAY,
41 	MCU_CAL_TX_GROUP_DELAY,
42 	MCU_CAL_VCO,
43 	MCU_CAL_NO_SIGNAL = 0xfe,
44 	MCU_CAL_FULL = 0xff,
45 };
46 
47 int mt76x0e_mcu_init(struct mt76x02_dev *dev);
48 int mt76x0u_mcu_init(struct mt76x02_dev *dev);
49 static inline int mt76x0_firmware_running(struct mt76x02_dev *dev)
50 {
51 	return mt76_rr(dev, MT_MCU_COM_REG0) == 1;
52 }
53 
54 #endif
55