From patchwork Tue Feb 13 21:39: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: 13555690 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) (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 B3F4A6215E; Tue, 13 Feb 2024 21:40:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707860417; cv=none; b=PdJqEArm/APJh7+Aj2IbG5Wppzulsm27zpoRbRLKvMHGlFWQ748VFXhKjDt5dAKiyTEiH+iLUppDLmtbS55+yLUicntRlKBiMYPmkNdnJrhGqBzzN5UpTyuABFmjOLL/i2wvKKWSTSUCFyauO193FaOVZzjMXNPS14wMiVTbt3A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707860417; c=relaxed/simple; bh=/WQVGD5RStqq2TMulnJzeOS49hKDoHVe7AeXru/8hBk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=S3gWONR9oAPMCO8MX6Ym2TgAG+3I+1e6LHQvp2pDgxYdS1kBKzLwpCWKWnpPDVpXE0D8GINrZikr2H723kvYm8112Z27OoM8BcHn16loF2pLiqTMpM7zIM6eQtzbQMpChnLu4z257PCvvJe+VTZ0GyAOzriayYy935dpXV4HvrE= 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=C5+yhd7J; arc=none smtp.client-ip=209.85.208.54 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="C5+yhd7J" Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-561f78f1ba1so1247585a12.0; Tue, 13 Feb 2024 13:40:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707860414; x=1708465214; 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=awRh8a2uyaBPV9HuU86fl9/hVsMJE3K/Mn7kByHoWp8=; b=C5+yhd7Jza1ba9wcKR4TsGyHyOpzbvcpFXfTHdRugdcx02wLxcwDXMKr8OfkkSDABd Zg6lu2NMCJIRplumzSeoMVaXapRVU6Hsos75wpAbN82D1EMbBSoY9mtiI5poRPKG7oTg +VyMrV6LByiglEBwmzhHPr9siIo6xMy2A92hR5iwV197R7FpNTB5UsqNEV3UdYGomElz hb4NPnu7ao58f3lP4DunCGjapu9ZLypcvh3hNJYe70oeo8uxdLn1L9exv4M6mQoCnLxi ipP7Cg8Xnoo2ykqzZskhF2b14iyB7nv5qT+OnWBTi4dtz3T4DGWvInnLDmNqNJ7Uehrm 3DAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707860414; x=1708465214; 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=awRh8a2uyaBPV9HuU86fl9/hVsMJE3K/Mn7kByHoWp8=; b=kOcsO3bZXlm3bYwdJ/JOkXgMUbwuUhL+mpUfnV/AI19tbRz9wKRcRQh2MYBxIMKs15 unlp5datRcd+YNyEn3Mr26YQMLe/79PfY0p3+QHx2U/G7vU6/bpmet5+6wBHf45us5TJ 8wO72jpgag/HHqRd8khvsnFYvMd4dWxBr5PQ7OnjfactoC2ffXnULJy4z1DfNVjZvpXc AC8Y0Nnm9RmjFrsatyaTrfdAaZmIrIpzsKZjaYSZinzoYHAaCVTLy5k5MevJETwztsKy n6iJhBBdF+jlVCGd6pHmX5hBOX3Su3HP5rB3WH3o22+/r0cjqhdFCZa1FHVEWsZ+yhNP WhCA== X-Forwarded-Encrypted: i=1; AJvYcCWQpe338CMAcdCtMVz39/ZuQKj6sf3UYo9nFdZBrQtMah5pQNB82Cjq7pIuWOLfxVGmfL4BBhJ+8bN2HHo2dEjbx0tox/UpFVOVgle3mSnvbj2gPeEB6QxYKznV9HFKsrlolE6F X-Gm-Message-State: AOJu0YzFeLH45hY+203rSEaNH7KeR0Hu+Fo39axfqov3Ga9u/fjOSfUl /r4WJPFAEDyuOWu/DY5WwTi/F8uoybDddN5wgO704PR8/9avq8he X-Google-Smtp-Source: AGHT+IEYwFCA39UE7hCEWs4q1hA9X0H3KrPNtsm/C7o7b+Pww/U91YEVPh3Vb/BmSW1ibaT22yy1/A== X-Received: by 2002:aa7:cc8c:0:b0:560:58f:7148 with SMTP id p12-20020aa7cc8c000000b00560058f7148mr638144edt.34.1707860413619; Tue, 13 Feb 2024 13:40:13 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVsaO4u9rpIs+1y8PWd/khMMJCSeZFy0zaJtdye8zgzb5aNPvoFlhWB/HS9Ik1inYAajPpS5SfSkDJfWWpnap0CMXATvTsJc+0cMKAFcQkwoTet9MNakNv5XzS1oPUITsxQfyiHsI6dzFt3LfDVa0GagN372FKTQNBLsGCD0cEvOTCVIR489uULtlBNlgA8UhK9MzvHFPL+0ptHvqMqb87PhVDHor4/KB7Nh6Nh6wYoSyfcjA5YoAjz3wL+9BaEVfOaw+GbkRyJToKcpHpSmIb8qri5ynrA0ivno6PghzohssOWayIcIHjTFL0bMyXBFj4QQvF/DSdyNlqCa49NHRxcNL0= Received: from debian.fritz.box ([93.184.186.109]) by smtp.gmail.com with ESMTPSA id k23-20020a05640212d700b005612987a525sm4003913edx.89.2024.02.13.13.40.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 13:40:13 -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 v6 net-next 01/14] net: phy: Add BaseT1 auto-negotiation constants Date: Tue, 13 Feb 2024 22:39:40 +0100 Message-Id: <20240213213955.178762-2-dima.fedrau@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240213213955.178762-1-dima.fedrau@gmail.com> References: <20240213213955.178762-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 d03863da180e..020ccc810d23 100644 --- a/include/uapi/linux/mdio.h +++ b/include/uapi/linux/mdio.h @@ -348,6 +348,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 Tue Feb 13 21:39: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: 13555691 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 444FE626A5; Tue, 13 Feb 2024 21:40:18 +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=1707860420; cv=none; b=pdDQvsy3V40H1quReCC3SiKF6lm1F/wshrkXTgYTPja+qzmy/OWFRc1P8ge6W4kQ7cW0vsJlma3BELDA/f9GWlW85DI4qJoX1T6snC1TQ5SE5gWK+fzu8QYgZGtoegrQYNH5o84lEwdxNC6ntVOF49FFGdEXfcPhY4rZDziCwls= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707860420; c=relaxed/simple; bh=Xlt6sMMKAUm7IbZRBGhxEDcRLpN3TDT3XNkJuoLuK4w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Oeq175g+aQdGX8HAbSIuMR4lRmEIjkBBzAFzbB1qelMjezHuBkPGBTJxJG+Rx9vhYwE+tVbmfC49uh5pa0rGbnhcm31IPYd2lT6b44i7vwS3hWJJ0whc177lp5DsZDogn1xfxrt7BGOwmo16DVCC9GblHH9ZG71NV35LjZ7w0tE= 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=kfcQ9x8l; 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="kfcQ9x8l" Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-562131bb958so638291a12.2; Tue, 13 Feb 2024 13:40:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707860416; x=1708465216; 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=kfcQ9x8lSchRiS52FwWp1Gagui0+aS8XRH6rK93zICTcf1VUv9Tkx60KEnPk3/kxIq 9BbDjBKfY7xWwxohXahj/IaTZqNCENEyt6L+ILwHtozXX7gWdzr1aMY8EPqhgpi+RI4h hKdMv+6n7/V4BFTGo3+Z3JV00ZBKAF/Bo3PMe0U+3FZStyaM4q5rvqu0kXWlmZiQGQfG Dy7hEZ+WiddvC08SeeKHcGQCErmRkjr8BitoU+PpMb2T3Q60Kn/6Kxb7fiAU2F0+2UCQ mNMxH+5ATR+KIa2vRKHuZp21ArKIo3g0KTqqUQAVT+NqJjHGVmYvp3mTAaia81r50i/t oQrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707860416; x=1708465216; 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=CBqKt8M+yPYnXyvcC9UPSglZ2JMo/th2F/zGfm0COX79E3HQABL+ns2f054jHttyMz QSByYYnweW/tOYb55n0prgoPOlkvHLTmER6jg/0RRMHP1CYnI5Cm0/TWRBQsxg0JrzvQ wiWvkezKUk/9uK77yMG4QM8wGl7JrhoKmoQrS1fMzRkvxBtattdWlHXZrBK3y6wC+3n/ unq4F2wNsU4ivQPq0pmpI1gfNn4IzRMTis7Knd1wonGBjxKnS57i3peS0VAlUtVPmkGo px7TqhCJWap3TSVKhwwQo6MEWJQDxf9GTfKRUKEQxraPSaV5RqUK5MnH6y93VS7brXZZ H/9Q== X-Forwarded-Encrypted: i=1; AJvYcCWYxSfiV1t2iXkHC3sJ7LQMixE1aCc5PeWuMaTMI+048f7aPNms3uv0froa7EgzwKFNgOuDgDLVEFeF3slJlHgK7JfqL8LcByq8LU4hPsZ8OK8yHmm1EiQIIkAwxiWTsKjxYyVV X-Gm-Message-State: AOJu0YwYoDSnzk7+4q3h3uR4dZNeqZTA68CgMeMQxtu901+GrcTLBQTS qUDy83mETMjJuH5+j2/anzEA91HivENetpsqc4VoqM1ugzMgqVMh X-Google-Smtp-Source: AGHT+IFzlEkF30+ITzXFlyZox4AktOmmGvYslinHBs0N6IAogbMuqJkmq4ru3AkyVSMwXOpOZ+MPpA== X-Received: by 2002:aa7:c90b:0:b0:560:b758:5e2d with SMTP id b11-20020aa7c90b000000b00560b7585e2dmr680585edt.27.1707860416556; Tue, 13 Feb 2024 13:40:16 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUHOkwuSj13xM/kFQBSiTDW/L5eZa2YUoY1+/sthxs8AQTHQ8TMJlJVjnqrG7HbI7QzRnioeew1Lu9DWLI3Ha4LqD/9Sskw7MgqEq+8WsKH/SCeuqFZhUpm03WqRF7qIrP4zVv7DiKouabV7rqsMV+ikGObSw7P3Y9H59pcsRb5m8WJfIdrReIK2Ffby0oCOgaGiSTI549itD+YefgKkQnThn+O1gIrxYAqGMMg5KBH8AoRWf7q70IH3ggHrwdlS+T3yTKQnFxd4T3O4RJGLTUWd0FOVqFKfzlxugMByJCuIlcd2IR65/EcWwHa7xwASP79MiYNiv2NgAlKl8TV3ENNV80= Received: from debian.fritz.box ([93.184.186.109]) by smtp.gmail.com with ESMTPSA id k23-20020a05640212d700b005612987a525sm4003913edx.89.2024.02.13.13.40.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 13:40:16 -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 v6 net-next 02/14] net: phy: Support 100/1000BT1 linkmode advertisements Date: Tue, 13 Feb 2024 22:39:41 +0100 Message-Id: <20240213213955.178762-3-dima.fedrau@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240213213955.178762-1-dima.fedrau@gmail.com> References: <20240213213955.178762-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 Tue Feb 13 21:39: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: 13555692 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.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 90A93627F7; Tue, 13 Feb 2024 21:40:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707860423; cv=none; b=JHbIhsekX/e3LgJC16Plg9u+mwdTn2Nqznp112nyYysO78A0t3D3U7KSguJDC5dRPlhVHdZ8eLxsHKBLSePC25982tLZ7uolwU7ZF+Ze8bcvsBychmblsBaq6excMHLYshmqTfXoWLX5am6nnojw3H2jMsEStEaYC4oolDM9KLc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707860423; c=relaxed/simple; bh=cFyzorVyt7pR+oxl9oSqdJVk3CnfNL+zpcN7YvtmWuI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mcmcBJXle0vb2kS6+3ZSAAYE3HO04ikdqTIVJh0cpXH2WFohrdxFuCl3Ut2chB0n+kjk+LMN+IxlrE16AEZZHBkrgdEC+p+HMEfpZm5Kf5sCQkQoDUJflpaoz4+VFEnkgB7Z5Q2Lruj+T4EmWPrVaZB28OUdsdKi8fDSNROWzwU= 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=Yj8Y5Wli; arc=none smtp.client-ip=209.85.208.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="Yj8Y5Wli" Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-56001d49cc5so6053713a12.2; Tue, 13 Feb 2024 13:40:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707860420; x=1708465220; 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=AH7FjojSelKl6RFjaMdeJGd9WEI2qrfj4ii5ApRFD+M=; b=Yj8Y5Wli3o5mx+vto7xy18gphrhWWWVm8xG8Qb5+vtMGqbWMZnoq8TMlpFt/v7Qx6j Dr6giy6QiMokvwpomDtBpJ4utsHrkWGFgIJtwR7xb7U3d0fOUyJA6n0bdnWf6qNRAA3h I4sWiizFD85Jv7gc3jOuOTsBOQ+UNHAtFAa+WB/YE9l1Ew3zONF/dKIyHRecZrGCxPsV 6ZODIHPNPXZEEEFb2IGveP6b1fKOE0RJQwKNKnGzWS6t5vvU1jU9FT0+PB8rEay4dYzD LiXgg8Lj7cL6nGhBSc6yNwN+Tae6UT6eIE70hgmzHeQAmjWxpnmT3U6fc+Ht7HACRKMk JNQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707860420; x=1708465220; 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=AH7FjojSelKl6RFjaMdeJGd9WEI2qrfj4ii5ApRFD+M=; b=SeHm1agnaQwvi3q4LmR6EFqPebuNk7/IT2Q2X7o67+VhYb7kFx3Ssn/CP2olWXhtLr lR3sHH/fO1g1y++MGc4f2uEM/9RSIMovfSn7MBbCrAbSHwotOCRbLjAGA4F7Bw7Xa7XZ vVh5xNK0fCG2mfZQyjp63ep0JiD3aKGNNclhQQPi0egxcXPMSW1W4tRI2A/M5LKJWedV 7aeahf5LghHc+C0fTyKF0t35shdeVOoCwWNlWfqMXFNGZ0TsonZKiHnU88OiSXESDdAZ IlFZj0CDQwOmRgv6eTr5fkyn09MJTq2ny7bimgboWogZbi+iL/QOpQiZFzxzZlGlbZ0R lfTg== X-Forwarded-Encrypted: i=1; AJvYcCUS093wW2+wEXP8NgqaPr/v3mgTDy2jUQNfPudDv4/WeMANop+DZx5v/bfnjcEGhFXQ2WxBwKu1YGu6XDpswvybV1P2Qz9234M9HRRYjsFkbh6piiCC8XLPdiGOGbl1HTpoPeqx X-Gm-Message-State: AOJu0YxWNcarblHmDHFjL+us+m9JRoT3DypNxJ3hLuZ/8510KyZi3EMy gsxgXxQG9R9EXeXHu0ikXUCeVRAZ5XkO/QQbz4eANZL+GsTPQBbT X-Google-Smtp-Source: AGHT+IFpWcx6761os9cY463iuCWj1XL4UFa7Ld5yCw6fna2rdMN3IzUFuO9OuDGXe4y1loKdEOgQnQ== X-Received: by 2002:a05:6402:6c7:b0:55e:ef54:a4dc with SMTP id n7-20020a05640206c700b0055eef54a4dcmr640135edy.23.1707860419584; Tue, 13 Feb 2024 13:40:19 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXQ9zxyD1Pggf8hY8RG7yzYR1rUCtJlOfqguf2JMEViHGgeozHqBSMHfcHcq18/kVmc8lbBlvYfCqaPW8DN13ZvkUJro2NfdJX+YRmyPqOs0bX9EpLSsppaI5EUnxABecsqYr9L+hmUjWOzcMG82Klfoha28LfRnT43kqbWBlQsR+eXrKK/kpuefAUY3PnYvhYwiGjsQIZh4cJo4kGCTwJOj/tceNzvVbCXshXisED05st5gn8Bek2fM+WxHPPMmX1EvoBZEMXcBWuDT+H65FjXEMv9u/NAhx/WnHHZLpFa73NzpdAMC/DXqKo+epyhfAKF0Zx+7IuIaXNBDcgBlOLTF7s= Received: from debian.fritz.box ([93.184.186.109]) by smtp.gmail.com with ESMTPSA id k23-20020a05640212d700b005612987a525sm4003913edx.89.2024.02.13.13.40.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 13:40:19 -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 v6 net-next 03/14] net: phy: c45: detect 100/1000BASE-T1 linkmode advertisements Date: Tue, 13 Feb 2024 22:39:42 +0100 Message-Id: <20240213213955.178762-4-dima.fedrau@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240213213955.178762-1-dima.fedrau@gmail.com> References: <20240213213955.178762-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 747d14bf152c..de8f5dc8be12 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 Tue Feb 13 21:39: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: 13555693 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) (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 7D030629ED; Tue, 13 Feb 2024 21:40:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707860426; cv=none; b=ujMJ4+tT1Ao2cWj2T5nJ8H2/vqt4EMWTjolJBtutM/mnOkRg0s4FSXRFJmbEPc8rBDZaI67ffM6ryMOJ2z+n1/JcUvIovF0i8FH0PALtOUnyRXlkSjz/fOw5A5r5qeeR53uwB46zayl1rxvMmSIi2Qm+y1EEM+SBcsYh97Gcu1Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707860426; c=relaxed/simple; bh=P9kbg96h8nA+vzLjsIPg4kILNbxrfwclXgGSuVa0iV8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=DehwWSpMECRAnER6C2vJU1cVxCbtl0ipsLVnzk+7qlYKa8X3W5npwfSpgMVrQmFT55dBZ3ilm60KBKy5vniqZeDmKfL+GNA6edKeyvNQD5d6iZbHXkGisyLEg8kyHcWHDTNQM/zfO85QG3OLo908yQz5BpmTWmcd05nzqwyEiEM= 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=DnjJm1oh; arc=none smtp.client-ip=209.85.208.169 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="DnjJm1oh" Received: by mail-lj1-f169.google.com with SMTP id 38308e7fff4ca-2d109e82bd0so15326801fa.3; Tue, 13 Feb 2024 13:40:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707860422; x=1708465222; 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=DnjJm1ohyTKGhZHNcU8vrNVUPibl7zg/xk2/LoEkKkoBa0mS0Y6ZEo9PerPNg7Js1X uzHYIiFyEYdn0LXnkfp862jpYdAEwsFoRfyINYv/Y+xdLawfeld3zvrdWZ3JsCzuzoGi aoDd/oPvhOS96dYlGZN6vFrxm7+byCFsLOJxSKUICn4rag1RYmJfVqkxNX4iDf1FJ3aG 2beKzrvAx8D25tA8tON8wdBjROO4AYmsMhWJwZVI+NoiidP2RVstEGdhcAyeH3dQII3x roh6uWCJOGTNfpgvvXKwxzVa1NUGfBogs8E7cK6YkezTMJUNj+UbNRgkQcg7l2T0htaP 2kMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707860422; x=1708465222; 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=j8HOTP6dSwPd+K8LCQAoMr4pEjJhJXIkaOiX81n9OZF5uV5bDbT7X1nKQ4hrIUbB5u q635rpZD94UQWU5v9bfG2BI2mGArTJTdr7MZVhDES0PT8B2wieMvmLa1RDeWY4YAvVJl 0crIU5rRHVkLKMIWgwraVUEB+cUTISi0ItFW04OLF/jG7A01/tXhJ/g1smRp+6NfcIr9 bhVknzkyL0EHB7I3PFb/XA4js8hPlAkzlsBwDBTJULK0dxkEpqk9QpbPwDEh9PKT6Jut Xta+YCypK6H+4kh6y6isR9Dm5RKIbFw/j+Lotv2hboHFYj+mszmh3RHUCH6s8yfhKant aa8g== X-Forwarded-Encrypted: i=1; AJvYcCWTSkVlWbXZbiMrLrYhLvGaYitTT1Oa9zyVD2jvI+vZG5SS/cPTBpF1RVlBDaKe5HrZtUMlps82l82YqtUop/MbDjfp4h7eN5O3cIQg9NmmEKCwGNPss0ZIC6TMq2QXiLKT6FP3 X-Gm-Message-State: AOJu0YwaGqXvsoj6tyaXSABBP0fjUQWFkePU2cEWbo9e8P6XNbuacGej 4RoeV/o0JetSGGPV0Wrn/03iLu7mM9VN+hHuSv1n9z2zYM85dFGo X-Google-Smtp-Source: AGHT+IGstANoms+UFbnJKknPAUv7SdGszKG7pGLDLY5atnR8LujkVPvCqWUxvAaANcXuCwXiAtIZ6A== X-Received: by 2002:a2e:98d6:0:b0:2d0:e35a:3bab with SMTP id s22-20020a2e98d6000000b002d0e35a3babmr520694ljj.48.1707860422495; Tue, 13 Feb 2024 13:40:22 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVEctUJOxW4T8/ZV6vGaNHaWPBZAvHDlT3gBHyDp/z9BAZJYQdz8BaLcUtnKwGDdcxrC7MDCBJZjDOPoSC7PYHtDKadWGWcQvw69uoYz+Rx7Iq4wvX4FlJf65ThFhs4uY+f/FvQdfln4HlMVGcMSZJWCEv3tp0ta29pICNngY+cvizfHW3JvtysHtPpIwosdKgdwlIAKz+vmh68ArYuppE0am/UbrT9zAh6/TBv9eQSjhokGym3omz9YhhT2miHGcIdLvojfb2xGPiZFJMlICul4WVOhyt2u4f5aCdHJmXdHFnRSgNBFTSlV9quPyw2KRwAVI6D37eMLJRbB/VvVMCVAjk= Received: from debian.fritz.box ([93.184.186.109]) by smtp.gmail.com with ESMTPSA id k23-20020a05640212d700b005612987a525sm4003913edx.89.2024.02.13.13.40.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 13:40:22 -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 v6 net-next 04/14] net: phy: marvell-88q2xxx: fix typos Date: Tue, 13 Feb 2024 22:39:43 +0100 Message-Id: <20240213213955.178762-5-dima.fedrau@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240213213955.178762-1-dima.fedrau@gmail.com> References: <20240213213955.178762-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 Tue Feb 13 21:39: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: 13555694 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.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 5E8AE6310C; Tue, 13 Feb 2024 21:40:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707860429; cv=none; b=fmlVgn2x0P25e+rN1XI++EAM0vBOfp6uNhN/kZAdyDC+lKdvX8jPLaRm0OTPJEXYvmdjSrbBbZqYRP+/oAdB/tL6sbQNC+1z/aOfEuGUKKDWz65xDgan77o9NhMr87sLHgHL9vAUdyH4PLzxYJOmM6QlYZXtze+NMya7Mjq/wP0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707860429; c=relaxed/simple; bh=ud5eFdUpmBlmS+fEpaSo3OD7jfLHSMb0XVsQTJwqqGc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=E4Iebrk6r2yS2Mz4EmDz3ltQE6I1RPkS9t0dhlStYEHTUSwGFs+m5Pks13J1afkgwQcJIHxt2H0mj8njszSdMutfL4VwboWsdD9kI3nwUbCTeBZ2DUpE40jI2J/P4Iy/SG+D2xJFZsnVB+ntmUq9/S0QqZRVqXpOMEMbMkMpE+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=U4mjXfV1; arc=none smtp.client-ip=209.85.208.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="U4mjXfV1" Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-5600d950442so5542382a12.1; Tue, 13 Feb 2024 13:40:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707860425; x=1708465225; 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=AkO12whfWQvc3hnxm0fS8HsMRPIy0r1IwU6i+kIL1jU=; b=U4mjXfV1gJT3iBX/qQZURbdPUeoI5HnoIl6ppYghbrQH8SJaZkB+a987KctVJ4WJuA R2mXirfy7K3W/FddlWjIpctSGxNMMIoa6XY5s4FN0yUZmoLOU4eaD3V54w9DWJJTXHIR GiAleGvSIagmnxkQpK186kV2K3jlSW161LAzXDL4RekE3HRYsDHdP6tnUfrDpoJW59cA 5JpGF+qUfITrIlvMeF9qcIAowQdRLiw22vxVPe2mI4hjOmJUIp5JD2o0OVvbXGXGasqo jJTtKCYuDKSggPBRXE560b3hBkqb2OZbr37gQTdZga+zvKyzBMwUN2CW3GwFmzVNvWWV UM/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707860425; x=1708465225; 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=AkO12whfWQvc3hnxm0fS8HsMRPIy0r1IwU6i+kIL1jU=; b=s4ghPdA3Zdr7n3hWqQQbqKD0oi4F4EwthAYbzuR9x0yU5x6sh3R6eFFDSAKZQzmorg NW6jFNAUXuhafyEFZ9iuIRawIGpH+QUNUwI/egy75bpCe9gcJVXUY3Cc76P7+cD7i3ZD ndZr1SYyPnHnZg3jAFzoawqYhxkrQRACwRhT6oNqzpTy9eGnD8T0485VeZqlgG8ALznU 1m3tgG+LbY1mSuTbApHkimLTyLBRXcBAj9EXC/WRWrXhpCWmhWRmLgSdfIpbuueB/W7w su0qm0N572taZvJkp18gRQC3H+U6EDoMg1tEbizUZ8cQcMyMTFXbkfrdbPsRHjTHdU3+ 8zPQ== X-Forwarded-Encrypted: i=1; AJvYcCXdwbML9TcitSRHTRc9tG45xbOB0nuP+dWyoA5ZZ6SLUK3JaxCdt7TlKgLoIH4S8vt/A5eAVMvi497MxAoh2oCwVaPi9DFV9KWhTqNr9Zw/vJaDTyMyJA6pobk7LyvsJE/NQ7Ed X-Gm-Message-State: AOJu0YwwvAV6eY9fNgUisz0DvVf1JxufsC+WN2rGaQWgalCPW3F57oz9 g67hMZ2mo2i0RlXuYwk3Ro9n3E4qJvvOK3tCEZt6S9tK53coTomecjCfedhc X-Google-Smtp-Source: AGHT+IGxel/TucfIsx79wPhSH8WRNZkLwSlWmMksS3MKq+KREqs17dCiyye53xdEp9INctw46wZSMQ== X-Received: by 2002:aa7:c74b:0:b0:560:8fb7:a721 with SMTP id c11-20020aa7c74b000000b005608fb7a721mr732963eds.13.1707860425536; Tue, 13 Feb 2024 13:40:25 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWckH5ZF84ggYamMLajNAkfx9/rbxkkLdVzlgTLBp2goZI9BP/UfQLUlrkBKkmlQXzk1InBzc6sliURDar9x6wUg9vcC6TdZJPJKVTT1Eqoq6KSt28RxnwFU0LvSJmCFv14F094TIQx+9R1j92uXM0C8tcGBxjFPQ1K058o4O5Yb9mDgOHa4pTMuXZS+g1x11Xm4yrCp8FTHn3DKQIVfu0k8IhKWQUUL1y4pUQY/EUm0afQc2bLjkSj4bt0UClZPFYQ+8JyRw0s2VMszpFBSqZezODqywuT0YfVclO5Wk8c71BDMVwKy0CS0MM4+SrLNmopL9AgPUufkUii/xEt8jKAyik= Received: from debian.fritz.box ([93.184.186.109]) by smtp.gmail.com with ESMTPSA id k23-20020a05640212d700b005612987a525sm4003913edx.89.2024.02.13.13.40.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 13:40:25 -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 v6 net-next 05/14] net: phy: marvell-88q2xxx: add driver for the Marvell 88Q2220 PHY Date: Tue, 13 Feb 2024 22:39:44 +0100 Message-Id: <20240213213955.178762-6-dima.fedrau@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240213213955.178762-1-dima.fedrau@gmail.com> References: <20240213213955.178762-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 Signed-off-by: Dimitri Fedrau Tested-by: Gregor Herburger --- 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 Tue Feb 13 21:39: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: 13555695 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F5106313F; Tue, 13 Feb 2024 21:40:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707860432; cv=none; b=eLrQrcIF4NoqAqL9CGYrk5m2OeVr4Rm45UOfVvT8CdWayQJiAi1wC8syeI1wOML+4HxaVhTz27BQ3TUDvBpiuJrCsSac1niWc1SIKP+F2Y2vZ3zouPuA7LFQ77Viw8MX9lVbTV5y8Dku/LeRsLfekUiDt4ekI/6wwUtJ7z1aRWw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707860432; c=relaxed/simple; bh=APHd53FETp7bMcTra6Q2uekzr3ZPbBpRLKIx89mhIt0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Ts8BWz1x3D4xelRtqjFop8WySHkyTIQz6POxht2dcJjDaPgHVpddSb/askCOMCuBNMvt8GrAjLoov50vpAtFXCw0u7Ymtg/Uma/DJrjc21RXibzE/n7RLCiL6u6ilFf+23D1R3F0MfdlxDeybiBSPJ3eKSkIRMo5dvPrQ2AXvzU= 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=MXtoKxsV; arc=none smtp.client-ip=209.85.208.51 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="MXtoKxsV" Received: by mail-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-5621f7c86c9so381533a12.0; Tue, 13 Feb 2024 13:40:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707860428; x=1708465228; 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=MXtoKxsVpNyhaUpj05lt7yBw+SO27dChph5lKtK0kB/r1h/59C68VzwS6hAY2qWLtR gZMMv92UCVd//17klB90YP4m6ww1fFtVMWar48u52fMI2ma24Ft3a3c4sIolgFR6R7Y+ I+KvqRc1xb3Zux7/hH5N3KkWWOKWBX877jyWCTCaYgWeThAkfDbRmaM63xKCWO+jeq5Q iFsUvD9LNEvNNR2GX2R2ItsSEDSJ5bUQIK9aVwdV2H65StoKpsCO+aPONPXoCIhEGSTs J5kdYAdlwyDUHCijenRMTZru7D1B5LmJn1gKnbAcEPsA+K3Ujf4nx9FAqEaOq09Wg992 +QvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707860428; x=1708465228; 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=ihfHhuEeN524hFkC4PMtOYzCoUA85dGcVW9O7qpSrRtGm4dk9XE10qpAVNKcJJ11wF Ie2EA5RWMU+R4Mtj4+uCrUmRYiFf8EPhnbQc5u2u7Lm86+5GVW7lfwSSdoaAzX5QEfYi bERDcy2bEYSAnOUvSMElcRWQlh6GyLy958KD4mGfRxkXWLvy5OXJpdKearSDO+KagvFO J92qFTZHX08N4n/IF1KCMMcCkU8iil/5RbzyBuWcZ3OE/Aorqm1lHMZ0kyv7NNDZ64wX C0FtligZCKizjpg2SalYNpzmueKeq9TYnnD+CuaLJzQBQQoshLN9CElFDmZTOevmQPGm jFqA== X-Forwarded-Encrypted: i=1; AJvYcCW4ldT2ZNE+hXn7IDgPxaS3NrCNk091kT7mmqQPTG2cYeVDviil8F41reEdCHygfkjMqcblEPCGSOm4ZZCkzHNXR7zt0PE62OxoiDS7r4hPdUa4K3+sr7fvp10Mosee5sD0GaUW X-Gm-Message-State: AOJu0YxKvI6GPA9oGE4h0m6x5Nn77SOsj1rz9DSFhjSYJo5AKjk85qJc gEh+M1Vrlk6b7/zV4SosQaie6UgTFdfG7S4m4qWfj5+MUrWvMTIv9KMj0FEb X-Google-Smtp-Source: AGHT+IEsiw9LiakDKx+HE8gNQekXad/bmbRJ7dPbAItqMXlU9UyC8KM/Eco+tRBt0xQjzvo+Apk0jg== X-Received: by 2002:aa7:d3cc:0:b0:561:f533:b7bb with SMTP id o12-20020aa7d3cc000000b00561f533b7bbmr70738edr.16.1707860428463; Tue, 13 Feb 2024 13:40:28 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXWjK6YYtbMEeAL+xQdpQymfXAu2FqNMF5xG39c84xiidTC6kOlZM/zJ/oTTzP4cH2FqHm+Y4kucXD9dsnlUmPkwG+ZEf4NPx11wfBs86PiCsTFOT2/wj9DTSrXoNpgOx0S0gn0ihsP9PzCyp/CI4ZLM86hUkj8O8sI6iU0XK19uf25uO/xbU4ASbWzLdWUXK3G5+GhG7wYk+Za6Z8XG9LxA6vyyGQw4NMDhiMwCjFboYVp5j+5Cwl5pI+z1iqkodd9NpabkjU9Yay4ZbhWCcrj8xcJR7kIkYZotEJtV7Qeg22+0YY+PDdUbuUL+aYQ/s2RzkYChtX9ZAGiwW/goNA1IGI= Received: from debian.fritz.box ([93.184.186.109]) by smtp.gmail.com with ESMTPSA id k23-20020a05640212d700b005612987a525sm4003913edx.89.2024.02.13.13.40.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 13:40:28 -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 v6 net-next 06/14] net: phy: marvell-88q2xxx: add interrupt support for link detection Date: Tue, 13 Feb 2024 22:39:45 +0100 Message-Id: <20240213213955.178762-7-dima.fedrau@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240213213955.178762-1-dima.fedrau@gmail.com> References: <20240213213955.178762-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 Tue Feb 13 21:39: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: 13555696 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (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 4110963405; Tue, 13 Feb 2024 21:40:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707860435; cv=none; b=u6vpkYuf2Sh8qSHlaNETos6n4HDiZs47FyR+FOewikKUA/U8bjG0FKZx3QN+im3d05lHCvzky7YHlWVpg0alXNsM/HxsEZDaJg4jlJxu+hWAV4b0ASwwG+2fbtXgR+Tz6MG9dmgE8opA1R+45LvENygyU5ujMfF30t4fqvi0mtI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707860435; c=relaxed/simple; bh=gF3/8s9rdHbLqFLOpYOvq2ihfs6x9vepRDOvp4fgqQw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PApg1x0XdD5n9pE/YI/YaumCMv1+IXibBEEv9Py0BtOUGRUp0j7/jTGhFlreb0GaDYh0miy8M6y8x5LYysiphHVg4B119Hy7ssnpL6OPy9WwEzCfv3OCVor2rp6TmhfSBmuR7yBrkF80HvD+d+v7ycbUKSdGgD2qYWhiHjHxgQ0= 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=a7Q9Vabi; arc=none smtp.client-ip=209.85.208.46 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="a7Q9Vabi" Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-562092d8135so1109671a12.3; Tue, 13 Feb 2024 13:40:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707860431; x=1708465231; 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=a7Q9VabitixcH+zk4fDn9LsKDHooTy4AYI6Fh2AQF05wI65gGDz0P78s6mvCmkw3Dk YIELNJevD/NxRjDwPLQrXZMpDFwbaIloexm09+XDu+rdJbDC49XX09IKX7rKS0/r3bso ob4X3JWV+BAcycXSYkFGMQFXsclGN2b1zzh6MMaS0f6J9XMZGoO0A7esjwVLQrKqluwa DkRClwkMI5TXN7i2NCGH6nliFsQI/UwPlziGOPt+RMyHcjg7niy+QXX9By1sYGC8Vnh4 x2cOus+2aL00uuTB6XeEpi1X2SySff4zy9uLRFZqKvpN9RuYsIchLyNPNzMY3UqYVM4v 4a7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707860431; x=1708465231; 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=o1X6buqKvmXLjf6sfMKuovj6HFfxW+DJEo8+K+67QiTG0QQSG3UJTUSMNnEkZwebMX R0MIR875eR228JaAa1OQDJzLCV2cKy0i6ir+SxJQbdWhMb/xsmeAcPNki40hooVdmd5z juocjrN/KDZCzV+/nPCWtZnNgcwnXADSyj/iAhtgMfiYORxRvJTIZYjyd9bWE1uH9Nss be7QdHYaO++vjFnuz95NmPrhuXtRlrHwEVGE1lhIYW9xpcUdrb3jzZjGJ/hwbLlGWTd/ ZU+Y05LgxdexXF+LF1hIHRoDTXkIRc0E1K7/us7mtRlHsnpY+u1dNbxI71qEOCVi9a6H C6aQ== X-Forwarded-Encrypted: i=1; AJvYcCX3GIetEPbe6ps5ACpADNcv9obDfMy4/0mzFLCUd73a/RzgqabKetOK0IhkVk1ghY3YiJGThxFQW8UT2sw8wVe1x9oWJR8rp5G97UoeQC1Avip6YO30+pT7qiZVd+CRTHAeiCCY X-Gm-Message-State: AOJu0Yx/t5v3ozirJy8HBXXWjDqiX6omnwhaziktsGWazasBRd3Cj2Lf jsxTWVQohKtaH8uuA+bEVJPaMO0wOsvtZFuxOfXMssLvfHS/rBKR X-Google-Smtp-Source: AGHT+IEJMc1vyqAvUkZlj04OkDPqcOi6uUp/jUrwB2UCcHIfyOZ7RKXL9TF8KBF2sBefPwkCSpJJMA== X-Received: by 2002:aa7:d40f:0:b0:561:347f:ec5e with SMTP id z15-20020aa7d40f000000b00561347fec5emr658984edq.32.1707860431349; Tue, 13 Feb 2024 13:40:31 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCV14mgLi7UAldNfOM7ldyU+z5AKMxT9vIVRrtCfdDFhRce6x/g8zjelO2mDlObMgoiw2QVv0jLgEDSRUaBnRR3oarP/ik89IPGODjEg9L1HliXXwcIe9Ney9T6Jd7DNVDaVgxpFgntrAOtXUkt9n6vwQdRLA/rgRLywrM1muX3te+s45fBqjyrHJG4I/eJrobXpYbeQFHf2xDr7b4HOrvJ8V35dzkFyFeYcUHn49YjLougZpBjLZN1Lr6iWTwxNYLlP3dyxiCOzTN9cw+h//FemK+uPhR05mSYv4kX1z66ddbmKdtOCBhl4GCZMLs+vmDUDJr7co25b8O1LJz61mHFDkAk= Received: from debian.fritz.box ([93.184.186.109]) by smtp.gmail.com with ESMTPSA id k23-20020a05640212d700b005612987a525sm4003913edx.89.2024.02.13.13.40.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 13:40:31 -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 v6 net-next 07/14] net: phy: marvell-88q2xxx: add suspend / resume ops Date: Tue, 13 Feb 2024 22:39:46 +0100 Message-Id: <20240213213955.178762-8-dima.fedrau@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240213213955.178762-1-dima.fedrau@gmail.com> References: <20240213213955.178762-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 Tue Feb 13 21:39: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: 13555697 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) (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 90BDD6341B; Tue, 13 Feb 2024 21:40:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707860438; cv=none; b=go2dc2payptg96ISDYluG9pD6XSXBonzCJwvP3gwQILDqhLLN663lIneljlcP3MjGZiRpv6JPsNLAocRz/JRT7e9+ExYp9Yif7zJENkFWqmrxKzPRLjJIBLQyLZ1LRLWwVIyYrj8qiRA4to/afnrbEdRPK/BeD5N/gmp/DxgZhg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707860438; c=relaxed/simple; bh=TTV3hCdYp8zmLN9u8rd4k02yWWJHTqp07hV2JU4mEPM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BDDuvvYMvRB5mCn+8MLIBoakF9qD8BSwbEEuWWjtenDOszt7cRvKiaSNG7W7abPwdMq8TvjAtpKBzk/rfNmFVMpJG3JvlLww+MDxJImn4qGgWlf2FHz0nYOe32JXo51bZcZExF/mJ+2CT6JFxk85AWPSz9KV5uobgdA3/DJGTv8= 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=TBXDdLJf; arc=none smtp.client-ip=209.85.208.180 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="TBXDdLJf" Received: by mail-lj1-f180.google.com with SMTP id 38308e7fff4ca-2d073b54359so71426911fa.0; Tue, 13 Feb 2024 13:40:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707860434; x=1708465234; 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=22OYUBeHLDk02R6s/5nnCTgcXdt4+AH9gPkoTxE03WU=; b=TBXDdLJfcSFcerYTJfzGH+FuYbleRdmCd8AUI6VQ0mfZUJ+RxG1YknebCRRyANkqDV fSYSpdgkEHuB2uGCLQIfM1WRh/mQ1ImQlvN91c8hV6OCAOkKDGZ5qvsDNB8IWjM7DpxU oKg/8GFCFD67W2z07v84rIi299szWjo6l+i/uXDB5x+NeSevaJJQG65ZJcZrLEZHQP2i +L7PmBH4DAXADPjsOGjW+p+T2zQF68gIO3Ql/1ZF3Bz/KER54/NfDxDf5ZmZ1RudsOlt iqwKGn8vn6A7tJN6MT/sOabha+7p02z+qV9edpdyrIvxC/tx3Rr/2q0WiVhiCGv/Dr3p uJjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707860434; x=1708465234; 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=22OYUBeHLDk02R6s/5nnCTgcXdt4+AH9gPkoTxE03WU=; b=f+9JmsjbHWsDf80gLvkbCDq0PyKye+u8rK/T2At+MjSWFBHnWlg17s1WmdPddti5nS Cdt3to98nUil2khZMiIh8Ot5hmvZaq5aAdNnymKPtFIlsC6AKseY+pO9T+QLpXWX9kxx /JEn31wLBdIzQh9JN5OjWZrZiCQdSMJyGayt2zoD8Dn+vkmehl7wTY964zy03Fb9eHE0 GMEPpMyvspHgOx/+em2AchYUssqTCf9cUu08E/wkcfH3yNb00WTu87kSB4io5tcxvSre /lvzP6aEz/+vfYkX5itqW1lw+rj+OdRknn0TvJ7ZAOmm5KKudb/+JlvIX8qrjJMV6i/W 8ubw== X-Forwarded-Encrypted: i=1; AJvYcCW8Coz8G2i3GRv3HzxpgC/mmhUGQZEScQit/zEALXYfp7/2MmLJMp0vcD/8qqBc3dRpZ5r3/+HBY11dD7pztofLD7QBVvWcu/5dWDXHZUQpWEmcoMsYtHJoOHNa2UUcG74vhLMzCEM/83TGx7g7VpdyleNd+Dt0/5pVgTlcdxJTuMo= X-Gm-Message-State: AOJu0Yy5nu9kFqy0T8STG812+moH/lrI+iOFte/5f0soFVsab9HiQqg2 YZSwugDik2UnVuvyByzaOr0ETAezdjd/HhtnmOBgdgIqiT8UdCr6 X-Google-Smtp-Source: AGHT+IGidetQKhpKj04a/nj4O4QTfDyYIXsUAIWtuuUpS/JXAG3U2H8WNneLBRmANTuM1eF3hP9FLg== X-Received: by 2002:a2e:87ce:0:b0:2d1:12bb:6613 with SMTP id v14-20020a2e87ce000000b002d112bb6613mr414351ljj.30.1707860434534; Tue, 13 Feb 2024 13:40:34 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUd3FWo2iVNYKorPyBgJDq6gw67ZeLhGlu1dx3DMj4r0p98dJvGkxCpbn/uRrrnU7nBZv08ys8OOULm9d2KmwMnYcS6+93dbb6OxC7Y+d6oNgdD3R80c1DB0Aqo0Yq7z9C9sLARxClInPWAN6a3nc/w7RrJPHQDCtjWKsdeh1W6he1wwi3b/J+/cVNPejgyj0dDnYHi2kBK1Ia9W1nVpnajVIyrW7gDw/yaU93IHa7LWi111l94D6wBtDuikgeSFHbqf8NqshCYiHUuaoUn6tqES0Jl31lGYsP2vcf3lVuVU4LZ7lYQqtzcHisUccCQ8JNPtYxC3AhY3hFNh+EKqu4bvh0UcXRTgSkTtrcF3maEPqOfc+MOwDSASZT/L2SuvA3XiTPgDbsHOJvd0/hdQn3+hNoZxhIwWToRUS+HDnoAw+LkJX/KDQ== Received: from debian.fritz.box ([93.184.186.109]) by smtp.gmail.com with ESMTPSA id k23-20020a05640212d700b005612987a525sm4003913edx.89.2024.02.13.13.40.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 13:40:34 -0800 (PST) From: Dimitri Fedrau To: Cc: Dimitri Fedrau , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jean Delvare , Guenter Roeck , Stefan Eichenberger , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org Subject: [PATCH v6 net-next 08/14] net: phy: marvell-88q2xxx: add support for temperature sensor Date: Tue, 13 Feb 2024 22:39:47 +0100 Message-Id: <20240213213955.178762-9-dima.fedrau@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240213213955.178762-1-dima.fedrau@gmail.com> References: <20240213213955.178762-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. Signed-off-by: Dimitri Fedrau Reviewed-by: Guenter Roeck Reviewed-by: Andrew Lunn --- 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 9e2672800f0b..f21f46ea736b 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 Tue Feb 13 21:39: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: 13555698 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.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 398DD64A8A; Tue, 13 Feb 2024 21:40:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707860441; cv=none; b=nfmD522N7L2ypRQX+qxLrRTyPxXZSSq0ZUeTqGX0zmqtc9LuPdewMS7LId5e2uDQ27dIXnKytQRVA424ZiaRMikv9bYNVVuDohjJgws62uOttuS1y7JdQeHTaVi7Lc6EgKITx/Ti1RkejUE1IeuawpaA0+dLxlVUu4JbKGZvRUs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707860441; c=relaxed/simple; bh=/CDF4FFzzPAWghGNTUm7S6kFdUaIxw2+IbQwN7IiNFE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=fvJHKlg+A379p6e/wupY86sKoe3J8n+lAuj9xfH+lJO0AA/UjxMZBZX4N3TyiHIoN9JiafFAERJFIPSdtLRkHT9p/4NuaeGfuZuqRsrhrvKlVW7MZFQdDwPVpUcZR5OwYMyjfRe3FrFhFtBAe792wua5QD+snIP4RKpAMtxsLQM= 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=lrK2JmOo; arc=none smtp.client-ip=209.85.208.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="lrK2JmOo" Received: by mail-ed1-f52.google.com with SMTP id 4fb4d7f45d1cf-5621f7c86c9so381744a12.0; Tue, 13 Feb 2024 13:40:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707860437; x=1708465237; 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=hGBYqZsltXYC+5JrS5KQP7H6qx5a94ybTWliBzFTS6A=; b=lrK2JmOouClswcJbk3fcqnk0hDnjTLPNon97VeSk6/V4BdMCtiy0fR4v9xBN8IjscP sLT0ETK6grOzfJhQm+fFRnj0N8V69jKOe1t62poKnRgVT0KVnfCHRVvQt3bdXlL69adu HxO9HxPq+JKOZ1YWMQ11F7emlmpHQoPHMfKBgdYpjlh811qxob/4eNyDUhb+pVGhNOPw KJ6eLv590HtSM5LGa+C4gyy2ff84k9FcGZ1yxS8J5rum6p8Wn/butRpdYgv71pn5XT0E ujxCuz7t3wIWWtAGvBKr2guUd1a9JHpi0AtyojyRysGRvXQiBrPfguy6QrMKo1SEbLpJ SP/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707860437; x=1708465237; 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=hGBYqZsltXYC+5JrS5KQP7H6qx5a94ybTWliBzFTS6A=; b=U+d21xNDfyDhyi+G2JCZyD57XcaNPToa+dbbGNS1Trogtt4aJRC7rQ9DO3UCwTwJ2/ mWLQ5XwnJND9zBYUNUlNIiRREx8ayh/zr5VlMYEC90KAg36xIhJN6OIlsgOsjmE1Zr9y IZ9LeSWtsiJ/SVLwMHahoyV26+4AoC3DKFjC7pBIeJjEXV1prkoA/QiNoehIk9L0ATbO WmFLBz9o81sFEAgsdLYrohKIN2f4Tma7fS/x1PogA24a89Y3G3hb9gP8Vly+1dX15ag8 +WwlYkc4+QipG10dvD6urpH1ecxtOi8HsamQwPosH58BfibOjCpPq4unmN6L/4APzrJS AfXA== X-Forwarded-Encrypted: i=1; AJvYcCVSeXP7zit6Ff+UzsOOI6CGH61w8O3ISf3hM+peAvE0O7qpDvhx0/dttODN/JBaU61yC4om9nqf0as+ZHZ8VV1BBqJrzrWQ6HANO5p1ynrZeYYcXJHa6fM5ZA9FLsMNaJB11lKc X-Gm-Message-State: AOJu0Yzi6ms1auEB5cP5/v1zOkl8KP/GcVQkDJ22hzpltvpYzgnt92xB R2CjlRFOcQH6onKbKgTgG/mlBUjDMXXj1FYHuyRWaaH4IGQK8zDu X-Google-Smtp-Source: AGHT+IE/+U5swRexCsL5tU/3AZadAypcal31siC7UkLGZQbNwh7s/LUVnCtU9afpwvblc8QX4Hl0Zw== X-Received: by 2002:a05:6402:3709:b0:562:6198:1aaa with SMTP id ek9-20020a056402370900b0056261981aaamr60032edb.19.1707860437559; Tue, 13 Feb 2024 13:40:37 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVC+m9nI/HfsehLhahkuDV7kBkWlEdSssPeoMyRGyZMg5gh3vMEqHLYfLOVUYJsHhJ9FZ0nBgYscGKWX1r4ni6l/2Feu8JLyd/swcaNrhqkAQBi7uHIVpUbh13QcJrgwbST5hg0quWamORZt625ysC6jPah/8RSrUTprt8+wd2o7A0Endo7bS/4h7IwrRC0h6k/DF/QyGiJkfTzVGewGmMNbiFoSc20gkwGjzg4MxQWI4evN3hP+iyfs4pOLnRYls+oaIL3xa3R/zT2MJ7s40ZZUNxRkdTcGi1Ch9OrY2/WQUJhDUfp8F9B5VvK61blAeGSoyX79qD4asSGks41m2Whcgw= Received: from debian.fritz.box ([93.184.186.109]) by smtp.gmail.com with ESMTPSA id k23-20020a05640212d700b005612987a525sm4003913edx.89.2024.02.13.13.40.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 13:40:37 -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 v6 net-next 09/14] net: phy: marvell-88q2xxx: add cable test support Date: Tue, 13 Feb 2024 22:39:48 +0100 Message-Id: <20240213213955.178762-10-dima.fedrau@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240213213955.178762-1-dima.fedrau@gmail.com> References: <20240213213955.178762-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 --- drivers/net/phy/marvell-88q2xxx.c | 97 +++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) diff --git a/drivers/net/phy/marvell-88q2xxx.c b/drivers/net/phy/marvell-88q2xxx.c index 2ca1b47e8f8f..93a6a9dff722 100644 --- a/drivers/net/phy/marvell-88q2xxx.c +++ b/drivers/net/phy/marvell-88q2xxx.c @@ -72,6 +72,26 @@ #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_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 +735,80 @@ 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; + + return phy_write_mmd(phydev, MDIO_MMD_PCS, MDIO_MMD_PCS_MV_TDR_STATUS, + MDIO_MMD_PCS_MV_TDR_STATUS_ON); +} + +static int mv88q222x_cable_test_get_status(struct phy_device *phydev, + bool *finished) +{ + int ret; + u32 dist; + + ret = phy_read_mmd(phydev, MDIO_MMD_PCS, MDIO_MMD_PCS_MV_TDR_STATUS); + if (ret < 0) + return ret; + + *finished = true; + /* fault length in meters */ + dist = FIELD_GET(MDIO_MMD_PCS_MV_TDR_STATUS_DIST_MASK, ret) * 100; + switch (ret & 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; + case MDIO_MMD_PCS_MV_TDR_STATUS_VCT_STAT_IN_PROGR: + *finished = false; + break; + default: + ethnl_cable_test_result(phydev, ETHTOOL_A_CABLE_PAIR_A, + ETHTOOL_A_CABLE_RESULT_CODE_UNSPEC); + } + + if (*finished) + return phy_write_mmd(phydev, MDIO_MMD_PCS, + MDIO_MMD_PCS_MV_TDR_RESET, + MDIO_MMD_PCS_MV_TDR_RESET_TDR_RST | 0xd90); + + return 0; +} + static struct phy_driver mv88q2xxx_driver[] = { { .phy_id = MARVELL_PHY_ID_88Q2110, @@ -732,6 +826,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 +837,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 Tue Feb 13 21:39: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: 13555699 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 4A57164CE6; Tue, 13 Feb 2024 21:40:42 +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=1707860443; cv=none; b=IzCuL/sHnd8gFJdGh9rtQ1wkks5eViiPZLEDZafflCITOkNfvCsCY7yho0ygQhd9Pyo2afmb/Ekil/WzeLQ+PDZo8oM4dbqTcHupWLL1BGlBXL8lJ1udTL8pv6zPIct0de+2qn0HQps0ECuUm4ibLb4MxO7wzkZ0JETGl8yNEUI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707860443; c=relaxed/simple; bh=Dv4JQqXsRVOgyAhAhDhlHkEqIxr/ZQjBsmY/eJgPTZA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=p02cQCpPEQzpz9qDNMLs3Q7uh79vZZuO8O9FZutlw24MXEDmA/vIJVuDhNduQvdwtouVA9W0fkP4DI3/Ku3h9awe4PDBnAKvdJsKLyYoy/Ov1S35F0j6u5RlKVihMVBiU0iNRFh7mSPYTZqrHrsVNBI1X6A2uoeJUCVaWI37ga4= 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=YkO1oyIb; 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="YkO1oyIb" Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-5610c233b95so5355030a12.0; Tue, 13 Feb 2024 13:40:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707860440; x=1708465240; 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=ia2MQQyP30BsuKczKS1Eq7Fn1i/O5F4KTy96rfmHjic=; b=YkO1oyIbmyFOp+Jd7l32Wehgco1evWIBVhMESHuleGsEu5NzndDOHUcaHwEm4LREds zlAilvqyEBfYdelAYVjfxA6CNambt6+XjTcRviIqQBqmHqlJcnsEseyFpWlk6JtXkQgs Rk/uEea2hTf8qASkCbOnmlzDDmTfn+jD7fGpADBDtWW37ozl3Bp5m0L7/kTHDznq5Gpx WuOJUrWIWsJqI938jM4wni3ORSv82nBEaSGFi1pjJXlFndZizmG2cQFm48dKVr6C1Sy4 5U11EjS/W6r0yc8garV7J1a41+0s5Lc6cZy3T5XOV2q2HJrdFzwRUMVosiHVfwUtEUmy BECQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707860440; x=1708465240; 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=ia2MQQyP30BsuKczKS1Eq7Fn1i/O5F4KTy96rfmHjic=; b=KzNEppCkFe1dWCogMyVeCGeOLyK+ImyAljoePO6I8Uauwds5p4jHQ6wKNHBMXVLQwP MryqKTyBjFLjfdh+PK7Tf+myaJziln3GYsFDbdzWhicwFPaKk2l7AR+2oq31xpWvC06o GsdrPDYw6B65nBlysbto6QYdvAnpY4cQy19WL3lxMkSqcQIqRxUURUmwl38qa5N8b572 w0GRs+OZ5kg39CJ0vx8myAWWUksig8djqJZM2wwQOSud1HmEIAH+OIkqrhJe0HW23+1r j3CEUPnAzJWzC+Kh7AgiLnpmk2eHosncZqzOHtgR1jpEtnJUGgwlWq20NUo1UYRwZQUV sCTg== X-Forwarded-Encrypted: i=1; AJvYcCXpr8Ob5DyD0TA4WZKYi2+2l6r0WE4eQoMzhmIVAWlplztEkJ2MB8o8Kws869fMvv1XxZ4/1/kOgAak3kWLRg88mkVpkFPLYYkc8qjMmaLdOuRhovlIOhRFj9jGk9Z3ZZCvQ9N/ X-Gm-Message-State: AOJu0YzoeOYc6I8ErO8L8eTEMpTQvzpT22RDJ9zJy8yce88G6BB76v9e 48bWSe2tGkxJqIng9t/JglLcvO4fUMfeeHkxpA5wRwEx6GvMcfIt X-Google-Smtp-Source: AGHT+IGSUKgROOhvq4eEy7dlbmODrpkNJVRJyCklGl9cVZ6ZKDkGWrIUrU9iAZlz8H9VuvXy0uI31w== X-Received: by 2002:a05:6402:505:b0:55f:c930:8b8a with SMTP id m5-20020a056402050500b0055fc9308b8amr594471edv.6.1707860440647; Tue, 13 Feb 2024 13:40:40 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUvQNYxBg9kVTpyiqL0lglnt2jwlwzdZ0sXU0XWDprqFV8g+85awMjZgFdUaW7UnRM9QSd2+o2X9F55zFATpQQubL72GvX9FBv22FDr0SbPoaIiaDmZEqV0OKoxoUZBwGjtllADKTVVUBbGqPz/PHq0A15XcONobuCWUR8Q0MLJK1+DN/hpHvzgkSdZn/uThHhVrU5Ab97LmIrSjNzI9Kr/lRiSIZPgsOsN5uSaDqBam/OvnOPoIksR8L8KisiOcXMEYf6MPF22Q9Wk0ycq/z518THRCWKGERuaKYjjNypgFeeXuMaeLHl9btASAEgdpuw/kLlN+e0Ay+wMx62yFiklrtQ= Received: from debian.fritz.box ([93.184.186.109]) by smtp.gmail.com with ESMTPSA id k23-20020a05640212d700b005612987a525sm4003913edx.89.2024.02.13.13.40.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 13:40:40 -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 v6 net-next 10/14] net: phy: marvell-88q2xxx: make mv88q2xxx_config_aneg generic Date: Tue, 13 Feb 2024 22:39:49 +0100 Message-Id: <20240213213955.178762-11-dima.fedrau@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240213213955.178762-1-dima.fedrau@gmail.com> References: <20240213213955.178762-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 93a6a9dff722..fa75d34d1d04 100644 --- a/drivers/net/phy/marvell-88q2xxx.c +++ b/drivers/net/phy/marvell-88q2xxx.c @@ -364,7 +364,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 Tue Feb 13 21:39: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: 13555700 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) (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 4F90D657A9; Tue, 13 Feb 2024 21:40:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707860447; cv=none; b=VNkEXHcX7PHYXpLnXAaPXi94AaFyNix9z7DfqWZFX6+BJhCOP1wUEhXfpv/7580m0pAiixeZa/JMc5EcDsqEmXyT3ceuxBHqwP3GdujaRtynLwTW3t41jMB1IKLizB4ALjuIRI8rJT0aJJ0z71aE8865PFWJS25PpPqSfA3VDrA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707860447; c=relaxed/simple; bh=HvCSJOpeH5pQW9J3p8kulTcz0xoYilN7jOhQKK+kq4Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=XtXl3MY/1DU/JeB8/k+nks9rwbjP24351FsmNtPX6+4PJBG9afejqiFng86G3jmrC1uITymn6xEX1ut570tXLPd39XDu4ow9iBl/PpdzjK8GfmojXQZXbwtMB57SUzjcOtpS/Gwf6BswnOPhMq5Ip4pN/ddPImDbQVv7dTZbX4s= 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=PEdMQfwg; arc=none smtp.client-ip=209.85.208.54 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="PEdMQfwg" Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-561f4bc306fso1370902a12.1; Tue, 13 Feb 2024 13:40:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707860443; x=1708465243; 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=LJuPqD+a90aENqljuSvhOuOykmDYIIKd0gcpkEo0slI=; b=PEdMQfwg29DO7myQTNCDiRsM8zGq8uYt289TiOh8+QgXafHXr2KYA6tGwA/LwQl8d/ mPYmLjgMB4aiWyur2hI2QsCnZBqkC33MB5tcxnMGo0h7GJhZbAzgV1bhPFPrZdHTJWig 8noEwY8g5MFJoSy6JCciPiZYOtlgMYGM8jInE9ap3M2oOOISmz4yYFX7Gp9j5Ku85lle NViIlE0RD1ZczpW33T0Sa6PzujwPLS9nxi549OlkwAT6tbwMhAzdMn/+c6PRHDHR92bM Ab95I6Af5xq0tx9Nwr/wHoBd0IwAMdYSxZ5C8IUN3s+lZ5Maa82BE7tIRHpi2vs2bsbH JUIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707860443; x=1708465243; 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=LJuPqD+a90aENqljuSvhOuOykmDYIIKd0gcpkEo0slI=; b=Ar5iyKcuoYJieK4O0ThhIFe3RXsTkk7nHkuAWyHC9PxiXugajo0yEZEkqIY/hbu98G OcYdd3qFIaapi9YWXws7SSCdGuaOEe33AqSiR7nmD+uKFSayZajDxOtpWkisySRwNHa1 8ysepAHNFQl/JOeXrwHrx/KREk7cS71NMbZXxscNRkpJPtl+gcbQ6H5aGQJUbXRrGLJ7 Aksq0z15xdWGcnPz9NI9W5AhMDZdIr81gnjxO2bSje+zCLD9+2PCYlzLWpPLQKGdB2pO qb9A3hgsPyQ3zl5lysN7gxBlWKJ/ijuRksZg7SMAXpHp8Vo8W9ve6gs4u9vgeFULtZAb etig== X-Forwarded-Encrypted: i=1; AJvYcCWJF41xVrOsUAv9rAA1WnI8zvR8mhLvMnIKm1raZ7hYms2+IgJ8+71jcbbcAtFzgNLvf0uaqyzbVdmSRVg9zS7QAJhoMtIkrvZziFkWyL+tYP65agGUh884NluqzpDAaT9xvZhB X-Gm-Message-State: AOJu0Yz/X0on6zpA2z88HNtgUeijlDLCUmt2sFPbT/gBo7Eh+GhXyPXe EQCjSNwjFYfuvkps9jTH8pO5LEXhuzrnPuqMl1shMspNMT5o+fdA X-Google-Smtp-Source: AGHT+IE9Vrkq8h2N6UyYOUpULJAvqduP2Nvme8pWxvSZnqu2zuitwxMDCxECyGXFW9zejXbYND4ccw== X-Received: by 2002:aa7:da18:0:b0:560:d8f:7def with SMTP id r24-20020aa7da18000000b005600d8f7defmr667803eds.17.1707860443602; Tue, 13 Feb 2024 13:40:43 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUTwELy5w9Mom+o2eWrZeYJjg4s1I8kQcU2nOtsNkCFthdwU+s7XPQzOEC+YKJLWYFoIdMi87ay5lQt437kCwPtEkVkAKc7ELDiHTnND3GDHBAvJK0Ozv43i0FCa6ldkaIZBKbJ3kwQy0YijQJI/TpTEHfJI55ChRNqE7IZhN7YxzaD6L3LdIS1tI8ENQJJT18xt1IrJOUfVby3/oRcpIte3+8aW807LV7I/ImqQx3B1nT/mtfaIiUB4vFJWe1iQne3kgsHMD/Lv1cgqdmz8Kw1gTTj0UHAp7FN1zN+fj5nuZafswDBuLO7EBy3A09VBul1707OI1NTOK1u4oMfSIlvqFc= Received: from debian.fritz.box ([93.184.186.109]) by smtp.gmail.com with ESMTPSA id k23-20020a05640212d700b005612987a525sm4003913edx.89.2024.02.13.13.40.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 13:40:43 -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 v6 net-next 11/14] net: phy: marvell-88q2xxx: switch to mv88q2xxx_config_aneg Date: Tue, 13 Feb 2024 22:39:50 +0100 Message-Id: <20240213213955.178762-12-dima.fedrau@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240213213955.178762-1-dima.fedrau@gmail.com> References: <20240213213955.178762-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 fa75d34d1d04..58140dfd75cb 100644 --- a/drivers/net/phy/marvell-88q2xxx.c +++ b/drivers/net/phy/marvell-88q2xxx.c @@ -685,17 +685,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; @@ -829,7 +818,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 Tue Feb 13 21:39: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: 13555701 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (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 4360065BC3; Tue, 13 Feb 2024 21:40:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707860449; cv=none; b=IcT9Y9Gu2vb3eEdcSNbR5+kEOwjr0PMmPiU017BzgO1whjT/x+IyM8fwElAOmmXtAsA1CzzMVho2rc551sA+Uqoq+1HNacvLYUDcgvnfEGHpyJAs5DSFq/eFXHutWXZjTAtHVToHTnLmZWn7PymWntNPob1Z57Z4dSRmSuZrcS4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707860449; c=relaxed/simple; bh=zjOBgi4Hrdw7U4QoP3k6BIf6OXaan7rQIvpuLsKQHzU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=pkc7USEKpK9GP6XCOmNJizjaUW6T/xgU6b2DZ1Rx573aRXCbCARfi4T2byjP5EDFJqU6H8K3B5g2JzEBifLTdWx8AiijhrrKqWXOwpoWZzxYSezfH1JSdst0gBEeLk/bj3Csx8t3pQJt1PlYciZNflWBMh92zIK7q66776pv1VA= 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=fSuvsoOH; arc=none smtp.client-ip=209.85.208.46 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="fSuvsoOH" Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-55a179f5fa1so6552227a12.0; Tue, 13 Feb 2024 13:40:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707860446; x=1708465246; 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=WgXAQTRVrWScNTXURozFbod63VKwU8QH9NP3SL+91b8=; b=fSuvsoOHIOsiZlXt+RTlrAWtZK/wfbavhzsK2RWp2dMfoDpA8OBJVBP7BW/iXXLKpi ioaeL+SHv10iO504clNXY/rJJNKey63fZY+usguJ8Ma0dMNQmRtFMJ8N54XBqPONg0OT a3xA2iBrc2uWw1+TWV9LYaN2n0Bq8R/BloUz8VzYExGDvfs6Zp3gj1J4r3/DYZMUPWSI /ULhrT8tQJjX+mrjKB2UKsw/74YaJ3tXI6wZKN8ba41MBKp/jt/lKJq19NIWPDLGyywa wH5B3J4JTckc5W6p9gD1rsjWZWsZXeaea2pBc7oZJ1QxY5uKeTxv87oZJb+F5y5KWHnU tHoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707860446; x=1708465246; 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=WgXAQTRVrWScNTXURozFbod63VKwU8QH9NP3SL+91b8=; b=CR7u2bSabhkoI+cSQi+6kRypBP8vA0qopZt8UiXq5KXMU4LOLKP/dbiw/uebmfT8p0 wZ0ePWtAVq0QjJyKTQD7lqIEVlm2LdSH4bFvkEYGpzOejjWeC6o9EhaIquORTol3k/Gn zNOi8T/2e6IDvpTJ4pqvkADL4ENrdiqTdDdxzFEcqRTZVop6ZutvbGiXjTTYEwrSmgbn SAdxpKea+nMCGvSO6dCy6g6wb1pZV1mIBTZC8hsiKa9KuAruobt7m5UD2pUCjEA4COMa 3oUlgx8N3RVhbA4t8a+VcOp2WkJVdVwhnIqNdEDLJXbyDyG/c8hsOggGSI/Y09ekGOzD V/1w== X-Forwarded-Encrypted: i=1; AJvYcCXNXNwwNpv8W+DBnEiaz90xJaU8JviE6BExxPk0GQ9vorDYIou/XvkCdiKxo3MGFg992v3hNTctetORBU4VBsv5IVdxhwN62Hg2oUPHgQuXixUFpUwAxcq+FcoLbILV5u4SBFoY X-Gm-Message-State: AOJu0YwMBVAV0ovlFIuzpAT1PkGhmrDclHnufSgy8dU4uOh7fu0cWke3 UXP2oeKe/Qyz1TVKNfn7qYvMSTm5DD7TMXStmsEERwORZQjBqTCM X-Google-Smtp-Source: AGHT+IFjPDXdbCGM179BEc59/bniy63XsWiKxumFZaSWWQmBoWnGtFKX4oao3YDW5cdaJED3Ml+78A== X-Received: by 2002:aa7:dcc1:0:b0:55f:31f7:4279 with SMTP id w1-20020aa7dcc1000000b0055f31f74279mr659292edu.12.1707860446505; Tue, 13 Feb 2024 13:40:46 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVMGXPawz8pRYRevPBeF5CP7Zz3SJ0gO8Ru3kc7hmgdFoQxyadt5ncflR8RA1q8oAhApmiDPzINd3+nq/evts1C6kHEugJQ+9D0LpePwi+3+5rTAKKFFr09HyoSatlLY6fgm6GA8DjZ/T9jqGzQ9caHXbclAzEygxY4XVtyGlCnGyELOwEZb8Q7sjEbPh+8L1hVsWuCpjwXka97mka3x3sLXxArP7PmhCjiy5kQbhYdq0a34oGu16kU+a8rMlhReIHYAeyw9zU5+I5DbUnizaKEgy6VlHY+xdBsKVqteU0nKnFY27mxJ8WKtsUp/oZ1varRe+xARqWdR04aYd7zygfX29c= Received: from debian.fritz.box ([93.184.186.109]) by smtp.gmail.com with ESMTPSA id k23-20020a05640212d700b005612987a525sm4003913edx.89.2024.02.13.13.40.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 13:40:46 -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 v6 net-next 12/14] net: phy: marvell-88q2xxx: cleanup mv88q2xxx_config_init Date: Tue, 13 Feb 2024 22:39:51 +0100 Message-Id: <20240213213955.178762-13-dima.fedrau@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240213213955.178762-1-dima.fedrau@gmail.com> References: <20240213213955.178762-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 Signed-off-by: Dimitri Fedrau Tested-by: Stefan Eichenberger --- 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 58140dfd75cb..64b96ca83a0f 100644 --- a/drivers/net/phy/marvell-88q2xxx.c +++ b/drivers/net/phy/marvell-88q2xxx.c @@ -369,20 +369,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 Tue Feb 13 21:39:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dimitri Fedrau X-Patchwork-Id: 13555702 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 353EB62161; Tue, 13 Feb 2024 21:40:50 +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=1707860452; cv=none; b=DSjjVEQvlbqkwqJyY8FJBthq9Xgs52zuNQSRXBD5aaQyH2DRw8l+7rg3FtXvNLTtSd4AYPiaAWJy3SKujKdB8inbGmXwKYoEoiEbmcH/K/1BrHm2x9ULPIS3q2bYhNZ+bWUIoGggTnU+t1Vcu6GmglQKAcZdKNzxcxJOTwTReMQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707860452; c=relaxed/simple; bh=pRcdcoxkVJGtQ6+zrBcyvGZMZIiduD7CkrhQ43AOJAU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=WBo4xP3bvIpQDPl54jg0i6dYpJE51CFsl5YfBrayLp/Tf683ReTwEwKz+VdWT6OmEkkrd/jsuAFcx+Msc67q9cPx3xhGsoiAKy+Fv2B1kKYL3H1lKXGS4IqgN9eHHuPrPOV9puAtRIRJt7f/cphuqWH1Op2cN1RCNMWCvfMNEKQ= 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=noK6NEm/; 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="noK6NEm/" Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-55ee686b5d5so6499134a12.0; Tue, 13 Feb 2024 13:40:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707860449; x=1708465249; 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=R8PqblJIkzW09NwcQ9gaSDOjPumdVAsEfe3x36fJn/I=; b=noK6NEm/pdnMoHber9tXtDRZjOB4kTkLolNOWD1HiKCyayT5eXGKr7xxxas6o9SHo0 w8AOp9b7imtms0sRaWN6DVaMifDQyEV/7HhJ7KvpwflvehAjdROmFzcXdDSDyZfzyz0X qJ9q2WT1THgaoMkyZASyt50V/pCGu+eLO57UEg7ZuCcfq0Qi4tysSISnag081+7hANfp FMOdGfBATo9t7DaW9xsvietKuBHvK6sfFOUV8Uyb5nXrXQBcl1fWfDf6WhyIXMOHWOnk FL3jAR049amEuGBpkMrF5iqiE2YBNT+WTUVcdHS16lFCecLlTNc3kvsAdJBzg+rVtape L9lA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707860449; x=1708465249; 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=R8PqblJIkzW09NwcQ9gaSDOjPumdVAsEfe3x36fJn/I=; b=gCxY417ZR0ctxBUGDADgYQ38njsQsrYR2gX17mWLmfiZx2DuMWsfv9Nbi4GfeRRnP5 7jRFLDqhPszF931iVy/XnaYzrJCKlkvfb1QmNj+Cm5KOXOWZtU5NfP1AuvlfU1kkxwOt Bei6U/GfqDhXyR6w5WC00Z3/OPtFVPJevpZyboy5mGx18BuNmpZbIJYUSDS68EoHYGNc mTtWVET9PXDZ/hLRmZSQt70EgCiz09x19OkP8YneE1MwmAl2Q6k/u37VSxfMv5eQa6a6 bjrfKhiU/cyKOBf4Xj2VdLePO9octWby7rdwAor9Qqv9p//ZKd4PMfhKw4TmMK5Dym3z 5jeg== X-Forwarded-Encrypted: i=1; AJvYcCVZRjtSFOTWkp0CJER7XzKFTXE9m3uI/bf+fpES5H24umAZv49Lw9UhaqwpB8gKcM7XyeMx5Re8KSJFnHfVfBLSW9jRPRBIcb6kLToBbDnWtRrYgdCWPmKbe+2E4GGtsL4TxSnj X-Gm-Message-State: AOJu0YxYJAI0NUZvs8ibNbFX8tRQEednTPFlwftERgQMkWT06RP6ZNEp kTC/UmyELx0Qn9FECBNN+iXAPKuf+WpirIW/Dn1QmLQ4iI/h4rtg X-Google-Smtp-Source: AGHT+IEVuEMoAI90cYOn23eXM8cyYaoRlmTxsYuyz+NAaVvHgsAM44eRVWnFYav3+6hC07/n79XPtw== X-Received: by 2002:aa7:c1d2:0:b0:560:64f4:cbd1 with SMTP id d18-20020aa7c1d2000000b0056064f4cbd1mr677922edp.19.1707860449430; Tue, 13 Feb 2024 13:40:49 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVdmb7A2UKEC+H/R6KQtwBPExW7oB3qaBGB7q4U40CzGdIY1GkiyzYVh5fTq6NZmQD0Q3PDGsrY7gDQ9rHHHXzcSEtpPnHMzfwNJKzKxhTbxvKLg8cUQV0IUXsk0a4H1swFTeO15/7XRFamqp6RnQRz+hjCTjESiyTNNXnqMTcUiF0gvjLZvVz3QysKj0gBhX6VcP34I1gR+e/4Ot29FpEjAL1t1S9+UIrSa+/YwuM+87/DVuBSdqEyuoT5+/JdF/hi7l32Jc9IIOizIJeRqwymHL4n5wAjQB4y74gZwFzatktkKEgUit1M9wlQvTDa2O8Ep2O3md8HO3myY3FDec0nxxE= Received: from debian.fritz.box ([93.184.186.109]) by smtp.gmail.com with ESMTPSA id k23-20020a05640212d700b005612987a525sm4003913edx.89.2024.02.13.13.40.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 13:40:49 -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 v6 net-next 13/14] net: phy: marvell-88q2xxx: remove duplicated assignment of pma_extable Date: Tue, 13 Feb 2024 22:39:52 +0100 Message-Id: <20240213213955.178762-14-dima.fedrau@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240213213955.178762-1-dima.fedrau@gmail.com> References: <20240213213955.178762-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. Signed-off-by: Dimitri Fedrau Reviewed-by: Andrew Lunn --- 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 64b96ca83a0f..7afaa693316f 100644 --- a/drivers/net/phy/marvell-88q2xxx.c +++ b/drivers/net/phy/marvell-88q2xxx.c @@ -700,12 +700,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. */ @@ -714,7 +708,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 Tue Feb 13 21:39:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dimitri Fedrau X-Patchwork-Id: 13555703 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1625869979; Tue, 13 Feb 2024 21:40:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707860455; cv=none; b=i9QCrGMpveJ7RAAK/qycygXIOsbVTygIGwPjggzO8u+mqsa3+e4dKmkWuNcAS+bZD8yJYmI8w08N6os4XMrah+C3N8dvi5Zg6ThTY0swEzEiEqoFuDouZ7n0wGL+LiHm7jzlGVgC4BblCSkmnWh4ciofCz7pNPrj8Opmz0PfGpA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707860455; c=relaxed/simple; bh=buFz+dlNRbQQ6/K1paWq40VmJqIW++d4iyTR0Ulizao=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=T7T0Lg1Zjev4FV6sP3JbUsx/HQhRAxxA2V9zwsHtdDu7Nbfo7R/lr9hXYbjzoea8M+r4dLs2OavrtwZiKVt6N+PhVOBBcsT+QFRu0C70B6MrSeFSsfRnztkIUGyzgjKx8ckbqfVtYzoQS9a7ke7h4msHBu/pXIQ1RUltKzqiG9E= 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=MvMwDxk0; arc=none smtp.client-ip=209.85.208.43 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="MvMwDxk0" Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-5620f15c3e5so970677a12.2; Tue, 13 Feb 2024 13:40:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707860452; x=1708465252; 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=bcJJ3FGefuRL57N+0mLK5i+7gqMGAlu+qKUm/Y2d5zY=; b=MvMwDxk0btZ8FTwJfft4m8T0BTMX4wMc0/w3Pvc4HES0ichGvDOPF3CqsOa3IgC+Ud MyC3gdJHJTGwgYICMXR/qT7DKEjOoBO8MaKhd6MfiuTSMQ4YeCNtcqZmlcV52MK9pOzn hEIjDHBYluUtL9XHGySqTmTzwz5JmowxEiX0emkSgQ1Le4TvD6pdFBv0E+BjRpIKa231 TcERe+msg8VHGHFYGHzTJEzmZSvZpRh2A7HoRjFOBfEc/1FDp5oPDoy4QulizcSyKCtH oVX5Yh3b84n6rvk0IhvJsWE76hy0LH0lXlD1PhdyuZt2/q1YJD6WDqIhsfoYvCbQbG/U gkdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707860452; x=1708465252; 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=bcJJ3FGefuRL57N+0mLK5i+7gqMGAlu+qKUm/Y2d5zY=; b=sMJBLqlWroWu4y5lq9goS3KfmJWqlGJ2TZuv9xWgAJwds2s3/4+zh8E3FFFt8/NoXR +h4Yr5ikH/congVPIjyHTGq71VY8MduX7qZL2e0q21EtGc6aiUkwYKP1MesNYb35gitn 7y2tkKlwn8hZqxJUCvNWsWIN//eeKj+aNRzl0jr7prYOSqeaGO4EPlRTHfrLQx4X/CRZ ogM+MTu/BDreBOYSXcJlHWcCQ4v8gOF98EMP+9wvAut4TZo14mS3amDka1gBWVsDEIpk QwYth6RS9QSZjDrnJFC02AOGGM3EBQczJTHvNNWbFdBnM07chWZob+x6bAca0UFJfWXn a0zw== X-Forwarded-Encrypted: i=1; AJvYcCUIfQpSAodEq6tt/RWdmZA0CRdhT+WEI8MtjuuKGnXD2vwdrRMDH1saRiKvdL4BRkFH+SCx2PjD2RwyGoJUDoXBdn7IgPNIA5tIahtQzCAhnF4mT1jwAa4Rrq4+cyYYpD1bZ9rz X-Gm-Message-State: AOJu0Yw0dUVSmSPnd01nkJoekM36I0/dHJqq5VlyNr9GN+KgWM2umCzP ETIOUgT/BKZKtTfj2CUNoSPot31bnjPcwHjoJ1laxiUay0z3YbSM X-Google-Smtp-Source: AGHT+IFDz75KgzZ+6hE0DiIug0nscdHe6JX7Wwu8Oxpc0c8N8TE2FnKBYcAvzKCdYJ5Pdd7Kh3rG3w== X-Received: by 2002:a05:6402:134f:b0:561:fd3f:d75a with SMTP id y15-20020a056402134f00b00561fd3fd75amr641329edw.28.1707860452326; Tue, 13 Feb 2024 13:40:52 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXV/RznNTpxucTM+oOK+M7Sxp5FheVEFgEBH3Q6MaRjMwlvSU49z/MGADjbpmuhXhckQSQNMjjhW+ZHQje3tAbjZhwqiB+XQJHZXEpIfTfboXNAApacb6isA2aNOd46LAyBAfLrKcGIBnEuPfzBDkYE4ykQk3TMYBr9dCDRQqpB0SUjUm9KdncNDh79oynVPdI9cPWvCN2LF22YBX7Ex0C3mJ7EjJRHW4QkUIuMTSs4GTHgGGcN/7b+pOvGwtF2ShKljJqMRR1J4bCFoXWVH97jlpzlpfi6OpIygB4YcaNAtFHzsA8oOxrldIXjX/IHN/E2ES8zkpUFsy//eA2JYQXR/Aw= Received: from debian.fritz.box ([93.184.186.109]) by smtp.gmail.com with ESMTPSA id k23-20020a05640212d700b005612987a525sm4003913edx.89.2024.02.13.13.40.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 13:40:51 -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 v6 net-next 14/14] net: phy: marvell-88q2xxx: move interrupt configuration Date: Tue, 13 Feb 2024 22:39:53 +0100 Message-Id: <20240213213955.178762-15-dima.fedrau@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240213213955.178762-1-dima.fedrau@gmail.com> References: <20240213213955.178762-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. Signed-off-by: Dimitri Fedrau Reviewed-by: Stefan Eichenberger Reviewed-by: Andrew Lunn --- 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 7afaa693316f..dc0f150826f0 100644 --- a/drivers/net/phy/marvell-88q2xxx.c +++ b/drivers/net/phy/marvell-88q2xxx.c @@ -375,6 +375,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; } @@ -700,14 +708,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); }