From 4b290d4a757caaf5efedc74ea3db9974b51f35f2 Mon Sep 17 00:00:00 2001 From: Samuel Mendoza-Jonas Date: Mon, 8 Aug 2022 21:46:04 +0930 Subject: cmd: Add ncsi command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds an "ncsi" command to manually start NC-SI configuration. Signed-off-by: Samuel Mendoza-Jonas Signed-off-by: Joel Stanley Reviewed-by: Cédric Le Goater --- cmd/net.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'cmd/net.c') diff --git a/cmd/net.c b/cmd/net.c index 46f8c87b69..addcad3ac1 100644 --- a/cmd/net.c +++ b/cmd/net.c @@ -16,6 +16,7 @@ #include #include #include +#include static int netboot_common(enum proto_t, struct cmd_tbl *, int, char * const []); @@ -566,3 +567,24 @@ U_BOOT_CMD( "list - list available devices\n" ); #endif // CONFIG_DM_ETH + +#if defined(CONFIG_CMD_NCSI) +static int do_ncsi(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[]) +{ + if (!phy_interface_is_ncsi() || !ncsi_active()) { + printf("Device not configured for NC-SI\n"); + return CMD_RET_FAILURE; + } + + if (net_loop(NCSI) < 0) + return CMD_RET_FAILURE; + + return CMD_RET_SUCCESS; +} + +U_BOOT_CMD( + ncsi, 1, 1, do_ncsi, + "Configure attached NIC via NC-SI", + "" +); +#endif /* CONFIG_CMD_NCSI */ -- cgit v1.2.3