Skip to contentSkip to conversation

pci/fsl_pci_init: Fold pci_setup_indirect into fsl_pci_init

PATCH New Kumar Gala 2 participants 6 messages Aug 4, 2009 PCI

lore
Share & tools
lore

Kumar Gala

author
#0 lore raw

PATCH 1/1 pci/fsl_pci_init: Fold pci_setup_indirect into fsl_pci_init

Every platform that calls fsl_pci_init calls pci_setup_indirect before it calls fsl_pci_init. There isn't any reason to just call it from fsl_pci_init and simplify things a bit.

---
 board/atum8548/atum8548.c                 |   10 +++-------
 board/freescale/mpc8536ds/mpc8536ds.c     |   13 ++++---------
 board/freescale/mpc8544ds/mpc8544ds.c     |   13 ++++---------
 board/freescale/mpc8548cds/mpc8548cds.c   |    6 ++----
 board/freescale/mpc8568mds/mpc8568mds.c   |    6 ++----
 board/freescale/mpc8569mds/mpc8569mds.c   |    4 +---
 board/freescale/mpc8572ds/mpc8572ds.c     |   10 +++-------
 board/freescale/mpc8610hpcd/mpc8610hpcd.c |   12 +++---------
 board/freescale/mpc8641hpcn/mpc8641hpcn.c |    6 ++----
 board/freescale/p2020ds/p2020ds.c         |   13 +++----------
 board/sbc8548/sbc8548.c                   |    6 ++----
 board/sbc8641d/sbc8641d.c                 |    6 ++----
 board/tqc/tqm85xx/tqm85xx.c               |    8 ++------
 board/xes/common/fsl_8xxx_pci.c           |   16 ++++------------
 drivers/pci/fsl_pci_init.c                |    6 ++++--
 include/asm-ppc/fsl_pci.h                 |    2 +-
 16 files changed, 42 insertions(+), 95 deletions(-)
board/atum8548/atum8548.c +3 -7
index c8085c7..7a02cdc 100644
@@ -244,9 +244,7 @@ pci_init_board(void)
 		hose->region_count = r - hose->regions;
 		hose->first_busno=first_free_busno;
 
-		pci_setup_indirect(hose, (int) &pci->cfg_addr, (int) &pci->cfg_data);
-
-		fsl_pci_init(hose);
+		fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 
 		first_free_busno=hose->last_busno+1;
 		printf("    PCIE1 on bus %02x - %02x\n",
@@ -302,9 +300,8 @@ pci_init_board(void)
 			       PCI_REGION_IO);
 		hose->region_count = r - hose->regions;
 		hose->first_busno=first_free_busno;
-		pci_setup_indirect(hose, (int) &pci->cfg_addr, (int) &pci->cfg_data);
 
-		fsl_pci_init(hose);
+		fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 		first_free_busno=hose->last_busno+1;
 		printf ("PCI1 on bus %02x - %02x\n",
 			hose->first_busno,hose->last_busno);
@@ -338,9 +335,8 @@ pci_init_board(void)
 			       PCI_REGION_IO);
 		hose->region_count = r - hose->regions;
 		hose->first_busno=first_free_busno;
-		pci_setup_indirect(hose, (int) &pci->cfg_addr, (int) &pci->cfg_data);
 
-		fsl_pci_init(hose);
+		fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 		first_free_busno=hose->last_busno+1;
 		printf ("PCI2 on bus %02x - %02x\n",
 			hose->first_busno,hose->last_busno);
board/freescale/mpc8536ds/mpc8536ds.c +4 -9
index 8c5984b..9d2753e 100644
@@ -250,9 +250,8 @@ pci_init_board(void)
 		hose->region_count = r - hose->regions;
 
 		hose->first_busno=first_free_busno;
-		pci_setup_indirect(hose, (int) &pci->cfg_addr, (int) &pci->cfg_data);
 
