~funderscore blog cgit wiki get in touch
aboutsummaryrefslogtreecommitdiff
blob: 1386516a16f6124c87ad06d04a3cedbd014edaa8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
/* SPDX-License-Identifier: GPL-2.0+ */
/*
 *
 * Copyright 2015 Timesys Corporation.
 * Copyright 2015 General Electric Company
 *
 * Refer doc/imx/mkimage/imximage.txt for more details about how-to configure
 * and create imximage boot image
 *
 * The syntax is taken as close as possible with the kwbimage
 */

IMAGE_VERSION 2
BOOT_FROM sd

#include <config.h>
#include "asm/arch/mx6-ddr.h"
#include "asm/arch/iomux.h"
#include "asm/arch/crm_regs.h"

/* DDR IO */
DATA 4, MX6_IOM_GRP_DDR_TYPE,	0x000c0000
DATA 4, MX6_IOM_GRP_DDRPKE,	0x00000000
DATA 4, MX6_IOM_DRAM_SDCLK_0,	0x00000030
DATA 4, MX6_IOM_DRAM_SDCLK_1,	0x00000030
DATA 4, MX6_IOM_DRAM_CAS,	0x00000030
DATA 4, MX6_IOM_DRAM_RAS,	0x00000030
DATA 4, MX6_IOM_GRP_ADDDS,	0x00000030
DATA 4, MX6_IOM_DRAM_RESET,	0x00000030
DATA 4, MX6_IOM_DRAM_SDBA2,	0x00000000
DATA 4, MX6_IOM_DRAM_SDODT0,	0x00000030
DATA 4, MX6_IOM_DRAM_SDODT1,	0x00000030
DATA 4, MX6_IOM_GRP_CTLDS,	0x00000030
DATA 4, MX6_IOM_DDRMODE_CTL,	0x00020000
DATA 4, MX6_IOM_DRAM_SDQS0,	0x00000030
DATA 4, MX6_IOM_DRAM_SDQS1,	0x00000030
DATA 4, MX6_IOM_DRAM_SDQS2,	0x00000030
DATA 4, MX6_IOM_DRAM_SDQS3,	0x00000030
DATA 4, MX6_IOM_DRAM_SDQS4,	0x00000030
DATA 4, MX6_IOM_DRAM_SDQS5,	0x00000030
DATA 4, MX6_IOM_DRAM_SDQS6,	0x00000030
DATA 4, MX6_IOM_DRAM_SDQS7,	0x00000030
DATA 4, MX6_IOM_GRP_DDRMODE,	0x00020000
DATA 4, MX6_IOM_GRP_B0DS,	0x00000030
DATA 4, MX6_IOM_GRP_B1DS,	0x00000030
DATA 4, MX6_IOM_GRP_B2DS,	0x00000030
DATA 4, MX6_IOM_GRP_B3DS,	0x00000030
DATA 4, MX6_IOM_GRP_B4DS,	0x00000030
DATA 4, MX6_IOM_GRP_B5DS,	0x00000030
DATA 4, MX6_IOM_GRP_B6DS,	0x00000030
DATA 4, MX6_IOM_GRP_B7DS,	0x00000030
DATA 4, MX6_IOM_DRAM_DQM0,	0x00000030
DATA 4, MX6_IOM_DRAM_DQM1,	0x00000030
DATA 4, MX6_IOM_DRAM_DQM2,	0x00000030
DATA 4, MX6_IOM_DRAM_DQM3,	0x00000030
DATA 4, MX6_IOM_DRAM_DQM4,	0x00000030
DATA 4, MX6_IOM_DRAM_DQM5,	0x00000030
DATA 4, MX6_IOM_DRAM_DQM6,	0x00000030
DATA 4, MX6_IOM_DRAM_DQM7,	0x00000030

