summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Simek <monstr@monstr.eu>2012-06-28 21:37:57 +0000
committerJoe Hershberger <joe.hershberger@ni.com>2012-09-24 13:17:25 -0500
commit7fd70820248b17aa8b574c2823f73d538c31958f (patch)
treee258d098cea162fc3ff75436fc175da2d7091b3a
parent61e129885a8fd6d36c25301e537d46e66b6c6e6a (diff)
downloadu-boot-imx-7fd70820248b17aa8b574c2823f73d538c31958f.zip
u-boot-imx-7fd70820248b17aa8b574c2823f73d538c31958f.tar.gz
u-boot-imx-7fd70820248b17aa8b574c2823f73d538c31958f.tar.bz2
net: emaclite: Support OF initialization
Support new CONFIG_OF_CONTROL option where device probing is done based on device tree description. Signed-off-by: Michal Simek <monstr@monstr.eu> CC: Joe Hershberger <joe.hershberger@gmail.com>
-rw-r--r--drivers/net/xilinx_emaclite.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c
index d5bd737..d890d60 100644
--- a/drivers/net/xilinx_emaclite.c
+++ b/drivers/net/xilinx_emaclite.c
@@ -28,6 +28,9 @@
#include <config.h>
#include <malloc.h>
#include <asm/io.h>
+#include <fdtdec.h>
+
+DECLARE_GLOBAL_DATA_PTR;
#undef DEBUG
@@ -375,3 +378,30 @@ int xilinx_emaclite_initialize(bd_t *bis, unsigned long base_addr,
return 1;
}
+
+#ifdef CONFIG_OF_CONTROL
+int xilinx_emaclite_init(bd_t *bis)
+{
+ int offset = 0;
+ u32 ret = 0;
+ u32 reg;
+
+ do {
+ offset = fdt_node_offset_by_compatible(gd->fdt_blob, offset,
+ "xlnx,xps-ethernetlite-1.00.a");
+ if (offset != -1) {
+ reg = fdtdec_get_addr(gd->fdt_blob, offset, "reg");
+ if (reg != FDT_ADDR_T_NONE) {
+ u32 rxpp = fdtdec_get_int(gd->fdt_blob, offset,
+ "xlnx,rx-ping-pong", 0);
+ u32 txpp = fdtdec_get_int(gd->fdt_blob, offset,
+ "xlnx,tx-ping-pong", 0);
+ ret |= xilinx_emaclite_initialize(bis, reg,
+ txpp, rxpp);
+ }
+ }
+ } while (offset != -1);
+
+ return ret;
+}
+#endif