+ return 0;
+}
+
+#ifdef CONFIG_FEC_MXC
+
+#ifndef ETH_ALEN
+#define ETH_ALEN 6
+#endif
+
+static void tx6_init_mac(void)
+{
+ u8 mac[ETH_ALEN];
+ const char *baseboard = getenv("baseboard");
+
+ imx_get_mac_from_fuse(0, mac);
+ if (!is_valid_ethaddr(mac)) {
+ printf("No valid MAC address programmed\n");
+ return;
+ }
+ printf("MAC addr from fuse: %pM\n", mac);
+ if (!getenv("ethaddr"))
+ eth_setenv_enetaddr("ethaddr", mac);
+
+ if (!baseboard || strncmp(baseboard, "stk5", 4) == 0) {
+ setenv("eth1addr", NULL);
+ return;
+ }
+ if (getenv("eth1addr"))
+ return;
+ imx_get_mac_from_fuse(1, mac);
+ eth_setenv_enetaddr("eth1addr", mac);
+}
+
+int board_eth_init(bd_t *bis)
+{
+ int ret;
+
+ tx6_init_mac();
+
+ /* delay at least 21ms for the PHY internal POR signal to deassert */
+ udelay(22000);
+
+ imx_iomux_v3_setup_multiple_pads(tx6ul_enet1_pads,
+ ARRAY_SIZE(tx6ul_enet1_pads));
+
+ /* Deassert RESET to the external phys */
+ gpio_set_value(TX6UL_FEC_RST_GPIO, 1);
+
+ if (getenv("ethaddr")) {
+ ret = fecmxc_initialize_multi(bis, 0, 0, ENET_BASE_ADDR);
+ if (ret) {
+ printf("failed to initialize FEC0: %d\n", ret);
+ return ret;
+ }
+ }
+ if (getenv("eth1addr")) {
+ ret = gpio_request_array(tx6ul_fec2_gpios,
+ ARRAY_SIZE(tx6ul_fec2_gpios));
+ if (ret < 0) {
+ printf("Failed to request tx6ul_fec2_gpios: %d\n", ret);
+ }
+ imx_iomux_v3_setup_multiple_pads(tx6ul_enet2_pads,
+ ARRAY_SIZE(tx6ul_enet2_pads));
+
+ writel(0x00100000, 0x020c80e4); /* assert ENET2_125M_EN */
+
+ /* Minimum PHY reset duration */
+ udelay(100);
+ gpio_set_value(TX6UL_FEC2_RST_GPIO, 1);
+ /* Wait for PHY internal POR to finish */
+ udelay(22000);
+
+ ret = fecmxc_initialize_multi(bis, 1, 2, ENET2_BASE_ADDR);
+ if (ret) {
+ printf("failed to initialize FEC1: %d\n", ret);
+ return ret;
+ }
+ }
+ return 0;