blob: ae1c586277f985bc92114d43d8e2f1304f1245f5 [file] [log] [blame]
Luka Kovacicb686e222019-05-07 19:35:55 +02001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright (C) 2015 Stefan Roese <sr@denx.de>
4 */
5
Luka Kovacicb686e222019-05-07 19:35:55 +02006#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>
Luka Kovacicb686e222019-05-07 19:35:55 +02009#include <asm/gpio.h>
Simon Glass4dcacfc2020-05-10 11:40:13 -060010#include <linux/bitops.h>
Luka Kovacicb686e222019-05-07 19:35:55 +020011#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) \
23 | BIT(6) | BIT(12) | BIT(13) \
24 | BIT(16) | BIT(17) | BIT(20) \
25 | BIT(29) | BIT(30)))
26#define DB_DX_AC3_GPP_OUT_ENA_MID (~(0))
27#define DB_DX_AC3_GPP_OUT_VAL_LOW (BIT(0) | BIT(2) | BIT(3) | BIT(4) \
28 | BIT(6) | BIT(12) | BIT(13) \
29 | BIT(16) | BIT(17) | BIT(20) \
30 | BIT(29) | BIT(30))
31#define DB_DX_AC3_GPP_OUT_VAL_MID 0x0
32#define DB_DX_AC3_GPP_POL_LOW 0x0
33#define DB_DX_AC3_GPP_POL_MID 0x0
34
35int board_early_init_f(void)
36{
37 /* Configure MPP */
38 writel(0x00142222, MVEBU_MPP_BASE + 0x00);
39 writel(0x11122000, MVEBU_MPP_BASE + 0x04);
40 writel(0x44444004, MVEBU_MPP_BASE + 0x08);
41 writel(0x14444444, MVEBU_MPP_BASE + 0x0c);
42 writel(0x00000001, MVEBU_MPP_BASE + 0x10);
43
44 /*
45 * MVEBU_GPIO0_BASE is the User LED
46 * MVEBU_GPIO1_BASE is the Reset Button (currently not used)
47 */
48
49 /* Set GPP Out value */
50 writel(DB_DX_AC3_GPP_OUT_VAL_LOW, MVEBU_GPIO0_BASE + 0x00);
51 /* writel(DB_DX_AC3_GPP_OUT_VAL_MID, MVEBU_GPIO1_BASE + 0x00); */
52
53 /* Set GPP Polarity */
54 writel(DB_DX_AC3_GPP_POL_LOW, MVEBU_GPIO0_BASE + 0x0c);
55 /* writel(DB_DX_AC3_GPP_POL_MID, MVEBU_GPIO1_BASE + 0x0c); */
56
57 /* Set GPP Out Enable */
58 writel(DB_DX_AC3_GPP_OUT_ENA_LOW, MVEBU_GPIO0_BASE + 0x04);
59 /* writel(DB_DX_AC3_GPP_OUT_ENA_MID, MVEBU_GPIO1_BASE + 0x04); */
60
61 return 0;
62}
63
64int board_init(void)
65{
66 /* address of boot parameters */
67 gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
68
69 return 0;
70}
71
72int checkboard(void)
73{
74 puts("Board: " CONFIG_SYS_BOARD "\n");
75
76 return 0;
77}