From c71103f9dc66dfcce8ad6df942364043bf27ade8 Mon Sep 17 00:00:00 2001 From: Matthias Fuchs Date: Wed, 8 Jul 2009 13:43:23 +0200 Subject: ppc4xx: Make is_pci_host() available for all 440 and 405 CPUs Signed-off-by: Matthias Fuchs Signed-off-by: Stefan Roese diff --git a/include/common.h b/include/common.h index 7ba6187..a6c7c07 100644 --- a/include/common.h +++ b/include/common.h @@ -275,7 +275,8 @@ void pci_init_board(void); void pciinfo (int, int); #if defined(CONFIG_PCI) && (defined(CONFIG_4xx) && !defined(CONFIG_AP1000)) - int pci_pre_init (struct pci_controller * ); + int pci_pre_init (struct pci_controller *); + int is_pci_host (struct pci_controller *); #endif #if defined(CONFIG_PCI) && (defined(CONFIG_440) || defined(CONFIG_405EX)) @@ -285,7 +286,6 @@ void pciinfo (int, int); # if defined(CONFIG_SYS_PCI_MASTER_INIT) void pci_master_init (struct pci_controller *); # endif - int is_pci_host (struct pci_controller *); #if defined(CONFIG_440SPE) || \ defined(CONFIG_460EX) || defined(CONFIG_460GT) || \ defined(CONFIG_405EX) -- cgit v0.10.2 From 123f102ec093fba6967066acdf9beb637df2e2d1 Mon Sep 17 00:00:00 2001 From: Matthias Fuchs Date: Wed, 8 Jul 2009 13:43:55 +0200 Subject: ppc4xx: Move 405EP pci code from cpu_init_f() to __pci_pre_init() This patch moves some basic PCI initialisation from the 4xx cpu_init_f() to cpu/ppc4xx/4xx_pci.c. The original cpu_init_f() function enabled the 405EP's internal arbiter in all situations. Also the HCE bit in cpc0_pci is always set. The first is not really wanted for PCI adapter designs and the latter is a general bug for PCI adapter U-Boots. Because it enables PCI configuration by the system CPU even when the PCI configuration has not been setup by the 405EP. The one and only correct place is in pci_405gp_init() (see "Set HCE bit" comment). So for compatibility reasons the arbiter is still enabled in any case, but from weak pci_pre_init() so that it can be replaced by board specific code. Signed-off-by: Matthias Fuchs Signed-off-by: Stefan Roese diff --git a/cpu/ppc4xx/4xx_pci.c b/cpu/ppc4xx/4xx_pci.c index 31ca85d..33dd743 100644 --- a/cpu/ppc4xx/4xx_pci.c +++ b/cpu/ppc4xx/4xx_pci.c @@ -87,6 +87,20 @@ DECLARE_GLOBAL_DATA_PTR; */ int __pci_pre_init(struct pci_controller *hose) { +#if defined (CONFIG_405EP) + /* + * Enable the internal PCI arbiter by default. + * + * On 405EP CPUs the internal arbiter can be controlled + * by the I2C strapping EEPROM. If you want to do so + * or if you want to disable the arbiter pci_pre_init() + * must be reimplemented without enabling the arbiter. + * The arbiter is enabled in this place because of + * compatibility reasons. + */ + mtdcr(cpc0_pci, mfdcr(cpc0_pci) | CPC0_PCI_ARBIT_EN); +#endif /* CONFIG_405EP */ + return 1; } int pci_pre_init(struct pci_controller *hose) __attribute__((weak, alias("__pci_pre_init"))); diff --git a/cpu/ppc4xx/cpu_init.c b/cpu/ppc4xx/cpu_init.c index 577d33f..bbd795d 100644 --- a/cpu/ppc4xx/cpu_init.c +++ b/cpu/ppc4xx/cpu_init.c @@ -174,11 +174,6 @@ cpu_init_f (void) * Set EMAC noise filter bits */ mtdcr(cpc0_epctl, CPC0_EPRCSR_E0NFE | CPC0_EPRCSR_E1NFE); - - /* - * Enable the internal PCI arbiter - */ - mtdcr(cpc0_pci, mfdcr(cpc0_pci) | CPC0_PCI_HOST_CFG_EN | CPC0_PCI_ARBIT_EN); #endif /* CONFIG_405EP */ #if defined(CONFIG_SYS_4xx_GPIO_TABLE) -- cgit v0.10.2 From 632e9b671efb0a6c900499f7a49fe5b63292b5fc Mon Sep 17 00:00:00 2001 From: Matthias Fuchs Date: Wed, 8 Jul 2009 15:31:57 +0200 Subject: ppc4xx: Set default PCI device ID for 405EP boards Current code only sets the PCI vendor id to 0x1014 and leaved device id to 0x0000. Ths patch .... a) uses the correct PCI_VENDOR_ID_IBM macro for this b) sets the default device ID as stated in the UM to 0x0156 by using PCI_DEVICE_ID_IBM_405GP for this. Signed-off-by: Matthias Fuchs Signed-off-by: Stefan Roese diff --git a/cpu/ppc4xx/4xx_pci.c b/cpu/ppc4xx/4xx_pci.c index 33dd743..4b5d636 100644 --- a/cpu/ppc4xx/4xx_pci.c +++ b/cpu/ppc4xx/4xx_pci.c @@ -337,8 +337,15 @@ void pci_405gp_init(struct pci_controller *hose) } #endif -#if defined(CONFIG_405EP) /* on ppc405ep vendor id is not set */ - pci_write_config_word(PCIDEVID_405GP, PCI_VENDOR_ID, 0x1014); /* IBM */ +#if defined(CONFIG_405EP) + /* + * on ppc405ep vendor/device id is not set + * The user manual says 0x1014 (IBM) / 0x0156 (405GP!) + * are the correct values. + */ + pci_write_config_word(PCIDEVID_405GP, PCI_VENDOR_ID, PCI_VENDOR_ID_IBM); + pci_write_config_word(PCIDEVID_405GP, + PCI_DEVICE_ID, PCI_DEVICE_ID_IBM_405GP); #endif /* -- cgit v0.10.2