ppc4xx: Remove duplicated is_pci_host() functions
authorStefan Roese <sr@denx.de>
Thu, 29 Oct 2009 15:54:52 +0000 (16:54 +0100)
committerStefan Roese <sr@denx.de>
Mon, 9 Nov 2009 10:27:08 +0000 (11:27 +0100)
This patch introduces a weak default function for is_pci_host(),
returning 1. This is the default behaviour, since most boards only
implement PCI host functionality. This weak default can be overridden
by a board specific version if needed.

Signed-off-by: Stefan Roese <sr@denx.de>
23 files changed:
board/amcc/bamboo/bamboo.c
board/amcc/canyonlands/canyonlands.c
board/amcc/ebony/ebony.c
board/amcc/katmai/katmai.c
board/amcc/luan/luan.c
board/amcc/ocotea/ocotea.c
board/amcc/sequoia/sequoia.c
board/amcc/taishan/taishan.c
board/amcc/yosemite/yosemite.c
board/amcc/yucca/yucca.c
board/esd/du440/du440.c
board/esd/pmc440/pmc440.c
board/gdsys/gdppc440etx/gdppc440etx.c
board/gdsys/intip/intip.c
board/korat/korat.c
board/lwmon5/lwmon5.c
board/netstal/hcu5/hcu5.c
board/pcs440ep/pcs440ep.c
board/prodrive/alpr/alpr.c
board/prodrive/p3p440/p3p440.c
board/sandburst/common/sb_common.c
board/xes/xpedite1000/xpedite1000.c
cpu/ppc4xx/4xx_pci.c

index 2598f2c..313f9f3 100644 (file)
@@ -603,29 +603,6 @@ void pci_master_init(struct pci_controller *hose)
 }
 #endif                         /* defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_MASTER_INIT) */
 
-/*************************************************************************
- *  is_pci_host
- *
- *     This routine is called to determine if a pci scan should be
- *     performed. With various hardware environments (especially cPCI and
- *     PPMC) it's insufficient to depend on the state of the arbiter enable
- *     bit in the strap register, or generic host/adapter assumptions.
- *
- *     Rather than hard-code a bad assumption in the general 440 code, the
- *     440 pci code requires the board to decide at runtime.
- *
- *     Return 0 for adapter mode, non-zero for host (monarch) mode.
- *
- *
- ************************************************************************/
-#if defined(CONFIG_PCI)
-int is_pci_host(struct pci_controller *hose)
-{
-       /* Bamboo is always configured as host. */
-       return (1);
-}
-#endif                         /* defined(CONFIG_PCI) */
-
 /*----------------------------------------------------------------------------+
   | is_powerpc440ep_pass1.
   +----------------------------------------------------------------------------*/
index 8ce6788..9a8ca8e 100644 (file)
@@ -364,25 +364,6 @@ void pci_target_init(struct pci_controller * hose )
 #endif /* defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_TARGET_INIT) */
 
 #if defined(CONFIG_PCI)
