blob: f9bc07649e0a7ddd7cc2eed263881f57b61f558f [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Luka Perkov2a3ce882012-04-17 09:22:17 +00002/*
3 * Copyright (C) 2011-2012
4 * Gerald Kerma <dreagle@doukki.net>
Luka Perkove91505d2012-12-03 03:24:15 +00005 * Luka Perkov <luka@openwrt.org>
Luka Perkov2a3ce882012-04-17 09:22:17 +00006 * Simon Baatz <gmbnomis@gmail.com>
Luka Perkov2a3ce882012-04-17 09:22:17 +00007 */
8
9#include <common.h>
Simon Glass97589732020-05-10 11:40:02 -060010#include <init.h>
Luka Perkov2a3ce882012-04-17 09:22:17 +000011#include <miiphy.h>
Simon Glass3ba929a2020-10-30 21:38:53 -060012#include <asm/global_data.h>
Simon Baatz50135dd2012-07-20 09:59:14 +000013#include <asm/io.h>
Luka Perkov2a3ce882012-04-17 09:22:17 +000014#include <asm/arch/cpu.h>
Stefan Roesec2437842014-10-22 12:13:06 +020015#include <asm/arch/soc.h>
Luka Perkov2a3ce882012-04-17 09:22:17 +000016#include <asm/arch/mpp.h>
17#include "ib62x0.h"
18
19DECLARE_GLOBAL_DATA_PTR;
20
21int board_early_init_f(void)
22{
23 /*
24 * default gpio configuration
25 * There are maximum 64 gpios controlled through 2 sets of registers
26 * the below configuration configures mainly initial LED status
27 */
Stefan Roesec50ab392014-10-22 12:13:11 +020028 mvebu_config_gpio(IB62x0_OE_VAL_LOW,
29 IB62x0_OE_VAL_HIGH,
30 IB62x0_OE_LOW, IB62x0_OE_HIGH);
Luka Perkov2a3ce882012-04-17 09:22:17 +000031
Simon Baatz50135dd2012-07-20 09:59:14 +000032 /* Set SATA activity LEDs to default off */
33 writel(MVSATAHC_LED_POLARITY_CTRL, MVSATAHC_LED_CONF_REG);
Luka Perkov2a3ce882012-04-17 09:22:17 +000034 /* Multi-Purpose Pins Functionality configuration */
Albert ARIBAUD4d424312012-11-26 11:27:36 +000035 static const u32 kwmpp_config[] = {
Luka Perkov2a3ce882012-04-17 09:22:17 +000036 MPP0_NF_IO2,
37 MPP1_NF_IO3,
38 MPP2_NF_IO4,
39 MPP3_NF_IO5,
40 MPP4_NF_IO6,
41 MPP5_NF_IO7,
42 MPP6_SYSRST_OUTn,
43 MPP8_TW_SDA,
44 MPP9_TW_SCK,
45 MPP10_UART0_TXD,
46 MPP11_UART0_RXD,
47 MPP18_NF_IO0,
48 MPP19_NF_IO1,
49 MPP20_SATA1_ACTn,
50 MPP21_SATA0_ACTn,
51 MPP22_GPIO, /* Power LED red */
52 MPP24_GPIO, /* Power off device */
53 MPP25_GPIO, /* Power LED green */
54 MPP27_GPIO, /* USB transfer LED */
55 MPP28_GPIO, /* Reset button */
56 MPP29_GPIO, /* USB Copy button */
57 0
58 };
Valentin Longchamp7d0d5022012-06-01 01:31:00 +000059 kirkwood_mpp_conf(kwmpp_config, NULL);
Luka Perkov2a3ce882012-04-17 09:22:17 +000060 return 0;
61}
62
63int board_init(void)
64{
65 /* adress of boot parameters */
Stefan Roese0b741752014-10-22 12:13:13 +020066 gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
Luka Perkov2a3ce882012-04-17 09:22:17 +000067
68 return 0;
69}