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