-		fsl_pci_init(hose);
+		fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 
 		first_free_busno=hose->last_busno+1;
 		printf ("    PCIE3 on bus %02x - %02x\n",
@@ -313,9 +312,7 @@ pci_init_board(void)
 		hose->region_count = r - hose->regions;
 		hose->first_busno=first_free_busno;
 
-		pci_setup_indirect(hose, (int) &pci->cfg_addr, (int) &pci->cfg_data);
-
-		fsl_pci_init(hose);
+		fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 
 		first_free_busno=hose->last_busno+1;
 		printf("    PCIE1 on bus %02x - %02x\n",
@@ -375,9 +372,8 @@ pci_init_board(void)
 #endif
 		hose->region_count = r - hose->regions;
 		hose->first_busno=first_free_busno;
-		pci_setup_indirect(hose, (int) &pci->cfg_addr, (int) &pci->cfg_data);
 
-		fsl_pci_init(hose);
+		fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 		first_free_busno=hose->last_busno+1;
 		printf ("    PCIE2 on bus %02x - %02x\n",
 			hose->first_busno,hose->last_busno);
@@ -443,9 +439,8 @@ pci_init_board(void)
 #endif
 		hose->region_count = r - hose->regions;
 		hose->first_busno=first_free_busno;
-		pci_setup_indirect(hose, (int) &pci->cfg_addr, (int) &pci->cfg_data);
 
-		fsl_pci_init(hose);
+		fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 		first_free_busno=hose->last_busno+1;
 		printf ("PCI on bus %02x - %02x\n",
 			hose->first_busno,hose->last_busno);
board/freescale/mpc8544ds/mpc8544ds.c +4 -9
index fd59839..60bde68 100644
@@ -166,9 +166,8 @@ pci_init_board(void)
 #endif
 		hose->region_count = r - hose->regions;
 		hose->first_busno=first_free_busno;
-		pci_setup_indirect(hose, (int) &pci->cfg_addr, (int) &pci->cfg_data);
 
-		fsl_pci_init(hose);
+		fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 
 		first_free_busno=hose->last_busno+1;
 		printf ("    PCIE3 on bus %02x - %02x\n",
@@ -234,9 +233,7 @@ pci_init_board(void)
 		hose->region_count = r - hose->regions;
 		hose->first_busno=first_free_busno;
 
-		pci_setup_indirect(hose, (int) &pci->cfg_addr, (int) &pci->cfg_data);
-
-		fsl_pci_init(hose);
+		fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 
 		first_free_busno=hose->last_busno+1;
 		printf("    PCIE1 on bus %02x - %02x\n",
@@ -296,9 +293,8 @@ pci_init_board(void)
 #endif
 		hose->region_count = r - hose->regions;
 		hose->first_busno=first_free_busno;
-		pci_setup_indirect(hose, (int) &pci->cfg_addr, (int) &pci->cfg_data);
 
-		fsl_pci_init(hose);
+		fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 		first_free_busno=hose->last_busno+1;
 		printf ("    PCIE2 on bus %02x - %02x\n",
 			hose->first_busno,hose->last_busno);
@@ -364,9 +360,8 @@ pci_init_board(void)
 #endif
 		hose->region_count = r - hose->regions;
 		hose->first_busno=first_free_busno;
-		pci_setup_indirect(hose, (int) &pci->cfg_addr, (int) &pci->cfg_data);
 
-		fsl_pci_init(hose);
+		fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 		first_free_busno=hose->last_busno+1;
 		printf ("PCI on bus %02x - %02x\n",
 			hose->first_busno,hose->last_busno);
board/freescale/mpc8548cds/mpc8548cds.c +2 -4
index ac1c9b4..d0856c4 100644
@@ -323,9 +323,8 @@ pci_init_board(void)
 			table->config_device += gd->reloc_off;
 
 		hose->first_busno=first_free_busno;
-		pci_setup_indirect(hose, (int) &pci->cfg_addr, (int) &pci->cfg_data);
 
-		fsl_pci_init(hose);
+		fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 		first_free_busno=hose->last_busno+1;
 		printf ("PCI on bus %02x - %02x\n",hose->first_busno,hose->last_busno);
 #ifdef CONFIG_PCIX_CHECK
@@ -402,9 +401,8 @@ pci_init_board(void)
 		hose->region_count = r - hose->regions;
 
 		hose->first_busno=first_free_busno;
-		pci_setup_indirect(hose, (int) &pci->cfg_addr, (int) &pci->cfg_data);
 
-		fsl_pci_init(hose);
+		fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 		printf ("PCIE on bus %d - %d\n",hose->first_busno,hose->last_busno);
 
 		first_free_busno=hose->last_busno+1;
board/freescale/mpc8568mds/mpc8568mds.c +2 -4
index 8f991e5..811bf5e 100644
@@ -409,9 +409,8 @@ pci_init_board(void)
 		hose->region_count = r - hose->regions;
 
 		hose->first_busno = first_free_busno;
-		pci_setup_indirect(hose, (int) &pci->cfg_addr, (int) &pci->cfg_data);
 
-		fsl_pci_init(hose);
+		fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 		first_free_busno = hose->last_busno+1;
 		printf ("PCI on bus %02x - %02x\n",hose->first_busno,hose->last_busno);
 	} else {
@@ -462,9 +461,8 @@ pci_init_board(void)
 		hose->region_count = r - hose->regions;
 
 		hose->first_busno=first_free_busno;
-		pci_setup_indirect(hose, (int) &pci->cfg_addr, (int) &pci->cfg_data);
 
-		fsl_pci_init(hose);
+		fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 		printf ("PCIE on bus %02x - %02x\n",hose->first_busno,hose->last_busno);
 
 		first_free_busno=hose->last_busno+1;
board/freescale/mpc8569mds/mpc8569mds.c +1 -3
index 1e7526a..45c518a 100644
@@ -367,10 +367,8 @@ pci_init_board(void)
 		hose->region_count = r - hose->regions;
 
 		hose->first_busno=first_free_busno;
-		pci_setup_indirect(hose, (int) &pci->cfg_addr,
-					(int) &pci->cfg_data);
 
-		fsl_pci_init(hose);
+		fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 		printf ("PCIE on bus %02x - %02x\n",
 				hose->first_busno,hose->last_busno);
 
board/freescale/mpc8572ds/mpc8572ds.c +3 -7
index 7c86134..9d5cfd7 100644
@@ -220,9 +220,8 @@ void pci_init_board(void)
 
 			hose->region_count = r - hose->regions;
 			hose->first_busno=first_free_busno;
-			pci_setup_indirect(hose, (int) &pci->cfg_addr, (int) &pci->cfg_data);
 
-			fsl_pci_init(hose);
+			fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 
 			first_free_busno=hose->last_busno+1;
 			printf ("    PCIE3 on bus %02x - %02x\n",
@@ -289,9 +288,8 @@ void pci_init_board(void)
 
 			hose->region_count = r - hose->regions;
 			hose->first_busno=first_free_busno;
-			pci_setup_indirect(hose, (int) &pci->cfg_addr, (int) &pci->cfg_data);
 
-			fsl_pci_init(hose);
+			fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 			first_free_busno=hose->last_busno+1;
 			printf ("    PCIE2 on bus %02x - %02x\n",
 					hose->first_busno,hose->last_busno);
@@ -345,9 +343,7 @@ void pci_init_board(void)
 			hose->region_count = r - hose->regions;
 			hose->first_busno=first_free_busno;
 
-			pci_setup_indirect(hose, (int) &pci->cfg_addr, (int) &pci->cfg_data);
-
-			fsl_pci_init(hose);
+			fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 
 			first_free_busno=hose->last_busno+1;
 			printf("    PCIE1 on bus %02x - %02x\n",
board/freescale/mpc8610hpcd/mpc8610hpcd.c +3 -9
index 2ac169b..98896d1 100644
@@ -280,10 +280,8 @@ void pci_init_board(void)
 		hose->region_count = r - hose->regions;
 
 		hose->first_busno = first_free_busno;
-		pci_setup_indirect(hose, (int)&pci->cfg_addr,
-				 (int)&pci->cfg_data);
 
-		fsl_pci_init(hose);
+		fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 
 		first_free_busno = hose->last_busno + 1;
 		printf(" PCI-Express 1 on bus %02x - %02x\n",
@@ -335,10 +333,8 @@ void pci_init_board(void)
 		hose->region_count = r - hose->regions;
 
 		hose->first_busno = first_free_busno;
-		pci_setup_indirect(hose, (int)&pci->cfg_addr,
-				 (int)&pci->cfg_data);
 
-		fsl_pci_init(hose);
+		fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 
 		first_free_busno = hose->last_busno + 1;
 		printf(" PCI-Express 2 on bus %02x - %02x\n",
@@ -384,10 +380,8 @@ void pci_init_board(void)
 		hose->region_count = r - hose->regions;
 
 		hose->first_busno = first_free_busno;
-		pci_setup_indirect(hose, (int) &pci->cfg_addr,
-				 (int) &pci->cfg_data);
 
-		fsl_pci_init(hose);
+		fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 
 		first_free_busno = hose->last_busno + 1;
 		printf(" PCI on bus %02x - %02x\n",
board/freescale/mpc8641hpcn/mpc8641hpcn.c +2 -4
index a8b2112..de899e8 100644
@@ -193,9 +193,8 @@ void pci_init_board(void)
 		hose->region_count = r - hose->regions;
 
 		hose->first_busno=first_free_busno;
-		pci_setup_indirect(hose, (int) &pci->cfg_addr, (int) &pci->cfg_data);
 
-		fsl_pci_init(hose);
+		fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 
 		first_free_busno=hose->last_busno+1;
 		printf ("    PCI-EXPRESS 1 on bus %02x - %02x\n",
@@ -242,9 +241,8 @@ void pci_init_board(void)
 	hose->region_count = r - hose->regions;
 
 	hose->first_busno=first_free_busno;
-	pci_setup_indirect(hose, (int) &pci->cfg_addr, (int) &pci->cfg_data);
 
-	fsl_pci_init(hose);
+	fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 
 	first_free_busno=hose->last_busno+1;
 	printf ("    PCI-EXPRESS 2 on bus %02x - %02x\n",
board/freescale/p2020ds/p2020ds.c +3 -10
index 14de7e7..e2cd39c 100644
@@ -254,10 +254,8 @@ void pci_init_board(void)
 
 		hose->region_count = r - hose->regions;
 		hose->first_busno = first_free_busno;
-		pci_setup_indirect(hose, (int)&pci->cfg_addr,
-				  (int)&pci->cfg_data);
 
-		fsl_pci_init(hose);
+		fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 		first_free_busno = hose->last_busno+1;
 		printf("    PCIE2 on bus %02x - %02x\n",
 			hose->first_busno, hose->last_busno);
@@ -327,10 +325,8 @@ void pci_init_board(void)
 
 		hose->region_count = r - hose->regions;
 		hose->first_busno = first_free_busno;
-		pci_setup_indirect(hose, (int)&pci->cfg_addr,
-				  (int)&pci->cfg_data);
 
-		fsl_pci_init(hose);
+		fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 
 		first_free_busno = hose->last_busno+1;
 		printf("    PCIE3 on bus %02x - %02x\n",
@@ -381,10 +377,7 @@ void pci_init_board(void)
 		hose->region_count = r - hose->regions;
 		hose->first_busno = first_free_busno;
 
-		pci_setup_indirect(hose, (int)&pci->cfg_addr,
-				  (int)&pci->cfg_data);
-
-		fsl_pci_init(hose);
+		fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 
 		first_free_busno = hose->last_busno+1;
 		printf("    PCIE1 on bus %02x - %02x\n",
board/sbc8548/sbc8548.c +2 -4
index 9c05c2f..978d91b 100644
@@ -403,9 +403,8 @@ pci_init_board(void)
 			table->config_device += gd->reloc_off;
 
 		hose->first_busno=first_free_busno;
-		pci_setup_indirect(hose, (int) &pci->cfg_addr, (int) &pci->cfg_data);
 
-		fsl_pci_init(hose);
+		fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 		first_free_busno=hose->last_busno+1;
 		printf ("PCI on bus %02x - %02x\n",hose->first_busno,hose->last_busno);
 #ifdef CONFIG_PCIX_CHECK
@@ -486,9 +485,8 @@ pci_init_board(void)
 		hose->region_count = r - hose->regions;
 
 		hose->first_busno=first_free_busno;
-		pci_setup_indirect(hose, (int) &pci->cfg_addr, (int) &pci->cfg_data);
 
-		fsl_pci_init(hose);
+		fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 		printf ("PCIE on bus %d - %d\n",hose->first_busno,hose->last_busno);
 
 		first_free_busno=hose->last_busno+1;
board/sbc8641d/sbc8641d.c +2 -4
index f118a6e..6d68c8e 100644
@@ -259,9 +259,8 @@ void pci_init_board(void)
 		hose->region_count = r - hose->regions;
 
 		hose->first_busno=first_free_busno;
-		pci_setup_indirect(hose, (int) &pci->cfg_addr, (int) &pci->cfg_data);
 
-		fsl_pci_init(hose);
+		fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 
 		first_free_busno=hose->last_busno+1;
 		printf ("    PCI-EXPRESS 1 on bus %02x - %02x\n",
@@ -302,9 +301,8 @@ void pci_init_board(void)
 	hose->region_count = r - hose->regions;
 
 	hose->first_busno=first_free_busno;
-	pci_setup_indirect(hose, (int) &pci->cfg_addr, (int) &pci->cfg_data);
 
-	fsl_pci_init(hose);
+	fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 
 	first_free_busno=hose->last_busno+1;
 	printf ("    PCI-EXPRESS 2 on bus %02x - %02x\n",
board/tqc/tqm85xx/tqm85xx.c +2 -6
index ab0e0dd..07a6db3 100644
@@ -596,10 +596,8 @@ static inline void init_pci1(void)
 		hose->region_count = r - hose->regions;
 
 		hose->first_busno = first_free_busno;
-		pci_setup_indirect (hose, (int)&pci->cfg_addr,
-				    (int)&pci->cfg_data);
 
-		fsl_pci_init (hose);
+		fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 
 		printf ("       PCI on bus %02x..%02x\n",
 			hose->first_busno, hose->last_busno);
@@ -673,10 +671,8 @@ static inline void init_pcie1(void)
 		hose->region_count = r - hose->regions;
 
 		hose->first_busno = first_free_busno;
-		pci_setup_indirect(hose, (int)&pci->cfg_addr,
-				   (int)&pci->cfg_data);
 
-		fsl_pci_init (hose);
+		fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 		printf ("       PCIe on bus %02x..%02x\n",
 			hose->first_busno, hose->last_busno);
 
board/xes/common/fsl_8xxx_pci.c +4 -12
index 025cc18..3a4e523 100644
@@ -233,10 +233,8 @@ void pci_init_board(void)
 		hose->region_count = r - hose->regions;
 
 		hose->first_busno = first_free_busno;
-		pci_setup_indirect(hose, (int)&pci->cfg_addr,
-				   (int)&pci->cfg_data);
 
-		fsl_pci_init(hose);
+		fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 
 		/* Unlock inbound PCI configuration cycles */
 		if (!host)
@@ -289,10 +287,8 @@ void pci_init_board(void)
 		hose->region_count = r - hose->regions;
 
 		hose->first_busno = first_free_busno;
-		pci_setup_indirect(hose, (int)&pci->cfg_addr,
-					(int) &pci->cfg_data);
 
-		fsl_pci_init(hose);
+		fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 
 		/* Unlock inbound PCI configuration cycles */
 		if (!host)
@@ -343,10 +339,8 @@ void pci_init_board(void)
 		hose->region_count = r - hose->regions;
 
 		hose->first_busno = first_free_busno;
-		pci_setup_indirect(hose, (int)&pci->cfg_addr,
-					(int)&pci->cfg_data);
 
-		fsl_pci_init(hose);
+		fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 
 		/* Unlock inbound PCI configuration cycles */
 		if (!host)
@@ -397,10 +391,8 @@ void pci_init_board(void)
 		hose->region_count = r - hose->regions;
 
 		hose->first_busno = first_free_busno;
-		pci_setup_indirect(hose, (int)&pci->cfg_addr,
-					(int)&pci->cfg_data);
 
-		fsl_pci_init(hose);
+		fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 
 		/* Unlock inbound PCI configuration cycles */
 		if (!host)
drivers/pci/fsl_pci_init.c +4 -2
index 19cf1ce..8858657 100644
@@ -133,7 +133,7 @@ int fsl_pci_setup_inbound_windows(struct pci_region *r)
 	return r - rgn_base;
 }
 
-void fsl_pci_init(struct pci_controller *hose)
+void fsl_pci_init(struct pci_controller *hose, u32 cfg_addr, u32 cfg_data)
 {
 	u16 temp16;
 	u32 temp32;
@@ -144,7 +144,7 @@ void fsl_pci_init(struct pci_controller *hose)
 	int r;
 	int bridge;
 	int inbound = 0;
-	volatile ccsr_fsl_pci_t *pci = (ccsr_fsl_pci_t *) hose->cfg_addr;
+	volatile ccsr_fsl_pci_t *pci = (ccsr_fsl_pci_t *)cfg_addr;
 	pci_dev_t dev = PCI_BDF(busno,0,0);
 
 	/* Initialize ATMU registers based on hose regions and flags */
@@ -155,6 +155,8 @@ void fsl_pci_init(struct pci_controller *hose)
 	int neg_link_w;
 #endif
 
+	pci_setup_indirect(hose, cfg_addr, cfg_data);
+
 	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_SYS_MEMORY) { /* inbound */
include/asm-ppc/fsl_pci.h +1 -1
index 624ca56..0473b72 100644
@@ -21,7 +21,7 @@
 #define __FSL_PCI_H_
 
 int fsl_pci_setup_inbound_windows(struct pci_region *r);
-void fsl_pci_init(struct pci_controller *hose);
+void fsl_pci_init(struct pci_controller *hose, u32 cfg_addr, u32 cfg_data);
 void fsl_pci_config_unlock(struct pci_controller *hose);
 void ft_fsl_pci_setup(void *blob, const char *pci_alias,
 			struct pci_controller *hose);
Signature · 1 line
1.6.0.6
author
#1 lore raw

PATCH 1/1 pci/fsl_pci_init: Fold fsl_pci_setup_inbound_windows into fsl_pci_init

Every platform that calls fsl_pci_init calls fsl_pci_setup_inbound_windows before it calls fsl_pci_init. There isn't any reason to just call it from fsl_pci_init and simplify things a bit.

---
 board/atum8548/atum8548.c                 |    8 --------
 board/freescale/mpc8536ds/mpc8536ds.c     |   12 ------------
 board/freescale/mpc8544ds/mpc8544ds.c     |   12 ------------
 board/freescale/mpc8548cds/mpc8548cds.c   |    7 -------
 board/freescale/mpc8568mds/mpc8568mds.c   |    6 ------
 board/freescale/mpc8569mds/mpc8569mds.c   |    3 ---
 board/freescale/mpc8572ds/mpc8572ds.c     |    9 ---------
 board/freescale/mpc8610hpcd/mpc8610hpcd.c |    9 ---------
 board/freescale/mpc8641hpcn/mpc8641hpcn.c |    6 ------
 board/freescale/p2020ds/p2020ds.c         |    9 ---------
 board/sbc8548/sbc8548.c                   |   11 -----------
 board/sbc8641d/sbc8641d.c                 |    7 -------
 board/tqc/tqm85xx/tqm85xx.c               |    7 -------
 board/xes/common/fsl_8xxx_pci.c           |   12 ------------
 drivers/pci/fsl_pci_init.c                |    8 +++++++-
 include/asm-ppc/fsl_pci.h                 |    1 -
 16 files changed, 7 insertions(+), 120 deletions(-)
board/atum8548/atum8548.c +0 -8
index 7a02cdc..85c0adc 100644
@@ -216,9 +216,6 @@ pci_init_board(void)
 		}
 		printf ("\n");
 
-		/* inbound */
-		r += fsl_pci_setup_inbound_windows(r);
-
 		/* outbound memory */
 		pci_set_region(r++,
 			       CONFIG_SYS_PCIE1_MEM_BASE,
@@ -282,9 +279,6 @@ pci_init_board(void)
 			(uint)pci
 			);
 
-		/* inbound */
-		r += fsl_pci_setup_inbound_windows(r);
-
 		/* outbound memory */
 		pci_set_region(r++,
 			       CONFIG_SYS_PCI1_MEM_BASE,
@@ -320,8 +314,6 @@ pci_init_board(void)
 	struct pci_region *r = hose->regions;
 
 	if (!(devdisr & MPC85xx_DEVDISR_PCI2)) {
-		r += fsl_pci_setup_inbound_windows(r);
-
 		pci_set_region(r++,
 			       CONFIG_SYS_PCI2_MEM_BASE,
 			       CONFIG_SYS_PCI2_MEM_PHYS,
board/freescale/mpc8536ds/mpc8536ds.c +0 -12
index 9d2753e..5bd20ce 100644
@@ -230,9 +230,6 @@ pci_init_board(void)
 		}
 		printf ("\n");
 
-		/* inbound */
-		r += fsl_pci_setup_inbound_windows(r);
-
 		/* outbound memory */
 		pci_set_region(r++,
 			       CONFIG_SYS_PCIE3_MEM_BUS,
@@ -284,9 +281,6 @@ pci_init_board(void)
 		}
 		printf ("\n");
 
-		/* inbound */
-		r += fsl_pci_setup_inbound_windows(r);
-
 		/* outbound memory */
 		pci_set_region(r++,
 			       CONFIG_SYS_PCIE1_MEM_BUS,
@@ -345,9 +339,6 @@ pci_init_board(void)
 		}
 		printf ("\n");
 
-		/* inbound */
-		r += fsl_pci_setup_inbound_windows(r);
-
 		/* outbound memory */
 		pci_set_region(r++,
 			       CONFIG_SYS_PCIE2_MEM_BUS,
@@ -412,9 +403,6 @@ pci_init_board(void)
 			(uint)pci
 			);
 
-		/* inbound */
-		r += fsl_pci_setup_inbound_windows(r);
-
 		/* outbound memory */
 		pci_set_region(r++,
 			       CONFIG_SYS_PCI1_MEM_BUS,
board/freescale/mpc8544ds/mpc8544ds.c +0 -12
index 60bde68..5a47d0a 100644
@@ -139,9 +139,6 @@ pci_init_board(void)
 		}
 		printf ("\n");
 
-		/* inbound */
-		r += fsl_pci_setup_inbound_windows(r);
-
 		/* outbound memory */
 		pci_set_region(r++,
 			       CONFIG_SYS_PCIE3_MEM_BUS,
@@ -205,9 +202,6 @@ pci_init_board(void)
 		}
 		printf ("\n");
 
-		/* inbound */
-		r += fsl_pci_setup_inbound_windows(r);
-
 		/* outbound memory */
 		pci_set_region(r++,
 			       CONFIG_SYS_PCIE1_MEM_BUS,
@@ -266,9 +260,6 @@ pci_init_board(void)
 		}
 		printf ("\n");
 
-		/* inbound */
-		r += fsl_pci_setup_inbound_windows(r);
-
 		/* outbound memory */
 		pci_set_region(r++,
 			       CONFIG_SYS_PCIE2_MEM_BUS,
@@ -333,9 +324,6 @@ pci_init_board(void)
 			(uint)pci
 			);
 
-		/* inbound */
-		r += fsl_pci_setup_inbound_windows(r);
-
 		/* outbound memory */
 		pci_set_region(r++,
 			       CONFIG_SYS_PCI1_MEM_BUS,
board/freescale/mpc8548cds/mpc8548cds.c +0 -7
index d0856c4..9df5f82 100644
@@ -297,10 +297,6 @@ pci_init_board(void)
 			pci_arb ? "arbiter" : "external-arbiter"
 			);
 
-
-		/* inbound */
-		r += fsl_pci_setup_inbound_windows(r);
-
 		/* outbound memory */
 		pci_set_region(r++,
 			       CONFIG_SYS_PCI1_MEM_BUS,
@@ -381,9 +377,6 @@ pci_init_board(void)
 		}
 		printf ("\n");
 
-		/* inbound */
-		r += fsl_pci_setup_inbound_windows(r);
-
 		/* outbound memory */
 		pci_set_region(r++,
 			       CONFIG_SYS_PCIE1_MEM_BUS,
board/freescale/mpc8568mds/mpc8568mds.c +0 -6
index 811bf5e..fe505b0 100644
@@ -389,9 +389,6 @@ pci_init_board(void)
 			pci_arb ? "arbiter" : "external-arbiter"
 			);
 
-		/* inbound */
-		r += fsl_pci_setup_inbound_windows(r);
-
 		/* outbound memory */
 		pci_set_region(r++,
 				CONFIG_SYS_PCI1_MEM_BUS,
@@ -441,9 +438,6 @@ pci_init_board(void)
 		}
 		printf ("\n");
 
-		/* inbound */
-		r += fsl_pci_setup_inbound_windows(r);
-
 		/* outbound memory */
 		pci_set_region(r++,
 				CONFIG_SYS_PCIE1_MEM_BUS,
board/freescale/mpc8569mds/mpc8569mds.c +0 -3
index 45c518a..63c21dd 100644
@@ -347,9 +347,6 @@ pci_init_board(void)
 		}
 		printf ("\n");
 
-		/* inbound */
-		r += fsl_pci_setup_inbound_windows(r);
-
 		/* outbound memory */
 		pci_set_region(r++,
 				CONFIG_SYS_PCIE1_MEM_BUS,
board/freescale/mpc8572ds/mpc8572ds.c +0 -9
index 9d5cfd7..59d7519 100644
@@ -201,9 +201,6 @@ void pci_init_board(void)
 			}
 			printf ("\n");
 
-			/* inbound */
-			r += fsl_pci_setup_inbound_windows(r);
-
 			/* outbound memory */
 			pci_set_region(r++,
 					CONFIG_SYS_PCIE3_MEM_BUS,
@@ -269,9 +266,6 @@ void pci_init_board(void)
 			}
 			printf ("\n");
 
-			/* inbound */
-			r += fsl_pci_setup_inbound_windows(r);
-
 			/* outbound memory */
 			pci_set_region(r++,
 					CONFIG_SYS_PCIE2_MEM_BUS,
@@ -323,9 +317,6 @@ void pci_init_board(void)
 			}
 			printf ("\n");
 
-			/* inbound */
-			r += fsl_pci_setup_inbound_windows(r);
-
 			/* outbound memory */
 			pci_set_region(r++,
 					CONFIG_SYS_PCIE1_MEM_BUS,
board/freescale/mpc8610hpcd/mpc8610hpcd.c +0 -9
index 98896d1..45000d9 100644
@@ -260,9 +260,6 @@ void pci_init_board(void)
 		if (pci->pme_msg_det)
 			pci->pme_msg_det = 0xffffffff;
 
-		/* inbound */
-		r += fsl_pci_setup_inbound_windows(r);
-
 		/* outbound memory */
 		pci_set_region(r++,
 			 CONFIG_SYS_PCIE1_MEM_BUS,
@@ -313,9 +310,6 @@ void pci_init_board(void)
 		if (pci->pme_msg_det)
 			pci->pme_msg_det = 0xffffffff;
 
-		/* inbound */
-		r += fsl_pci_setup_inbound_windows(r);
-
 		/* outbound memory */
 		pci_set_region(r++,
 			 CONFIG_SYS_PCIE2_MEM_BUS,
@@ -360,9 +354,6 @@ void pci_init_board(void)
 			pci_agent ? "Agent" : "Host",
 			(uint)pci);
 
-		/* inbound */
-		r += fsl_pci_setup_inbound_windows(r);
-
 		/* outbound memory */
 		pci_set_region(r++,
 			 CONFIG_SYS_PCI1_MEM_BUS,
board/freescale/mpc8641hpcn/mpc8641hpcn.c +0 -6
index de899e8..fab4fae 100644
@@ -187,9 +187,6 @@ void pci_init_board(void)
 			       CONFIG_SYS_PCI1_IO_SIZE,
 			       PCI_REGION_IO);
 
-		/* inbound */
-		r += fsl_pci_setup_inbound_windows(r);
-
 		hose->region_count = r - hose->regions;
 
 		hose->first_busno=first_free_busno;
@@ -235,9 +232,6 @@ void pci_init_board(void)
 		       CONFIG_SYS_PCI2_IO_SIZE,
 		       PCI_REGION_IO);
 
-	/* inbound */
-	r += fsl_pci_setup_inbound_windows(r);
-
 	hose->region_count = r - hose->regions;
 
 	hose->first_busno=first_free_busno;
board/freescale/p2020ds/p2020ds.c +0 -9
index e2cd39c..3fe72cd 100644
@@ -235,9 +235,6 @@ void pci_init_board(void)
 		}
 		printf("\n");
 
-		/* inbound */
-		r += fsl_pci_setup_inbound_windows(r);
-
 		/* outbound memory */
 		pci_set_region(r++,
 				CONFIG_SYS_PCIE2_MEM_BUS,
@@ -306,9 +303,6 @@ void pci_init_board(void)
 		}
 		printf("\n");
 
-		/* inbound */
-		r += fsl_pci_setup_inbound_windows(r);
-
 		/* outbound memory */
 		pci_set_region(r++,
 				CONFIG_SYS_PCIE3_MEM_BUS,
@@ -357,9 +351,6 @@ void pci_init_board(void)
 		}
 		printf("\n");
 
-		/* inbound */
-		r += fsl_pci_setup_inbound_windows(r);
-
 		/* outbound memory */
 		pci_set_region(r++,
 				CONFIG_SYS_PCIE1_MEM_BUS,
board/sbc8548/sbc8548.c +0 -11
index 978d91b..1ae4cda 100644
@@ -377,10 +377,6 @@ pci_init_board(void)
 			pci_arb ? "arbiter" : "external-arbiter"
 			);
 
-
-		/* inbound */
-		r += fsl_pci_setup_inbound_windows(r);
-
 		/* outbound memory */
 		pci_set_region(r++,
 			       CONFIG_SYS_PCI1_MEM_BASE,
@@ -461,13 +457,6 @@ pci_init_board(void)
 		}
 		printf ("\n");
 
-		/* inbound */
-		pci_set_region(r++,
-			       CONFIG_SYS_PCI_MEMORY_BUS,
-			       CONFIG_SYS_PCI_MEMORY_PHYS,
-			       CONFIG_SYS_PCI_MEMORY_SIZE,
-			       PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
-
 		/* outbound memory */
 		pci_set_region(r++,
 			       CONFIG_SYS_PCIE1_MEM_BASE,
board/sbc8641d/sbc8641d.c +0 -7
index 6d68c8e..aabefa9 100644
@@ -239,9 +239,6 @@ void pci_init_board(void)
 		}
 		debug("\n");
 
-		/* inbound */
-		r += fsl_pci_setup_inbound_windows(r);
-
 		/* outbound memory */
 		pci_set_region(r++,
 			       CONFIG_SYS_PCI1_MEM_BUS,
@@ -280,10 +277,6 @@ void pci_init_board(void)
 	struct pci_controller *hose = &pci2_hose;
 	struct pci_region *r = hose->regions;
 
-
-	/* inbound */
-	r += fsl_pci_setup_inbound_windows(r);
-
 	/* outbound memory */
 	pci_set_region(r++,
 		       CONFIG_SYS_PCI2_MEM_BUS,
board/tqc/tqm85xx/tqm85xx.c +0 -7
index 07a6db3..277edcd 100644
@@ -575,10 +575,6 @@ static inline void init_pci1(void)
 			pci_agent ? "agent" : "host",
 			pci_arb ? "arbiter" : "external-arbiter");
 
-
-		/* inbound */
-		r += fsl_pci_setup_inbound_windows(r);
-
 		/* outbound memory */
 		pci_set_region (r++,
 				CONFIG_SYS_PCI1_MEM_BASE,
@@ -651,9 +647,6 @@ static inline void init_pcie1(void)
 		}
 		puts ("\n");
 
-		/* inbound */
-		r += fsl_pci_setup_inbound_windows(r);
-
 		/* outbound memory */
 		pci_set_region (r++,
 				CONFIG_SYS_PCIE1_MEM_BASE,
board/xes/common/fsl_8xxx_pci.c +0 -12
index 3a4e523..463588f 100644
@@ -213,9 +213,6 @@ void pci_init_board(void)
 			host ? "host" : "agent",
 			pci_arb ? "arbiter" : "external-arbiter");
 
-		/* inbound */
-		r += fsl_pci_setup_inbound_windows(r);
-
 		/* outbound memory */
 		pci_set_region(r++,
 				CONFIG_SYS_PCI1_MEM_BASE,
@@ -267,9 +264,6 @@ void pci_init_board(void)
 		}
 		printf("\n");
 
-		/* inbound */
-		r += fsl_pci_setup_inbound_windows(r);
-
 		/* outbound memory */
 		pci_set_region(r++,
 				CONFIG_SYS_PCIE1_MEM_BASE,
@@ -319,9 +313,6 @@ void pci_init_board(void)
 		}
 		printf("\n");
 
-		/* inbound */
-		r += fsl_pci_setup_inbound_windows(r);
-
 		/* outbound memory */
 		pci_set_region(r++,
 				CONFIG_SYS_PCIE2_MEM_BASE,
@@ -371,9 +362,6 @@ void pci_init_board(void)
 		}
 		printf("\n");
 
-		/* inbound */
-		r += fsl_pci_setup_inbound_windows(r);
-
 		/* outbound memory */
 		pci_set_region(r++,
 				CONFIG_SYS_PCIE3_MEM_BASE,
drivers/pci/fsl_pci_init.c +7 -1
index 8858657..c40ab30 100644
@@ -60,7 +60,7 @@ void pciauto_config_init(struct pci_controller *hose);
 #define CONFIG_SYS_PCI64_MEMORY_BUS (64ull*1024*1024*1024)
 #endif
 
-int fsl_pci_setup_inbound_windows(struct pci_region *r)
+static int fsl_pci_setup_inbound_windows(struct pci_region *r)
 {
 	struct pci_region *rgn_base = r;
 	u64 sz = min((u64)gd->ram_size, (1ull << 32) - 1);
@@ -145,6 +145,7 @@ void fsl_pci_init(struct pci_controller *hose, u32 cfg_addr, u32 cfg_data)
 	int bridge;
 	int inbound = 0;
 	volatile ccsr_fsl_pci_t *pci = (ccsr_fsl_pci_t *)cfg_addr;
+	struct pci_region *reg = hose->regions + hose->region_count;
 	pci_dev_t dev = PCI_BDF(busno,0,0);
 
 	/* Initialize ATMU registers based on hose regions and flags */
@@ -157,6 +158,11 @@ void fsl_pci_init(struct pci_controller *hose, u32 cfg_addr, u32 cfg_data)
 
 	pci_setup_indirect(hose, cfg_addr, cfg_data);
 
+	/* inbound */
+	reg += fsl_pci_setup_inbound_windows(reg);
+
+	hose->region_count = reg - hose->regions;
+
 	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_SYS_MEMORY) { /* inbound */
include/asm-ppc/fsl_pci.h +0 -1
index 0473b72..b2ff0e9 100644
@@ -20,7 +20,6 @@
 #ifndef __FSL_PCI_H_
 #define __FSL_PCI_H_
 
-int fsl_pci_setup_inbound_windows(struct pci_region *r);
 void fsl_pci_init(struct pci_controller *hose, u32 cfg_addr, u32 cfg_data);
 void fsl_pci_config_unlock(struct pci_controller *hose);
 void ft_fsl_pci_setup(void *blob, const char *pci_alias,
Signature · 1 line
1.6.0.6
#2 lore raw

PATCH 1/1 pci/fsl_pci_init: Fold fsl_pci_setup_inbound_windows into fsl_pci_init

Dear Kumar Gala,

Quoted 3 lines · In message <[email protected]> you…

Every platform that calls fsl_pci_init calls fsl_pci_setup_inbound_windows before it calls fsl_pci_init. There isn't any reason to just call it from fsl_pci_init and simplify things a bit.

...

Quoted 5 lines
board/atum8548/atum8548.c +0 -0
index 7a02cdc..85c0adc 100644

board/atum8548/atum8548.c pci_init_board(void) · line 221

Quoted 9 lines
board/atum8548/atum8548.c +0 -3
@@ -216,9 +216,6 @@ pci_init_board(void)
 		}
 		printf ("\n");
 
-		/* inbound */
-		r += fsl_pci_setup_inbound_windows(r);
-
 		/* outbound memory */
 		pci_set_region(r++,
 			       CONFIG_SYS_PCIE1_MEM_BASE,

Now pci_set_region() will see a different value of "r". Is this OK?

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
[Doctors and Bartenders], We both get the same two kinds of customers
-- the living and the dying.
	-- Dr. Boyce, "The Menagerie" ("The Cage"), stardate unknown
author
#3 lore raw

PATCH 1/1 pci/fsl_pci_init: Fold fsl_pci_setup_inbound_windows into fsl_pci_init

Quoted 17 lines · Wolfgang Denk

Dear Kumar Gala,

In message <[email protected]

Quoted 5 lines

you wrote:
Every platform that calls fsl_pci_init calls fsl_pci_setup_inbound_windows
before it calls fsl_pci_init. There isn't any reason to just call it from fsl_pci_init and simplify things a bit.

...

Quoted 8 lines
board/atum8548/atum8548.c +0 -0
index 7a02cdc..85c0adc 100644
@@ -216,9 +216,6 @@ pci_init_board(void)
 		}
 		printf ("\n");
 
Quoted 8 lines

board/atum8548/atum8548.c pci_init_board(void) · line 221

Quoted 6 lines
board/atum8548/atum8548.c +0 -3
-		/* inbound */
-		r += fsl_pci_setup_inbound_windows(r);
-
 		/* outbound memory */
 		pci_set_region(r++,
 			       CONFIG_SYS_PCIE1_MEM_BASE,

Now pci_set_region() will see a different value of "r". Is this OK?

It is, the order of regions is not important.

- k

#4 lore raw

PATCH 1/1 pci/fsl_pci_init: Fold pci_setup_indirect into fsl_pci_init

In reply to Kumar Gala

Dear Kumar Gala,

Quoted 3 lines · In message <[email protected]> you…

Every platform that calls fsl_pci_init calls pci_setup_indirect before it calls fsl_pci_init. There isn't any reason to just call it from fsl_pci_init and simplify things a bit.

...

include/asm-ppc/fsl_pci.h line 24

Quoted 8 lines
include/asm-ppc/fsl_pci.h +1 -1
@@ -21,7 +21,7 @@
 #define __FSL_PCI_H_
 
 int fsl_pci_setup_inbound_windows(struct pci_region *r);
-void fsl_pci_init(struct pci_controller *hose);
+void fsl_pci_init(struct pci_controller *hose, u32 cfg_addr, u32 cfg_data);

There will never be any system where 64 bit addresses may be needed?

Best regards,

Wolfgang Denk

Signature · 4 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
The world is no nursery.                              - Sigmund Freud
author
#5 lore raw

PATCH 1/1 pci/fsl_pci_init: Fold pci_setup_indirect into fsl_pci_init

Quoted 14 lines · Wolfgang Denk

Dear Kumar Gala,

In message <[email protected]

Quoted 5 lines

you wrote:
Every platform that calls fsl_pci_init calls pci_setup_indirect before
it calls fsl_pci_init. There isn't any reason to just call it from fsl_pci_init and simplify things a bit.

...

Quoted 5 lines
include/asm-ppc/fsl_pci.h +0 -0
@@ -21,7 +21,7 @@
 #define __FSL_PCI_H_
 
Quoted 6 lines

include/asm-ppc/fsl_pci.h

Quoted 4 lines
include/asm-ppc/fsl_pci.h +1 -1
 int fsl_pci_setup_inbound_windows(struct pci_region *r);
-void fsl_pci_init(struct pci_controller *hose);
+void fsl_pci_init(struct pci_controller *hose, u32 cfg_addr, u32  
 cfg_data);

There will never be any system where 64 bit addresses may be needed?

I thought about this, pci_setup_indirect() takes u32's at this time. I'm not sure what the best option is here.

- k