From patchwork Thu May 8 11:48:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helmut Schaa X-Patchwork-Id: 4135721 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9DC08BFF02 for ; Thu, 8 May 2014 11:49:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C8D6C201D3 for ; Thu, 8 May 2014 11:49:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8DC26201C0 for ; Thu, 8 May 2014 11:49:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754026AbaEHLs7 (ORCPT ); Thu, 8 May 2014 07:48:59 -0400 Received: from mail-qg0-f48.google.com ([209.85.192.48]:44894 "EHLO mail-qg0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753270AbaEHLsF (ORCPT ); Thu, 8 May 2014 07:48:05 -0400 Received: by mail-qg0-f48.google.com with SMTP id i50so2629592qgf.35 for ; Thu, 08 May 2014 04:48:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=XtRd48kLu1oTukfhaHRAgkKq0rgYmjvFT56mLE/yQ4A=; b=Lp7WcVBtaq9siWyA2U3+egnfWzTBYvso2muBy8+7MuGdVEbozzRISFXg1oKVY5bxSN rtdeWD3et3P4ZH+HDmpMAU8dvo/Z7tJ675dt/a3a76l+uY7q6nMHezwwQzQB7TMfyMRQ 7bIlwXxpo2uEWWgLMP3x4w8R28Ddb40xKy78nDYP85O+1l65YvfNkxwCt3C+edmlFCS3 DxDnz84LzYz9AlQgQJtabfIogx6m4HQPHxqDmQmY4eUSPDZuLzwgS4rlS2nmzq/R4Uj0 gu46kgygf69pA6gliXJCxebrLl5fdxKoXteFPrnmmGAJU1ER1tJLgZuUuVy+88hwKI1B C8Pw== X-Received: by 10.140.101.170 with SMTP id u39mr3786326qge.32.1399549684382; Thu, 08 May 2014 04:48:04 -0700 (PDT) Received: from hschaa-desktop.site (HSI-KBW-109-193-015-173.hsi7.kabel-badenwuerttemberg.de. [109.193.15.173]) by mx.google.com with ESMTPSA id q8sm1117298qas.5.2014.05.08.04.48.02 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 May 2014 04:48:03 -0700 (PDT) From: Helmut Schaa To: linville@tuxdriver.com Cc: linux-wireless@vger.kernel.org, ath9k-devel@lists.ath9k.org, nbd@openwrt.org, Helmut Schaa Subject: [PATCHv2] ath9k: Allow platform override without EEPROM override Date: Thu, 8 May 2014 13:48:38 +0200 Message-Id: <1399549718-19848-1-git-send-email-helmut.schaa@googlemail.com> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <1399447711-12441-1-git-send-email-helmut.schaa@googlemail.com> References: <1399447711-12441-1-git-send-email-helmut.schaa@googlemail.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add a new platform data flag "use_eeprom" that indicates that the eeprom found on the card itself should be used instead of the one present in the platform data. This allows to override the MAC address of a PCI card while preserving the eeprom data from the card itself. The default behavior is preserved. Signed-off-by: Helmut Schaa --- Changes in V2: Don't try to load eeprom from platform data on pci if use_eeprom is set. drivers/net/wireless/ath/ath9k/init.c | 2 +- drivers/net/wireless/ath/ath9k/pci.c | 2 +- include/linux/ath9k_platform.h | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c index c99e50f..1af7708 100644 --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c @@ -508,7 +508,7 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, sc->tx99_power = MAX_RATE_POWER + 1; init_waitqueue_head(&sc->tx_wait); - if (!pdata) { + if (!pdata || pdata->use_eeprom) { ah->ah_flags |= AH_USE_EEPROM; sc->sc_ah->led_pin = -1; } else { diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c index 914dbc6..c1e82f7 100644 --- a/drivers/net/wireless/ath/ath9k/pci.c +++ b/drivers/net/wireless/ath/ath9k/pci.c @@ -686,7 +686,7 @@ static bool ath_pci_eeprom_read(struct ath_common *common, u32 off, u16 *data) struct ath_softc *sc = (struct ath_softc *) common->priv; struct ath9k_platform_data *pdata = sc->dev->platform_data; - if (pdata) { + if (pdata && !pdata->use_eeprom) { if (off >= (ARRAY_SIZE(pdata->eeprom_data))) { ath_err(common, "%s: eeprom read failed, offset %08x is out of range\n", diff --git a/include/linux/ath9k_platform.h b/include/linux/ath9k_platform.h index 8598f8e..a495a95 100644 --- a/include/linux/ath9k_platform.h +++ b/include/linux/ath9k_platform.h @@ -36,6 +36,8 @@ struct ath9k_platform_data { int (*get_mac_revision)(void); int (*external_reset)(void); + + bool use_eeprom; }; #endif /* _LINUX_ATH9K_PLATFORM_H */