1ff9112dfSStefan Roese /*
2ff9112dfSStefan Roese  * Copyright (C) Marvell International Ltd. and its affiliates
3ff9112dfSStefan Roese  *
4ff9112dfSStefan Roese  * SPDX-License-Identifier:	GPL-2.0
5ff9112dfSStefan Roese  */
6ff9112dfSStefan Roese 
7ff9112dfSStefan Roese #ifndef __DDR3_AXP_CONFIG_H
8ff9112dfSStefan Roese #define __DDR3_AXP_CONFIG_H
9ff9112dfSStefan Roese 
10ff9112dfSStefan Roese /*
11ff9112dfSStefan Roese  * DDR3_LOG_LEVEL Information
12ff9112dfSStefan Roese  *
13ff9112dfSStefan Roese  * Level 0: Provides an error code in a case of failure, RL, WL errors
14ff9112dfSStefan Roese  *          and other algorithm failure
15ff9112dfSStefan Roese  * Level 1: Provides the D-Unit setup (SPD/Static configuration)
16ff9112dfSStefan Roese  * Level 2: Provides the windows margin as a results of DQS centeralization
17ff9112dfSStefan Roese  * Level 3: Provides the windows margin of each DQ as a results of DQS
18ff9112dfSStefan Roese  *          centeralization
19ff9112dfSStefan Roese  */
20ff9112dfSStefan Roese #ifdef CONFIG_DDR_LOG_LEVEL
21ff9112dfSStefan Roese #define	DDR3_LOG_LEVEL	CONFIG_DDR_LOG_LEVEL
22ff9112dfSStefan Roese #else
23ff9112dfSStefan Roese #define	DDR3_LOG_LEVEL	0
24ff9112dfSStefan Roese #endif
25ff9112dfSStefan Roese 
26ff9112dfSStefan Roese #define DDR3_PBS        1
27ff9112dfSStefan Roese 
28ff9112dfSStefan Roese /* This flag allows the execution of SW WL/RL upon HW failure */
29ff9112dfSStefan Roese #define DDR3_RUN_SW_WHEN_HW_FAIL    1
30ff9112dfSStefan Roese 
31ff9112dfSStefan Roese /*
32ff9112dfSStefan Roese  * General Configurations
33ff9112dfSStefan Roese  *
34ff9112dfSStefan Roese  * The following parameters are required for proper setup:
35ff9112dfSStefan Roese  *
36ff9112dfSStefan Roese  * DDR_TARGET_FABRIC   - Set desired fabric configuration
37ff9112dfSStefan Roese  *                       (for sample@Reset fabfreq parameter)
38ff9112dfSStefan Roese  * DRAM_ECC            - Set ECC support 1/0
39ff9112dfSStefan Roese  * BUS_WIDTH           - 64/32 bit
40ff9112dfSStefan Roese  * CONFIG_SPD_EEPROM   - Enables auto detection of DIMMs and their timing values
41ff9112dfSStefan Roese  * DQS_CLK_ALIGNED     - Set this if CLK and DQS signals are aligned on board
42ff9112dfSStefan Roese  * MIXED_DIMM_STATIC   - Mixed DIMM + On board devices support (ODT registers
43ff9112dfSStefan Roese  *                       values are taken statically)
44ff9112dfSStefan Roese  * DDR3_TRAINING_DEBUG - Debug prints of internal code
45ff9112dfSStefan Roese  */
46ff9112dfSStefan Roese #define DDR_TARGET_FABRIC			5
47*a3ed9789SStefan Roese #define DRAM_ECC				1
48ff9112dfSStefan Roese 
49ff9112dfSStefan Roese #ifdef MV_DDR_32BIT
50ff9112dfSStefan Roese #define BUS_WIDTH                               32
51ff9112dfSStefan Roese #else
52ff9112dfSStefan Roese #define BUS_WIDTH				64
53ff9112dfSStefan Roese #endif
54ff9112dfSStefan Roese 
55ff9112dfSStefan Roese #undef DQS_CLK_ALIGNED
56ff9112dfSStefan Roese #undef MIXED_DIMM_STATIC
57ff9112dfSStefan Roese #define DDR3_TRAINING_DEBUG			0
58ff9112dfSStefan Roese #define REG_DIMM_SKIP_WL			0
59ff9112dfSStefan Roese 
60ff9112dfSStefan Roese /* Marvell boards specific configurations */
61ff9112dfSStefan Roese #if defined(DB_78X60_PCAC)
62ff9112dfSStefan Roese #undef CONFIG_SPD_EEPROM
63ff9112dfSStefan Roese #define STATIC_TRAINING
64ff9112dfSStefan Roese #endif
65ff9112dfSStefan Roese 
66ff9112dfSStefan Roese #if defined(DB_78X60_AMC)
67ff9112dfSStefan Roese #undef CONFIG_SPD_EEPROM
68ff9112dfSStefan Roese #undef  DRAM_ECC
69ff9112dfSStefan Roese #define DRAM_ECC				1
70ff9112dfSStefan Roese #endif
71ff9112dfSStefan Roese 
72ff9112dfSStefan Roese #ifdef CONFIG_SPD_EEPROM
73ff9112dfSStefan Roese /*
74ff9112dfSStefan Roese  * DIMM support parameters:
75ff9112dfSStefan Roese  * DRAM_2T - Set Desired 2T Mode - 0 - 1T, 0x1 - 2T, 0x2 - 3T
76ff9112dfSStefan Roese  * DIMM_CS_BITMAP - bitmap representing the optional CS in DIMMs
77ff9112dfSStefan Roese  * (0xF=CS0+CS1+CS2+CS3, 0xC=CS2+CS3...)
78ff9112dfSStefan Roese  */
79ff9112dfSStefan Roese #define DRAM_2T					0x0
80ff9112dfSStefan Roese #define DIMM_CS_BITMAP				0xF
81ff9112dfSStefan Roese #define DUNIT_SPD
82ff9112dfSStefan Roese #endif
83ff9112dfSStefan Roese 
84ff9112dfSStefan Roese #ifdef DRAM_ECC
85ff9112dfSStefan Roese /*
86ff9112dfSStefan Roese  * ECC support parameters:
87ff9112dfSStefan Roese  *
88ff9112dfSStefan Roese  * U_BOOT_START_ADDR, U_BOOT_SCRUB_SIZE - relevant when using ECC and need
89ff9112dfSStefan Roese  * to configure the scrubbing area
90ff9112dfSStefan Roese  */
91ff9112dfSStefan Roese #define TRAINING_SIZE				0x20000
92ff9112dfSStefan Roese #define U_BOOT_START_ADDR			0
93ff9112dfSStefan Roese #define U_BOOT_SCRUB_SIZE			0x1000000 /* TRAINING_SIZE */
94ff9112dfSStefan Roese #endif
95ff9112dfSStefan Roese 
96ff9112dfSStefan Roese /*
97ff9112dfSStefan Roese  * Registered DIMM Support - In case registered DIMM is attached,
98ff9112dfSStefan Roese  * please supply the following values:
99ff9112dfSStefan Roese  * (see JEDEC - JESD82-29A "Definition of the SSTE32882 Registering Clock
100ff9112dfSStefan Roese  * Driver with Parity and Quad Chip
101ff9112dfSStefan Roese  * Selects for DDR3/DDR3L/DDR3U RDIMM 1.5 V/1.35 V/1.25 V Applications")
102ff9112dfSStefan Roese  * RC0: Global Features Control Word
103ff9112dfSStefan Roese  * RC1: Clock Driver Enable Control Word
104ff9112dfSStefan Roese  * RC2: Timing Control Word
105ff9112dfSStefan Roese  * RC3-RC5 - taken from SPD
106ff9112dfSStefan Roese  * RC8: Additional IBT Setting Control Word
107ff9112dfSStefan Roese  * RC9: Power Saving Settings Control Word
108ff9112dfSStefan Roese  * RC10: Encoding for RDIMM Operating Speed
109ff9112dfSStefan Roese  * RC11: Operating Voltage VDD and VREFCA Control Word
110ff9112dfSStefan Roese  */
111ff9112dfSStefan Roese #define RDIMM_RC0				0
112ff9112dfSStefan Roese #define RDIMM_RC1				0
113ff9112dfSStefan Roese #define RDIMM_RC2				0
114ff9112dfSStefan Roese #define RDIMM_RC8				0
115ff9112dfSStefan Roese #define RDIMM_RC9				0
116ff9112dfSStefan Roese #define RDIMM_RC10				0x2
117ff9112dfSStefan Roese #define RDIMM_RC11				0x0
118ff9112dfSStefan Roese 
119ff9112dfSStefan Roese #if defined(MIXED_DIMM_STATIC) || !defined(CONFIG_SPD_EEPROM)
120ff9112dfSStefan Roese #define DUNIT_STATIC
121ff9112dfSStefan Roese #endif
122ff9112dfSStefan Roese 
123ff9112dfSStefan Roese #if defined(MIXED_DIMM_STATIC) || defined(CONFIG_SPD_EEPROM)
124ff9112dfSStefan Roese /*
125ff9112dfSStefan Roese  * This flag allows the user to change the dram refresh cycle in ps,
126ff9112dfSStefan Roese  * only in case of SPD or MIX DIMM topology
127ff9112dfSStefan Roese  */
128ff9112dfSStefan Roese #define TREFI_USER_EN
129ff9112dfSStefan Roese 
130ff9112dfSStefan Roese #ifdef TREFI_USER_EN
131ff9112dfSStefan Roese #define TREFI_USER				3900000
132ff9112dfSStefan Roese #endif
133ff9112dfSStefan Roese #endif
134ff9112dfSStefan Roese 
135ff9112dfSStefan Roese #ifdef CONFIG_SPD_EEPROM
136ff9112dfSStefan Roese /*
137ff9112dfSStefan Roese  * AUTO_DETECTION_SUPPORT - relevant ONLY for Marvell DB boards.
138ff9112dfSStefan Roese  * Enables I2C auto detection different options
139ff9112dfSStefan Roese  */
140ff9112dfSStefan Roese #if defined(CONFIG_DB_88F78X60) || defined(CONFIG_DB_88F78X60_REV2) || \
141ff9112dfSStefan Roese     defined(CONFIG_DB_784MP_GP)
142ff9112dfSStefan Roese #define AUTO_DETECTION_SUPPORT
143ff9112dfSStefan Roese #endif
144ff9112dfSStefan Roese #endif
145ff9112dfSStefan Roese 
146ff9112dfSStefan Roese #endif /* __DDR3_AXP_CONFIG_H */
147