public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Minda Chen <minda.chen@starfivetech.com>
To: "Pali Rohár" <pali@kernel.org>, "Rick Chen" <rick@andestech.com>,
	Leo <ycliang@andestech.com>, "Torsten Duwe" <duwe@suse.de>,
	"Bin Meng" <bmeng.cn@gmail.com>
Cc: <u-boot@lists.denx.de>, Mason Huo <mason.huo@starfivetech.com>,
	Minda Chen <minda.chen@starfivetech.com>
Subject: [RESEND, v1 1/4] pci: plda: Get correct ECAM offset in multiple PCIe RC case
Date: Mon, 7 Aug 2023 16:53:35 +0800	[thread overview]
Message-ID: <20230807085338.27119-2-minda.chen@starfivetech.com> (raw)
In-Reply-To: <20230807085338.27119-1-minda.chen@starfivetech.com>

Get the correct ECAM offset and record the secondary bus
number in Multiple RC case.

Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
---
 drivers/pci/pcie_plda_common.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/pcie_plda_common.c b/drivers/pci/pcie_plda_common.c
index 005b92616a..cd74bb4711 100644
--- a/drivers/pci/pcie_plda_common.c
+++ b/drivers/pci/pcie_plda_common.c
@@ -36,8 +36,8 @@ static int plda_pcie_conf_address(const struct udevice *udev, pci_dev_t bdf,
 				  uint offset, void **paddr)
 {
 	struct pcie_plda *priv = dev_get_priv(udev);
-	int where = PCIE_ECAM_OFFSET(PCI_BUS(bdf), PCI_DEV(bdf),
-				     PCI_FUNC(bdf), offset);
+	int where = PCIE_ECAM_OFFSET(PCI_BUS(bdf) - dev_seq(udev),
+				     PCI_DEV(bdf), PCI_FUNC(bdf), offset);
 
 	if (!plda_pcie_addr_valid(priv, bdf))
 		return -ENODEV;
@@ -71,6 +71,7 @@ int plda_pcie_config_write(struct udevice *udev, pci_dev_t bdf,
 	    (offset == PCI_PRIMARY_BUS && size != PCI_SIZE_8))) {
 		priv->sec_busno =
 			((offset == PCI_PRIMARY_BUS) ? (value >> 8) : value) & 0xff;
+		priv->sec_busno += dev_seq(udev);
 		debug("Secondary bus number was changed to %d\n",
 		      priv->sec_busno);
 	}
-- 
2.17.1


  reply	other threads:[~2023-08-07  8:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-07  8:53 [RESEND,v1 0/4] Add StarFive VF2 USB host support Minda Chen
2023-08-07  8:53 ` Minda Chen [this message]
2023-08-09  7:02   ` [RESEND,v1 1/4] pci: plda: Get correct ECAM offset in multiple PCIe RC case Leo Liang
2023-08-07  8:53 ` [RESEND,v1 2/4] riscv: dts: starfive: Enable pcie0 dts node Minda Chen
2023-08-09  7:03   ` Leo Liang
2023-08-07  8:53 ` [RESEND, v1 3/4] riscv: starfive: Add SYS_CACHE_SHIFT_6 to enable SYS_CACHELINE_SIZE Minda Chen
2023-08-07 10:18   ` Bin Meng
2023-08-09  7:04   ` Leo Liang
2023-08-07  8:53 ` [RESEND, v1 4/4] configs: riscv: starfive: Add VF2 PCIe USB3 XHCI support Minda Chen
2023-08-09  7:04   ` Leo Liang

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=20230807085338.27119-2-minda.chen@starfivetech.com \
    --to=minda.chen@starfivetech.com \
    --cc=bmeng.cn@gmail.com \
    --cc=duwe@suse.de \
    --cc=mason.huo@starfivetech.com \
    --cc=pali@kernel.org \
    --cc=rick@andestech.com \
    --cc=u-boot@lists.denx.de \
    --cc=ycliang@andestech.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