aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLogan Gunthorpe <logang@deltatee.com>2017-05-22 17:52:30 -0400
committerBjorn Helgaas <bhelgaas@google.com>2017-05-22 17:52:30 -0400
commit9871e9bb5cf6ff0b51457ca74c270c5c5230b224 (patch)
treee2627f003c78390e5e7adcfef4ffc4423313e5a9
parente40cf640b8f632091a30ef0b030c83546f07c902 (diff)
switchtec: Fix minor bug with partition ID register
When a switch endpoint 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, 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. Reported-by: Dingbao Chen <dingbao.chen@microsemi.com> Signed-off-by: Logan Gunthorpe <logang@deltatee.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-rw-r--r--drivers/pci/switch/switchtec.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c
index abaa227a5f34..f6a63406c76e 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,
1441 stdev->mmio_sys_info = stdev->mmio + SWITCHTEC_GAS_SYS_INFO_OFFSET; 1441 stdev->mmio_sys_info = stdev->mmio + SWITCHTEC_GAS_SYS_INFO_OFFSET;
1442 stdev->mmio_flash_info = stdev->mmio + SWITCHTEC_GAS_FLASH_INFO_OFFSET; 1442 stdev->mmio_flash_info = stdev->mmio + SWITCHTEC_GAS_FLASH_INFO_OFFSET;
1443 stdev->mmio_ntb = stdev->mmio + SWITCHTEC_GAS_NTB_OFFSET; 1443 stdev->mmio_ntb = stdev->mmio + SWITCHTEC_GAS_NTB_OFFSET;
1444 stdev->partition = ioread8(&stdev->mmio_ntb->partition_id); 1444 stdev->partition = ioread8(&stdev->mmio_sys_info->partition_id);
1445 stdev->partition_count = ioread8(&stdev->mmio_ntb->partition_count); 1445 stdev->partition_count = ioread8(&stdev->mmio_ntb->partition_count);
1446 stdev->mmio_part_cfg_all = stdev->mmio + SWITCHTEC_GAS_PART_CFG_OFFSET; 1446 stdev->mmio_part_cfg_all = stdev->mmio + SWITCHTEC_GAS_PART_CFG_OFFSET;
1447 stdev->mmio_part_cfg = &stdev->mmio_part_cfg_all[stdev->partition]; 1447 stdev->mmio_part_cfg = &stdev->mmio_part_cfg_all[stdev->partition];
1448 stdev->mmio_pff_csr = stdev->mmio + SWITCHTEC_GAS_PFF_CSR_OFFSET; 1448 stdev->mmio_pff_csr = stdev->mmio + SWITCHTEC_GAS_PFF_CSR_OFFSET;
1449 1449
1450 if (stdev->partition_count < 1)
1451 stdev->partition_count = 1;
1452
1450 init_pff(stdev); 1453 init_pff(stdev);
1451 1454
1452 pci_set_drvdata(pdev, stdev); 1455 pci_set_drvdata(pdev, stdev);