blob: d42da2bc5672c1f46bb4d4edea86b9f1cfacf0c3 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Albert ARIBAUD \(3ADEV\)ee69a392015-03-31 11:40:51 +02002/*
3 * WORK Microwave work_92105 board low level init
4 *
5 * (C) Copyright 2014 DENX Software Engineering GmbH
6 * Written-by: Albert ARIBAUD <albert.aribaud@3adev.fr>
7 *
8 * Low level init is called from SPL to set up the clocks.
9 * On entry, the LPC3250 is in Direct Run mode with all clocks
10 * running at 13 MHz; on exit, ARM clock is 208 MHz, HCLK is
11 * 104 MHz and PCLK is 13 MHz.
12 *
13 * This code must run from SRAM so that the clock changes do
14 * not prevent it from executing.
Albert ARIBAUD \(3ADEV\)ee69a392015-03-31 11:40:51 +020015 */
16
17.globl lowlevel_init
18
19lowlevel_init:
20
21 /* Set ARM, HCLK, PCLK dividers for normal mode */
22 ldr r0, =0x0000003D
23 ldr r1, =0x40004040
24 str r0, [r1]
25
26 /* Start HCLK PLL for 208 MHz */
27 ldr r0, =0x0001401E
28 ldr r1, =0x40004058
29 str r0, [r1]
30
31 /* wait for HCLK PLL to lock */
321:
33 ldr r0, [r1]
34 ands r0, r0, #1
35 beq 1b
36
37 /* switch to normal mode */
38 ldr r1, =0x40004044
39 ldr r0, [r1]
40 orr r0, #0x00000004
41 str r0, [r1]
42
Bin Meng75574052016-02-05 19:30:11 -080043 /* Return to U-Boot via saved link register */
Albert ARIBAUD \(3ADEV\)ee69a392015-03-31 11:40:51 +020044 mov pc, lr