diff mbox

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

Message ID 1489439116-4233-5-git-send-email-albeu@free.fr
State Awaiting Upstream, archived
Delegated to: David Miller
Headers show

Commit Message

Alban March 13, 2017, 9:05 p.m. UTC
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(+)

Comments

Rafał Miłecki March 13, 2017, 10:17 p.m. UTC | #1
On 03/13/2017 10:05 PM, Alban wrote:
> @@ -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);

One trivial thing: you don't need these extra braces.


> +		clk_put(clk);
> +	}
diff mbox

Patch

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),