wol.c 630 B

123456789101112131415161718192021222324252627282930313233
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * (C) Copyright 2018
  4. * Lothar Felte, lothar.felten@gmail.com
  5. */
  6. /*
  7. * Wake-on-LAN support
  8. */
  9. #include <common.h>
  10. #include <command.h>
  11. #include <net.h>
  12. #if defined(CONFIG_CMD_WOL)
  13. void wol_set_timeout(ulong);
  14. int do_wol(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
  15. {
  16. /* Validate arguments */
  17. if (argc < 2)
  18. return CMD_RET_USAGE;
  19. wol_set_timeout(simple_strtol(argv[1], NULL, 10) * 1000);
  20. if (net_loop(WOL) < 0)
  21. return CMD_RET_FAILURE;
  22. return CMD_RET_SUCCESS;
  23. }
  24. U_BOOT_CMD(
  25. wol, 2, 1, do_wol,
  26. "wait for an incoming wake-on-lan packet",
  27. "Timeout"
  28. );
  29. #endif