From patchwork Wed Jun 19 18:45:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13704447 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F35E6C2BD05 for ; Wed, 19 Jun 2024 18:46:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=m8OMC48GmXgiPxob9K29Y+tXmIST97gKgb0MYszQ6f4=; b=WffOSnIzGC7MtcSSSdahb9zxPw +VS0awxpop16Wfd0Bz36fZH3G4CA+U4y2gg1JLQX63kC4sHIS8b+JRWFZrxfcNSswjWL6n4PsblqO eZLnDJuGz94xSjf/AP+0vQRsrz46jEtCcIXIxGfJ6ZfxgFlMSUUxbqBWidU1ttcYbShAoYVqa7yq/ q/btfoimiJEQBuMtIYRiYCh6r99xmhR83A82xmtXXVVFiK1PJ5uR8by2nzLN6LYpvUlGNo4dgAKz/ 1CO/FhJoiTfS/8xC6YMVnhW7iWEwk4LLSeUHMMZ3R0NNAcpD33fIn9F5VC9/ctRQ2DNGJzVN+mL3+ H9HkslnQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sK0K1-00000002QZc-1h11; Wed, 19 Jun 2024 18:46:17 +0000 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sK0Jt-00000002QTy-1Su9 for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2024 18:46:10 +0000 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-362f62ae4c5so76167f8f.1 for ; Wed, 19 Jun 2024 11:46:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1718822767; x=1719427567; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=m8OMC48GmXgiPxob9K29Y+tXmIST97gKgb0MYszQ6f4=; b=tYrTVtC8m645M7w/N+UThRmh2m1lKNfC1Drme2xpSUqmhCt+BwA2xGj+Y+NPFHVYFo kgImLp7fivDqA1yfGJsimyn1WsZ/pkStsffo1/MxGtSV7cOdLRkOtztoHZx1xhwqqy5v rEIod3Tz3Bm0sQQH8BpdROKYQov07Rim7uM/vsYeLhULcfUCErAIruBOetm3zBGowPet n4tGFQReSFS7RQf4IeZ0qpUD+Jg1LMasxMIwY3CtuhkB4HNara4KRInZtyTg2EJOmyLt e9xvHMDCcDMDsSw/DLsXmoUVS0n8I+3s6Cdk9vS1bbKxv0GN1U+Kg1p17QUXyph21ZG6 GhcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718822767; x=1719427567; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=m8OMC48GmXgiPxob9K29Y+tXmIST97gKgb0MYszQ6f4=; b=ilkTDeacsBGOb6vXWCVL+DGog/v7ogGOaJKtGnWNED6A/lrFBofs/Su75yu6m+gxLp 9yJIcLpYrd0RbEemhkzn9IG0HZIA19bp9LeyokF4qpsUD+q3ltjIPXHxDqaV3WKBBufp qF6l54MNueE+Ntb7xCajDPjxiN8tjw4dSHb+SGKt3X3vMcgF1URQvjOzLGKU47qCVt6c bSNf4s3Fq0SOqsbaeGORYpkmfb/Qi65bUbmXo+mkXzpZecZrCFxbj9ggBUG7vekz/ahT C3P8bRvGIpFCFYemVMt0AW0Hy0vPuXA/l4Ja0dRBYpxdxb7RZTBsfbHuVaR+UAqkfvOh ivFg== X-Forwarded-Encrypted: i=1; AJvYcCVcO71oNs5FUxCzQoTxYO+Z1lqcv73I9BoUpliWK/ZSbRbT0xhtM7lngMCsjALlanCLSQkhOFdLFRJMfC8XGwPiX5QcHIAEAs2EHNMlFwCtHof5Fdo= X-Gm-Message-State: AOJu0Yww6mT9uJNYgNxjBUqqAgeiuRck9ek+wFHFgcXK9aPH/AJXdNIg 1Y1478VT/ijPh/1fX3iR+rSkStHLqTazW98drHHbeATEOj34alpNqrq5zTRrSfs= X-Google-Smtp-Source: AGHT+IHPbftWUm712EVMDPWc9/FAfLxNDa5SAVUKIsk+n79gLzuNi7krxSeOn0v4Ewzob/JdZzx81g== X-Received: by 2002:a5d:6d4c:0:b0:360:7856:fa62 with SMTP id ffacd0b85a97d-3609ea6c58emr6800607f8f.15.1718822767356; Wed, 19 Jun 2024 11:46:07 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:dc:7e00:991f:deb8:4c5d:d73d]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36098c8c596sm7594156f8f.14.2024.06.19.11.46.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 11:46:07 -0700 (PDT) From: Bartosz Golaszewski To: Vinod Koul , Alexandre Torgue , Jose Abreu , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Andrew Lunn , Heiner Kallweit , Russell King Cc: netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH net-next 5/8] net: phy: aquantia: wait for FW reset before checking the vendor ID Date: Wed, 19 Jun 2024 20:45:46 +0200 Message-ID: <20240619184550.34524-6-brgl@bgdev.pl> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240619184550.34524-1-brgl@bgdev.pl> References: <20240619184550.34524-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240619_114609_505117_76AD55CD X-CRM114-Status: GOOD ( 15.64 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Bartosz Golaszewski Checking the firmware register before it boots makes no sense, it will report 0 even if FW is loaded. Always wait for FW to boot before continuing. Signed-off-by: Bartosz Golaszewski --- drivers/net/phy/aquantia/aquantia.h | 1 + drivers/net/phy/aquantia/aquantia_firmware.c | 4 ++++ drivers/net/phy/aquantia/aquantia_main.c | 6 +++--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/net/phy/aquantia/aquantia.h b/drivers/net/phy/aquantia/aquantia.h index b8502793962e..2465345081f8 100644 --- a/drivers/net/phy/aquantia/aquantia.h +++ b/drivers/net/phy/aquantia/aquantia.h @@ -201,5 +201,6 @@ int aqr_phy_led_hw_control_set(struct phy_device *phydev, u8 index, int aqr_phy_led_active_low_set(struct phy_device *phydev, int index, bool enable); int aqr_phy_led_polarity_set(struct phy_device *phydev, int index, unsigned long modes); +int aqr_wait_reset_complete(struct phy_device *phydev); #endif /* AQUANTIA_H */ diff --git a/drivers/net/phy/aquantia/aquantia_firmware.c b/drivers/net/phy/aquantia/aquantia_firmware.c index 0c9640ef153b..524627a36c6f 100644 --- a/drivers/net/phy/aquantia/aquantia_firmware.c +++ b/drivers/net/phy/aquantia/aquantia_firmware.c @@ -353,6 +353,10 @@ int aqr_firmware_load(struct phy_device *phydev) { int ret; + ret = aqr_wait_reset_complete(phydev); + if (ret) + return ret; + /* Check if the firmware is not already loaded by pooling * the current version returned by the PHY. If 0 is returned, * no firmware is loaded. diff --git a/drivers/net/phy/aquantia/aquantia_main.c b/drivers/net/phy/aquantia/aquantia_main.c index 11da460698b0..eab779db225c 100644 --- a/drivers/net/phy/aquantia/aquantia_main.c +++ b/drivers/net/phy/aquantia/aquantia_main.c @@ -441,7 +441,7 @@ static int aqr107_set_tunable(struct phy_device *phydev, * The chip also provides a "reset completed" bit, but it's cleared after * read. Therefore function would time out if called again. */ -static int aqr107_wait_reset_complete(struct phy_device *phydev) +int aqr_wait_reset_complete(struct phy_device *phydev) { int val; @@ -494,7 +494,7 @@ static int aqr107_config_init(struct phy_device *phydev) WARN(phydev->interface == PHY_INTERFACE_MODE_XGMII, "Your devicetree is out of date, please update it. The AQR107 family doesn't support XGMII, maybe you mean USXGMII.\n"); - ret = aqr107_wait_reset_complete(phydev); + ret = aqr_wait_reset_complete(phydev); if (!ret) aqr107_chip_info(phydev); @@ -522,7 +522,7 @@ static int aqcs109_config_init(struct phy_device *phydev) phydev->interface != PHY_INTERFACE_MODE_2500BASEX) return -ENODEV; - ret = aqr107_wait_reset_complete(phydev); + ret = aqr_wait_reset_complete(phydev); if (!ret) aqr107_chip_info(phydev);