Skip to content

Commit

Permalink
ath9k: of: Use the clk API to get the reference clock rate
Browse files Browse the repository at this point in the history
If a clock named "ref" exists use it to get the reference clock rate.

Signed-off-by: Alban Bedel <albeu@free.fr>
---
Changelog:
v2: * Fixed From/SoB to have my full name
    * Removed superfluous parenthesis
  • Loading branch information
AlbanBedel committed Mar 24, 2018
1 parent ac3c9fb commit aab2db9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/net/wireless/ath/ath9k/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <linux/nvmem-consumer.h>
#include <linux/relay.h>
#include <linux/dmi.h>
#include <linux/clk.h>
#include <net/ieee80211_radiotap.h>

#include "ath9k.h"
Expand Down Expand Up @@ -619,6 +620,7 @@ static int ath9k_of_init(struct ath_softc *sc)
struct ath_hw *ah = sc->sc_ah;
struct ath_common *common = ath9k_hw_common(ah);
enum ath_bus_type bus_type = common->bus_ops->ath_bus_type;
struct clk *clk;
const char *mac;
char eeprom_name[100];
int ret;
Expand All @@ -628,6 +630,12 @@ static int ath9k_of_init(struct ath_softc *sc)

ath_dbg(common, CONFIG, "parsing configuration from OF node\n");

clk = clk_get(sc->dev, "ref");
if (!IS_ERR(clk)) {
ah->is_clk_25mhz = clk_get_rate(clk) == 25000000;
clk_put(clk);
}

if (of_property_read_bool(np, "qca,no-eeprom")) {
/* ath9k-eeprom-<bus>-<id>.bin */
scnprintf(eeprom_name, sizeof(eeprom_name),
Expand Down

0 comments on commit aab2db9

Please sign in to comment.