From patchwork Wed Jul 3 18:11:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13722677 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.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 A27F31862BA for ; Wed, 3 Jul 2024 18:11:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720030310; cv=none; b=InqnAoeD09xr3IyaB1CAzjMHige4VfLtYEr/10/Fb9otA6cT0DguzimVwpWMQhpCx9hbU4AzDxuR7Aw3Bp7Q5H4eDOKstkPVkdHzWhuiizeiR03SRQ1wehpe0A3g3t+d0umsR+O79Hw5KMyUlDcW0QoeNeB8jsk0Qfsol087aBE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720030310; c=relaxed/simple; bh=Ya7JRuOpvI1mc23hT3kq5HyKGwwymGLsHGeOErmvRQA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lxaeql/QQksuTuT4Khr/FZJYSTWQyXXCcX8dGOAVJdnqGAJxN4uNq5JVya4OMb6UQkR66y0wgZ/cOqhhjpELFKuh64PZwM13738ymmu13Ay/ZDCg71rsyK2jcpOmtm44tdEQyntIWKRYeg/8MzdbhOg7/vL+JrknIYqShUZ4JIM= 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=Ik5ysb32; arc=none smtp.client-ip=209.85.128.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="Ik5ysb32" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-42562a984d3so40140645e9.3 for ; Wed, 03 Jul 2024 11:11:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1720030307; x=1720635107; 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=L0QRgM6fvt7mWflQHel1qsIOJCVNJNaGUQC7xIWGyMo=; b=Ik5ysb32mOl0oXNfXsMaGpmiIGVI98ZJQ+6ckvjkrwcJ8lrvUW03ee8CH+BR4k+ICh l1P+5GSbDpcgt6Wku1PP5cH9MjWJcw1MH/G2rygUbXwyec4rdP55fD7z32Iybl5HKGMn Z/0hlgLW8jFr5cWmrlo6Qii+I/ASP8l8V0Y9istyTl+MdDdxp26+Lm3umWi4QPrGozXS v0a4hOKeE3z6EOC7w+OAUvKLeWX4nVOfPEWPJpO7+FitiVu7A0HAsIKvNwIRXEjT286A QoQzFbyDlxziZX0SfcKYRoIcVpMTK2aIRF7y4gd8CV5n0BWMlGoo6ahvZJ1bsbTC8kNT +7jQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720030307; x=1720635107; 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=L0QRgM6fvt7mWflQHel1qsIOJCVNJNaGUQC7xIWGyMo=; b=F70AbqhumQD4znkNlWWYhmQdND8cpSNBEQFJV3q6lBTEVIA4rSaCnuF6sJhZEqBvPf Gx58UPoKfjpPGgUf7q7SDM367O5jp98B8r0CRy4hZJrTLWpclkRkmiBULlq7MxR0k+5v SmqcY7ukVurjfVc7EOskXOmjnxNN2+cNhP5yDvQriPtB7rrvQ4CLwgAyPWsbQok5loen IVsMDxQitDBcVZF9r6X2c7B4Vel94w8wM7guA9C4tFEkF3hF8Hv8bayhMojDUndPckUK xBJWs2m6xft+yY3zAezwOYCFJlB2jOD5oyk2MbGXMtPbXmqg/dfX4fvmydhS3GCvFwLe xgRw== X-Gm-Message-State: AOJu0YxvBK5+pxTP/WUGUagngh6MFMwMaIjeDdc2yok1GtO0pcZD/OP7 VxlHUspshVv63CrSXL+bUFUF86fmJatO5D2p6SbSpl8eUmb/6gcJtK5hH5gmKbg= X-Google-Smtp-Source: AGHT+IE9ecYh0TynIiGek+n1mnz5lEz375vFlXm+NaSRncFsOuV60WslfeQFIDqe0ZUtBf/d5YRwVA== X-Received: by 2002:a05:600c:54cc:b0:425:849c:86fd with SMTP id 5b1f17b1804b1-425849c8732mr60047875e9.14.1720030306764; Wed, 03 Jul 2024 11:11:46 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:dc:7e00:c37f:195e:538f:bf06]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256af37828sm255295965e9.9.2024.07.03.11.11.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 11:11:45 -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: [PATCH net-next v3 1/4] net: phy: aquantia: rename and export aqr107_wait_reset_complete() Date: Wed, 3 Jul 2024 20:11:28 +0200 Message-ID: <20240703181132.28374-2-brgl@bgdev.pl> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240703181132.28374-1-brgl@bgdev.pl> References: <20240703181132.28374-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 | 1 + drivers/net/phy/aquantia/aquantia_main.c | 6 +++--- 2 files changed, 4 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_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 Wed Jul 3 18:11:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13722678 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.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 2A022186E2D for ; Wed, 3 Jul 2024 18:11:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720030310; cv=none; b=B+RB3fiKb0A1iUVb4QK+H5REj4ugnA0v9pmayOC+XKy/hEh7xRJGsOvh/YoQ1yp9FwFAlBKgAfEVzNp9GiAjIQZ/jo5s6Rgkd6A8/ETS0Gukhc/dmM8nQr81tGYbwCP8bsXM9LvX8zYgM+skm8rfNWYiC0QUxF1o1eJf80XlJTc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720030310; c=relaxed/simple; bh=qT/I0vbZRGDpE8yP1ELoiUDNULDJ0duW33V+A0EfTRo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HHUe45a9RHuGGMJUOALiA6fDOXsbiHrog2EmZeT90EYHxvaLUq3PHCdWOcH2Yrjb0f6YTN2qvrO1t6SnUKz3pBcr0UCqR9GgKMFjVZkGZLdBIGa/wQUWoSJ/IuqzJS+ceJV99MTzwxD6YGu0LR/JBBFzuWi2OixyDACN6YCzd+Q= 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=KI/TRkAz; arc=none smtp.client-ip=209.85.128.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="KI/TRkAz" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-424ad289912so39959835e9.2 for ; Wed, 03 Jul 2024 11:11:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1720030307; x=1720635107; 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=KI/TRkAz3bD58fQgVzqUsT/3DFp6QeARBtOyC0gjyp90jXKFC5Q5mBUpvTltpiv9hJ GRnMhl/H2RxM1PjcDjG78En1ie1vrzXxR0I8/W33gcMr/hQEpU0I2duEmhTfi5z+EcOz keT+E1TYWY9jhATl4WKWVssfoEDKSHtahciPg3bnj2PwamKXb1dP6AXXFDyKfDDjEq2f UTL5pakxqRQr51uLK/R3OkM924E2YcXSLqrH7xtByEwik2Z20PWVScI+EsbP9L6TAwML 9sddvDvvOxog4NTJp0Zyyt3+75hghmHn3nS+dW6gFpiAc9/2xexEwWtlBEFd7voBynVm 6tkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720030307; x=1720635107; 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=fPQRnJHjzlJ+Z3mV4A7mwFn4vYFDuLohAjM245/qQu8sg9XK/VIeir9KxitA4ppuQo 0idX8GtTVeppIelJXNegZII0VAfV7YtTCuGIuZ0h0dzh/dlvwNk5k6EyufJtO4LYMEui viinmEdX6DWFlIKjJpQNHyGwNsic8hmnIsCB/ki/TI8+vJBQzRiqjNT0xkIXKogk4WmC m8aBxghz3eDjwRtQIFpfS+F5PuujEEmyHbMAS88bFVE9CByro3locRFuMctpd+xbeJJN +MSnAd3v/Cmy+lAMbmM/yc/9itjXTp7dV1zJra6rjlEWo4R/ZsBFflqlTv3HFeDDmODZ Y/1A== X-Gm-Message-State: AOJu0Yw8vHkjcrJCTiGk1bKuVBdK6nGuFmCT56Fzv/fgu7lZbAc8T5VR PrLqoOXlDuxvUMjXlmMjz3IYoFNVd7WFzQKz4IZhrIr3kEAzUTmdwiGdtIEHo3M= X-Google-Smtp-Source: AGHT+IErpOTH5np4WNdFL0dt39n7/w2pRaPdii3nhm8qc2dmFYkgcWXsp23yHtXNUTE0DONLhMPEsw== X-Received: by 2002:a05:600c:19cb:b0:424:bb93:7aad with SMTP id 5b1f17b1804b1-42579fd1d64mr98083665e9.0.1720030307575; Wed, 03 Jul 2024 11:11:47 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:dc:7e00:c37f:195e:538f:bf06]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256af37828sm255295965e9.9.2024.07.03.11.11.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 11:11:47 -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: [PATCH net-next v3 2/4] net: phy: aquantia: wait for FW reset before checking the vendor ID Date: Wed, 3 Jul 2024 20:11:29 +0200 Message-ID: <20240703181132.28374-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240703181132.28374-1-brgl@bgdev.pl> References: <20240703181132.28374-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 Wed Jul 3 18:11:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13722679 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.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 CDC7618754A for ; Wed, 3 Jul 2024 18:11:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720030312; cv=none; b=NsSrAzI6gKDmpy3L/LtkycFER1YzhWaPyh2y+VlF6eQkEOHnRAcmA4Sg6DnDevUC09C61i5Cgd7ZOqM6ia9Arjw8YuxKsAnIwhK5sM89TENoomM+svHBGZzqTDiLZpqVD92vHlQzPvKQC0mUneBN6RKpldw01nDkDvcJ9kX6B2w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720030312; c=relaxed/simple; bh=I8ZVS0D82/R3RtH++gdSA2BpSL5i3uiqUGmj0KpPRmU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bptajZjxQfu6LSVodROAAfDX4g2ZIThBVQWyDhq5XyRoV+6u6+msp+WACgNSW8fZZolyLn6yiYMdLuPu8oG9jmdui2rGBb61kr+ahcyNq9UJNQZJD90r2/mvZG7zEnuRg+R3qLZqHJDqPLynR2njwAUsQf9AYw0jnjjnYA9e5K0= 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=znLU8L+e; arc=none smtp.client-ip=209.85.128.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="znLU8L+e" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-42122ac2f38so6396745e9.1 for ; Wed, 03 Jul 2024 11:11:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1720030309; x=1720635109; 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=znLU8L+edVKJWwnxAsk63EoWyCH1+zDzoWWdOI20ORV7YQXwIy4nwxCzfUS6xD3KKw UojKMFhvtmd4Ah6zmWUI45bFOa5FGDpPhZYjzrjwjDu5WZ0aciqsiOo1YF/Q1ZrDYUqc 07FrTZ7TwNpafvIF2qYm3EweDvwm3p9ozH676WYsyI4E6IYFzMWFgGqCSCsOWcdI51RQ Py/96wS+9pxunVICdZMUz2dlwwfQ2+nB4wSiPOKHFp30/9qo3z41n/QgGAId7U6AEzby OC303McYXny4Ie2KQNxHZpdW9W0qUXMOdsCwVrAdDUcaCVUTEStSrthznPvec+Lh81a7 DSPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720030309; x=1720635109; 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=XwE6vs8Hi+r0xwC7WaBsOyWZHg64hwFfVhzQBHZRZk5UNLeB3YZqD1Gk+i/DWEdt/P GO8bVN0Kca4ZfldKETzrAMCD50u3ojyCj/y3Kv/gasxx7v9WgCXWP5HbuiiHSf5ChhJT 6HX5cv2lp1ddSJKafNUEkn9tWWW/PNGLe9XXSHX35etJ4PyjDLxI0bj6lUv3jtnZI8Zz 66yPIGZ9P2PvwI9wKJs8qZ2CfbMi8zqzNDyffKtYFpx1uegxoW0bcNNsfFneQLGP9C82 5TTaK2wcNN9ZVFR/W45UEItAiqQ2GsGbV5M03tHlgjf1H4n44j5qEUmSqN18FFS/EHm3 JRpg== X-Gm-Message-State: AOJu0Yx0rfFM3Gp69sZrrDV0HbgY/ayeim84LECKlJXyxKUh3bSqQb5A ER+gbdpGoYMHu0RmYOEH6uqhv8GHBBP18T/rAHgbRJiohfGX0BNMnUMirZyTxlQ= X-Google-Smtp-Source: AGHT+IHVwe8/4ij6H+78c3AbrhZOwIE2BfvOBOZPCNI35hR3tc0er9IaJ+qw7bNgU/kFrct/G4o16w== X-Received: by 2002:a05:600c:4da4:b0:424:a401:f012 with SMTP id 5b1f17b1804b1-426408e51d2mr21890405e9.3.1720030309465; Wed, 03 Jul 2024 11:11:49 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:dc:7e00:c37f:195e:538f:bf06]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256af37828sm255295965e9.9.2024.07.03.11.11.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 11:11:49 -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: [PATCH net-next v3 3/4] net: phy: aquantia: wait for the GLOBAL_CFG to start returning real values Date: Wed, 3 Jul 2024 20:11:30 +0200 Message-ID: <20240703181132.28374-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240703181132.28374-1-brgl@bgdev.pl> References: <20240703181132.28374-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 Wed Jul 3 18:11:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13722680 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (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 523B218FC8F for ; Wed, 3 Jul 2024 18:11:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720030315; cv=none; b=SlRb3U9+bDg9ER4HudkPpVakRCLjtfeXynRvFxf8DtMtgviGdMhrLpl6qt782M+KlHHePgppbe8P6vZvzPCS/8qyPN8P8hzfpox4CYr2UnTyz5LTfhC/RQc51BCpMncxcmniitip0iy8MifHNRxYivXWHUBaiF/bF4m2YNLa4Ng= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720030315; c=relaxed/simple; bh=aWRGwjNl141O0N2eu4pMGXstKpSbZTAZRRlvToIsLls=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mhn0LHAgRWUWp7TqUemeiVtaF7u73ML7+ozh8c04Q6FlfNNA8jC9wOUnhI9UEqi3Tyosfst3NgnNUjvaYSLZCvq7W5s5QjurqTorn6OtSaH+3Ja1VtPjN7IS6NSLG+HGNXzQ64sPV99+XXEWX5C8fAdivDVdbNhVwe+SFFglOPI= 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=X1KNbFCU; arc=none smtp.client-ip=209.85.167.42 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="X1KNbFCU" Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-52caebc6137so5296444e87.0 for ; Wed, 03 Jul 2024 11:11:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1720030312; x=1720635112; 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=X1KNbFCU1gDc5vccHTUiVy9mhdC2JJSI1+PvfxFU6QWmIjERx1Z//lROvGq8jgEKFx fZu496Dly1Fc16UIJ86sDkoFO3n642n+h0v/DodzrmK50ueV13DPbfyxQvpsPuKkV1fF vRlwj0ecX4wWTSC5vCb7sa+Wk6i2faz0Xij7A0+IdK03zYkmqVxnULDPfCNtSU3RegJk be5ArIv+5ROzTQreEXRcbzRfct+Wet4lrBt9j+TT+yuEJ2F1EZiPqoy4BGjsfzMaW/ht k0kAFCjhCoTOILP274s0JQ6+1R0omP4ViwEYtIcnxVfAjeR575DK6y5Wd4IiJi7nLr7r olDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720030312; x=1720635112; 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=mywHDMHuksUuoPBZMnT/B/B8BRQX59GXdy1je4ZLGW0MdUQu+fHd2m5+AwH2t20J2y nLhd6sMTWrSjSl1rO65eQvSejIeJ5Z0PmXhlsN12KzKx9SPQrZqxnRH2FNLA4nG6Rhxg M5szmetrD3h++b32LNvXKQ86p1RZE5Ly3VLmcnUaP4ic9sP5aesiz0mQSDe/6X8Tm7/A 88PKR64/LXHIstEaR4uE0mc9StagccITTkRNNY9R/bWfyJCDnYDV14cOWfRU9y2Dfh37 NbkXpsBFZ0FilGnYGvGlz+EeCl8BJScy274M8MQ4OQzrsOcr2jTAaLcIZmepI+8+jmvO RxZQ== X-Gm-Message-State: AOJu0YxvR8SWxtsVUnf82VHUWpawW/+mWa6vr1FfEoNIULwKrN5eQceZ J11Ha8VIi59WahsHf5I0/EZv7FNpFVGMcFxhGeIf1NVCqG0ge92UXQzFUwybA7nudVtOrQB7NLQ t X-Google-Smtp-Source: AGHT+IGJ92MJnvwayKor/szhFQMSnyPVZIaE+W1/4fVR28fkPdYSuQi6QNltMsxfShBRYqDRjb91IQ== X-Received: by 2002:a05:6512:114c:b0:52c:de7b:586f with SMTP id 2adb3069b0e04-52e8273656amr7958556e87.67.1720030311256; Wed, 03 Jul 2024 11:11:51 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:dc:7e00:c37f:195e:538f:bf06]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256af37828sm255295965e9.9.2024.07.03.11.11.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 11:11:49 -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: [PATCH net-next v3 4/4] net: phy: aquantia: add support for aqr115c Date: Wed, 3 Jul 2024 20:11:31 +0200 Message-ID: <20240703181132.28374-5-brgl@bgdev.pl> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240703181132.28374-1-brgl@bgdev.pl> References: <20240703181132.28374-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) }, { } };