blob: 59e1218b411a18fd5169bc0cf032c9ac351960c5 [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
13#include <common.h>
Simon Glass97589732020-05-10 11:40:02 -060014#include <init.h>
Simon Glass0f2af882020-05-10 11:40:05 -060015#include <log.h>
Tony Dinh670fffd2022-02-08 18:56:22 -080016#include <netdev.h>
David Purdy415d07e2012-03-27 16:01:09 +000017#include <asm/arch/cpu.h>
Stefan Roesec2437842014-10-22 12:13:06 +020018#include <asm/arch/soc.h>
David Purdy415d07e2012-03-27 16:01:09 +000019#include <asm/arch/mpp.h>
Simon Glass3ba929a2020-10-30 21:38:53 -060020#include <asm/global_data.h>
Tony Dinh670fffd2022-02-08 18:56:22 -080021#include <linux/bitops.h>
David Purdy415d07e2012-03-27 16:01:09 +000022
23DECLARE_GLOBAL_DATA_PTR;
24
Tony Dinh670fffd2022-02-08 18:56:22 -080025/* GPIO configuration */
26#define POGO_E02_OE_LOW (~(0))
27#define POGO_E02_OE_HIGH (~(0))
28#define POGO_E02_OE_VAL_LOW BIT(29)
29#define POGO_E02_OE_VAL_HIGH 0
30
David Purdy415d07e2012-03-27 16:01:09 +000031int board_early_init_f(void)
32{
33 /*
34 * default gpio configuration
35 * There are maximum 64 gpios controlled through 2 sets of registers
36 * the below configuration configures mainly initial LED status
37 */
Stefan Roesec50ab392014-10-22 12:13:11 +020038 mvebu_config_gpio(POGO_E02_OE_VAL_LOW,
39 POGO_E02_OE_VAL_HIGH,
40 POGO_E02_OE_LOW, POGO_E02_OE_HIGH);
David Purdy415d07e2012-03-27 16:01:09 +000041
42 /* Multi-Purpose Pins Functionality configuration */
Albert ARIBAUD4d424312012-11-26 11:27:36 +000043 static const u32 kwmpp_config[] = {
David Purdy415d07e2012-03-27 16:01:09 +000044 MPP0_NF_IO2,
45 MPP1_NF_IO3,
46 MPP2_NF_IO4,
47 MPP3_NF_IO5,
48 MPP4_NF_IO6,
49 MPP5_NF_IO7,
50 MPP6_SYSRST_OUTn,
51 MPP7_GPO,
52 MPP8_UART0_RTS,
53 MPP9_UART0_CTS,
54 MPP10_UART0_TXD,
55 MPP11_UART0_RXD,
56 MPP12_SD_CLK,
57 MPP13_SD_CMD,
58 MPP14_SD_D0,
59 MPP15_SD_D1,
60 MPP16_SD_D2,
61 MPP17_SD_D3,
62 MPP18_NF_IO0,
63 MPP19_NF_IO1,
64 MPP29_TSMP9, /* USB Power Enable */
65 MPP48_GPIO, /* LED green */
66 MPP49_GPIO, /* LED orange */
67 0
68 };
Valentin Longchamp7d0d5022012-06-01 01:31:00 +000069 kirkwood_mpp_conf(kwmpp_config, NULL);
David Purdy415d07e2012-03-27 16:01:09 +000070 return 0;
71}
72
Tony Dinh670fffd2022-02-08 18:56:22 -080073int board_eth_init(struct bd_info *bis)
74{
75 return cpu_eth_init(bis);
76}
77
David Purdy415d07e2012-03-27 16:01:09 +000078int board_init(void)
79{
80 /* Boot parameters address */
Stefan Roese0b741752014-10-22 12:13:13 +020081 gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
David Purdy415d07e2012-03-27 16:01:09 +000082
83 return 0;
84}