All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
	bhelgaas@google.com
Cc: Jason Cooper <jason@lakedaemon.net>,
	linux-pci@vger.kernel.org,
	linux ARM <linux-arm-kernel@lists.infradead.org>,
	Andrew Lunn <andrew@lunn.ch>
Subject: [PATCH] PCI: MVEBU: Use Device ID and revision from underlying endpoint
Date: Wed,  5 Feb 2014 11:55:49 +0100	[thread overview]
Message-ID: <1391597749-29807-1-git-send-email-andrew@lunn.ch> (raw)

Marvell SoCs place the SoC number into the PCIe endpoint device ID.
The SoC stepping is placed into the PCIe revision. The old plat-orion
PCIe driver allowed this information to be seen in user space with a
simple lspci command.

The new driver places a virtual PCI-PCI bridge on top of these
endpoints. It has its own hard coded PCI device ID. Thus it is no
longer possible to see what the SoC is using lspci.

When initializing the PCI-PCI bridge, set its device ID and revision
from the underlying endpoint, thus restoring this functionality.
Debian would like to use this in order to aid installing the correct
DTB file.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 drivers/pci/host/pci-mvebu.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
index 13478ecd4113..0e79665afd44 100644
--- a/drivers/pci/host/pci-mvebu.c
+++ b/drivers/pci/host/pci-mvebu.c
@@ -60,14 +60,6 @@
 #define PCIE_DEBUG_CTRL         0x1a60
 #define  PCIE_DEBUG_SOFT_RESET		BIT(20)
 
-/*
- * This product ID is registered by Marvell, and used when the Marvell
- * SoC is not the root complex, but an endpoint on the PCIe bus. It is
- * therefore safe to re-use this PCI ID for our emulated PCI-to-PCI
- * bridge.
- */
-#define MARVELL_EMULATED_PCI_PCI_BRIDGE_ID 0x7846
-
 /* PCI configuration space of a PCI-to-PCI bridge */
 struct mvebu_sw_pci_bridge {
 	u16 vendor;
@@ -388,7 +380,8 @@ static void mvebu_sw_pci_bridge_init(struct mvebu_pcie_port *port)
 
 	bridge->class = PCI_CLASS_BRIDGE_PCI;
 	bridge->vendor = PCI_VENDOR_ID_MARVELL;
-	bridge->device = MARVELL_EMULATED_PCI_PCI_BRIDGE_ID;
+	bridge->device = mvebu_readl(port, PCIE_DEV_ID_OFF) >> 16;
+	bridge->revision = mvebu_readl(port, PCIE_DEV_REV_OFF) & 0xff;
 	bridge->header_type = PCI_HEADER_TYPE_BRIDGE;
 	bridge->cache_line_size = 0x10;
 
-- 
1.8.5.2


WARNING: multiple messages have this Message-ID (diff)
From: andrew@lunn.ch (Andrew Lunn)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] PCI: MVEBU: Use Device ID and revision from underlying endpoint
Date: Wed,  5 Feb 2014 11:55:49 +0100	[thread overview]
Message-ID: <1391597749-29807-1-git-send-email-andrew@lunn.ch> (raw)

Marvell SoCs place the SoC number into the PCIe endpoint device ID.
The SoC stepping is placed into the PCIe revision. The old plat-orion
PCIe driver allowed this information to be seen in user space with a
simple lspci command.

The new driver places a virtual PCI-PCI bridge on top of these
endpoints. It has its own hard coded PCI device ID. Thus it is no
longer possible to see what the SoC is using lspci.

When initializing the PCI-PCI bridge, set its device ID and revision
from the underlying endpoint, thus restoring this functionality.
Debian would like to use this in order to aid installing the correct
DTB file.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 drivers/pci/host/pci-mvebu.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
index 13478ecd4113..0e79665afd44 100644
--- a/drivers/pci/host/pci-mvebu.c
+++ b/drivers/pci/host/pci-mvebu.c
@@ -60,14 +60,6 @@
 #define PCIE_DEBUG_CTRL         0x1a60
 #define  PCIE_DEBUG_SOFT_RESET		BIT(20)
 
-/*
- * This product ID is registered by Marvell, and used when the Marvell
- * SoC is not the root complex, but an endpoint on the PCIe bus. It is
- * therefore safe to re-use this PCI ID for our emulated PCI-to-PCI
- * bridge.
- */
-#define MARVELL_EMULATED_PCI_PCI_BRIDGE_ID 0x7846
-
 /* PCI configuration space of a PCI-to-PCI bridge */
 struct mvebu_sw_pci_bridge {
 	u16 vendor;
@@ -388,7 +380,8 @@ static void mvebu_sw_pci_bridge_init(struct mvebu_pcie_port *port)
 
 	bridge->class = PCI_CLASS_BRIDGE_PCI;
 	bridge->vendor = PCI_VENDOR_ID_MARVELL;
-	bridge->device = MARVELL_EMULATED_PCI_PCI_BRIDGE_ID;
+	bridge->device = mvebu_readl(port, PCIE_DEV_ID_OFF) >> 16;
+	bridge->revision = mvebu_readl(port, PCIE_DEV_REV_OFF) & 0xff;
 	bridge->header_type = PCI_HEADER_TYPE_BRIDGE;
 	bridge->cache_line_size = 0x10;
 
-- 
1.8.5.2

             reply	other threads:[~2014-02-05 10:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-05 10:55 Andrew Lunn [this message]
2014-02-05 10:55 ` [PATCH] PCI: MVEBU: Use Device ID and revision from underlying endpoint Andrew Lunn
2014-02-05 16:21 ` Thomas Petazzoni
2014-02-05 16:21   ` Thomas Petazzoni
2014-02-05 16:54   ` Andrew Lunn
2014-02-05 16:54     ` Andrew Lunn
2014-02-05 17:03     ` Thomas Petazzoni
2014-02-05 17:03       ` Thomas Petazzoni
2014-02-05 18:42 ` Jason Cooper
2014-02-05 18:42   ` Jason Cooper
2014-02-12 21:06 ` Bjorn Helgaas
2014-02-12 21:06   ` Bjorn Helgaas

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=1391597749-29807-1-git-send-email-andrew@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=bhelgaas@google.com \
    --cc=jason@lakedaemon.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=thomas.petazzoni@free-electrons.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.