diff options
| author | Stefan Roese <sr@denx.de> | 2009-11-12 17:19:37 +0100 | 
|---|---|---|
| committer | Stefan Roese <sr@denx.de> | 2009-11-19 11:35:34 +0100 | 
| commit | 6c70049bd14e8e81764570732be7f34a89831f09 (patch) | |
| tree | 9e2028ab7a017c9a8f78ac62a99e135bb5b23630 | |
| parent | a760b0203155da6fb8b8e9086169bb87d09d76fa (diff) | |
| download | olio-uboot-2014.01-6c70049bd14e8e81764570732be7f34a89831f09.tar.xz olio-uboot-2014.01-6c70049bd14e8e81764570732be7f34a89831f09.zip | |
ppc4xx: Consolidate pci_master_init() function
This patch removes the duplicted implementations of the pci_master_init()
function by introducing a weak default function for it. It can be
overridden by a board specific version.
Signed-off-by: Stefan Roese <sr@denx.de>
| -rw-r--r-- | board/amcc/bamboo/bamboo.c | 21 | ||||
| -rw-r--r-- | board/amcc/sequoia/sequoia.c | 17 | ||||
| -rw-r--r-- | board/amcc/yosemite/yosemite.c | 21 | ||||
| -rw-r--r-- | board/esd/du440/du440.c | 17 | ||||
| -rw-r--r-- | board/esd/pmc440/pmc440.c | 18 | ||||
| -rw-r--r-- | board/gdsys/gdppc440etx/gdppc440etx.c | 21 | ||||
| -rw-r--r-- | board/korat/korat.c | 17 | ||||
| -rw-r--r-- | board/lwmon5/lwmon5.c | 21 | ||||
| -rw-r--r-- | board/netstal/hcu5/hcu5.c | 19 | ||||
| -rw-r--r-- | board/pcs440ep/pcs440ep.c | 21 | ||||
| -rw-r--r-- | cpu/ppc4xx/4xx_pci.c | 18 | ||||
| -rw-r--r-- | include/asm-ppc/4xx_pci.h | 1 | 
12 files changed, 31 insertions, 181 deletions
| diff --git a/board/amcc/bamboo/bamboo.c b/board/amcc/bamboo/bamboo.c index 7c34c4445..c90f86b8d 100644 --- a/board/amcc/bamboo/bamboo.c +++ b/board/amcc/bamboo/bamboo.c @@ -466,27 +466,6 @@ phys_size_t initdram (int board_type)  #endif  } -/************************************************************************* - *  pci_master_init - * - ************************************************************************/ -#if defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_MASTER_INIT) -void pci_master_init(struct pci_controller *hose) -{ -	unsigned short temp_short; - -	/*--------------------------------------------------------------------------+ -	  | Write the PowerPC440 EP PCI Configuration regs. -	  |   Enable PowerPC440 EP to be a master on the PCI bus (PMM). -	  |   Enable PowerPC440 EP to act as a PCI memory target (PTM). -	  +--------------------------------------------------------------------------*/ -	pci_read_config_word(0, PCI_COMMAND, &temp_short); -	pci_write_config_word(0, PCI_COMMAND, -			      temp_short | PCI_COMMAND_MASTER | -			      PCI_COMMAND_MEMORY); -} -#endif				/* defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_MASTER_INIT) */ -  /*----------------------------------------------------------------------------+    | is_powerpc440ep_pass1.    +----------------------------------------------------------------------------*/ diff --git a/board/amcc/sequoia/sequoia.c b/board/amcc/sequoia/sequoia.c index 8c0a64761..cb34c9d7d 100644 --- a/board/amcc/sequoia/sequoia.c +++ b/board/amcc/sequoia/sequoia.c @@ -370,23 +370,6 @@ void board_pci_fixup_irq(struct pci_controller *hose, pci_dev_t dev)  }  #endif -#if defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_MASTER_INIT) -void pci_master_init(struct pci_controller *hose) -{ -	unsigned short temp_short; - -	/* -	 * Write the PowerPC440 EP PCI Configuration regs. -	 * Enable PowerPC440 EP to be a master on the PCI bus (PMM). -	 * Enable PowerPC440 EP to act as a PCI memory target (PTM). -	 */ -	pci_read_config_word(0, PCI_COMMAND, &temp_short); -	pci_write_config_word(0, PCI_COMMAND, -			      temp_short | PCI_COMMAND_MASTER | -			      PCI_COMMAND_MEMORY); -} -#endif /* defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_MASTER_INIT) */ -  #if defined(CONFIG_POST)  /*   * Returns 1 if keys pressed to start the power-on long-running tests diff --git a/board/amcc/yosemite/yosemite.c b/board/amcc/yosemite/yosemite.c index b6f8b7028..98c1f3b81 100644 --- a/board/amcc/yosemite/yosemite.c +++ b/board/amcc/yosemite/yosemite.c @@ -353,27 +353,6 @@ phys_size_t initdram(int board)  }  /************************************************************************* - *  pci_master_init - * - ************************************************************************/ -#if defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_MASTER_INIT) -void pci_master_init(struct pci_controller *hose) -{ -	unsigned short temp_short; - -	/*--------------------------------------------------------------------------+ -	  | Write the PowerPC440 EP PCI Configuration regs. -	  |   Enable PowerPC440 EP to be a master on the PCI bus (PMM). -	  |   Enable PowerPC440 EP to act as a PCI memory target (PTM). -	  +--------------------------------------------------------------------------*/ -	pci_read_config_word(0, PCI_COMMAND, &temp_short); -	pci_write_config_word(0, PCI_COMMAND, -			      temp_short | PCI_COMMAND_MASTER | -			      PCI_COMMAND_MEMORY); -} -#endif				/* defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_MASTER_INIT) */ - -/*************************************************************************   *  hw_watchdog_reset   *   *	This routine is called to reset (keep alive) the watchdog timer diff --git a/board/esd/du440/du440.c b/board/esd/du440/du440.c index af50a1ef8..111cce52a 100644 --- a/board/esd/du440/du440.c +++ b/board/esd/du440/du440.c @@ -360,23 +360,6 @@ int checkboard(void)  	return (0);  } -#if defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_MASTER_INIT) -void pci_master_init(struct pci_controller *hose) -{ -	unsigned short temp_short; - -	/* -	 * Write the PowerPC440 EP PCI Configuration regs. -	 * Enable PowerPC440 EP to be a master on the PCI bus (PMM). -	 * Enable PowerPC440 EP to act as a PCI memory target (PTM). -	 */ -	pci_read_config_word(0, PCI_COMMAND, &temp_short); -	pci_write_config_word(0, PCI_COMMAND, -			      temp_short | PCI_COMMAND_MASTER | -			      PCI_COMMAND_MEMORY); -} -#endif /* defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_MASTER_INIT) */ -  int last_stage_init(void)  {  	int e, i; diff --git a/board/esd/pmc440/pmc440.c b/board/esd/pmc440/pmc440.c index c5dc486cd..d0ff080fa 100644 --- a/board/esd/pmc440/pmc440.c +++ b/board/esd/pmc440/pmc440.c @@ -39,6 +39,8 @@  #include <miiphy.h>  #endif  #include <serial.h> +#include <asm/4xx_pci.h> +  #include "fpga.h"  #include "pmc440.h" @@ -600,24 +602,16 @@ void pci_target_init(struct pci_controller *hose)  #endif /* defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_TARGET_INIT) */  /* - * pci_master_init + * Override weak default pci_master_init()   */  #if defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_MASTER_INIT)  void pci_master_init(struct pci_controller *hose)  { -	unsigned short temp_short; -  	/* -	 * Write the PowerPC440 EP PCI Configuration regs. -	 * Enable PowerPC440 EP to be a master on the PCI bus (PMM). -	 * Enable PowerPC440 EP to act as a PCI memory target (PTM). +	 * Only configure the master in monach mode  	 */ -	if (is_monarch()) { -		pci_read_config_word(0, PCI_COMMAND, &temp_short); -		pci_write_config_word(0, PCI_COMMAND, -				      temp_short | PCI_COMMAND_MASTER | -				      PCI_COMMAND_MEMORY); -	} +	if (is_monarch()) +		__pci_master_init(hose);  }  #endif /* defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_MASTER_INIT) */ diff --git a/board/gdsys/gdppc440etx/gdppc440etx.c b/board/gdsys/gdppc440etx/gdppc440etx.c index 10e146b42..ecbc3c3d1 100644 --- a/board/gdsys/gdppc440etx/gdppc440etx.c +++ b/board/gdsys/gdppc440etx/gdppc440etx.c @@ -174,24 +174,3 @@ int pci_pre_init(struct pci_controller *hose)  	return 1;  }  #endif	/* defined(CONFIG_PCI) */ - -/* - *  pci_master_init - * - */ -#if defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_MASTER_INIT) -void pci_master_init(struct pci_controller *hose) -{ -	unsigned short temp_short; - -	/* -	 * Write the PowerPC440 EP PCI Configuration regs. -	 *   Enable PowerPC440 EP to be a master on the PCI bus (PMM). -	 *   Enable PowerPC440 EP to act as a PCI memory target (PTM). -	 */ -	pci_read_config_word(0, PCI_COMMAND, &temp_short); -	pci_write_config_word(0, PCI_COMMAND, -			      temp_short | PCI_COMMAND_MASTER | -			      PCI_COMMAND_MEMORY); -} -#endif	/* defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_MASTER_INIT) */ diff --git a/board/korat/korat.c b/board/korat/korat.c index 78ccb1122..f942052bd 100644 --- a/board/korat/korat.c +++ b/board/korat/korat.c @@ -622,23 +622,6 @@ void pci_target_init(struct pci_controller *hose)  }  #endif /* defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_TARGET_INIT) */ -#if defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_MASTER_INIT) -void pci_master_init(struct pci_controller *hose) -{ -	unsigned short temp_short; - -	/* -	 * Write the PowerPC440 EP PCI Configuration regs. -	 * Enable PowerPC440 EP to be a master on the PCI bus (PMM). -	 * Enable PowerPC440 EP to act as a PCI memory target (PTM). -	 */ -	pci_read_config_word(0, PCI_COMMAND, &temp_short); -	pci_write_config_word(0, PCI_COMMAND, -			      temp_short | PCI_COMMAND_MASTER | -			      PCI_COMMAND_MEMORY); -} -#endif -  #if defined(CONFIG_POST)  /*   * Returns 1 if keys pressed to start the power-on long-running tests diff --git a/board/lwmon5/lwmon5.c b/board/lwmon5/lwmon5.c index bd29437a2..415e036c0 100644 --- a/board/lwmon5/lwmon5.c +++ b/board/lwmon5/lwmon5.c @@ -275,27 +275,6 @@ int checkboard(void)  	return (0);  } -/************************************************************************* - *  pci_master_init - * - ************************************************************************/ -#if defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_MASTER_INIT) -void pci_master_init(struct pci_controller *hose) -{ -	unsigned short temp_short; - -	/*--------------------------------------------------------------------------+ -	  | Write the PowerPC440 EP PCI Configuration regs. -	  |   Enable PowerPC440 EP to be a master on the PCI bus (PMM). -	  |   Enable PowerPC440 EP to act as a PCI memory target (PTM). -	  +--------------------------------------------------------------------------*/ -	pci_read_config_word(0, PCI_COMMAND, &temp_short); -	pci_write_config_word(0, PCI_COMMAND, -			      temp_short | PCI_COMMAND_MASTER | -			      PCI_COMMAND_MEMORY); -} -#endif				/* defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_MASTER_INIT) */ -  void hw_watchdog_reset(void)  {  	int val; diff --git a/board/netstal/hcu5/hcu5.c b/board/netstal/hcu5/hcu5.c index 144fdd970..861564564 100644 --- a/board/netstal/hcu5/hcu5.c +++ b/board/netstal/hcu5/hcu5.c @@ -22,6 +22,8 @@  #include <asm/processor.h>  #include <ppc440.h>  #include <asm/io.h> +#include <asm/4xx_pci.h> +  #include  "../common/nm.h"  DECLARE_GLOBAL_DATA_PTR; @@ -377,23 +379,14 @@ int pci_pre_init(struct pci_controller *hose)  }  /* - *  pci_master_init - * + * Override weak default pci_master_init()   */  void pci_master_init(struct pci_controller *hose)  { -	unsigned short temp_short; -	if (!board_with_pci()) { return; } +	if (!board_with_pci()) +		return; -	/*--------------------------------------------------------------- -	 * Write the PowerPC440 EP PCI Configuration regs. -	 *   Enable PowerPC440 EP to be a master on the PCI bus (PMM). -	 *   Enable PowerPC440 EP to act as a PCI memory target (PTM). -	 *--------------------------------------------------------------*/ -	pci_read_config_word(0, PCI_COMMAND, &temp_short); -	pci_write_config_word(0, PCI_COMMAND, -			      temp_short | PCI_COMMAND_MASTER | -			      PCI_COMMAND_MEMORY); +	__pci_master_init(hose);  }  #endif	 /* defined(CONFIG_PCI) */ diff --git a/board/pcs440ep/pcs440ep.c b/board/pcs440ep/pcs440ep.c index e7c575d8a..ce1e61667 100644 --- a/board/pcs440ep/pcs440ep.c +++ b/board/pcs440ep/pcs440ep.c @@ -551,27 +551,6 @@ phys_size_t initdram (int board_type)  }  /************************************************************************* - *  pci_master_init - * - ************************************************************************/ -#if defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_MASTER_INIT) -void pci_master_init(struct pci_controller *hose) -{ -	unsigned short temp_short; - -	/*--------------------------------------------------------------------------+ -	  | Write the PowerPC440 EP PCI Configuration regs. -	  |   Enable PowerPC440 EP to be a master on the PCI bus (PMM). -	  |   Enable PowerPC440 EP to act as a PCI memory target (PTM). -	  +--------------------------------------------------------------------------*/ -	pci_read_config_word(0, PCI_COMMAND, &temp_short); -	pci_write_config_word(0, PCI_COMMAND, -			      temp_short | PCI_COMMAND_MASTER | -			      PCI_COMMAND_MEMORY); -} -#endif				/* defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_MASTER_INIT) */ - -/*************************************************************************   *  hw_watchdog_reset   *   *	This routine is called to reset (keep alive) the watchdog timer diff --git a/cpu/ppc4xx/4xx_pci.c b/cpu/ppc4xx/4xx_pci.c index 01b9cf721..eed4534e5 100644 --- a/cpu/ppc4xx/4xx_pci.c +++ b/cpu/ppc4xx/4xx_pci.c @@ -686,6 +686,24 @@ void pci_target_init(struct pci_controller * hose)  int pci_pre_init(struct pci_controller *hose)  	__attribute__((weak, alias("__pci_pre_init"))); +#if defined(CONFIG_SYS_PCI_MASTER_INIT) +void __pci_master_init(struct pci_controller *hose) +{ +	u16 reg; + +	/* +	 * Write the PowerPC440 EP PCI Configuration regs. +	 * Enable PowerPC440 EP to be a master on the PCI bus (PMM). +	 * Enable PowerPC440 EP to act as a PCI memory target (PTM). +	 */ +	pci_read_config_word(0, PCI_COMMAND, ®); +	pci_write_config_word(0, PCI_COMMAND, reg | +			      PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY); +} +void pci_master_init(struct pci_controller *hose) +	__attribute__((weak, alias("__pci_master_init"))); +#endif /* CONFIG_SYS_PCI_MASTER_INIT */ +  int pci_440_init (struct pci_controller *hose)  {  	int reg_num = 0; diff --git a/include/asm-ppc/4xx_pci.h b/include/asm-ppc/4xx_pci.h index 31769901c..f686e7cb0 100644 --- a/include/asm-ppc/4xx_pci.h +++ b/include/asm-ppc/4xx_pci.h @@ -55,5 +55,6 @@ void board_pci_fixup_irq(struct pci_controller *hose, pci_dev_t dev);  int pci_arbiter_enabled(void);  int __pci_pre_init(struct pci_controller *hose);  void __pci_target_init(struct pci_controller *hose); +void __pci_master_init(struct pci_controller *hose);  #endif |