-/*
- * is_pci_host
- *
- * This routine is called to determine if a pci scan should be
- * performed. With various hardware environments (especially cPCI and
- * PPMC) it's insufficient to depend on the state of the arbiter enable
- * bit in the strap register, or generic host/adapter assumptions.
- *
- * Rather than hard-code a bad assumption in the general 440 code, the
- * 440 pci code requires the board to decide at runtime.
- *
- * Return 0 for adapter mode, non-zero for host (monarch) mode.
- */
-int is_pci_host(struct pci_controller *hose)
-{
-       /* Board is always configured as host. */
-       return (1);
-}
-
 int board_pcie_first(void)
 {
        /*
index 0ca1acc..1524b53 100644 (file)
@@ -234,26 +234,3 @@ void pci_target_init(struct pci_controller *hose)
        out16r(PCIL0_CMD, in16r(PCIL0_CMD) | PCI_COMMAND_MEMORY);
 }
 #endif                         /* defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_TARGET_INIT) */
-
-/*************************************************************************
- *  is_pci_host
- *
- *     This routine is called to determine if a pci scan should be
- *     performed. With various hardware environments (especially cPCI and
- *     PPMC) it's insufficient to depend on the state of the arbiter enable
- *     bit in the strap register, or generic host/adapter assumptions.
- *
- *     Rather than hard-code a bad assumption in the general 440 code, the
- *     440 pci code requires the board to decide at runtime.
- *
- *     Return 0 for adapter mode, non-zero for host (monarch) mode.
- *
- *
- ************************************************************************/
-#if defined(CONFIG_PCI)
-int is_pci_host(struct pci_controller *hose)
-{
-       /* The ebony board is always configured as host. */
-       return (1);
-}
-#endif                         /* defined(CONFIG_PCI) */
index 34ecd99..f43e764 100644 (file)
@@ -330,27 +330,6 @@ void pci_target_init(struct pci_controller * hose )
 #endif /* defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_TARGET_INIT) */
 
 #if defined(CONFIG_PCI)
-/*************************************************************************
- *  is_pci_host
- *
- *     This routine is called to determine if a pci scan should be
- *     performed. With various hardware environments (especially cPCI and
- *     PPMC) it's insufficient to depend on the state of the arbiter enable
- *     bit in the strap register, or generic host/adapter assumptions.
- *
- *     Rather than hard-code a bad assumption in the general 440 code, the
- *     440 pci code requires the board to decide at runtime.
- *
- *     Return 0 for adapter mode, non-zero for host (monarch) mode.
- *
- *
- ************************************************************************/
-int is_pci_host(struct pci_controller *hose)
-{
-       /* The katmai board is always configured as host. */
-       return 1;
-}
-
 int board_pcie_card_present(int port)
 {
        u32 val;
index a04f2af..94ba643 100644 (file)
@@ -200,29 +200,6 @@ void pci_target_init(struct pci_controller *hose)
 
 
 /*************************************************************************
- *  is_pci_host
- *
- *     This routine is called to determine if a pci scan should be
- *     performed. With various hardware environments (especially cPCI and
- *     PPMC) it's insufficient to depend on the state of the arbiter enable
- *     bit in the strap register, or generic host/adapter assumptions.
- *
- *     Rather than hard-code a bad assumption in the general 440 code, the
- *     440 pci code requires the board to decide at runtime.
- *
- *     Return 0 for adapter mode, non-zero for host (monarch) mode.
- *
- *
- ************************************************************************/
-#if defined(CONFIG_PCI)
-int is_pci_host(struct pci_controller *hose)
-{
-       return  1;
-}
-#endif                         /* defined(CONFIG_PCI) */
-
-
-/*************************************************************************
  *  hw_watchdog_reset
  *
  *     This routine is called to reset (keep alive) the watchdog timer
index 0aa317e..2f64764 100644 (file)
@@ -347,30 +347,6 @@ void pci_target_init(struct pci_controller * hose )
 #endif /* defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_TARGET_INIT) */
 
 
-/*************************************************************************
- *  is_pci_host
- *
- *     This routine is called to determine if a pci scan should be
- *     performed. With various hardware environments (especially cPCI and
- *     PPMC) it's insufficient to depend on the state of the arbiter enable
- *     bit in the strap register, or generic host/adapter assumptions.
- *
- *     Rather than hard-code a bad assumption in the general 440 code, the
- *     440 pci code requires the board to decide at runtime.
- *
- *     Return 0 for adapter mode, non-zero for host (monarch) mode.
- *
- *
- ************************************************************************/
-#if defined(CONFIG_PCI)
-int is_pci_host(struct pci_controller *hose)
-{
-    /* The ocotea board is always configured as host. */
-    return(1);
-}
-#endif /* defined(CONFIG_PCI) */
-
-
 void fpga_init(void)
 {
        unsigned long group;
index 00f6408..4393820 100644 (file)
@@ -509,27 +509,6 @@ void pci_master_init(struct pci_controller *hose)
 }
 #endif /* defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_MASTER_INIT) */
 
-/*
- * is_pci_host
- *
- * This routine is called to determine if a pci scan should be
- * performed. With various hardware environments (especially cPCI and
- * PPMC) it's insufficient to depend on the state of the arbiter enable
- * bit in the strap register, or generic host/adapter assumptions.
- *
- * Rather than hard-code a bad assumption in the general 440 code, the
- * 440 pci code requires the board to decide at runtime.
- *
- * Return 0 for adapter mode, non-zero for host (monarch) mode.
- */
-#if defined(CONFIG_PCI)
-int is_pci_host(struct pci_controller *hose)
-{
-       /* Cactus is always configured as host. */
-       return (1);
-}
-#endif /* defined(CONFIG_PCI) */
-
 #if defined(CONFIG_POST)
 /*
  * Returns 1 if keys pressed to start the power-on long-running tests
index 0c20faf..81e8fe1 100644 (file)
@@ -279,29 +279,6 @@ void pci_target_init(struct pci_controller * hose )
 }
 #endif /* defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_TARGET_INIT) */
 
-/*************************************************************************
- *  is_pci_host
- *
- *     This routine is called to determine if a pci scan should be
- *     performed. With various hardware environments (especially cPCI and
- *     PPMC) it's insufficient to depend on the state of the arbiter enable
- *     bit in the strap register, or generic host/adapter assumptions.
- *
- *     Rather than hard-code a bad assumption in the general 440 code, the
- *     440 pci code requires the board to decide at runtime.
- *
- *     Return 0 for adapter mode, non-zero for host (monarch) mode.
- *
- *
- ************************************************************************/
-#if defined(CONFIG_PCI)
-int is_pci_host(struct pci_controller *hose)
-{
-       /* The ocotea board is always configured as host. */
-       return(1);
-}
-#endif /* defined(CONFIG_PCI) */
-
 #ifdef CONFIG_POST
 /*
  * Returns 1 if keys pressed to start the power-on long-running tests
index ccbeb0e..e416eeb 100644 (file)
@@ -490,29 +490,6 @@ void pci_master_init(struct pci_controller *hose)
 #endif                         /* defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_MASTER_INIT) */
 
 /*************************************************************************
- *  is_pci_host
- *
- *     This routine is called to determine if a pci scan should be
- *     performed. With various hardware environments (especially cPCI and
- *     PPMC) it's insufficient to depend on the state of the arbiter enable
- *     bit in the strap register, or generic host/adapter assumptions.
- *
- *     Rather than hard-code a bad assumption in the general 440 code, the
- *     440 pci code requires the board to decide at runtime.
- *
- *     Return 0 for adapter mode, non-zero for host (monarch) mode.
- *
- *
- ************************************************************************/
-#if defined(CONFIG_PCI)
-int is_pci_host(struct pci_controller *hose)
-{
-       /* Bamboo is always configured as host. */
-       return (1);
-}
-#endif                         /* defined(CONFIG_PCI) */
-
-/*************************************************************************
  *  hw_watchdog_reset
  *
  *     This routine is called to reset (keep alive) the watchdog timer
index 6493155..7315033 100644 (file)
@@ -658,27 +658,6 @@ void pci_target_init(struct pci_controller * hose )
 #endif /* defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_TARGET_INIT) */
 
 #if defined(CONFIG_PCI)
-/*************************************************************************
- *  is_pci_host
- *
- *     This routine is called to determine if a pci scan should be
- *     performed. With various hardware environments (especially cPCI and
- *     PPMC) it's insufficient to depend on the state of the arbiter enable
- *     bit in the strap register, or generic host/adapter assumptions.
- *
- *     Rather than hard-code a bad assumption in the general 440 code, the
- *     440 pci code requires the board to decide at runtime.
- *
- *     Return 0 for adapter mode, non-zero for host (monarch) mode.
- *
- *
- ************************************************************************/
-int is_pci_host(struct pci_controller *hose)
-{
-       /* The yucca board is always configured as host. */
-       return 1;
-}
-
 int board_pcie_card_present(int port)
 {
        u16 reg;
index d0e52cb..8f9f950 100644 (file)
@@ -498,27 +498,6 @@ void pci_master_init(struct pci_controller *hose)
 }
 #endif /* defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_MASTER_INIT) */
 
-/*
- * is_pci_host
- *
- * This routine is called to determine if a pci scan should be
- * performed. With various hardware environments (especially cPCI and
- * PPMC) it's insufficient to depend on the state of the arbiter enable
- * bit in the strap register, or generic host/adapter assumptions.
- *
- * Rather than hard-code a bad assumption in the general 440 code, the
- * 440 pci code requires the board to decide at runtime.
- *
- * Return 0 for adapter mode, non-zero for host (monarch) mode.
- */
-#if defined(CONFIG_PCI)
-int is_pci_host(struct pci_controller *hose)
-{
-       /* always configured as host. */
-       return (1);
-}
-#endif /* defined(CONFIG_PCI) */
-
 int last_stage_init(void)
 {
        int e, i;
index ec92552..10901b4 100644 (file)
@@ -712,7 +712,7 @@ static void wait_for_pci_ready(void)
 }
 
 /*
- * is_pci_host
+ * Override weak is_pci_host()
  *
  * This routine is called to determine if a pci scan should be
  * performed. With various hardware environments (especially cPCI and
index 90dbe52..92f5d82 100644 (file)
@@ -299,25 +299,3 @@ void pci_master_init(struct pci_controller *hose)
                              PCI_COMMAND_MEMORY);
 }
 #endif /* defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_MASTER_INIT) */
-
-/*
- *  is_pci_host
- *
- *     This routine is called to determine if a pci scan should be
- *     performed. With various hardware environments (especially cPCI and
- *     PPMC) it's insufficient to depend on the state of the arbiter enable
- *     bit in the strap register, or generic host/adapter assumptions.
- *
- *     Rather than hard-code a bad assumption in the general 440 code, the
- *     440 pci code requires the board to decide at runtime.
- *
- *     Return 0 for adapter mode, non-zero for host (monarch) mode.
- *
- *
- */
-#if defined(CONFIG_PCI)
-int is_pci_host(struct pci_controller *hose)
-{
-       return 1;
-}
-#endif /* defined(CONFIG_PCI) */
index b42e908..49d2451 100644 (file)
@@ -178,27 +178,6 @@ void pci_target_init(struct pci_controller *hose)
 }
 #endif /* defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_TARGET_INIT) */
 
-#if defined(CONFIG_PCI)
-/*
- * is_pci_host
- *
- * This routine is called to determine if a pci scan should be
- * performed. With various hardware environments (especially cPCI and
- * PPMC) it's insufficient to depend on the state of the arbiter enable
- * bit in the strap register, or generic host/adapter assumptions.
- *
- * Rather than hard-code a bad assumption in the general 440 code, the
- * 440 pci code requires the board to decide at runtime.
- *
- * Return 0 for adapter mode, non-zero for host (monarch) mode.
- */
-int is_pci_host(struct pci_controller *hose)
-{
-       /* Board is always configured as host. */
-       return 1;
-}
-#endif /* CONFIG_PCI */
-
 int board_early_init_r(void)
 {
        /*
index 8c674a2..b0e6a56 100644 (file)
@@ -748,27 +748,6 @@ void pci_master_init(struct pci_controller *hose)
 }
 #endif
 
-/*
- * is_pci_host
- *
- * This routine is called to determine if a pci scan should be
- * performed. With various hardware environments (especially cPCI and
- * PPMC) it's insufficient to depend on the state of the arbiter enable
- * bit in the strap register, or generic host/adapter assumptions.
- *
- * Rather than hard-code a bad assumption in the general 440 code, the
- * 440 pci code requires the board to decide at runtime.
- *
- * Return 0 for adapter mode, non-zero for host (monarch) mode.
- */
-#if defined(CONFIG_PCI)
-int is_pci_host(struct pci_controller *hose)
-{
-       /* Korat is always configured as host. */
-       return (1);
-}
-#endif /* defined(CONFIG_PCI) */
-
 #if defined(CONFIG_POST)
 /*
  * Returns 1 if keys pressed to start the power-on long-running tests
index d36ea04..09ba2b9 100644 (file)
@@ -412,29 +412,6 @@ void pci_master_init(struct pci_controller *hose)
 }
 #endif                         /* defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_MASTER_INIT) */
 
-/*************************************************************************
- *  is_pci_host
- *
- *     This routine is called to determine if a pci scan should be
- *     performed. With various hardware environments (especially cPCI and
- *     PPMC) it's insufficient to depend on the state of the arbiter enable
- *     bit in the strap register, or generic host/adapter assumptions.
- *
- *     Rather than hard-code a bad assumption in the general 440 code, the
- *     440 pci code requires the board to decide at runtime.
- *
- *     Return 0 for adapter mode, non-zero for host (monarch) mode.
- *
- *
- ************************************************************************/
-#if defined(CONFIG_PCI)
-int is_pci_host(struct pci_controller *hose)
-{
-       /* Cactus is always configured as host. */
-       return (1);
-}
-#endif                         /* defined(CONFIG_PCI) */
-
 void hw_watchdog_reset(void)
 {
        int val;
index 946c3f3..7ffc262 100644 (file)
@@ -460,25 +460,6 @@ void pci_master_init(struct pci_controller *hose)
                              temp_short | PCI_COMMAND_MASTER |
                              PCI_COMMAND_MEMORY);
 }
-
-/*
- *  is_pci_host
- *
- *     This routine is called to determine if a pci scan should be
- *     performed. With various hardware environments (especially cPCI and
- *     PPMC) it's insufficient to depend on the state of the arbiter enable
- *     bit in the strap register, or generic host/adapter assumptions.
- *
- *     Rather than hard-code a bad assumption in the general 440 code, the
- *     440 pci code requires the board to decide at runtime.
- *
- *     Return 0 for adapter mode, non-zero for host (monarch) mode.
- *
- */
-int is_pci_host(struct pci_controller *hose)
-{
-       return 1;
-}
 #endif  /* defined(CONFIG_PCI) */
 
 #if defined(CONFIG_POST)
index b70827e..2155711 100644 (file)
@@ -688,29 +688,6 @@ void pci_master_init(struct pci_controller *hose)
 #endif                         /* defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_MASTER_INIT) */
 
 /*************************************************************************
- *  is_pci_host
- *
- *     This routine is called to determine if a pci scan should be
- *     performed. With various hardware environments (especially cPCI and
- *     PPMC) it's insufficient to depend on the state of the arbiter enable
- *     bit in the strap register, or generic host/adapter assumptions.
- *
- *     Rather than hard-code a bad assumption in the general 440 code, the
- *     440 pci code requires the board to decide at runtime.
- *
- *     Return 0 for adapter mode, non-zero for host (monarch) mode.
- *
- *
- ************************************************************************/
-#if defined(CONFIG_PCI)
-int is_pci_host(struct pci_controller *hose)
-{
-       /* PCS440EP is always configured as host. */
-       return (1);
-}
-#endif                         /* defined(CONFIG_PCI) */
-
-/*************************************************************************
  *  hw_watchdog_reset
  *
  *     This routine is called to reset (keep alive) the watchdog timer
index 51335c4..e9e2bf3 100644 (file)
@@ -218,7 +218,7 @@ void pci_target_init(struct pci_controller * hose )
 #endif /* defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_TARGET_INIT) */
 
 /*************************************************************************
- *  is_pci_host
+ * Override weak is_pci_host()
  *
  *     This routine is called to determine if a pci scan should be
  *     performed. With various hardware environments (especially cPCI and
index 9a07852..e074007 100644 (file)
@@ -235,7 +235,7 @@ void pci_target_init(struct pci_controller *hose)
 #endif                         /* defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_TARGET_INIT) */
 
 /*************************************************************************
- *  is_pci_host
+ * Override weak is_pci_host()
  *
  *     This routine is called to determine if a pci scan should be
  *     performed. With various hardware environments (especially cPCI and
index a484874..5749084 100644 (file)
@@ -373,19 +373,6 @@ void pci_target_init(struct pci_controller * hose )
 
 
 /*************************************************************************
- *  is_pci_host
- *
- *
- ************************************************************************/
-#if defined(CONFIG_PCI)
-int is_pci_host(struct pci_controller *hose)
-{
-    /* The metrobox is always configured as host. */
-    return(1);
-}
-#endif /* defined(CONFIG_PCI) */
-
-/*************************************************************************
  *  board_get_enetaddr
  *
  *  Get the ethernet MAC address for the management ethernet from the
index 04949bb..0c4cf94 100644 (file)
@@ -200,6 +200,8 @@ void pci_target_init(struct pci_controller * hose)
 
 #if defined(CONFIG_PCI)
 /*
+ * Override weak is_pci_host()
+ *
  * This routine is called to determine if a pci scan should be
  * performed. With various hardware environments (especially cPCI and
  * PPMC) it's insufficient to depend on the state of the arbiter enable
index fa521f0..40017f4 100644 (file)
@@ -478,6 +478,26 @@ void pci_init_board(void)
 
 static struct pci_controller ppc440_hose = {0};
 
+/*
+ * This routine is called to determine if a pci scan should be
+ * performed. With various hardware environments (especially cPCI and
+ * PPMC) it's insufficient to depend on the state of the arbiter enable
+ * bit in the strap register, or generic host/adapter assumptions.
+ *
+ * Rather than hard-code a bad assumption in the general 440 code, the
+ * 440 pci code requires the board to decide at runtime.
+ *
+ * Return 0 for adapter mode, non-zero for host (monarch) mode.
+ *
+ * Weak default implementation: "Normal" boards implement the PCI
+ * host functionality. This can be overridden for PCI adapter boards.
+ */
+int __is_pci_host(struct pci_controller *hose)
+{
+       return 1;
+}
+int is_pci_host(struct pci_controller *hose)
+       __attribute__((weak, alias("__is_pci_host")));
 
 int pci_440_init (struct pci_controller *hose)
 {