From f5577aae4aa9f245c4c67308fe0f7b3cecf61c93 Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Tue, 29 Aug 2006 08:04:32 +0200 Subject: Improve DIMM detection for AMCC Yucca 440SPe board Improved the memory DIMM detection for the Yucca 440SPe board for the case where a memory DIMM is falsely detected as present. This issue is seen on some AMCC Yucca 440SPe validation boards if only one 512MB memory DIMM is installed, i.e. DIMM slot 0 is populated and DIMM slot 1 is empty. In this case, U-Boot does not correctly detect that there is only one DIMM memory module installed and will falsely detect two DIMM memory modules are present and therefore U-Boot will not calculate the correct amount of total memory and u-boot will not booting up. Patch by Adam Graham, 24 Aug 2006 --- board/amcc/yucca/yucca.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'board/amcc/yucca/yucca.c') diff --git a/board/amcc/yucca/yucca.c b/board/amcc/yucca/yucca.c index af12839c2c..65f75756c4 100644 --- a/board/amcc/yucca/yucca.c +++ b/board/amcc/yucca/yucca.c @@ -562,10 +562,11 @@ int checkboard (void) static long int yucca_probe_for_dimms(void) { - long int dimm_installed[MAXDIMMS]; - long int dimm_num, probe_result; - long int dimms_found = 0; - uchar dimm_addr = IIC0_DIMM0_ADDR; + int dimm_installed[MAXDIMMS]; + int dimm_num, result; + int dimms_found = 0; + uchar dimm_addr = IIC0_DIMM0_ADDR; + uchar dimm_spd_data[MAX_SPD_BYTES]; for (dimm_num = 0; dimm_num < MAXDIMMS; dimm_num++) { /* check if there is a chip at the dimm address */ @@ -577,12 +578,28 @@ static long int yucca_probe_for_dimms(void) dimm_addr = IIC0_DIMM1_ADDR; break; } - probe_result = i2c_probe(dimm_addr); - if (probe_result == 0) { + result = i2c_probe(dimm_addr); + + memset(dimm_spd_data, 0, MAX_SPD_BYTES * sizeof(char)); + if (result == 0) { + /* read first byte of SPD data, if there is any data */ + result = i2c_read(dimm_addr, 0, 1, dimm_spd_data, 1); + + if (result == 0) { + result = dimm_spd_data[0]; + result = result > MAX_SPD_BYTES ? + MAX_SPD_BYTES : result; + result = i2c_read(dimm_addr, 0, 1, + dimm_spd_data, result); + } + } + + if ((result == 0) && + (dimm_spd_data[64] == MICRON_SPD_JEDEC_ID)) { dimm_installed[dimm_num] = TRUE; dimms_found++; - debug("DIMM slot %d: DDR2 SDRAM detected\n",dimm_num); + debug("DIMM slot %d: DDR2 SDRAM detected\n", dimm_num); } else { dimm_installed[dimm_num] = FALSE; debug("DIMM slot %d: Not populated or cannot sucessfully probe the DIMM\n", dimm_num); -- cgit From 2b393b0f0af8402ef43b25c1968bfd29714ddffa Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Tue, 29 Aug 2006 08:05:15 +0200 Subject: PCIe endpoint support for AMCC Yucca 440SPe board Patch by Tirumala R Marri, 26 Aug 2006 --- board/amcc/yucca/yucca.c | 80 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 75 insertions(+), 5 deletions(-) (limited to 'board/amcc/yucca/yucca.c') diff --git a/board/amcc/yucca/yucca.c b/board/amcc/yucca/yucca.c index 65f75756c4..cd175265f0 100644 --- a/board/amcc/yucca/yucca.c +++ b/board/amcc/yucca/yucca.c @@ -32,6 +32,10 @@ #include #include "yucca.h" +#include "../cpu/ppc4xx/440spe_pcie.h" + +#undef PCIE_ENDPOINT +/* #define PCIE_ENDPOINT 1 */ void fpga_init (void); @@ -583,12 +587,12 @@ static long int yucca_probe_for_dimms(void) memset(dimm_spd_data, 0, MAX_SPD_BYTES * sizeof(char)); if (result == 0) { - /* read first byte of SPD data, if there is any data */ + /* read first byte of SPD data, if there is any data */ result = i2c_read(dimm_addr, 0, 1, dimm_spd_data, 1); if (result == 0) { result = dimm_spd_data[0]; - result = result > MAX_SPD_BYTES ? + result = result > MAX_SPD_BYTES ? MAX_SPD_BYTES : result; result = i2c_read(dimm_addr, 0, 1, dimm_spd_data, result); @@ -596,7 +600,7 @@ static long int yucca_probe_for_dimms(void) } if ((result == 0) && - (dimm_spd_data[64] == MICRON_SPD_JEDEC_ID)) { + (dimm_spd_data[64] == MICRON_SPD_JEDEC_ID)) { dimm_installed[dimm_num] = TRUE; dimms_found++; debug("DIMM slot %d: DDR2 SDRAM detected\n", dimm_num); @@ -1029,6 +1033,57 @@ void yucca_setup_pcie_fpga_rootpoint(int port) out_be16((u16 *)FPGA_REG1C, reset_off | in_be16((u16 *)FPGA_REG1C)); } +/* + * For the given slot, set endpoint mode, send power to the slot, + * turn on the green LED and turn off the yellow LED, enable the clock + * .In end point mode reset bit is read only. + */ +void yucca_setup_pcie_fpga_endpoint(int port) +{ + u16 power, clock, green_led, yellow_led, reset_off, rootpoint, endpoint; + + switch(port) { + case 0: + rootpoint = FPGA_REG1C_PE0_ROOTPOINT; + endpoint = 0; + power = FPGA_REG1A_PE0_PWRON; + green_led = FPGA_REG1A_PE0_GLED; + clock = FPGA_REG1A_PE0_REFCLK_ENABLE; + yellow_led = FPGA_REG1A_PE0_YLED; + reset_off = FPGA_REG1C_PE0_PERST; + break; + case 1: + rootpoint = 0; + endpoint = FPGA_REG1C_PE1_ENDPOINT; + power = FPGA_REG1A_PE1_PWRON; + green_led = FPGA_REG1A_PE1_GLED; + clock = FPGA_REG1A_PE1_REFCLK_ENABLE; + yellow_led = FPGA_REG1A_PE1_YLED; + reset_off = FPGA_REG1C_PE1_PERST; + break; + case 2: + rootpoint = 0; + endpoint = FPGA_REG1C_PE2_ENDPOINT; + power = FPGA_REG1A_PE2_PWRON; + green_led = FPGA_REG1A_PE2_GLED; + clock = FPGA_REG1A_PE2_REFCLK_ENABLE; + yellow_led = FPGA_REG1A_PE2_YLED; + reset_off = FPGA_REG1C_PE2_PERST; + break; + + default: + return; + } + + out_be16((u16 *)FPGA_REG1A, + ~(power | clock | green_led) & + (yellow_led | in_be16((u16 *)FPGA_REG1A))); + + out_be16((u16 *)FPGA_REG1C, + ~(rootpoint | reset_off) & + (endpoint | in_be16((u16 *)FPGA_REG1C))); +} + static struct pci_controller pcie_hose[3] = {{0},{0},{0}}; @@ -1048,9 +1103,13 @@ void pcie_setup_hoses(void) if (!yucca_pcie_card_present(i)) continue; +#ifdef PCIE_ENDPOINT + yucca_setup_pcie_fpga_endpoint(i); + if (ppc440spe_init_pcie_endport(i)) { +#else yucca_setup_pcie_fpga_rootpoint(i); - if (ppc440spe_init_pcie_rootport(i)) { +#endif printf("PCIE%d: initialization failed\n", i); continue; } @@ -1070,8 +1129,19 @@ void pcie_setup_hoses(void) hose->region_count = 1; pci_register_hose(hose); - ppc440spe_setup_pcie(hose, i); +#ifdef PCIE_ENDPOINT + ppc440spe_setup_pcie_endpoint(hose, i); + /* + * Reson for no scanning is endpoint can not generate + * upstream configuration accesses. + */ +#else + ppc440spe_setup_pcie_rootpoint(hose, i); + /* + * Config access can only go down stream + */ hose->last_busno = pci_hose_scan(hose); +#endif } } #endif /* defined(CONFIG_PCI) */ -- cgit From 511d0c72b82aab9b807efde50fc9e390365f5ca1 Mon Sep 17 00:00:00 2001 From: Wolfgang Denk Date: Mon, 9 Oct 2006 00:42:01 +0200 Subject: Coding style cleanup --- board/amcc/yucca/yucca.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'board/amcc/yucca/yucca.c') diff --git a/board/amcc/yucca/yucca.c b/board/amcc/yucca/yucca.c index cd175265f0..e9b34dd249 100644 --- a/board/amcc/yucca/yucca.c +++ b/board/amcc/yucca/yucca.c @@ -958,7 +958,6 @@ int is_pci_host(struct pci_controller *hose) return 1; } - int yucca_pcie_card_present(int port) { u16 reg; @@ -1084,8 +1083,6 @@ void yucca_setup_pcie_fpga_endpoint(int port) (endpoint | in_be16((u16 *)FPGA_REG1C))); } - - static struct pci_controller pcie_hose[3] = {{0},{0},{0}}; void pcie_setup_hoses(void) -- cgit