public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: Heiko Schocher <hs@denx.de>
Cc: u-boot@lists.denx.de
Subject: [PATCH u-boot 3/3] pci: mpc85xx: Do not try to access extended PCIe registers
Date: Thu, 13 Apr 2023 22:41:46 +0200	[thread overview]
Message-ID: <20230413204146.9318-4-pali@kernel.org> (raw)
In-Reply-To: <20230413204146.9318-1-pali@kernel.org>

Driver pci_mpc85xx.c is PCI controller driver for old PCI Local Bus,
which does not support access to extended PCIe registers (above 0xff),
as opposite of the PCIe driver pcie_fsl.c for the same platform.

So do not try to access extended PCIe registers as it cannot work.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 drivers/pci/pci_mpc85xx.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/pci_mpc85xx.c b/drivers/pci/pci_mpc85xx.c
index d144f2b791b8..833de816c459 100644
--- a/drivers/pci/pci_mpc85xx.c
+++ b/drivers/pci/pci_mpc85xx.c
@@ -22,7 +22,12 @@ static int mpc85xx_pci_dm_read_config(const struct udevice *dev, pci_dev_t bdf,
 	struct mpc85xx_pci_priv *priv = dev_get_priv(dev);
 	u32 addr;
 
-	addr = PCI_CONF1_EXT_ADDRESS(PCI_BUS(bdf), PCI_DEV(bdf), PCI_FUNC(bdf), offset);
+	if (offset > 0xff) {
+		*value = pci_get_ff(size);
+		return 0;
+	}
+
+	addr = PCI_CONF1_ADDRESS(PCI_BUS(bdf), PCI_DEV(bdf), PCI_FUNC(bdf), offset);
 	out_be32(priv->cfg_addr, addr);
 	sync();
 
@@ -48,7 +53,10 @@ static int mpc85xx_pci_dm_write_config(struct udevice *dev, pci_dev_t bdf,
 	struct mpc85xx_pci_priv *priv = dev_get_priv(dev);
 	u32 addr;
 
-	addr = PCI_CONF1_EXT_ADDRESS(PCI_BUS(bdf), PCI_DEV(bdf), PCI_FUNC(bdf), offset);
+	if (offset > 0xff)
+		return 0;
+
+	addr = PCI_CONF1_ADDRESS(PCI_BUS(bdf), PCI_DEV(bdf), PCI_FUNC(bdf), offset);
 	out_be32(priv->cfg_addr, addr);
 	sync();
 
-- 
2.20.1


  parent reply	other threads:[~2023-04-13 20:44 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-13 20:41 [PATCH u-boot 0/3] pci: mpc85xx: Fixes for PCI config space Pali Rohár
2023-04-13 20:41 ` [PATCH u-boot 1/3] pci: mpc85xx: Add missing sync() after writing to " Pali Rohár
2023-04-17  5:13   ` Heiko Schocher
2023-05-02 16:51   ` Tom Rini
2023-04-13 20:41 ` [PATCH u-boot 2/3] pci: mpc85xx: Allow 8/16-bit access " Pali Rohár
2023-04-17  5:13   ` Heiko Schocher
2023-05-02 16:51   ` Tom Rini
2023-04-13 20:41 ` Pali Rohár [this message]
2023-04-17  5:13   ` [PATCH u-boot 3/3] pci: mpc85xx: Do not try to access extended PCIe registers Heiko Schocher
2023-05-02 16:51   ` Tom Rini
2023-04-14  4:01 ` [PATCH u-boot 0/3] pci: mpc85xx: Fixes for PCI config space Heiko Schocher
2023-04-17  5:12 ` Heiko Schocher
2023-04-17  7:03   ` Pali Rohár
2023-04-29 11:10 ` Pali Rohár
2023-05-02  4:20   ` Heiko Schocher

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=20230413204146.9318-4-pali@kernel.org \
    --to=pali@kernel.org \
    --cc=hs@denx.de \
    --cc=u-boot@lists.denx.de \
    /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