1
2
3
4
5
6
7
8#include <common.h>
9#include <miiphy.h>
10#include <asm/io.h>
11#include <asm/arch/cpu.h>
12#include <asm/arch/soc.h>
13#include <linux/mbus.h>
14
15#include "../drivers/ddr/marvell/axp/ddr3_hw_training.h"
16#include "../arch/arm/mach-mvebu/serdes/axp/high_speed_env_spec.h"
17#include "../arch/arm/mach-mvebu/serdes/axp/board_env_spec.h"
18
19DECLARE_GLOBAL_DATA_PTR;
20
21
22
23#define DS414_GPP_OUT_VAL_LOW (BIT(25) | BIT(30))
24#define DS414_GPP_OUT_VAL_MID (BIT(10) | BIT(15))
25#define DS414_GPP_OUT_VAL_HIGH (0)
26
27#define DS414_GPP_OUT_POL_LOW (0)
28#define DS414_GPP_OUT_POL_MID (0)
29#define DS414_GPP_OUT_POL_HIGH (0)
30
31#define DS414_GPP_OUT_ENA_LOW (~(BIT(25) | BIT(30)))
32#define DS414_GPP_OUT_ENA_MID (~(BIT(10) | BIT(12) | \
33 BIT(13) | BIT(14) | BIT(15)))
34#define DS414_GPP_OUT_ENA_HIGH (~0)
35
36static const u32 ds414_mpp_control[] = {
37 0x11111111,
38 0x22221111,
39 0x22222222,
40 0x00000000,
41 0x11110000,
42 0x00004000,
43 0x00000000,
44 0x00000000,
45 0x00000000
46};
47
48
49
50
51MV_DRAM_MC_INIT syno_ddr3_b0_667_1g_v1[MV_MAX_DDR3_STATIC_SIZE] = {
52 {0x00001400, 0x73014A28},
53 {0x00001404, 0x30000800},
54 {0x00001408, 0x44148887},
55 {0x0000140C, 0x3AD83FEA},
56
57 {0x00001410, 0x14000000},
58
59 {0x00001414, 0x00000000},
60 {0x00001418, 0x00000e00},
61 {0x00001420, 0x00000004},
62 {0x00001424, 0x0000F3FF},
63 {0x00001428, 0x000F8830},
64 {0x0000142C, 0x054C36F4},
65 {0x0000147C, 0x0000C671},
66
67 {0x000014a0, 0x00000001},
68 {0x000014a8, 0x00000100},
69 {0x00020220, 0x00000006},
70
71 {0x00001494, 0x00010000},
72 {0x00001498, 0x00000000},
73 {0x0000149C, 0x00000001},
74
75 {0x000014C0, 0x192424C9},
76 {0x000014C4, 0x0AAA24C9},
77
78 {0x000200e8, 0x3FFF0E01},
79 {0x00020184, 0x3FFFFFE0},
80
81 {0x0001504, 0x3FFFFFE1},
82 {0x000150C, 0x00000000},
83 {0x0001514, 0x00000000},
84 {0x000151C, 0x00000000},
85
86 {0x00001538, 0x00000009},
87 {0x0000153C, 0x00000009},
88
89 {0x000015D0, 0x00000650},
90 {0x000015D4, 0x00000044},
91 {0x000015D8, 0x00000010},
92 {0x000015DC, 0x00000000},
93
94 {0x000015E4, 0x00203c18},
95 {0x000015EC, 0xF800A225},
96
97 {0x0, 0x0}
98};
99
100MV_DRAM_MODES ds414_ddr_modes[MV_DDR3_MODES_NUMBER] = {
101 {"ds414_1333-667", 0x3, 0x5, 0x0, A0, syno_ddr3_b0_667_1g_v1, NULL},
102};
103
104extern MV_SERDES_CHANGE_M_PHY serdes_change_m_phy[];
105
106MV_BIN_SERDES_CFG ds414_serdes_cfg[] = {
107 { MV_PEX_ROOT_COMPLEX, 0x02011111, 0x00000000,
108 { PEX_BUS_MODE_X4, PEX_BUS_MODE_X1, PEX_BUS_DISABLED,
109 PEX_BUS_DISABLED },
110 0x0040, serdes_change_m_phy
111 }
112};
113
114MV_DRAM_MODES *ddr3_get_static_ddr_mode(void)
115{
116 return &ds414_ddr_modes[0];
117}
118
119MV_BIN_SERDES_CFG *board_serdes_cfg_get(u8 pex_mode)
120{
121 return &ds414_serdes_cfg[0];
122}
123
124u8 board_sat_r_get(u8 dev_num, u8 reg)
125{
126 return (0x1 << 1 | 1);
127}
128
129int board_early_init_f(void)
130{
131 int i;
132
133
134 reg_write(GPP_DATA_OUT_REG(0), DS414_GPP_OUT_VAL_LOW);
135 reg_write(GPP_DATA_OUT_REG(1), DS414_GPP_OUT_VAL_MID);
136 reg_write(GPP_DATA_OUT_REG(2), DS414_GPP_OUT_VAL_HIGH);
137
138
139 reg_write(GPP_DATA_IN_POL_REG(0), DS414_GPP_OUT_POL_LOW);
140 reg_write(GPP_DATA_IN_POL_REG(1), DS414_GPP_OUT_POL_MID);
141 reg_write(GPP_DATA_IN_POL_REG(2), DS414_GPP_OUT_POL_HIGH);
142
143
144 reg_write(GPP_DATA_OUT_EN_REG(0), DS414_GPP_OUT_ENA_LOW);
145 reg_write(GPP_DATA_OUT_EN_REG(1), DS414_GPP_OUT_ENA_MID);
146 reg_write(GPP_DATA_OUT_EN_REG(2), DS414_GPP_OUT_ENA_HIGH);
147
148 for (i = 0; i < ARRAY_SIZE(ds414_mpp_control); i++)
149 reg_write(MPP_CONTROL_REG(i), ds414_mpp_control[i]);
150
151 return 0;
152}
153
154int board_init(void)
155{
156 u32 pwr_mng_ctrl_reg;
157
158
159 gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
160
161
162
163
164
165
166
167 pwr_mng_ctrl_reg = reg_read(POWER_MNG_CTRL_REG);
168 pwr_mng_ctrl_reg &= ~(BIT(0));
169 pwr_mng_ctrl_reg &= ~(BIT(1) | BIT(2));
170 pwr_mng_ctrl_reg &= ~(BIT(14) | BIT(15));
171 pwr_mng_ctrl_reg &= ~(BIT(16));
172 pwr_mng_ctrl_reg &= ~(BIT(17));
173 pwr_mng_ctrl_reg &= ~(BIT(19) | BIT(20));
174 pwr_mng_ctrl_reg &= ~(BIT(29) | BIT(30));
175 reg_write(POWER_MNG_CTRL_REG, pwr_mng_ctrl_reg);
176
177 return 0;
178}
179
180int checkboard(void)
181{
182 puts("Board: DS414\n");
183
184 return 0;
185}
186