From patchwork Thu Jun 27 11:30:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13714245 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (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 6A26A14E2F0 for ; Thu, 27 Jun 2024 11:30:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719487834; cv=none; b=YtOzI87ODrJwnFKsAGyv95Fc88b8L/pK+H3gbxgBBLMeVz8ZOzROyToWwP8lELIsUPNCU2bhM14MX0OEpfIlVUAINROQXiJs+33XL5aMmkx/MS0ce05gkPG3ewUCAWBx4IGBg2SY1zCCNTHvmhKdQpuXet1B1Sliy2zUZGJKgao= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719487834; c=relaxed/simple; bh=Ya7JRuOpvI1mc23hT3kq5HyKGwwymGLsHGeOErmvRQA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dO4hr9G4nEGUPIkcMLQb5eGUsWvWg31OuZfpzGpSgTcO8phCRfZ/Llhv5BFbzCl/mAGTvoIMjogH71KGMSOfuIcbar0Xzy7TKeS1E42EB9JO9Wd4bCwUOHgL8nlqN273u7DMvxvUR3BLPjc860XGplfsmYVf/cputFjyy01F/kk= 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=iBePjVnn; arc=none smtp.client-ip=209.85.221.51 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="iBePjVnn" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-3672aec418cso1083766f8f.0 for ; Thu, 27 Jun 2024 04:30:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1719487829; x=1720092629; 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=iBePjVnnTtGtjqA8u4A7A7+Jc6sxhTAmyqlqO79rsZsc4AFO/JI7ocX8j2PFZZxrfU PA8s2hGCLvOuJeJVDfd0udlFxvsOLSxSigIq0pL72WHq+4d7PwKK6jnWlmhjEk2o91O9 jTDwu9q4+SbslYlWdUZktrih8lqEtfozTUN0IxwPM0bHq9wBj/Gcupd7ie38Eoo4/qQp 4rpZIegUxwDP7uh6p+m5OAReVOb5tRLYESW5ebB1LRgJxCWyiY3xkME+cDXUIfmbrNmW OqcxcB9OGokmRJyVrlp+7QZ0d4GmBbFJXQeRoEdrkRhdCqWn+lpFGodrmhUlPVyRwm8+ qWgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719487829; x=1720092629; 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=DOJoubbxWSXt1yeVW5VabU5I/MRiONOOrF5eb1/VJhWx0rkWMxufS15AolP5eKJONE Tvlry8oPfezMvoOpieNkgk5LCYyK86GXfd14Ee3RrWQSWifefcBIWmA6+sgqtr92+j8K rW717hM/BR8nDLGqQs7BPGOIDBuUuabGuvOVYDYW2C3WamYxBf0ALiIJGKctJfSZ94Se XHHCHHA8zL1UfbVe3+jJa0Y+bFDRac+YWIDtGrsSsHlG4D3hsHd+KYo4JvGkmEoEEGAo 4lPjL0eTvjhfKQAAha4858s2CLGu2ItHr2sX8UC8r/AFx8fgqw8ew8I6YhLBK0xjsv3a xMJA== X-Gm-Message-State: AOJu0YwQtpkghDcYbG7wR7kifQZE73QLcP7wFF6Sryr7EFszD/au9p0k 6ENNf+t2lBtVBS7qkFZVnskqMkCXRMisp+bQpnDzsxWMgAH2KPyANriN8jVMq5U= X-Google-Smtp-Source: AGHT+IHtZalwKUmz03jYf/W8W6QwUXJljrBV5NvK4R0vga/4Bv2QjNASP687/iYIZH4x0UVsSJ4hjw== X-Received: by 2002:a05:6000:1888:b0:366:e87d:a771 with SMTP id ffacd0b85a97d-366e87da7d9mr12245883f8f.3.1719487828431; Thu, 27 Jun 2024 04:30:28 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:dc:7e00:7fe5:47e9:28c5:7f25]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36743699ae0sm1504111f8f.66.2024.06.27.04.30.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jun 2024 04:30:27 -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 v2 net-next 1/3] net: phy: aquantia: rename and export aqr107_wait_reset_complete() Date: Thu, 27 Jun 2024 13:30:15 +0200 Message-ID: <20240627113018.25083-2-brgl@bgdev.pl> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240627113018.25083-1-brgl@bgdev.pl> References: <20240627113018.25083-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 Reviewed-by: Andrew Lunn --- 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 Thu Jun 27 11:30:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13714243 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (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 C70BC14F114 for ; Thu, 27 Jun 2024 11:30:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719487832; cv=none; b=jpFdvChBT6maRgSpOTAAnw/maDmTVw08XXJmSeMZ1fPcHTzpQBnmz0VRCUm4biEcNbZdLEVnQiWr1NJOhu39zX2Mn1R56ohAQryq5ifIjzWmWGz7cOJYLhzH6bfEvWHc1jSXKH/rAylceI/8LcgjjxoZkc+iZMAhJnBLRuuuuoM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719487832; c=relaxed/simple; bh=qT/I0vbZRGDpE8yP1ELoiUDNULDJ0duW33V+A0EfTRo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fEo+IP3lMJJkJmUAoZvE48Y6OGbG81S0Z5Gb4U04wzerorrwS3uZyZji0qPH1zn5HrZSHL1v8InBn+hDm2Vgku9f3VpezmxFZvHII9jnV1vrqIxuzmy9oV+gPOVkcNBIICvh9E2saCx7+Mc3BXbYT4z+uNP/D8dxgBAb59vI4jk= 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=Q8n0qOnU; arc=none smtp.client-ip=209.85.221.47 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="Q8n0qOnU" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-363bd55bcc2so5967706f8f.2 for ; Thu, 27 Jun 2024 04:30:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1719487829; x=1720092629; 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=Q8n0qOnUBq9zJJWxJLsFTL8v5H7teQ9On6bxDJyP0jsB6I6mB75nXCNLLKnSoqyYem E9W6QZ+JOZ09VPyTutcSLARe4Vv/+ZldjLhJZSKOuN5VPQMsFq8uuwhx0uj37T3koeOm WmJrNzsniWv8nfu8cwjZBtsd2iwPuDBK/fdMotY1Qh/eyvLn7VwbGRF4KBDWXaerNf1V P9y/klJ/J5RF7f+YH9JGGf3+ZSMfjLJOZUG2qL/VwnSaHbpioes4EuOOROvsqWurLAvZ BtWhzgOOQleLdtaBIEE3qMAR0/hk6Zf+b5o8e6mHVaEHcr3Bh5X1NxIBGrEffzTi0QIt ZPWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719487829; x=1720092629; 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=YDgS83hjzqUPXPW8iDz3oQ0oI55TOjUyVozlF53S1xTN5dhhAN724z6Lyjy/qcu9Z4 U4jpwGob2A/AkVPk/uClJwvLFCYgbTJmd6LTzFKlcj/vZqd9pCQMqDlIYW1GPqL0Htjw FtOhYoG38ydhHH4S6xc9HPDN/geBdYV1b3+7vPTe+FpYWuxm9NpQWEq9MfGIdjf5sDkc H/PhZ4ymYfZUw+5NqT6Xj2A8TVEJjyRlybWQduu5yTzdA/eTeiNqemNp6AMs0cvoxTpq K8oixR9TGh+KjPWoCAGuYnpsRoaTjGt/os/4b7du62H9a/kyD6YpzzVFuFNtXFeyhsvK eGAQ== X-Gm-Message-State: AOJu0YyY6G/0PmdmO0zBauYlLrPy7EB0hL2Og1/s8uaTpv4WpN6d1Due dCsDa/O/MKXAVIG8ymmo+aUS/rIZVQVdTlacmWVTBncOHC8XHnI1WPz3S3DN56g= X-Google-Smtp-Source: AGHT+IE3DkKA/w8nX9UijesIIy/Krp9fMCKxcp6E1gIBE/pfr/ALQIhI6+lVmY51WFB5RS6DUQEf8w== X-Received: by 2002:a5d:518c:0:b0:362:3b56:dbda with SMTP id ffacd0b85a97d-366e9463e46mr8283279f8f.9.1719487829229; Thu, 27 Jun 2024 04:30:29 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:dc:7e00:7fe5:47e9:28c5:7f25]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36743699ae0sm1504111f8f.66.2024.06.27.04.30.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jun 2024 04:30:28 -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 v2 net-next 2/3] net: phy: aquantia: wait for FW reset before checking the vendor ID Date: Thu, 27 Jun 2024 13:30:16 +0200 Message-ID: <20240627113018.25083-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240627113018.25083-1-brgl@bgdev.pl> References: <20240627113018.25083-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 Reviewed-by: Andrew Lunn --- 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 Thu Jun 27 11:30:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13714244 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (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 BE974154BE8 for ; Thu, 27 Jun 2024 11:30:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719487833; cv=none; b=MyXggjnWu3pHM6upq6CiwnvXDY+oSCPXT9Jr0fbGoIAsl82tyxI/MKEGGniqyW+rrU9jYsof7g+u192Iry7iP6FG2+Sc2/u2ryIeZZEJ3Ost/nfT0XduSXVtaZ044Eplj4o4gV/G+7d15AOELYssP3yIPP3+f+Xw1FyHS8S3XSY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719487833; c=relaxed/simple; bh=+dkNGrY8iUBtOuIAm905KbG4l4iftKZC0lmNmQHFM9E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gvOcGK4Ec2C6Av8D5seUDW5C1k8br1RNlDSzx+NTnWr89N1oMVBiBs/O5n2w12gFbqnA3gKtX8g/FxlSNqO3PTJnRg/J3B8B8DT8LQZkjqrV8K4X2uB/o5FFF3csv3i93nU52VnvlnYigMgOe9pv8MIeTmw3FFSy9DyE9F0fTpQ= 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=NqgSWjlQ; arc=none smtp.client-ip=209.85.128.48 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="NqgSWjlQ" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-424ad991c1cso21182765e9.1 for ; Thu, 27 Jun 2024 04:30:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1719487830; x=1720092630; 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=4BN1xhZxrLr5nolBCZpgMsAlPUqMYeOtqezwGGeoYo0=; b=NqgSWjlQtiVg9hJhTPcdl01U8RR3YdWqo+T/hSXdheMZuxJG82RXQAQruMXHej1sfg oajji3wldwaTKOG+KK9XSH7TfFm7JOaCV9GCBCDpYnEdvPTppQ8H3NyBTQ6vbWuuWS/o +tMQGvw475pqzfIGF4OZxDghXfesa78M/vlip8GqmuquZ0ZtWsjUlOd3VE9SMDfErsuY dST+Wj/sK3n0gAhe69iftieE/j07H+6TfliPzw3EwU6cLayJ+fpYcM7wiby9gnHEn8Ik yrJTZDZvymxjyTY1+NWibl5TQJ2UKLK03Bpbq/igRv6FRPSastzYekGxnZq8ASbNruBp RjLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719487830; x=1720092630; 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=4BN1xhZxrLr5nolBCZpgMsAlPUqMYeOtqezwGGeoYo0=; b=dXPb42Fm5ocFWkRfdkuD9MQw2MBsLIhXrrm850jHC1DgxQ1f8Geas9AxSUb2unnBkd /37KoajXBsPBM0YW8ZbZoJ7f2nCUpO+7Izg6iDEzIonrGWPyPI2XbyWbXTY90x4KrnXT jJfKDRhNtwH8GSSv6eGJT8NHtQc9K9sQVd9mGWISRPWkpTd3++yJKPAoz5IGjjti6GzW rRhSElgg7peDFj7Ogyma28vRtWEZQ43XE50yf+8ptGuY6AxCtyXpRcQlfsFctCHjEqbm Cr9Cx4NkhmreLNisJVYY8BL2S59nDOvQ/hgsVQjL6uw71H1seawddm8OJIpH+Kc8CtK3 8EqA== X-Gm-Message-State: AOJu0YwQ1TCvM/RNe/vI2YprPJWYqoXVYWEOmfuloNaq4aYEQaHidXw9 t87V02luWnm0ibEQgvs4qySFbqzAP8lmw2JeRoS8TvdfgAj9PSea2YSHZ0uCkoc= X-Google-Smtp-Source: AGHT+IEspJ5tpQhEcaFkouMsqw9DA/rsVOiSsLgs+WQRpheU7yQxhWLnKxJTMUL6UGdqoDGHD8y8EA== X-Received: by 2002:a05:6000:4594:b0:362:c7b3:7649 with SMTP id ffacd0b85a97d-366e95eaeedmr10121351f8f.56.1719487830020; Thu, 27 Jun 2024 04:30:30 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:dc:7e00:7fe5:47e9:28c5:7f25]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36743699ae0sm1504111f8f.66.2024.06.27.04.30.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jun 2024 04:30: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: [PATCH v2 net-next 3/3] net: phy: aquantia: add support for aqr115c Date: Thu, 27 Jun 2024 13:30:17 +0200 Message-ID: <20240627113018.25083-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240627113018.25083-1-brgl@bgdev.pl> References: <20240627113018.25083-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 Overlocked SGMII mode with 2.5G speeds. Signed-off-by: Bartosz Golaszewski --- drivers/net/phy/aquantia/aquantia_main.c | 39 +++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/aquantia/aquantia_main.c b/drivers/net/phy/aquantia/aquantia_main.c index 974795bd0860..98ccefd355d5 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 @@ -111,7 +112,6 @@ static u64 aqr107_get_stat(struct phy_device *phydev, int index) int len_h = stat->size - len_l; u64 ret; int val; - val = phy_read_mmd(phydev, MDIO_MMD_C22EXT, stat->reg); if (val < 0) return U64_MAX; @@ -721,6 +721,18 @@ static int aqr113c_config_init(struct phy_device *phydev) return aqr107_fill_interface_modes(phydev); } +static int aqr115c_config_init(struct phy_device *phydev) +{ + /* Check that the PHY interface type is compatible */ + if (phydev->interface != PHY_INTERFACE_MODE_SGMII && + phydev->interface != PHY_INTERFACE_MODE_2500BASEX) + return -ENODEV; + + phy_set_max_speed(phydev, SPEED_2500); + + return 0; +} + static int aqr107_probe(struct phy_device *phydev) { int ret; @@ -999,6 +1011,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 = aqr115c_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", @@ -1042,6 +1078,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) }, { } };