blob: a5f4f8b7434f302563c47d822b2323920f92f87e [file] [log] [blame]
Hans de Goede56333be2015-01-21 16:14:00 +01001/* DRAM parameters for auto dram configuration on sun5i and sun7i */
Hans de Goede6c46c8e2015-01-17 22:31:30 +01002
3#include <common.h>
Simon Glass691d7192020-05-10 11:40:02 -06004#include <init.h>
Hans de Goede6c46c8e2015-01-17 22:31:30 +01005#include <asm/arch/dram.h>
6
7static struct dram_para dram_para = {
8 .clock = CONFIG_DRAM_CLK,
Siarhei Siamashka47e35012015-02-01 00:27:06 +02009 .mbus_clock = CONFIG_DRAM_MBUS_CLK,
Hans de Goede6c46c8e2015-01-17 22:31:30 +010010 .type = 3,
11 .rank_num = 1,
12 .density = 0,
13 .io_width = 0,
14 .bus_width = 0,
Hans de Goede6c46c8e2015-01-17 22:31:30 +010015 .zq = CONFIG_DRAM_ZQ,
Hans de Goede8975cdf2015-05-13 15:00:46 +020016 .odt_en = IS_ENABLED(CONFIG_DRAM_ODT_EN),
Hans de Goede6c46c8e2015-01-17 22:31:30 +010017 .size = 0,
Siarhei Siamashkad1336472015-02-01 00:27:05 +020018#ifdef CONFIG_DRAM_TIMINGS_VENDOR_MAGIC
19 .cas = 9,
Hans de Goede6c46c8e2015-01-17 22:31:30 +010020 .tpr0 = 0x42d899b7,
21 .tpr1 = 0xa090,
22 .tpr2 = 0x22a00,
Siarhei Siamashkad1336472015-02-01 00:27:05 +020023 .emr2 = 0x10,
24#else
25# include "dram_timings_sun4i.h"
Siarhei Siamashka47e35012015-02-01 00:27:06 +020026 .active_windowing = 1,
Siarhei Siamashkad1336472015-02-01 00:27:05 +020027#endif
Adam Sampson8d6e18d2015-02-23 20:44:10 +000028 .tpr3 = CONFIG_DRAM_TPR3,
Hans de Goede6c46c8e2015-01-17 22:31:30 +010029 .tpr4 = 0,
30 .tpr5 = 0,
31 .emr1 = CONFIG_DRAM_EMR1,
Hans de Goede6c46c8e2015-01-17 22:31:30 +010032 .emr3 = 0,
Siarhei Siamashka47e35012015-02-01 00:27:06 +020033 .dqs_gating_delay = CONFIG_DRAM_DQS_GATING_DELAY,
Hans de Goede6c46c8e2015-01-17 22:31:30 +010034};
35
36unsigned long sunxi_dram_init(void)
37{
38 return dramc_init(&dram_para);
39}