2012-05-20 21:58:03 +00:00
|
|
|
--- a/include/linux/rt2x00_platform.h
|
|
|
|
+++ b/include/linux/rt2x00_platform.h
|
|
|
|
@@ -14,6 +14,7 @@
|
|
|
|
|
|
|
|
struct rt2x00_platform_data {
|
|
|
|
char *eeprom_file_name;
|
|
|
|
+ const u8 *mac_address;
|
|
|
|
|
|
|
|
int disable_2ghz;
|
|
|
|
int disable_5ghz;
|
|
|
|
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
|
|
|
|
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
|
2013-06-15 20:14:06 +00:00
|
|
|
@@ -929,6 +929,18 @@ static void rt2x00lib_rate(struct ieee80
|
2012-05-20 21:58:03 +00:00
|
|
|
entry->flags |= IEEE80211_RATE_SHORT_PREAMBLE;
|
|
|
|
}
|
|
|
|
|
|
|
|
+const u8 *rt2x00lib_get_mac_address(struct rt2x00_dev *rt2x00dev)
|
|
|
|
+{
|
|
|
|
+ struct rt2x00_platform_data *pdata;
|
|
|
|
+
|
|
|
|
+ pdata = rt2x00dev->dev->platform_data;
|
|
|
|
+ if (!pdata)
|
|
|
|
+ return NULL;
|
|
|
|
+
|
|
|
|
+ return pdata->mac_address;
|
|
|
|
+}
|
|
|
|
+EXPORT_SYMBOL_GPL(rt2x00lib_get_mac_address);
|
|
|
|
+
|
|
|
|
static int rt2x00lib_probe_hw_modes(struct rt2x00_dev *rt2x00dev,
|
|
|
|
struct hw_mode_spec *spec)
|
|
|
|
{
|
|
|
|
--- a/drivers/net/wireless/rt2x00/rt2x00.h
|
|
|
|
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
|
2013-06-15 20:14:06 +00:00
|
|
|
@@ -1326,6 +1326,7 @@ static inline void rt2x00debug_dump_fram
|
2012-05-20 21:58:03 +00:00
|
|
|
*/
|
|
|
|
u32 rt2x00lib_get_bssidx(struct rt2x00_dev *rt2x00dev,
|
|
|
|
struct ieee80211_vif *vif);
|
|
|
|
+const u8 *rt2x00lib_get_mac_address(struct rt2x00_dev *rt2x00dev);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Interrupt context handlers.
|
|
|
|
--- a/drivers/net/wireless/rt2x00/rt61pci.c
|
|
|
|
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
|
2013-06-15 20:14:06 +00:00
|
|
|
@@ -2395,6 +2395,7 @@ static int rt61pci_validate_eeprom(struc
|
2012-05-20 21:58:03 +00:00
|
|
|
u32 reg;
|
|
|
|
u16 word;
|
|
|
|
u8 *mac;
|
|
|
|
+ const u8 *pdata_mac;
|
|
|
|
s8 value;
|
|
|
|
|
2013-04-26 10:52:03 +00:00
|
|
|
rt2x00mmio_register_read(rt2x00dev, E2PROM_CSR, ®);
|
2013-06-15 20:14:06 +00:00
|
|
|
@@ -2415,7 +2416,11 @@ static int rt61pci_validate_eeprom(struc
|
2012-05-20 21:58:03 +00:00
|
|
|
/*
|
|
|
|
* Start validation of the data that has been read.
|
|
|
|
*/
|
|
|
|
+ pdata_mac = rt2x00lib_get_mac_address(rt2x00dev);
|
|
|
|
mac = rt2x00_eeprom_addr(rt2x00dev, EEPROM_MAC_ADDR_0);
|
|
|
|
+ if (pdata_mac)
|
|
|
|
+ memcpy(mac, pdata_mac, 6);
|
|
|
|
+
|
|
|
|
if (!is_valid_ether_addr(mac)) {
|
2012-09-08 11:10:54 +00:00
|
|
|
eth_random_addr(mac);
|
2013-06-15 20:14:06 +00:00
|
|
|
rt2x00_eeprom_dbg(rt2x00dev, "MAC: %pM\n", mac);
|