* [PATCH v2 9/9] Created quirk_mpc8641_transparent() to initialize bridge resources.
@ 2007-06-04 22:30 Jon Loeliger
2007-06-22 13:50 ` Kumar Gala
0 siblings, 1 reply; 4+ messages in thread
From: Jon Loeliger @ 2007-06-04 22:30 UTC (permalink / raw)
To: linuxppc-dev@ozlabs.org
The 8641 RC poses as a transparent bridge, but does not implement the
IO_BASE or IO_LIMIT registers in the config space. This means that
the code which initializes the bridge resources ends up setting the
IO resources erroneously.
This change sets RC of mpc8641 to be a transparent bridge
for legacy I/O access and initializes the RC bridge resources
from the device tree.
Signed-off-by: Zhang Wei <wei.zhang@freescale.com>
Signed-off-by: Andy Fleming <afleming@freescale.com>
Signed-off-by: Jon Loeliger <jdl@freescale.com>
---
Incorporates review suggestions from Milton.
arch/powerpc/platforms/86xx/mpc86xx_hpcn.c | 76 ++++++++++++++++++++++++++++
1 files changed, 76 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
index a82da4b..83a2c28 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
@@ -318,6 +318,7 @@ static void __devinit quirk_uli5288(struct pci_dev *dev)
static void __devinit quirk_uli5229(struct pci_dev *dev)
{
unsigned short temp;
+
pci_write_config_word(dev, 0x04, 0x0405);
dev->class &= ~0x5;
pci_read_config_word(dev, 0x4a, &temp);
@@ -325,6 +326,75 @@ static void __devinit quirk_uli5229(struct pci_dev *dev)
pci_write_config_word(dev, 0x4a, temp);
}
+static void __devinit quirk_mpc8641_transparent(struct pci_dev *dev)
+{
+ const u32 *ranges;
+ struct resource *res;
+ int len;
+ int i;
+ unsigned int flags;
+ u64 size;
+ struct device_node *node;
+ struct pci_controller *hose;
+
+ /*
+ * Make the bridge be transparent.
+ */
+ dev->transparent = 1;
+
+ /*
+ * parse ranges property
+ * Ensure IO resource is placed in the PCI_BRIDGE_RESOURCES entry.
+ * PCI #address-cells == 3 and #size-cells == 2 always
+ */
+ hose = pci_bus_to_hose(dev->bus->number);
+ if (!hose) {
+ printk(KERN_ERR "Can't find hose for bus %d\n",
+ dev->bus->number);
+ return;
+ }
+ node = hose->arch_data;
+
+ ranges = of_get_property(node, "ranges", &len);
+ if (ranges == NULL) {
+ printk(KERN_DEBUG "Can't get ranges for PCI-PCI bridge %s\n",
+ node->full_name);
+ return;
+ }
+
+ /*
+ * Each PCI range is 3 words of PCI address, 1 word
+ * of CPU address, 2 words of size:
+ * one range is < [pci_addr] [CPU] [size] >
+ */
+ i = PCI_BRIDGE_RESOURCES + 1;
+ for (; len >= 24; len -= 24, ranges += 6) {
+ flags = of_bus_pci_get_flags(&ranges[0]);
+ size = of_read_number(&ranges[4], 2);
+ if (flags == 0 || size == 0)
+ continue;
+ if (flags & IORESOURCE_IO) {
+ res = &dev->resource[PCI_BRIDGE_RESOURCES];
+ if (res->flags) {
+ printk(KERN_ERR "PCI: ignoring extra I/O range"
+ " for bridge %s\n", node->full_name);
+ continue;
+ }
+ } else {
+ if (i >= PCI_NUM_RESOURCES) {
+ printk(KERN_ERR "PCI: too many memory ranges"
+ " for bridge %s\n", node->full_name);
+ continue;
+ }
+ res = &dev->resource[i];
+ ++i;
+ }
+ res->start = of_read_number(&ranges[1], 2);
+ res->end = res->start + size - 1;
+ res->flags = flags;
+ }
+}
+
static void __devinit early_uli5249(struct pci_dev *dev)
{
unsigned char temp;
@@ -339,6 +409,12 @@ static void __devinit early_uli5249(struct pci_dev *dev)
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x1575, quirk_uli1575);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5288, quirk_uli5288);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5229, quirk_uli5229);
+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_FREESCALE,
+ PCI_DEVICE_ID_8641_PCI_HOST_BRIDGE,
+ quirk_mpc8641_transparent);
+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_FREESCALE,
+ PCI_DEVICE_ID_8641D_PCI_HOST_BRIDGE,
+ quirk_mpc8641_transparent);
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_AL, 0x5249, early_uli5249);
#endif /* CONFIG_PCI */
--
1.5.0.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 9/9] Created quirk_mpc8641_transparent() to initialize bridge resources.
2007-06-04 22:30 [PATCH v2 9/9] Created quirk_mpc8641_transparent() to initialize bridge resources Jon Loeliger
@ 2007-06-22 13:50 ` Kumar Gala
2007-06-22 16:20 ` Jon Loeliger
0 siblings, 1 reply; 4+ messages in thread
From: Kumar Gala @ 2007-06-22 13:50 UTC (permalink / raw)
To: Jon Loeliger; +Cc: linuxppc-dev@ozlabs.org list
On Jun 4, 2007, at 5:30 PM, Jon Loeliger wrote:
> The 8641 RC poses as a transparent bridge, but does not implement the
> IO_BASE or IO_LIMIT registers in the config space. This means that
> the code which initializes the bridge resources ends up setting the
> IO resources erroneously.
>
> This change sets RC of mpc8641 to be a transparent bridge
> for legacy I/O access and initializes the RC bridge resources
> from the device tree.
>
> Signed-off-by: Zhang Wei <wei.zhang@freescale.com>
> Signed-off-by: Andy Fleming <afleming@freescale.com>
> Signed-off-by: Jon Loeliger <jdl@freescale.com>
> ---
>
> Incorporates review suggestions from Milton.
>
> arch/powerpc/platforms/86xx/mpc86xx_hpcn.c | 76 +++++++++++++++++
> +++++++++++
> 1 files changed, 76 insertions(+), 0 deletions(-)
>
> diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/
> powerpc/platforms/86xx/mpc86xx_hpcn.c
> index a82da4b..83a2c28 100644
> --- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
> +++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
> @@ -318,6 +318,7 @@ static void __devinit quirk_uli5288(struct
> pci_dev *dev)
> static void __devinit quirk_uli5229(struct pci_dev *dev)
> {
> unsigned short temp;
> +
> pci_write_config_word(dev, 0x04, 0x0405);
> dev->class &= ~0x5;
> pci_read_config_word(dev, 0x4a, &temp);
> @@ -325,6 +326,75 @@ static void __devinit quirk_uli5229(struct
> pci_dev *dev)
> pci_write_config_word(dev, 0x4a, temp);
> }
>
> +static void __devinit quirk_mpc8641_transparent(struct pci_dev *dev)
> +{
Shouldn't we put this in fsl_pcie.c since it will be need by everyone
using an 85xx/86xx pci-e controller?
[snip]
> +}
- k
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2 9/9] Created quirk_mpc8641_transparent() to initialize bridge resources.
2007-06-22 13:50 ` Kumar Gala
@ 2007-06-22 16:20 ` Jon Loeliger
2007-06-22 16:35 ` Kumar Gala
0 siblings, 1 reply; 4+ messages in thread
From: Jon Loeliger @ 2007-06-22 16:20 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev@ozlabs.org list, Wei Zhang
On Fri, 2007-06-22 at 08:50, Kumar Gala wrote:
> Shouldn't we put this in fsl_pcie.c since it will be need by everyone
> using an 85xx/86xx pci-e controller?
> - k
IIRC, Ww are trying to eliminate the need for fsl_pcie.c
and converge on the more generic code instead.
If we can ever get the PCI-E patches accepted, the
8641 boards won't use the fsl_pcie.c file at all. :-)
jdl
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2 9/9] Created quirk_mpc8641_transparent() to initialize bridge resources.
2007-06-22 16:20 ` Jon Loeliger
@ 2007-06-22 16:35 ` Kumar Gala
0 siblings, 0 replies; 4+ messages in thread
From: Kumar Gala @ 2007-06-22 16:35 UTC (permalink / raw)
To: Jon Loeliger; +Cc: linuxppc-dev@ozlabs.org list, Wei Zhang
On Jun 22, 2007, at 11:20 AM, Jon Loeliger wrote:
> On Fri, 2007-06-22 at 08:50, Kumar Gala wrote:
>
>> Shouldn't we put this in fsl_pcie.c since it will be need by everyone
>> using an 85xx/86xx pci-e controller?
>
>> - k
>
> IIRC, Ww are trying to eliminate the need for fsl_pcie.c
> and converge on the more generic code instead.
> If we can ever get the PCI-E patches accepted, the
> 8641 boards won't use the fsl_pcie.c file at all. :-)
Where do we plan on putting the freescale generic pci code?
- k
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-06-22 16:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-04 22:30 [PATCH v2 9/9] Created quirk_mpc8641_transparent() to initialize bridge resources Jon Loeliger
2007-06-22 13:50 ` Kumar Gala
2007-06-22 16:20 ` Jon Loeliger
2007-06-22 16:35 ` Kumar Gala
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).