Skip to content

Commit 5131f18

Browse files
Jimmy Assarssonmarckleinebudde
authored andcommitted
can: kvaser_pciefd: Store the different firmware version components in a struct
Store firmware version in kvaser_pciefd_fw_version struct, specifying the different components of the version number. And drop debug prinout of firmware version, since later patches will expose it via the devlink interface. Reviewed-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr> Signed-off-by: Jimmy Assarsson <extja@kvaser.com> Link: https://patch.msgid.link/20250725123230.8-5-extja@kvaser.com Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
1 parent 69a2cb6 commit 5131f18

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

drivers/net/can/kvaser_pciefd.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,12 @@ struct kvaser_pciefd_driver_data {
325325
const struct kvaser_pciefd_dev_ops *ops;
326326
};
327327

328+
struct kvaser_pciefd_fw_version {
329+
u8 major;
330+
u8 minor;
331+
u16 build;
332+
};
333+
328334
static const struct kvaser_pciefd_address_offset kvaser_pciefd_altera_address_offset = {
329335
.serdes = 0x1000,
330336
.pci_ien = 0x50,
@@ -437,6 +443,7 @@ struct kvaser_pciefd {
437443
u32 bus_freq;
438444
u32 freq;
439445
u32 freq_to_ticks_div;
446+
struct kvaser_pciefd_fw_version fw_version;
440447
};
441448

442449
struct kvaser_pciefd_rx_packet {
@@ -1205,14 +1212,12 @@ static int kvaser_pciefd_setup_board(struct kvaser_pciefd *pcie)
12051212
u32 version, srb_status, build;
12061213

12071214
version = ioread32(KVASER_PCIEFD_SYSID_ADDR(pcie) + KVASER_PCIEFD_SYSID_VERSION_REG);
1215+
build = ioread32(KVASER_PCIEFD_SYSID_ADDR(pcie) + KVASER_PCIEFD_SYSID_BUILD_REG);
12081216
pcie->nr_channels = min(KVASER_PCIEFD_MAX_CAN_CHANNELS,
12091217
FIELD_GET(KVASER_PCIEFD_SYSID_VERSION_NR_CHAN_MASK, version));
1210-
1211-
build = ioread32(KVASER_PCIEFD_SYSID_ADDR(pcie) + KVASER_PCIEFD_SYSID_BUILD_REG);
1212-
dev_dbg(&pcie->pci->dev, "Version %lu.%lu.%lu\n",
1213-
FIELD_GET(KVASER_PCIEFD_SYSID_VERSION_MAJOR_MASK, version),
1214-
FIELD_GET(KVASER_PCIEFD_SYSID_VERSION_MINOR_MASK, version),
1215-
FIELD_GET(KVASER_PCIEFD_SYSID_BUILD_SEQ_MASK, build));
1218+
pcie->fw_version.major = FIELD_GET(KVASER_PCIEFD_SYSID_VERSION_MAJOR_MASK, version);
1219+
pcie->fw_version.minor = FIELD_GET(KVASER_PCIEFD_SYSID_VERSION_MINOR_MASK, version);
1220+
pcie->fw_version.build = FIELD_GET(KVASER_PCIEFD_SYSID_BUILD_SEQ_MASK, build);
12161221

12171222
srb_status = ioread32(KVASER_PCIEFD_SRB_ADDR(pcie) + KVASER_PCIEFD_SRB_STAT_REG);
12181223
if (!(srb_status & KVASER_PCIEFD_SRB_STAT_DMA)) {

0 commit comments

Comments
 (0)