u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
From: Sean Anderson <sean.anderson@seco.com>
To: u-boot@lists.denx.de, Joe Hershberger <joe.hershberger@ni.com>,
	Ramon Fried <rfried.dev@gmail.com>
Cc: Priyanka Jain <priyanka.jain@nxp.com>,
	York Sun <york.sun@nxp.com>,
	Sean Anderson <sean.anderson@seco.com>
Subject: [RESEND PATCH v2 2/3] net: fm: Add firmware name parameter
Date: Fri, 22 Apr 2022 13:30:31 -0400	[thread overview]
Message-ID: <20220422173032.2259019-3-sean.anderson@seco.com> (raw)
In-Reply-To: <20220422173032.2259019-1-sean.anderson@seco.com>

In order to read the firmware from the filesystem, we need a file name.
Read the firmware name from the device tree, using the firmware-name
property. This property is commonly used in Linux to determine the
correct name to use (and can be seen in several device trees in U-Boot).

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
---

(no changes since v1)

 drivers/net/fm/fm.c   | 15 ++++++++++++---
 drivers/net/fm/fm.h   |  2 +-
 drivers/net/fm/init.c |  4 ++--
 3 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/drivers/net/fm/fm.c b/drivers/net/fm/fm.c
index f825612640..aa0cc69232 100644
--- a/drivers/net/fm/fm.c
+++ b/drivers/net/fm/fm.c
@@ -7,6 +7,7 @@
 #include <env.h>
 #include <malloc.h>
 #include <asm/io.h>
+#include <dm/device_compat.h>
 #include <linux/errno.h>
 #include <u-boot/crc.h>
 #ifdef CONFIG_DM_ETH
@@ -354,7 +355,7 @@ static void fm_init_qmi(struct fm_qmi_common *qmi)
 
 /* Init common part of FM, index is fm num# like fm as above */
 #ifdef CONFIG_TFABOOT
-int fm_init_common(int index, struct ccsr_fman *reg)
+int fm_init_common(int index, struct ccsr_fman *reg, const char *firmware_name)
 {
 	int rc;
 	void *addr = NULL;
@@ -449,7 +450,7 @@ int fm_init_common(int index, struct ccsr_fman *reg)
 	return fm_init_bmi(index, &reg->fm_bmi_common);
 }
 #else
-int fm_init_common(int index, struct ccsr_fman *reg)
+int fm_init_common(int index, struct ccsr_fman *reg, const char *firmware_name)
 {
 	int rc;
 #if defined(CONFIG_SYS_QE_FMAN_FW_IN_NOR)
@@ -546,6 +547,8 @@ static const struct udevice_id fman_ids[] = {
 
 static int fman_probe(struct udevice *dev)
 {
+	const char *firmware_name = NULL;
+	int ret;
 	struct fman_priv *priv = dev_get_priv(dev);
 
 	priv->reg = (struct ccsr_fman *)(uintptr_t)dev_read_addr(dev);
@@ -555,7 +558,13 @@ static int fman_probe(struct udevice *dev)
 		return -EINVAL;
 	}
 
-	return fm_init_common(priv->fman_id, priv->reg);
+	ret = dev_read_string_index(dev, "firmware-name", 0, &firmware_name);
+	if (ret && ret != -EINVAL) {
+		dev_dbg(dev, "Could not read firmware-name\n");
+		return ret;
+	}
+
+	return fm_init_common(priv->fman_id, priv->reg, firmware_name);
 }
 
 static int fman_remove(struct udevice *dev)
diff --git a/drivers/net/fm/fm.h b/drivers/net/fm/fm.h
index 2379b3a11c..32de5cf2b6 100644
--- a/drivers/net/fm/fm.h
+++ b/drivers/net/fm/fm.h
@@ -108,7 +108,7 @@ struct fm_port_global_pram {
 
 void *fm_muram_alloc(int fm_idx, size_t size, ulong align);
 void *fm_muram_base(int fm_idx);
-int fm_init_common(int index, struct ccsr_fman *reg);
+int fm_init_common(int index, struct ccsr_fman *reg, const char *firmware_name);
 int fm_eth_initialize(struct ccsr_fman *reg, struct fm_eth_info *info);
 phy_interface_t fman_port_enet_if(enum fm_port port);
 void fman_disable_port(enum fm_port port);
diff --git a/drivers/net/fm/init.c b/drivers/net/fm/init.c
index 2fed64205c..a9a20931a1 100644
--- a/drivers/net/fm/init.c
+++ b/drivers/net/fm/init.c
@@ -93,7 +93,7 @@ int fm_standard_init(struct bd_info *bis)
 	struct ccsr_fman *reg;
 
 	reg = (void *)CONFIG_SYS_FSL_FM1_ADDR;
-	if (fm_init_common(0, reg))
+	if (fm_init_common(0, reg, NULL))
 		return 0;
 
 	for (i = 0; i < ARRAY_SIZE(fm_info); i++) {
@@ -103,7 +103,7 @@ int fm_standard_init(struct bd_info *bis)
 
 #if (CONFIG_SYS_NUM_FMAN == 2)
 	reg = (void *)CONFIG_SYS_FSL_FM2_ADDR;
-	if (fm_init_common(1, reg))
+	if (fm_init_common(1, reg, NULL))
 		return 0;
 
 	for (i = 0; i < ARRAY_SIZE(fm_info); i++) {
-- 
2.35.1.1320.gc452695387.dirty


  parent reply	other threads:[~2022-04-22 17:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-22 17:30 [RESEND PATCH v2 0/3] net: fm: Add support for loading firmware from filesystem Sean Anderson
2022-04-22 17:30 ` [RESEND PATCH v2 1/3] misc: fs_loader: Add function to get the chosen loader Sean Anderson
2022-08-14 20:47   ` Ramon Fried
2022-04-22 17:30 ` Sean Anderson [this message]
2022-08-14 20:46   ` [RESEND PATCH v2 2/3] net: fm: Add firmware name parameter Ramon Fried
2022-04-22 17:30 ` [RESEND PATCH v2 3/3] net: fm: Support loading firmware from a filesystem Sean Anderson
2022-08-14 20:46   ` Ramon Fried
2022-08-13  6:15 ` [RESEND PATCH v2 0/3] net: fm: Add support for loading firmware from filesystem Sean Anderson
2022-08-14 20:48   ` Ramon Fried
2022-11-17 21:29     ` Sean Anderson
2022-11-26 22:47       ` Ramon Fried
2022-11-28 15:03         ` Tom Rini

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=20220422173032.2259019-3-sean.anderson@seco.com \
    --to=sean.anderson@seco.com \
    --cc=joe.hershberger@ni.com \
    --cc=priyanka.jain@nxp.com \
    --cc=rfried.dev@gmail.com \
    --cc=u-boot@lists.denx.de \
    --cc=york.sun@nxp.com \
    /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).