From 38b16f0834e153e90332528f47b3483d3b65692c Mon Sep 17 00:00:00 2001 From: YouMin Chen Date: Wed, 22 Jul 2020 16:26:34 +0800 Subject: [PATCH] drivers: ram: rv1126: fix the timing about noc and controller 1. set the noc ddrtimingc0.b.wrtomwr for LPDDR4 2. set the noc ddrmode.b.mwrsize for LPDDR4 3. update the noc ddrmode.b.burstsize 4. update the controller timing for 328MHz 5. set ddr4timing to 0 except LPDDR4 6. calculate ddr4timing using *_L timing for DDR4 Change-Id: I9f8fae51a05f8547d64da262d4c69fd4edec79fb Signed-off-by: YouMin Chen --- .../rv1126/sdram-rv1126-ddr3-detect-1056.inc | 2 +- .../rv1126/sdram-rv1126-ddr3-detect-328.inc | 4 +-- .../rv1126/sdram-rv1126-ddr3-detect-396.inc | 2 +- .../rv1126/sdram-rv1126-ddr3-detect-528.inc | 2 +- .../rv1126/sdram-rv1126-ddr3-detect-664.inc | 2 +- .../rv1126/sdram-rv1126-ddr3-detect-784.inc | 2 +- .../rv1126/sdram-rv1126-ddr3-detect-924.inc | 2 +- .../rv1126/sdram-rv1126-ddr4-detect-1056.inc | 2 +- .../rv1126/sdram-rv1126-ddr4-detect-328.inc | 4 +-- .../rv1126/sdram-rv1126-ddr4-detect-396.inc | 2 +- .../rv1126/sdram-rv1126-ddr4-detect-528.inc | 2 +- .../rv1126/sdram-rv1126-ddr4-detect-664.inc | 2 +- .../rv1126/sdram-rv1126-ddr4-detect-784.inc | 2 +- .../rv1126/sdram-rv1126-ddr4-detect-924.inc | 2 +- .../sdram-rv1126-lpddr3-detect-1056.inc | 2 +- .../rv1126/sdram-rv1126-lpddr3-detect-328.inc | 4 +-- .../rv1126/sdram-rv1126-lpddr3-detect-396.inc | 4 +-- .../rv1126/sdram-rv1126-lpddr3-detect-528.inc | 2 +- .../rv1126/sdram-rv1126-lpddr3-detect-664.inc | 4 +-- .../rv1126/sdram-rv1126-lpddr3-detect-784.inc | 2 +- .../rv1126/sdram-rv1126-lpddr3-detect-924.inc | 4 +-- .../sdram-rv1126-lpddr4-detect-1056.inc | 8 +++--- .../rv1126/sdram-rv1126-lpddr4-detect-328.inc | 12 ++++----- .../rv1126/sdram-rv1126-lpddr4-detect-396.inc | 6 ++--- .../rv1126/sdram-rv1126-lpddr4-detect-528.inc | 6 ++--- .../rv1126/sdram-rv1126-lpddr4-detect-664.inc | 6 ++--- .../rv1126/sdram-rv1126-lpddr4-detect-784.inc | 6 ++--- .../rv1126/sdram-rv1126-lpddr4-detect-924.inc | 6 ++--- drivers/ram/rockchip/sdram_rv1126.c | 27 +++++++++++++++++++ 29 files changed, 79 insertions(+), 52 deletions(-) diff --git a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr3-detect-1056.inc b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr3-detect-1056.inc index 2cb613eb63..062f04d79a 100644 --- a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr3-detect-1056.inc +++ b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr3-detect-1056.inc @@ -19,7 +19,7 @@ {0x00000002}, {0x00001111}, {0x0000000c}, - {0x0000034a}, + {0x00000000}, 0x000000ff } }, diff --git a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr3-detect-328.inc b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr3-detect-328.inc index 5f9733b3a3..1276900cc4 100644 --- a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr3-detect-328.inc +++ b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr3-detect-328.inc @@ -19,7 +19,7 @@ {0x00000002}, {0x00001111}, {0x0000000c}, - {0x00000222}, + {0x00000000}, 0x000000ff } }, @@ -33,7 +33,7 @@ { { {0x00000000, 0x43041001}, /* MSTR */ - {0x00000064, 0x0028003a}, /* RFSHTMG */ + {0x00000064, 0x0027003a}, /* RFSHTMG */ {0x000000d0, 0x00020052}, /* INIT0 */ {0x000000d4, 0x00220000}, /* INIT1 */ {0x000000d8, 0x00000100}, /* INIT2 */ diff --git a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr3-detect-396.inc b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr3-detect-396.inc index 6984db1438..caefcc2f1d 100644 --- a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr3-detect-396.inc +++ b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr3-detect-396.inc @@ -19,7 +19,7 @@ {0x00000002}, {0x00001111}, {0x0000000c}, - {0x00000222}, + {0x00000000}, 0x000000ff } }, diff --git a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr3-detect-528.inc b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr3-detect-528.inc index ff4dd08a7f..362585ce46 100644 --- a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr3-detect-528.inc +++ b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr3-detect-528.inc @@ -19,7 +19,7 @@ {0x00000002}, {0x00001111}, {0x0000000c}, - {0x0000032a}, + {0x00000000}, 0x000000ff } }, diff --git a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr3-detect-664.inc b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr3-detect-664.inc index e74a4810d1..06bd9ef295 100644 --- a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr3-detect-664.inc +++ b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr3-detect-664.inc @@ -19,7 +19,7 @@ {0x00000002}, {0x00001111}, {0x0000000c}, - {0x00000232}, + {0x00000000}, 0x000000ff } }, diff --git a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr3-detect-784.inc b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr3-detect-784.inc index 377dc39aa9..5cce6903f7 100644 --- a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr3-detect-784.inc +++ b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr3-detect-784.inc @@ -19,7 +19,7 @@ {0x00000002}, {0x00001111}, {0x0000000c}, - {0x0000033a}, + {0x00000000}, 0x000000ff } }, diff --git a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr3-detect-924.inc b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr3-detect-924.inc index 63ea151af4..3aeb91bb3c 100644 --- a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr3-detect-924.inc +++ b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr3-detect-924.inc @@ -19,7 +19,7 @@ {0x00000002}, {0x00001111}, {0x0000000c}, - {0x00000342}, + {0x00000000}, 0x000000ff } }, diff --git a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr4-detect-1056.inc b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr4-detect-1056.inc index dc438c004b..295b0871e0 100644 --- a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr4-detect-1056.inc +++ b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr4-detect-1056.inc @@ -19,7 +19,7 @@ {0x00000002}, {0x00001111}, {0x0000000c}, - {0x0000033a}, + {0x0000034b}, 0x000000ff } }, diff --git a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr4-detect-328.inc b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr4-detect-328.inc index 3b61adfb38..4b424fb440 100644 --- a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr4-detect-328.inc +++ b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr4-detect-328.inc @@ -19,7 +19,7 @@ {0x00000002}, {0x00001111}, {0x0000000c}, - {0x0000022a}, + {0x00000232}, 0x000000ff } }, @@ -33,7 +33,7 @@ { { {0x00000000, 0x43049010}, /* MSTR */ - {0x00000064, 0x0028003a}, /* RFSHTMG */ + {0x00000064, 0x0027003a}, /* RFSHTMG */ {0x000000d0, 0x00020052}, /* INIT0 */ {0x000000d4, 0x00220000}, /* INIT1 */ {0x000000d8, 0x00000100}, /* INIT2 */ diff --git a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr4-detect-396.inc b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr4-detect-396.inc index 1901e0c4a3..980be8cf18 100644 --- a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr4-detect-396.inc +++ b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr4-detect-396.inc @@ -19,7 +19,7 @@ {0x00000002}, {0x00001111}, {0x0000000c}, - {0x0000022a}, + {0x00000232}, 0x000000ff } }, diff --git a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr4-detect-528.inc b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr4-detect-528.inc index ad082449c6..3bde055e8d 100644 --- a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr4-detect-528.inc +++ b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr4-detect-528.inc @@ -19,7 +19,7 @@ {0x00000002}, {0x00001111}, {0x0000000c}, - {0x0000022a}, + {0x00000232}, 0x000000ff } }, diff --git a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr4-detect-664.inc b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr4-detect-664.inc index 2cc463782b..c9341166d6 100644 --- a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr4-detect-664.inc +++ b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr4-detect-664.inc @@ -19,7 +19,7 @@ {0x00000002}, {0x00001111}, {0x0000000c}, - {0x0000022a}, + {0x0000023a}, 0x000000ff } }, diff --git a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr4-detect-784.inc b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr4-detect-784.inc index 38cbe4ebaf..ef2e9347bf 100644 --- a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr4-detect-784.inc +++ b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr4-detect-784.inc @@ -19,7 +19,7 @@ {0x00000002}, {0x00001111}, {0x0000000c}, - {0x0000022a}, + {0x0000033a}, 0x000000ff } }, diff --git a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr4-detect-924.inc b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr4-detect-924.inc index a3dec3ac7e..acb33bd315 100644 --- a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr4-detect-924.inc +++ b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-ddr4-detect-924.inc @@ -19,7 +19,7 @@ {0x00000002}, {0x00001111}, {0x0000000c}, - {0x00000232}, + {0x00000342}, 0x000000ff } }, diff --git a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr3-detect-1056.inc b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr3-detect-1056.inc index b67ab876fc..41eecc7fda 100644 --- a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr3-detect-1056.inc +++ b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr3-detect-1056.inc @@ -19,7 +19,7 @@ {0x00000002}, {0x00001111}, {0x0000000c}, - {0x00000542}, + {0x00000000}, 0x000000ff } }, diff --git a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr3-detect-328.inc b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr3-detect-328.inc index 24025d6dde..bf0dde78c2 100644 --- a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr3-detect-328.inc +++ b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr3-detect-328.inc @@ -15,11 +15,11 @@ }, { {0x290a060a}, - {0x08020303}, + {0x08020403}, {0x00000002}, {0x00001111}, {0x0000000c}, - {0x0000021a}, + {0x00000000}, 0x000000ff } }, diff --git a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr3-detect-396.inc b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr3-detect-396.inc index fb1468e83b..798c9866f1 100644 --- a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr3-detect-396.inc +++ b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr3-detect-396.inc @@ -15,11 +15,11 @@ }, { {0x2b0d080d}, - {0x0a020303}, + {0x0a020403}, {0x00000002}, {0x00001111}, {0x0000000c}, - {0x0000021a}, + {0x00000000}, 0x000000ff } }, diff --git a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr3-detect-528.inc b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr3-detect-528.inc index d6df8fde6b..8d40a7c837 100644 --- a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr3-detect-528.inc +++ b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr3-detect-528.inc @@ -19,7 +19,7 @@ {0x00000002}, {0x00001111}, {0x0000000c}, - {0x00000322}, + {0x00000000}, 0x000000ff } }, diff --git a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr3-detect-664.inc b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr3-detect-664.inc index 64557fc4a1..c58be2c921 100644 --- a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr3-detect-664.inc +++ b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr3-detect-664.inc @@ -15,11 +15,11 @@ }, { {0x32150d15}, - {0x11030504}, + {0x11030604}, {0x00000002}, {0x00001111}, {0x0000000c}, - {0x0000032a}, + {0x00000000}, 0x000000ff } }, diff --git a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr3-detect-784.inc b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr3-detect-784.inc index fa5d142e4d..9ca6685f43 100644 --- a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr3-detect-784.inc +++ b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr3-detect-784.inc @@ -19,7 +19,7 @@ {0x00000002}, {0x00001111}, {0x0000000c}, - {0x00000432}, + {0x00000000}, 0x000000ff } }, diff --git a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr3-detect-924.inc b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr3-detect-924.inc index 5ac7700482..c32a6de289 100644 --- a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr3-detect-924.inc +++ b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr3-detect-924.inc @@ -15,11 +15,11 @@ }, { {0x391d141d}, - {0x17050706}, + {0x17050806}, {0x00000002}, {0x00001111}, {0x0000000c}, - {0x0000053a}, + {0x00000000}, 0x000000ff } }, diff --git a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr4-detect-1056.inc b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr4-detect-1056.inc index 0f9624a18a..04f1a3eab2 100644 --- a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr4-detect-1056.inc +++ b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr4-detect-1056.inc @@ -15,11 +15,11 @@ }, { {0x41241522}, - {0x15050a07}, - {0x00000002}, + {0x15050b07}, + {0x00000602}, {0x00001111}, - {0x0000000c}, - {0x00000554}, + {0x00000054}, + {0x00000000}, 0x000000ff } }, diff --git a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr4-detect-328.inc b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr4-detect-328.inc index ecdfc45ac2..dc1186e76e 100644 --- a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr4-detect-328.inc +++ b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr4-detect-328.inc @@ -16,10 +16,10 @@ { {0x2f0d060a}, {0x07020804}, - {0x00000002}, + {0x00000602}, {0x00001111}, - {0x0000000c}, - {0x00000244}, + {0x00000054}, + {0x00000000}, 0x000000ff } }, @@ -33,8 +33,8 @@ { { {0x00000000, 0x81081020}, /* MSTR */ - {0x00000064, 0x0014002f}, /* RFSHTMG */ - {0x000000d0, 0x00020144}, /* INIT0 */ + {0x00000064, 0x0014002e}, /* RFSHTMG */ + {0x000000d0, 0x00020142}, /* INIT0 */ {0x000000d4, 0x00220000}, /* INIT1 */ {0x000000d8, 0x00000202}, /* INIT2 */ {0x000000dc, 0x00240012}, /* INIT3 */ @@ -54,7 +54,7 @@ {0x00000130, 0x00020000}, /* DRAMTMG12 */ {0x00000134, 0x00100002}, /* DRAMTMG13 */ {0x00000138, 0x00000030}, /* DRAMTMG14 */ - {0x00000180, 0x00a500a5}, /* ZQCTL0 */ + {0x00000180, 0x00a400a4}, /* ZQCTL0 */ {0x00000184, 0x00900000}, /* ZQCTL1 */ {0x00000190, 0x07040000}, /* DFITMG0 */ {0x00000198, 0x07000101}, /* DFILPCFG0 */ diff --git a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr4-detect-396.inc b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr4-detect-396.inc index c83f5090dd..bac8148b8e 100644 --- a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr4-detect-396.inc +++ b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr4-detect-396.inc @@ -16,10 +16,10 @@ { {0x3110080d}, {0x08020804}, - {0x00000002}, + {0x00000602}, {0x00001111}, - {0x0000000c}, - {0x00000244}, + {0x00000054}, + {0x00000000}, 0x000000ff } }, diff --git a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr4-detect-528.inc b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr4-detect-528.inc index e54edd3219..b4cb969fd4 100644 --- a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr4-detect-528.inc +++ b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr4-detect-528.inc @@ -16,10 +16,10 @@ { {0x34140b11}, {0x0b030804}, - {0x00000002}, + {0x00000602}, {0x00001111}, - {0x0000000c}, - {0x00000344}, + {0x00000054}, + {0x00000000}, 0x000000ff } }, diff --git a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr4-detect-664.inc b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr4-detect-664.inc index a4b885d2cb..95ee2d8d12 100644 --- a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr4-detect-664.inc +++ b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr4-detect-664.inc @@ -16,10 +16,10 @@ { {0x36170d15}, {0x0d030805}, - {0x00000002}, + {0x00000602}, {0x00001111}, - {0x0000000c}, - {0x00000344}, + {0x00000054}, + {0x00000000}, 0x000000ff } }, diff --git a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr4-detect-784.inc b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr4-detect-784.inc index eb7a6bd047..e968b086ef 100644 --- a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr4-detect-784.inc +++ b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr4-detect-784.inc @@ -16,10 +16,10 @@ { {0x391b1019}, {0x10040805}, - {0x00000002}, + {0x00000602}, {0x00001111}, - {0x0000000c}, - {0x00000444}, + {0x00000054}, + {0x00000000}, 0x000000ff } }, diff --git a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr4-detect-924.inc b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr4-detect-924.inc index a40cca12a2..fc02f0d5cc 100644 --- a/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr4-detect-924.inc +++ b/drivers/ram/rockchip/sdram_inc/rv1126/sdram-rv1126-lpddr4-detect-924.inc @@ -16,10 +16,10 @@ { {0x3e20121d}, {0x12050a07}, - {0x00000002}, + {0x00000602}, {0x00001111}, - {0x0000000c}, - {0x00000554}, + {0x00000054}, + {0x00000000}, 0x000000ff } }, diff --git a/drivers/ram/rockchip/sdram_rv1126.c b/drivers/ram/rockchip/sdram_rv1126.c index 075567cd9f..c4821ba009 100644 --- a/drivers/ram/rockchip/sdram_rv1126.c +++ b/drivers/ram/rockchip/sdram_rv1126.c @@ -1997,6 +1997,32 @@ static void set_ddrconfig(struct dram_info *dram, u32 ddrconfig) static void update_noc_timing(struct dram_info *dram, struct rv1126_sdram_params *sdram_params) { + void __iomem *pctl_base = dram->pctl; + u32 bw, bl; + + bw = 8 << sdram_params->ch.cap_info.bw; + bl = ((readl(pctl_base + DDR_PCTL2_MSTR) >> 16) & 0xf) * 2; + + /* update the noc timing related to data bus width */ + if ((bw / 8 * bl) == 16) + sdram_params->ch.noc_timings.ddrmode.b.burstsize = 0; + else if ((bw / 8 * bl) == 32) + sdram_params->ch.noc_timings.ddrmode.b.burstsize = 1; + else if ((bw / 8 * bl) == 64) + sdram_params->ch.noc_timings.ddrmode.b.burstsize = 2; + else + sdram_params->ch.noc_timings.ddrmode.b.burstsize = 3; + + sdram_params->ch.noc_timings.ddrtimingc0.b.burstpenalty = + (bw == 32) ? 2 : ((bw == 16) ? 4 : 8); + + if (sdram_params->base.dramtype == LPDDR4) { + sdram_params->ch.noc_timings.ddrmode.b.mwrsize = + (bw == 16) ? 0x1 : 0x2; + sdram_params->ch.noc_timings.ddrtimingc0.b.wrtomwr = + 3 * sdram_params->ch.noc_timings.ddrtimingc0.b.burstpenalty; + } + writel(sdram_params->ch.noc_timings.ddrtiminga0.d32, &dram->msch->ddrtiminga0); writel(sdram_params->ch.noc_timings.ddrtimingb0.d32, @@ -2772,6 +2798,7 @@ void ddr_set_rate(struct dram_info *dram, lp_stat = low_power_update(dram, 0); sdram_params_new = get_default_sdram_config(freq); sdram_params_new->ch.cap_info.rank = sdram_params->ch.cap_info.rank; + sdram_params_new->ch.cap_info.bw = sdram_params->ch.cap_info.bw; pre_set_rate(dram, sdram_params_new, dst_fsp, dst_fsp_lp4);