summaryrefslogtreecommitdiffstats
path: root/arch/arm/boards/tqma53/lowlevel.c
blob: 97a7ac556e556497b6970be9e8d0f013110aa9e6 (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
#include <common.h>
#include <debug_ll.h>
#include <io.h>
#include <mach/esdctl.h>
#include <asm/barebox-arm-head.h>
#include <asm/barebox-arm.h>
#include <mach/imx5.h>
#include <mach/imx53-regs.h>
#include <mach/generic.h>
#include <image-metadata.h>

extern char __dtb_imx53_mba53_start[];

static inline void setup_uart(void __iomem *base)
{
	/* Enable UART for lowlevel debugging purposes */
	writel(0x00000000, base + 0x80);
	writel(0x00004027, base + 0x84);
	writel(0x00000704, base + 0x88);
	writel(0x00000a81, base + 0x90);
	writel(0x0000002b, base + 0x9c);
	writel(0x0001046a, base + 0xb0);
	writel(0x0000047f, base + 0xa4);
	writel(0x0000a2c1, base + 0xa8);
	writel(0x00000001, base + 0x80);
}

static void __noreturn start_imx53_tqma53_common(void *fdt)
{
	if (IS_ENABLED(CONFIG_DEBUG_LL)) {
		writel(0x3, MX53_IOMUXC_BASE_ADDR + 0x278);
		writel(0x3, MX53_IOMUXC_BASE_ADDR + 0x27c);
		setup_uart((void *)MX53_UART2_BASE_ADDR);
		putc_ll('>');
	}

	imx53_barebox_entry(fdt);
}

BAREBOX_IMD_TAG_STRING(tqma53_memsize_512M, IMD_TYPE_PARAMETER, "memsize=512", 0);

ENTRY_FUNCTION(start_imx53_mba53_512mib, r0, r1, r2)
{
	void *fdt;

	imx5_cpu_lowlevel_init();

	arm_setup_stack(MX53_IRAM_BASE_ADDR + MX53_IRAM_SIZE);

	IMD_USED(tqma53_memsize_512M);

	imx53_init_lowlevel_early(800);

	fdt = __dtb_imx53_mba53_start + get_runtime_offset();

	start_imx53_tqma53_common(fdt);
}

BAREBOX_IMD_TAG_STRING(tqma53_memsize_1G, IMD_TYPE_PARAMETER, "memsize=1024", 0);

ENTRY_FUNCTION(start_imx53_mba53_1gib, r0, r1, r2)
{
	void *fdt;

	imx5_cpu_lowlevel_init();

	arm_setup_stack(MX53_IRAM_BASE_ADDR + MX53_IRAM_SIZE);

	IMD_USED(tqma53_memsize_1G);

	imx53_init_lowlevel_early(800);

	fdt = __dtb_imx53_mba53_start + get_runtime_offset();

	start_imx53_tqma53_common(fdt);
}