Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 17072C00140 for ; Mon, 8 Aug 2022 12:16:54 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4FA7184567; Mon, 8 Aug 2022 14:16:36 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="d/rKF4Mb"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E9DAD84567; Mon, 8 Aug 2022 14:16:33 +0200 (CEST) Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 21EEB83FB1 for ; Mon, 8 Aug 2022 14:16:31 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=joel.stan@gmail.com Received: by mail-pg1-x531.google.com with SMTP id r69so1869999pgr.2 for ; Mon, 08 Aug 2022 05:16:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc; bh=8Xx6BoXb1EXQ5ktx24lge1LB7WCXNrH5w+qBeaePeWc=; b=d/rKF4MbeMq/jVt2WM1t647nrqTLQ/qSAqKpdppWzP/C/zAnXkaZoC67yP3k2Zl4aV /o1utVDRM9Mc3vN2X+HucHspZMnVu1V1+2lcOcK7kDloYFhxIeNXDZeQjlwHZwl9987u /8WbiASsYjvFccLDAGsDJfQ1onLqooaMqb5V6TKHt0k95bdFjDqazpJCe2QLm0iPbgsD Op90/nX6if9a2wybzy97paz3puxvFUnPyoqJ9CxxgvAQpyTIQkO1lbSqKCshy85H6Hb5 lHez+WV1QWmwiZRoD9x1IaOA0ySkVqcSrvH+ElOR5Iy2VqBbb7uNw5DcpPqk33TC2TWL yrbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc; bh=8Xx6BoXb1EXQ5ktx24lge1LB7WCXNrH5w+qBeaePeWc=; b=2kmEcR39drDNjV+wTDUNHc9/5/pqmR93oK7fc2kVMIgqjdql2PYuUYeJecYDJDt+Tg dkRfDj42bUq76LvqFFXi42NWSJFW5b201Rs2YjWIvAnCxniZF4v16BfzyfI12aJ/zHkx lJhUssBbnZvljwc9dH3rQHjTtr0/thT0Deulg65r9HXRq2yAgfuIkpN61rTFmArd3ax1 i1+56lGB4o06jZltLyI72vP6j98QKi6GizLA4gFqlXZx/pHb0Ri2irYcQaDXjrOPF8nK 94zIjev95DesJqNAfkZSvjvUQmWThDTAXZDuyZ4Gt6yuGverUHXbjLRBIeNg6RnASbYh IO4Q== X-Gm-Message-State: ACgBeo3ojCMVJdZzPTajgbt7NQa0s6Q0Glop3ZHbWwjd/OvP4w2Atjdl ZOH2SHFIWlHstoH1Uf2hKnc= X-Google-Smtp-Source: AA6agR5mdvgZ6raSVrhIVlob3MJfEUIbph6zSaf2QX+Ovb6h4bMttA27ZdtbVOBZROq29VuP7+jbYA== X-Received: by 2002:a63:220d:0:b0:41a:a604:8540 with SMTP id i13-20020a63220d000000b0041aa6048540mr15314514pgi.390.1659960988985; Mon, 08 Aug 2022 05:16:28 -0700 (PDT) Received: from voyager.lan ([45.124.203.15]) by smtp.gmail.com with ESMTPSA id t16-20020a62d150000000b0052b6ed5ca40sm8482163pfl.192.2022.08.08.05.16.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Aug 2022 05:16:28 -0700 (PDT) From: Joel Stanley To: Joe Hershberger , Ramon Fried , Ryan Chen , BMC-SW@aspeedtech.com Cc: Samuel Mendoza-Jonas , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , u-boot@lists.denx.de Subject: [PATCH v4 2/4] cmd: Add ncsi command Date: Mon, 8 Aug 2022 21:46:04 +0930 Message-Id: <20220808121606.188002-3-joel@jms.id.au> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220808121606.188002-1-joel@jms.id.au> References: <20220808121606.188002-1-joel@jms.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean From: Samuel Mendoza-Jonas Adds an "ncsi" command to manually start NC-SI configuration. Signed-off-by: Samuel Mendoza-Jonas Signed-off-by: Joel Stanley --- v4: New patch, split from patch 1 cmd/net.c | 22 ++++++++++++++++++++++ net/net.c | 1 + cmd/Kconfig | 8 ++++++++ 3 files changed, 31 insertions(+) diff --git a/cmd/net.c b/cmd/net.c index 3619c843d838..2863fe768118 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 []); @@ -524,3 +525,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 */ diff --git a/net/net.c b/net/net.c index f0faf33d0d77..a4e645ac4425 100644 --- a/net/net.c +++ b/net/net.c @@ -434,6 +434,7 @@ int net_loop(enum proto_t protocol) } else { eth_init_state_only(); } + restart: #ifdef CONFIG_USB_KEYBOARD net_busy_flag = 0; diff --git a/cmd/Kconfig b/cmd/Kconfig index 3625ff2a50b3..3a5d1bba78a8 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -1813,6 +1813,14 @@ config CMD_LINK_LOCAL help Acquire a network IP address using the link-local protocol +config CMD_NCSI + bool "ncsi" + depends on PHY_NCSI + help + Manually configure the attached NIC via NC-SI. + Normally this happens automatically before other network + operations. + endif config CMD_ETHSW -- 2.35.1