[U-Boot] [PATCH 12/12] ppc/8xxx: Remove is_fsl_pci_agent

Kumar Gala galak at kernel.crashing.org
Thu Nov 5 05:38:41 CET 2009


All users of is_fsl_pci_agent have been converted to fsl_is_pci_agent
that uses the standard PCI programming model to determine host vs
agent/end-point.

Signed-off-by: Kumar Gala <galak at kernel.crashing.org>
---
 cpu/mpc8xxx/pci_cfg.c      |   44 +++-----------------------------------------
 drivers/pci/fsl_pci_init.c |    9 +++++++++
 include/asm-ppc/fsl_pci.h  |    5 +++--
 3 files changed, 15 insertions(+), 43 deletions(-)

diff --git a/cpu/mpc8xxx/pci_cfg.c b/cpu/mpc8xxx/pci_cfg.c
index ea129c5..d53781b 100644
--- a/cpu/mpc8xxx/pci_cfg.c
+++ b/cpu/mpc8xxx/pci_cfg.c
@@ -25,19 +25,14 @@
 #include <pci.h>
 
 struct pci_info {
-	u16	agent;
 	u16	cfg;
 };
 
-/* The agent field is a bit mask in which each bit represents the value of
- * cfg_host_agt[] signal and the bit is set of the given interface would be
- * in agent/end-point mode for the given interface.
- *
- * The same idea is true of the cfg field.  The bit will be set if the
- * interface would be enabled based on the value of cfg_IO_ports[] signal
+/* The cfg field is a bit mask in which each bit represents the value of
+ * cfg_IO_ports[] signal and the bit is set if the interface would be
+ * enabled based on the value of cfg_IO_ports[] signal
  *
  * On MPC86xx/PQ3 based systems:
- *   we extract cfg_host_agt from GUTS register PORBMSR
  *   we extract cfg_IO_ports from GUTS register PORDEVSR
  *
  * cfg_IO_ports only exist on systems w/PCIe (we set cfg 0 for systems
@@ -48,7 +43,6 @@ struct pci_info {
 static struct pci_info pci_config_info[] =
 {
 	[LAW_TRGT_IF_PCI] = {
-		.agent = (1 << 0) | (1 << 2),
 		.cfg =   0,
 	},
 };
@@ -56,7 +50,6 @@ static struct pci_info pci_config_info[] =
 static struct pci_info pci_config_info[] =
 {
 	[LAW_TRGT_IF_PCI] = {
-		.agent = (1 << 0),
 		.cfg =   0,
 	},
 };
@@ -64,19 +57,15 @@ static struct pci_info pci_config_info[] =
 static struct pci_info pci_config_info[] =
 {
 	[LAW_TRGT_IF_PCI] = {
-		.agent = (1 << 6),
 		.cfg =   0,
 	},
 	[LAW_TRGT_IF_PCIE_1] = {
-		.agent = (1 << 5),
 		.cfg =   (1 << 2) | (1 << 3) | (1 << 5) | (1 << 7),
 	},
 	[LAW_TRGT_IF_PCIE_2] = {
-		.agent = (1 << 3),
 		.cfg =   (1 << 5) | (1 << 7),
 	},
 	[LAW_TRGT_IF_PCIE_3] = {
-		.agent = (1 << 1),
 		.cfg =   (1 << 7),
 	},
 };
@@ -84,20 +73,16 @@ static struct pci_info pci_config_info[] =
 static struct pci_info pci_config_info[] =
 {
 	[LAW_TRGT_IF_PCI] = {
-		.agent = (1 << 6),
 		.cfg =   0,
 	},
 	[LAW_TRGT_IF_PCIE_1] = {
-		.agent = (1 << 5),
 		.cfg =   (1 << 2) | (1 << 3) | (1 << 4) | (1 << 5) |
 			 (1 << 6) | (1 << 7),
 	},
 	[LAW_TRGT_IF_PCIE_2] = {
-		.agent = (1 << 3),
 		.cfg =   (1 << 4) | (1 << 5) | (1 << 6) | (1 << 7),
 	},
 	[LAW_TRGT_IF_PCIE_3] = {
-		.agent = (1 << 1),
 		.cfg =   (1 << 6) | (1 << 7),
 	},
 };
@@ -105,16 +90,13 @@ static struct pci_info pci_config_info[] =
 static struct pci_info pci_config_info[] =
 {
 	[LAW_TRGT_IF_PCI_1] = {
-		.agent = (1 << 4) | (1 << 6),
 		.cfg =   0,
 	},
 	[LAW_TRGT_IF_PCI_2] = {
-		.agent = (1 << 4) | (1 << 6),
 		.cfg =   0,
 	},
 	/* PCI_2 is always host and we dont use iosel to determine enable/disable */
 	[LAW_TRGT_IF_PCIE_1] = {
-		.agent = (1 << 0) | (1 << 2),
 		.cfg =   (1 << 3) | (1 << 4) | (1 << 7),
 	},
 };
