X-Git-Url: https://git.karo-electronics.de/?a=blobdiff_plain;f=net%2Fbootme.c;h=448727201cae94e9f0ad332311ed58c79f43de32;hb=12f51da324678dbcddd3187c91d4c04f0abae980;hp=af2ab9f57ec4a021cddf506ba171bfd9d8c13d8c;hpb=fc92c8c1db6e92d942006b76bb1330a7e41f7eae;p=karo-tx-uboot.git diff --git a/net/bootme.c b/net/bootme.c index af2ab9f57e..448727201c 100644 --- a/net/bootme.c +++ b/net/bootme.c @@ -251,7 +251,7 @@ void BootmeStart(void) check_net_config(); if (output_packet_len == 0 || - memcmp(bootme_ether, NetEtherNullAddr, ETH_ALEN) != 0) { + is_valid_ether_addr(bootme_ether)) { /* wait for incoming packet */ net_set_udp_handler(bootme_handler); bootme_timed_out = 0; @@ -289,7 +289,7 @@ int bootme_send_frame(const void *buf, size_t len) __func__, buf, len, &NetOurIP, bootme_src_port, &bootme_ip, bootme_dst_port); - if (memcmp(bootme_ether, NetEtherNullAddr, ETH_ALEN) == 0) { + if (is_zero_ether_addr(bootme_ether)) { output_packet = buf; output_packet_len = len; /* wait for arp reply and send packet */ @@ -304,6 +304,17 @@ int bootme_send_frame(const void *buf, size_t len) return 0; } + if (eth->state != ETH_STATE_ACTIVE) { + if (eth_is_on_demand_init()) { + ret = eth_init(gd->bd); + if (ret < 0) + return ret; + eth_set_last_protocol(BOOTME); + } else { + eth_init_state_only(gd->bd); + } + } + assert(NetTxPacket != NULL); pkt = (uchar *)NetTxPacket + NetEthHdrSize() + IP_UDP_HDR_SIZE; memcpy(pkt, buf, len);