[U-Boot] [RFC PATCH 12/13] dm: sunxi: Support driver model for Ethernet

Simon Glass sjg at chromium.org
Sun Mar 1 17:33:38 CET 2015


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 at chromium.org>
---

 board/sunxi/gmac.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/board/sunxi/gmac.c b/board/sunxi/gmac.c
index 8849132..ce7831d 100644
--- a/board/sunxi/gmac.c
+++ b/board/sunxi/gmac.c
@@ -80,11 +80,16 @@ int sunxi_gmac_initialize(bd_t *bis)
 		sunxi_gpio_set_cfgpin(pin, SUN6I_GPA0_GMAC);
 #endif
 
-#ifdef CONFIG_RGMII
+#ifdef CONFIG_DM_ETH
+	printf("eth init\n");
+	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
 }
-- 
2.2.0.rc0.207.ga3a616c



More information about the U-Boot mailing list