Search Linux Wireless

Re: [PATCH v6 6/9] ath5k: Add a function to read chipset's MAC revision

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2010/11/26 Wojciech Dubowik <dubowoj@xxxxxxxxxxx>:
> From: Felix Fietkau <nbd@xxxxxxxxxxx>
>
> Add bus dependent revision read function which is used to
> determine chipset's MAC before hardware is initialized.
>
> Signed-off-by: Felix Fietkau <nbd@xxxxxxxxxxx>
> Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@xxxxxxxxxxx>
> ---
> Âdrivers/net/wireless/ath/ath5k/ath5k.h Â| Â Â5 +++--
> Âdrivers/net/wireless/ath/ath5k/attach.c | Â 11 +++++++----
> Âdrivers/net/wireless/ath/ath5k/pci.c  Â|  Â6 ++++++
> Â3 files changed, 16 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h
> index 946e54a..917deb4 100644
> --- a/drivers/net/wireless/ath/ath5k/ath5k.h
> +++ b/drivers/net/wireless/ath/ath5k/ath5k.h
> @@ -1035,6 +1035,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;
> @@ -1143,9 +1144,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_bus_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 fe7e6f1..9b5f6e4 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_bus_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..4eff891 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_bus_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,
> --
> 1.7.1
>

Why not naming that ath5k_hw_read_srev_pci and the other one
ath5k_hw_read_srev_ahb and name both ath5k_bus_read_srev ? Also please
at least follow the naming scheme, all hw related functions are
ath5k_hw_*.



-- 
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux