Skip to contentSkip to conversation

74xx_7xx: CPCI750: Enable access to PCI function > 0

PATCH New Stefan Roese 2 participants 2 messages Jun 5, 2009 – Jun 12, 2009

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 74xx_7xx: CPCI750: Enable access to PCI function > 0

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

---
v2:
- Long lines splitted

 board/esd/cpci750/cpci750.c |   16 +++++++++++++---
 board/esd/cpci750/pci.c     |   14 +++++++++-----
 2 files changed, 22 insertions(+), 8 deletions(-)
board/esd/cpci750/cpci750.c +13 -3
index 69ae517..1b9d07e 100644
@@ -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,15 @@ static void gt_pci_config (void)
 
 /*ronen update the pci internal registers base address.*/
 #ifdef MAP_PCI
-	for (stat = 0; stat <= PCI_HOST1; stat++)
+	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, CONFIG_SYS_GT_REGS);
+				   SELF, data);
+	}
 #endif
 
 }
@@ -451,9 +457,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 */
board/esd/cpci750/pci.c +9 -5
index bfc7e55..3b59b16 100644
@@ -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;
 }
 
Signature · 1 line
1.6.3.2
#1 lore raw

PATCH v2 1/1 74xx_7xx: CPCI750: Enable access to PCI function > 0

Dear Stefan Roese,

Quoted 5 lines · In message <[email protected]> you wrote:

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

Quoted 7 lines

---
v2:
- Long lines splitted

 board/esd/cpci750/cpci750.c |   16 +++++++++++++---
 board/esd/cpci750/pci.c     |   14 +++++++++-----
 2 files changed, 22 insertions(+), 8 deletions(-)

Applied to next, thanks.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
If it happens once, it's a bug.
If it happens twice, it's a feature.
If it happens more than twice, it's a design philosophy.