]> Git Repo - J-u-boot.git/blame - board/LaCie/netspace_v2/netspace_v2.c
env: Rename eth_setenv_enetaddr() to eth_env_set_enetaddr()
[J-u-boot.git] / board / LaCie / netspace_v2 / netspace_v2.c
CommitLineData
79642098
SG
1/*
2 * Copyright (C) 2011 Simon Guinot <[email protected]>
3 *
4 * Based on Kirkwood support:
5 * (C) Copyright 2009
6 * Marvell Semiconductor <www.marvell.com>
7 * Written-by: Prafulla Wadaskar <[email protected]>
8 *
1a459660 9 * SPDX-License-Identifier: GPL-2.0+
79642098
SG
10 */
11
12#include <common.h>
79642098 13#include <command.h>
c62db35d 14#include <asm/mach-types.h>
fc168cc5 15#include <asm/arch/cpu.h>
3dc23f78 16#include <asm/arch/soc.h>
79642098
SG
17#include <asm/arch/mpp.h>
18#include <asm/arch/gpio.h>
77ea071f 19
79642098 20#include "netspace_v2.h"
77ea071f 21#include "../common/common.h"
79642098
SG
22
23DECLARE_GLOBAL_DATA_PTR;
24
25int board_early_init_f(void)
26{
27 /* Gpio configuration */
d5c5132f
SR
28 mvebu_config_gpio(NETSPACE_V2_OE_VAL_LOW, NETSPACE_V2_OE_VAL_HIGH,
29 NETSPACE_V2_OE_LOW, NETSPACE_V2_OE_HIGH);
79642098
SG
30
31 /* Multi-Purpose Pins Functionality configuration */
9d86f0c3 32 static const u32 kwmpp_config[] = {
79642098
SG
33 MPP0_SPI_SCn,
34 MPP1_SPI_MOSI,
35 MPP2_SPI_SCK,
36 MPP3_SPI_MISO,
37 MPP4_NF_IO6,
38 MPP5_NF_IO7,
39 MPP6_SYSRST_OUTn,
40 MPP7_GPO, /* Fan speed (bit 1) */
41 MPP8_TW_SDA,
42 MPP9_TW_SCK,
43 MPP10_UART0_TXD,
44 MPP11_UART0_RXD,
45 MPP12_GPO, /* Red led */
46 MPP14_GPIO, /* USB fuse */
47 MPP16_GPIO, /* SATA 0 power */
48 MPP17_GPIO, /* SATA 1 power */
49 MPP18_NF_IO0,
50 MPP19_NF_IO1,
51 MPP20_SATA1_ACTn,
52 MPP21_SATA0_ACTn,
53 MPP22_GPIO, /* Fan speed (bit 0) */
54 MPP23_GPIO, /* Fan power */
55 MPP24_GPIO, /* USB mode select */
56 MPP25_GPIO, /* Fan rotation fail */
57 MPP26_GPIO, /* USB vbus-in detection */
58 MPP28_GPIO, /* USB enable vbus-out */
59 MPP29_GPIO, /* Blue led (slow register) */
60 MPP30_GPIO, /* Blue led (command register) */
61 MPP31_GPIO, /* Board power off */
62 MPP32_GPIO, /* Button (0 = Released, 1 = Pushed) */
63 MPP33_GPIO, /* Fan speed (bit 2) */
64 0
65 };
84683638 66 kirkwood_mpp_conf(kwmpp_config, NULL);
79642098
SG
67
68 return 0;
69}
70
71int board_init(void)
72{
73 /* Machine number */
74 gd->bd->bi_arch_number = CONFIG_MACH_TYPE;
75
76 /* Boot parameters address */
96c5f081 77 gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
79642098
SG
78
79 return 0;
80}
81
77ea071f 82#if defined(CONFIG_MISC_INIT_R)
0bfb66b6
SG
83int misc_init_r(void)
84{
85#if defined(CONFIG_CMD_I2C) && defined(CONFIG_SYS_I2C_EEPROM_ADDR)
86 if (!getenv("ethaddr")) {
0bfb66b6 87 uchar mac[6];
77ea071f 88 if (lacie_read_mac_address(mac) == 0)
fd1e959e 89 eth_env_set_enetaddr("ethaddr", mac);
0bfb66b6 90 }
77ea071f 91#endif
0bfb66b6
SG
92 return 0;
93}
77ea071f 94#endif
0bfb66b6 95
77ea071f 96#if defined(CONFIG_CMD_NET) && defined(CONFIG_RESET_PHY_R)
79642098
SG
97/* Configure and initialize PHY */
98void reset_phy(void)
99{
37235496
SG
100#if defined(CONFIG_NETSPACE_LITE_V2) || defined(CONFIG_NETSPACE_MINI_V2)
101 mv_phy_88e1318_init("egiga0", 0);
102#else
c59c0857 103 mv_phy_88e1116_init("egiga0", 8);
37235496 104#endif
79642098 105}
77ea071f 106#endif
79642098 107
77ea071f 108#if defined(CONFIG_KIRKWOOD_GPIO)
79642098
SG
109/* Return GPIO button status */
110static int
111do_read_button(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
112{
113 return kw_gpio_get_value(NETSPACE_V2_GPIO_BUTTON);
114}
115
116U_BOOT_CMD(button, 1, 1, do_read_button,
117 "Return GPIO button status 0=off 1=on", "");
77ea071f 118#endif
This page took 0.332611 seconds and 4 git commands to generate.