public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Kumar Gala <galak@kernel.crashing.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 06/10] pci/fsl_pci_init: Enable larger address and setting inbound windows properly
Date: Thu, 23 Oct 2008 01:26:44 -0500	[thread overview]
Message-ID: <1224743208-11160-7-git-send-email-galak@kernel.crashing.org> (raw)
In-Reply-To: <1224743208-11160-6-git-send-email-galak@kernel.crashing.org>

* PCI Inbound window was setup incorrectly.  The PCI address and system
  address were swapped.  The PCI address should be setting piwar/piwbear
  and the system address should be setting pitar.

* Removed masking of addresses to allow for system address to support
  system address & PCI address >32-bits

* Set PIWBEAR & POTEAR to allow for full 64-bit PCI addresses

* Respect the PCI_REGION_PREFETCH for inbound windows

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
 drivers/pci/fsl_pci_init.c |   38 ++++++++++++++++++++++++--------------
 1 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/drivers/pci/fsl_pci_init.c b/drivers/pci/fsl_pci_init.c
index 38a16e5..f41c8aa 100644
--- a/drivers/pci/fsl_pci_init.c
+++ b/drivers/pci/fsl_pci_init.c
@@ -39,10 +39,9 @@ void pciauto_prescan_setup_bridge(struct pci_controller *hose,
 				pci_dev_t dev, int sub_bus);
 void pciauto_postscan_setup_bridge(struct pci_controller *hose,
 				pci_dev_t dev, int sub_bus);
-
 void pciauto_config_init(struct pci_controller *hose);
-void
-fsl_pci_init(struct pci_controller *hose)
+
+void fsl_pci_init(struct pci_controller *hose)
 {
 	u16 temp16;
 	u32 temp32;
@@ -65,25 +64,36 @@ fsl_pci_init(struct pci_controller *hose)
 #endif
 
 	for (r=0; r<hose->region_count; r++) {
+		u32 sz = (__ilog2_u64((u64)hose->regions[r].size) - 1);
 		if (hose->regions[r].flags & PCI_REGION_MEMORY) { /* inbound */
-			pi->pitar = (hose->regions[r].bus_start >> 12) & 0x000fffff;
-			pi->piwbar = (hose->regions[r].phys_start >> 12) & 0x000fffff;
+			u32 flag = PIWAR_EN | PIWAR_LOCAL | \
+					PIWAR_READ_SNOOP | PIWAR_WRITE_SNOOP;
+			pi->pitar = (hose->regions[r].phys_start >> 12);
+			pi->piwbar = (hose->regions[r].bus_start >> 12);
+#ifdef CONFIG_SYS_PCI_64BIT
+			pi->piwbear = (hose->regions[r].bus_start >> 44);
+#else
 			pi->piwbear = 0;
-			pi->piwar = PIWAR_EN | PIWAR_PF | PIWAR_LOCAL |
-				PIWAR_READ_SNOOP | PIWAR_WRITE_SNOOP |
-				(__ilog2(hose->regions[r].size) - 1);
+#endif
+			if (hose->regions[r].flags & PCI_REGION_PREFETCH)
+				flag |= PIWAR_PF;
+			pi->piwar = flag | sz;
 			pi++;
 			inbound = hose->regions[r].size > 0;
 		} else { /* Outbound */
-			po->powbar = (hose->regions[r].phys_start >> 12) & 0x000fffff;
-			po->potar = (hose->regions[r].bus_start >> 12) & 0x000fffff;
+			po->powbar = (hose->regions[r].phys_start >> 12);
+			po->potar = (hose->regions[r].bus_start >> 12);
+#ifdef CONFIG_SYS_PCI_64BIT
+			po->potear = (hose->regions[r].bus_start >> 44);
+#else
 			po->potear = 0;
+#endif
 			if (hose->regions[r].flags & PCI_REGION_IO)
-				po->powar = POWAR_EN | POWAR_IO_READ | POWAR_IO_WRITE |
-					(__ilog2(hose->regions[r].size) - 1);
+				po->powar = POWAR_EN | sz | \
+					POWAR_IO_READ | POWAR_IO_WRITE;
 			else
-				po->powar = POWAR_EN | POWAR_MEM_READ | POWAR_MEM_WRITE |
-					(__ilog2(hose->regions[r].size) - 1);
+				po->powar = POWAR_EN | sz | \
+					POWAR_MEM_READ | POWAR_MEM_WRITE;
 			po++;
 		}
 	}
-- 
1.5.5.1

  reply	other threads:[~2008-10-23  6:26 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-23  6:26 [U-Boot] [PATCH 00/10] 85xx/85xx pci cleanup Kumar Gala
2008-10-23  6:26 ` [U-Boot] [PATCH 01/10] pci: Allow for PCI addresses to be 64-bit Kumar Gala
2008-10-23  6:26   ` [U-Boot] [PATCH 02/10] 85xx: Enable 64-bit PCI resources on all Freescale boards Kumar Gala
2008-10-23  6:26     ` [U-Boot] [PATCH 03/10] 86xx: " Kumar Gala
2008-10-23  6:26       ` [U-Boot] [PATCH 04/10] fdt: Add fdt_sizecell & fdt_addrcell helpers Kumar Gala
2008-10-23  6:26         ` [U-Boot] [PATCH 05/10] fdt: Added helper to set PCI dma-ranges property Kumar Gala
2008-10-23  6:26           ` Kumar Gala [this message]
2008-10-23  6:26             ` [U-Boot] [PATCH 07/10] pci/fsl_pci_init: Add a common PCI inbound setup function Kumar Gala
2008-10-23  6:26               ` [U-Boot] [PATCH 08/10] pci/fsl_pci_init: Added fdt helper for setting up bus-ranges & dma-ranges Kumar Gala
2008-10-23  6:26                 ` [U-Boot] [PATCH 09/10] 85xx: Convert all fsl_pci_init users to new APIs Kumar Gala
2008-10-23  6:26                   ` [U-Boot] [PATCH 10/10] 86xx: " Kumar Gala
2008-10-24  0:41                     ` Jon Loeliger
2008-10-23 11:55         ` [U-Boot] [PATCH 04/10] fdt: Add fdt_sizecell & fdt_addrcell helpers Jerry Van Baren
2008-10-23 12:04           ` Kumar Gala
2008-10-23 12:26             ` Jerry Van Baren
2008-10-23 12:59               ` Kumar Gala
2008-10-24 13:12   ` [U-Boot] [PATCH 01/10] pci: Allow for PCI addresses to be 64-bit Wolfgang Denk
2008-10-23  8:35 ` [U-Boot] [PATCH 00/10] 85xx/85xx pci cleanup Wolfgang Denk
2008-10-23 11:58   ` Kumar Gala
2008-10-24 22:48     ` Andy Fleming

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=1224743208-11160-7-git-send-email-galak@kernel.crashing.org \
    --to=galak@kernel.crashing.org \
    --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