4 * Based on Kirkwood support:
6 * Marvell Semiconductor <www.marvell.com>
9 * See file CREDITS for list of people who contributed to this
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License as
14 * published by the Free Software Foundation; either version 2 of
15 * the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
25 #include <asm/arch/cpu.h>
26 #include <asm/arch/kirkwood.h>
27 #include <asm/arch/mpp.h>
28 #include <asm/arch/gpio.h>
30 #include "netspace_v2.h"
31 #include "../common/common.h"
33 DECLARE_GLOBAL_DATA_PTR;
35 int board_early_init_f(void)
37 /* Gpio configuration */
38 kw_config_gpio(NETSPACE_V2_OE_VAL_LOW, NETSPACE_V2_OE_VAL_HIGH,
39 NETSPACE_V2_OE_LOW, NETSPACE_V2_OE_HIGH);
41 /* Multi-Purpose Pins Functionality configuration */
42 u32 kwmpp_config[] = {
50 MPP7_GPO, /* Fan speed (bit 1) */
55 MPP12_GPO, /* Red led */
56 MPP14_GPIO, /* USB fuse */
57 MPP16_GPIO, /* SATA 0 power */
58 MPP17_GPIO, /* SATA 1 power */
63 MPP22_GPIO, /* Fan speed (bit 0) */
64 MPP23_GPIO, /* Fan power */
65 MPP24_GPIO, /* USB mode select */
66 MPP25_GPIO, /* Fan rotation fail */
67 MPP26_GPIO, /* USB vbus-in detection */
68 MPP28_GPIO, /* USB enable vbus-out */
69 MPP29_GPIO, /* Blue led (slow register) */
70 MPP30_GPIO, /* Blue led (command register) */
71 MPP31_GPIO, /* Board power off */
72 MPP32_GPIO, /* Button (0 = Released, 1 = Pushed) */
73 MPP33_GPIO, /* Fan speed (bit 2) */
76 kirkwood_mpp_conf(kwmpp_config);
84 gd->bd->bi_arch_number = CONFIG_MACH_TYPE;
86 /* Boot parameters address */
87 gd->bd->bi_boot_params = kw_sdram_bar(0) + 0x100;
92 #if defined(CONFIG_MISC_INIT_R)
95 #if defined(CONFIG_CMD_I2C) && defined(CONFIG_SYS_I2C_EEPROM_ADDR)
96 if (!getenv("ethaddr")) {
98 if (lacie_read_mac_address(mac) == 0)
99 eth_setenv_enetaddr("ethaddr", mac);
106 #if defined(CONFIG_CMD_NET) && defined(CONFIG_RESET_PHY_R)
107 /* Configure and initialize PHY */
110 mv_phy_88e1116_init("egiga0");
114 #if defined(CONFIG_KIRKWOOD_GPIO)
115 /* Return GPIO button status */
117 do_read_button(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
119 return kw_gpio_get_value(NETSPACE_V2_GPIO_BUTTON);
122 U_BOOT_CMD(button, 1, 1, do_read_button,
123 "Return GPIO button status 0=off 1=on", "");