netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, oss-drivers@netronome.com,
	Jakub Kicinski <jakub.kicinski@netronome.com>
Subject: [PATCH net-next 02/15] nfp: attempt FW load from flash
Date: Tue, 28 Aug 2018 13:20:34 -0700	[thread overview]
Message-ID: <20180828202047.1305-3-jakub.kicinski@netronome.com> (raw)
In-Reply-To: <20180828202047.1305-1-jakub.kicinski@netronome.com>

Flash may contain a default NFP application FW.  This application
can either be put there by the user (with ethtool -f) or shipped
with the card.  If file system FW is not found, attempt to load
this flash stored app FW.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
---
 drivers/net/ethernet/netronome/nfp/nfp_main.c        | 6 ++++--
 drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.c | 6 ++++++
 drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.h | 6 ++++++
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/netronome/nfp/nfp_main.c b/drivers/net/ethernet/netronome/nfp/nfp_main.c
index 4a540c5e27fe..61c22c2935d4 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_main.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_main.c
@@ -441,8 +441,11 @@ nfp_fw_load(struct pci_dev *pdev, struct nfp_pf *pf, struct nfp_nsp *nsp)
 	}
 
 	fw = nfp_net_fw_find(pdev, pf);
-	if (!fw)
+	if (!fw) {
+		if (nfp_nsp_has_stored_fw_load(nsp))
+			nfp_nsp_load_stored_fw(nsp);
 		return 0;
+	}
 
 	dev_info(&pdev->dev, "Soft-reset, loading FW image\n");
 	err = nfp_nsp_device_soft_reset(nsp);
@@ -453,7 +456,6 @@ nfp_fw_load(struct pci_dev *pdev, struct nfp_pf *pf, struct nfp_nsp *nsp)
 	}
 
 	err = nfp_nsp_load_fw(nsp, fw);
-
 	if (err < 0) {
 		dev_err(&pdev->dev, "FW loading failed: %d\n", err);
 		goto exit_release_fw;
diff --git a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.c b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.c
index e1a14f4e5e71..0cdaa1fd6bcf 100644
--- a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.c
+++ b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.c
@@ -100,6 +100,7 @@ enum nfp_nsp_cmd {
 	SPCODE_NSP_WRITE_FLASH	= 11, /* Load and flash image from buffer */
 	SPCODE_NSP_SENSORS	= 12, /* Read NSP sensor(s) */
 	SPCODE_NSP_IDENTIFY	= 13, /* Read NSP version */
+	SPCODE_FW_STORED	= 16, /* If no FW loaded, load flash app FW */
 };
 
 static const struct {
@@ -618,3 +619,8 @@ int nfp_nsp_read_sensors(struct nfp_nsp *state, unsigned int sensor_mask,
 
 	return nfp_nsp_command_buf(state, &sensors);
 }
+
+int nfp_nsp_load_stored_fw(struct nfp_nsp *state)
+{
+	return nfp_nsp_command(state, SPCODE_FW_STORED);
+}
diff --git a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.h b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.h
index f23d9e06f097..65f2d4a6de02 100644
--- a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.h
+++ b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.h
@@ -50,12 +50,18 @@ int nfp_nsp_device_soft_reset(struct nfp_nsp *state);
 int nfp_nsp_load_fw(struct nfp_nsp *state, const struct firmware *fw);
 int nfp_nsp_write_flash(struct nfp_nsp *state, const struct firmware *fw);
 int nfp_nsp_mac_reinit(struct nfp_nsp *state);
+int nfp_nsp_load_stored_fw(struct nfp_nsp *state);
 
 static inline bool nfp_nsp_has_mac_reinit(struct nfp_nsp *state)
 {
 	return nfp_nsp_get_abi_ver_minor(state) > 20;
 }
 
+static inline bool nfp_nsp_has_stored_fw_load(struct nfp_nsp *state)
+{
+	return nfp_nsp_get_abi_ver_minor(state) > 23;
+}
+
 enum nfp_eth_interface {
 	NFP_INTERFACE_NONE	= 0,
 	NFP_INTERFACE_SFP	= 1,
-- 
2.17.1

  parent reply	other threads:[~2018-08-29  0:15 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-28 20:20 [PATCH net-next 00/15] nfp: add NFP5000 support Jakub Kicinski
2018-08-28 20:20 ` [PATCH net-next 01/15] nfp: encapsulate NSP command arguments into structs Jakub Kicinski
2018-08-28 20:20 ` Jakub Kicinski [this message]
2018-08-28 20:20 ` [PATCH net-next 03/15] nfp: interpret extended FW load result codes Jakub Kicinski
2018-08-28 20:20 ` [PATCH net-next 04/15] nfp: add support for indirect HWinfo lookup Jakub Kicinski
2018-08-28 20:20 ` [PATCH net-next 05/15] nfp: abm: look up MAC addresses via management FW Jakub Kicinski
2018-08-28 20:20 ` [PATCH net-next 06/15] nfp: add support for NFP5000 Jakub Kicinski
2018-08-28 20:20 ` [PATCH net-next 07/15] nfp: refactor the per-chip PCIe config Jakub Kicinski
2018-08-28 20:20 ` [PATCH net-next 08/15] nfp: save the MU locality field offset Jakub Kicinski
2018-08-28 20:20 ` [PATCH net-next 09/15] nfp: add basic errors messages to target logic Jakub Kicinski
2018-08-28 20:20 ` [PATCH net-next 10/15] nfp: add RTsym access helpers Jakub Kicinski
2018-08-28 20:20 ` [PATCH net-next 11/15] nfp: pass cpp_id to nfp_cpp_map_area() Jakub Kicinski
2018-08-28 20:20 ` [PATCH net-next 12/15] nfp: convert existing RTsym helpers to full target decoding Jakub Kicinski
2018-08-28 20:20 ` [PATCH net-next 13/15] nfp: convert all RTsym users to use new read/write helpers Jakub Kicinski
2018-08-28 20:20 ` [PATCH net-next 14/15] nfp: support access to absolute RTsyms Jakub Kicinski
2018-08-28 20:20 ` [PATCH net-next 15/15] nfp: make RTsym users handle absolute symbols correctly Jakub Kicinski
2018-08-29  0:01 ` [PATCH net-next 00/15] nfp: add NFP5000 support David Miller

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=20180828202047.1305-3-jakub.kicinski@netronome.com \
    --to=jakub.kicinski@netronome.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=oss-drivers@netronome.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).