blob: 1153b188e7e4bd948328a875f0cde834115fa919 [file] [log] [blame]
Chris Packham199e3182019-04-11 22:22:53 +12001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright (C) 2015 Stefan Roese <sr@denx.de>
4 */
5
6#include <common.h>
7#include <i2c.h>
Simon Glass97589732020-05-10 11:40:02 -06008#include <init.h>
Chris Packham199e3182019-04-11 22:22:53 +12009#include <asm/gpio.h>
10#include <linux/mbus.h>
11#include <linux/io.h>
12#include <asm/arch/cpu.h>
13#include <asm/arch/soc.h>
14
15DECLARE_GLOBAL_DATA_PTR;
16
17/*
18 * These values and defines are taken from the Marvell U-Boot version
19 * "u-boot-2013.01-2016_T1.0.eng_drop_v6"
20 */
21#define DB_DX_AC3_GPP_OUT_ENA_LOW (~(BIT(0) | BIT(2) | BIT(3) | BIT(4) | BIT(6) | BIT(12) \
22 | BIT(13) | BIT(16) | BIT(17) | BIT(20) | BIT(29) | BIT(30)))
23#define DB_DX_AC3_GPP_OUT_ENA_MID (~(0))
24#define DB_DX_AC3_GPP_OUT_VAL_LOW (BIT(0) | BIT(2) | BIT(3) | BIT(4) | BIT(6) | BIT(12) \
25 | BIT(13) | BIT(16) | BIT(17) | BIT(20) | BIT(29) | BIT(30))
26#define DB_DX_AC3_GPP_OUT_VAL_MID 0x0
27#define DB_DX_AC3_GPP_POL_LOW 0x0
28#define DB_DX_AC3_GPP_POL_MID 0x0
29
30int board_early_init_f(void)
31{
32 /* Configure MPP */
33 writel(0x00142222, MVEBU_MPP_BASE + 0x00);
34 writel(0x11122000, MVEBU_MPP_BASE + 0x04);
35 writel(0x44444004, MVEBU_MPP_BASE + 0x08);
36 writel(0x14444444, MVEBU_MPP_BASE + 0x0c);
37 writel(0x00000001, MVEBU_MPP_BASE + 0x10);
38
39 /* Set GPP Out value */
40 writel(DB_DX_AC3_GPP_OUT_VAL_LOW, MVEBU_GPIO0_BASE + 0x00);
41 writel(DB_DX_AC3_GPP_OUT_VAL_MID, MVEBU_GPIO1_BASE + 0x00);
42
43 /* Set GPP Polarity */
44 writel(DB_DX_AC3_GPP_POL_LOW, MVEBU_GPIO0_BASE + 0x0c);
45 writel(DB_DX_AC3_GPP_POL_MID, MVEBU_GPIO1_BASE + 0x0c);
46
47 /* Set GPP Out Enable */
48 writel(DB_DX_AC3_GPP_OUT_ENA_LOW, MVEBU_GPIO0_BASE + 0x04);
49 writel(DB_DX_AC3_GPP_OUT_ENA_MID, MVEBU_GPIO1_BASE + 0x04);
50
51 return 0;
52}
53
54int board_init(void)
55{
56 /* address of boot parameters */
57 gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
58
59 return 0;
60}
61
62#ifdef CONFIG_DISPLAY_BOARDINFO
63int checkboard(void)
64{
65 puts("Board: " CONFIG_SYS_BOARD "\n");
66
67 return 0;
68}
69#endif