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