common: Move command functions out of common.h
[oweals/u-boot.git] / drivers / net / mvneta.c
index ab697b9bc76ef5876dfa56da534aa92729f952a7..6f76a6b0dcffdb32636d29a2d7d65bbc49ccc2c0 100644 (file)
@@ -13,6 +13,7 @@
  */
 
 #include <common.h>
+#include <cpu_func.h>
 #include <dm.h>
 #include <net.h>
 #include <netdev.h>
@@ -27,6 +28,7 @@
 #include <asm/arch/soc.h>
 #include <linux/compat.h>
 #include <linux/mbus.h>
+#include <asm-generic/gpio.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -34,14 +36,6 @@ DECLARE_GLOBAL_DATA_PTR;
 # error Marvell mvneta requires PHYLIB
 #endif
 
-/* Some linux -> U-Boot compatibility stuff */
-#define netdev_err(dev, fmt, args...)          \
-       printf(fmt, ##args)
-#define netdev_warn(dev, fmt, args...)         \
-       printf(fmt, ##args)
-#define netdev_info(dev, fmt, args...)         \
-       printf(fmt, ##args)
-
 #define CONFIG_NR_CPUS         1
 #define ETH_HLEN               14      /* Total octets in header */
 
@@ -282,6 +276,9 @@ struct mvneta_port {
        int init;
        int phyaddr;
        struct phy_device *phydev;
+#ifdef CONFIG_DM_GPIO
+       struct gpio_desc phy_reset_gpio;
+#endif
        struct mii_dev *bus;
 };
 
@@ -1757,6 +1754,17 @@ static int mvneta_probe(struct udevice *dev)
        if (ret)
                return ret;
 
+#ifdef CONFIG_DM_GPIO
+       gpio_request_by_name(dev, "phy-reset-gpios", 0,
+                            &pp->phy_reset_gpio, GPIOD_IS_OUT);
+
+       if (dm_gpio_is_valid(&pp->phy_reset_gpio)) {
+               dm_gpio_set_value(&pp->phy_reset_gpio, 1);
+               mdelay(10);
+               dm_gpio_set_value(&pp->phy_reset_gpio, 0);
+       }
+#endif
+
        return board_network_enable(bus);
 }