Commit 2b018150 authored by Alexander Potashev's avatar Alexander Potashev
Browse files

RT77788. k70-som: Set DDR setting R2RSAME to 3 to avoid memory corruptions

 * When Ethernet and/or LCD are extensively utilized, the DDR controller send
command to the memory chip very often, so that sometimes these commands go
back-to-back to one another. In this situation the value of the R2RSAME
parameter is taken into account by the DDR controller.
 * The necessary value for CR37[R2RSAME] was found experimentally. The K70
Reference Manual is very unclear on the exact meanings of delays set by the
fields of the DDR_CR37 register (including R2RSAME).
parent a3d8e7ce
......@@ -201,6 +201,7 @@ struct kinetis_ddr_regs {
* DDR Control Register 37 (DDR_CR37)
*/
#define KINETIS_DDR_CR37_R2WSAME_BITS 8
#define KINETIS_DDR_CR37_R2RSAME_BITS 0
/*
* DDR Control Register 38 (DDR_CR38)
*/
......@@ -573,6 +574,7 @@ int misc_init_r(void)
#define KINETIS_DDR_CMDAGE 255
#define KINETIS_DDR_AGECNT 255
#define KINETIS_DDR_R2WSAME 2
#define KINETIS_DDR_R2RSAME 3
#define KINETIS_DDR_RDDTENBAS 1
#define KINETIS_DDR_PHYRDLAT 6
#define KINETIS_DDR_PYWRLTBS 1
......@@ -720,7 +722,8 @@ int dram_init(void)
KINETIS_DDR->cr[30] = 0;
KINETIS_DDR->cr[34] = 0;
KINETIS_DDR->cr[37] =
(KINETIS_DDR_R2WSAME << KINETIS_DDR_CR37_R2WSAME_BITS);
(KINETIS_DDR_R2WSAME << KINETIS_DDR_CR37_R2WSAME_BITS) |
(KINETIS_DDR_R2RSAME << KINETIS_DDR_CR37_R2RSAME_BITS);
KINETIS_DDR->cr[38] =
(KINETIS_DDR_P0WRCNT << KINETIS_DDR_CR38_P0WRCNT_BITS);
KINETIS_DDR->cr[39] =
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment