blob: 48eee67129fac8f063ce24dd07a5a2f32625a204 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
David Purdy415d07e2012-03-27 16:01:09 +00002/*
Tony Dinh670fffd2022-02-08 18:56:22 -08003 * Copyright (C) 2022 Tony Dinh <mibodhi@gmail.com>
David Purdy415d07e2012-03-27 16:01:09 +00004 * Copyright (C) 2012
5 * David Purdy <david.c.purdy@gmail.com>
6 *
7 * Based on Kirkwood support:
8 * (C) Copyright 2009
9 * Marvell Semiconductor <www.marvell.com>
10 * Written-by: Prafulla Wadaskar <prafulla@marvell.com>
David Purdy415d07e2012-03-27 16:01:09 +000011 */
12
Simon Glass97589732020-05-10 11:40:02 -060013#include <init.h>
Simon Glass0f2af882020-05-10 11:40:05 -060014#include <log.h>
Tony Dinh670fffd2022-02-08 18:56:22 -080015#include <netdev.h>
David Purdy415d07e2012-03-27 16:01:09 +000016#include <asm/arch/cpu.h>
Stefan Roesec2437842014-10-22 12:13:06 +020017#include <asm/arch/soc.h>
David Purdy415d07e2012-03-27 16:01:09 +000018#include <asm/arch/mpp.h>
Simon Glass3ba929a2020-10-30 21:38:53 -060019#include <asm/global_data.h>
Tony Dinh670fffd2022-02-08 18:56:22 -080020#include <linux/bitops.h>
David Purdy415d07e2012-03-27 16:01:09 +000021
22DECLARE_GLOBAL_DATA_PTR;
23
Tony Dinh670fffd2022-02-08 18:56:22 -080024/* GPIO configuration */
25#define POGO_E02_OE_LOW (~(0))
26#define POGO_E02_OE_HIGH (~(0))
27#define POGO_E02_OE_VAL_LOW BIT(29)
28#define POGO_E02_OE_VAL_HIGH 0
29
David Purdy415d07e2012-03-27 16:01:09 +000030int board_early_init_f(void)
31{
32 /*
33 * default gpio configuration
34 * There are maximum 64 gpios controlled through 2 sets of registers
35 * the below configuration configures mainly initial LED status
36 */
Stefan Roesec50ab392014-10-22 12:13:11 +020037 mvebu_config_gpio(POGO_E02_OE_VAL_LOW,
38 POGO_E02_OE_VAL_HIGH,
39 POGO_E02_OE_LOW, POGO_E02_OE_HIGH);
David Purdy415d07e2012-03-27 16:01:09 +000040
41 /* Multi-Purpose Pins Functionality configuration */
Albert ARIBAUD4d424312012-11-26 11:27:36 +000042 static const u32 kwmpp_config[] = {
David Purdy415d07e2012-03-27 16:01:09 +000043 MPP0_NF_IO2,
44 MPP1_NF_IO3,
45 MPP2_NF_IO4,
46 MPP3_NF_IO5,
47 MPP4_NF_IO6,
48 MPP5_NF_IO7,
49 MPP6_SYSRST_OUTn,
50 MPP7_GPO,
51 MPP8_UART0_RTS,
52 MPP9_UART0_CTS,
53 MPP10_UART0_TXD,
54 MPP11_UART0_RXD,
55 MPP12_SD_CLK,
56 MPP13_SD_CMD,
57 MPP14_SD_D0,
58 MPP15_SD_D1,
59 MPP16_SD_D2,
60 MPP17_SD_D3,
61 MPP18_NF_IO0,
62 MPP19_NF_IO1,
63 MPP29_TSMP9, /* USB Power Enable */
64 MPP48_GPIO, /* LED green */
65 MPP49_GPIO, /* LED orange */
66 0
67 };
Valentin Longchamp7d0d5022012-06-01 01:31:00 +000068 kirkwood_mpp_conf(kwmpp_config, NULL);
David Purdy415d07e2012-03-27 16:01:09 +000069 return 0;
70}
71
Tony Dinh670fffd2022-02-08 18:56:22 -080072int board_eth_init(struct bd_info *bis)
73{
74 return cpu_eth_init(bis);
75}
76
David Purdy415d07e2012-03-27 16:01:09 +000077int board_init(void)
78{
79 /* Boot parameters address */
Stefan Roese0b741752014-10-22 12:13:13 +020080 gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
David Purdy415d07e2012-03-27 16:01:09 +000081
82 return 0;
83}