2 * Copyright (C) 2014 Evgeni Dobrev <evgeni@studio-punkt.com>
4 * Based on sheevaplug.c originally written by
5 * Prafulla Wadaskar <prafulla@marvell.com>
7 * Marvell Semiconductor <www.marvell.com>
9 * SPDX-License-Identifier: GPL-2.0+
14 #include <asm/arch/soc.h>
15 #include <asm/arch/mpp.h>
16 #include <asm/arch/cpu.h>
19 DECLARE_GLOBAL_DATA_PTR;
21 int board_early_init_f(void)
24 * default gpio configuration
26 mvebu_config_gpio(NAS220_GE_OE_VAL_LOW, NAS220_GE_OE_VAL_HIGH,
27 NAS220_GE_OE_LOW, NAS220_GE_OE_HIGH);
29 /* Multi-Purpose Pins Functionality configuration */
30 static const u32 kwmpp_config[] = {
69 kirkwood_mpp_conf(kwmpp_config, NULL);
76 * arch number of board
78 gd->bd->bi_arch_number = MACH_TYPE_NAS220;
80 /* adress of boot parameters */
81 gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
86 #ifdef CONFIG_RESET_PHY_R
87 /* Configure and enable MV88E1116 PHY */
92 char *name = "egiga0";
94 if (miiphy_set_current_dev(name))
97 /* command to read PHY dev address */
98 if (miiphy_read(name, 0xEE, 0xEE, (u16 *)&devadr)) {
99 printf("Err..%s could not read PHY dev address\n", __func__);
104 * Enable RGMII delay on Tx and Rx for CPU port
105 * Ref: sec 4.7.2 of chip datasheet
107 miiphy_write(name, devadr, MV88E1116_PGADR_REG, 2);
108 miiphy_read(name, devadr, MV88E1116_MAC_CTRL_REG, ®);
109 reg |= (MV88E1116_RGMII_RXTM_CTRL | MV88E1116_RGMII_TXTM_CTRL);
110 miiphy_write(name, devadr, MV88E1116_MAC_CTRL_REG, reg);
111 miiphy_write(name, devadr, MV88E1116_PGADR_REG, 0);
114 miiphy_reset(name, devadr);
116 printf("88E1116 Initialized on %s\n", name);
118 #endif /* CONFIG_RESET_PHY_R */