summaryrefslogtreecommitdiffstats
path: root/arch/arm/boards/dfi-fs700-m60/lowlevel.c
blob: 2995bd4db76a74da02b639e6cf6ae1cffdb49f5f (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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*
 * Copyright (C) 2013 Sascha Hauer <s.hauer@pengutronix.de>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 *
 * 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 <common.h>
#include <sizes.h>
#include <io.h>
#include <asm/sections.h>
#include <asm/mmu.h>
#include <asm/barebox-arm-head.h>
#include <asm/barebox-arm.h>
#include <mach/imx6-mmdc.h>
#include <mach/imx6-regs.h>

#include <debug_ll.h>

static inline void early_uart_init(void)
{
	writel(0x00000000, MX6_UART1_BASE_ADDR + 0x80);
	writel(0x00004027, MX6_UART1_BASE_ADDR + 0x84);
	writel(0x00000704, MX6_UART1_BASE_ADDR + 0x88);
	writel(0x00000a81, MX6_UART1_BASE_ADDR + 0x90);
	writel(0x0000002b, MX6_UART1_BASE_ADDR + 0x9c);
	writel(0x00013880, MX6_UART1_BASE_ADDR + 0xb0);
	writel(0x0000047f, MX6_UART1_BASE_ADDR + 0xa4);
	writel(0x0000c34f, MX6_UART1_BASE_ADDR + 0xa8);
	writel(0x00000001, MX6_UART1_BASE_ADDR + 0x80);
}

static inline void early_uart_init_6q(void)
{
	writel(0x3, MX6_IOMUXC_BASE_ADDR + 0x280);
	writel(0x3, MX6_IOMUXC_BASE_ADDR + 0x284);
	writel(0x1, MX6_IOMUXC_BASE_ADDR + 0x920);
	writel(0x0001b0b1, MX6_IOMUXC_BASE_ADDR + 0x650);
	writel(0x0001b0b1, MX6_IOMUXC_BASE_ADDR + 0x654);

	early_uart_init();
}

static inline void early_uart_init_6s(void)
{
	writel(0x3, MX6_IOMUXC_BASE_ADDR + 0x4c);
	writel(0x3, MX6_IOMUXC_BASE_ADDR + 0x50);
	writel(0x1, MX6_IOMUXC_BASE_ADDR + 0x8fc);
	writel(0x0001b0b1, MX6_IOMUXC_BASE_ADDR + 0x360);
	writel(0x0001b0b1, MX6_IOMUXC_BASE_ADDR + 0x364);

	early_uart_init();
}

extern char __dtb_imx6q_dfi_fs700_m60_6q_start[];

ENTRY_FUNCTION(start_imx6q_dfi_fs700_m60_6q, r0, r1, r2)
{
	uint32_t fdt;

	arm_cpu_lowlevel_init();

	arm_setup_stack(0x00940000 - 8);

	early_uart_init_6q();

	fdt = (uint32_t)__dtb_imx6q_dfi_fs700_m60_6q_start - get_runtime_offset();

	barebox_arm_entry(0x10000000, SZ_1G, fdt);
}

extern char __dtb_imx6dl_dfi_fs700_m60_6s_start[];

ENTRY_FUNCTION(start_imx6dl_dfi_fs700_m60_6s, r0, r1, r2)
{
	uint32_t fdt;
	int i;

	arm_cpu_lowlevel_init();

	arm_setup_stack(0x00920000 - 8);

	for (i = 0x68; i <= 0x80; i += 4)
		writel(0xffffffff, MX6_CCM_BASE_ADDR + i);

	early_uart_init_6s();

	fdt = (uint32_t)__dtb_imx6dl_dfi_fs700_m60_6s_start - get_runtime_offset();

	barebox_arm_entry(0x10000000, SZ_1G, fdt);
}