ppc4xx: Consolidate pci_pre_init() function
PATCH 2/3 ppc4xx: Consolidate pci_pre_init() function
This patch removes the duplicted implementations of the pci_pre_init() function by introducing a weak default function for it. This weak default has a different implementation for some PPC variants. It can be overridden by a board specific version.
--- board/amcc/bamboo/bamboo.c | 55 -------------- board/amcc/ebony/ebony.c | 31 -------- board/amcc/katmai/katmai.c | 31 -------- board/amcc/kilauea/kilauea.c | 19 ----- board/amcc/luan/luan.c | 33 --------- board/amcc/makalu/makalu.c | 19 ----- board/amcc/ocotea/ocotea.c | 32 --------- board/amcc/sequoia/sequoia.c | 59 +--------------- board/amcc/taishan/taishan.c | 31 -------- board/amcc/yosemite/yosemite.c | 55 -------------- board/amcc/yucca/yucca.c | 31 -------- board/esd/du440/du440.c | 54 -------------- board/esd/pmc440/pmc440.c | 60 +--------------- board/gdsys/gdppc440etx/gdppc440etx.c | 49 +------------ board/korat/korat.c | 60 +--------------- board/lwmon5/lwmon5.c | 55 -------------- board/pcs440ep/pcs440ep.c | 55 -------------- board/prodrive/alpr/alpr.c | 34 ++------- board/prodrive/p3p440/p3p440.c | 31 -------- board/sandburst/common/sb_common.c | 32 --------- board/xes/xpedite1000/xpedite1000.c | 3 +- cpu/ppc4xx/4xx_pci.c | 125 +++++++++++++++++++++++++++------ cpu/ppc4xx/cpu.c | 2 +- include/asm-ppc/4xx_pci.h | 5 ++ include/configs/PMC440.h | 1 + include/configs/korat.h | 1 + include/configs/sequoia.h | 1 + include/ppc440.h | 3 +- 28 files changed, 130 insertions(+), 837 deletions(-)
board/amcc/bamboo/bamboo.c +0 -55
@@ -467,61 +467,6 @@ phys_size_t initdram (int board_type) }/************************************************************************* -* pci_pre_init -* -* This routine is called just prior to registering the hose and gives -* the board the opportunity to check things. Returning a value of zero -* indicates that things are bad & PCI initialization should be aborted. -* -* Different boards may wish to customize the pci controller structure -* (add regions, override default access routines, etc) or perform -* certain pre-initialization actions. -* -************************************************************************/ -#if defined(CONFIG_PCI ) -int pci_pre_init (struct pci_controller *hose) -{ -unsigned long addr; - -/*-------------------------------------------------------------------------+ -| Set priority for all PLB3 devices to 0. -| Set PLB3 arbiter to fair mode. -+-------------------------------------------------------------------------*/ -mfsdr (SD0_AMP1 , addr); -mtsdr (SD0_AMP1 , (addr &0x000000FF ) |0x0000FF00 ); - addr =mfdcr (PLB3_ACR ); -mtdcr (PLB3_ACR , addr |0x80000000 ); - -/*-------------------------------------------------------------------------+ -| Set priority for all PLB4 devices to 0. -+-------------------------------------------------------------------------*/ -mfsdr (SD0_AMP0 , addr); -mtsdr (SD0_AMP0 , (addr &0x000000FF ) |0x0000FF00 ); - addr =mfdcr (PLB4_ACR ) |0xa0000000 ;/* Was 0x8---- */ -mtdcr (PLB4_ACR , addr); - -/*-------------------------------------------------------------------------+ -| Set Nebula PLB4 arbiter to fair mode. -+-------------------------------------------------------------------------*/ -/* Segment0 */ - addr = (mfdcr (PLB0_ACR ) & ~PLB0_ACR_PPM_MASK ) |PLB0_ACR_PPM_FAIR ; - addr = (addr & ~PLB0_ACR_HBU_MASK ) |PLB0_ACR_HBU_ENABLED ; - addr = (addr & ~PLB0_ACR_RDP_MASK ) |PLB0_ACR_RDP_4DEEP ; - addr = (addr & ~PLB0_ACR_WRP_MASK ) |PLB0_ACR_WRP_2DEEP ; -mtdcr (PLB0_ACR , addr); - -/* Segment1 */ - addr = (mfdcr (PLB1_ACR ) & ~PLB1_ACR_PPM_MASK ) |PLB1_ACR_PPM_FAIR ; - addr = (addr & ~PLB1_ACR_HBU_MASK ) |PLB1_ACR_HBU_ENABLED ; - addr = (addr & ~PLB1_ACR_RDP_MASK ) |PLB1_ACR_RDP_4DEEP ; - addr = (addr & ~PLB1_ACR_WRP_MASK ) |PLB1_ACR_WRP_2DEEP ; -mtdcr (PLB1_ACR , addr); - -return 1 ; -} -#endif /* defined(CONFIG_PCI) */ - -/************************************************************************* * pci_master_init * ************************************************************************/
board/amcc/ebony/ebony.c +0 -31
@@ -164,34 +164,3 @@ long int fixed_sdram(void) return (128 * 1024 * 1024); /* 128 MB */ }#endif /* !defined(CONFIG_SPD_EEPROM) */ - -/************************************************************************* -* pci_pre_init -* -* This routine is called just prior to registering the hose and gives -* the board the opportunity to check things. Returning a value of zero -* indicates that things are bad & PCI initialization should be aborted. -* -* Different boards may wish to customize the pci controller structure -* (add regions, override default access routines, etc) or perform -* certain pre-initialization actions. -* -************************************************************************/ -#if defined(CONFIG_PCI ) -int pci_pre_init (struct pci_controller *hose) -{ -unsigned long strap; - -/*--------------------------------------------------------------------------+ -* The ebony board is always configured as the host & requires the -* PCI arbiter to be enabled. -*--------------------------------------------------------------------------*/ - strap =mfdcr (CPC0_STRP1 ); -if ((strap &0x00100000 ) ==0 ) { -printf ("PCI: CPC0_STRP1[PAE] not set.\n" ); -return 0 ; - } - -return 1 ; -} -#endif /* defined(CONFIG_PCI) */
board/amcc/katmai/katmai.c +0 -31
@@ -260,37 +260,6 @@ u32 ddr_clktr(u32 default_val) {return (SDRAM_CLKTR_CLKP_90_DEG_ADV ); } -/************************************************************************* -* pci_pre_init -* -* This routine is called just prior to registering the hose and gives -* the board the opportunity to check things. Returning a value of zero -* indicates that things are bad & PCI initialization should be aborted. -* -* Different boards may wish to customize the pci controller structure -* (add regions, override default access routines, etc) or perform -* certain pre-initialization actions. -* -************************************************************************/ -#if defined(CONFIG_PCI ) -int pci_pre_init (struct pci_controller * hose ) -{ -unsigned long strap; - -/*-------------------------------------------------------------------+ -* The katmai board is always configured as the host & requires the -* PCI arbiter to be enabled. -*-------------------------------------------------------------------*/ -mfsdr (SDR0_SDSTP1 , strap); -if ( (strap &SDR0_SDSTP1_PAE_MASK ) ==0 ) { -printf ("PCI: SDR0_STRP1[%08lX] - PCI Arbiter disabled.\n" ,strap); -return 0 ; - } - -return 1 ; -} -#endif /* defined(CONFIG_PCI) */ -#if defined(CONFIG_PCI )int board_pcie_card_present (int port) {
board/amcc/kilauea/kilauea.c +0 -19
@@ -285,25 +285,6 @@ int checkboard (void)return (0 ); } -/************************************************************************* -* pci_pre_init -* -* This routine is called just prior to registering the hose and gives -* the board the opportunity to check things. Returning a value of zero -* indicates that things are bad & PCI initialization should be aborted. -* -* Different boards may wish to customize the pci controller structure -* (add regions, override default access routines, etc) or perform -* certain pre-initialization actions. -* -************************************************************************/ -#if defined(CONFIG_PCI ) -int pci_pre_init (struct pci_controller * hose ) -{ -return 0 ; -} -#endif /* defined(CONFIG_PCI) */ -#if defined(CONFIG_POST )/* * Returns 1 if keys pressed to start the power-on long-running tests
board/amcc/luan/luan.c +0 -33
@@ -127,39 +127,6 @@ u32 ddr_clktr(u32 default_val) { }/************************************************************************* -* pci_pre_init -* -* This routine is called just prior to registering the hose and gives -* the board the opportunity to check things. Returning a value of zero -* indicates that things are bad & PCI initialization should be aborted. -* -* Different boards may wish to customize the pci controller structure -* (add regions, override default access routines, etc) or perform -* certain pre-initialization actions. -* -************************************************************************/ -#if defined(CONFIG_PCI ) -int pci_pre_init (struct pci_controller *hose ) -{ -unsigned long strap; - -/*--------------------------------------------------------------------------+ -* The luan board is always configured as the host & requires the -* PCI arbiter to be enabled. -*--------------------------------------------------------------------------*/ -mfsdr (SDR0_SDSTP1 , strap); -if ( (strap &SDR0_SDSTP1_PAE_MASK ) ==0 ) { -printf ("PCI: SDR0_STRP1[%08lX] - PCI Arbiter disabled.\n" ,strap); - -return 0 ; - } - -return 1 ; -} -#endif /* defined(CONFIG_PCI) */ - - -/************************************************************************* * hw_watchdog_reset * * This routine is called to reset (keep alive) the watchdog timer
board/amcc/makalu/makalu.c +0 -19
@@ -237,25 +237,6 @@ int checkboard (void)return (0 ); } -/************************************************************************* -* pci_pre_init -* -* This routine is called just prior to registering the hose and gives -* the board the opportunity to check things. Returning a value of zero -* indicates that things are bad & PCI initialization should be aborted. -* -* Different boards may wish to customize the pci controller structure -* (add regions, override default access routines, etc) or perform -* certain pre-initialization actions. -* -************************************************************************/ -#if defined(CONFIG_PCI ) -int pci_pre_init (struct pci_controller * hose ) -{ -return 0 ; -} -#endif /* defined(CONFIG_PCI) */ -#if defined(CONFIG_POST )/* * Returns 1 if keys pressed to start the power-on long-running tests
board/amcc/ocotea/ocotea.c +0 -32
@@ -275,38 +275,6 @@ long int fixed_sdram (void) }#endif /* !defined(CONFIG_SPD_EEPROM) */ - -/************************************************************************* -* pci_pre_init -* -* This routine is called just prior to registering the hose and gives -* the board the opportunity to check things. Returning a value of zero -* indicates that things are bad & PCI initialization should be aborted. -* -* Different boards may wish to customize the pci controller structure -* (add regions, override default access routines, etc) or perform -* certain pre-initialization actions. -* -************************************************************************/ -#if defined(CONFIG_PCI ) -int pci_pre_init (struct pci_controller * hose ) -{ -unsigned long strap; - -/*--------------------------------------------------------------------------+ -* The ocotea board is always configured as the host & requires the -* PCI arbiter to be enabled. -*--------------------------------------------------------------------------*/ -mfsdr (SDR0_SDSTP1 , strap); -if ( (strap &SDR0_SDSTP1_PAE_MASK ) ==0 ){ -printf ("PCI: SDR0_STRP1[%08lX] - PCI Arbiter disabled.\n" ,strap); -return 0 ; - } - -return 1 ; -} -#endif /* defined(CONFIG_PCI) */ -void fpga_init (void ) {unsigned long group;
board/amcc/sequoia/sequoia.c +1 -58
70 lines not on this page · raw message
board/amcc/taishan/taishan.c +0 -31
@@ -209,37 +209,6 @@ int checkboard (void)return (0 ); } -/************************************************************************* -* pci_pre_init -* -* This routine is called just prior to registering the hose and gives -* the board the opportunity to check things. Returning a value of zero -* indicates that things are bad & PCI initialization should be aborted. -* -* Different boards may wish to customize the pci controller structure -* (add regions, override default access routines, etc) or perform -* certain pre-initialization actions. -* -************************************************************************/ -#if defined(CONFIG_PCI ) -int pci_pre_init (struct pci_controller * hose ) -{ -unsigned long strap; - -/*--------------------------------------------------------------------------+ -* The ocotea board is always configured as the host & requires the -* PCI arbiter to be enabled. -*--------------------------------------------------------------------------*/ -mfsdr (SDR0_SDSTP1 , strap); -if ( (strap &SDR0_SDSTP1_PAE_MASK ) ==0 ){ -printf ("PCI: SDR0_STRP1[%08lX] - PCI Arbiter disabled.\n" ,strap); -return 0 ; - } - -return 1 ; -} -#endif /* defined(CONFIG_PCI) */ -#ifdef CONFIG_POST /* * Returns 1 if keys pressed to start the power-on long-running tests
board/amcc/yosemite/yosemite.c +0 -55
61 lines not on this page · raw message
board/amcc/yucca/yucca.c +0 -31
@@ -588,37 +588,6 @@ u32 ddr_clktr(u32 default_val) {return default_val; } -/************************************************************************* -* pci_pre_init -* -* This routine is called just prior to registering the hose and gives -* the board the opportunity to check things. Returning a value of zero -* indicates that things are bad & PCI initialization should be aborted. -* -* Different boards may wish to customize the pci controller structure -* (add regions, override default access routines, etc) or perform -* certain pre-initialization actions. -* -************************************************************************/ -#if defined(CONFIG_PCI ) -int pci_pre_init (struct pci_controller * hose ) -{ -unsigned long strap; - -/*-------------------------------------------------------------------+ -* The yucca board is always configured as the host & requires the -* PCI arbiter to be enabled. -*-------------------------------------------------------------------*/ -mfsdr (SDR0_SDSTP1 , strap); -if ( (strap &SDR0_SDSTP1_PAE_MASK ) ==0 ) { -printf ("PCI: SDR0_STRP1[%08lX] - PCI Arbiter disabled.\n" ,strap); -return 0 ; - } - -return 1 ; -} -#endif /* defined(CONFIG_PCI) */ -#if defined(CONFIG_PCI )int board_pcie_card_present (int port) {
board/esd/du440/du440.c +0 -54
60 lines not on this page · raw message
board/esd/pmc440/pmc440.c +1 -59
72 lines not on this page · raw message
board/gdsys/gdppc440etx/gdppc440etx.c +4 -45
65 lines not on this page · raw message
board/korat/korat.c +1 -59
72 lines not on this page · raw message
board/lwmon5/lwmon5.c +0 -55
61 lines not on this page · raw message
board/pcs440ep/pcs440ep.c +0 -55
61 lines not on this page · raw message
board/prodrive/alpr/alpr.c +7 -27
@@ -29,6 +29,7 @@#include <ppc4xx_enet.h> #include <miiphy.h> #include <asm/processor.h> +#include <asm/4xx_pci.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -144,39 +145,20 @@ int checkboard (void)return (0 ); } -/************************************************************************* -* pci_pre_init -* -* This routine is called just prior to registering the hose and gives -* the board the opportunity to check things. Returning a value of zero -* indicates that things are bad & PCI initialization should be aborted. -* -* Different boards may wish to customize the pci controller structure -* (add regions, override default access routines, etc) or perform -* certain pre-initialization actions. -* -************************************************************************/ #if defined(CONFIG_PCI ) -int pci_pre_init (struct pci_controller * hose ) +/* +* Override weak pci_pre_init() +*/ +int pci_pre_init (struct pci_controller *hose) { -unsigned long strap; - -/*--------------------------------------------------------------------------+ -* The ocotea board is always configured as the host & requires the -* PCI arbiter to be enabled. -*--------------------------------------------------------------------------*/ -mfsdr (SDR0_SDSTP1 , strap); -if ( (strap &SDR0_SDSTP1_PAE_MASK ) ==0 ){ -printf ("PCI: SDR0_STRP1[%08lX] - PCI Arbiter disabled.\n" ,strap); +if (__pci_pre_init (hose) ==0 )return 0 ; - }/* FPGA Init */ -alpr_fpga_init (); +alpr_fpga_init ();return 1 ; } -#endif /* defined(CONFIG_PCI) */ /************************************************************************* * Override weak is_pci_host()
@@ -193,8 +175,6 @@ int pci_pre_init(struct pci_controller * hose )* * ************************************************************************/ -#if defined(CONFIG_PCI ) -static void wait_for_pci_ready (void ) {/*
board/prodrive/p3p440/p3p440.c +0 -31
@@ -165,37 +165,6 @@ int misc_init_r (void) }/************************************************************************* -* pci_pre_init -* -* This routine is called just prior to registering the hose and gives -* the board the opportunity to check things. Returning a value of zero -* indicates that things are bad & PCI initialization should be aborted. -* -* Different boards may wish to customize the pci controller structure -* (add regions, override default access routines, etc) or perform -* certain pre-initialization actions. -* -************************************************************************/ -#if defined(CONFIG_PCI ) -int pci_pre_init (struct pci_controller *hose) -{ -unsigned long strap; - -/*--------------------------------------------------------------------------+ -* The P3P440 board is always configured as the host & requires the -* PCI arbiter to be disabled because it's an PMC module. -*--------------------------------------------------------------------------*/ - strap =mfdcr (CPC0_STRP1 ); -if (strap &0x00100000 ) { -printf ("PCI: CPC0_STRP1[PAE] set.\n" ); -return 0 ; - } - -return 1 ; -} -#endif /* defined(CONFIG_PCI) */ - -/************************************************************************* * Override weak is_pci_host() * * This routine is called to determine if a pci scan should be
board/sandburst/common/sb_common.c +0 -32
@@ -300,38 +300,6 @@ long int fixed_sdram (void) }#endif /* !defined(CONFIG_SPD_EEPROM) */ - -/************************************************************************* -* pci_pre_init -* -* This routine is called just prior to registering the hose and gives -* the board the opportunity to check things. Returning a value of zero -* indicates that things are bad & PCI initialization should be aborted. -* -* Different boards may wish to customize the pci controller structure -* (add regions, override default access routines, etc) or perform -* certain pre-initialization actions. -* -************************************************************************/ -#if defined(CONFIG_PCI ) -int pci_pre_init (struct pci_controller * hose ) -{ -unsigned long strap; - -/*--------------------------------------------------------------------------+ -* The metrobox is always configured as the host & requires the -* PCI arbiter to be enabled. -*--------------------------------------------------------------------------*/ -mfsdr (SDR0_SDSTP1 , strap); -if ( (strap &SDR0_SDSTP1_PAE_MASK ) ==0 ){ -printf ("PCI: SDR0_STRP1[%08lX] - PCI Arbiter disabled.\n" ,strap); -return 0 ; - } - -return 1 ; -} -#endif /* defined(CONFIG_PCI) */ -/************************************************************************* * board_get_enetaddr *
board/xes/xpedite1000/xpedite1000.c +2 -1
@@ -136,6 +136,8 @@ phys_size_t initdram(int board_type) }/* +* Override weak pci_pre_init() +* * This routine is called just prior to registering the hose and gives * the board the opportunity to check things. Returning a value of zero * indicates that things are bad & PCI initialization should be aborted.
@@ -144,7 +146,6 @@ phys_size_t initdram(int board_type)* (add regions, override default access routines, etc) or perform * certain pre-initialization actions. */ -#if defined(CONFIG_PCI )int pci_pre_init (struct pci_controller * hose) {
cpu/ppc4xx/4xx_pci.c +103 -22
188 lines not on this page · raw message
cpu/ppc4xx/cpu.c +1 -1
@@ -81,7 +81,7 @@ static int pci_async_enabled(void)#if defined(CONFIG_PCI ) && !defined(CONFIG_IOP480 ) && \ !defined(CONFIG_405 ) && !defined(CONFIG_405EX ) -static int pci_arbiter_enabled (void ) +int pci_arbiter_enabled (void ) {#if defined(CONFIG_405GP )return (mfdcr (CPC0_PSR ) &PSR_PCI_ARBIT_EN );
include/asm-ppc/4xx_pci.h +5 -0
@@ -1,6 +1,8 @@#ifndef _405GP_PCI_H#define _405GP_PCI_H +#include <pci.h> +/*----------------------------------------------------------------------------+ | 405GP PCI core memory map defines. +----------------------------------------------------------------------------*/
@@ -49,6 +51,9 @@#define PCIDEVID_405GP 0x0 +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);#endif
include/configs/PMC440.h +1 -0
@@ -435,6 +435,7 @@/* Board-specific PCI */ #define CONFIG_SYS_PCI_TARGET_INIT #define CONFIG_SYS_PCI_MASTER_INIT +#define CONFIG_SYS_PCI_BOARD_FIXUP_IRQ /* PCI identification */ #define CONFIG_SYS_PCI_SUBSYS_VENDORID 0x12FE/* PCI Vendor ID: esd gmbh */
include/configs/korat.h +1 -0
@@ -360,6 +360,7 @@/* Board-specific PCI */ #define CONFIG_SYS_PCI_TARGET_INIT #define CONFIG_SYS_PCI_MASTER_INIT +#define CONFIG_SYS_PCI_BOARD_FIXUP_IRQ #define CONFIG_SYS_PCI_SUBSYS_VENDORID 0x10e8/* AMCC */ #define CONFIG_SYS_PCI_SUBSYS_ID 0xcafe/* Whatever */
include/configs/sequoia.h +1 -0
@@ -364,6 +364,7 @@/* Board-specific PCI */ #define CONFIG_SYS_PCI_TARGET_INIT #define CONFIG_SYS_PCI_MASTER_INIT +#define CONFIG_SYS_PCI_BOARD_FIXUP_IRQ #define CONFIG_SYS_PCI_SUBSYS_VENDORID 0x10e8/* AMCC */ #define CONFIG_SYS_PCI_SUBSYS_ID 0xcafe/* Whatever */
include/ppc440.h +2 -1
@@ -1276,7 +1276,8 @@#define CPC0_STRP1_PAE_MASK (0x80000000 >> 11)#define CPC0_STRP1_PISE_MASK (0x80000000 >> 13)#endif /* defined(CONFIG_440GP) */ -#if defined(CONFIG_440GX ) || defined(CONFIG_440SP ) +#if defined(CONFIG_440GX ) || defined(CONFIG_440SP ) || \ + defined(CONFIG_460EX ) || defined(CONFIG_460GT )#define SDR0_SDSTP1_PAE_MASK (0x80000000 >> 13)#define SDR0_SDSTP1_PISE_MASK (0x80000000 >> 15)#endif /* defined(CONFIG_440GX) || defined(CONFIG_440SP) */
Signature · 1 line
1.6.5.2
PATCH 2/3 ppc4xx: Consolidate pci_pre_init() function
Quoted 4 lines · On Friday 13 November 2009 11:24:06 Stefan Roese wrote:
This patch removes the duplicted implementations of the
pci_pre_init()function by introducing a weak default function for it. This weak default has a different implementation for some PPC variants. It can be overridden by a board specific version.
Applied to u-boot-ppc4xx/next. Thanks.
Cheers,
Stefan
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de