Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3936850pxj; Mon, 21 Jun 2021 09:44:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwvMR5H31d8TBRSoGdPbAYH89Cxacg+ycBvomJ1zpLRhiGVJhuE9H/MewfQNP5cQOYctUjp X-Received: by 2002:a17:907:6fd:: with SMTP id yh29mr26129254ejb.432.1624293898920; Mon, 21 Jun 2021 09:44:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624293898; cv=none; d=google.com; s=arc-20160816; b=a1o3RrjyJnxVA6TEuyXmVFR/uN5DfMhPhY9+LE8rk+UAyjcLBhB94aYhyXpSrDTokz cTCKOtTVxd4t9ok8AwD4dHWic1/SfM0cLA13QfzfR5XFWUF9ipv+6Omwdge5szMgcD39 SQ7nlKKnbvJqmlrWyTqGE4V2Eoixp1Soogj3M2jAHlAZAxxTBszzieLbJX4qorat4wxf NhkB+c+av6akRW/NYeP0xPuD7u1GYg3eHwMCUH32EZFDXPaIi7DE0aOIprgQZx+5S/pK 0vXO+tAkCZR1LvNVP7m8Lz9KTUDO/xhNiySlXhwaXtPRFYZLx4hwzGHfH21EoCJk9XmS jIhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UryGe18hqRhbvLYoRIu7q68g+Nu4NhvwFN82oSkM5Ig=; b=wyMMDe6Z7E3JskwtF+eJW9Rm1QhkPmHaBVAliZI78GhWat1tP9NFZfxkxkGDb1V0vc ItHFrLVeDP0SGjCd1f1myU1RWAznh40LhjicAjG0k4yLL+889qpT4nSI4HHwLuSIR+fL m9oxwz4Hh+CGnCUwNwqcPDqOHBrDh9yywDTo+59spQ+Cty1fEyV2bO9aE9HtqwYal0On Jgh6zGpvVgq2a5QShTUp3IEr/dhwx9yconh50j1bOEHNrp5qqpncs0CjeJhtPzx7tafV sV8E6BQD8xl7ftATL6kM1CUVV3aB9OZENLyEMlObuYiWRVcBffnkb/UJg4A3X3tdVplO UAog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XTId6kSk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f16si8823444edf.309.2021.06.21.09.44.36; Mon, 21 Jun 2021 09:44:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XTId6kSk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231723AbhFUQmI (ORCPT + 99 others); Mon, 21 Jun 2021 12:42:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:33732 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232362AbhFUQiv (ORCPT ); Mon, 21 Jun 2021 12:38:51 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 461C861434; Mon, 21 Jun 2021 16:29:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1624292978; bh=J5rFiomhkGXb6uTmtgxj7bmx3aKGX3F4ApLcrBXBtng=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XTId6kSkq/2BKYt3h0CXala/0HAoC+K+Xk5mAIh4NrtTsueKpHkpo90UwS0zskb+F uRlPClYHvoKwrcpCXwMWcuUg0DVBhkfjObRMn9zgnBoP8ULi0Z5lWqaEzqciwQWloP hFkZfteumwL2xpSy2yrdQ+MrKnOJtruFk8MC4IYg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rahul Lakkireddy , "David S. Miller" , Sasha Levin Subject: [PATCH 5.12 052/178] cxgb4: halt chip before flashing PHY firmware image Date: Mon, 21 Jun 2021 18:14:26 +0200 Message-Id: <20210621154924.163498220@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210621154921.212599475@linuxfoundation.org> References: <20210621154921.212599475@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rahul Lakkireddy [ Upstream commit 6d297540f75d759489054e8b07932208fc4db2cb ] When using firmware-assisted PHY firmware image write to flash, halt the chip before beginning the flash write operation to allow the running firmware to store the image persistently. Otherwise, the running firmware will only store the PHY image in local on-chip RAM, which will be lost after next reset. Fixes: 4ee339e1e92a ("cxgb4: add support to flash PHY image") Signed-off-by: Rahul Lakkireddy Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- .../ethernet/chelsio/cxgb4/cxgb4_ethtool.c | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c index bc2de01d0539..df20485b5744 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c @@ -1337,11 +1337,27 @@ static int cxgb4_ethtool_flash_phy(struct net_device *netdev, return ret; } + /* We have to RESET the chip/firmware because we need the + * chip in uninitialized state for loading new PHY image. + * Otherwise, the running firmware will only store the PHY + * image in local RAM which will be lost after next reset. + */ + ret = t4_fw_reset(adap, adap->mbox, PIORSTMODE_F | PIORST_F); + if (ret < 0) { + dev_err(adap->pdev_dev, + "Set FW to RESET for flashing PHY FW failed. ret: %d\n", + ret); + return ret; + } + ret = t4_load_phy_fw(adap, MEMWIN_NIC, NULL, data, size); - if (ret) - dev_err(adap->pdev_dev, "Failed to load PHY FW\n"); + if (ret < 0) { + dev_err(adap->pdev_dev, "Failed to load PHY FW. ret: %d\n", + ret); + return ret; + } - return ret; + return 0; } static int cxgb4_ethtool_flash_fw(struct net_device *netdev, -- 2.30.2