Skip to content

Commit

Permalink
ath9k: add support for overriding the MAC address through platform data
Browse files Browse the repository at this point in the history
On some devices the correct MAC address is not in the EEPROM data, but
stored somewhere else.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Felix Fietkau authored and John W. Linville committed Mar 30, 2011
1 parent 691680b commit 6fb1b1e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/net/wireless/ath/ath9k/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/

#include <linux/slab.h>
#include <linux/ath9k_platform.h>

#include "ath9k.h"

Expand Down Expand Up @@ -537,6 +538,7 @@ static void ath9k_init_misc(struct ath_softc *sc)
static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid,
const struct ath_bus_ops *bus_ops)
{
struct ath9k_platform_data *pdata = sc->dev->platform_data;
struct ath_hw *ah = NULL;
struct ath_common *common;
int ret = 0, i;
Expand All @@ -551,7 +553,7 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid,
ah->hw_version.subsysid = subsysid;
sc->sc_ah = ah;

if (!sc->dev->platform_data)
if (!pdata)
ah->ah_flags |= AH_USE_EEPROM;

common = ath9k_hw_common(ah);
Expand Down Expand Up @@ -587,6 +589,9 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid,
if (ret)
goto err_hw;

if (pdata && pdata->macaddr)
memcpy(common->macaddr, pdata->macaddr, ETH_ALEN);

ret = ath9k_init_queues(sc);
if (ret)
goto err_queues;
Expand Down
1 change: 1 addition & 0 deletions include/linux/ath9k_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

struct ath9k_platform_data {
u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS];
u8 *macaddr;
};

#endif /* _LINUX_ATH9K_PLATFORM_H */

0 comments on commit 6fb1b1e

Please sign in to comment.