Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1599820

[PATCH 5/7] ath9k: of: Use the clk API to get the reference clock rate

From Alban <albeu@free.fr>
Newsgroups linux.kernel
Subject [PATCH 5/7] ath9k: of: Use the clk API to get the reference clock rate
Date 2017-03-13 22:10 +0100
Message-ID <tkFo6-6nZ-23@gated-at.bofh.it> (permalink)
References <tkFo6-6nZ-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


If a clock named "ref" exists use it to get the reference clock rate.

Signed-off-by: Alban <albeu@free.fr>
---
 drivers/net/wireless/ath/ath9k/init.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index 36b51a5..5cb9c61 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -24,6 +24,7 @@
 #include <linux/of_net.h>
 #include <linux/nvmem-consumer.h>
 #include <linux/relay.h>
+#include <linux/clk.h>
 #include <net/ieee80211_radiotap.h>
 
 #include "ath9k.h"
@@ -564,6 +565,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;
@@ -573,6 +575,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),
-- 
2.7.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/7] Documentation: dt: net: Update the ath9k binding for SoC devices Alban <albeu@free.fr> - 2017-03-13 22:10 +0100
  [PATCH 5/7] ath9k: of: Use the clk API to get the reference clock rate Alban <albeu@free.fr> - 2017-03-13 22:10 +0100
    Re: [PATCH 5/7] ath9k: of: Use the clk API to get the reference clock  rate Rafał Miłecki <zajec5@gmail.com> - 2017-03-13 23:20 +0100
  [PATCH 2/7] ath9k: ahb: Add OF support Alban <albeu@free.fr> - 2017-03-13 22:10 +0100
    Re: [PATCH 2/7] ath9k: ahb: Add OF support Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2017-03-14 12:20 +0100
  [PATCH 3/7] ath9k: Add support for reading the EEPROM data using the nvmem API Alban <albeu@free.fr> - 2017-03-13 22:10 +0100
    Re: [PATCH 3/7] ath9k: Add support for reading the EEPROM data using  the nvmem API Rafał Miłecki <zajec5@gmail.com> - 2017-03-13 23:20 +0100
    Re: [PATCH 3/7] ath9k: Add support for reading the EEPROM data using the nvmem API Christian Lamparter <chunkeey@googlemail.com> - 2017-03-14 01:00 +0100
      Re: [PATCH 3/7] ath9k: Add support for reading the EEPROM data  using the nvmem API Alban <albeu@free.fr> - 2017-03-23 15:50 +0100
        Re: [PATCH 3/7] ath9k: Add support for reading the EEPROM data using the nvmem API Christian Lamparter <chunkeey@googlemail.com> - 2017-03-24 17:30 +0100
  [PATCH 4/7] ath9k: Add support for reading the MAC address with nvmem Alban <albeu@free.fr> - 2017-03-13 22:10 +0100
  Re: [PATCH 1/7] Documentation: dt: net: Update the ath9k binding for  SoC devices Rob Herring <robh@kernel.org> - 2017-03-20 23:10 +0100
  Re: [PATCH 1/7] Documentation: dt: net: Update the ath9k binding for SoC devices Christian Lamparter <chunkeey@googlemail.com> - 2017-03-27 18:20 +0200

csiph-web