/* Calibrations */
/* ZQ */
DATA 4, MX6_MMDC_P0_MPZQHWCTRL,  0xa1390003
/* write leveling */
DATA 4, MX6_MMDC_P0_MPWLDECTRL0, 0x001F001F
DATA 4, MX6_MMDC_P0_MPWLDECTRL1, 0x001F001F
DATA 4, MX6_MMDC_P1_MPWLDECTRL0, 0x001F001F
DATA 4, MX6_MMDC_P1_MPWLDECTRL1, 0x001F001F
/* Read DQS Gating calibration */
DATA 4, MX6_MMDC_P0_MPDGCTRL0,	0x45380544
DATA 4, MX6_MMDC_P0_MPDGCTRL1,	0x05280530
DATA 4, MX6_MMDC_P1_MPDGCTRL0,	0x4530053C
DATA 4, MX6_MMDC_P1_MPDGCTRL1,	0x0530050C
/* Read calibration */
DATA 4, MX6_MMDC_P0_MPRDDLCTL,	0x36303032
DATA 4, MX6_MMDC_P1_MPRDDLCTL,	0x38363042
/* Write calibration */
DATA 4, MX6_MMDC_P0_MPWRDLCTL,	0x3A3A423E
DATA 4, MX6_MMDC_P1_MPWRDLCTL,	0x4A38483E
/* read data bit delay */
DATA 4, MX6_MMDC_P0_MPRDDQBY0DL, 0x33333333
DATA 4, MX6_MMDC_P0_MPRDDQBY1DL, 0x33333333
DATA 4, MX6_MMDC_P0_MPRDDQBY2DL, 0x33333333
DATA 4, MX6_MMDC_P0_MPRDDQBY3DL, 0x33333333
DATA 4, MX6_MMDC_P1_MPRDDQBY0DL, 0x33333333
DATA 4, MX6_MMDC_P1_MPRDDQBY1DL, 0x33333333
DATA 4, MX6_MMDC_P1_MPRDDQBY2DL, 0x33333333
DATA 4, MX6_MMDC_P1_MPRDDQBY3DL, 0x33333333

/* Complete calibration by forced measurment */
DATA 4, MX6_MMDC_P0_MPMUR0,	0x00000800
DATA 4, MX6_MMDC_P1_MPMUR0,	0x00000800

/* MMDC init */
DATA 4, MX6_MMDC_P0_MDPDC,	0x00020036
DATA 4, MX6_MMDC_P0_MDOTC,	0x09444040
DATA 4, MX6_MMDC_P0_MDCFG0,	0x8A8F79A4
DATA 4, MX6_MMDC_P0_MDCFG1,	0xDB538E64
DATA 4, MX6_MMDC_P0_MDCFG2,	0x01ff00db
DATA 4, MX6_MMDC_P0_MDMISC,	0x00001740
DATA 4, MX6_MMDC_P0_MDSCR,	0x00008000
DATA 4, MX6_MMDC_P0_MDRWD,	0x000026d2
DATA 4, MX6_MMDC_P0_MDOR,	0x008F1023
DATA 4, MX6_MMDC_P0_MDASP,	0x00000047
DATA 4, MX6_MMDC_P0_MDCTL,	0x841a0000

/* Initialize Micron MT41J128M */
DATA 4, MX6_MMDC_P0_MDSCR,	0x04088032
DATA 4, MX6_MMDC_P0_MDSCR,	0x0408803a
DATA 4, MX6_MMDC_P0_MDSCR,	0x00008033
DATA 4, MX6_MMDC_P0_MDSCR,	0x0000803b
DATA 4, MX6_MMDC_P0_MDSCR,	0x00408031
DATA 4, MX6_MMDC_P0_MDSCR,	0x00408039
DATA 4, MX6_MMDC_P0_MDSCR,	0x09408030
DATA 4, MX6_MMDC_P0_MDSCR,	0x09408038
DATA 4, MX6_MMDC_P0_MDSCR,	0x04008040
DATA 4, MX6_MMDC_P0_MDSCR,	0x04008048
DATA 4, MX6_MMDC_P0_MDREF,	0x00005800
DATA 4, MX6_MMDC_P0_MPODTCTRL,	0x00011117
DATA 4, MX6_MMDC_P1_MPODTCTRL,	0x00011117
DATA 4, MX6_MMDC_P0_MDPDC,	0x00025576
DATA 4, MX6_MMDC_P0_MAPSR,	0x00011006
DATA 4, MX6_MMDC_P0_MDSCR,	0x00000000

/* set the default clock gate to save power */
DATA 4, CCM_CCGR0, 0x00C03F3F
DATA 4, CCM_CCGR1, 0x0030FC03
DATA 4, CCM_CCGR2, 0x0FFFC000
DATA 4, CCM_CCGR3, 0x3FF00000
DATA 4, CCM_CCGR4, 0x00FFF300
DATA 4, CCM_CCGR5, 0x0F0000C3
DATA 4, CCM_CCGR6, 0x000003FF

/* enable AXI cache for VDOA/VPU/IPU */
DATA 4, MX6_IOMUXC_GPR4, 0xF00000CF
/* set IPU AXI-id0 Qos=0xf(bypass) AXI-id1 Qos=0x7 */
DATA 4, MX6_IOMUXC_GPR6, 0x007F007F
DATA 4, MX6_IOMUXC_GPR7, 0x007F007F

/*
 * Setup CCM_CCOSR register as follows:
 *
 * cko1_en  1	   --> CKO1 enabled
 * cko1_div 111  --> divide by 8
 * cko1_sel 1011 --> ahb_clk_root
 *
 * This sets CKO1 at ahb_clk_root/8 132/8 16.5 MHz
 */
DATA 4, CCM_CCOSR, 0x000000fb