3 * Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
5 * Based on Kirkwood support:
7 * Marvell Semiconductor <www.marvell.com>
8 * Written-by: Prafulla Wadaskar <prafulla@marvell.com>
10 * SPDX-License-Identifier: GPL-2.0+
16 #include <asm/arch/cpu.h>
17 #include <asm/arch/soc.h>
18 #include <asm/arch/mpp.h>
19 #include <asm/arch/gpio.h>
22 DECLARE_GLOBAL_DATA_PTR;
24 int board_early_init_f(void)
26 /* Gpio configuration */
27 mvebu_config_gpio(DNS325_OE_VAL_LOW, DNS325_OE_VAL_HIGH,
28 DNS325_OE_LOW, DNS325_OE_HIGH);
30 /* Multi-Purpose Pins Functionality configuration */
31 static const u32 kwmpp_config[] = {
52 MPP20_SATA1_ACTn, /* sata1(left) status led */
53 MPP21_SATA0_ACTn, /* sata0(right) status led */
56 MPP24_GPIO, /* power off out */
58 MPP26_GPIO, /* power led */
59 MPP27_GPIO, /* sata0(right) error led */
60 MPP28_GPIO, /* sata1(left) error led */
61 MPP29_GPIO, /* usb error led */
66 MPP34_GPIO, /* power key */
71 MPP39_GPIO, /* enable sata 0 */
72 MPP40_GPIO, /* enable sata 1 */
73 MPP41_GPIO, /* hdd0 present */
74 MPP42_GPIO, /* hdd1 present */
75 MPP43_GPIO, /* usb status led */
76 MPP44_GPIO, /* fan status */
77 MPP45_GPIO, /* fan high speed */
78 MPP46_GPIO, /* fan low speed */
79 MPP47_GPIO, /* usb umount */
80 MPP48_GPIO, /* factory reset */
81 MPP49_GPIO, /* thermal sensor */
84 kirkwood_mpp_conf(kwmpp_config, NULL);
86 kw_gpio_set_blink(DNS325_GPIO_LED_POWER , 1);
88 kw_gpio_set_value(DNS325_GPIO_SATA0_EN , 1);
94 /* Boot parameters address */
95 gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
100 #ifdef CONFIG_RESET_PHY_R
101 /* Configure and initialize PHY */
106 char *name = "egiga0";
108 if (miiphy_set_current_dev(name))
111 /* command to read PHY dev address */
112 if (miiphy_read(name, 0xEE, 0xEE, (u16 *) &devadr)) {
113 printf("Err..(%s) could not read PHY dev address\n", __func__);
118 * Enable RGMII delay on Tx and Rx for CPU port
119 * Ref: sec 4.7.2 of chip datasheet
121 miiphy_write(name, devadr, MV88E1116_PGADR_REG, 2);
122 miiphy_read(name, devadr, MV88E1116_MAC_CTRL_REG, ®);
123 reg |= (MV88E1116_RGMII_RXTM_CTRL | MV88E1116_RGMII_TXTM_CTRL);
124 miiphy_write(name, devadr, MV88E1116_MAC_CTRL_REG, reg);
125 miiphy_write(name, devadr, MV88E1116_PGADR_REG, 0);
128 miiphy_reset(name, devadr);
130 debug("88E1116 Initialized on %s\n", name);
132 #endif /* CONFIG_RESET_PHY_R */