dm: sunxi: Support driver model for Ethernet
authorSimon Glass <sjg@chromium.org>
Sun, 5 Apr 2015 22:07:42 +0000 (16:07 -0600)
committerSimon Glass <sjg@chromium.org>
Sat, 18 Apr 2015 17:11:37 +0000 (11:11 -0600)
Adjust the Ethernet initialisation code to support driver model.
It is no-longer necessary to call designware_initialize(). The device will
be probed when it is used. The PHY type and GMAC base will come from the
device tree.

Signed-off-by: Simon Glass <sjg@chromium.org>
board/sunxi/gmac.c

index 63a7360b6d2687adb5527590c77dddc8a9c08121..d90eed48f7858c177da2507dcdde422bb6c2fdb7 100644 (file)
@@ -80,11 +80,15 @@ int sunxi_gmac_initialize(bd_t *bis)
                sunxi_gpio_set_cfgpin(pin, SUN6I_GPA_GMAC);
 #endif
 
-#ifdef CONFIG_RGMII
+#ifdef CONFIG_DM_ETH
+       return 0;
+#else
+# ifdef CONFIG_RGMII
        return designware_initialize(SUNXI_GMAC_BASE, PHY_INTERFACE_MODE_RGMII);
-#elif defined CONFIG_GMII
+# elif defined CONFIG_GMII
        return designware_initialize(SUNXI_GMAC_BASE, PHY_INTERFACE_MODE_GMII);
-#else
+# else
        return designware_initialize(SUNXI_GMAC_BASE, PHY_INTERFACE_MODE_MII);
+# endif
 #endif
 }