From: Zhang Wei <wei.zhang@freescale.com>
To: paulus@samba.org
Cc: linuxppc-dev@ozlabs.org
Subject: [PATCH 3/5] Float the pci bus number on MPC8641HPCN board.
Date: Tue, 22 May 2007 11:38:28 +0800 [thread overview]
Message-ID: <1179805110278-git-send-email-wei.zhang@freescale.com> (raw)
In-Reply-To: <1179805110272-git-send-email-wei.zhang@freescale.com>
Float the pci bus number on MPC8641HPCN board.
For example, PCI hose 1 bus range is from 0 to 2, the PCI hose 2 bus
range will start from 3.
Add the pci-express link training stats check. It avoid the system halt
while the link training is fault.
Signed-off-by: Zhang Wei <wei.zhang@freescale.com>
Acked-by: Roy Zang <tie-fei.zang@freescale.com>
---
arch/powerpc/platforms/86xx/mpc86xx_hpcn.c | 1 +
arch/powerpc/platforms/86xx/pci.c | 23 ++++++++++++++++++++++-
2 files changed, 23 insertions(+), 1 deletions(-)
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
index ae5714f..2dacc33 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
@@ -358,6 +358,7 @@ mpc86xx_hpcn_setup_arch(void)
}
#ifdef CONFIG_PCI
+ pci_assign_all_buses = 1;
for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
add_bridge(np);
diff --git a/arch/powerpc/platforms/86xx/pci.c b/arch/powerpc/platforms/86xx/pci.c
index 7efae7c..5612f6a 100644
--- a/arch/powerpc/platforms/86xx/pci.c
+++ b/arch/powerpc/platforms/86xx/pci.c
@@ -122,7 +122,6 @@ static void __init
mpc86xx_setup_pcie(struct pci_controller *hose, u32 pcie_offset, u32 pcie_size)
{
u16 cmd;
- unsigned int temps;
DBG("PCIE host controller register offset 0x%08x, size 0x%08x.\n",
pcie_offset, pcie_size);
@@ -137,9 +136,23 @@ mpc86xx_setup_pcie(struct pci_controller *hose, u32 pcie_offset, u32 pcie_size)
int mpc86xx_exclude_device(u_char bus, u_char devfn)
{
+ struct pci_controller *hose;
+
+ hose = pci_bus_to_hose(bus);
+ if (unlikely(!hose))
+ return PCIBIOS_DEVICE_NOT_FOUND;
+
+ /* Correcting the hose->bus_offset value. */
+ out_be32(hose->cfg_addr, 0x80000000 | ((hose->first_busno
+ - hose->bus_offset) << 16));
+ if (unlikely(in_le32(hose->cfg_data) == 0xffffffff))
+ hose->bus_offset = hose->bus_offset ? 0 : hose->first_busno;
+
return PCIBIOS_SUCCESSFUL;
}
+#define PCIE_LTSSM 0x04000004 /* PCIe Link Training and Status */
+#define PCIE_LTSSM_L0 0x16 /* L0 state */
int __init add_bridge(struct device_node *dev)
{
int len;
@@ -148,12 +161,20 @@ int __init add_bridge(struct device_node *dev)
const int *bus_range;
int has_address = 0;
int primary = 0;
+ void *pcicfg_addr;
DBG("Adding PCIE host bridge %s\n", dev->full_name);
/* Fetch host bridge registers address */
has_address = (of_address_to_resource(dev, 0, &rsrc) == 0);
+ /* Probe the hose link training status */
+ pcicfg_addr = ioremap(rsrc.start, 0x1000);
+ out_be32(pcicfg_addr, 0x80000000 | PCIE_LTSSM);
+ if (in_le16(pcicfg_addr + 4) < PCIE_LTSSM_L0)
+ return -ENXIO;
+ iounmap(pcicfg_addr);
+
/* Get bus range if any */
bus_range = of_get_property(dev, "bus-range", &len);
if (bus_range == NULL || len < 2 * sizeof(int))
--
1.5.1
next prev parent reply other threads:[~2007-05-22 3:31 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-22 3:38 [PATCH 0/5] Add the support for MPC8641 silicon rev 2.0 and MPC8641HPCN board 2.0 Zhang Wei
2007-05-22 3:38 ` [PATCH 1/5] Remove the errata fix codes for MPC8641 silicon ver 1.0 which is end of life Zhang Wei
2007-05-22 3:38 ` [PATCH 2/5] Add uli1575 pci-bridge sector to MPC8641HPCN dts file Zhang Wei
2007-05-22 3:38 ` Zhang Wei [this message]
2007-05-22 3:38 ` [PATCH 4/5] Set RC of mpc8641 to transparent bridge for transfer legacy I/O access Zhang Wei
2007-05-22 3:38 ` [PATCH 5/5] Set IDE in ULI1575 to not native mode Zhang Wei
2007-05-29 18:15 ` Jon Loeliger
2007-05-29 20:50 ` Kumar Gala
2007-05-30 2:25 ` Zhang Wei-r63237
2007-05-30 11:40 ` Benjamin Herrenschmidt
2007-05-31 2:00 ` Zhang Wei-r63237
2007-05-30 11:18 ` Benjamin Herrenschmidt
2007-05-29 18:15 ` [PATCH 4/5] Set RC of mpc8641 to transparent bridge for transfer legacy I/O access Jon Loeliger
2007-05-22 17:59 ` [PATCH 3/5] Float the pci bus number on MPC8641HPCN board Wade Farnsworth
2007-05-23 3:35 ` Zhang Wei-r63237
2007-05-31 13:43 ` Kumar Gala
2007-06-01 2:01 ` Zhang Wei-r63237
2007-06-01 5:08 ` Kumar Gala
2007-06-01 6:28 ` Paul Mackerras
2007-06-01 6:45 ` Zhang Wei-r63237
2007-06-01 7:44 ` Benjamin Herrenschmidt
2007-06-01 7:53 ` Zhang Wei-r63237
2007-06-01 8:00 ` Benjamin Herrenschmidt
2007-06-01 16:35 ` Matt Sealey
2007-06-01 16:47 ` Jon Loeliger
2007-06-01 22:41 ` Benjamin Herrenschmidt
2007-06-01 22:41 ` Benjamin Herrenschmidt
2007-06-02 8:36 ` Segher Boessenkool
2007-06-02 8:55 ` Benjamin Herrenschmidt
2007-06-01 19:58 ` Kumar Gala
2007-06-01 23:28 ` Benjamin Herrenschmidt
2007-06-04 19:00 ` Jon Loeliger
2007-06-04 22:24 ` Benjamin Herrenschmidt
2007-06-01 6:29 ` Zhang Wei-r63237
2007-05-29 18:14 ` Jon Loeliger
2007-05-22 20:37 ` [PATCH 2/5] Add uli1575 pci-bridge sector to MPC8641HPCN dts file xianghua xiao
2007-05-23 3:38 ` Zhang Wei-r63237
2007-05-29 18:14 ` Jon Loeliger
2007-05-29 20:39 ` Kumar Gala
2007-05-30 10:02 ` Zhang Wei-r63237
2007-05-30 10:18 ` Segher Boessenkool
2007-05-30 11:07 ` Benjamin Herrenschmidt
2007-05-30 22:26 ` Wade Farnsworth
2007-05-29 18:13 ` [PATCH 1/5] Remove the errata fix codes for MPC8641 silicon ver 1.0 which is end of life Jon Loeliger
2007-05-22 3:53 ` [PATCH 0/5] Add the support for MPC8641 silicon rev 2.0 and MPC8641HPCN board 2.0 Kumar Gala
2007-05-22 4:46 ` Zhang Wei-r63237
2007-05-22 12:54 ` Kumar Gala
2007-05-22 16:28 ` Jon Loeliger
2007-05-22 17:47 ` Wade Farnsworth
2007-05-23 2:48 ` [PATCH 0/5] Add the support for MPC8641 silicon rev 2.0 andMPC8641HPCN " Zhang Wei-r63237
2007-05-23 22:37 ` Wade Farnsworth
2007-05-29 18:12 ` [PATCH 0/5] Add the support for MPC8641 silicon rev 2.0 and MPC8641HPCN " Jon Loeliger
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=1179805110278-git-send-email-wei.zhang@freescale.com \
--to=wei.zhang@freescale.com \
--cc=linuxppc-dev@ozlabs.org \
--cc=paulus@samba.org \
/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;
as well as URLs for NNTP newsgroup(s).