2012/7/3 Simon Glass <s...@chromium.org>: > Hi Michal, > > On Thu, Jun 28, 2012 at 12:26 AM, Michal Simek <mon...@monstr.eu> wrote: >> >> Support new CONFIG_OF_CONTROL option where device >> probing is done based on device tree description. >> >> Signed-off-by: Michal Simek <mon...@monstr.eu> >> --- >> drivers/net/xilinx_emaclite.c | 30 ++++++++++++++++++++++++++++++ >> 1 files changed, 30 insertions(+), 0 deletions(-) >> >> diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c >> index e1af42a..0f6807d 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) { > > > offset > 0 or >= 0
ok, probably safer. >> >> + 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); > > > Just offset > 0 here I think. ok. > >> >> + >> + return ret; >> +} >> +#endif > > > This is fine I think. Do you want to impose an ordering on the interfaces, > or are you happy with them being assigned randomly? If you want an ordering, > see fdtdec_find_aliases_for_id(). For now, not. for future probably yes. I have changed uartlite and uart16550 drivers where this is very important. Thanks, Michal _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot