diff options
author | Max Krummenacher <max.krummenacher@toradex.com> | 2014-09-04 14:11:33 +0200 |
---|---|---|
committer | Max Krummenacher <max.krummenacher@toradex.com> | 2014-09-04 14:20:45 +0200 |
commit | bdb4d2c1a30dadf0a812aa84827f7c3794ab2b75 (patch) | |
tree | 0fa8824b772b0e701c1b86a41bb51c5f7d063489 | |
parent | 71ba57a64013fc6555e01c19a763b98382683dab (diff) |
colibri_imx6.c: add patch_ddr_size cmd
Adds the patch_ddr_size cmd which patches the DCD data structure
settings for the DDR memory controller optimized for the module.
Currently this is only the bus width which is changed from 32bit
to 64bit on DL modules.
This allows to use a unified U-Boot for S and DL modules. Right after
flashing the U-Boot to eMMC this cmd will be run to complete the
update.
-rw-r--r-- | board/toradex/colibri_imx6/colibri_imx6.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/board/toradex/colibri_imx6/colibri_imx6.c b/board/toradex/colibri_imx6/colibri_imx6.c index ae7e9c27fca..21b9592af70 100644 --- a/board/toradex/colibri_imx6/colibri_imx6.c +++ b/board/toradex/colibri_imx6/colibri_imx6.c @@ -786,3 +786,46 @@ int misc_init_r(void) #endif return 0; } + +/* On Colibri iMX6 the DDR bus width depends on the CPU type + * With Solo it is 32bit, with Dual Light 64 bit. + * U-Boot is configured to use 32bit on both models which works. + * This commands patches this so that on subsequent boots a DL + * will use 64bit and thus all stuffed memory + */ +int do_patch_ddr_size(cmd_tbl_t *cmdtp, int flag, int argc, + char * const argv[]) +{ + char *ivt; + struct mmc *mmc; + int ret = 0; + + ivt = memalign(ARCH_DMA_MINALIGN, 1024); + if (ivt != NULL) { + /* read IVT */ + mmc = find_mmc_device(0); + ret = mmc->block_dev.block_read(0, 2, 2, ivt); + + /* FIXME: Parse IVT to find DCD, parse DCD to find correct write addr */ + if(ret == 2) { + + + if(is_cpu_type(MXC_CPU_MX6DL) && (ivt[0x215] == 0x19)) { + ivt[0x215] = 0x1a; + ret = mmc->block_dev.block_write(0, 2, 2, ivt); + puts("patched, "); + } + } + } + if(ret == 2) + puts("done.\n"); + else + puts("failed.\n"); + return 0; +} + +U_BOOT_CMD( + patch_ddr_size, 1, 0, do_patch_ddr_size, + "Patch the DCD table to the right ddr size depending on CPU type\n", + "" +); |