Wolfgang Denk | 61826a6 | 2014-11-06 14:03:01 +0100 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2011 |
| 3 | * Andreas Pretzsch, carpe noctem engineering, apr@cn-eng.de |
| 4 | * |
| 5 | * SPDX-License-Identifier: GPL-2.0+ |
Andreas Pretzsch | fcc69ff | 2011-07-16 05:51:00 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include <common.h> |
| 9 | #include <command.h> |
Simon Glass | d1892ac | 2013-05-15 06:23:54 +0000 | [diff] [blame] | 10 | #include <net.h> |
Andreas Pretzsch | fcc69ff | 2011-07-16 05:51:00 +0000 | [diff] [blame] | 11 | |
| 12 | #if !defined(CONFIG_UPDATE_TFTP) |
| 13 | #error "CONFIG_UPDATE_TFTP required" |
| 14 | #endif |
| 15 | |
Andreas Pretzsch | fcc69ff | 2011-07-16 05:51:00 +0000 | [diff] [blame] | 16 | static int do_fitupd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
| 17 | { |
| 18 | ulong addr = 0UL; |
| 19 | |
| 20 | if (argc > 2) |
Simon Glass | a06dfc7 | 2011-12-10 08:44:01 +0000 | [diff] [blame] | 21 | return CMD_RET_USAGE; |
Andreas Pretzsch | fcc69ff | 2011-07-16 05:51:00 +0000 | [diff] [blame] | 22 | |
| 23 | if (argc == 2) |
| 24 | addr = simple_strtoul(argv[1], NULL, 16); |
| 25 | |
Lukasz Majewski | e32125a | 2015-08-24 00:21:47 +0200 | [diff] [blame] | 26 | return update_tftp(addr, NULL, NULL); |
Andreas Pretzsch | fcc69ff | 2011-07-16 05:51:00 +0000 | [diff] [blame] | 27 | } |
| 28 | |
| 29 | U_BOOT_CMD(fitupd, 2, 0, do_fitupd, |
| 30 | "update from FIT image", |
| 31 | "[addr]\n" |
| 32 | "\t- run update from FIT image at addr\n" |
| 33 | "\t or from tftp 'updatefile'" |
| 34 | ); |