linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Logan Gunthorpe <logang@deltatee.com>
To: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
	Bjorn Helgaas <bhelgaas@google.com>
Cc: Kelvin.Cao@microchip.com, Eric Pilmore <epilmore@gigaio.com>,
	Doug Meyer <dmeyer@gigaio.com>,
	Logan Gunthorpe <logang@deltatee.com>
Subject: [PATCH v2 5/7] PCI/switchtec: Add gen4 support for the system info registers
Date: Tue, 14 Jan 2020 20:56:46 -0700	[thread overview]
Message-ID: <20200115035648.2578-6-logang@deltatee.com> (raw)
In-Reply-To: <20200115035648.2578-1-logang@deltatee.com>

Add the gen4 specific system info registers and ensure their usage is
guarded by a check on the device's generation.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
---
 drivers/pci/switch/switchtec.c |  5 ++++
 include/linux/switchtec.h      | 43 ++++++++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+)

diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c
index 3bdec509f948..0062225db50f 100644
--- a/drivers/pci/switch/switchtec.c
+++ b/drivers/pci/switch/switchtec.c
@@ -321,6 +321,9 @@ static ssize_t field ## _show(struct device *dev, \
 	if (stdev->gen == SWITCHTEC_GEN3) \
 		return io_string_show(buf, &si->gen3.field, \
 				      sizeof(si->gen3.field)); \
+	else if (stdev->gen == SWITCHTEC_GEN4) \
+		return io_string_show(buf, &si->gen4.field, \
+				      sizeof(si->gen4.field)); \
 	else \
 		return -ENOTSUPP; \
 } \
@@ -1435,6 +1438,8 @@ static int switchtec_init_pci(struct switchtec_dev *stdev,
 
 	if (stdev->gen == SWITCHTEC_GEN3)
 		part_id = &stdev->mmio_sys_info->gen3.partition_id;
+	else if (stdev->gen == SWITCHTEC_GEN4)
+		part_id = &stdev->mmio_sys_info->gen4.partition_id;
 	else
 		return -ENOTSUPP;
 
diff --git a/include/linux/switchtec.h b/include/linux/switchtec.h
index 73817d02db1e..ea217af5260e 100644
--- a/include/linux/switchtec.h
+++ b/include/linux/switchtec.h
@@ -39,6 +39,7 @@ enum {
 
 enum switchtec_gen {
 	SWITCHTEC_GEN3,
+	SWITCHTEC_GEN4,
 };
 
 struct mrpc_regs {
@@ -130,12 +131,54 @@ struct sys_info_regs_gen3 {
 	u8 component_revision;
 } __packed;
 
+struct sys_info_regs_gen4 {
+	u16 gas_layout_ver;
+	u8 evlist_ver;
+	u8 reserved1;
+	u16 mgmt_cmd_set_ver;
+	u16 fabric_cmd_set_ver;
+	u32 reserved2[2];
+	u8 mrpc_uart_ver;
+	u8 mrpc_twi_ver;
+	u8 mrpc_eth_ver;
+	u8 mrpc_inband_ver;
+	u32 reserved3[7];
+	u32 fw_update_tmo;
+	u32 xml_version_cfg;
+	u32 xml_version_img;
+	u32 partition_id;
+	u16 bl2_running;
+	u16 cfg_running;
+	u16 img_running;
+	u16 key_running;
+	u32 reserved4[43];
+	u32 vendor_seeprom_twi;
+	u32 vendor_table_revision;
+	u32 vendor_specific_info[2];
+	u16 p2p_vendor_id;
+	u16 p2p_device_id;
+	u8 p2p_revision_id;
+	u8 reserved5[3];
+	u32 p2p_class_id;
+	u16 subsystem_vendor_id;
+	u16 subsystem_id;
+	u32 p2p_serial_number[2];
+	u8 mac_addr[6];
+	u8 reserved6[2];
+	u32 reserved7[3];
+	char vendor_id[8];
+	char product_id[24];
+	char  product_revision[2];
+	u16 reserved8;
+} __packed;
+
 struct sys_info_regs {
 	u32 device_id;
 	u32 device_version;
 	u32 firmware_version;
 	union {
 		struct sys_info_regs_gen3 gen3;
+		struct sys_info_regs_gen4 gen4;
 	};
 } __packed;
 
-- 
2.20.1


  parent reply	other threads:[~2020-01-15  3:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-15  3:56 [PATCH v2 0/7] Switchtec Gen4 Support Logan Gunthorpe
2020-01-15  3:56 ` [PATCH v2 1/7] PCI/switchtec: Rename generation specific constants Logan Gunthorpe
2020-01-15  3:56 ` [PATCH v2 2/7] PCI/switchtec: Introduce Generation Variable Logan Gunthorpe
2020-01-15  3:56 ` [PATCH v2 3/7] PCI/switchtec: Refactor ioctl_flash_part_info() Logan Gunthorpe
2020-01-15  3:56 ` [PATCH v2 4/7] PCI/switchtec: Separate out gen3 register structures into unionse Logan Gunthorpe
2020-01-15  3:56 ` Logan Gunthorpe [this message]
2020-01-15  3:56 ` [PATCH v2 6/7] PCI/switchtec: Add gen4 support for the flash information interface Logan Gunthorpe
2020-01-15  3:56 ` [PATCH v2 7/7] PCI/switchtec: Introduce gen4 variant IDS in the device ID table Logan Gunthorpe
2020-01-15 17:01 ` [PATCH v2 0/7] Switchtec Gen4 Support Bjorn Helgaas

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=20200115035648.2578-6-logang@deltatee.com \
    --to=logang@deltatee.com \
    --cc=Kelvin.Cao@microchip.com \
    --cc=bhelgaas@google.com \
    --cc=dmeyer@gigaio.com \
    --cc=epilmore@gigaio.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@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).