summaryrefslogtreecommitdiffstats
path: root/arch/arm/boards/freescale-vf610-twr/lowlevel.c
blob: 65042736c9ec6e0240bc138803fe034273fa035e (plain) (blame)
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
#include <common.h>
#include <linux/sizes.h>
#include <mach/generic.h>
#include <asm/barebox-arm-head.h>
#include <asm/barebox-arm.h>
#include <mach/vf610-regs.h>
#include <mach/clock-vf610.h>
#include <mach/iomux-vf610.h>
#include <debug_ll.h>

static inline void setup_uart(void)
{
	void __iomem *iomuxbase = IOMEM(VF610_IOMUXC_BASE_ADDR);

	vf610_ungate_all_peripherals();

	/*
	 * VF610_PAD_PTB4__UART1_TX
	 */
	writel(VF610_UART_PAD_CTRL | (2 << 20), iomuxbase + 0x0068);
	writel(0, iomuxbase + 0x0380);

	vf610_uart_setup_ll();
}

extern char __dtb_vf610_twr_start[];

ENTRY_FUNCTION(start_vf610_twr, r0, r1, r2)
{
	int i;
	void *fdt;
	void __iomem *mscm = IOMEM(VF610_MSCM_BASE_ADDR);

	vf610_cpu_lowlevel_init();

	for (i = 0; i < VF610_MSCM_IRSPRC_NUM; i++)
		writew(VF610_MSCM_IRSPRC_CP0_EN,
		       mscm + VF610_MSCM_IRSPRC(i));

	if (IS_ENABLED(CONFIG_DEBUG_LL))
		setup_uart();

	fdt = __dtb_vf610_twr_start - get_runtime_offset();
	barebox_arm_entry(0x80000000, SZ_128M, fdt);
}