summaryrefslogtreecommitdiffstats
path: root/arch/mips/boards/netgear-wg102/include/board/board_pbl_start.h
blob: 9fb220519fecbcbb239d4954171ecd96180c5097 (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
/*
 * Copyright (C) 2013 Antony Pavlov <antonynpavlov@gmail.com>
 * Copyright (C) 2013 Oleksij Rempel <linux@rempel-privat.de>
 *
 * This file is part of barebox.
 * See file CREDITS for list of people who contributed to this project.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 */

#include <asm/pbl_macros.h>
#include <mach/pbl_macros.h>
#include <mach/ar2312_regs.h>

#include <mach/debug_ll.h>

	.macro	board_pbl_start
	.set	push
	.set	noreorder

	mips_barebox_10h

	mips_disable_interrupts

	pbl_ar2312_pll

	pbl_ar2312_rst_uart0
	debug_ll_ns16550_init

	debug_ll_outc 'a'
	debug_ll_ns16550_outnl

	/* check if SDRAM is already configured,
	 * if yes, we are probably starting
	 * as second stage loader and can skip configuration */
	la	t0, KSEG1 | AR2312_MEM_CFG1
	lw	t1, 0(t0)
	and	t0, t1, MEM_CFG1_E0
	beq	zero, t0, 1f
	 nop

	pbl_probe_mem t0, t1, KSEG1
	beq t0, t1, sdram_configured
	 nop

1:
	/* start SDRAM configuration */
	pbl_ar2312_x16_sdram

	/* check one more time. if some thing wrong,
	 * we don't need to continue */
	pbl_probe_mem t0, t1, KSEG1
	beq t0, t1, sdram_configured
	 nop
	debug_ll_outc '#'
	debug_ll_ns16550_outnl

1:
	b	1b /* dead end */
	 nop

sdram_configured:
	debug_ll_outc 'b'
	debug_ll_ns16550_outnl

	copy_to_link_location	pbl_start

	.set	pop
	.endm