@@ -122,11 +104,9 @@ static struct pci_info pci_config_info[] =
 static struct pci_info pci_config_info[] =
 {
 	[LAW_TRGT_IF_PCI] = {
-		.agent = (1 << 0) | (1 << 4) | (1 << 6),
 		.cfg =   0,
 	},
 	[LAW_TRGT_IF_PCIE_1] = {
-		.agent = (1 << 0) | (1 << 2) | (1 << 4),
 		.cfg =   (1 << 3) | (1 << 4) | (1 << 7),
 	},
 };
@@ -134,7 +114,6 @@ static struct pci_info pci_config_info[] =
 static struct pci_info pci_config_info[] =
 {
 	[LAW_TRGT_IF_PCIE_1] = {
-		.agent = (1 << 0) | (1 << 6),
 		.cfg =   (1 << 0) | (1 << 4) | (1 << 5) | (1 << 6) | (1 << 7) |
 			 (1 << 8) | (1 << 0xc) | (1 << 0xf),
 	},
@@ -143,16 +122,13 @@ static struct pci_info pci_config_info[] =
 static struct pci_info pci_config_info[] =
 {
 	[LAW_TRGT_IF_PCIE_1] = {
-		.agent = (1 << 0) | (1 << 1) | (1 << 4) | (1 << 5),
 		.cfg =   (1 << 2) | (1 << 3) | (1 << 7) |
 			 (1 << 0xb) | (1 << 0xc) | (1 << 0xf),
 	},
 	[LAW_TRGT_IF_PCIE_2] = {
-		.agent = (1 << 0) | (1 << 2) | (1 << 4) | (1 << 6),
 		.cfg =   (1 << 3) | (1 << 7),
 	},
 	[LAW_TRGT_IF_PCIE_3] = {
-		.agent = (1 << 0) | (1 << 3) | (1 << 5) | (1 << 6),
 		.cfg =   (1 << 7),
 	},
 };
@@ -160,15 +136,12 @@ static struct pci_info pci_config_info[] =
 static struct pci_info pci_config_info[] =
 {
 	[LAW_TRGT_IF_PCI_1] = {
-		.agent = (1 << 4) | (1 << 5) | (1 << 6),
 		.cfg =   0,
 	},
 	[LAW_TRGT_IF_PCIE_1] = {
-		.agent = (1 << 0) | (1 << 2) | (1 << 5),
 		.cfg =   (1 << 1) | (1 << 4),
 	},
 	[LAW_TRGT_IF_PCIE_2] = {
-		.agent = (1 << 0) | (1 << 1) | (1 << 4),
 		.cfg =   (1 << 0) | (1 << 4),
 	},
 };
@@ -176,7 +149,6 @@ static struct pci_info pci_config_info[] =
 static struct pci_info pci_config_info[] =
 {
 	[LAW_TRGT_IF_PCIE_1] = {
-		.agent = 0, /* we dont use agent on 8641 */
 		.cfg =   (1 << 2) | (1 << 3) | (1 << 5) | (1 << 6) |
 			 (1 << 7) | (1 << 0xe) | (1 << 0xf),
 	},
@@ -185,11 +157,9 @@ static struct pci_info pci_config_info[] =
 static struct pci_info pci_config_info[] =
 {
 	[LAW_TRGT_IF_PCIE_1] = {
-		.agent = (1 << 0) | (1 << 1),
 		.cfg =   (1 << 0) | (1 << 6) | (1 << 0xe) | (1 << 0xf),
 	},
 	[LAW_TRGT_IF_PCIE_2] = {
-		.agent = (1 << 0) | (1 << 2),
 		.cfg =   (1 << 0xe),
 	},
 };
@@ -197,16 +167,13 @@ static struct pci_info pci_config_info[] =
 static struct pci_info pci_config_info[] =
 {
 	[LAW_TRGT_IF_PCIE_1] = {
-		.agent = (1 << 0) | (1 << 1) | (1 << 4) | (1 << 5),
 		.cfg =   (1 << 0) | (1 << 2) | (1 << 4) | (1 << 6) |
 			 (1 << 0xd) | (1 << 0xe) | (1 << 0xf),
 	},
 	[LAW_TRGT_IF_PCIE_2] = {
-		.agent = (1 << 0) | (1 << 2) | (1 << 4) | (1 << 6),
 		.cfg =   (1 << 2) | (1 << 0xe),
 	},
 	[LAW_TRGT_IF_PCIE_3] = {
-		.agent = (1 << 0) | (1 << 3) | (1 << 5) | (1 << 6),
 		.cfg =   (1 << 2) | (1 << 4),
 	},
 };
@@ -216,11 +183,6 @@ static struct pci_info pci_config_info[] =
 #endif
 
 #ifndef CONFIG_FSL_CORENET
-int is_fsl_pci_agent(enum law_trgt_if trgt, u32 host_agent)
-{
-	return ((1 << host_agent) & pci_config_info[trgt].agent);
-}
-
 int is_fsl_pci_cfg(enum law_trgt_if trgt, u32 io_sel)
 {
 	return ((1 << io_sel) & pci_config_info[trgt].cfg);
diff --git a/drivers/pci/fsl_pci_init.c b/drivers/pci/fsl_pci_init.c
index 170cc25..fe57926 100644
--- a/drivers/pci/fsl_pci_init.c
+++ b/drivers/pci/fsl_pci_init.c
@@ -86,6 +86,15 @@ static void set_inbound_window(volatile pit_t *pi,
 	out_be32(&pi->piwar, flag | sz);
 }
 
+int fsl_setup_hose(struct pci_controller *hose, unsigned long addr)
+{
+	volatile ccsr_fsl_pci_t *pci = (ccsr_fsl_pci_t *) addr;
+
+	pci_setup_indirect(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
+
+	return fsl_is_pci_agent(hose);
+}
+
 static int fsl_pci_setup_inbound_windows(struct pci_controller *hose,
 					 u64 out_lo, u8 pcie_cap,
 					 volatile pit_t *pi)
diff --git a/include/asm-ppc/fsl_pci.h b/include/asm-ppc/fsl_pci.h
index a5f72f5..db61e7e 100644
--- a/include/asm-ppc/fsl_pci.h
+++ b/include/asm-ppc/fsl_pci.h
@@ -1,4 +1,5 @@
-/* (C) Copyright 2007 Freescale Semiconductor, Inc.
+/*
+ * Copyright 2007,2009 Freescale Semiconductor, Inc.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -22,9 +23,9 @@
 
 #include <asm/fsl_law.h>
 
-int is_fsl_pci_agent(enum law_trgt_if trgt, u32 host_agent);
 int is_fsl_pci_cfg(enum law_trgt_if trgt, u32 io_sel);
 
+int fsl_setup_hose(struct pci_controller *hose, unsigned long addr);
 int fsl_is_pci_agent(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);
-- 
1.6.0.6



More information about the U-Boot mailing list