2 * Copyright (C) 2008, Guennadi Liakhovetski <lg@denx.de>
4 * SPDX-License-Identifier: GPL-2.0+
7 #include <asm/arch/imx-regs.h>
29 /* RedBoot: AIPS setup - Only setup MPROTx registers.
30 * The PACR default values are good.*/
33 * Set all MPROTx to be non-bufferable, trusted for R/W,
34 * not forced to user-mode.
45 * Clear the on and off peripheral modules Supervisor Protect bit
46 * for SDMA to access them. Did not change the AIPS control registers
47 * (offset 0x20) access type
56 and r1, r1, #0x00FFFFFF
66 and r1, r1, #0x00FFFFFF
70 /* RedBoot: MAX (Multi-Layer AHB Crossbar Switch) setup */
73 /* MPR - priority is M4 > M2 > M3 > M5 > M0 > M1 */
75 str r1, [r0, #0x000] /* for S0 */
76 str r1, [r0, #0x100] /* for S1 */
77 str r1, [r0, #0x200] /* for S2 */
78 str r1, [r0, #0x300] /* for S3 */
79 str r1, [r0, #0x400] /* for S4 */
80 /* SGPCR - always park on last master */
82 str r1, [r0, #0x010] /* for S0 */
83 str r1, [r0, #0x110] /* for S1 */
84 str r1, [r0, #0x210] /* for S2 */
85 str r1, [r0, #0x310] /* for S3 */
86 str r1, [r0, #0x410] /* for S4 */
87 /* MGPCR - restore default values */
89 str r1, [r0, #0x800] /* for M0 */
90 str r1, [r0, #0x900] /* for M1 */
91 str r1, [r0, #0xA00] /* for M2 */
92 str r1, [r0, #0xB00] /* for M3 */
93 str r1, [r0, #0xC00] /* for M4 */
94 str r1, [r0, #0xD00] /* for M5 */
97 /* RedBoot: M3IF setup */
99 /* Configure M3IF registers */
102 * M3IF Control Register (M3IFCTL)
103 * MRRP[0] = L2CC0 not on priority list (0 << 0) = 0x00000000
104 * MRRP[1] = L2CC1 not on priority list (0 << 0) = 0x00000000
105 * MRRP[2] = MBX not on priority list (0 << 0) = 0x00000000
106 * MRRP[3] = MAX1 not on priority list (0 << 0) = 0x00000000
107 * MRRP[4] = SDMA not on priority list (0 << 0) = 0x00000000
108 * MRRP[5] = MPEG4 not on priority list (0 << 0) = 0x00000000
109 * MRRP[6] = IPU1 on priority list (1 << 6) = 0x00000040
110 * MRRP[7] = IPU2 not on priority list (0 << 0) = 0x00000000
115 str r0, [r1] /* M3IF control reg */
116 .endm /* init_m3if */
118 /* RedBoot: To support 133MHz DDR */
119 .macro init_drive_strength
121 * Disable maximum drive strength SDRAM/DDR lines by clearing DSE1 bits
122 * in SW_PAD_CTL registers
128 bic r0, r0, #(1 << 12)
133 bic r0, r0, #(1 << 22)
138 bic r0, r0, #(1 << 2)
143 bic r0, r0, #(1 << 22)
148 bic r0, r0, #(1 << 22)
151 /* DQM2, DQM1, DQM0, SD31-SD0, A25-A0, MA10 (0x288..0x2DC) */
152 ldr r2, =22 /* (0x2E0 - 0x288) / 4 = 22 */
155 bic r0, r0, #(1 << 22)
156 bic r0, r0, #(1 << 12)
157 bic r0, r0, #(1 << 2)
162 .endm /* init_drive_strength */
164 /* CPLD on CS4 setup */
178 /* Redboot initializes very early AIPS, what for?
179 * Then it also initializes Multi-Layer AHB Crossbar Switch,
181 /* Also setup the Peripheral Port Remap register inside the core */
182 ldr r0, =0x40000015 /* start from AIPS 2GB region */
183 mcr p15, 0, r0, c15, c2, 4
195 /* Image Processing Unit: */
196 /* Too early to switch display on? */
197 REG IPU_CONF, IPU_CONF_DI_EN /* Switch on Display Interface */
198 /* Clock Control Module: */
199 REG CCM_CCMR, 0x074B0BF5 /* Use CKIH, MCU PLL off */
203 REG CCM_CCMR, 0x074B0BF5 | CCMR_MPE /* MCU PLL on */
204 REG CCM_CCMR, (0x074B0BF5 | CCMR_MPE) & ~CCMR_MDS /* Switch to MCU PLL */
206 /* PBC CPLD on CS4 */
209 /* Is 27MHz switch set? */
217 ldreq r1, MPCTL_PARAM_532
218 ldrne r1, MPCTL_PARAM_532_27
222 /* Set UPLL=240MHz, USB=60MHz */
226 ldreq r1, UPCTL_PARAM_240
227 ldrne r1, UPCTL_PARAM_240_27
230 /* default CLKO to 1/8 of the ARM core */
232 add r1, r1, #0x00000006
236 /* RedBoot sets 0x3f, 7, 7, 3, 5, 1, 3, 0 */
237 /* REG CCM_PDR0, PDR0_CSI_PODF(0x3f) | PDR0_CSI_PRDF(7) | PDR0_PER_PODF(7) | PDR0_HSP_PODF(2) | PDR0_NFC_PODF(6) | PDR0_IPG_PODF(1) | PDR0_MAX_PODF(2) | PDR0_MCU_PODF(0)*/
239 /* Redboot: 0, 51, 10, 12 / 0, 14, 9, 13 */
240 /* REG CCM_MPCTL, PLL_PD(0) | PLL_MFD(0x33) | PLL_MFI(7) | PLL_MFN(0x23)*/
241 /* Default: 1, 4, 12, 1 */
242 REG CCM_SPCTL, PLL_PD(1) | PLL_MFD(4) | PLL_MFI(12) | PLL_MFN(1)
244 /* B8xxxxxx - NAND, 8xxxxxxx - CSD0 RAM */
245 REG 0xB8001010, 0x00000004
246 REG 0xB8001004, 0x006ac73a
247 REG 0xB8001000, 0x92100000
248 REG 0x80000f00, 0x12344321
249 REG 0xB8001000, 0xa2100000
250 REG 0x80000000, 0x12344321
251 REG 0x80000000, 0x12344321
252 REG 0xB8001000, 0xb2100000
253 REG8 0x80000033, 0xda
254 REG8 0x81000000, 0xff
255 REG 0xB8001000, 0x82226080
256 REG 0x80000000, 0xDEADBEEF
257 REG 0xB8001010, 0x0000000c
262 .word (((1-1) << 26) + ((52-1) << 16) + (10 << 10) + (12 << 0))
264 .word (((1-1) << 26) + ((15-1) << 16) + (9 << 10) + (13 << 0))
266 .word (((2-1) << 26) + ((13-1) << 16) + (9 << 10) + (3 << 0))
268 .word (((2-1) << 26) + ((9 -1) << 16) + (8 << 10) + (8 << 0))