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>, Tom Rini <trini@konsulko.com>
Cc: u-boot@lists.denx.de
Subject: [PATCH v2 u-boot] pci: fsl: Do not access PCI BAR0 register of PCIe Root Port
Date: Tue,  2 May 2023 19:53:57 +0200	[thread overview]
Message-ID: <20230502175357.18072-1-pali@kernel.org> (raw)
In-Reply-To: <20230502165119.GM1134230@bill-the-cat>

Freescale PCIe Root Port has PEXCSRBAR register at position of PCI BAR0.
PCIe Root Port does not have any PCIe memory, so returns zero when trying
to read from PCIe Root Port BAR0 and ignore any writes.

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

diff --git a/drivers/pci/pcie_fsl.c b/drivers/pci/pcie_fsl.c
index 4600652f2b1b..8d89a1e5919c 100644
--- a/drivers/pci/pcie_fsl.c
+++ b/drivers/pci/pcie_fsl.c
@@ -58,6 +58,14 @@ static int fsl_pcie_read_config(const struct udevice *bus, pci_dev_t bdf,
 		return 0;
 	}
 
+	/* Skip Freescale PCIe controller's PEXCSRBAR register */
+	if (PCI_BUS(bdf) - dev_seq(bus) == 0 &&
+	    PCI_DEV(bdf) == 0 && PCI_FUNC(bdf) == 0 &&
+	    (offset & ~3) == PCI_BASE_ADDRESS_0) {
+		*valuep = 0;
+		return 0;
+	}
+
 	val = PCI_CONF1_EXT_ADDRESS(PCI_BUS(bdf) - dev_seq(bus),
 				    PCI_DEV(bdf), PCI_FUNC(bdf),
 				    offset);
@@ -95,6 +103,12 @@ static int fsl_pcie_write_config(struct udevice *bus, pci_dev_t bdf,
 	if (fsl_pcie_addr_valid(pcie, bdf))
 		return 0;
 
+	/* Skip Freescale PCIe controller's PEXCSRBAR register */
+	if (PCI_BUS(bdf) - dev_seq(bus) == 0 &&
+	    PCI_DEV(bdf) == 0 && PCI_FUNC(bdf) == 0 &&
+	    (offset & ~3) == PCI_BASE_ADDRESS_0)
+		return 0;
+
 	val = PCI_CONF1_EXT_ADDRESS(PCI_BUS(bdf) - dev_seq(bus),
 				    PCI_DEV(bdf), PCI_FUNC(bdf),
 				    offset);
-- 
2.20.1


  reply	other threads:[~2023-05-02 17:55 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-20 19:44 [PATCH u-boot 0/3] pci: Do not access Freescale PCI controllers BARs registers Pali Rohár
2023-04-20 19:44 ` [PATCH u-boot 1/3] pci: mpc85xx: Do not access PCI BARs registers of BDF address 00:00.0 Pali Rohár
2023-04-21  3:55   ` Heiko Schocher
2023-05-02 16:51   ` Tom Rini
2023-04-20 19:44 ` [PATCH u-boot 2/3] pci: fsl: Do not access PCI BAR0 register of PCIe Root Port Pali Rohár
2023-04-21  3:56   ` Heiko Schocher
2023-05-02 16:51   ` Tom Rini
2023-05-02 17:53     ` Pali Rohár [this message]
2023-05-04 15:52       ` [PATCH v2 u-boot] " Tom Rini
2023-04-20 19:44 ` [PATCH u-boot 3/3] pci: auto: Remove PCI_CLASS_PROCESSOR_POWERPC autoconfig case Pali Rohár
2023-04-21  3:56   ` Heiko Schocher
2023-05-02 16:51   ` Tom Rini
2023-04-21  3:54 ` [PATCH u-boot 0/3] pci: Do not access Freescale PCI controllers BARs registers Heiko Schocher
2023-04-29 11:06   ` Pali Rohár

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=20230502175357.18072-1-pali@kernel.org \
    --to=pali@kernel.org \
    --cc=hs@denx.de \
    --cc=trini@konsulko.com \
    --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