public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 4/5] 74xx_7xx: CPCI750: Enable access to PCI function > 0
Date: Thu,  4 Jun 2009 13:35:38 +0200	[thread overview]
Message-ID: <1244115339-19862-4-git-send-email-sr@denx.de> (raw)
In-Reply-To: <1244115339-19862-1-git-send-email-sr@denx.de>

The Marvell bridge 64360 supports serveral PCI functions, not only 0. This
patch enables access to those functions.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Reinhard Arlt <reinhard.arlt@esd-electronics.com>
---
 board/esd/cpci750/cpci750.c |   16 +++++++++++-----
 board/esd/cpci750/pci.c     |   14 +++++++++-----
 2 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/board/esd/cpci750/cpci750.c b/board/esd/cpci750/cpci750.c
index 69ae517..18944ef 100644
--- a/board/esd/cpci750/cpci750.c
+++ b/board/esd/cpci750/cpci750.c
@@ -187,6 +187,7 @@ original ppcboot 1.1.6 source end */
 static void gt_pci_config (void)
 {
 	unsigned int stat;
+	unsigned int data;
 	unsigned int val = 0x00fff864;	/* DINK32: BusNum 23:16,  DevNum 15:11, FuncNum 10:8, RegNum 7:2 */
 
 	/* In PCIX mode devices provide their own bus and device numbers. We query the Discovery II's
@@ -254,10 +255,11 @@ static void gt_pci_config (void)
 
 /*ronen update the pci internal registers base address.*/
 #ifdef MAP_PCI
-	for (stat = 0; stat <= PCI_HOST1; stat++)
-		pciWriteConfigReg (stat,
-				   PCI_INTERNAL_REGISTERS_MEMORY_MAPPED_BASE_ADDRESS,
-				   SELF, CONFIG_SYS_GT_REGS);
+	for (stat = 0; stat <= PCI_HOST1; stat++) {
+		data = pciReadConfigReg(stat, PCI_INTERNAL_REGISTERS_MEMORY_MAPPED_BASE_ADDRESS, SELF);
+		data = (data & 0x0f) | CONFIG_SYS_GT_REGS;
+		pciWriteConfigReg (stat, PCI_INTERNAL_REGISTERS_MEMORY_MAPPED_BASE_ADDRESS, SELF, data);
+	}
 #endif
 
 }
@@ -451,9 +453,13 @@ int misc_init_r ()
 
 void after_reloc (ulong dest_addr, gd_t * gd)
 {
-	memoryMapDeviceSpace (BOOT_DEVICE, CONFIG_SYS_BOOT_SPACE, CONFIG_SYS_BOOT_SIZE);
+	memoryMapDeviceSpace (BOOT_DEVICE, CONFIG_SYS_BOOT_SPACE,
+			      CONFIG_SYS_BOOT_SIZE);
 
 	display_mem_map ();
+	GT_REG_WRITE (PCI_0BASE_ADDRESS_REGISTERS_ENABLE, 0xfffffdfe);
+	GT_REG_WRITE (PCI_1BASE_ADDRESS_REGISTERS_ENABLE, 0xfffffdfe);
+
 	/* now, jump to the main ppcboot board init code */
 	board_init_r (gd, dest_addr);
 	/* NOTREACHED */
diff --git a/board/esd/cpci750/pci.c b/board/esd/cpci750/pci.c
index bfc7e55..3b59b16 100644
--- a/board/esd/cpci750/pci.c
+++ b/board/esd/cpci750/pci.c
@@ -768,11 +768,12 @@ static int gt_read_config_dword (struct pci_controller *hose,
 	int bus = PCI_BUS (dev);
 
 	if ((bus == local_buses[0]) || (bus == local_buses[1])) {
-		*value = pciReadConfigReg ((PCI_HOST) hose->cfg_addr, offset,
+	        *value = pciReadConfigReg ((PCI_HOST) hose->cfg_addr,
+					   offset | (PCI_FUNC(dev) << 8),
 					   PCI_DEV (dev));
 	} else {
-		*value = pciOverBridgeReadConfigReg ((PCI_HOST) hose->
-						     cfg_addr, offset,
+		*value = pciOverBridgeReadConfigReg ((PCI_HOST) hose->cfg_addr,
+						     offset | (PCI_FUNC(dev) << 8),
 						     PCI_DEV (dev), bus);
 	}
 
@@ -785,13 +786,16 @@ static int gt_write_config_dword (struct pci_controller *hose,
 	int bus = PCI_BUS (dev);
 
 	if ((bus == local_buses[0]) || (bus == local_buses[1])) {
-		pciWriteConfigReg ((PCI_HOST) hose->cfg_addr, offset,
+		pciWriteConfigReg ((PCI_HOST) hose->cfg_addr,
+				   offset | (PCI_FUNC(dev) << 8),
 				   PCI_DEV (dev), value);
 	} else {
 		pciOverBridgeWriteConfigReg ((PCI_HOST) hose->cfg_addr,
-					     offset, PCI_DEV (dev), bus,
+					     offset | (PCI_FUNC(dev) << 8),
+					     PCI_DEV (dev), bus,
 					     value);
 	}
+
 	return 0;
 }
 
-- 
1.6.2.5

  parent reply	other threads:[~2009-06-04 11:35 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-04 11:35 [U-Boot] [PATCH 1/5] 74xx_7xx: CPCI750: Add commandline editing/history Stefan Roese
2009-06-04 11:35 ` [U-Boot] [PATCH 2/5] 74xx_7xx: CPCI750: Add loadpci command Stefan Roese
2009-06-04 17:40   ` Matthias Fuchs
2009-06-05  3:39     ` Stefan Roese
2009-06-05 10:54       ` Matthias Fuchs
2009-06-12 12:53   ` Wolfgang Denk
2009-06-04 11:35 ` [U-Boot] [PATCH 3/5] 74xx_7xx: CPCI750: Minor coding style cleanup of cpci750.c Stefan Roese
2009-06-12 12:54   ` Wolfgang Denk
2009-06-04 11:35 ` Stefan Roese [this message]
2009-06-04 17:43   ` [U-Boot] [PATCH 4/5] 74xx_7xx: CPCI750: Enable access to PCI function > 0 Matthias Fuchs
2009-06-04 11:35 ` [U-Boot] [PATCH 5/5] 74xx_7xx: CPCI750: Add CPCI adapter/target support Stefan Roese
2009-06-12 12:56   ` Wolfgang Denk
2009-06-12 12:52 ` [U-Boot] [PATCH 1/5] 74xx_7xx: CPCI750: Add commandline editing/history Wolfgang Denk

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=1244115339-19862-4-git-send-email-sr@denx.de \
    --to=sr@denx.de \
    --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