blob: 1b0ab5603e54b30c1fadd986a09a7e10348e65e3 [file] [log] [blame]
Stefan Roesef8d25d72015-01-19 11:33:40 +01001/*
2 * Copyright (C) Marvell International Ltd. and its affiliates
3 *
4 * SPDX-License-Identifier: GPL-2.0
5 */
6
7#ifndef __AXP_VARS_H
8#define __AXP_VARS_H
9
10#include "ddr3_axp_config.h"
11#include "ddr3_axp_mc_static.h"
12#include "ddr3_axp_training_static.h"
13
14MV_DRAM_MODES ddr_modes[MV_DDR3_MODES_NUMBER] = {
15 /* Conf name CPUFreq FabFreq Chip ID Chip/Board MC regs Training Values */
16 /* db board values: */
17 {"db_800-400", 0xA, 0x5, 0x0, A0, ddr3_A0_db_400, NULL},
18 {"db_1200-300", 0x2, 0xC, 0x0, A0, ddr3_A0_db_400, NULL},
19 {"db_1200-600", 0x2, 0x5, 0x0, A0, NULL, NULL},
20 {"db_1333-667", 0x3, 0x5, 0x0, A0, ddr3_A0_db_667, ddr3_db_rev2_667},
21 {"db_1600-800", 0xB, 0x5, 0x0, A0, ddr3_A0_db_667, ddr3_db_rev2_800},
22 {"amc_1333-667", 0x3, 0x5, 0x0, A0_AMC, ddr3_A0_AMC_667, NULL},
23 {"db_667-667", 0x9, 0x13, 0x0, Z1, ddr3_Z1_db_600, ddr3_db_667},
24 {"db_800-400", 0xA, 0x1, 0x0, Z1, ddr3_Z1_db_300, ddr3_db_400},
25 {"db_1066-533", 0x1, 0x1, 0x0, Z1, ddr3_Z1_db_300, ddr3_db_533},
26 {"db_1200-300", 0x2, 0xC, 0x0, Z1, ddr3_Z1_db_300, ddr3_db_667},
27 {"db_1200-600", 0x2, 0x5, 0x0, Z1, ddr3_Z1_db_600, NULL},
28 {"db_1333-333", 0x3, 0xC, 0x0, Z1, ddr3_Z1_db_300, ddr3_db_400},
29 {"db_1333-667", 0x3, 0x5, 0x0, Z1, ddr3_Z1_db_600, ddr3_db_667},
30 /* pcac board values (Z1 device): */
31 {"pcac_1200-600", 0x2, 0x5, 0x0, Z1_PCAC, ddr3_Z1_db_600,
32 ddr3_pcac_600},
33 /* rd board values (Z1 device): */
34 {"rd_667_0", 0x3, 0x5, 0x0, Z1_RD_SLED, ddr3_Z1_db_600, ddr3_rd_667_0},
35 {"rd_667_1", 0x3, 0x5, 0x1, Z1_RD_SLED, ddr3_Z1_db_600, ddr3_rd_667_1},
36 {"rd_667_2", 0x3, 0x5, 0x2, Z1_RD_SLED, ddr3_Z1_db_600, ddr3_rd_667_2},
37 {"rd_667_3", 0x3, 0x5, 0x3, Z1_RD_SLED, ddr3_Z1_db_600, ddr3_rd_667_3}
38};
39
40/* ODT settings - if needed update the following tables: (ODT_OPT - represents the CS configuration bitmap) */
41
42u16 odt_static[ODT_OPT][MAX_CS] = { /* NearEnd/FarEnd */
43 {0, 0, 0, 0}, /* 0000 0/0 - Not supported */
44 {ODT40, 0, 0, 0}, /* 0001 0/1 */
45 {0, 0, 0, 0}, /* 0010 0/0 - Not supported */
46 {ODT40, ODT40, 0, 0}, /* 0011 0/2 */
47 {0, 0, ODT40, 0}, /* 0100 1/0 */
48 {ODT30, 0, ODT30, 0}, /* 0101 1/1 */
49 {0, 0, 0, 0}, /* 0110 0/0 - Not supported */
50 {ODT120, ODT20, ODT20, 0}, /* 0111 1/2 */
51 {0, 0, 0, 0}, /* 1000 0/0 - Not supported */
52 {0, 0, 0, 0}, /* 1001 0/0 - Not supported */
53 {0, 0, 0, 0}, /* 1010 0/0 - Not supported */
54 {0, 0, 0, 0}, /* 1011 0/0 - Not supported */
55 {0, 0, ODT40, 0}, /* 1100 2/0 */
56 {ODT20, 0, ODT120, ODT20}, /* 1101 2/1 */
57 {0, 0, 0, 0}, /* 1110 0/0 - Not supported */
58 {ODT120, ODT30, ODT120, ODT30} /* 1111 2/2 */
59};
60
61u16 odt_dynamic[ODT_OPT][MAX_CS] = { /* NearEnd/FarEnd */
62 {0, 0, 0, 0}, /* 0000 0/0 */
63 {0, 0, 0, 0}, /* 0001 0/1 */
64 {0, 0, 0, 0}, /* 0010 0/0 - Not supported */
65 {0, 0, 0, 0}, /* 0011 0/2 */
66 {0, 0, 0, 0}, /* 0100 1/0 */
67 {ODT120D, 0, ODT120D, 0}, /* 0101 1/1 */
68 {0, 0, 0, 0}, /* 0110 0/0 - Not supported */
69 {0, 0, ODT120D, 0}, /* 0111 1/2 */
70 {0, 0, 0, 0}, /* 1000 0/0 - Not supported */
71 {0, 0, 0, 0}, /* 1001 0/0 - Not supported */
72 {0, 0, 0, 0}, /* 1010 0/0 - Not supported */
73 {0, 0, 0, 0}, /* 1011 0/0 - Not supported */
74 {0, 0, 0, 0}, /* 1100 2/0 */
75 {ODT120D, 0, 0, 0}, /* 1101 2/1 */
76 {0, 0, 0, 0}, /* 1110 0/0 - Not supported */
77 {0, 0, 0, 0} /* 1111 2/2 */
78};
79
80u32 odt_config[ODT_OPT] = {
81 0, 0x00010000, 0, 0x00030000, 0x04000000, 0x05050104, 0, 0x07430340, 0,
82 0, 0, 0,
83 0x30000, 0x1C0D100C, 0, 0x3CC330C0
84};
85
86/*
87 * User can manually set SPD values (in case SPD is not available on
88 * DIMM/System).
89 * SPD Values can simplify calculating the DUNIT registers values
90 */
91u8 spd_data[SPD_SIZE] = {
92 /* AXP DB Board DIMM SPD Values - manually set */
93 0x92, 0x10, 0x0B, 0x2, 0x3, 0x19, 0x0, 0x9, 0x09, 0x52, 0x1, 0x8, 0x0C,
94 0x0, 0x7E, 0x0, 0x69, 0x78,
95 0x69, 0x30, 0x69, 0x11, 0x20, 0x89, 0x0, 0x5, 0x3C, 0x3C, 0x0, 0xF0,
96 0x82, 0x5, 0x80, 0x0, 0x0, 0x0,
97 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
98 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
99 0x0, 0x0, 0x0, 0x0, 0x0F, 0x1, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
100 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
101 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
102 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
103 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
104 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
105 0x0, 0x80, 0x2C, 0x1, 0x10, 0x23, 0x35, 0x28, 0xEB, 0xCA, 0x19, 0x8F
106};
107
108/*
109 * Controller Specific configurations Starts Here - DO NOT MODIFY
110 */
111
112/* Frequency - values are 1/HCLK in ps */
113u32 cpu_fab_clk_to_hclk[FAB_OPT][CLK_CPU] =
114/* CPU Frequency:
115 1000 1066 1200 1333 1500 1666 1800 2000 600 667 800 1600 Fabric */
116{
117 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
118 {0, 0, 0, 0, 0, 0, 0, 0, 0, 3000, 2500, 0},
119 {0, 0, 0, 0, 0, 0, 0, 0, 0, 4500, 3750, 0},
120 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
121 {0, 0, 2500, 0, 0, 0, 0, 0, 0, 0, 0, 0},
122 {4000, 3750, 3333, 3000, 2666, 2400, 0, 0, 0, 0, 5000, 2500},
123 {0, 0, 0, 0, 0, 0, 0, 0, 0, 3000, 0, 0},
124 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
125 {2500, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
126 {0, 0, 5000, 0, 4000, 0, 0, 0, 0, 0, 0, 3750},
127 {5000, 0, 0, 3750, 3333, 0, 0, 0, 0, 0, 0, 3125},
128 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
129 {0, 0, 3330, 3000, 0, 0, 0, 0, 0, 0, 0, 2500},
130 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3750},
131 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
132 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
133 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
134 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
135 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
136 {0, 0, 0, 0, 0, 0, 0, 0, 0, 3000, 2500, 0},
137 {3000, 0, 2500, 0, 0, 0, 0, 0, 0, 0, 3750, 0}
138};
139
140u32 cpu_ddr_ratios[FAB_OPT][CLK_CPU] =
141/* CPU Frequency:
142 1000 1066 1200 1333 1500 1666 1800 2000 600 667 800 1600 Fabric */
143{
144 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
145 {0, 0, 0, 0, 0, 0, 0, 0, 0, DDR_333, DDR_400, 0},
146 {0, 0, 0, 0, 0, 0, 0, 0, 0, DDR_444, DDR_533, 0},
147 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
148 {0, 0, DDR_400, 0, 0, 0, 0, 0, 0, 0, 0, 0},
149 {DDR_500, DDR_533, DDR_600, DDR_666, DDR_750, DDR_833, 0, 0, 0, 0,
150 DDR_400, DDR_800},
151 {0, 0, 0, 0, 0, 0, 0, 0, 0, DDR_333, 0, 0},
152 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
153 {DDR_400, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
154 {0, 0, DDR_400, 0, DDR_500, 0, 0, 0, 0, 0, 0, DDR_533},
155 {DDR_400, 0, 0, DDR_533, DDR_600, 0, 0, 0, 0, 0, 0, DDR_640},
156 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
157 {0, 0, DDR_300, DDR_333, 0, 0, 0, 0, 0, 0, 0, DDR_400},
158 {0, 0, 0, 0, 0, 0, DDR_600, DDR_666, 0, 0, 0, DDR_533},
159 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
160 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
161 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
162 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
163 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
164 {0, 0, 0, 0, 0, 0, 0, 0, 0, DDR_666, DDR_800, 0},
165 {DDR_666, 0, DDR_800, 0, 0, 0, 0, 0, 0, 0, DDR_533, 0}
166};
167
168u8 div_ratio1to1[CLK_VCO][CLK_DDR] =
169/* DDR Frequency:
170 100 300 360 400 444 500 533 600 666 750 800 833 */
171{ {0xA, 3, 0, 3, 0, 2, 0, 0, 0, 0, 0, 0}, /* 1:1 CLK_CPU_1000 */
172{0xB, 3, 0, 3, 0, 0, 2, 0, 0, 0, 0, 0}, /* 1:1 CLK_CPU_1066 */
173{0xC, 4, 0, 3, 0, 0, 0, 2, 0, 0, 0, 0}, /* 1:1 CLK_CPU_1200 */
174{0xD, 4, 0, 4, 0, 0, 0, 0, 2, 0, 0, 0}, /* 1:1 CLK_CPU_1333 */
175{0xF, 5, 0, 4, 0, 3, 0, 0, 0, 0, 0, 0}, /* 1:1 CLK_CPU_1500 */
176{0x11, 5, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0}, /* 1:1 CLK_CPU_1666 */
177{0x12, 6, 5, 4, 0, 0, 0, 3, 0, 0, 0, 0}, /* 1:1 CLK_CPU_1800 */
178{0x14, 7, 0, 5, 0, 4, 0, 0, 3, 0, 0, 0}, /* 1:1 CLK_CPU_2000 */
179{0x6, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0}, /* 1:1 CLK_CPU_600 */
180{0x6, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0}, /* 1:1 CLK_CPU_667 */
181{0x8, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0}, /* 1:1 CLK_CPU_800 */
182{0x10, 5, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0}, /* 1:1 CLK_CPU_1600 */
183{0x14, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0}, /* 1:1 CLK_CPU_1000 VCO_2000 */
184{0x15, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0}, /* 1:1 CLK_CPU_1066 VCO_2133 */
185{0x18, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0}, /* 1:1 CLK_CPU_1200 VCO_2400 */
186{0x1A, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0}, /* 1:1 CLK_CPU_1333 VCO_2666 */
187{0x1E, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0}, /* 1:1 CLK_CPU_1500 VCO_3000 */
188{0x21, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0}, /* 1:1 CLK_CPU_1666 VCO_3333 */
189{0x24, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0}, /* 1:1 CLK_CPU_1800 VCO_3600 */
190{0x28, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0}, /* 1:1 CLK_CPU_2000 VCO_4000 */
191{0xC, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0}, /* 1:1 CLK_CPU_600 VCO_1200 */
192{0xD, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0}, /* 1:1 CLK_CPU_667 VCO_1333 */
193{0x10, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0}, /* 1:1 CLK_CPU_800 VCO_1600 */
194{0x20, 10, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0} /* 1:1 CLK_CPU_1600 VCO_3200 */
195};
196
197u8 div_ratio2to1[CLK_VCO][CLK_DDR] =
198/* DDR Frequency:
199 100 300 360 400 444 500 533 600 666 750 800 833 */
200{ {0, 0, 0, 0, 0, 2, 0, 0, 3, 0, 0, 0}, /* 2:1 CLK_CPU_1000 */
201{0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0}, /* 2:1 CLK_CPU_1066 */
202{0, 0, 0, 3, 5, 0, 0, 2, 0, 0, 3, 3}, /* 2:1 CLK_CPU_1200 */
203{0, 0, 0, 0, 0, 0, 5, 0, 2, 0, 3, 0}, /* 2:1 CLK_CPU_1333 */
204{0, 0, 0, 0, 0, 3, 0, 5, 0, 2, 0, 0}, /* 2:1 CLK_CPU_1500 */
205{0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 2}, /* 2:1 CLK_CPU_1666 */
206{0, 0, 0, 0, 0, 0, 0, 3, 0, 5, 0, 0}, /* 2:1 CLK_CPU_1800 */
207{0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 5}, /* 2:1 CLK_CPU_2000 */
208{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* 2:1 CLK_CPU_600 */
209{0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0}, /* 2:1 CLK_CPU_667 */
210{0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 1, 0}, /* 2:1 CLK_CPU_800 */
211{0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0}, /* 2:1 CLK_CPU_1600 */
212{0, 0, 0, 5, 0, 0, 0, 0, 3, 0, 0, 0}, /* 2:1 CLK_CPU_1000 VCO_2000 */
213{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* 2:1 CLK_CPU_1066 VCO_2133 */
214{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0}, /* 2:1 CLK_CPU_1200 VCO_2400 */
215{0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0}, /* 2:1 CLK_CPU_1333 VCO_2666 */
216{0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0}, /* 2:1 CLK_CPU_1500 VCO_3000 */
217{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* 2:1 CLK_CPU_1666 VCO_3333 */
218{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* 2:1 CLK_CPU_1800 VCO_3600 */
219{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* 2:1 CLK_CPU_2000 VCO_4000 */
220{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* 2:1 CLK_CPU_600 VCO_1200 */
221{0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0}, /* 2:1 CLK_CPU_667 VCO_1333 */
222{0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0}, /* 2:1 CLK_CPU_800 VCO_1600 */
223{0, 0, 0, 0, 0, 0, 0, 5, 5, 0, 0, 0} /* 2:1 CLK_CPU_1600 VCO_3200 */
224};
225
226#endif /* __AXP_VARS_H */