blob: 93789fd456535b56b92ab00b9c41ee58d9a34a40 [file] [log] [blame]
Khoronzhuk, Ivan50df5cc2014-07-09 19:48:40 +03001/*
2 * DDR3
3 *
4 * (C) Copyright 2014
5 * Texas Instruments Incorporated, <www.ti.com>
6 *
7 * SPDX-License-Identifier: GPL-2.0+
8 */
9
10#ifndef _DDR3_H_
11#define _DDR3_H_
12
13#include <asm/arch/hardware.h>
14
15struct ddr3_phy_config {
16 unsigned int pllcr;
17 unsigned int pgcr1_mask;
18 unsigned int pgcr1_val;
19 unsigned int ptr0;
20 unsigned int ptr1;
21 unsigned int ptr2;
22 unsigned int ptr3;
23 unsigned int ptr4;
24 unsigned int dcr_mask;
25 unsigned int dcr_val;
26 unsigned int dtpr0;
27 unsigned int dtpr1;
28 unsigned int dtpr2;
29 unsigned int mr0;
30 unsigned int mr1;
31 unsigned int mr2;
32 unsigned int dtcr;
33 unsigned int pgcr2;
34 unsigned int zq0cr1;
35 unsigned int zq1cr1;
36 unsigned int zq2cr1;
37 unsigned int pir_v1;
Cooper Jr., Franklin369234e2017-06-16 17:25:19 -050038 unsigned int datx8_2_mask;
39 unsigned int datx8_2_val;
40 unsigned int datx8_3_mask;
41 unsigned int datx8_3_val;
42 unsigned int datx8_4_mask;
43 unsigned int datx8_4_val;
44 unsigned int datx8_5_mask;
45 unsigned int datx8_5_val;
46 unsigned int datx8_6_mask;
47 unsigned int datx8_6_val;
48 unsigned int datx8_7_mask;
49 unsigned int datx8_7_val;
50 unsigned int datx8_8_mask;
51 unsigned int datx8_8_val;
Khoronzhuk, Ivan50df5cc2014-07-09 19:48:40 +030052 unsigned int pir_v2;
53};
54
55struct ddr3_emif_config {
56 unsigned int sdcfg;
57 unsigned int sdtim1;
58 unsigned int sdtim2;
59 unsigned int sdtim3;
60 unsigned int sdtim4;
61 unsigned int zqcfg;
62 unsigned int sdrfc;
63};
64
Vitaly Andrianovead26f62016-03-04 10:36:42 -060065struct ddr3_spd_cb {
66 char dimm_name[32];
67 struct ddr3_phy_config phy_cfg;
68 struct ddr3_emif_config emif_cfg;
69 unsigned int ddrspdclock;
70 int ddr_size_gbyte;
71};
72
Vitaly Andrianova9554d62015-02-11 14:07:58 -050073u32 ddr3_init(void);
Hao Zhangd6c508c2014-07-09 19:48:41 +030074void ddr3_reset_ddrphy(void);
Vitaly Andrianova9554d62015-02-11 14:07:58 -050075void ddr3_init_ecc(u32 base, u32 ddr3_size);
Vitaly Andrianov19173012014-10-22 17:47:58 +030076void ddr3_disable_ecc(u32 base);
77void ddr3_check_ecc_int(u32 base);
78int ddr3_ecc_support_rmw(u32 base);
Murali Karicheri39f45202014-09-10 15:54:59 +030079void ddr3_err_reset_workaround(void);
Vitaly Andrianov19173012014-10-22 17:47:58 +030080void ddr3_enable_ecc(u32 base, int test);
Khoronzhuk, Ivan50df5cc2014-07-09 19:48:40 +030081void ddr3_init_ddrphy(u32 base, struct ddr3_phy_config *phy_cfg);
82void ddr3_init_ddremif(u32 base, struct ddr3_emif_config *emif_cfg);
Vitaly Andrianov539de5f2016-03-04 10:36:43 -060083int ddr3_get_size(void);
Khoronzhuk, Ivan50df5cc2014-07-09 19:48:40 +030084
85#endif