From patchwork Thu Dec 2 09:27:06 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wojciech Dubowik X-Patchwork-Id: 373401 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oB29RKDM020095 for ; Thu, 2 Dec 2010 09:27:20 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755937Ab0LBJ1P (ORCPT ); Thu, 2 Dec 2010 04:27:15 -0500 Received: from mail.neratec.ch ([80.75.119.105]:53010 "EHLO mail.neratec.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756515Ab0LBJ1J (ORCPT ); Thu, 2 Dec 2010 04:27:09 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.neratec.ch (Postfix) with ESMTP id 92B7F860D2; Thu, 2 Dec 2010 10:27:07 +0100 (CET) X-Virus-Scanned: amavisd-new at neratec.ch Received: from mail.neratec.ch ([127.0.0.1]) by localhost (mail.neratec.ch [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AwImR74Olt2A; Thu, 2 Dec 2010 10:27:06 +0100 (CET) Received: from mail.neratec.ch (mail.neratec.ch [192.168.11.23]) by mail.neratec.ch (Postfix) with ESMTP id 34DCB860D1; Thu, 2 Dec 2010 10:27:06 +0100 (CET) Date: Thu, 2 Dec 2010 10:27:06 +0100 (CET) From: Wojciech Dubowik To: linville@tuxdriver.com Cc: linux-wireless@vger.kernel.org, nbd@openwrt.org, ath5k-devel@venema.h4ckr.net, mickflemm@gmail.com Message-ID: <4669012.1461291282024468.JavaMail.wlan@CHBU500181> In-Reply-To: <2881922.1281291281880222.JavaMail.wlan@CHBU500181> Subject: [PATCH v7 6/9] ath5k: Add a function to read chipset's MAC revision MIME-Version: 1.0 X-Originating-IP: [192.168.11.196] X-Mailer: Zimbra 6.0.8_GA_2661 (Zimbra Desktop/1.0.4_1833_Linux) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Thu, 02 Dec 2010 09:27:20 +0000 (UTC) diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h index 5d9fdc2..5e525eb 100644 --- a/drivers/net/wireless/ath/ath5k/ath5k.h +++ b/drivers/net/wireless/ath/ath5k/ath5k.h @@ -1046,6 +1046,7 @@ struct ath5k_hw { u32 ah_phy; u32 ah_mac_srev; u16 ah_mac_version; + u16 ah_mac_revision; u16 ah_phy_revision; u16 ah_radio_5ghz_revision; u16 ah_radio_2ghz_revision; @@ -1156,8 +1157,9 @@ void ath5k_hw_deinit(struct ath5k_hw *ah); int ath5k_sysfs_register(struct ath5k_softc *sc); void ath5k_sysfs_unregister(struct ath5k_softc *sc); -/*Chip id helper function */ +/*Chip id helper functions */ const char *ath5k_chip_name(enum ath5k_srev_type type, u_int16_t val); +int ath5k_hw_read_srev(struct ath5k_hw *ah); /* LED functions */ int ath5k_init_leds(struct ath5k_softc *sc); diff --git a/drivers/net/wireless/ath/ath5k/attach.c b/drivers/net/wireless/ath/ath5k/attach.c index 86f6fec..9dbc1fa 100644 --- a/drivers/net/wireless/ath/ath5k/attach.c +++ b/drivers/net/wireless/ath/ath5k/attach.c @@ -128,7 +128,8 @@ int ath5k_hw_init(struct ath5k_softc *sc) /* * Find the mac version */ - srev = ath5k_hw_reg_read(ah, AR5K_SREV); + ath5k_hw_read_srev(ah); + srev = ah->ah_mac_srev; if (srev < AR5K_SREV_AR5311) ah->ah_version = AR5K_AR5210; else if (srev < AR5K_SREV_AR5212) @@ -136,6 +137,10 @@ int ath5k_hw_init(struct ath5k_softc *sc) else ah->ah_version = AR5K_AR5212; + /* Get the MAC revision */ + ah->ah_mac_version = AR5K_REG_MS(srev, AR5K_SREV_VER); + ah->ah_mac_revision = AR5K_REG_MS(srev, AR5K_SREV_REV); + /* Fill the ath5k_hw struct with the needed functions */ ret = ath5k_hw_init_desc_functions(ah); if (ret) @@ -146,9 +151,7 @@ int ath5k_hw_init(struct ath5k_softc *sc) if (ret) goto err; - /* Get MAC, PHY and RADIO revisions */ - ah->ah_mac_srev = srev; - ah->ah_mac_version = AR5K_REG_MS(srev, AR5K_SREV_VER); + /* Get PHY and RADIO revisions */ ah->ah_phy_revision = ath5k_hw_reg_read(ah, AR5K_PHY_CHIP_ID) & 0xffffffff; ah->ah_radio_5ghz_revision = ath5k_hw_radio_revision(ah, diff --git a/drivers/net/wireless/ath/ath5k/pci.c b/drivers/net/wireless/ath/ath5k/pci.c index 3f26cf2..39f0331 100644 --- a/drivers/net/wireless/ath/ath5k/pci.c +++ b/drivers/net/wireless/ath/ath5k/pci.c @@ -100,6 +100,12 @@ bool ath5k_pci_eeprom_read(struct ath_common *common, u32 offset, u16 *data) return -ETIMEDOUT; } +int ath5k_hw_read_srev(struct ath5k_hw *ah) +{ + ah->ah_mac_srev = ath5k_hw_reg_read(ah, AR5K_SREV); + return 0; +} + /* Common ath_bus_opts structure */ static const struct ath_bus_ops ath_pci_bus_ops = { .ath_bus_type = ATH_PCI,