From patchwork Sun Feb 18 07:57:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dimitri Fedrau X-Patchwork-Id: 13561726 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.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 42565EAD5; Sun, 18 Feb 2024 07:58:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708243083; cv=none; b=Yp2kD3R3Ewgf2xb9yMd1KGOEEyTy/J++ahINlWeot/aMot1XrP4AntTh5QhRJHSTKiP6EjZnSESxF5wbTXgMQlu7SsREq4J60aVA9eqpjcHOdFsYVwTfMtKZ0t0DTkTeDv3IT+in0ylAQ23/7hJXKL6uhoAA+1XxV1xYvGmEyOQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708243083; c=relaxed/simple; bh=12ZQEdtuynQ+RnIa2FV2uXf0/cwlIvakbZZS+qm0xB8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qTWTxhEZ9OIa7963Ws6KBCTB5nhyEFHbIbZ46fAArz08vgpl3EToGw1PNK747vpwU002b5d6YQNJ8FsKn2BEEXezXtNn80cW+ITTko/R19Ddx5pgv29V/dh6XhZpscpMVrOd63jG4vlqali9+CutdViOhfZbV3Q/eSYXXVc1rI8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fCzD9fao; arc=none smtp.client-ip=209.85.208.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fCzD9fao" Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-563c595f968so3585937a12.0; Sat, 17 Feb 2024 23:58:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708243080; x=1708847880; 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=bU9yZws6bY4pAcFt+/tQW3bVoJ4iyCU+qUdZyENINWE=; b=fCzD9faozpixaf0WJsOBnwOk/MpjD9H+0GJteK6CMWYOt7hQ0iwEJ5MfTmUcOU9wf2 C0yAORZgiY7AilQE/zRjtdr9snD+hkW57SEFdAQydoxttPtmL2KmForb6IJeHRyGyIYz b+CHB56pzmOs0YGlvProc0US2l8BLlnSizhS7PQQ/Mi09wVvlalGqJpBRAhsEVdPrc9I +3GHW7f8dBX9pLYf5eh1/hxDjF425KyHDB4r/DOMfSPVsOcp4oxJpt9le3Hk1Mnrmj4Y lZhfR1/Ig73NRTNB1wtMnMcQBkEVhYSKXyNUBca+3+/BCfJYbfdCntzEnpGodwbpGdNo VSrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708243080; x=1708847880; 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=bU9yZws6bY4pAcFt+/tQW3bVoJ4iyCU+qUdZyENINWE=; b=sKSkt4fVlzM9LhNYfRJ8OcPfpFUwmDOpliTG0KktnDxZHxr8NonnPVy7imrGWldcwn KHLc3gFxNUYx6yJY2rpwaZ3Ky3tkWNGPqOor2vSNUQZXC6jZ3VbSyNRZuQNgSZ8gqo0m LlQRFpQBpFkz2TCZFFKGy8SYOhfXP7aMx2aw+4a2Ht58Trjv6E7xJtY6yrWrLqgt4d6y jlKEsG98neAmUt8O2bstpGaevvczdjCwvb2ZHg4qMMmMe0OYJ4mnrWxvPp2tua5yNeHi FfDJgF+XSGbbI/F0+XVJKL72nAoYZWb/fbqb6RkjOC+JKoBXxwsE7Y961AUAj7G1lMid NDiA== X-Forwarded-Encrypted: i=1; AJvYcCUPwpUNLNdTpEJhJHjEOfjb+ivEIg8D9eve/5FbMsFB/N6Q2E4rqaBmfY+OG8Vb+d0i8aRA0WrQWNoLaeVmQrEAV5rDlMssG+3m7ffgVJNKDdoHbDx66giIQlqGyumFkLf2E9PD X-Gm-Message-State: AOJu0YyIvs9A7JLSSLaJoZBGqDW4CLbiL0sMQlZeWKqfBlk5bDVnck1K JvMwXfADbkf+IjwD7gXbmzLFJkw4luPDodMAWKhCyNzd0qAYvtpb X-Google-Smtp-Source: AGHT+IGXHWdGOBEtbe2Q27KHCj3vWhkjd9YvBSUq5+h7VAsPByLk0kuEXYhvTqXB3cClDVqxOL/YmA== X-Received: by 2002:a17:906:b0d9:b0:a38:63d4:2273 with SMTP id bk25-20020a170906b0d900b00a3863d42273mr6487403ejb.35.1708243080451; Sat, 17 Feb 2024 23:58:00 -0800 (PST) Received: from debian.fritz.box ([93.184.186.109]) by smtp.gmail.com with ESMTPSA id jj12-20020a170907984c00b00a3e64bcd2c1sm458732ejc.142.2024.02.17.23.57.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 23:57:59 -0800 (PST) From: Dimitri Fedrau To: Cc: Dimitri Fedrau , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Stefan Eichenberger , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 net-next 01/14] net: phy: Add BaseT1 auto-negotiation constants Date: Sun, 18 Feb 2024 08:57:38 +0100 Message-Id: <20240218075753.18067-2-dima.fedrau@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240218075753.18067-1-dima.fedrau@gmail.com> References: <20240218075753.18067-1-dima.fedrau@gmail.com> 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 Added constants for advertising 100BT1 and 1000BT1 in register BASE-T1 auto-negotiation advertisement register [31:16] (Register 7.515) Reviewed-by: Andrew Lunn Signed-off-by: Dimitri Fedrau --- include/uapi/linux/mdio.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/uapi/linux/mdio.h b/include/uapi/linux/mdio.h index 3c9097502403..c0c8ec995b06 100644 --- a/include/uapi/linux/mdio.h +++ b/include/uapi/linux/mdio.h @@ -350,6 +350,8 @@ /* BASE-T1 auto-negotiation advertisement register [31:16] */ #define MDIO_AN_T1_ADV_M_B10L 0x4000 /* device is compatible with 10BASE-T1L */ +#define MDIO_AN_T1_ADV_M_1000BT1 0x0080 /* advertise 1000BASE-T1 */ +#define MDIO_AN_T1_ADV_M_100BT1 0x0020 /* advertise 100BASE-T1 */ #define MDIO_AN_T1_ADV_M_MST 0x0010 /* advertise master preference */ /* BASE-T1 auto-negotiation advertisement register [47:32] */ From patchwork Sun Feb 18 07:57:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dimitri Fedrau X-Patchwork-Id: 13561727 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (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 6222912B91; Sun, 18 Feb 2024 07:58:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708243087; cv=none; b=Ne27pKJWvPFY7gWpRNoMnmHMe6tADYcvkodIH3EY1ZMsl5wHMLUSDDVXJtw4fn1sb6ZrFoCGT8stPo+19mo68d++a+vMtzQpIyDoCA/4Fx/P2AaH1fS3ggaAH3HdgG+GQ8Hge+dpOBGH2GI9awkbjsD1M5tadwVTYruxMaEkaVU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708243087; c=relaxed/simple; bh=Xlt6sMMKAUm7IbZRBGhxEDcRLpN3TDT3XNkJuoLuK4w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=uM2RFIOBk437nqNXOOZtvzusJIdwXRfWQaV8kVnnrC3k9RygBRANnw3oRYhiITi1QepLXUy1W3zwgO64EIVTiFCkzW61xGmODUj9wj0VidPmWfxzz6URdVHVWQIAIJEG5GGgljaLZ1z2uXNI5+HxfqxPkLlrWkwJdb0x4D36T4c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=CqP9sTZy; arc=none smtp.client-ip=209.85.218.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CqP9sTZy" Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-a3e72ec566aso13741166b.2; Sat, 17 Feb 2024 23:58:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708243084; x=1708847884; 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=ABA/+6oxHumH7163VNUvqNT1eTr+ehROcpiaVQm4GRM=; b=CqP9sTZyzryAs7iLXK7/LFAjYkvJflQ058VXI3J9RVoGL2tgn5FxdZY2h1RujvURd3 QCFQSp3WAwrMR2ruEekqHsF22hLM8kZgOcW7bbpyf9ASKOqBJto64EDMWVIKeisbWaLL +EFBuDUk6oPMwHThw0uzjCDhihAuHpyEoc1uHUoyQSTQ/mIbJ/nhegU4ZaY1A2NudSpo ITstTCkYlxo5jK8qk/FvOnlPkgfFFXH9eLit99xnpVZGrFZDD+/EXUHemIFTQ2mHtx4W 5Tn9a+9bIapNll6cOSRFgMHHKvv3Tli9aHymokKqoU+99fPJrzFlD/1CEsAF9feA3fbl X57w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708243084; x=1708847884; 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=ABA/+6oxHumH7163VNUvqNT1eTr+ehROcpiaVQm4GRM=; b=GrQHOY0BCjdq25+V+xTgnWFhAx23Wg3BSB5eJt+bHjr6dH4KS3N1dSPphazuCAQyAn mJ9FE58wkxrvc97nYWM/MyBTCtVccSsdFZS4Y60q3hcxCN9nEgG2PUpdKMZP08VVf1X0 8XqQiPjlI8qp/V0lQDUN3IVjb04qlVBpMTjRt+sRaXdrHaAEjjbfhtjrpvLoqDZzvQ8o Ve5/WEjJR4BRR44nNHi1Y0s2g/C4OCCLDdd618vUbTA05a+eyLUcTA5chFWKNGZrHCRQ vHsybrSREh1ZfDPTu/2izo7XGm/CWM6GeVOMGcs+jQ32FnP6VAiv9HC2guKqNyTtJ5jh B69A== X-Forwarded-Encrypted: i=1; AJvYcCVYmrd9YmIAVeVxAaVayIa6dDWD+ivxuSX6rEzrQSmOTzCvHMaVbazdYXlBqIoaJ4El//QSVht6ZVgN/gOZkM/EatqmagAIZ3pe/YG0JLSRZooJjAGO9S9ivvuRrsX7yDQFlI1M X-Gm-Message-State: AOJu0YwEzs1pqymyrWgkFP9L4OiOrsT9HN+kXrvM/c/Nd+JVM9v3LLdw OMzNhO5F98Vq5Qtbo0/SJ2WWYPzpp7qZMqJTIUS2i0Vs0T9Tc92p X-Google-Smtp-Source: AGHT+IGwNcnr0R5tb8Mt1y0aO3rr6jdQwKrX+eS6QNQEfrKvWFGN1zKKTKMU5cWihtKHla0t9toeGQ== X-Received: by 2002:a17:906:3492:b0:a3e:6d75:61df with SMTP id g18-20020a170906349200b00a3e6d7561dfmr501895ejb.45.1708243083483; Sat, 17 Feb 2024 23:58:03 -0800 (PST) Received: from debian.fritz.box ([93.184.186.109]) by smtp.gmail.com with ESMTPSA id jj12-20020a170907984c00b00a3e64bcd2c1sm458732ejc.142.2024.02.17.23.58.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 23:58:03 -0800 (PST) From: Dimitri Fedrau To: Cc: Dimitri Fedrau , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Stefan Eichenberger , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 net-next 02/14] net: phy: Support 100/1000BT1 linkmode advertisements Date: Sun, 18 Feb 2024 08:57:39 +0100 Message-Id: <20240218075753.18067-3-dima.fedrau@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240218075753.18067-1-dima.fedrau@gmail.com> References: <20240218075753.18067-1-dima.fedrau@gmail.com> 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 Extend helper functions mii_t1_adv_m_mod_linkmode_t and linkmode_adv_to_mii_t1_adv_m_t to support 100BT1 and 1000BT1 linkmode advertisements. Reviewed-by: Andrew Lunn Signed-off-by: Dimitri Fedrau --- include/linux/mdio.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/linux/mdio.h b/include/linux/mdio.h index 79ceee3c8673..ecd21acc7eed 100644 --- a/include/linux/mdio.h +++ b/include/linux/mdio.h @@ -373,6 +373,10 @@ static inline void mii_t1_adv_m_mod_linkmode_t(unsigned long *advertising, u32 l { linkmode_mod_bit(ETHTOOL_LINK_MODE_10baseT1L_Full_BIT, advertising, lpa & MDIO_AN_T1_ADV_M_B10L); + linkmode_mod_bit(ETHTOOL_LINK_MODE_100baseT1_Full_BIT, + advertising, lpa & MDIO_AN_T1_ADV_M_100BT1); + linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseT1_Full_BIT, + advertising, lpa & MDIO_AN_T1_ADV_M_1000BT1); } /** @@ -409,6 +413,10 @@ static inline u32 linkmode_adv_to_mii_t1_adv_m_t(unsigned long *advertising) if (linkmode_test_bit(ETHTOOL_LINK_MODE_10baseT1L_Full_BIT, advertising)) result |= MDIO_AN_T1_ADV_M_B10L; + if (linkmode_test_bit(ETHTOOL_LINK_MODE_100baseT1_Full_BIT, advertising)) + result |= MDIO_AN_T1_ADV_M_100BT1; + if (linkmode_test_bit(ETHTOOL_LINK_MODE_1000baseT1_Full_BIT, advertising)) + result |= MDIO_AN_T1_ADV_M_1000BT1; return result; } From patchwork Sun Feb 18 07:57:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dimitri Fedrau X-Patchwork-Id: 13561728 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.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 6FAA017BD7; Sun, 18 Feb 2024 07:58:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708243090; cv=none; b=upSp/MkrM0YcPlqkzRVu+qV4nRWrTbuU6h9m84lTqppE3/pb7reIaaJ5z8WHv6D4YQ0SH7bxzhz0Xu7zcHKEXa0ycolPdo62CILecRX9Sjocp7T6cC1nCdVp4PRwYbbX1ljSXIvNKZ8wc3pYCsLbV2BT6s8BtBmHyaJsz2itXxk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708243090; c=relaxed/simple; bh=fVx+88lC405JmaqvU4kHNZU3L2yhs/oiP/GJV8DFJuw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=nV6egH/drXybPI6xx1ht19w8D3pJy8SdABqsh1wJxo4vhmnXEp66hK4Y9NJhFS9YKID5risXns1+0RNTejSWZwQq1qTmucBrmWcAVVybBTG7cb9V188mKZ4o26sVQaw5E9KFAxsR3OX++oyRYtTAia+gyUAs/aTiAwyC3VHCzrc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZOIgmlz7; arc=none smtp.client-ip=209.85.208.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZOIgmlz7" Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-563c2b2bddbso4060151a12.1; Sat, 17 Feb 2024 23:58:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708243087; x=1708847887; 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=uoozvBpHXRYWFOVYUVcvnJG+XHdV4MDAR4eyxjGBsXQ=; b=ZOIgmlz780+cdrrNe7kbvweVDYSp6tUK2ohCUoCghW6X598lOCY1Islo6vuKu0lUwb u0/AWfiFTn7EJE2g1kOJ74A5kDVU/WpWPXSKrJ4IWCuBaDFyLN1BJv6EDEt+f4dwKOcK tFoJux+/1bJQ9cuo5RGjyvV6IeMlAOqb6J0l5yOf7DZBQo05yXuF5G3QYzp2G6/fhtFz wcGI4qvieg854cdQVGJ1TYEcEJFPXp2P/hpstXpeWcG7THV/PoJbBUmkwCa6FSu5vP9Z UWG5NTdU7BMDrAZMp4cghj4g50oG2uojYnlHXGFMtCEN2kWfmRokGMriMxg0IYRxfIfq pZhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708243087; x=1708847887; 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=uoozvBpHXRYWFOVYUVcvnJG+XHdV4MDAR4eyxjGBsXQ=; b=Itfmp7GUXdo/Cz76QSF2wIEmBx2J8mvOfprJQcuYKNDWMPoAY8sDghpLBsj7Ax9D1T IYVH9pgRDezujWj9TNAhrqQgO11iVWHqisy0ohTYvxPm/tghlp90+5itMcYsdVQNvdYI d1bA+oVyTJk9BWiU/VppMUL+MWgfd/+ZJw+RwxjosNjimq++HRkClajEeZPrta3KqbfZ o8qAHP/Ay5ewV1MOFYH5jRcyFzZ9a3U5KJ0A7GVcMpQMEZRfq3DwXxGpQ9GzZoaGjUzB tV9A4oXpTWBJAv9QbbpTihS7sBtSXPD+sL40Qm4NkwhsDMll9pw0foAgOjcu8Kc3AKkV heeA== X-Forwarded-Encrypted: i=1; AJvYcCXm0iI2eki/k0VvP+BeYr5eesuEZewL3bYFxtWmZjh1Hz4rluCNobOL8hwa+p1WZM7YwhvRBQ8SmaConX4WKC2Y7s7GhMG1nxu5G7UM0HhQoSMF1XgIBnFe8WRyi23bYAQfhd8Y X-Gm-Message-State: AOJu0YzApirAVCxMEHfxZoPisnK1DUARascP7M6XSr97dlCC/6C1JLYY sq4XKEdFeMUTOP+dH3Ag445gzXDfItvOvkz01D8W1CKNQSghyq+5 X-Google-Smtp-Source: AGHT+IFC+szXzWHSDcsGUuis7Z4UB+aU/EuJR0JOC8IytpPgyl6+trDyieIwKwFyzfY/xl4C7T7jIg== X-Received: by 2002:a17:907:10cf:b0:a3d:8554:44a0 with SMTP id rv15-20020a17090710cf00b00a3d855444a0mr5790488ejb.57.1708243086527; Sat, 17 Feb 2024 23:58:06 -0800 (PST) Received: from debian.fritz.box ([93.184.186.109]) by smtp.gmail.com with ESMTPSA id jj12-20020a170907984c00b00a3e64bcd2c1sm458732ejc.142.2024.02.17.23.58.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 23:58:06 -0800 (PST) From: Dimitri Fedrau To: Cc: Dimitri Fedrau , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Stefan Eichenberger , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 net-next 03/14] net: phy: c45: detect 100/1000BASE-T1 linkmode advertisements Date: Sun, 18 Feb 2024 08:57:40 +0100 Message-Id: <20240218075753.18067-4-dima.fedrau@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240218075753.18067-1-dima.fedrau@gmail.com> References: <20240218075753.18067-1-dima.fedrau@gmail.com> 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 Set 100BT1 and 1000BT1 linkmode advertisement bits to adv_l_mask to enable detection. Reviewed-by: Andrew Lunn Signed-off-by: Dimitri Fedrau --- drivers/net/phy/phy-c45.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/phy-c45.c b/drivers/net/phy/phy-c45.c index 46c87a903efd..b78b6b32d9f9 100644 --- a/drivers/net/phy/phy-c45.c +++ b/drivers/net/phy/phy-c45.c @@ -208,7 +208,8 @@ static int genphy_c45_baset1_an_config_aneg(struct phy_device *phydev) adv_l_mask = MDIO_AN_T1_ADV_L_FORCE_MS | MDIO_AN_T1_ADV_L_PAUSE_CAP | MDIO_AN_T1_ADV_L_PAUSE_ASYM; - adv_m_mask = MDIO_AN_T1_ADV_M_MST | MDIO_AN_T1_ADV_M_B10L; + adv_m_mask = MDIO_AN_T1_ADV_M_1000BT1 | MDIO_AN_T1_ADV_M_100BT1 | + MDIO_AN_T1_ADV_M_MST | MDIO_AN_T1_ADV_M_B10L; switch (phydev->master_slave_set) { case MASTER_SLAVE_CFG_MASTER_FORCE: From patchwork Sun Feb 18 07:57:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dimitri Fedrau X-Patchwork-Id: 13561729 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) (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 58D2B1B944; Sun, 18 Feb 2024 07:58:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708243093; cv=none; b=o9NEkBY69s9Un5DVcEKUoTGRzOQ4xTulZVcHN5ZNW7k1Cmb/L9o+ddi7xMunO1akhAgBaAFdavW/eEQzx3sHRSZXphK2fDOZupOL4Al1G6aYK7iSvv/x5nhCW8Ww2xaqwDN3UU8GefqG6Tkt5utxz5dl86vjNxJd8sRgKJeSjzQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708243093; c=relaxed/simple; bh=P9kbg96h8nA+vzLjsIPg4kILNbxrfwclXgGSuVa0iV8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=e+dOy0DPM6uKv+nT1tawsILJXJhQL1Y9MuJnMxtsuVFUdCWzNKzIiBi2X2WaEsoQkc87N9mMNF6H08B1qSIBEMP/bjQWPhFYkWqG2Q0hRVVQFzceSeSfhfVYMmFg9SHcWmUFdWPt0A3VRaInSIyOIRZqO3YVKb48geEMUwm9JwM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=AvSK+lNC; arc=none smtp.client-ip=209.85.218.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AvSK+lNC" Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-a3d5e77cfbeso568150966b.0; Sat, 17 Feb 2024 23:58:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708243089; x=1708847889; 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=zhWArK/7gr86CDN8jWRWkGtNc20privf2Tsm1Zz0aTk=; b=AvSK+lNCPMCCVT1IYydviXcc7KSFSX8Fab4qPwyqjJqGPIGmlJzGIVDPsyuDKl/et1 z/r1TcGmcnMltN0SBxF7SXdxPCmzBGBkdwDVQUY5uMKR5prcyHaUgiel+Zz9N63ss57x VNCsZ8JN3H7kfy7xoA/rriVcE5KOwcX+im/VlK5w2hOd8E5mEp6eMpWifpOg119w9KzP +l2Y7YTggKxQG6025/+EFt5NwUuvCdzj1d5PxXggXYSsAcKuwdRsittLijU4UslpxPk0 I3FzaNG7isu/i75e+f7kPBiLkD1+uGKbAvVsxaOKpFmY/0+r0od1+uVjx+8OJGJIFCkl PFwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708243089; x=1708847889; 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=zhWArK/7gr86CDN8jWRWkGtNc20privf2Tsm1Zz0aTk=; b=k7piuhXFRFXyUKr1+HPEDKqcruVge5mCq22lQfhoDuvNAxohAG03f7S6bPgXFVr1jl tuKDJ+zX2dtEFvhRisTJ2bZm5iQ++XB4sOrlce9m4aw0LvnrCvgYkzBADh86uzY66A20 F14IiFfKhYf7VKc7GhQOGe7VYDWN/rQ2uvnGgg5AN4Zk3tjSCtj/qTyBAiEEvkiF52fP oKo+PaGHGnD4ZZtNhFgHnwQSYq31CIq+OAH7cb6hE0txZszPNMmIRNMDaYXXvWhGOmMq 8SLqUPKKLG1In2q80hFo8UlGLUbTNbKoQjiK5AVJEEfBr/NFaDlndaS68TWCxDdAmBsi MwuA== X-Forwarded-Encrypted: i=1; AJvYcCXuse1UWE3nJc+F8+CzrN7GSxZxIg+p/vaw3/LptZ3p65te/hlReyMq9bwhV4nMfoFtY70BoXXqcVwqH3cHcAFiulmVXfi4FBRQ+jsL7HG605QTBrO+HljdyYmcPxAl1TaSHr9D X-Gm-Message-State: AOJu0Yz2wEw6T65W9C0qYcNkZB3CSQkDDh6hMxOiRs6rBldMMOU1T1u5 ERvD6Gws5wOTKp3nGLYeq/hXaS/VYmYLy3aqJI0zxNyIDaYtWdzN X-Google-Smtp-Source: AGHT+IFiDEu/otHrEkvC4JbegXwDX5tFC46jhmBrsl4lYMLsqVFq07U3vFqGdj7liKSFqg372Mv3vg== X-Received: by 2002:a17:906:254f:b0:a3e:5d4d:69e8 with SMTP id j15-20020a170906254f00b00a3e5d4d69e8mr997470ejb.10.1708243089606; Sat, 17 Feb 2024 23:58:09 -0800 (PST) Received: from debian.fritz.box ([93.184.186.109]) by smtp.gmail.com with ESMTPSA id jj12-20020a170907984c00b00a3e64bcd2c1sm458732ejc.142.2024.02.17.23.58.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 23:58:09 -0800 (PST) From: Dimitri Fedrau To: Cc: Dimitri Fedrau , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Stefan Eichenberger , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 net-next 04/14] net: phy: marvell-88q2xxx: fix typos Date: Sun, 18 Feb 2024 08:57:41 +0100 Message-Id: <20240218075753.18067-5-dima.fedrau@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240218075753.18067-1-dima.fedrau@gmail.com> References: <20240218075753.18067-1-dima.fedrau@gmail.com> 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 Rename mv88q2xxxx_get_sqi to mv88q2xxx_get_sqi and mv88q2xxxx_get_sqi_max to mv88q2xxx_get_sqi_max. Fix linebreaks and use everywhere hexadecimal numbers written with lowercase letters instead of mixing it up. Reviewed-by: Andrew Lunn Signed-off-by: Dimitri Fedrau --- drivers/net/phy/marvell-88q2xxx.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/drivers/net/phy/marvell-88q2xxx.c b/drivers/net/phy/marvell-88q2xxx.c index 1c3ff77de56b..dcebb4643aff 100644 --- a/drivers/net/phy/marvell-88q2xxx.c +++ b/drivers/net/phy/marvell-88q2xxx.c @@ -14,7 +14,7 @@ #define MDIO_MMD_AN_MV_STAT_MS_CONF_FAULT 0x8000 #define MDIO_MMD_PCS_MV_100BT1_STAT1 33032 -#define MDIO_MMD_PCS_MV_100BT1_STAT1_IDLE_ERROR 0x00FF +#define MDIO_MMD_PCS_MV_100BT1_STAT1_IDLE_ERROR 0x00ff #define MDIO_MMD_PCS_MV_100BT1_STAT1_JABBER 0x0100 #define MDIO_MMD_PCS_MV_100BT1_STAT1_LINK 0x0200 #define MDIO_MMD_PCS_MV_100BT1_STAT1_LOCAL_RX 0x1000 @@ -27,6 +27,8 @@ #define MDIO_MMD_PCS_MV_100BT1_STAT2_LINK 0x0004 #define MDIO_MMD_PCS_MV_100BT1_STAT2_ANGE 0x0008 +#define MDIO_MMD_PCS_MV_RX_STAT 33328 + static int mv88q2xxx_soft_reset(struct phy_device *phydev) { int ret; @@ -63,7 +65,8 @@ static int mv88q2xxx_read_link_gbit(struct phy_device *phydev) * the link was already down. */ if (!phy_polling_mode(phydev) || !phydev->link) { - ret = phy_read_mmd(phydev, MDIO_MMD_PCS, MDIO_PCS_1000BT1_STAT); + ret = phy_read_mmd(phydev, MDIO_MMD_PCS, + MDIO_PCS_1000BT1_STAT); if (ret < 0) return ret; else if (ret & MDIO_PCS_1000BT1_STAT_LINK) @@ -71,7 +74,8 @@ static int mv88q2xxx_read_link_gbit(struct phy_device *phydev) } if (!link) { - ret = phy_read_mmd(phydev, MDIO_MMD_PCS, MDIO_PCS_1000BT1_STAT); + ret = phy_read_mmd(phydev, MDIO_MMD_PCS, + MDIO_PCS_1000BT1_STAT); if (ret < 0) return ret; else if (ret & MDIO_PCS_1000BT1_STAT_LINK) @@ -95,7 +99,8 @@ static int mv88q2xxx_read_link_100m(struct phy_device *phydev) * we always read the realtime status. */ if (!phy_polling_mode(phydev) || !phydev->link) { - ret = phy_read_mmd(phydev, MDIO_MMD_PCS, MDIO_MMD_PCS_MV_100BT1_STAT1); + ret = phy_read_mmd(phydev, MDIO_MMD_PCS, + MDIO_MMD_PCS_MV_100BT1_STAT1); if (ret < 0) return ret; else if (ret & MDIO_MMD_PCS_MV_100BT1_STAT1_LINK) @@ -200,7 +205,7 @@ static int mv88q2xxx_config_init(struct phy_device *phydev) return mv88q2xxx_config_aneg(phydev); } -static int mv88q2xxxx_get_sqi(struct phy_device *phydev) +static int mv88q2xxx_get_sqi(struct phy_device *phydev) { int ret; @@ -208,7 +213,8 @@ static int mv88q2xxxx_get_sqi(struct phy_device *phydev) /* Read the SQI from the vendor specific receiver status * register */ - ret = phy_read_mmd(phydev, MDIO_MMD_PCS, 0x8230); + ret = phy_read_mmd(phydev, MDIO_MMD_PCS, + MDIO_MMD_PCS_MV_RX_STAT); if (ret < 0) return ret; @@ -218,7 +224,7 @@ static int mv88q2xxxx_get_sqi(struct phy_device *phydev) * but can be found in the Software Initialization Guide. Only * revisions >= A0 are supported. */ - ret = phy_modify_mmd(phydev, MDIO_MMD_PCS, 0xFC5D, 0x00FF, 0x00AC); + ret = phy_modify_mmd(phydev, MDIO_MMD_PCS, 0xfc5d, 0xff, 0xac); if (ret < 0) return ret; @@ -227,10 +233,10 @@ static int mv88q2xxxx_get_sqi(struct phy_device *phydev) return ret; } - return ret & 0x0F; + return ret & 0x0f; } -static int mv88q2xxxx_get_sqi_max(struct phy_device *phydev) +static int mv88q2xxx_get_sqi_max(struct phy_device *phydev) { return 15; } @@ -246,8 +252,8 @@ static struct phy_driver mv88q2xxx_driver[] = { .read_status = mv88q2xxx_read_status, .soft_reset = mv88q2xxx_soft_reset, .set_loopback = genphy_c45_loopback, - .get_sqi = mv88q2xxxx_get_sqi, - .get_sqi_max = mv88q2xxxx_get_sqi_max, + .get_sqi = mv88q2xxx_get_sqi, + .get_sqi_max = mv88q2xxx_get_sqi_max, }, }; From patchwork Sun Feb 18 07:57:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dimitri Fedrau X-Patchwork-Id: 13561730 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.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 AD93CEAE4; Sun, 18 Feb 2024 07:58:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708243096; cv=none; b=UPRb95FKOsAfgvrP99d6PpA0W0nvFR8oGZLQFpjtG/C2Aq7ccyW0OrXfbhAb6pYXHjmFZmZ7u7t5aroMBM6c89dj20JH+Uo7V7iN/H3px+IthdJTurHkFCbvvRRNRulPqmISLJNfFBYJe1v8moQdQh/COi1/tKYwnOD/ZG5DlWQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708243096; c=relaxed/simple; bh=FMn1k2LeUHLqPOJ5MrimW8W5ba6/IZNZUrZdnQzwtTM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=IKj6wqYfrtbbLVkRG+vq0O1tr1Nzx3U2LZYrBv0jbOWFZs5uF24AiPIaw3i5IIi5zsAvamYZGGCnkPUrkNp88OLgpQTIq5ep4WoE2hkFyes37WWCFUkW1RlnGZqmEgOQxgfmJ+tCJ1ilArKYxkG1ttsduylm7oBwCnY7WCVg+hQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fWEGKRi1; arc=none smtp.client-ip=209.85.167.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fWEGKRi1" Received: by mail-lf1-f45.google.com with SMTP id 2adb3069b0e04-512b0cfd79dso152310e87.0; Sat, 17 Feb 2024 23:58:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708243093; x=1708847893; 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=U3SacVFogZ0VIPM9NhlkFSdJIVFVokdqjKp32uGKAe8=; b=fWEGKRi1q8OGvHNRqB+kggoRChaOb6zA7/4L4Fc0TyxVMpC1ZD8v2aZeKHNOWHhefO em1Tg3aUqlzp21zB/9qdrh5ZM1gkgE+HKIF1ksEmU2PYGp+ye8WAX8zMcjFzkXlSL3Nx nepo+seJNNU4OLhTHPFzIhjCSd9YtcTdPEA1kh6yFhydT76YYinoNIKju43kq7XUFsQ+ 4UaKSqTxH6F7VyQZx07ql6onoWjuYXULlk1LaswOTGCkXUK7sXm8mqxn0yPLnYy+OSo2 IOpyede2+lYtPLkt8hvmb1ucyDRJkUKpEzRnZMrRSEr2pj17kKUn/PiUSjxDssQW2jdX eO4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708243093; x=1708847893; 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=U3SacVFogZ0VIPM9NhlkFSdJIVFVokdqjKp32uGKAe8=; b=sUm5x/dbJ2N6Ey5CS5gUILOqoU/k0CVoIIv/Xx4QyNClPQrEu5VSgnosq1q5NCADKO x2+NN8mN/ZSYtQ5UdRaD3PxLihn9IPJ2+xxdmNf0mfch/ewGrhjXfLXNCttMAa5w82zi 9hIlfNzFy5QTAo7wBNKWB+l7svWtj+Vj+Pb4HqvT+y3ar7VccMnHkZVTtfebkOrOy4dh QUMmWyR9pYnEYuNx7Fo9tGeLwgy/Ki6B3v2lUSZNNU5P9fTj9kL2PLEsmYsMuh1nRT1d qfhp905WgprHPnlB9sY4W1kM0BO0D+q8UWRcJScN3W/PcH9IGiv4owtb1rXmkWxO6qCN 8BYg== X-Forwarded-Encrypted: i=1; AJvYcCXqqDEk/kOoYM3zARruDfvWkgxScFNWv5CwfxGmzr4RK+8tcgb7P5FRIQr9xzFl3c+9iZtsRaySCoUuhmBOoQa15Wx8hZrTSQ1V2OceUK9oFj/zziucIIpXp3g+mQPjJD8fWanP X-Gm-Message-State: AOJu0YyaXfUZURC87WamU70tIt73NFy4QxEduVfZiYhAyW1K6SrlZQs9 yqsoXySWoh7NJznbY68GT4fWs/Bx5cTukl2JoL+OI36UZeVcxyrI X-Google-Smtp-Source: AGHT+IFT+tP26QEl1DNh6jGTSx0kKYi8WzvR6x28sJ/iDw7W/UG5aH2mamznyqD4a+nm7ryQovBGRA== X-Received: by 2002:a19:7618:0:b0:512:44c9:fb76 with SMTP id c24-20020a197618000000b0051244c9fb76mr5528232lff.22.1708243092792; Sat, 17 Feb 2024 23:58:12 -0800 (PST) Received: from debian.fritz.box ([93.184.186.109]) by smtp.gmail.com with ESMTPSA id jj12-20020a170907984c00b00a3e64bcd2c1sm458732ejc.142.2024.02.17.23.58.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 23:58:12 -0800 (PST) From: Dimitri Fedrau To: Cc: Dimitri Fedrau , Andrew Lunn , Gregor Herburger , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Stefan Eichenberger , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 net-next 05/14] net: phy: marvell-88q2xxx: add driver for the Marvell 88Q2220 PHY Date: Sun, 18 Feb 2024 08:57:42 +0100 Message-Id: <20240218075753.18067-6-dima.fedrau@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240218075753.18067-1-dima.fedrau@gmail.com> References: <20240218075753.18067-1-dima.fedrau@gmail.com> 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 Add a driver for the Marvell 88Q2220. This driver allows to detect the link, switch between 100BASE-T1 and 1000BASE-T1 and switch between master and slave mode. Autonegotiation is supported. Reviewed-by: Andrew Lunn Tested-by: Gregor Herburger Signed-off-by: Dimitri Fedrau --- drivers/net/phy/marvell-88q2xxx.c | 210 +++++++++++++++++++++++++++++- include/linux/marvell_phy.h | 1 + 2 files changed, 205 insertions(+), 6 deletions(-) diff --git a/drivers/net/phy/marvell-88q2xxx.c b/drivers/net/phy/marvell-88q2xxx.c index dcebb4643aff..9829facde253 100644 --- a/drivers/net/phy/marvell-88q2xxx.c +++ b/drivers/net/phy/marvell-88q2xxx.c @@ -1,11 +1,17 @@ // SPDX-License-Identifier: GPL-2.0 /* * Marvell 88Q2XXX automotive 100BASE-T1/1000BASE-T1 PHY driver + * + * Derived from Marvell Q222x API + * + * Copyright (C) 2024 Liebherr-Electronics and Drives GmbH */ #include #include #include +#define PHY_ID_88Q2220_REVB0 (MARVELL_PHY_ID_88Q2220 | 0x1) + #define MDIO_MMD_AN_MV_STAT 32769 #define MDIO_MMD_AN_MV_STAT_ANEG 0x0100 #define MDIO_MMD_AN_MV_STAT_LOCAL_RX 0x1000 @@ -13,6 +19,11 @@ #define MDIO_MMD_AN_MV_STAT_LOCAL_MASTER 0x4000 #define MDIO_MMD_AN_MV_STAT_MS_CONF_FAULT 0x8000 +#define MDIO_MMD_AN_MV_STAT2 32794 +#define MDIO_MMD_AN_MV_STAT2_AN_RESOLVED 0x0800 +#define MDIO_MMD_AN_MV_STAT2_100BT1 0x2000 +#define MDIO_MMD_AN_MV_STAT2_1000BT1 0x4000 + #define MDIO_MMD_PCS_MV_100BT1_STAT1 33032 #define MDIO_MMD_PCS_MV_100BT1_STAT1_IDLE_ERROR 0x00ff #define MDIO_MMD_PCS_MV_100BT1_STAT1_JABBER 0x0100 @@ -29,6 +40,42 @@ #define MDIO_MMD_PCS_MV_RX_STAT 33328 +struct mmd_val { + int devad; + u32 regnum; + u16 val; +}; + +static const struct mmd_val mv88q222x_revb0_init_seq0[] = { + { MDIO_MMD_PCS, 0x8033, 0x6801 }, + { MDIO_MMD_AN, MDIO_AN_T1_CTRL, 0x0 }, + { MDIO_MMD_PMAPMD, MDIO_CTRL1, + MDIO_CTRL1_LPOWER | MDIO_PMA_CTRL1_SPEED1000 }, + { MDIO_MMD_PCS, 0xfe1b, 0x48 }, + { MDIO_MMD_PCS, 0xffe4, 0x6b6 }, + { MDIO_MMD_PMAPMD, MDIO_CTRL1, 0x0 }, + { MDIO_MMD_PCS, MDIO_CTRL1, 0x0 }, +}; + +static const struct mmd_val mv88q222x_revb0_init_seq1[] = { + { MDIO_MMD_PCS, 0xfe79, 0x0 }, + { MDIO_MMD_PCS, 0xfe07, 0x125a }, + { MDIO_MMD_PCS, 0xfe09, 0x1288 }, + { MDIO_MMD_PCS, 0xfe08, 0x2588 }, + { MDIO_MMD_PCS, 0xfe11, 0x1105 }, + { MDIO_MMD_PCS, 0xfe72, 0x042c }, + { MDIO_MMD_PCS, 0xfbba, 0xcb2 }, + { MDIO_MMD_PCS, 0xfbbb, 0xc4a }, + { MDIO_MMD_AN, 0x8032, 0x2020 }, + { MDIO_MMD_AN, 0x8031, 0xa28 }, + { MDIO_MMD_AN, 0x8031, 0xc28 }, + { MDIO_MMD_PCS, 0xffdb, 0xfc10 }, + { MDIO_MMD_PCS, 0xfe1b, 0x58 }, + { MDIO_MMD_PCS, 0xfe79, 0x4 }, + { MDIO_MMD_PCS, 0xfe5f, 0xe8 }, + { MDIO_MMD_PCS, 0xfe05, 0x755c }, +}; + static int mv88q2xxx_soft_reset(struct phy_device *phydev) { int ret; @@ -125,24 +172,90 @@ static int mv88q2xxx_read_link_100m(struct phy_device *phydev) static int mv88q2xxx_read_link(struct phy_device *phydev) { - int ret; - /* The 88Q2XXX PHYs do not have the PMA/PMD status register available, * therefore we need to read the link status from the vendor specific * registers depending on the speed. */ + if (phydev->speed == SPEED_1000) - ret = mv88q2xxx_read_link_gbit(phydev); + return mv88q2xxx_read_link_gbit(phydev); + else if (phydev->speed == SPEED_100) + return mv88q2xxx_read_link_100m(phydev); + + phydev->link = false; + return 0; +} + +static int mv88q2xxx_read_master_slave_state(struct phy_device *phydev) +{ + int ret; + + phydev->master_slave_state = MASTER_SLAVE_STATE_UNKNOWN; + ret = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_MMD_AN_MV_STAT); + if (ret < 0) + return ret; + + if (ret & MDIO_MMD_AN_MV_STAT_LOCAL_MASTER) + phydev->master_slave_state = MASTER_SLAVE_STATE_MASTER; else - ret = mv88q2xxx_read_link_100m(phydev); + phydev->master_slave_state = MASTER_SLAVE_STATE_SLAVE; - return ret; + return 0; +} + +static int mv88q2xxx_read_aneg_speed(struct phy_device *phydev) +{ + int ret; + + phydev->speed = SPEED_UNKNOWN; + ret = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_MMD_AN_MV_STAT2); + if (ret < 0) + return ret; + + if (!(ret & MDIO_MMD_AN_MV_STAT2_AN_RESOLVED)) + return 0; + + if (ret & MDIO_MMD_AN_MV_STAT2_100BT1) + phydev->speed = SPEED_100; + else if (ret & MDIO_MMD_AN_MV_STAT2_1000BT1) + phydev->speed = SPEED_1000; + + return 0; } static int mv88q2xxx_read_status(struct phy_device *phydev) { int ret; + if (phydev->autoneg == AUTONEG_ENABLE) { + /* We have to get the negotiated speed first, otherwise we are + * not able to read the link. + */ + ret = mv88q2xxx_read_aneg_speed(phydev); + if (ret < 0) + return ret; + + ret = mv88q2xxx_read_link(phydev); + if (ret < 0) + return ret; + + ret = genphy_c45_read_lpa(phydev); + if (ret < 0) + return ret; + + ret = genphy_c45_baset1_read_status(phydev); + if (ret < 0) + return ret; + + ret = mv88q2xxx_read_master_slave_state(phydev); + if (ret < 0) + return ret; + + phy_resolve_aneg_linkmode(phydev); + + return 0; + } + ret = mv88q2xxx_read_link(phydev); if (ret < 0) return ret; @@ -171,7 +284,9 @@ static int mv88q2xxx_get_features(struct phy_device *phydev) * sequence provided by Marvell. Disable it for now until a proper * workaround is found or a new PHY revision is released. */ - linkmode_clear_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, phydev->supported); + if (phydev->drv->phy_id == MARVELL_PHY_ID_88Q2110) + linkmode_clear_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, + phydev->supported); return 0; } @@ -241,6 +356,75 @@ static int mv88q2xxx_get_sqi_max(struct phy_device *phydev) return 15; } +static int mv88q222x_soft_reset(struct phy_device *phydev) +{ + int ret; + + /* Enable RESET of DCL */ + if (phydev->autoneg == AUTONEG_ENABLE || phydev->speed == SPEED_1000) { + ret = phy_write_mmd(phydev, MDIO_MMD_PCS, 0xfe1b, 0x48); + if (ret < 0) + return ret; + } + + ret = phy_write_mmd(phydev, MDIO_MMD_PCS, MDIO_PCS_1000BT1_CTRL, + MDIO_PCS_1000BT1_CTRL_RESET); + if (ret < 0) + return ret; + + ret = phy_write_mmd(phydev, MDIO_MMD_PCS, 0xffe4, 0xc); + if (ret < 0) + return ret; + + /* Disable RESET of DCL */ + if (phydev->autoneg == AUTONEG_ENABLE || phydev->speed == SPEED_1000) + return phy_write_mmd(phydev, MDIO_MMD_PCS, 0xfe1b, 0x58); + + return 0; +} + +static int mv88q222x_config_aneg(struct phy_device *phydev) +{ + int ret; + + ret = genphy_c45_config_aneg(phydev); + if (ret) + return ret; + + return mv88q222x_soft_reset(phydev); +} + +static int mv88q222x_revb0_config_init(struct phy_device *phydev) +{ + int ret, i; + + for (i = 0; i < ARRAY_SIZE(mv88q222x_revb0_init_seq0); i++) { + ret = phy_write_mmd(phydev, mv88q222x_revb0_init_seq0[i].devad, + mv88q222x_revb0_init_seq0[i].regnum, + mv88q222x_revb0_init_seq0[i].val); + if (ret < 0) + return ret; + } + + usleep_range(5000, 10000); + + for (i = 0; i < ARRAY_SIZE(mv88q222x_revb0_init_seq1); i++) { + ret = phy_write_mmd(phydev, mv88q222x_revb0_init_seq1[i].devad, + mv88q222x_revb0_init_seq1[i].regnum, + mv88q222x_revb0_init_seq1[i].val); + if (ret < 0) + return ret; + } + + /* The 88Q2XXX PHYs do have the extended ability register available, but + * register MDIO_PMA_EXTABLE where they should signalize it does not + * work according to specification. Therefore, we force it here. + */ + phydev->pma_extable = MDIO_PMA_EXTABLE_BT1; + + return 0; +} + static struct phy_driver mv88q2xxx_driver[] = { { .phy_id = MARVELL_PHY_ID_88Q2110, @@ -255,12 +439,26 @@ static struct phy_driver mv88q2xxx_driver[] = { .get_sqi = mv88q2xxx_get_sqi, .get_sqi_max = mv88q2xxx_get_sqi_max, }, + { + PHY_ID_MATCH_EXACT(PHY_ID_88Q2220_REVB0), + .name = "mv88q2220", + .get_features = mv88q2xxx_get_features, + .config_aneg = mv88q222x_config_aneg, + .aneg_done = genphy_c45_aneg_done, + .config_init = mv88q222x_revb0_config_init, + .read_status = mv88q2xxx_read_status, + .soft_reset = mv88q222x_soft_reset, + .set_loopback = genphy_c45_loopback, + .get_sqi = mv88q2xxx_get_sqi, + .get_sqi_max = mv88q2xxx_get_sqi_max, + }, }; module_phy_driver(mv88q2xxx_driver); static struct mdio_device_id __maybe_unused mv88q2xxx_tbl[] = { { MARVELL_PHY_ID_88Q2110, MARVELL_PHY_ID_MASK }, + { PHY_ID_MATCH_EXACT(PHY_ID_88Q2220_REVB0), }, { /*sentinel*/ } }; MODULE_DEVICE_TABLE(mdio, mv88q2xxx_tbl); diff --git a/include/linux/marvell_phy.h b/include/linux/marvell_phy.h index 9b54c4f0677f..693eba9869e4 100644 --- a/include/linux/marvell_phy.h +++ b/include/linux/marvell_phy.h @@ -26,6 +26,7 @@ #define MARVELL_PHY_ID_88E2110 0x002b09b0 #define MARVELL_PHY_ID_88X2222 0x01410f10 #define MARVELL_PHY_ID_88Q2110 0x002b0980 +#define MARVELL_PHY_ID_88Q2220 0x002b0b20 /* Marvel 88E1111 in Finisar SFP module with modified PHY ID */ #define MARVELL_PHY_ID_88E1111_FINISAR 0x01ff0cc0 From patchwork Sun Feb 18 07:57:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dimitri Fedrau X-Patchwork-Id: 13561731 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) (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 806B61D6AA; Sun, 18 Feb 2024 07:58:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708243099; cv=none; b=c5qHyhqP385oCTUO61mhU7/XZGETWNy6pOVKZoAFkQKg7kUK3D2+XiL6awlKZ/SGTfG8W0Z9AXHYgW721zFdRSRsJ2uY6jgB7ftuBVhhXI+Q8JBHZ1JAYA/em6k4we3/bhIOCA9ZSrGiwocR1zGYJDGKZepi/8GAqSYcE4/F99M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708243099; c=relaxed/simple; bh=APHd53FETp7bMcTra6Q2uekzr3ZPbBpRLKIx89mhIt0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=eZ/e7+Dee9zoNaHk8ZPO5x/hYjMpBOgoL5A2Nb3v1CdBB2nldtytkN73/wRa/AlxseQubBQQC1NDa1ogdkUViSZQoXbPdc7zEv5mSJ0tdC5DC4hkcs5UTwmHOIK/oUZcTKKUugz3IpvYg+bagoPqjn/fNvp1ySwkJHZ7ONoZuxM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=M4PraJEV; arc=none smtp.client-ip=209.85.218.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="M4PraJEV" Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-a3e891b5e4eso464166b.0; Sat, 17 Feb 2024 23:58:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708243096; x=1708847896; 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=YOctRdMaVKvlxxQLiZyj1BX0A6EczB9hIAIpTNelg5c=; b=M4PraJEVWQgyuWlkuy1OQoDmH3owV1mSElK3KLwNNgpUi0HruzXUJpZQb91MhyBQUY bRFUIVSFZvUTZFAY0yKXDD4oZuZNfdSiPJKUA5731AVeXEEIst7e08yPA2Bi0UjShUfX XOaBjNgwJ0+vtKw3cLB00CNLY8LslWsWiB9CoHZD/VIptdqEr3mzcXQXzrSSsbMPVxih itsz5Mfnztw9xIgAnFvqB6kmEpcO2wWXizRS0Y2w90khYwVqAkHqFQFZEwFAgsIkQMD1 xStmL4xbZZdJoBIvSz4zocxmOSgE1c06uP0d8srNsbLIWLjBeLuooFcxzc2FfTrB+Va+ RGEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708243096; x=1708847896; 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=YOctRdMaVKvlxxQLiZyj1BX0A6EczB9hIAIpTNelg5c=; b=EGq4MCzQb7lcHUpnBl1kby/h89V9KOkGNzZ52DvuBUEbWPtplgXDyWwyHKLWWrR0pl 7PviYcXQWHkLd4pY6nwUifCfXXXgRe2VkAq7aihxb4dXMi11hBKFbm4bGCtrg5i+EHom /dSPsmaq/4gk2yjTFrxx4E0DP550e+s7594HrYVyOkezhJPa245LPPuqjAcDhmttv2Tt jDiOxWinI+cxufM+OqJvALV8PZpg4WA1eoMord55vkujkL68jwB77lJYW6oryCnY+Xoe YxKz0+V/JO48OZVl3jTgiu+/yI81zXXsST3nKtlgex4H0dwd/JpwFdYoGa4+eMWJUhtm /6jQ== X-Forwarded-Encrypted: i=1; AJvYcCVD1kEHi8bHkJSRv3RxKtdH3IXqxa7FjkqNpb0Lyr1j70n2Mwyl6mrqrClCn8mTeJobRZtlDABLSRnuDPAW2Jl6U8A/p4Qi3vwmrTusarO8td9J0ITuP4EugEj4jggjKapLZbqc X-Gm-Message-State: AOJu0YwSS/c/Ij3RMZoEJUNFvC7YAu17S6DH4lKlcTmH5r1Gnd8B5dpN oKlMLV5QfyzohlmkOu7KmnQmN4798UqdmGWWIHGWX69VMWwrcm+X X-Google-Smtp-Source: AGHT+IEis5Td4gJlGqzyMPzrBgl03RLfsaeHUTC7vGBI5Adt7nStq6043pikjkxr9EssV3LXjPxuYg== X-Received: by 2002:a17:906:af0f:b0:a3d:dfa:7a92 with SMTP id lx15-20020a170906af0f00b00a3d0dfa7a92mr6592739ejb.36.1708243095819; Sat, 17 Feb 2024 23:58:15 -0800 (PST) Received: from debian.fritz.box ([93.184.186.109]) by smtp.gmail.com with ESMTPSA id jj12-20020a170907984c00b00a3e64bcd2c1sm458732ejc.142.2024.02.17.23.58.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 23:58:15 -0800 (PST) From: Dimitri Fedrau To: Cc: Dimitri Fedrau , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Stefan Eichenberger , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 net-next 06/14] net: phy: marvell-88q2xxx: add interrupt support for link detection Date: Sun, 18 Feb 2024 08:57:43 +0100 Message-Id: <20240218075753.18067-7-dima.fedrau@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240218075753.18067-1-dima.fedrau@gmail.com> References: <20240218075753.18067-1-dima.fedrau@gmail.com> 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 Added .config_intr and .handle_interrupt callbacks. Whenever the link goes up or down an interrupt will be triggered. Interrupts are configured separately for 100/1000BASET1. Reviewed-by: Andrew Lunn Signed-off-by: Dimitri Fedrau --- drivers/net/phy/marvell-88q2xxx.c | 123 +++++++++++++++++++++++++++++- 1 file changed, 119 insertions(+), 4 deletions(-) diff --git a/drivers/net/phy/marvell-88q2xxx.c b/drivers/net/phy/marvell-88q2xxx.c index 9829facde253..7c7517af346b 100644 --- a/drivers/net/phy/marvell-88q2xxx.c +++ b/drivers/net/phy/marvell-88q2xxx.c @@ -24,6 +24,19 @@ #define MDIO_MMD_AN_MV_STAT2_100BT1 0x2000 #define MDIO_MMD_AN_MV_STAT2_1000BT1 0x4000 +#define MDIO_MMD_PCS_MV_INT_EN 32784 +#define MDIO_MMD_PCS_MV_INT_EN_LINK_UP 0x0040 +#define MDIO_MMD_PCS_MV_INT_EN_LINK_DOWN 0x0080 +#define MDIO_MMD_PCS_MV_INT_EN_100BT1 0x1000 + +#define MDIO_MMD_PCS_MV_GPIO_INT_STAT 32785 +#define MDIO_MMD_PCS_MV_GPIO_INT_STAT_LINK_UP 0x0040 +#define MDIO_MMD_PCS_MV_GPIO_INT_STAT_LINK_DOWN 0x0080 +#define MDIO_MMD_PCS_MV_GPIO_INT_STAT_100BT1_GEN 0x1000 + +#define MDIO_MMD_PCS_MV_GPIO_INT_CTRL 32787 +#define MDIO_MMD_PCS_MV_GPIO_INT_CTRL_TRI_DIS 0x0800 + #define MDIO_MMD_PCS_MV_100BT1_STAT1 33032 #define MDIO_MMD_PCS_MV_100BT1_STAT1_IDLE_ERROR 0x00ff #define MDIO_MMD_PCS_MV_100BT1_STAT1_JABBER 0x0100 @@ -38,6 +51,12 @@ #define MDIO_MMD_PCS_MV_100BT1_STAT2_LINK 0x0004 #define MDIO_MMD_PCS_MV_100BT1_STAT2_ANGE 0x0008 +#define MDIO_MMD_PCS_MV_100BT1_INT_EN 33042 +#define MDIO_MMD_PCS_MV_100BT1_INT_EN_LINKEVENT 0x0400 + +#define MDIO_MMD_PCS_MV_COPPER_INT_STAT 33043 +#define MDIO_MMD_PCS_MV_COPPER_INT_STAT_LINKEVENT 0x0400 + #define MDIO_MMD_PCS_MV_RX_STAT 33328 struct mmd_val { @@ -99,13 +118,15 @@ static int mv88q2xxx_read_link_gbit(struct phy_device *phydev) /* Read vendor specific Auto-Negotiation status register to get local * and remote receiver status according to software initialization - * guide. + * guide. However, when not in polling mode the local and remote + * receiver status are not evaluated due to the Marvell 88Q2xxx APIs. */ ret = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_MMD_AN_MV_STAT); if (ret < 0) { return ret; - } else if ((ret & MDIO_MMD_AN_MV_STAT_LOCAL_RX) && - (ret & MDIO_MMD_AN_MV_STAT_REMOTE_RX)) { + } else if (((ret & MDIO_MMD_AN_MV_STAT_LOCAL_RX) && + (ret & MDIO_MMD_AN_MV_STAT_REMOTE_RX)) || + !phy_polling_mode(phydev)) { /* The link state is latched low so that momentary link * drops can be detected. Do not double-read the status * in polling mode to detect such short link drops except @@ -145,7 +166,18 @@ static int mv88q2xxx_read_link_100m(struct phy_device *phydev) * the link was already down. In case we are not polling, * we always read the realtime status. */ - if (!phy_polling_mode(phydev) || !phydev->link) { + if (!phy_polling_mode(phydev)) { + phydev->link = false; + ret = phy_read_mmd(phydev, MDIO_MMD_PCS, + MDIO_MMD_PCS_MV_100BT1_STAT2); + if (ret < 0) + return ret; + + if (ret & MDIO_MMD_PCS_MV_100BT1_STAT2_LINK) + phydev->link = true; + + return 0; + } else if (!phydev->link) { ret = phy_read_mmd(phydev, MDIO_MMD_PCS, MDIO_MMD_PCS_MV_100BT1_STAT1); if (ret < 0) @@ -356,6 +388,79 @@ static int mv88q2xxx_get_sqi_max(struct phy_device *phydev) return 15; } +static int mv88q2xxx_config_intr(struct phy_device *phydev) +{ + int ret; + + if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { + /* Enable interrupts for 1000BASE-T1 link up and down events + * and enable general interrupts for 100BASE-T1. + */ + ret = phy_write_mmd(phydev, MDIO_MMD_PCS, + MDIO_MMD_PCS_MV_INT_EN, + MDIO_MMD_PCS_MV_INT_EN_LINK_UP | + MDIO_MMD_PCS_MV_INT_EN_LINK_DOWN | + MDIO_MMD_PCS_MV_INT_EN_100BT1); + if (ret < 0) + return ret; + + /* Enable interrupts for 100BASE-T1 link events */ + return phy_write_mmd(phydev, MDIO_MMD_PCS, + MDIO_MMD_PCS_MV_100BT1_INT_EN, + MDIO_MMD_PCS_MV_100BT1_INT_EN_LINKEVENT); + } else { + ret = phy_write_mmd(phydev, MDIO_MMD_PCS, + MDIO_MMD_PCS_MV_INT_EN, 0); + if (ret < 0) + return ret; + + return phy_write_mmd(phydev, MDIO_MMD_PCS, + MDIO_MMD_PCS_MV_100BT1_INT_EN, 0); + } +} + +static irqreturn_t mv88q2xxx_handle_interrupt(struct phy_device *phydev) +{ + bool trigger_machine = false; + int irq; + + /* Before we can acknowledge the 100BT1 general interrupt, that is in + * the 1000BT1 interrupt status register, we have to acknowledge any + * interrupts that are related to it. Therefore we read first the 100BT1 + * interrupt status register, followed by reading the 1000BT1 interrupt + * status register. + */ + + irq = phy_read_mmd(phydev, MDIO_MMD_PCS, + MDIO_MMD_PCS_MV_COPPER_INT_STAT); + if (irq < 0) { + phy_error(phydev); + return IRQ_NONE; + } + + /* Check link status for 100BT1 */ + if (irq & MDIO_MMD_PCS_MV_COPPER_INT_STAT_LINKEVENT) + trigger_machine = true; + + irq = phy_read_mmd(phydev, MDIO_MMD_PCS, MDIO_MMD_PCS_MV_GPIO_INT_STAT); + if (irq < 0) { + phy_error(phydev); + return IRQ_NONE; + } + + /* Check link status for 1000BT1 */ + if ((irq & MDIO_MMD_PCS_MV_GPIO_INT_STAT_LINK_UP) || + (irq & MDIO_MMD_PCS_MV_GPIO_INT_STAT_LINK_DOWN)) + trigger_machine = true; + + if (!trigger_machine) + return IRQ_NONE; + + phy_trigger_machine(phydev); + + return IRQ_HANDLED; +} + static int mv88q222x_soft_reset(struct phy_device *phydev) { int ret; @@ -422,6 +527,14 @@ static int mv88q222x_revb0_config_init(struct phy_device *phydev) */ phydev->pma_extable = MDIO_PMA_EXTABLE_BT1; + /* Configure interrupt with default settings, output is driven low for + * active interrupt and high for inactive. + */ + if (phy_interrupt_is_valid(phydev)) + return phy_set_bits_mmd(phydev, MDIO_MMD_PCS, + MDIO_MMD_PCS_MV_GPIO_INT_CTRL, + MDIO_MMD_PCS_MV_GPIO_INT_CTRL_TRI_DIS); + return 0; } @@ -448,6 +561,8 @@ static struct phy_driver mv88q2xxx_driver[] = { .config_init = mv88q222x_revb0_config_init, .read_status = mv88q2xxx_read_status, .soft_reset = mv88q222x_soft_reset, + .config_intr = mv88q2xxx_config_intr, + .handle_interrupt = mv88q2xxx_handle_interrupt, .set_loopback = genphy_c45_loopback, .get_sqi = mv88q2xxx_get_sqi, .get_sqi_max = mv88q2xxx_get_sqi_max, From patchwork Sun Feb 18 07:57:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dimitri Fedrau X-Patchwork-Id: 13561732 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.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 3E829F9F0; Sun, 18 Feb 2024 07:58:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708243102; cv=none; b=TfzoCs8D1HxfXDt5iQtL7dp8+sInSUXtgwIsXx0qZE0+tz58rD8gLu71prO1C2B24uaxjKsoVezFhmV6zkMyyjLsXnX3NCbSoq9zPy7FA240QWO2rnx4VFpO4QE5lIojA9udpY7nmqGFQJFczaCSWWm9T5lUpcER/GD6TA2UXBE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708243102; c=relaxed/simple; bh=gF3/8s9rdHbLqFLOpYOvq2ihfs6x9vepRDOvp4fgqQw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=AWxrtK8q0NUtqSQp4jkQxUgPJw5JfbU76qnt4L8yiX+KnQ+IgTWvWWKQEP490/mAy70nkQy6cNWR6v9wyUmGS9rc0g7g/+v4ZRwrqNkNdAVN1T4YXw3KrKiacPhFmryhwq3ub6h+F3hjvGN8wTSRkGvK35ZACwNxl+pQ6hdnhts= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=UF+J06eR; arc=none smtp.client-ip=209.85.218.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UF+J06eR" Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-a3e706f50beso21174466b.0; Sat, 17 Feb 2024 23:58:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708243098; x=1708847898; 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=zhBVbpbbNuAZsJD1zsfWWGeNA5wuPbJ+/FGELo9o7pw=; b=UF+J06eRuTKEybgI3F7Q6T0axVSufvnzJRa66G4WNugpSHoo+6tT8FAKniDhsMC7Jr MnS3MqrtkAoEmAeCXKFccW7sxSnkbjB6hLWZUTO8B5KqX1qbkI3Hy1kQ32YGIxjIYXow Xmynojjjrbh4hBJGjWshUZ+px7aFlhhKxFMcEFi4pzgvSAXHcGydT4tWZqPujYzAkzr5 ScSbpZ86yNPuI4z3Dm6wKjP3ykMbL9+X2jX3ld0Oo+awtWb2N3OqyPWaYFDHFgCCSakJ svOHM2FE04aZSjq+EAIB75MXtg4Gw1qTbglQbTg3kZnNiPeOUO8oJsAXN3GS33kCEGZj LMgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708243098; x=1708847898; 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=zhBVbpbbNuAZsJD1zsfWWGeNA5wuPbJ+/FGELo9o7pw=; b=ag5tKA7+i0fl2PMkWs9knMwKGPn1HTCRvjc8qB9V0nKobo+Ioxb/wi3AZllTZ3dP99 HWgXoMI9R/61Ll+6Cy9aihs1cdoF5av9WrTS3Lwe3BO5nRZrXEyJhvqApsYAZ2uH94tp VuT7Op1A6knBWjECxhNVxGic7/bTt/Kby3pxLsKrCo2d32ecY/PC6zy3ObstQJmbo6RW izEU97JOHTH0qRt2ztPh/k7H2g2dm0/tENhF+g6ZEG4D95dgqBiHC1kfc7e7IEawfRv8 ye0pWvbcaTRm++xMNjuO/jo5rCdO238gMORtbCa+huYc/cHUkORijj0FPBVhptaHHp/U zPMQ== X-Forwarded-Encrypted: i=1; AJvYcCWLqwBM/UzSinJbgB6nntMu45wsHX8tFks/DjiuP22XMdjO66+eiIBvP/leCXviaJrTMZIy0GyhjSbPpgid9SRwANxWVAgwfJ+UkFRxqGWzpzea2+OReGsEYw9cs8uLOkdzcPJX X-Gm-Message-State: AOJu0Yw3OVlFyu8dGAQgCmWQe2EgEhfn/vEyE7qVGV8QhgDAesGD6Byy iTWne7nqnKoyBbGct70y+UhNsf5yktTNdV1w1fNoIhRzw04g21+A X-Google-Smtp-Source: AGHT+IG3FzcKr25nULijxUuqWGKsk13wSncNCW4A+KbfHbPk6ScXYFTqGgsHTrQrUHFjXkamhq4aLQ== X-Received: by 2002:a17:906:3786:b0:a3e:3bc2:bdf with SMTP id n6-20020a170906378600b00a3e3bc20bdfmr1391538ejc.60.1708243098705; Sat, 17 Feb 2024 23:58:18 -0800 (PST) Received: from debian.fritz.box ([93.184.186.109]) by smtp.gmail.com with ESMTPSA id jj12-20020a170907984c00b00a3e64bcd2c1sm458732ejc.142.2024.02.17.23.58.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 23:58:18 -0800 (PST) From: Dimitri Fedrau To: Cc: Dimitri Fedrau , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Stefan Eichenberger , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 net-next 07/14] net: phy: marvell-88q2xxx: add suspend / resume ops Date: Sun, 18 Feb 2024 08:57:44 +0100 Message-Id: <20240218075753.18067-8-dima.fedrau@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240218075753.18067-1-dima.fedrau@gmail.com> References: <20240218075753.18067-1-dima.fedrau@gmail.com> 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 Add suspend/resume ops for Marvell 88Q2xxx devices. Reviewed-by: Andrew Lunn Signed-off-by: Dimitri Fedrau --- drivers/net/phy/marvell-88q2xxx.c | 34 +++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/drivers/net/phy/marvell-88q2xxx.c b/drivers/net/phy/marvell-88q2xxx.c index 7c7517af346b..8b8275552014 100644 --- a/drivers/net/phy/marvell-88q2xxx.c +++ b/drivers/net/phy/marvell-88q2xxx.c @@ -461,6 +461,38 @@ static irqreturn_t mv88q2xxx_handle_interrupt(struct phy_device *phydev) return IRQ_HANDLED; } +static int mv88q2xxx_suspend(struct phy_device *phydev) +{ + int ret; + + /* Disable PHY interrupts */ + if (phy_interrupt_is_valid(phydev)) { + phydev->interrupts = PHY_INTERRUPT_DISABLED; + ret = mv88q2xxx_config_intr(phydev); + if (ret) + return ret; + } + + return phy_set_bits_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_CTRL1, + MDIO_CTRL1_LPOWER); +} + +static int mv88q2xxx_resume(struct phy_device *phydev) +{ + int ret; + + /* Enable PHY interrupts */ + if (phy_interrupt_is_valid(phydev)) { + phydev->interrupts = PHY_INTERRUPT_ENABLED; + ret = mv88q2xxx_config_intr(phydev); + if (ret) + return ret; + } + + return phy_clear_bits_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_CTRL1, + MDIO_CTRL1_LPOWER); +} + static int mv88q222x_soft_reset(struct phy_device *phydev) { int ret; @@ -566,6 +598,8 @@ static struct phy_driver mv88q2xxx_driver[] = { .set_loopback = genphy_c45_loopback, .get_sqi = mv88q2xxx_get_sqi, .get_sqi_max = mv88q2xxx_get_sqi_max, + .suspend = mv88q2xxx_suspend, + .resume = mv88q2xxx_resume, }, }; From patchwork Sun Feb 18 07:57:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dimitri Fedrau X-Patchwork-Id: 13561733 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44]) (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 A3E4B200AE; Sun, 18 Feb 2024 07:58:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708243105; cv=none; b=BXC/uYA34rkOVgFnrRTJkgRD25rT44yXRl4r/clpy3K69LgmpVkqDSb1aK+pYrjTGd8v+zIBGc1vIHW4Mu7LLnUNSDXaKEhxvUTJ/Gu1X7YCeXrAkF59dk9k+Rb+7AHZP+eHj+AAh3LjVKITF0MXLeHEQe4vreWNs8e7t1Y3w78= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708243105; c=relaxed/simple; bh=LCJqQmp8EvzXP2okag81gJ1d/9Sz9Vw//mEsG+70Wkg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=oZi2uqu9BCXSRGV0R2i9diwgLdBI8AhAPMi31Ru6y9XzUwEAr89N+RmcffbgQApki5NDtIIsFSmSXD6231LOfkKccxuWVKkvivpDh4AZg6TNVfIj0Zzj5dcjdE8O1m1JAkE+POkGnSDPtW3M9vtwIhdQDVOiJKxX2ptxmENJ+z4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Fr50yw7W; arc=none smtp.client-ip=209.85.208.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Fr50yw7W" Received: by mail-ed1-f44.google.com with SMTP id 4fb4d7f45d1cf-5611e54a92dso4451502a12.2; Sat, 17 Feb 2024 23:58:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708243102; x=1708847902; 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=9xvjQdKQSLTDb6d/SX3Ag359hpRipFeHv0DDcAaw9Sg=; b=Fr50yw7WQiMX7LbxO1lRCrnLgEPC60k9tABP6ih8ZM4zSrFirBVVOah2xYMyQz8P7L KjVjILP+PZN21q/azN6ZOccwzNW+bR5HdZIh5kB/BMI6qQN22Jkl5/jqur+Te+bZd75E 4u5rc5DivY8qvgTZMPXlan/Ql/OxrNhoDqXfkUZ85C5PEsSGkpIICxZAEIZy254oZwAM 3UuEKstAWko266bckpvY+cNHQTEMXhLmuAYHcWGbKOSiRe7pnr02Ro3hTp4uGZE+mWWj TPKWP312Wcf3EcRauUcTDgcTAPFelZZ48MiK3AWghG5Dk/6FLM5PMyfuGEq7rE6PQG7t lPbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708243102; x=1708847902; 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=9xvjQdKQSLTDb6d/SX3Ag359hpRipFeHv0DDcAaw9Sg=; b=GBVdW7flRVTO1fzlmNHY8scm+GyiLKrOTWD61TEmOOjWunXoq95kmDHcHLZqOLQ3CI QD5MdFixf3ZR+11TyCLBynFdkXNoVnVgkFv/z+bWhAV7blB6899N/RHgByijd75yLYsE Etgz2mAwooQDx8Qkzly5JHWxAjlBewAt7upsx5t6rsFanEI1bpiynuPt1hDCMiV6HSbz Yk5emFYrgQB8ghbSYFS9gLtM39y+q0Vm9htvof2ouFFJu5yYrczl3YYKMAk38djejwTa O7bygjUOI9UP3geM1Peb6EJz0kg5C8x3fIN5BsNepJfbJNx/87pmqcATTGpYOFko6Y// azLQ== X-Forwarded-Encrypted: i=1; AJvYcCU7bxYg4GDwZP9Xl4rKH9tI9QlORt/1Krd28eYB6aNupPoXxCdMriOVGRGw3owBDCHHtgsMPtReVzecUB7C15jEwZ8LyJDGyFllJCrfdzu3s256mJJEcsQW4EOSVG/IvlKBBVNVvKZPujy3wIzeWam+B2IgDNATQ8BttfHnSGx+ec0= X-Gm-Message-State: AOJu0Ywx2a1+5eNISJ/gbQmQqAzzeei365SzpMB90XSwJgyTh5G65itv NhN6e0oSwZyW4ITBdMldQRTiJGE1qqEyuaRH+L5g14dPX8fd94gZ X-Google-Smtp-Source: AGHT+IHolR8m3UWhhMdTlFrzlT0ejUIXeg/98gHaJ4tjsdt1SS4ZBd1Gwlkku5RG/IPu8WTWL04DuA== X-Received: by 2002:a17:906:35da:b0:a3e:4baa:9ba4 with SMTP id p26-20020a17090635da00b00a3e4baa9ba4mr1239767ejb.58.1708243101828; Sat, 17 Feb 2024 23:58:21 -0800 (PST) Received: from debian.fritz.box ([93.184.186.109]) by smtp.gmail.com with ESMTPSA id jj12-20020a170907984c00b00a3e64bcd2c1sm458732ejc.142.2024.02.17.23.58.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 23:58:21 -0800 (PST) From: Dimitri Fedrau To: Cc: Dimitri Fedrau , Andrew Lunn , Guenter Roeck , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jean Delvare , Stefan Eichenberger , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org Subject: [PATCH v7 net-next 08/14] net: phy: marvell-88q2xxx: add support for temperature sensor Date: Sun, 18 Feb 2024 08:57:45 +0100 Message-Id: <20240218075753.18067-9-dima.fedrau@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240218075753.18067-1-dima.fedrau@gmail.com> References: <20240218075753.18067-1-dima.fedrau@gmail.com> 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 Marvell 88q2xxx devices have an inbuilt temperature sensor. Add hwmon support for this sensor. Reviewed-by: Andrew Lunn Reviewed-by: Guenter Roeck Signed-off-by: Dimitri Fedrau --- drivers/net/phy/Kconfig | 1 + drivers/net/phy/marvell-88q2xxx.c | 146 ++++++++++++++++++++++++++++++ 2 files changed, 147 insertions(+) diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index e261e58bf158..1df0595c5ba9 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig @@ -232,6 +232,7 @@ config MARVELL_10G_PHY config MARVELL_88Q2XXX_PHY tristate "Marvell 88Q2XXX PHY" + depends on HWMON || HWMON=n help Support for the Marvell 88Q2XXX 100/1000BASE-T1 Automotive Ethernet PHYs. diff --git a/drivers/net/phy/marvell-88q2xxx.c b/drivers/net/phy/marvell-88q2xxx.c index 8b8275552014..2ca1b47e8f8f 100644 --- a/drivers/net/phy/marvell-88q2xxx.c +++ b/drivers/net/phy/marvell-88q2xxx.c @@ -9,6 +9,7 @@ #include #include #include +#include #define PHY_ID_88Q2220_REVB0 (MARVELL_PHY_ID_88Q2220 | 0x1) @@ -37,6 +38,18 @@ #define MDIO_MMD_PCS_MV_GPIO_INT_CTRL 32787 #define MDIO_MMD_PCS_MV_GPIO_INT_CTRL_TRI_DIS 0x0800 +#define MDIO_MMD_PCS_MV_TEMP_SENSOR1 32833 +#define MDIO_MMD_PCS_MV_TEMP_SENSOR1_RAW_INT 0x0001 +#define MDIO_MMD_PCS_MV_TEMP_SENSOR1_INT 0x0040 +#define MDIO_MMD_PCS_MV_TEMP_SENSOR1_INT_EN 0x0080 + +#define MDIO_MMD_PCS_MV_TEMP_SENSOR2 32834 +#define MDIO_MMD_PCS_MV_TEMP_SENSOR2_DIS_MASK 0xc000 + +#define MDIO_MMD_PCS_MV_TEMP_SENSOR3 32835 +#define MDIO_MMD_PCS_MV_TEMP_SENSOR3_INT_THRESH_MASK 0xff00 +#define MDIO_MMD_PCS_MV_TEMP_SENSOR3_MASK 0x00ff + #define MDIO_MMD_PCS_MV_100BT1_STAT1 33032 #define MDIO_MMD_PCS_MV_100BT1_STAT1_IDLE_ERROR 0x00ff #define MDIO_MMD_PCS_MV_100BT1_STAT1_JABBER 0x0100 @@ -493,6 +506,138 @@ static int mv88q2xxx_resume(struct phy_device *phydev) MDIO_CTRL1_LPOWER); } +#if IS_ENABLED(CONFIG_HWMON) +static const struct hwmon_channel_info * const mv88q2xxx_hwmon_info[] = { + HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT | HWMON_T_MAX | HWMON_T_ALARM), + NULL +}; + +static umode_t mv88q2xxx_hwmon_is_visible(const void *data, + enum hwmon_sensor_types type, + u32 attr, int channel) +{ + switch (attr) { + case hwmon_temp_input: + return 0444; + case hwmon_temp_max: + return 0644; + case hwmon_temp_alarm: + return 0444; + default: + return 0; + } +} + +static int mv88q2xxx_hwmon_read(struct device *dev, + enum hwmon_sensor_types type, + u32 attr, int channel, long *val) +{ + struct phy_device *phydev = dev_get_drvdata(dev); + int ret; + + switch (attr) { + case hwmon_temp_input: + ret = phy_read_mmd(phydev, MDIO_MMD_PCS, + MDIO_MMD_PCS_MV_TEMP_SENSOR3); + if (ret < 0) + return ret; + + ret = FIELD_GET(MDIO_MMD_PCS_MV_TEMP_SENSOR3_MASK, ret); + *val = (ret - 75) * 1000; + return 0; + case hwmon_temp_max: + ret = phy_read_mmd(phydev, MDIO_MMD_PCS, + MDIO_MMD_PCS_MV_TEMP_SENSOR3); + if (ret < 0) + return ret; + + ret = FIELD_GET(MDIO_MMD_PCS_MV_TEMP_SENSOR3_INT_THRESH_MASK, + ret); + *val = (ret - 75) * 1000; + return 0; + case hwmon_temp_alarm: + ret = phy_read_mmd(phydev, MDIO_MMD_PCS, + MDIO_MMD_PCS_MV_TEMP_SENSOR1); + if (ret < 0) + return ret; + + *val = !!(ret & MDIO_MMD_PCS_MV_TEMP_SENSOR1_RAW_INT); + return 0; + default: + return -EOPNOTSUPP; + } +} + +static int mv88q2xxx_hwmon_write(struct device *dev, + enum hwmon_sensor_types type, u32 attr, + int channel, long val) +{ + struct phy_device *phydev = dev_get_drvdata(dev); + + switch (attr) { + case hwmon_temp_max: + clamp_val(val, -75000, 180000); + val = (val / 1000) + 75; + val = FIELD_PREP(MDIO_MMD_PCS_MV_TEMP_SENSOR3_INT_THRESH_MASK, + val); + return phy_modify_mmd(phydev, MDIO_MMD_PCS, + MDIO_MMD_PCS_MV_TEMP_SENSOR3, + MDIO_MMD_PCS_MV_TEMP_SENSOR3_INT_THRESH_MASK, + val); + default: + return -EOPNOTSUPP; + } +} + +static const struct hwmon_ops mv88q2xxx_hwmon_hwmon_ops = { + .is_visible = mv88q2xxx_hwmon_is_visible, + .read = mv88q2xxx_hwmon_read, + .write = mv88q2xxx_hwmon_write, +}; + +static const struct hwmon_chip_info mv88q2xxx_hwmon_chip_info = { + .ops = &mv88q2xxx_hwmon_hwmon_ops, + .info = mv88q2xxx_hwmon_info, +}; + +static int mv88q2xxx_hwmon_probe(struct phy_device *phydev) +{ + struct device *dev = &phydev->mdio.dev; + struct device *hwmon; + char *hwmon_name; + int ret; + + /* Enable temperature sense */ + ret = phy_modify_mmd(phydev, MDIO_MMD_PCS, MDIO_MMD_PCS_MV_TEMP_SENSOR2, + MDIO_MMD_PCS_MV_TEMP_SENSOR2_DIS_MASK, 0); + if (ret < 0) + return ret; + + hwmon_name = devm_hwmon_sanitize_name(dev, dev_name(dev)); + if (IS_ERR(hwmon_name)) + return PTR_ERR(hwmon_name); + + hwmon = devm_hwmon_device_register_with_info(dev, + hwmon_name, + phydev, + &mv88q2xxx_hwmon_chip_info, + NULL); + + return PTR_ERR_OR_ZERO(hwmon); +} + +#else +static int mv88q2xxx_hwmon_probe(struct phy_device *phydev) +{ + return 0; +} +#endif + +static int mv88q2xxx_probe(struct phy_device *phydev) +{ + return mv88q2xxx_hwmon_probe(phydev); +} + static int mv88q222x_soft_reset(struct phy_device *phydev) { int ret; @@ -587,6 +732,7 @@ static struct phy_driver mv88q2xxx_driver[] = { { PHY_ID_MATCH_EXACT(PHY_ID_88Q2220_REVB0), .name = "mv88q2220", + .probe = mv88q2xxx_probe, .get_features = mv88q2xxx_get_features, .config_aneg = mv88q222x_config_aneg, .aneg_done = genphy_c45_aneg_done, From patchwork Sun Feb 18 07:57:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dimitri Fedrau X-Patchwork-Id: 13561734 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) (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 89CDE20316; Sun, 18 Feb 2024 07:58:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708243108; cv=none; b=YKbfy/lPCjiv3N8GF8LjUop7JD9ybvFyadpxQ1LFRKXBAfYfAU3j3JGSIH+7KmtO6bS85VmLkyeGxHetALiTSATcmf24sQWVLJhx/CaxfGIST5akp2q1DxDG6RQvoAIq/c2M33gGt81whwcEuN23W1/jUJZGOsY4PK/iUb/+QNY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708243108; c=relaxed/simple; bh=UedqRELMO7e8o7c66PHVA/kd0dvR8BduXQgVhk7eUpg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=eKMqRpWajSEH1vIwYKcdIx88V/QDZJ8odZbSLcu2rce0jBUEk1IGi93kzw3dkwYmGAB/+RoLmItvAQXBwAhVhyVZ0kQ8MWD3Gmdlmivnxw0zLC5eZY2h2SCVW92mH7mHQxnj/crYkz5DGRZQyyjNaad1TxulhbhEWTLZ7lJ4Hak= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZDdX/nla; arc=none smtp.client-ip=209.85.218.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZDdX/nla" Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-a2a17f3217aso432182766b.2; Sat, 17 Feb 2024 23:58:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708243105; x=1708847905; 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=uJGv4BnTeZKfUPwk1e7iNloffsoJmrlyLh8bOyrQHPY=; b=ZDdX/nla1gOr7q7eW1D3nlmLBtjtucskP96ilgLSUqGVTKOg5q2QgCVAJdsJhIUQbn NUiHUFOFTA9qdd2mnQtzsLzY0F8sfaKHZ3mHt16v3qAwVr5XvBgUvKdAUB7sjuB6P2jh wKmWxYVlSOHWRs16e8nNzkAw2Tp5XOpGFM09VO5ANHn72GH440ZTXOP3tmVCvB6Tl0h1 lZWtwmRa9BuZFwpEEPDS9N/i8K32ownEIHA6kf09AK0d90cjwRgZ2y3zgst6n/4l0INq jMq2Ya30qylsVeVvzRoThRc3C8vvBhDNd2cU7oQ/3nJu7UBEA9DCTJ+Lfq5NDbV73+WF GmVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708243105; x=1708847905; 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=uJGv4BnTeZKfUPwk1e7iNloffsoJmrlyLh8bOyrQHPY=; b=SY00o4kzFj8ASu1EAViQ2A77kspll8SbsiqbBkEdj+9pzDnedaWKjdpdV3UkU+oH67 cF/WBtvtnb502a9fv4JnEuqoDM8rIOJvUrJrqXooVCGqU9jMMiN+zpHgiAnfVw4UJfwI F9sMc9NYafJFYOR+7qukLXFimnQEdkDdkTMUH4hba+sX1WTexyQ+fJoKqnHOcuOH1zzb u/YQSosRezYQMpUBB0RDvWqmxcXklgngaxYD+/TtPBys2m/FqA7P8qrOhHPf3pW9ajNc n6StmvlA5UprJP0LMChlULOkh7Wr794p5iRnGxAdj/ST6KdODurlIUjSGoUM8IwsswPR 6S6g== X-Forwarded-Encrypted: i=1; AJvYcCXWJ4WtcZZkuqJ05/kGX59+gNaJHgyIjiUAJHQ4FJPLGsViqCh+pNYs3XgXSxFd0P+8A57oZObcjUsVZg2qw4zO+v3NuTrcTnzmW1GMGd+d9eAVnd7UqyMZq+Ii27YZznt4/4Cn X-Gm-Message-State: AOJu0Yxr9dfzW64rzBs/plIp4JrFdIhEWk6LqGRF99Z71wOjR6WurbYR xgAdBW/32vhLVhXYT8NNXe/5k/InvQz7ms9UjVTZ/RO0/u0z4skL X-Google-Smtp-Source: AGHT+IFJnZYjiv6Rl7dgXluxt1+cAqLscj82FxxRFywoVAhkRGJsCE+5RlkFAbf9TFw1Sq4P1sTtYA== X-Received: by 2002:a17:906:278c:b0:a3e:5993:96e9 with SMTP id j12-20020a170906278c00b00a3e599396e9mr886455ejc.42.1708243104817; Sat, 17 Feb 2024 23:58:24 -0800 (PST) Received: from debian.fritz.box ([93.184.186.109]) by smtp.gmail.com with ESMTPSA id jj12-20020a170907984c00b00a3e64bcd2c1sm458732ejc.142.2024.02.17.23.58.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 23:58:24 -0800 (PST) From: Dimitri Fedrau To: Cc: Dimitri Fedrau , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Stefan Eichenberger , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 net-next 09/14] net: phy: marvell-88q2xxx: add cable test support Date: Sun, 18 Feb 2024 08:57:46 +0100 Message-Id: <20240218075753.18067-10-dima.fedrau@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240218075753.18067-1-dima.fedrau@gmail.com> References: <20240218075753.18067-1-dima.fedrau@gmail.com> 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 Add cable test support for Marvell 88Q222x devices. Reported distance granularity is 1m. 1m cable, open: Cable test started for device eth0. Cable test completed for device eth0. Pair A code Open Circuit Pair A, fault length: 1.00m 1m cable, shorted: Cable test started for device eth0. Cable test completed for device eth0. Pair A code Short within Pair Pair A, fault length: 1.00m 6m cable, open: Cable test started for device eth0. Cable test completed for device eth0. Pair A code Open Circuit Pair A, fault length: 6.00m 6m cable, shorted: Cable test started for device eth0. Cable test completed for device eth0. Pair A code Short within Pair Pair A, fault length: 6.00m Signed-off-by: Dimitri Fedrau Reviewed-by: Andrew Lunn --- drivers/net/phy/marvell-88q2xxx.c | 107 ++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) diff --git a/drivers/net/phy/marvell-88q2xxx.c b/drivers/net/phy/marvell-88q2xxx.c index 2ca1b47e8f8f..11963d8176b2 100644 --- a/drivers/net/phy/marvell-88q2xxx.c +++ b/drivers/net/phy/marvell-88q2xxx.c @@ -72,6 +72,27 @@ #define MDIO_MMD_PCS_MV_RX_STAT 33328 +#define MDIO_MMD_PCS_MV_TDR_RESET 65226 +#define MDIO_MMD_PCS_MV_TDR_RESET_TDR_RST 0x1000 + +#define MDIO_MMD_PCS_MV_TDR_OFF_SHORT_CABLE 65241 + +#define MDIO_MMD_PCS_MV_TDR_OFF_LONG_CABLE 65242 + +#define MDIO_MMD_PCS_MV_TDR_STATUS 65245 +#define MDIO_MMD_PCS_MV_TDR_STATUS_MASK 0x0003 +#define MDIO_MMD_PCS_MV_TDR_STATUS_OFF 0x0001 +#define MDIO_MMD_PCS_MV_TDR_STATUS_ON 0x0002 +#define MDIO_MMD_PCS_MV_TDR_STATUS_DIST_MASK 0xff00 +#define MDIO_MMD_PCS_MV_TDR_STATUS_VCT_STAT_MASK 0x00f0 +#define MDIO_MMD_PCS_MV_TDR_STATUS_VCT_STAT_SHORT 0x0030 +#define MDIO_MMD_PCS_MV_TDR_STATUS_VCT_STAT_OPEN 0x00e0 +#define MDIO_MMD_PCS_MV_TDR_STATUS_VCT_STAT_OK 0x0070 +#define MDIO_MMD_PCS_MV_TDR_STATUS_VCT_STAT_IN_PROGR 0x0080 +#define MDIO_MMD_PCS_MV_TDR_STATUS_VCT_STAT_NOISE 0x0050 + +#define MDIO_MMD_PCS_MV_TDR_OFF_CUTOFF 65246 + struct mmd_val { int devad; u32 regnum; @@ -715,6 +736,89 @@ static int mv88q222x_revb0_config_init(struct phy_device *phydev) return 0; } +static int mv88q222x_cable_test_start(struct phy_device *phydev) +{ + int ret; + + ret = phy_write_mmd(phydev, MDIO_MMD_PCS, + MDIO_MMD_PCS_MV_TDR_OFF_CUTOFF, 0x0058); + if (ret < 0) + return ret; + + ret = phy_write_mmd(phydev, MDIO_MMD_PCS, + MDIO_MMD_PCS_MV_TDR_OFF_LONG_CABLE, 0x00eb); + if (ret < 0) + return ret; + + ret = phy_write_mmd(phydev, MDIO_MMD_PCS, + MDIO_MMD_PCS_MV_TDR_OFF_SHORT_CABLE, 0x010e); + if (ret < 0) + return ret; + + ret = phy_write_mmd(phydev, MDIO_MMD_PCS, MDIO_MMD_PCS_MV_TDR_RESET, + 0x0d90); + if (ret < 0) + return ret; + + ret = phy_write_mmd(phydev, MDIO_MMD_PCS, MDIO_MMD_PCS_MV_TDR_STATUS, + MDIO_MMD_PCS_MV_TDR_STATUS_ON); + if (ret < 0) + return ret; + + /* According to the Marvell API the test is finished within 500 ms */ + msleep(500); + + return 0; +} + +static int mv88q222x_cable_test_get_status(struct phy_device *phydev, + bool *finished) +{ + int ret, status; + u32 dist; + + status = phy_read_mmd(phydev, MDIO_MMD_PCS, MDIO_MMD_PCS_MV_TDR_STATUS); + if (status < 0) + return status; + + ret = phy_write_mmd(phydev, MDIO_MMD_PCS, MDIO_MMD_PCS_MV_TDR_RESET, + MDIO_MMD_PCS_MV_TDR_RESET_TDR_RST | 0xd90); + if (ret < 0) + return ret; + + /* Test could not be finished */ + if (FIELD_GET(MDIO_MMD_PCS_MV_TDR_STATUS_MASK, status) != + MDIO_MMD_PCS_MV_TDR_STATUS_OFF) + return -ETIMEDOUT; + + *finished = true; + /* Fault length reported in meters, convert to centimeters */ + dist = FIELD_GET(MDIO_MMD_PCS_MV_TDR_STATUS_DIST_MASK, status) * 100; + switch (status & MDIO_MMD_PCS_MV_TDR_STATUS_VCT_STAT_MASK) { + case MDIO_MMD_PCS_MV_TDR_STATUS_VCT_STAT_OPEN: + ethnl_cable_test_result(phydev, ETHTOOL_A_CABLE_PAIR_A, + ETHTOOL_A_CABLE_RESULT_CODE_OPEN); + ethnl_cable_test_fault_length(phydev, ETHTOOL_A_CABLE_PAIR_A, + dist); + break; + case MDIO_MMD_PCS_MV_TDR_STATUS_VCT_STAT_SHORT: + ethnl_cable_test_result(phydev, ETHTOOL_A_CABLE_PAIR_A, + ETHTOOL_A_CABLE_RESULT_CODE_SAME_SHORT); + ethnl_cable_test_fault_length(phydev, ETHTOOL_A_CABLE_PAIR_A, + dist); + break; + case MDIO_MMD_PCS_MV_TDR_STATUS_VCT_STAT_OK: + ethnl_cable_test_result(phydev, ETHTOOL_A_CABLE_PAIR_A, + ETHTOOL_A_CABLE_RESULT_CODE_OK); + break; + default: + ethnl_cable_test_result(phydev, ETHTOOL_A_CABLE_PAIR_A, + ETHTOOL_A_CABLE_RESULT_CODE_UNSPEC); + } + + return 0; +} + static struct phy_driver mv88q2xxx_driver[] = { { .phy_id = MARVELL_PHY_ID_88Q2110, @@ -732,6 +836,7 @@ static struct phy_driver mv88q2xxx_driver[] = { { PHY_ID_MATCH_EXACT(PHY_ID_88Q2220_REVB0), .name = "mv88q2220", + .flags = PHY_POLL_CABLE_TEST, .probe = mv88q2xxx_probe, .get_features = mv88q2xxx_get_features, .config_aneg = mv88q222x_config_aneg, @@ -742,6 +847,8 @@ static struct phy_driver mv88q2xxx_driver[] = { .config_intr = mv88q2xxx_config_intr, .handle_interrupt = mv88q2xxx_handle_interrupt, .set_loopback = genphy_c45_loopback, + .cable_test_start = mv88q222x_cable_test_start, + .cable_test_get_status = mv88q222x_cable_test_get_status, .get_sqi = mv88q2xxx_get_sqi, .get_sqi_max = mv88q2xxx_get_sqi_max, .suspend = mv88q2xxx_suspend, From patchwork Sun Feb 18 07:57:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dimitri Fedrau X-Patchwork-Id: 13561735 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.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 7E4B8208D0; Sun, 18 Feb 2024 07:58:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708243111; cv=none; b=MGqxDeiAzxJ1UzaiYHnTQB0fp6I11zXWFAiCxaqPAZ2napyNACBk94znXNb53CJv3v5bv350Zug3sDSlu6ZHo1lyXWdw2tysL04dU/Ba5IadjOXDd+ZlX5p4Aiq39ZHz1QtJLmjXM/2LtwcGo+saarVKw4qUy95kJmf7qxnm6ts= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708243111; c=relaxed/simple; bh=Ea8NaLNPADv8VDfh1Pb1Oe5BoRkPPa8AC3idJobKRtQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Cc9GMp+qlFCZtdudeUGCRatWv5XW9pdIueBCeFsD9jmEEYRmea8+ZgNQTQf+YC0dYOJdL9sFcH1/FOArpiqb2neVJohqFJpUUn+RklZbun4G562RfkzLuTM/TOiYGZDhSPRCj1CSqmFzffWWIf/6PFPyGfWA0sJ92kAF1ftHS/4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=eqB0L/Ya; arc=none smtp.client-ip=209.85.218.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eqB0L/Ya" Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-a3d5e77cfbeso568172966b.0; Sat, 17 Feb 2024 23:58:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708243108; x=1708847908; 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=f/4bsnOcKwys+eKmRevLvzH/QB06cYALB/4EeQcmFfM=; b=eqB0L/YaBGa/DlrpZ8n9iPZ555H8l+nxpDfO+IoRAaNPSfhk3Gh3LSC0fw3FjnTOCP p+yJ/MokUY/ttdaqPNOIAwYG24jDxfMNnf0F/6o59d+KVr5yxB7ScGk8iQVjom+pHwJb ZQ2Qb6XBkXnuRRuExyyEqH7yEwdO8a5DBil2C8QhNAhxg5dKZ3vNK2ublMGyxPCpSua/ y6gdCSdqYMVmGo7vh6eiDvTGYGpc6XtQWRgN9Jr1M5E+evbomk/5ntjAeeFCuMjJkqao 9ilVF0XJZb03gerYHe80WvY3HtjNsLRX02wiKLbkYVYfWf0EuLS0so57UlLuqgrHS9QA aiOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708243108; x=1708847908; 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=f/4bsnOcKwys+eKmRevLvzH/QB06cYALB/4EeQcmFfM=; b=byNloUebBRp7rnRELAYav6xUmtuG6wqwrKxZsbL2ALMgsX0qeoMU/2+VkBep3/xb/8 UsvqyAC5cuzafWKOYBZH/u8mXFXvFgUSBzfYjtSzgR7SbmDDz8FSqg4n7woH0Rtui3ib /twF2vCVG8Ie1dlSXYM8x7TK//SDxd23NCsbDI4+Xstnqx1K+MvSa1JfyNOyt5nrDDh1 DW/9JjI/YFzEKuUVZS8P5nV0xU+rVlB3yT79hlKF5miSwDqTPWPV9Ftss2bWgYrFYYkS kTjEPHRJt05cQJjtYLjTbQPX57vnkjXgxKdEEp8Sx41rs90/lMY2/O/HQqVhPjzY7rCj GMdA== X-Forwarded-Encrypted: i=1; AJvYcCU/hJ9MxyZbGayVtwXOaHwVKQQaWLDFjXTvyeFzHU4hIhly9j7aXp6I4ssYgirmfX/Onfn6lQW1yVvsw71ZtL6ShmrGkLmaVpfdXW6evSJh2B+ai9N1scG/mEulEjCtu0nzG04S X-Gm-Message-State: AOJu0YxF7dyklBK5AqqHriu5Xk6pQqjkhkzyh1klFPDASW7qNPO/D3f2 28c/H43f3cLkpqQl8/0JKhnOFMUFXEyMgmVh1zclD0iz1oH/Euue X-Google-Smtp-Source: AGHT+IEhic+8p36UjietPwnv//K85VOuBnyx24EoelwCnpUfQ9hLeDwPNeoo1jqH64Cc/ZKRJtkPyw== X-Received: by 2002:a17:906:fe03:b0:a3e:7a8e:ad5c with SMTP id wy3-20020a170906fe0300b00a3e7a8ead5cmr435041ejb.36.1708243107815; Sat, 17 Feb 2024 23:58:27 -0800 (PST) Received: from debian.fritz.box ([93.184.186.109]) by smtp.gmail.com with ESMTPSA id jj12-20020a170907984c00b00a3e64bcd2c1sm458732ejc.142.2024.02.17.23.58.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 23:58:27 -0800 (PST) From: Dimitri Fedrau To: Cc: Dimitri Fedrau , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Stefan Eichenberger , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 net-next 10/14] net: phy: marvell-88q2xxx: make mv88q2xxx_config_aneg generic Date: Sun, 18 Feb 2024 08:57:47 +0100 Message-Id: <20240218075753.18067-11-dima.fedrau@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240218075753.18067-1-dima.fedrau@gmail.com> References: <20240218075753.18067-1-dima.fedrau@gmail.com> 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 Marvell 88Q2xxx devices follow the same scheme, after configuration they need a soft reset. Soft resets differ between devices, so we use the .soft_reset callback instead of creating .config_aneg callbacks for each device. Reviewed-by: Andrew Lunn Signed-off-by: Dimitri Fedrau --- drivers/net/phy/marvell-88q2xxx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/phy/marvell-88q2xxx.c b/drivers/net/phy/marvell-88q2xxx.c index 11963d8176b2..5bc36cc68a20 100644 --- a/drivers/net/phy/marvell-88q2xxx.c +++ b/drivers/net/phy/marvell-88q2xxx.c @@ -365,7 +365,7 @@ static int mv88q2xxx_config_aneg(struct phy_device *phydev) if (ret) return ret; - return mv88q2xxx_soft_reset(phydev); + return phydev->drv->soft_reset(phydev); } static int mv88q2xxx_config_init(struct phy_device *phydev) From patchwork Sun Feb 18 07:57:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dimitri Fedrau X-Patchwork-Id: 13561736 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) (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 5C21D20DC8; Sun, 18 Feb 2024 07:58:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708243113; cv=none; b=Dq1+hf+W8jmzZmEO18PVfeXnoRqu1vuW0RjhkZiGknMMqthvnXl327olKi68FSDDoIhw/dmycJhEhQW9o14NzTpqrTep1NPxkewOWTt/lM87fLhVrPquZMszWUV/gV1FBi06xTlJ+MuXvZG4iq+A5T8CtVr4dcaiQLuTazAMh48= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708243113; c=relaxed/simple; bh=er7cV2uMtVycRBt3k8jVuTVk0/xvZNwEgT5wOaSLlUE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=oO8Ng1tsLhGhTIKSWDAq485i9dULGHUv0Lxw5cFf8tmqjsNNDJt/Snvcr41NhFyrlyzBzojcXdctd+Eag8CjsjAYLwkGdGsJ6OSQpcOsvy6idSFZKQCMjHxpJoVV8pVlHnKnvhRBIzHKY3QXijQnmuRlZ37Jjk9qytvdRMWYpu0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=PUQuIH1M; arc=none smtp.client-ip=209.85.218.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PUQuIH1M" Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-a3cc2f9621aso327298466b.1; Sat, 17 Feb 2024 23:58:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708243111; x=1708847911; 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=+KV06U1xQkJ+t8rNMhzXp7fjnC3kSl2GuC4K8HSKdH4=; b=PUQuIH1MbG9piTV/YOty1WKesyGgsaSTowEHHYnhgDo50Tz2+lMD6j36BjpwwUso+L y1ow7T8BOSJBIcWSnRSaGHDiuktKtfL5mK+5UKvUEAXdnKBO2xpSJlAKG84Rg433rBAI Gq7kDXUflDGnGkJCBsWr031q0U+JVM2RpwjJvdFhWWB5SW/jjoHhAESC6VdYjBETFy9u DoBJq+b9MWIciFw0tS5Aw9mZE3/vf0nu4RjI+8UnK/sUZSeeBy+qJ4963AnaAs+N8hw1 9NjDRvztYDkPunElswLC7Hgzui26TPqRWbmvt47Z2ZYIrioN7WOIUT3lAcFxAzLNdMgU 3jTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708243111; x=1708847911; 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=+KV06U1xQkJ+t8rNMhzXp7fjnC3kSl2GuC4K8HSKdH4=; b=vo0qAiaLudG/imDAgMEJ9hbSoZw14oKY1PV7t8QJlK+gOsZbYaM2Y8gfFu5gYU1Syu 342kKyN6Zm4MYgjeh/L5PVt1K/kyQFwQ4u0SYdZxHtIPyTV76DdmIOutUixHmwsAFdaN Hf1tx4GxuYJAbgGdYE4UXXACkPtkZtbO7IFxYq8aRPRCDwKBzdH/MzNG0iZtizbP277z 4IU471VcVgG1/YJBOpMslXESgPgp3j52umuUCwJFi0j9OCGY8rSD8nSvPkItGGcdv/18 K7qLH9f7tBZV09wRqNLFhMYSc8XUlPjJaD4SRPyVQyWS2CIcr9ON/tR5+cAgL7xqKCVS DdLg== X-Forwarded-Encrypted: i=1; AJvYcCVpSfFuxRFqmpm38Keinhngb90tiP7TwezGSqBJ2wNsBeVq1Q6ofuowt3GCAyobkH1P55+jcJY5LbHTfTuBDYEaQXY1IGBw8maJ4WYPoJ5aL4wYqNXkktG82+hH8fnvEi0xQrsY X-Gm-Message-State: AOJu0YxxE0dEFKeG01ssf/Ehbkh/AibUWqO8rEqZ55832b0kYmAz3GpN cI4nx/4vqq3OX9uOILxmQ1uZcsUx01u1nwt7swd31T3BSMCfqonM X-Google-Smtp-Source: AGHT+IG8iMGlxN5K5TYJNC2CsuGgQE8Au70cfbZEx609kRZkjSrjlcRj6qsJK9aUk45M7W+ivsljeA== X-Received: by 2002:a17:906:a1cd:b0:a3d:14e0:9608 with SMTP id bx13-20020a170906a1cd00b00a3d14e09608mr4792129ejb.39.1708243110830; Sat, 17 Feb 2024 23:58:30 -0800 (PST) Received: from debian.fritz.box ([93.184.186.109]) by smtp.gmail.com with ESMTPSA id jj12-20020a170907984c00b00a3e64bcd2c1sm458732ejc.142.2024.02.17.23.58.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 23:58:30 -0800 (PST) From: Dimitri Fedrau To: Cc: Dimitri Fedrau , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Stefan Eichenberger , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 net-next 11/14] net: phy: marvell-88q2xxx: switch to mv88q2xxx_config_aneg Date: Sun, 18 Feb 2024 08:57:48 +0100 Message-Id: <20240218075753.18067-12-dima.fedrau@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240218075753.18067-1-dima.fedrau@gmail.com> References: <20240218075753.18067-1-dima.fedrau@gmail.com> 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 Switch to mv88q2xxx_config_aneg for Marvell 88Q2220 devices and remove the mv88q222x_config_aneg function which is basically a copy of the mv88q2xxx_config_aneg function. Reviewed-by: Andrew Lunn Signed-off-by: Dimitri Fedrau --- drivers/net/phy/marvell-88q2xxx.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/net/phy/marvell-88q2xxx.c b/drivers/net/phy/marvell-88q2xxx.c index 5bc36cc68a20..58aa10d35731 100644 --- a/drivers/net/phy/marvell-88q2xxx.c +++ b/drivers/net/phy/marvell-88q2xxx.c @@ -686,17 +686,6 @@ static int mv88q222x_soft_reset(struct phy_device *phydev) return 0; } -static int mv88q222x_config_aneg(struct phy_device *phydev) -{ - int ret; - - ret = genphy_c45_config_aneg(phydev); - if (ret) - return ret; - - return mv88q222x_soft_reset(phydev); -} - static int mv88q222x_revb0_config_init(struct phy_device *phydev) { int ret, i; @@ -839,7 +828,7 @@ static struct phy_driver mv88q2xxx_driver[] = { .flags = PHY_POLL_CABLE_TEST, .probe = mv88q2xxx_probe, .get_features = mv88q2xxx_get_features, - .config_aneg = mv88q222x_config_aneg, + .config_aneg = mv88q2xxx_config_aneg, .aneg_done = genphy_c45_aneg_done, .config_init = mv88q222x_revb0_config_init, .read_status = mv88q2xxx_read_status, From patchwork Sun Feb 18 07:57:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dimitri Fedrau X-Patchwork-Id: 13561737 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.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 64F42210F9; Sun, 18 Feb 2024 07:58:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708243117; cv=none; b=rTmhSpYGhNby8egkG9yNkQ5xFgRPg3swHkICOzXB/hd0NAQO7T2J0hMWINYYqhtTk4YET7snvSbb9jhTajpzoiKsYYYiwE4omSH0ejwfC8uEQSPIqCI2KfnRkwPKsgQGmoJrNgNhCpC9COU3+JAHp6FDq7+b4HzVtKf6cTXiWQI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708243117; c=relaxed/simple; bh=qtqYlODExvRuMNQTFEJhebFMDpvaefrby/rQ80F2z7A=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=RgVkFvPw6Wo07CA8zAdpyZhfAFGQV1RjqejtJinXREhYfScBYbg+yCQCGh0U3tr9o5z57TlIGdzldeZd2EuSERSlt3n8GkUzP1updEBXCnDW3KPLGEn9Pswo9hhSEZ/oEA2bI0HaL7Hood2iIgijxVws1jpERKczEg/LEAzYMsQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=RepRNznH; arc=none smtp.client-ip=209.85.218.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RepRNznH" Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-a293f2280c7so466331666b.1; Sat, 17 Feb 2024 23:58:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708243114; x=1708847914; 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=4oGxiX3DP59U1b6opp4bM7FWUx7s6k2h0K8Wum1QSsU=; b=RepRNznH8QH0PPXsfZaIykU8oeMBZfppq7CM6nq12vy2D+k/s8Eb4/Td86i1E0cKNr Bpn50F/DZ2SV6dKzsWIE2cfudzgdNKgC/LArbTewv/cq4Ee/JzDlPU20UXh0e/fKU+aQ +QstWgU6g64ppXVD4bKK6ThErErIaxQbwEJtYj7bE1rsETKTdplkprQcali0VHdhPJz9 byp6AagO6yQmv1mnQMv9amVVwTEF1kLOYknksfcHoZ3RDBSl0U2RKdyQmYxD8XZGLM9f AyXme3XsCTpLbWp2tyAOqqTJOu2dWtFhZqkVVhq09VZXf9UOyDmi/+3R34Pq9sRgNmWs h3KA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708243114; x=1708847914; 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=4oGxiX3DP59U1b6opp4bM7FWUx7s6k2h0K8Wum1QSsU=; b=QSEA/LYFvuZMkNq5zs6X7RSHvstu/WgMcuxS12XUz9PZGP+FudpI9iSbcSr25j5wPc 1QTb/74THiCPky54AtIevKNV5Yc6gZ26R52npewHDx9Bj/yRFdaydQoF4qzTvZqib8NA bKSbFsngBiyfIdjg2rEOeQGW1SQASWuF7HjeBk4uG628Ag+tvA+tz7OtE0BvXwcKsuPe 9/vegJ58yYXYz2fnpMIO0gR2sULtrOTLqnZG3NmWJjAEkdGnC35/xhNH66sX0+e0GUTS 6BmYEAK83YMv5udUTTQLzLL+Qq/VO8lw+n4uu7MBxmvmKauy3WfmWnqRJ6Y6fzuf5aj/ cIrg== X-Forwarded-Encrypted: i=1; AJvYcCXvIuU9Q2uun/7cLHTmQW7dZYrFZ2+0OQ34PPch7VEJQLO8MynmtLrvxnD3T2ONK8vKMEuaezXC+FPNG4ueDmPL1irzo2dmFU58UEPG8XJ+BuYAlatB38DIQlm/lIG4gum4nWey X-Gm-Message-State: AOJu0YzULhxlOdPzLnTgQByxmsKhUbJvzXJvyTq5o6REg5CaZ3I5wMuM cx2CI6Bq+9LV839Y7njAGOjfrAj3fwOZZfafZwrMpGopQlPjX/6S X-Google-Smtp-Source: AGHT+IFkjTD7qVoCb2nmNqmOovYb/5JoE/O6ewWqQ7UbZB9DeCBYISSiBjBNUrJ0HH76Dp+OUEFC7Q== X-Received: by 2002:a17:906:1b46:b0:a3e:5589:6099 with SMTP id p6-20020a1709061b4600b00a3e55896099mr992240ejg.70.1708243113775; Sat, 17 Feb 2024 23:58:33 -0800 (PST) Received: from debian.fritz.box ([93.184.186.109]) by smtp.gmail.com with ESMTPSA id jj12-20020a170907984c00b00a3e64bcd2c1sm458732ejc.142.2024.02.17.23.58.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 23:58:33 -0800 (PST) From: Dimitri Fedrau To: Cc: Dimitri Fedrau , Andrew Lunn , Stefan Eichenberger , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 net-next 12/14] net: phy: marvell-88q2xxx: cleanup mv88q2xxx_config_init Date: Sun, 18 Feb 2024 08:57:49 +0100 Message-Id: <20240218075753.18067-13-dima.fedrau@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240218075753.18067-1-dima.fedrau@gmail.com> References: <20240218075753.18067-1-dima.fedrau@gmail.com> 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 mv88q2xxx_config_init calls genphy_c45_read_pma which is done by mv88q2xxx_read_status, it calls also mv88q2xxx_config_aneg which is also called by the PHY state machine. Let the PHY state machine handle the phydriver ops in their intendend way. Reviewed-by: Andrew Lunn Tested-by: Stefan Eichenberger Signed-off-by: Dimitri Fedrau --- drivers/net/phy/marvell-88q2xxx.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/net/phy/marvell-88q2xxx.c b/drivers/net/phy/marvell-88q2xxx.c index 58aa10d35731..ebcc6b4046fb 100644 --- a/drivers/net/phy/marvell-88q2xxx.c +++ b/drivers/net/phy/marvell-88q2xxx.c @@ -370,20 +370,13 @@ static int mv88q2xxx_config_aneg(struct phy_device *phydev) static int mv88q2xxx_config_init(struct phy_device *phydev) { - int ret; - /* The 88Q2XXX PHYs do have the extended ability register available, but * register MDIO_PMA_EXTABLE where they should signalize it does not * work according to specification. Therefore, we force it here. */ phydev->pma_extable = MDIO_PMA_EXTABLE_BT1; - /* Read the current PHY configuration */ - ret = genphy_c45_read_pma(phydev); - if (ret) - return ret; - - return mv88q2xxx_config_aneg(phydev); + return 0; } static int mv88q2xxx_get_sqi(struct phy_device *phydev) From patchwork Sun Feb 18 07:57:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dimitri Fedrau X-Patchwork-Id: 13561738 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.170]) (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 A034F219FC; Sun, 18 Feb 2024 07:58:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708243120; cv=none; b=L/86m8m6PY0qR62T3kuXh1kyFg45ZcXBaU8nb2PcsKNJ/um4Jeh0I4BQNk+2wNsKN5aQj1saa1M0Wxn1hlq/8PqS77A+sgYgezRlwYYTGm8BBffdGyKj+ujyAoz/AzVAh70Hk9VzGLmCYmmhTfERmvDkpVemIaeZP//eOnR9UjU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708243120; c=relaxed/simple; bh=3U9U1nadvLg0Rjm7LYRaj0MxfV50Z5qtzpMXJXowUBI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=UunkRVNjrhfblQn+YawNQ893vjQLqBgZs8HFgffaT6eOqW2X0q2Dun0EMQP/uF1ac1ClMiiyH5G7WwSezjHa/3XpYkauK3D7Ox/321GU05BIYGPTXytmKlwDDeQBnQVRHgQ44zlNdgBapIcexgm9Po6tpYuP2muJCUmrkBapC3Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=EpAikeCL; arc=none smtp.client-ip=209.85.208.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EpAikeCL" Received: by mail-lj1-f170.google.com with SMTP id 38308e7fff4ca-2d204e102a9so42396531fa.0; Sat, 17 Feb 2024 23:58:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708243117; x=1708847917; 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=z6lP6DHwHLvm2vn7jETR5fRUC+QbfoDMTGIxPcHU+Ek=; b=EpAikeCLUyuO+aqY9QQj9JlYj+BeeBZiwMFiIwItY+/dDZ5y6FB8b8LOvGfJRD1wEF 3C+O2GctgiHyZrL2nT1LQWS/X1HN5iF9Enuru1TW9gDKi4dosv/LMNCRXmM2ORzVQ7vk fGncGDnpBZM93+yJj5YHuvjn3UAiMrLWPCKOamc3hdxg/WOpJf/Yq1Dkhm50WkfHBoSR UuXLjBzh9nf6xhSnR24cjrq5Px0FN8ypXvq5Emv65vk/po1nFLooAf41Xeq5F5ysqT8V f0y67PF72KZe7m9QTqa2yPIEwQtrqNPF3cgJUrD+cXpxeYDhD4fZUXU/DQ4BFxJ3OhcD MHkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708243117; x=1708847917; 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=z6lP6DHwHLvm2vn7jETR5fRUC+QbfoDMTGIxPcHU+Ek=; b=MDZBDtIJ6zioRWgVhbAnES/GVkorQxnX8A2nmfoirTcbvA1QAHmH5+IzKtx4tNN9VI XGVkQJ6TdSUJQSYRbgwMZte1L21zYduHbyW9N4zg4WtsRkW3tKCkJyu7ehcQzMzonzMP NLWcFxx3uPX4cgPun7oBeX4iNwBkULCgmkcgaPpOLRAOP6Z+cBuGhP+AtOMSYH/YLs+y 9yzA3VDLwvCvFEsxnr8yvevjXkPLYzamI5qSUXIv0K75VHGq4EysVqpWxqkCv/hmVOPS welpODFBSSPhKgSk51ZTbRmv33N53/0LQS6kYoYexkCTOE35CHJt263SnfkHlWhxgjOm Fjrw== X-Forwarded-Encrypted: i=1; AJvYcCW05kpRnLzeAYWGkcGvVgq+8MbW3Xid7AsLHWyoKfF+7tDhu42i/FjGgTniJLnjnp5z/iwdjvTqhqCj8TiQdB2mhQAGsUM8QkbFzuJG6Um5GShVaX8m9WUP6gyIJ+ZZ4LmEZGTh X-Gm-Message-State: AOJu0YyMPy8gGTLWWJV2v+QVbQ2U2m1ki0Rwib0FE8wh0T/9stlzU8AP txkr9ThuKb5faff4u19BWjrfcCG3Vot2IIIQqSq63g7mr0F8gZWbV3jK9G9Z X-Google-Smtp-Source: AGHT+IFq43Up4WtdV4MGcvql2QzQRx7rryiB6CQSRv2Gaaw2YQM/tyjcvaRLAEOdd7NXQegMHGVe/w== X-Received: by 2002:a05:6512:714:b0:512:9cbf:acf8 with SMTP id b20-20020a056512071400b005129cbfacf8mr2424995lfs.4.1708243116751; Sat, 17 Feb 2024 23:58:36 -0800 (PST) Received: from debian.fritz.box ([93.184.186.109]) by smtp.gmail.com with ESMTPSA id jj12-20020a170907984c00b00a3e64bcd2c1sm458732ejc.142.2024.02.17.23.58.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 23:58:36 -0800 (PST) From: Dimitri Fedrau To: Cc: Dimitri Fedrau , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Stefan Eichenberger , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 net-next 13/14] net: phy: marvell-88q2xxx: remove duplicated assignment of pma_extable Date: Sun, 18 Feb 2024 08:57:50 +0100 Message-Id: <20240218075753.18067-14-dima.fedrau@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240218075753.18067-1-dima.fedrau@gmail.com> References: <20240218075753.18067-1-dima.fedrau@gmail.com> 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 Remove assignment of phydev->pma_extable in mv88q222x_revb0_config_init. It is already done in mv88q2xxx_config_init, just call mv88q2xxx_config_init. Reviewed-by: Andrew Lunn Signed-off-by: Dimitri Fedrau --- drivers/net/phy/marvell-88q2xxx.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/net/phy/marvell-88q2xxx.c b/drivers/net/phy/marvell-88q2xxx.c index ebcc6b4046fb..75740f378c66 100644 --- a/drivers/net/phy/marvell-88q2xxx.c +++ b/drivers/net/phy/marvell-88q2xxx.c @@ -701,12 +701,6 @@ static int mv88q222x_revb0_config_init(struct phy_device *phydev) return ret; } - /* The 88Q2XXX PHYs do have the extended ability register available, but - * register MDIO_PMA_EXTABLE where they should signalize it does not - * work according to specification. Therefore, we force it here. - */ - phydev->pma_extable = MDIO_PMA_EXTABLE_BT1; - /* Configure interrupt with default settings, output is driven low for * active interrupt and high for inactive. */ @@ -715,7 +709,7 @@ static int mv88q222x_revb0_config_init(struct phy_device *phydev) MDIO_MMD_PCS_MV_GPIO_INT_CTRL, MDIO_MMD_PCS_MV_GPIO_INT_CTRL_TRI_DIS); - return 0; + return mv88q2xxx_config_init(phydev); } static int mv88q222x_cable_test_start(struct phy_device *phydev) From patchwork Sun Feb 18 07:57:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dimitri Fedrau X-Patchwork-Id: 13561739 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) (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 5CA6922325; Sun, 18 Feb 2024 07:58:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708243123; cv=none; b=fRlKGrV2SvNYNmRdwNuygV2qRTScSPoC7Kfge0x3M3543NpvVZRbKlO0AEKoKW3nQx5JQCc8pu0tEb+VzyKhnpXjmYmqmgIqZPwwixM+isIO0RXcs1Wo/REr0Cg2zcjY/KRfvMaek+qBAdF5OQJWnhEOh6Rk8W4/Kg6VDVDOgrA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708243123; c=relaxed/simple; bh=NKH0ZFPcCFBnqG7yf+u2px5oQxf4WU5hZN0TqksNx/E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=XWGZhbvsBAChB0ZfLfHMOKqe0C6C6gSJkXPdfQCqhVKqLPeyJl8HhyoHs3vXnqQW299jrNTs+96l7/mVoFqVmeI0n7tmQIP4Y0bpP5EpCMBrIIzXjmqDZkfwOsgjtz9i0UTH137w0BxU8FaLB6m/mjDDUJo0TEsVwnSInsFTO18= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=L+i+JDPK; arc=none smtp.client-ip=209.85.218.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="L+i+JDPK" Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-a3d6d160529so244420866b.0; Sat, 17 Feb 2024 23:58:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708243120; x=1708847920; 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=raGAwOephnSsA9G7MZk1sb2g9wF+qqd4XeQDzxVbWtw=; b=L+i+JDPKG/DQj45ZwmH5Q/C3I8fgxbAy/4qOdRzxSyWLkTInaimwvf5Zg2bdYYOXCk 4oEAD1APjCSW29NPgdH6e29q64rp6WpWQoQvtGWxgG6qC9yrpcH176eaBDqHL3IcTdjL UvNiByP76KnsJTCQWr+/klCAYtnRYhZXrBec/Dn+Mn4tudUz8EW1dUxffAq5rQTaNBdb anwd7JmEw95Jpq+wnI4J1wVD39Lg1LXtagiinetZ2QKrEjesz8fhn3KpMD0mqDbYXdZt aYu/BjoGpAChM3CzYokP5syQg/4hpUa9tneWPw3+U+2KyoCKF5HVLdIEkNSFauBMM0rG 9sYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708243120; x=1708847920; 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=raGAwOephnSsA9G7MZk1sb2g9wF+qqd4XeQDzxVbWtw=; b=WuRBuS0CNCH6Uolg4EcbLe6tIJj9UJCU9saHogukchKFEw3QlCXJO9jycTS73bKSyH d3Y/dD/cq3xnjP+vFGB1Px8y3OmYCadD7+ZZfvPLvOIL1X6m0GnFRKZpFwV+yun9P3DP UsxLC78L74e003ymC4K/D6PZi0gA2Bo4NU9ihEg7NnABRQqRgx0T/zoXxfaeSjtbevJe F0tBdzNo5BEYkaYpSI/Z49TCWoqwTVJ4y10uRM+rM/cYTT9+8M5t/fdeqfEzilONc3ep QeFZLC5pwXjbpGz3TrYK0r/pa0AB1323EjgnfUtCnDE2bcY+IdK5RENfC/cCBN7f/FYN KxgQ== X-Forwarded-Encrypted: i=1; AJvYcCV0CZuJImXgh2p51yRL46m3NUW/w1vRMsjpJPzV9XprnYPYz/lZ/5lcarw+mI8wYF/x2hZBa/Txu+ILI5vw/0HPQo62FQqVjV/hVSYuiz0SI4QI1ZVS8to6Z9JyXRGGkSts9CrD X-Gm-Message-State: AOJu0Yz4Nyu2o0BWktZyOD6K8VoxI8Q1OiyveHkNf/YplKYK96hiRxSk DnSfk9drs9oZ9gypbpTUHd3FUDhJ8J5IeMh6VXDAXbkP4tSoJ9IJ X-Google-Smtp-Source: AGHT+IHEDPtHdS3hJq+jdRNZaHpln8fDc6cfXgK7v1fk7Ak49LJFyjTCVPjb0c+zNEtTZ60qnVPivA== X-Received: by 2002:a17:906:1854:b0:a3e:73c8:d383 with SMTP id w20-20020a170906185400b00a3e73c8d383mr473319eje.49.1708243119850; Sat, 17 Feb 2024 23:58:39 -0800 (PST) Received: from debian.fritz.box ([93.184.186.109]) by smtp.gmail.com with ESMTPSA id jj12-20020a170907984c00b00a3e64bcd2c1sm458732ejc.142.2024.02.17.23.58.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 23:58:39 -0800 (PST) From: Dimitri Fedrau To: Cc: Dimitri Fedrau , Andrew Lunn , Stefan Eichenberger , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 net-next 14/14] net: phy: marvell-88q2xxx: move interrupt configuration Date: Sun, 18 Feb 2024 08:57:51 +0100 Message-Id: <20240218075753.18067-15-dima.fedrau@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240218075753.18067-1-dima.fedrau@gmail.com> References: <20240218075753.18067-1-dima.fedrau@gmail.com> 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 Move interrupt configuration from mv88q222x_revb0_config_init to mv88q2xxx_config_init. Same register and bits are used for the 88q2xxx devices. Reviewed-by: Andrew Lunn Reviewed-by: Stefan Eichenberger Signed-off-by: Dimitri Fedrau --- drivers/net/phy/marvell-88q2xxx.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/phy/marvell-88q2xxx.c b/drivers/net/phy/marvell-88q2xxx.c index 75740f378c66..6b4bd9883304 100644 --- a/drivers/net/phy/marvell-88q2xxx.c +++ b/drivers/net/phy/marvell-88q2xxx.c @@ -376,6 +376,14 @@ static int mv88q2xxx_config_init(struct phy_device *phydev) */ phydev->pma_extable = MDIO_PMA_EXTABLE_BT1; + /* Configure interrupt with default settings, output is driven low for + * active interrupt and high for inactive. + */ + if (phy_interrupt_is_valid(phydev)) + return phy_set_bits_mmd(phydev, MDIO_MMD_PCS, + MDIO_MMD_PCS_MV_GPIO_INT_CTRL, + MDIO_MMD_PCS_MV_GPIO_INT_CTRL_TRI_DIS); + return 0; } @@ -701,14 +709,6 @@ static int mv88q222x_revb0_config_init(struct phy_device *phydev) return ret; } - /* Configure interrupt with default settings, output is driven low for - * active interrupt and high for inactive. - */ - if (phy_interrupt_is_valid(phydev)) - return phy_set_bits_mmd(phydev, MDIO_MMD_PCS, - MDIO_MMD_PCS_MV_GPIO_INT_CTRL, - MDIO_MMD_PCS_MV_GPIO_INT_CTRL_TRI_DIS); - return mv88q2xxx_config_init(phydev); }