ppc4xx: Consolidate 4xx PCIe board specific configuration
PATCH 1/1 ppc4xx: Consolidate 4xx PCIe board specific configuration
This patch consolidates the PPC4xx board specific PCIe configuration code. This way the duplicated code is removed. Boards can implement a special, non standard behaviour (e.g. number of PCIe slots, etc) by overriding the weak default functions.
--- board/amcc/canyonlands/canyonlands.c | 74 +------------- board/amcc/katmai/katmai.c | 74 +------------- board/amcc/kilauea/kilauea.c | 77 ++------------ board/amcc/makalu/makalu.c | 67 ------------ board/amcc/yucca/yucca.c | 191 ++++++---------------------------- cpu/ppc4xx/4xx_pcie.c | 123 ++++++++++++++++++++++ include/configs/yucca.h | 8 ++ 7 files changed, 172 insertions(+), 442 deletions(-)
board/amcc/canyonlands/canyonlands.c +3 -71
@@ -383,84 +383,16 @@ int is_pci_host(struct pci_controller *hose) return (1); } -static struct pci_controller pcie_hose[2 ] = {{0 },{0 }}; - -void pcie_setup_hoses (int busno) +int board_pcie_first (void ) { -struct pci_controller *hose; -int i, bus; -int ret =0 ; -char *env; -unsigned int delay; -int start; - -/* -* assume we're called after the PCIX hose is initialized, which takes -* bus ID 0 and therefore start numbering PCIe's from 1. -*/ - bus = busno; -/* * Canyonlands with SATA enabled has only one PCIe slot * (2nd one). */ if (gd->board_type ==BOARD_CANYONLANDS_SATA ) - start =1 ; -else - start =0 ; - -for (i = start; i <=1 ; i++) { +return 1 ; -if (is_end_point (i)) - ret =ppc4xx_init_pcie_endport (i); -else - ret =ppc4xx_init_pcie_rootport (i); -if (ret == -ENODEV ) -continue ; -if (ret) { -printf ("PCIE%d: initialization as %s failed\n" , i, -is_end_point (i) ?"endpoint" :"root-complex" ); -continue ; - } - - hose = &pcie_hose[i]; - hose->first_busno = bus; - hose->last_busno = bus; - hose->current_busno = bus; - -/* setup mem resource */ -pci_set_region (hose->regions +0 , -CONFIG_SYS_PCIE_MEMBASE + i *CONFIG_SYS_PCIE_MEMSIZE , -CONFIG_SYS_PCIE_MEMBASE + i *CONFIG_SYS_PCIE_MEMSIZE , -CONFIG_SYS_PCIE_MEMSIZE , -PCI_REGION_MEM ); - hose->region_count =1 ; -pci_register_hose (hose); - -if (is_end_point (i)) { -ppc4xx_setup_pcie_endpoint (hose, i); -/* -* Reson for no scanning is endpoint can not generate -* upstream configuration accesses. -*/ - }else { -ppc4xx_setup_pcie_rootpoint (hose, i); - env =getenv ("pciscandelay" ); -if (env !=NULL ) { - delay =simple_strtoul (env,NULL ,10 ); -if (delay >5 ) -printf ("Warning, expect noticable delay before " -"PCIe scan due to 'pciscandelay' value!\n" ); -mdelay (delay *1000 ); - } - -/* -* Config access can only go down stream -*/ - hose->last_busno =pci_hose_scan (hose); - bus = hose->last_busno +1 ; - } - } +return 0 ; }#endif /* CONFIG_PCI */
board/amcc/katmai/katmai.c +1 -73
86 lines not on this page · raw message
board/amcc/kilauea/kilauea.c +7 -70
95 lines not on this page · raw message
board/amcc/makalu/makalu.c +0 -67
73 lines not on this page · raw message
board/amcc/yucca/yucca.c +30 -161
222 lines not on this page · raw message
cpu/ppc4xx/4xx_pcie.c +123 -0
129 lines not on this page · raw message
include/configs/yucca.h +8 -0
@@ -389,6 +389,11 @@#define FPGA_REG1A_PE_SELSOURCE_0 0x0002#define FPGA_REG1A_PE_SELSOURCE_1 0x0001 +#define FPGA_REG1A_GLED_ENCODE (n) (FPGA_REG1A_PE0_GLED >> (n)) +#define FPGA_REG1A_YLED_ENCODE (n) (FPGA_REG1A_PE0_YLED >> (n)) +#define FPGA_REG1A_PWRON_ENCODE (n) (FPGA_REG1A_PE0_PWRON >> (n)) +#define FPGA_REG1A_REFCLK_ENCODE (n) (FPGA_REG1A_PE0_REFCLK_ENABLE >> (n)) +/*----------------------------------------------------------------------------+ | PCIe Miscellaneous +----------------------------------------------------------------------------*/
@@ -407,6 +412,9 @@#define FPGA_REG1C_PE1_PERST 0x0008#define FPGA_REG1C_PE2_PERST 0x0004 +#define FPGA_REG1C_ROOTPOINT_ENCODE (n) (FPGA_REG1C_PE0_ROOTPOINT >> (n)) +#define FPGA_REG1C_PERST_ENCODE (n) (FPGA_REG1C_PE0_PERST >> (n)) +/*----------------------------------------------------------------------------+ | Defines +----------------------------------------------------------------------------*/
Signature · 1 line
1.6.5.1
PATCH 1/1 ppc4xx: Consolidate 4xx PCIe board specific configuration
Quoted 4 lines · On Thursday 29 October 2009 18:46:25 Stefan Roese wrote:
This patch consolidates the PPC4xx board specific PCIe configuration code. This way the duplicated code is removed. Boards can implement a special, non standard behaviour (e.g. number of PCIe slots, etc) by overriding the weak default functions.
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