diff options
author | Icarus Chau <ichau@broadcom.com> | 2015-02-13 15:16:37 -0800 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2015-04-22 08:40:04 +0200 |
commit | d5f551a82a5d6f5c54798094c00ad606ca9d6807 (patch) | |
tree | 29ae658dd4c19a4bf98b4f1a0a1d3b51c968010f /src/soc/broadcom/cygnus/sdram.c | |
parent | 1abb6002ddc84dd6f2dc01e76475480445fa4271 (diff) |
broadcom/cygnus: Initialize dram in romstage.
BUG=chrome-os-partner:36456
BRANCH=broadcom-firmware
TEST=When enable configuration CYGNUS_SDRAM_TEST_DDR,
print on console:
sdram initialization is completed.
test ddr start from 0x60000000 to 0x80000000
...
test ddr end: fail=0
Translation table is @ 02004000
Mapping address range [0x00000000:0x00000000) as uncached
Change-Id: I88dc2f0c504e2a152133edd442c3d776dd73d37e
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 376471751d6980f99bbe47faad193c79a05fa69f
Original-Signed-off-by: Icarus Chau <ichau@broadcom.com>
Original-Reviewed-on: https://chrome-internal-review.googlesource.com/199775
Original-Commit-Queue: <ichau@broadcom.com>
Original-Tested-by: <ichau@broadcom.com>
Original-Reviewed-by: Scott Branden <sbranden@broadcom.com>
Original-Change-Id: I47bc5d9ec147cc8bfbd893e8c0d7e5fc5e401771
Original-Reviewed-on: https://chromium-review.googlesource.com/256416
Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Original-Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Original-Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: http://review.coreboot.org/9853
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/soc/broadcom/cygnus/sdram.c')
-rw-r--r-- | src/soc/broadcom/cygnus/sdram.c | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/src/soc/broadcom/cygnus/sdram.c b/src/soc/broadcom/cygnus/sdram.c index d9b45c0d43..1642842e0c 100644 --- a/src/soc/broadcom/cygnus/sdram.c +++ b/src/soc/broadcom/cygnus/sdram.c @@ -17,9 +17,46 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include <console/console.h> +#include <symbols.h> #include <soc/sdram.h> +#define DRAM_TEST_LEN 0x8000000 + +static void test_ddr(void) +{ + if (IS_ENABLED(CONFIG_CYGNUS_SDRAM_TEST_DDR)) { + uint32_t *test_buffer = (uint32_t *) _dram; + uint32_t len = DRAM_TEST_LEN; + uint32_t i; + uint32_t fail_count = 0; + + printk(BIOS_INFO, "test ddr start from 0x%p to 0x%p\n", test_buffer, + test_buffer + len); + + for (i = 0; i < len; i++) + *(test_buffer + i) = i; + + for (i = 0; i < len; i++) { + int val = *(test_buffer + i); + + if ((i % 0x10000) == 0) + printk(BIOS_INFO, "#"); + + if (i != val) { + printk(BIOS_ERR, "\ntest_ddr: @ 0x%p: %d != %d\n", + test_buffer + i, i, val); + fail_count++; + } + } + printk(BIOS_INFO, "\ntest ddr end: fail=%d\n", fail_count); + } +} + void sdram_init(void) { - printk(BIOS_INFO, "sdram initialization is not implemented\n"); + printk(BIOS_INFO, "sdram initialization is in progress...\n"); + ddr_init2(); + printk(BIOS_INFO, "sdram initialization is completed.\n"); + + test_ddr(); } |