From: Logan Gunthorpe <logang@deltatee.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: Kurt Schwemmer <kurt.schwemmer@microsemi.com>,
Stephen Bates <stephen.bates@microsemi.com>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
Logan Gunthorpe <logang@deltatee.com>
Subject: [PATCH 2/2] switchtec: fix minor bug with partition id register
Date: Mon, 15 May 2017 10:44:53 -0600 [thread overview]
Message-ID: <1494866693-2850-3-git-send-email-logang@deltatee.com> (raw)
In-Reply-To: <1494866693-2850-1-git-send-email-logang@deltatee.com>
When a switch endpoind is configured without NTB the mmio_ntb registers
will read all zeros. However, in corner case configurations where the
partition ID is not zero and NTB is not enabled then the code will have
the wrong partition ID and this causes the driver to use the wrong
set of drivers. To fix this we simply take the partition ID from the
system info region.
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Reported-by: Dingbao Chen <dingbao.chen@microsemi.com>
---
drivers/pci/switch/switchtec.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c
index abaa227a..f6a6340 100644
--- a/drivers/pci/switch/switchtec.c
+++ b/drivers/pci/switch/switchtec.c
@@ -1441,12 +1441,15 @@ static int switchtec_init_pci(struct switchtec_dev *stdev,
stdev->mmio_sys_info = stdev->mmio + SWITCHTEC_GAS_SYS_INFO_OFFSET;
stdev->mmio_flash_info = stdev->mmio + SWITCHTEC_GAS_FLASH_INFO_OFFSET;
stdev->mmio_ntb = stdev->mmio + SWITCHTEC_GAS_NTB_OFFSET;
- stdev->partition = ioread8(&stdev->mmio_ntb->partition_id);
+ stdev->partition = ioread8(&stdev->mmio_sys_info->partition_id);
stdev->partition_count = ioread8(&stdev->mmio_ntb->partition_count);
stdev->mmio_part_cfg_all = stdev->mmio + SWITCHTEC_GAS_PART_CFG_OFFSET;
stdev->mmio_part_cfg = &stdev->mmio_part_cfg_all[stdev->partition];
stdev->mmio_pff_csr = stdev->mmio + SWITCHTEC_GAS_PFF_CSR_OFFSET;
+ if (stdev->partition_count < 1)
+ stdev->partition_count = 1;
+
init_pff(stdev);
pci_set_drvdata(pdev, stdev);
--
2.1.4
next prev parent reply other threads:[~2017-05-15 16:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-15 16:44 [PATCH 0/2] Fixes for Switchtec Driver Logan Gunthorpe
2017-05-15 16:44 ` [PATCH 1/2] switchtec: utilize new device_add_cdev helper function Logan Gunthorpe
2017-05-15 16:44 ` Logan Gunthorpe [this message]
2017-05-22 21:54 ` [PATCH 0/2] Fixes for Switchtec Driver Bjorn Helgaas
2017-05-23 3:56 ` Logan Gunthorpe
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=1494866693-2850-3-git-send-email-logang@deltatee.com \
--to=logang@deltatee.com \
--cc=bhelgaas@google.com \
--cc=kurt.schwemmer@microsemi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=stephen.bates@microsemi.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).