1 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
2 +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
3 @@ -78,6 +78,9 @@ struct rt2800_ops {
4 int (*drv_init_registers)(struct rt2x00_dev *rt2x00dev);
5 __le32 *(*drv_get_txwi)(struct queue_entry *entry);
6 unsigned int (*drv_get_dma_done)(struct data_queue *queue);
7 + int (*hw_get_chippkg)(void);
8 + int (*hw_get_chipver)(void);
9 + int (*hw_get_chipeco)(void);
12 static inline u32 rt2800_register_read(struct rt2x00_dev *rt2x00dev,
13 @@ -195,6 +198,27 @@ static inline unsigned int rt2800_drv_ge
14 return rt2800ops->drv_get_dma_done(queue);
17 +static inline int rt2800_hw_get_chippkg(struct rt2x00_dev *rt2x00dev)
19 + const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
21 + return rt2800ops->hw_get_chippkg();
24 +static inline int rt2800_hw_get_chipver(struct rt2x00_dev *rt2x00dev)
26 + const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
28 + return rt2800ops->hw_get_chipver();
31 +static inline int rt2800_hw_get_chipeco(struct rt2x00_dev *rt2x00dev)
33 + const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
35 + return rt2800ops->hw_get_chipeco();
38 void rt2800_mcu_request(struct rt2x00_dev *rt2x00dev,
39 const u8 command, const u8 token,
40 const u8 arg0, const u8 arg1);
41 --- a/drivers/net/wireless/ralink/rt2x00/rt2800pci.c
42 +++ b/drivers/net/wireless/ralink/rt2x00/rt2800pci.c
43 @@ -286,6 +286,10 @@ static int rt2800pci_read_eeprom(struct
47 +static int rt2800pci_get_chippkg(void) { return 0; }
48 +static int rt2800pci_get_chipver(void) { return 0; }
49 +static int rt2800pci_get_chipeco(void) { return 0; }
51 static const struct ieee80211_ops rt2800pci_mac80211_ops = {
53 .start = rt2x00mac_start,
54 @@ -328,6 +332,9 @@ static const struct rt2800_ops rt2800pci
55 .drv_init_registers = rt2800mmio_init_registers,
56 .drv_get_txwi = rt2800mmio_get_txwi,
57 .drv_get_dma_done = rt2800mmio_get_dma_done,
58 + .hw_get_chippkg = rt2800pci_get_chippkg,
59 + .hw_get_chipver = rt2800pci_get_chipver,
60 + .hw_get_chipeco = rt2800pci_get_chipeco,
63 static const struct rt2x00lib_ops rt2800pci_rt2x00_ops = {
64 --- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
65 +++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
67 #include "rt2800lib.h"
68 #include "rt2800mmio.h"
70 +/* Needed to probe CHIP_VER register on MT7620 */
71 +#ifdef CONFIG_SOC_MT7620
72 +#include <asm/mach-ralink/ralink_regs.h>
73 +#include <asm/mach-ralink/mt7620.h>
76 /* Allow hardware encryption to be disabled. */
77 static bool modparam_nohwcrypt;
78 module_param_named(nohwcrypt, modparam_nohwcrypt, bool, 0444);
79 @@ -118,6 +124,27 @@ static int rt2800soc_write_firmware(stru
83 +#ifdef CONFIG_SOC_MT7620
84 +static int rt2800soc_get_chippkg(void)
86 + return mt7620_get_pkg();
89 +static int rt2800soc_get_chipver(void)
91 + return mt7620_get_chipver();
94 +static int rt2800soc_get_chipeco(void)
96 + return mt7620_get_eco();
99 +static int rt2800soc_get_chippkg(void) { return 0; }
100 +static int rt2800soc_get_chipver(void) { return 0; }
101 +static int rt2800soc_get_chipeco(void) { return 0; }
104 static const struct ieee80211_ops rt2800soc_mac80211_ops = {
106 .start = rt2x00mac_start,
107 @@ -159,6 +186,9 @@ static const struct rt2800_ops rt2800soc
108 .drv_init_registers = rt2800mmio_init_registers,
109 .drv_get_txwi = rt2800mmio_get_txwi,
110 .drv_get_dma_done = rt2800mmio_get_dma_done,
111 + .hw_get_chippkg = rt2800soc_get_chippkg,
112 + .hw_get_chipver = rt2800soc_get_chipver,
113 + .hw_get_chipeco = rt2800soc_get_chipeco,
116 static const struct rt2x00lib_ops rt2800soc_rt2x00_ops = {
117 --- a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
118 +++ b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
119 @@ -628,6 +628,10 @@ static int rt2800usb_probe_hw(struct rt2
123 +static int rt2800usb_get_chippkg(void) { return 0; }
124 +static int rt2800usb_get_chipver(void) { return 0; }
125 +static int rt2800usb_get_chipeco(void) { return 0; }
127 static const struct ieee80211_ops rt2800usb_mac80211_ops = {
129 .start = rt2x00mac_start,
130 @@ -671,6 +675,9 @@ static const struct rt2800_ops rt2800usb
131 .drv_init_registers = rt2800usb_init_registers,
132 .drv_get_txwi = rt2800usb_get_txwi,
133 .drv_get_dma_done = rt2800usb_get_dma_done,
134 + .hw_get_chippkg = rt2800usb_get_chippkg,
135 + .hw_get_chipver = rt2800usb_get_chipver,
136 + .hw_get_chipeco = rt2800usb_get_chipeco,
139 static const struct rt2x00lib_ops rt2800usb_rt2x00_ops = {