4 * Based on Kirkwood support:
6 * Marvell Semiconductor <www.marvell.com>
9 * SPDX-License-Identifier: GPL-2.0+
14 #include <asm/arch/cpu.h>
15 #include <asm/arch/kirkwood.h>
16 #include <asm/arch/mpp.h>
17 #include <asm/arch/gpio.h>
19 #include "netspace_v2.h"
20 #include "../common/common.h"
22 DECLARE_GLOBAL_DATA_PTR;
24 int board_early_init_f(void)
26 /* Gpio configuration */
27 kw_config_gpio(NETSPACE_V2_OE_VAL_LOW, NETSPACE_V2_OE_VAL_HIGH,
28 NETSPACE_V2_OE_LOW, NETSPACE_V2_OE_HIGH);
30 /* Multi-Purpose Pins Functionality configuration */
31 static const u32 kwmpp_config[] = {
39 MPP7_GPO, /* Fan speed (bit 1) */
44 MPP12_GPO, /* Red led */
45 MPP14_GPIO, /* USB fuse */
46 MPP16_GPIO, /* SATA 0 power */
47 MPP17_GPIO, /* SATA 1 power */
52 MPP22_GPIO, /* Fan speed (bit 0) */
53 MPP23_GPIO, /* Fan power */
54 MPP24_GPIO, /* USB mode select */
55 MPP25_GPIO, /* Fan rotation fail */
56 MPP26_GPIO, /* USB vbus-in detection */
57 MPP28_GPIO, /* USB enable vbus-out */
58 MPP29_GPIO, /* Blue led (slow register) */
59 MPP30_GPIO, /* Blue led (command register) */
60 MPP31_GPIO, /* Board power off */
61 MPP32_GPIO, /* Button (0 = Released, 1 = Pushed) */
62 MPP33_GPIO, /* Fan speed (bit 2) */
65 kirkwood_mpp_conf(kwmpp_config, NULL);
73 gd->bd->bi_arch_number = CONFIG_MACH_TYPE;
75 /* Boot parameters address */
76 gd->bd->bi_boot_params = kw_sdram_bar(0) + 0x100;
81 #if defined(CONFIG_MISC_INIT_R)
84 #if defined(CONFIG_CMD_I2C) && defined(CONFIG_SYS_I2C_EEPROM_ADDR)
85 if (!getenv("ethaddr")) {
87 if (lacie_read_mac_address(mac) == 0)
88 eth_setenv_enetaddr("ethaddr", mac);
95 #if defined(CONFIG_CMD_NET) && defined(CONFIG_RESET_PHY_R)
96 /* Configure and initialize PHY */
99 #if defined(CONFIG_NETSPACE_LITE_V2) || defined(CONFIG_NETSPACE_MINI_V2)
100 mv_phy_88e1318_init("egiga0", 0);
102 mv_phy_88e1116_init("egiga0", 8);
107 #if defined(CONFIG_KIRKWOOD_GPIO)
108 /* Return GPIO button status */
110 do_read_button(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
112 return kw_gpio_get_value(NETSPACE_V2_GPIO_BUTTON);
115 U_BOOT_CMD(button, 1, 1, do_read_button,
116 "Return GPIO button status 0=off 1=on", "");