From patchwork Mon Jul 8 07:50:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13726259 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E7E223759 for ; Mon, 8 Jul 2024 07:50:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720425033; cv=none; b=scJE9yUImHppZ0lLZHTCSDRHFTuVxulBQq1G8UQxSL01pckKPBEfasqz1INpBHrcIvjEbSRjp2RoG2qf7c8SgS/TGkm4785dj1XXE6N+jau1bjt+baIFIYOfZgWS0R3m/HbJdjF11hWgY8wI9g1M6pIq+WSWvluxpMTXE5WgRVE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720425033; c=relaxed/simple; bh=9yi1anNucjAJ8p+xi+AkakLSWlU6/VCwEhS0HwZzO54=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=s4NFCprvowwQ736vFzKD/DD4Z70hfx5oPESkjhHr7JWWsw5k+OQPkC/rerHW/Fs6E/bUT273/+obyb8RoUGId5DsK2c8rCPgQpqQuHWv0cc2VHAWCqySKJDF4Le9DEHDeMcy4y8GJ4fueFo6j0/EJzfV+ejj4K8DPs0JfY8ALgU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl; spf=none smtp.mailfrom=bgdev.pl; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b=1CHMVnRp; arc=none smtp.client-ip=209.85.221.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="1CHMVnRp" Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-367a081d1cdso2041422f8f.1 for ; Mon, 08 Jul 2024 00:50:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1720425029; x=1721029829; darn=vger.kernel.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=mvg9NGlB7Q3nnPA4DGlVOBNb6F5m/xXWm+pljGd+Dec=; b=1CHMVnRpprAnpqZEBhSRDNgQ8hVvKKnHTiDzqzSja591RtzItEyZiwh1HsLjR4LGAP fK2obxynuMxL3cTy0ikdxkMLvmXSJ3hY4q1YeZyszhDNuvQuxc5ndAD6rjvFvfmNXzUz RJFypAlTvgnlDJK7f35wBzjC5mBaTZMdNmtSUwarnvOaz+q9oBD+YedawdUFslnRhyhA zpI+Am3Qdl+qZjv3zt/8EMeGyhv2r9UjrZdd70synlpUiuoaQJO9fIaWFeAEBLnh8Qd8 6YfbspgqmFcIavkTVq2x9AMDchWjqRGUcDQMtbbEb1TvzTtgh+DB4gTHYhs2wghM7QSw DhXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720425029; x=1721029829; 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=mvg9NGlB7Q3nnPA4DGlVOBNb6F5m/xXWm+pljGd+Dec=; b=WCrIsOJ17gD7EIhFXO39gtQJBvgyweI8QRFvjH69mJTCtF2TWT/8rVv99XR85JmE5o 6rJTLDef6kyibmtnCKGMStNiXPwt2OS3UvSi1n37mfE7nisI/JvLJ67NOMeT+ceFPVbJ QpbQemuKVdGwcdiakVkuSXMa5ar83IDZ6uszMdnE+CnkOTMwU9Z3bOgoiSVJw/Sx4LfE DQmc6hlZEVO+AoOW+AvHuusDY6flBCefVZHU5ASCOW4lwFeUxnomS9ubCrEaLWBMEhZL S9/woT8aAe//9C97ctnGhSIbYCBLj243xZFYVIC3szN039CtjLDNfVPDxknhqngOMvoj 9gkA== X-Gm-Message-State: AOJu0YzT7rQXzZ9p6zl+dNdVNnwjedX0JOpDx2gi7P/XdXyxtiwAG6Ed t08m6W2cYqf9IBdh4oUm1i5C/wSX9qvtG9DcA49NQZ3GngLHi2FOCAjaqrOHVlH/gg6gaJgr0qd l X-Google-Smtp-Source: AGHT+IGEsMan5VERG5Ruuq/k28lPTx8wwmEfk9bARBnsnlCFiqZl6+JtfHYuFcpgTGHfbHSorC7eJA== X-Received: by 2002:a5d:408c:0:b0:360:7c13:761e with SMTP id ffacd0b85a97d-3679dd71a3dmr8078039f8f.65.1720425029279; Mon, 08 Jul 2024 00:50:29 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:dc:7e00:b5f9:a318:2e8a:9e50]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3679d827789sm10160055f8f.76.2024.07.08.00.50.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jul 2024 00:50:29 -0700 (PDT) From: Bartosz Golaszewski To: Andrew Lunn , Heiner Kallweit , Russell King , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [RESEND PATCH net-next v3 1/4] net: phy: aquantia: rename and export aqr107_wait_reset_complete() Date: Mon, 8 Jul 2024 09:50:20 +0200 Message-ID: <20240708075023.14893-2-brgl@bgdev.pl> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240708075023.14893-1-brgl@bgdev.pl> References: <20240708075023.14893-1-brgl@bgdev.pl> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Bartosz Golaszewski This function is quite generic in this driver and not limited to aqr107. We will use it outside its current compilation unit soon so rename it and declare it in the header. Signed-off-by: Bartosz Golaszewski --- drivers/net/phy/aquantia/aquantia.h | 2 ++ drivers/net/phy/aquantia/aquantia_main.c | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/phy/aquantia/aquantia.h b/drivers/net/phy/aquantia/aquantia.h index 0bca28ec3332..2465345081f8 100644 --- a/drivers/net/phy/aquantia/aquantia.h +++ b/drivers/net/phy/aquantia/aquantia.h @@ -201,4 +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_main.c b/drivers/net/phy/aquantia/aquantia_main.c index 6c14355744b7..974795bd0860 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); From patchwork Mon Jul 8 07:50:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13726260 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B47FD38FA1 for ; Mon, 8 Jul 2024 07:50:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720425034; cv=none; b=HgKL+IZ+CJD00yFmTooYu62mBNRDOILryqODKR54V6GIlQ/198UJPDWWneXA1yb3e3hqFjZZyZPkPPi1RvGPxGTCeQRtz8baAKD9yB1XyVCmGp4P/wEBjy2qLWEy7zti1+3EvSNg6ztdh1q6vsPi0j88REBdoLMFgS+slMkqoQg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720425034; c=relaxed/simple; bh=qT/I0vbZRGDpE8yP1ELoiUDNULDJ0duW33V+A0EfTRo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HyFD9E9Hw59sg2y58utFaVNJ0K0FzKE3DrwJwzRvFwb4FIbQ5DpNXkzOoiQLu0OW2njElcS1J1nuqqnb2USJTZxB3Za0JKZPCD+e4bSh6S9sIHFaO/s2xwiFUojNayiCN0N6yAWhmyRh0jkW2uwtQxsK0o8bk6L/zsIF9gsypX8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl; spf=none smtp.mailfrom=bgdev.pl; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b=EYDe4A6l; arc=none smtp.client-ip=209.85.221.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="EYDe4A6l" Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-367ac08f80fso1386840f8f.1 for ; Mon, 08 Jul 2024 00:50:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1720425031; x=1721029831; darn=vger.kernel.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=a9Md/Ifap9fn0ZqaVx/ir7biX84P7JSuDDxVoVQn/Dg=; b=EYDe4A6ljADu4uYo/+yKHjVNlJvACxZlSWBOvUy9AFzEaoIbWw8rxjdcodDmYPByO7 Y70F5jkWV145zREBHbMGdBohy7VoKW9o+Hh2m0VZUktQ+mlKwdHW637wJW5JL3pSlye5 m+o+obqdTKGGCspqf1WNoOUEmMZfCxXQcAQgTL/Cki+UfQ3D0t2w1WeoqM/WLiugX86h 8pcZ99IFp/ViGgKLfph0A+mJxOg2jne95BgXB8ZJo8+UzTJRmpGtx3zwprRcGN5gY2zQ w8s7Me+filDnw17jy3mUQuxNDVDgnSnJ4LWSPXa3infDj0XV+c3+gS7DzqZwb4ax8WBQ S5sA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720425031; x=1721029831; 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=a9Md/Ifap9fn0ZqaVx/ir7biX84P7JSuDDxVoVQn/Dg=; b=UspWCqAZect2IIZjm9ZUrl5zzvRHSo9+tfLgqOW6i+j3Nu1wg51hSMsgu/dkA+Urlu 8Mz50OBvbYkbgExZL/fhDFJ+l3y3NhHn1+rBYl7E3M/M4en9+lnoINP90PbMg7nVMVgw 0Cz5nz4LdZTigZaqKiosvQt+4PlWMi/UPrAWzQ1498vI5JZibw66IveWhzOsFqyQStwy ZGD7wDdQmWTGaP+RjoIIJbqjCAmNXH98qiKdyldHZbN9RIu2L5xjKIMFnUkKwkb07WPc XKx72BzxjwqqgkvzrHRtPAU0lM/j/GzoJVqN/ooa+8Eoyv9OnU7m5w9EI6iczmdjXcTR yTKg== X-Gm-Message-State: AOJu0YyRddAy8XkoIesU59TuRhWHP1wmaexSlYw4qZPKEFadT/ihO0Jt jP3JQBGWRdi+GH1QoijTjYQdsuzJ7dT6jgyBh4Swz+IgoLtxgR96MH0o1Rvwg6U= X-Google-Smtp-Source: AGHT+IHVB2YXB4XGZU9hQow7TYKrFDF5hlVBHYX1Zn7NqJFValokpAL01XU7F8dmUnLHKfJPoXRn5A== X-Received: by 2002:a05:6000:d04:b0:367:9107:9e11 with SMTP id ffacd0b85a97d-3679dd73c6fmr9802180f8f.62.1720425031243; Mon, 08 Jul 2024 00:50:31 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:dc:7e00:b5f9:a318:2e8a:9e50]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3679d827789sm10160055f8f.76.2024.07.08.00.50.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jul 2024 00:50:29 -0700 (PDT) From: Bartosz Golaszewski To: Andrew Lunn , Heiner Kallweit , Russell King , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [RESEND PATCH net-next v3 2/4] net: phy: aquantia: wait for FW reset before checking the vendor ID Date: Mon, 8 Jul 2024 09:50:21 +0200 Message-ID: <20240708075023.14893-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240708075023.14893-1-brgl@bgdev.pl> References: <20240708075023.14893-1-brgl@bgdev.pl> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Bartosz Golaszewski Checking the firmware register before it complete the boot process makes no sense, it will report 0 even if FW is available from internal memory. Always wait for FW to boot before continuing or we'll unnecessarily try to load it from nvmem/filesystem and fail. Signed-off-by: Bartosz Golaszewski --- drivers/net/phy/aquantia/aquantia_firmware.c | 4 ++++ 1 file changed, 4 insertions(+) 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. From patchwork Mon Jul 8 07:50:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13726261 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5607A3BBE8 for ; Mon, 8 Jul 2024 07:50:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720425035; cv=none; b=KpLHyKOodAtm6ouxQCGMg3a6O5uDwfsKxHtC0e4vGt6aK+sEYx4JHuzwyHR+W22BlfqN4FP+0kp9qVWnxH8+OBcT5Y69kP/3N/Td0KYB08OlGMDqQRMO22NXS/1OmLZ+BsSOSRBKem2Q5872+KgX5r+ZfyhehdHqSdQG9RxAZ+A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720425035; c=relaxed/simple; bh=I8ZVS0D82/R3RtH++gdSA2BpSL5i3uiqUGmj0KpPRmU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CQcMwPNsfaZKaxqgo96MlhQFDnio1jYR2eMqaqbXIgImCiIrqSsnkXUwlOF27sLWnC7Iq9h8VW/fFzzSHeTaVR1NEvb+SEvx+M32vlXlX+iJjpLoeOfHzH35V0C2uqfpcdxdPeFDADYeWslxIdNCARgiDQwR7JiBddlKlufd4ag= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl; spf=none smtp.mailfrom=bgdev.pl; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b=bcc6folD; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="bcc6folD" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-4265ff0c964so11138685e9.1 for ; Mon, 08 Jul 2024 00:50:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1720425033; x=1721029833; darn=vger.kernel.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=DH3kXkonM31DpQhN/1Hxs8pfB1Bit5q7zwIm1RL/Mck=; b=bcc6folDJj1sY3nQvsG6Hz1slvmi+IszcHp3OwgDcz2dOitWgcqcih05h5W7ivgjlo Fc4VXFXdk2MJ1aPEbW7+Zp/NrQbaLPZhUiLjg6/u+v8OeLCq8obv422hEtpe8LuWiVuq SPDxOotlvvL1GXT1yzseeNNnyn8tABxBnWsvgDeBo8Qs34cMOgsDcpLDXcJ0EV1zRJK1 mrvjGzTtN02whD4l1WgyRPTBNfyn+MRVuknSD3g8jjPLCMF7DHOVRgynAV4tL8j5FZ5S HckPw5xragSqy4YILi+DMSw5ds1OlH4WygbljVdqkNFADPcb6NgCvHPPbFlBR77W+SdE yOxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720425033; x=1721029833; 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=DH3kXkonM31DpQhN/1Hxs8pfB1Bit5q7zwIm1RL/Mck=; b=OCtQZJqYMjcLQwABGtLt2SzjsJP711+r9+rhLCfwPd4xdzfNuQRjb39wb4ICMzJR9v EHumbpLfis4q5OPUU9EIsYjh2EnmZfQ+HGoi59WQypB+HFA130rBOh4MlnpO203W6x9H BL8bzc7VHzp+pVt7IGOOXjEtMXiepXy5wo1tdcbvS+AGgNkUpskcb4J6gUKdwmbMmkKY R43WtM0v2sdLChy8cWnHVsgfRKFsFogWe6T81Fi8ufZROFRotq9PxZ2VFZ5Wa+CJAn09 9CSsPCz/7iAN2crRJRxMLt5kNbFVp2apw7FJqA6Lxy+NfGNQsuNY1oXSXfxihdXwJi1l U4dQ== X-Gm-Message-State: AOJu0YxB/egXJJfxyUbG5tT3DL0H5+4vdl4gIS94fZZMZcETK9USccIQ UBNHRP2LNp5NPIFauH6+CUpxKCj2766mIoCCtQcNnwwGbgmJQ18D9GsavP7ADOM= X-Google-Smtp-Source: AGHT+IFGHXf42qjKEYiucDNY+VpgnwFXf1LC7psqdBVMRctd1Pm+BjeZFIZfnElzKyJyj7JtJC18Lg== X-Received: by 2002:a05:600c:1d03:b0:426:6667:5c42 with SMTP id 5b1f17b1804b1-42666675d11mr20254685e9.4.1720425032668; Mon, 08 Jul 2024 00:50:32 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:dc:7e00:b5f9:a318:2e8a:9e50]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3679d827789sm10160055f8f.76.2024.07.08.00.50.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jul 2024 00:50:31 -0700 (PDT) From: Bartosz Golaszewski To: Andrew Lunn , Heiner Kallweit , Russell King , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [RESEND PATCH net-next v3 3/4] net: phy: aquantia: wait for the GLOBAL_CFG to start returning real values Date: Mon, 8 Jul 2024 09:50:22 +0200 Message-ID: <20240708075023.14893-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240708075023.14893-1-brgl@bgdev.pl> References: <20240708075023.14893-1-brgl@bgdev.pl> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Bartosz Golaszewski When the PHY is first coming up (or resuming from suspend), it's possible that although the FW status shows as running, we still see zeroes in the GLOBAL_CFG set of registers and cannot determine available modes. Since all models support 10M, add a poll and wait the config to become available. Signed-off-by: Bartosz Golaszewski --- drivers/net/phy/aquantia/aquantia_main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/aquantia/aquantia_main.c b/drivers/net/phy/aquantia/aquantia_main.c index 974795bd0860..2c8ba2725a91 100644 --- a/drivers/net/phy/aquantia/aquantia_main.c +++ b/drivers/net/phy/aquantia/aquantia_main.c @@ -652,7 +652,13 @@ static int aqr107_fill_interface_modes(struct phy_device *phydev) unsigned long *possible = phydev->possible_interfaces; unsigned int serdes_mode, rate_adapt; phy_interface_t interface; - int i, val; + int i, val, ret; + + ret = phy_read_mmd_poll_timeout(phydev, MDIO_MMD_VEND1, + VEND1_GLOBAL_CFG_10M, val, val != 0, + 1000, 100000, false); + if (ret) + return ret; /* Walk the media-speed configuration registers to determine which * host-side serdes modes may be used by the PHY depending on the From patchwork Mon Jul 8 07:50:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13726262 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 17AB5481B4 for ; Mon, 8 Jul 2024 07:50:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720425037; cv=none; b=fK4UWZyv7RsZdE0yrfdbTA31si+CyM/JFEGBQI1og3+6semjM6hdKYydARpPDLB3vNm58C1XWfJZsmGgNeH7pLXwtmCgRfoIAXkssgTpkWAtjf+3oWJ9U7cSWoZ+UqByG6hEkoO00CGLRqXAeb324jfwmKKgNn+c5q36n+0CdGE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720425037; c=relaxed/simple; bh=aWRGwjNl141O0N2eu4pMGXstKpSbZTAZRRlvToIsLls=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ql0A+tv0vCltZGx9CXS50XFDG6o7jLzCmjhaWXZPyNnjn5Q4xTE8cvWHcvX4K2O6hwbAC3DoL7Y4fn76X+Yv8Nr2OmnKFGuLNVPQjJsvdBQz2ZPYfKXR+0VgrDU8Uz0wwV96UdFhNM8i6uiy913vJbNpRTICa1rz9ZdK28lZGbg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl; spf=none smtp.mailfrom=bgdev.pl; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b=p5ZIgrUZ; arc=none smtp.client-ip=209.85.221.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="p5ZIgrUZ" Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-367a23462e6so2162785f8f.3 for ; Mon, 08 Jul 2024 00:50:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1720425034; x=1721029834; darn=vger.kernel.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=mqzfRYx/eBkp9k5OzF2pgC0wEOIaJNu82fson6xrplE=; b=p5ZIgrUZ+uadygfMxSy17GGXlCI2oeCEjVCrAw61Ydf7rSPc98lXSLPGwyO1ue++Dw 28xKFrb97PBRVAsOpk2SFw1R0rpoZo8b+0wmVebIMaLui4g1xCFNODyydsuiFj29xyIC J8w6AEII6KlxdEQdVUUpiRIwGRoGRxNi/tOh0j0XlgAA58JQlAna2BLQCHqg6KiYlaYh N5UvlAyvp/115pDhvYnHr6qE3SAzwKFc7NoTfmknO+OplHIs+0YaLhQ2nIQ4FAelKI7O t0jTkmOaJs4DHu0eFz9+/5V9Uefet6oOmgmhV1k++7ALvudSvxlRTyDhenz1xuIg+2Sz GkHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720425034; x=1721029834; 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=mqzfRYx/eBkp9k5OzF2pgC0wEOIaJNu82fson6xrplE=; b=v3BINYlsbetKeKw51xd/4+O5XSXz7ZxOUyBjNmHpMQ5pUd2hD7MZ7H18SuK3MGm+DT En1Ba57c3GrCOJ8/IEnwN9s++QLuDNDd4jsTuGz9ohjaI8YT8iETKJyHkq13d4aOz9oS VgLNyefRD3aYaMx0ak0ZIS3ptbVkUZSapVrL70LZC/aSx7bc0DeLnGU3Mqj2cAhJvYnw SxAwE5La/746penRX1uSj0+7gq1E3AmHjiihVHl72l7HGYx9fELalTYh6ao9VWe5v9Z6 UL4t/5v33jfi4zxCFdM/O7+OjULRq7udLa6V6yNt5X7tJI82q6kc4gR2kefVqYta6h6e bFcA== X-Gm-Message-State: AOJu0YyCpqJWsV5TDI6zqH6zoop9sL6HhlcE/Y7J6gaKKT+IPscMVvCe weVWwIOYtusIJsYrdPWJXqwdkbOZuO8uXDK7gxr3fXYvNeMwsBz4ei01WoMBu/m0lyGGiPOduuD F X-Google-Smtp-Source: AGHT+IHCdYtJ5gdajf8bIJppL3jAkrIqdYM6almNmdUFQezuZItVtFtLkoeiiigNoVNNGUV5o239kQ== X-Received: by 2002:adf:8bde:0:b0:35f:f58:38fc with SMTP id ffacd0b85a97d-3679dd29745mr8013567f8f.26.1720425034553; Mon, 08 Jul 2024 00:50:34 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:dc:7e00:b5f9:a318:2e8a:9e50]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3679d827789sm10160055f8f.76.2024.07.08.00.50.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jul 2024 00:50:33 -0700 (PDT) From: Bartosz Golaszewski To: Andrew Lunn , Heiner Kallweit , Russell King , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [RESEND PATCH net-next v3 4/4] net: phy: aquantia: add support for aqr115c Date: Mon, 8 Jul 2024 09:50:23 +0200 Message-ID: <20240708075023.14893-5-brgl@bgdev.pl> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240708075023.14893-1-brgl@bgdev.pl> References: <20240708075023.14893-1-brgl@bgdev.pl> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Bartosz Golaszewski Add support for a new model to the Aquantia driver. This PHY supports 2.5 gigabit speeds. The PHY mode is referred to by the manufacturer as Overclocked SGMII (OCSGMII) but this actually is just 2500BASEX without in-band signalling so reuse the existing mode to avoid changing the uAPI. Signed-off-by: Bartosz Golaszewski --- drivers/net/phy/aquantia/aquantia_main.c | 26 ++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/net/phy/aquantia/aquantia_main.c b/drivers/net/phy/aquantia/aquantia_main.c index 2c8ba2725a91..d12e35374231 100644 --- a/drivers/net/phy/aquantia/aquantia_main.c +++ b/drivers/net/phy/aquantia/aquantia_main.c @@ -29,6 +29,7 @@ #define PHY_ID_AQR113 0x31c31c40 #define PHY_ID_AQR113C 0x31c31c12 #define PHY_ID_AQR114C 0x31c31c22 +#define PHY_ID_AQR115C 0x31c31c33 #define PHY_ID_AQR813 0x31c31cb2 #define MDIO_PHYXS_VEND_IF_STATUS 0xe812 @@ -1005,6 +1006,30 @@ static struct phy_driver aqr_driver[] = { .led_hw_control_get = aqr_phy_led_hw_control_get, .led_polarity_set = aqr_phy_led_polarity_set, }, +{ + PHY_ID_MATCH_MODEL(PHY_ID_AQR115C), + .name = "Aquantia AQR115C", + .probe = aqr107_probe, + .get_rate_matching = aqr107_get_rate_matching, + .config_init = aqr113c_config_init, + .config_aneg = aqr_config_aneg, + .config_intr = aqr_config_intr, + .handle_interrupt = aqr_handle_interrupt, + .read_status = aqr107_read_status, + .get_tunable = aqr107_get_tunable, + .set_tunable = aqr107_set_tunable, + .suspend = aqr107_suspend, + .resume = aqr107_resume, + .get_sset_count = aqr107_get_sset_count, + .get_strings = aqr107_get_strings, + .get_stats = aqr107_get_stats, + .link_change_notify = aqr107_link_change_notify, + .led_brightness_set = aqr_phy_led_brightness_set, + .led_hw_is_supported = aqr_phy_led_hw_is_supported, + .led_hw_control_set = aqr_phy_led_hw_control_set, + .led_hw_control_get = aqr_phy_led_hw_control_get, + .led_polarity_set = aqr_phy_led_polarity_set, +}, { PHY_ID_MATCH_MODEL(PHY_ID_AQR813), .name = "Aquantia AQR813", @@ -1048,6 +1073,7 @@ static struct mdio_device_id __maybe_unused aqr_tbl[] = { { PHY_ID_MATCH_MODEL(PHY_ID_AQR113) }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR113C) }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR114C) }, + { PHY_ID_MATCH_MODEL(PHY_ID_AQR115C) }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR813) }, { } };