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