From: Jonathan Lemon <jonathan.lemon@gmail.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, richardcochran@gmail.com,
kernel-team@fb.com
Subject: [PATCH net-next v2 2/2] ptp: ocp: Update devlink firmware display path.
Date: Mon, 7 Mar 2022 16:05:35 -0800 [thread overview]
Message-ID: <20220308000536.2278-3-jonathan.lemon@gmail.com> (raw)
In-Reply-To: <20220308000536.2278-1-jonathan.lemon@gmail.com>
Cache the firmware version when the card is initialized,
and use this field to populate the devlink firmware information.
The cached firmware version will be used for feature gating in
upcoming patches.
Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
---
drivers/ptp/ptp_ocp.c | 43 +++++++++++++++++--------------------------
1 file changed, 17 insertions(+), 26 deletions(-)
diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c
index db805e3ce9a3..8e23d563a577 100644
--- a/drivers/ptp/ptp_ocp.c
+++ b/drivers/ptp/ptp_ocp.c
@@ -244,6 +244,7 @@ struct ptp_ocp {
int gnss2_port;
int mac_port; /* miniature atomic clock */
int nmea_port;
+ u32 fw_version;
u8 board_id[OCP_BOARD_ID_LEN];
u8 serial[OCP_SERIAL_LEN];
bool has_eeprom_data;
@@ -1139,23 +1140,15 @@ ptp_ocp_devlink_info_get(struct devlink *devlink, struct devlink_info_req *req,
if (err)
return err;
- if (bp->image) {
- u32 ver = ioread32(&bp->image->version);
-
- if (ver & 0xffff) {
- sprintf(buf, "%d", ver);
- err = devlink_info_version_running_put(req,
- "fw",
- buf);
- } else {
- sprintf(buf, "%d", ver >> 16);
- err = devlink_info_version_running_put(req,
- "loader",
- buf);
- }
- if (err)
- return err;
+ if (bp->fw_version & 0xffff) {
+ sprintf(buf, "%d", bp->fw_version);
+ err = devlink_info_version_running_put(req, "fw", buf);
+ } else {
+ sprintf(buf, "%d", bp->fw_version >> 16);
+ err = devlink_info_version_running_put(req, "loader", buf);
}
+ if (err)
+ return err;
if (!bp->has_eeprom_data) {
ptp_ocp_read_eeprom(bp);
@@ -1468,6 +1461,7 @@ ptp_ocp_fb_board_init(struct ptp_ocp *bp, struct ocp_resource *r)
{
bp->flash_start = 1024 * 4096;
bp->eeprom_map = fb_eeprom_map;
+ bp->fw_version = ioread32(&bp->image->version);
ptp_ocp_tod_init(bp);
ptp_ocp_nmea_out_init(bp);
@@ -2576,17 +2570,14 @@ ptp_ocp_info(struct ptp_ocp *bp)
ptp_ocp_phc_info(bp);
- if (bp->image) {
- u32 ver = ioread32(&bp->image->version);
+ dev_info(dev, "version %x\n", bp->fw_version);
+ if (bp->fw_version & 0xffff)
+ dev_info(dev, "regular image, version %d\n",
+ bp->fw_version & 0xffff);
+ else
+ dev_info(dev, "golden image, version %d\n",
+ bp->fw_version >> 16);
- dev_info(dev, "version %x\n", ver);
- if (ver & 0xffff)
- dev_info(dev, "regular image, version %d\n",
- ver & 0xffff);
- else
- dev_info(dev, "golden image, version %d\n",
- ver >> 16);
- }
ptp_ocp_serial_info(dev, "GNSS", bp->gnss_port, 115200);
ptp_ocp_serial_info(dev, "GNSS2", bp->gnss2_port, 115200);
ptp_ocp_serial_info(dev, "MAC", bp->mac_port, 57600);
--
2.31.1
next prev parent reply other threads:[~2022-03-08 0:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-08 0:05 [PATCH net-next v2 0/2] ptp: ocp: update devlink information Jonathan Lemon
2022-03-08 0:05 ` [PATCH net-next v2 1/2] ptp: ocp: add nvmem interface for accessing eeprom Jonathan Lemon
2022-03-08 0:05 ` Jonathan Lemon [this message]
2022-03-09 11:10 ` [PATCH net-next v2 0/2] ptp: ocp: update devlink information patchwork-bot+netdevbpf
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=20220308000536.2278-3-jonathan.lemon@gmail.com \
--to=jonathan.lemon@gmail.com \
--cc=davem@davemloft.net \
--cc=kernel-team@fb.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=richardcochran@gmail.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).