blob: 2c589eb3a6558b3cc0233845785071e1e248082a [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0 */
Stefan Roese5ffceb82015-03-26 15:36:56 +01002/*
3 * Copyright (C) Marvell International Ltd. and its affiliates
Stefan Roese5ffceb82015-03-26 15:36:56 +01004 */
5
6#ifndef _DDR_TOPOLOGY_DEF_H
7#define _DDR_TOPOLOGY_DEF_H
8
9#include "ddr3_training_ip_def.h"
10#include "ddr3_topology_def.h"
11
Chris Packham1a07d212018-05-10 13:28:29 +120012#if defined(CONFIG_ARMADA_38X) || defined(CONFIG_ARMADA_39X)
13#include "mv_ddr_plat.h"
Stefan Roese5ffceb82015-03-26 15:36:56 +010014#endif
15
Chris Packham1a07d212018-05-10 13:28:29 +120016#include "mv_ddr_topology.h"
17#include "mv_ddr_spd.h"
18#include "ddr3_logging_def.h"
Marek BehĂșnf8bf75f2017-06-09 19:28:40 +020019
Stefan Roese5ffceb82015-03-26 15:36:56 +010020struct bus_params {
21 /* Chip Select (CS) bitmask (bits 0-CS0, bit 1- CS1 ...) */
22 u8 cs_bitmask;
23
24 /*
25 * mirror enable/disable
26 * (bits 0-CS0 mirroring, bit 1- CS1 mirroring ...)
27 */
28 int mirror_enable_bitmask;
29
30 /* DQS Swap (polarity) - true if enable */
31 int is_dqs_swap;
32
33 /* CK swap (polarity) - true if enable */
34 int is_ck_swap;
35};
36
37struct if_params {
38 /* bus configuration */
39 struct bus_params as_bus_params[MAX_BUS_NUM];
40
41 /* Speed Bin Table */
42 enum hws_speed_bin speed_bin_index;
43
Chris Packham1a07d212018-05-10 13:28:29 +120044 /* sdram device width */
45 enum mv_ddr_dev_width bus_width;
Stefan Roese5ffceb82015-03-26 15:36:56 +010046
Chris Packham1a07d212018-05-10 13:28:29 +120047 /* total sdram capacity per die, megabits */
48 enum mv_ddr_die_capacity memory_size;
Stefan Roese5ffceb82015-03-26 15:36:56 +010049
50 /* The DDR frequency for each interfaces */
51 enum hws_ddr_freq memory_freq;
52
53 /*
54 * delay CAS Write Latency
55 * - 0 for using default value (jedec suggested)
56 */
57 u8 cas_wl;
58
59 /*
60 * delay CAS Latency
61 * - 0 for using default value (jedec suggested)
62 */
63 u8 cas_l;
64
65 /* operation temperature */
Chris Packham1a07d212018-05-10 13:28:29 +120066 enum mv_ddr_temperature interface_temp;
Stefan Roese5ffceb82015-03-26 15:36:56 +010067};
68
Chris Packham1a07d212018-05-10 13:28:29 +120069struct mv_ddr_topology_map {
70 /* debug level configuration */
71 enum mv_ddr_debug_level debug_level;
72
Stefan Roese5ffceb82015-03-26 15:36:56 +010073 /* Number of interfaces (default is 12) */
74 u8 if_act_mask;
75
76 /* Controller configuration per interface */
77 struct if_params interface_params[MAX_INTERFACE_NUM];
78
Stefan Roese5ffceb82015-03-26 15:36:56 +010079 /* Bit mask for active buses */
Chris Packham1a07d212018-05-10 13:28:29 +120080 u16 bus_act_mask;
81
82 /* source of ddr configuration data */
83 enum mv_ddr_cfg_src cfg_src;
84
85 /* raw spd data */
86 union mv_ddr_spd_data spd_data;
87
88 /* timing parameters */
89 unsigned int timing_data[MV_DDR_TDATA_LAST];
Stefan Roese5ffceb82015-03-26 15:36:56 +010090};
91
92/* DDR3 training global configuration parameters */
93struct tune_train_params {
94 u32 ck_delay;
Stefan Roese5ffceb82015-03-26 15:36:56 +010095 u32 phy_reg3_val;
Chris Packham1a07d212018-05-10 13:28:29 +120096 u32 g_zpri_data;
97 u32 g_znri_data;
98 u32 g_zpri_ctrl;
99 u32 g_znri_ctrl;
100 u32 g_zpodt_data;
101 u32 g_znodt_data;
102 u32 g_zpodt_ctrl;
103 u32 g_znodt_ctrl;
104 u32 g_dic;
105 u32 g_odt_config;
106 u32 g_rtt_nom;
107 u32 g_rtt_wr;
108 u32 g_rtt_park;
Stefan Roese5ffceb82015-03-26 15:36:56 +0100109};
110
111#endif /* _DDR_TOPOLOGY_DEF_H */