xref: /openbmc/u-boot/board/freescale/mx7ulp_evk/plugin.S (revision 83d290c56fab2d38cd1ab4c4cc7099559c1d5046)
1*83d290c5STom Rini/* SPDX-License-Identifier: GPL-2.0+ */
277fa0457SPeng Fan/*
377fa0457SPeng Fan * Copyright (C) 2016 Freescale Semiconductor, Inc.
477fa0457SPeng Fan */
577fa0457SPeng Fan
677fa0457SPeng Fan#include <config.h>
777fa0457SPeng Fan
877fa0457SPeng Fan.macro imx7ulp_ddr_freq_decrease
977fa0457SPeng Fan	ldr r2, =0x403f0000
1077fa0457SPeng Fan	ldr r3, =0x00000000
1177fa0457SPeng Fan	str r3, [r2, #0xdc]
1277fa0457SPeng Fan
1377fa0457SPeng Fan	ldr r2, =0x403e0000
1477fa0457SPeng Fan	ldr r3, =0x01000020
1577fa0457SPeng Fan	str r3, [r2, #0x40]
1677fa0457SPeng Fan	ldr r3, =0x01000000
1777fa0457SPeng Fan	str r3, [r2, #0x500]
1877fa0457SPeng Fan	ldr r3, =0x80808080
1977fa0457SPeng Fan	str r3, [r2, #0x50c]
2077fa0457SPeng Fan	ldr r3, =0x00140000
2177fa0457SPeng Fan	str r3, [r2, #0x508]
2277fa0457SPeng Fan	ldr r3, =0x00000004
2377fa0457SPeng Fan	str r3, [r2, #0x510]
2477fa0457SPeng Fan	ldr r3, =0x00000002
2577fa0457SPeng Fan	str r3, [r2, #0x514]
2677fa0457SPeng Fan	ldr r3, =0x00000001
2777fa0457SPeng Fan	str r3, [r2, #0x500]
2877fa0457SPeng Fan
2977fa0457SPeng Fan	ldr r3, =0x01000000
3077fa0457SPeng Fanwait1:
3177fa0457SPeng Fan	ldr r4, [r2, #0x500]
3277fa0457SPeng Fan	and r4, r3
3377fa0457SPeng Fan	cmp r4, r3
3477fa0457SPeng Fan	bne wait1
3577fa0457SPeng Fan
3677fa0457SPeng Fan	ldr r3, =0x8080801E
3777fa0457SPeng Fan	str r3, [r2, #0x50c]
3877fa0457SPeng Fan
3977fa0457SPeng Fan	ldr r3, =0x00000040
4077fa0457SPeng Fanwait2:
4177fa0457SPeng Fan	ldr r4, [r2, #0x50c]
4277fa0457SPeng Fan	and r4, r3
4377fa0457SPeng Fan	cmp r4, r3
4477fa0457SPeng Fan	bne wait2
4577fa0457SPeng Fan
4677fa0457SPeng Fan	ldr r3, =0x00000001
4777fa0457SPeng Fan	str r3, [r2, #0x30]
4877fa0457SPeng Fan	ldr r3, =0x11000020
4977fa0457SPeng Fan	str r3, [r2, #0x40]
5077fa0457SPeng Fan
5177fa0457SPeng Fan	ldr r2, =0x403f0000
5277fa0457SPeng Fan	ldr r3, =0x42000000
5377fa0457SPeng Fan	str r3, [r2, #0xdc]
5477fa0457SPeng Fan
5577fa0457SPeng Fan.endm
5677fa0457SPeng Fan
5777fa0457SPeng Fan.macro imx7ulp_evk_ddr_setting
5877fa0457SPeng Fan
5977fa0457SPeng Fan	imx7ulp_ddr_freq_decrease
6077fa0457SPeng Fan
6177fa0457SPeng Fan	/* Enable MMDC PCC clock */
6277fa0457SPeng Fan	ldr r2, =0x40b30000
6377fa0457SPeng Fan	ldr r3, =0x40000000
6477fa0457SPeng Fan	str r3, [r2, #0xac]
6577fa0457SPeng Fan
6677fa0457SPeng Fan	/* Configure DDR pad */
6777fa0457SPeng Fan	ldr r0, =0x40ad0000
6877fa0457SPeng Fan	ldr r1, =0x00040000
6977fa0457SPeng Fan	str r1, [r0, #0x128]
7077fa0457SPeng Fan	ldr r1, =0x0
7177fa0457SPeng Fan	str r1, [r0, #0xf8]
7277fa0457SPeng Fan	ldr r1, =0x00000180
7377fa0457SPeng Fan	str r1, [r0, #0xd8]
7477fa0457SPeng Fan	ldr r1, =0x00000180
7577fa0457SPeng Fan	str r1, [r0, #0x108]
7677fa0457SPeng Fan	ldr r1, =0x00000180
7777fa0457SPeng Fan	str r1, [r0, #0x104]
7877fa0457SPeng Fan	ldr r1, =0x00010000
7977fa0457SPeng Fan	str r1, [r0, #0x124]
8077fa0457SPeng Fan	ldr r1, =0x0000018C
8177fa0457SPeng Fan	str r1, [r0, #0x80]
8277fa0457SPeng Fan	ldr r1, =0x0000018C
8377fa0457SPeng Fan	str r1, [r0, #0x84]
8477fa0457SPeng Fan	ldr r1, =0x0000018C
8577fa0457SPeng Fan	str r1, [r0, #0x88]
8677fa0457SPeng Fan	ldr r1, =0x0000018C
8777fa0457SPeng Fan	str r1, [r0, #0x8c]
8877fa0457SPeng Fan
8977fa0457SPeng Fan	ldr r1, =0x00010000
9077fa0457SPeng Fan	str r1, [r0, #0x120]
9177fa0457SPeng Fan	ldr r1, =0x00000180
9277fa0457SPeng Fan	str r1, [r0, #0x10c]
9377fa0457SPeng Fan	ldr r1, =0x00000180
9477fa0457SPeng Fan	str r1, [r0, #0x110]
9577fa0457SPeng Fan	ldr r1, =0x00000180
9677fa0457SPeng Fan	str r1, [r0, #0x114]
9777fa0457SPeng Fan	ldr r1, =0x00000180
9877fa0457SPeng Fan	str r1, [r0, #0x118]
9977fa0457SPeng Fan	ldr r1, =0x00000180
10077fa0457SPeng Fan	str r1, [r0, #0x90]
10177fa0457SPeng Fan	ldr r1, =0x00000180
10277fa0457SPeng Fan	str r1, [r0, #0x94]
10377fa0457SPeng Fan	ldr r1, =0x00000180
10477fa0457SPeng Fan	str r1, [r0, #0x98]
10577fa0457SPeng Fan	ldr r1, =0x00000180
10677fa0457SPeng Fan	str r1, [r0, #0x9c]
10777fa0457SPeng Fan	ldr r1, =0x00040000
10877fa0457SPeng Fan	str r1, [r0, #0xe0]
10977fa0457SPeng Fan	ldr r1, =0x00040000
11077fa0457SPeng Fan	str r1, [r0, #0xe4]
11177fa0457SPeng Fan
11277fa0457SPeng Fan	ldr r0, =0x40ab0000
11377fa0457SPeng Fan	ldr r1, =0x00008000
11477fa0457SPeng Fan	str r1, [r0, #0x1c]
11577fa0457SPeng Fan	ldr r1, =0xA1390003
11677fa0457SPeng Fan	str r1, [r0, #0x800]
11777fa0457SPeng Fan	ldr r1, =0x0D3900A0
11877fa0457SPeng Fan	str r1, [r0, #0x85c]
11977fa0457SPeng Fan	ldr r1, =0x00400000
12077fa0457SPeng Fan	str r1, [r0, #0x890]
12177fa0457SPeng Fan
12277fa0457SPeng Fan	ldr r1, =0x40404040
12377fa0457SPeng Fan	str r1, [r0, #0x848]
12477fa0457SPeng Fan	ldr r1, =0x40404040
12577fa0457SPeng Fan	str r1, [r0, #0x850]
12677fa0457SPeng Fan	ldr r1, =0x33333333
12777fa0457SPeng Fan	str r1, [r0, #0x81c]
12877fa0457SPeng Fan	ldr r1, =0x33333333
12977fa0457SPeng Fan	str r1, [r0, #0x820]
13077fa0457SPeng Fan	ldr r1, =0x33333333
13177fa0457SPeng Fan	str r1, [r0, #0x824]
13277fa0457SPeng Fan	ldr r1, =0x33333333
13377fa0457SPeng Fan	str r1, [r0, #0x828]
13477fa0457SPeng Fan
13577fa0457SPeng Fan	ldr r1, =0xf3333333
13677fa0457SPeng Fan	str r1, [r0, #0x82c]
13777fa0457SPeng Fan	ldr r1, =0xf3333333
13877fa0457SPeng Fan	str r1, [r0, #0x830]
13977fa0457SPeng Fan	ldr r1, =0xf3333333
14077fa0457SPeng Fan	str r1, [r0, #0x834]
14177fa0457SPeng Fan	ldr r1, =0xf3333333
14277fa0457SPeng Fan	str r1, [r0, #0x838]
14377fa0457SPeng Fan
14477fa0457SPeng Fan	ldr r1, =0x24922492
14577fa0457SPeng Fan	str r1, [r0, #0x8c0]
14677fa0457SPeng Fan	ldr r1, =0x00000800
14777fa0457SPeng Fan	str r1, [r0, #0x8b8]
14877fa0457SPeng Fan
14977fa0457SPeng Fan	ldr r1, =0x00020052
15077fa0457SPeng Fan	str r1, [r0, #0x4]
15177fa0457SPeng Fan	ldr r1, =0x292C42F3
15277fa0457SPeng Fan	str r1, [r0, #0xc]
15377fa0457SPeng Fan	ldr r1, =0x00100A22
15477fa0457SPeng Fan	str r1, [r0, #0x10]
15577fa0457SPeng Fan	ldr r1, =0x00120556
15677fa0457SPeng Fan	str r1, [r0, #0x38]
15777fa0457SPeng Fan	ldr r1, =0x00C700DB
15877fa0457SPeng Fan	str r1, [r0, #0x14]
15977fa0457SPeng Fan	ldr r1, =0x00211718
16077fa0457SPeng Fan	str r1, [r0, #0x18]
16177fa0457SPeng Fan
16277fa0457SPeng Fan	ldr r1, =0x0F9F26D2
16377fa0457SPeng Fan	str r1, [r0, #0x2c]
16477fa0457SPeng Fan	ldr r1, =0x009F0E10
16577fa0457SPeng Fan	str r1, [r0, #0x30]
16677fa0457SPeng Fan	ldr r1, =0x0000003F
16777fa0457SPeng Fan	str r1, [r0, #0x40]
16877fa0457SPeng Fan	ldr r1, =0xC3190000
16977fa0457SPeng Fan	str r1, [r0, #0x0]
17077fa0457SPeng Fan
17177fa0457SPeng Fan	ldr r1, =0x00008050
17277fa0457SPeng Fan	str r1, [r0, #0x1c]
17377fa0457SPeng Fan	ldr r1, =0x00008058
17477fa0457SPeng Fan	str r1, [r0, #0x1c]
17577fa0457SPeng Fan	ldr r1, =0x003F8030
17677fa0457SPeng Fan	str r1, [r0, #0x1c]
17777fa0457SPeng Fan	ldr r1, =0x003F8038
17877fa0457SPeng Fan	str r1, [r0, #0x1c]
17977fa0457SPeng Fan	ldr r1, =0xFF0A8030
18077fa0457SPeng Fan	str r1, [r0, #0x1c]
18177fa0457SPeng Fan	ldr r1, =0xFF0A8038
18277fa0457SPeng Fan	str r1, [r0, #0x1c]
18377fa0457SPeng Fan	ldr r1, =0x04028030
18477fa0457SPeng Fan	str r1, [r0, #0x1c]
18577fa0457SPeng Fan	ldr r1, =0x04028038
18677fa0457SPeng Fan	str r1, [r0, #0x1c]
18777fa0457SPeng Fan	ldr r1, =0x83018030
18877fa0457SPeng Fan	str r1, [r0, #0x1c]
18977fa0457SPeng Fan	ldr r1, =0x83018038
19077fa0457SPeng Fan	str r1, [r0, #0x1c]
19177fa0457SPeng Fan	ldr r1, =0x01038030
19277fa0457SPeng Fan	str r1, [r0, #0x1c]
19377fa0457SPeng Fan	ldr r1, =0x01038038
19477fa0457SPeng Fan	str r1, [r0, #0x1c]
19577fa0457SPeng Fan
19677fa0457SPeng Fan	ldr r1, =0x20000000
19777fa0457SPeng Fan	str r1, [r0, #0x83c]
19877fa0457SPeng Fan
19977fa0457SPeng Fan	ldr r1, =0x00001800
20077fa0457SPeng Fan	str r1, [r0, #0x20]
20177fa0457SPeng Fan	ldr r1, =0xA1310000
20277fa0457SPeng Fan	str r1, [r0, #0x800]
20377fa0457SPeng Fan	ldr r1, =0x00020052
20477fa0457SPeng Fan	str r1, [r0, #0x4]
20577fa0457SPeng Fan	ldr r1, =0x00011006
20677fa0457SPeng Fan	str r1, [r0, #0x404]
20777fa0457SPeng Fan	ldr r1, =0x00000000
20877fa0457SPeng Fan	str r1, [r0, #0x1c]
20977fa0457SPeng Fan
21077fa0457SPeng Fan.endm
21177fa0457SPeng Fan
21277fa0457SPeng Fan.macro imx7ulp_clock_gating
21377fa0457SPeng Fan.endm
21477fa0457SPeng Fan
21577fa0457SPeng Fan.macro imx7ulp_qos_setting
21677fa0457SPeng Fan.endm
21777fa0457SPeng Fan
21877fa0457SPeng Fan.macro imx7ulp_ddr_setting
21977fa0457SPeng Fan	imx7ulp_evk_ddr_setting
22077fa0457SPeng Fan.endm
22177fa0457SPeng Fan
22277fa0457SPeng Fan/* include the common plugin code here */
22377fa0457SPeng Fan#include <asm/arch/mx7ulp_plugin.S>
224