linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ansuel Smith <ansuelsmth@gmail.com>
To: "0001-ath10k-Try-to-get-mac-address-from-dts . patchKalle Valo" 
	<kvalo@codeaurora.org>
Cc: Ansuel Smith <ansuelsmth@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	ath10k@lists.infradead.org, linux-wireless@vger.kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] ath10k: Try to get mac-address from dts
Date: Sun, 27 Sep 2020 21:25:13 +0200	[thread overview]
Message-ID: <20200927192515.86-1-ansuelsmth@gmail.com> (raw)

Most of embedded device that have the ath10k wifi integrated store the
mac-address in nvmem partitions. Try to fetch the mac-address using the
standard 'of_get_mac_address' than in all the check also try to fetch the
address using the nvmem api searching for a defined 'mac-address' cell.
Mac-address defined in the dts have priority than any other address found.

Tested-on: QCA9984 hw1.0 PCI 10.4

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
---
 drivers/net/wireless/ath/ath10k/core.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 5f4e12196..9ed7b9883 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -8,6 +8,8 @@
 #include <linux/module.h>
 #include <linux/firmware.h>
 #include <linux/of.h>
+#include <linux/of_net.h>
+#include <linux/property.h>
 #include <linux/property.h>
 #include <linux/dmi.h>
 #include <linux/ctype.h>
@@ -2961,8 +2963,12 @@ EXPORT_SYMBOL(ath10k_core_stop);
 static int ath10k_core_probe_fw(struct ath10k *ar)
 {
 	struct bmi_target_info target_info;
+	const char *mac;
 	int ret = 0;
 
+	/* register the platform to be found by the of api */
+	of_platform_device_create(ar->dev->of_node, NULL, NULL);
+
 	ret = ath10k_hif_power_up(ar, ATH10K_FIRMWARE_MODE_NORMAL);
 	if (ret) {
 		ath10k_err(ar, "could not power on hif bus (%d)\n", ret);
@@ -3062,6 +3068,10 @@ static int ath10k_core_probe_fw(struct ath10k *ar)
 
 	device_get_mac_address(ar->dev, ar->mac_addr, sizeof(ar->mac_addr));
 
+	mac = of_get_mac_address(ar->dev->of_node);
+	if (!IS_ERR(mac))
+		ether_addr_copy(ar->mac_addr, mac);
+
 	ret = ath10k_core_init_firmware_features(ar);
 	if (ret) {
 		ath10k_err(ar, "fatal problem with firmware features: %d\n",
-- 
2.27.0


             reply	other threads:[~2020-09-27 19:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-27 19:25 Ansuel Smith [this message]
2020-09-27 19:25 ` [PATCH 2/2] ath10k: Try to download pre-cal using nvmem api Ansuel Smith

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200927192515.86-1-ansuelsmth@gmail.com \
    --to=ansuelsmth@gmail.com \
    --cc=ath10k@lists.infradead.org \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=kvalo@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).