Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3926070pxj; Mon, 21 Jun 2021 09:31:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgYsvTxCHCzfS3pLHE2wjSgY6GgLlnRveEGzKGcaJXd2JjqY+5zDT1tEZKZ2ke3zE3Axql X-Received: by 2002:a05:6e02:e0e:: with SMTP id a14mr9694096ilk.294.1624293073051; Mon, 21 Jun 2021 09:31:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624293073; cv=none; d=google.com; s=arc-20160816; b=PoWbbVCiUu9TsaJQ7Bwlkc6kttSNm92L1dcwNNZUTX/6JB7WbA5nreaPizmpamv44k ywRChIWF1L2vZP3nPpthAbqo9gbmCyas1SZ+7v7e8ccEsE+g82oFhey3fHUQ1pDtvMIG 3N2OC93lRtpzKlUF/Tp+gz73jFxPKCT8ZhSKohPbE2n3Ga9xbHXj9MhnCMlr8cQnCiDs CgRhCX+DZ9HrhiAnfZH4e2lylSLAWjRAVHyHUtnn/9aTggVoGrD48PG3dtt/vaux3vO0 L3FtIp77+yBKfEuI1MgF+ti5CPzXxhkOMAcARieNL38i3w5DZYCTfFMOVGYd8NEIvle3 P+IQ== 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=L0SJ5xi41o0X5r7aguq3ILBUHTtt20/HSkNT8jY0go8j0q8KjzlPhUcHnExZIa1+E8 nrSh7hgsP6uL+MHKcz2/ltqk1Ag6cI4sYuX+gIx9P39FLLJsC5MHF3Aqg0i1e1xZ4sHn gRnxcW2Nb4b5KpmXofaAEyj7+S01N8nQ1frIjcAad2B1jATFYamXbNdurgwqYO2eSWMB 7FALeII9DF1gyvDGdcCOcmKS8DG/GKkIiWsnFsuo4wA5yXFGZ/NhNe7yuLvuhrgeYzkM lh/qi/t5pqZEuTfxwa4aveYOVnLoUAnO78jcRQhCw/QXQtPgrvzx/CRaFnWXHC0AgSQh VgAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=of+Z6aUJ; 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 u18si12788212ilg.79.2021.06.21.09.30.28; Mon, 21 Jun 2021 09:31:13 -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=of+Z6aUJ; 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 S232489AbhFUQcQ (ORCPT + 99 others); Mon, 21 Jun 2021 12:32:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:49444 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232495AbhFUQ3g (ORCPT ); Mon, 21 Jun 2021 12:29:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 957BF61026; Mon, 21 Jun 2021 16:24:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1624292669; bh=J5rFiomhkGXb6uTmtgxj7bmx3aKGX3F4ApLcrBXBtng=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=of+Z6aUJrk6GpW1t+MFyVjS6ygFTvohNSLdowH+ZrpNb2Pb1NtVE5OmOi258kcs9H TvMig7DP49/iIFx2LTlP56enUwoFTJAg4s/3McZ3ClbkgNYr1Lusx2rM9OxOHWedAm 2zEBxnPOvqVe18TDeRT0hVsuJlSRjJbb5FjIwHV0= 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.10 043/146] cxgb4: halt chip before flashing PHY firmware image Date: Mon, 21 Jun 2021 18:14:33 +0200 Message-Id: <20210621154912.758538743@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210621154911.244649123@linuxfoundation.org> References: <20210621154911.244649123@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