From patchwork Sun Feb 18 07:57:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dimitri Fedrau X-Patchwork-Id: 202748 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp676334dyc; Sat, 17 Feb 2024 23:58:31 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU/Yo/1QjO11h9aCZJpP0T6OeBCzYVjwYFncF+9s+jYbgnUQFwMTnzuSxtys9HYMDzguH0CZKCVLtarCNmV6/mMbeHAqw== X-Google-Smtp-Source: AGHT+IGXYPma3Zir7jGA8hYl9rnrRGEkFOsbLWxidUSl6SFM4vGguuP35c9RnVPKzcbG53COjzi5 X-Received: by 2002:ae9:e603:0:b0:787:2250:c98c with SMTP id z3-20020ae9e603000000b007872250c98cmr20360634qkf.32.1708243111702; Sat, 17 Feb 2024 23:58:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708243111; cv=pass; d=google.com; s=arc-20160816; b=kEjJtzYYD8w7+9MZG4EzharGRl+266Fl0uSkMutx0tky6dLUGCnJ6H5Ze4osDK7X+G 4QDvIp+yJfONnR9YsVY6k1UNIq4lxiTMrSytcY06mM0mvlWFiUMSxVPiATRFLq+DjG/I 8g7IbHUm1Ma5dBSDe/FcKYxz2YYvnOANKhTAz0ElulWF5ujX2NEu8XqvzEm1uHBdURDf 2fAw2/lMPQcckYolGPddhWdOaabDz6HmP2ZKsB1D+rT3fByBzC+JghEz+ey4H6uQgtcV YHWJLQfRh2rJyg0IpQCp38Jvj7JkzgNY5OTnOFGNdDcfxZYIsEdnbD3KTA1RKZAK8qgK wkkA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=bU9yZws6bY4pAcFt+/tQW3bVoJ4iyCU+qUdZyENINWE=; fh=zG9oZlaY4FioHNa29SXL9hH/rj59emvPijZcZvtWdTE=; b=brerAUhc7W79fqy3jPSqa5AVISN9EUXpNMiWpWfUlPS5LUx3IGX5l7Go30JyWIbLr+ qNrZ5kuNundBO4vsqoSfw1y4rt6hJ9wuxMVaocdDDnzqsirMq7sQm85vE9abt5OOTJCo zr1geamg3Dziskx7RMxj7QMm2sKwKwKynjIPDzcar0RG2jB83q6DSHPR5wKk8ojcCw7R bYWtb63qW1Fu4Gdl2W4/RPPR8+yVs6WRIRiRXEIhA0YsOwE47LQXlvenSYNZi0mnIZ8c rJNRD/oFKb0dQP7wk9YQGljvKlAbgG+urE7YU/AImukfcKIlF9TKyXd5xK+6CCb5iUru BT2g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=fCzD9fao; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-70259-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70259-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id pi21-20020a05620a379500b0078726baaca4si3709444qkn.617.2024.02.17.23.58.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 23:58:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70259-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=fCzD9fao; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-70259-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70259-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 7E1151C20EDA for ; Sun, 18 Feb 2024 07:58:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 74BFB14274; Sun, 18 Feb 2024 07:58:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fCzD9fao" Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 42565EAD5; Sun, 18 Feb 2024 07:58:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708243083; cv=none; b=Yp2kD3R3Ewgf2xb9yMd1KGOEEyTy/J++ahINlWeot/aMot1XrP4AntTh5QhRJHSTKiP6EjZnSESxF5wbTXgMQlu7SsREq4J60aVA9eqpjcHOdFsYVwTfMtKZ0t0DTkTeDv3IT+in0ylAQ23/7hJXKL6uhoAA+1XxV1xYvGmEyOQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708243083; c=relaxed/simple; bh=12ZQEdtuynQ+RnIa2FV2uXf0/cwlIvakbZZS+qm0xB8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qTWTxhEZ9OIa7963Ws6KBCTB5nhyEFHbIbZ46fAArz08vgpl3EToGw1PNK747vpwU002b5d6YQNJ8FsKn2BEEXezXtNn80cW+ITTko/R19Ddx5pgv29V/dh6XhZpscpMVrOd63jG4vlqali9+CutdViOhfZbV3Q/eSYXXVc1rI8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fCzD9fao; arc=none smtp.client-ip=209.85.208.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-563c595f968so3585937a12.0; Sat, 17 Feb 2024 23:58:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708243080; x=1708847880; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bU9yZws6bY4pAcFt+/tQW3bVoJ4iyCU+qUdZyENINWE=; b=fCzD9faozpixaf0WJsOBnwOk/MpjD9H+0GJteK6CMWYOt7hQ0iwEJ5MfTmUcOU9wf2 C0yAORZgiY7AilQE/zRjtdr9snD+hkW57SEFdAQydoxttPtmL2KmForb6IJeHRyGyIYz b+CHB56pzmOs0YGlvProc0US2l8BLlnSizhS7PQQ/Mi09wVvlalGqJpBRAhsEVdPrc9I +3GHW7f8dBX9pLYf5eh1/hxDjF425KyHDB4r/DOMfSPVsOcp4oxJpt9le3Hk1Mnrmj4Y lZhfR1/Ig73NRTNB1wtMnMcQBkEVhYSKXyNUBca+3+/BCfJYbfdCntzEnpGodwbpGdNo VSrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708243080; x=1708847880; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bU9yZws6bY4pAcFt+/tQW3bVoJ4iyCU+qUdZyENINWE=; b=sKSkt4fVlzM9LhNYfRJ8OcPfpFUwmDOpliTG0KktnDxZHxr8NonnPVy7imrGWldcwn KHLc3gFxNUYx6yJY2rpwaZ3Ky3tkWNGPqOor2vSNUQZXC6jZ3VbSyNRZuQNgSZ8gqo0m LlQRFpQBpFkz2TCZFFKGy8SYOhfXP7aMx2aw+4a2Ht58Trjv6E7xJtY6yrWrLqgt4d6y jlKEsG98neAmUt8O2bstpGaevvczdjCwvb2ZHg4qMMmMe0OYJ4mnrWxvPp2tua5yNeHi FfDJgF+XSGbbI/F0+XVJKL72nAoYZWb/fbqb6RkjOC+JKoBXxwsE7Y961AUAj7G1lMid NDiA== X-Forwarded-Encrypted: i=1; AJvYcCUPwpUNLNdTpEJhJHjEOfjb+ivEIg8D9eve/5FbMsFB/N6Q2E4rqaBmfY+OG8Vb+d0i8aRA0WrQWNoLaeVmQrEAV5rDlMssG+3m7ffgVJNKDdoHbDx66giIQlqGyumFkLf2E9PD X-Gm-Message-State: AOJu0YyIvs9A7JLSSLaJoZBGqDW4CLbiL0sMQlZeWKqfBlk5bDVnck1K JvMwXfADbkf+IjwD7gXbmzLFJkw4luPDodMAWKhCyNzd0qAYvtpb X-Received: by 2002:a17:906:b0d9:b0:a38:63d4:2273 with SMTP id bk25-20020a170906b0d900b00a3863d42273mr6487403ejb.35.1708243080451; Sat, 17 Feb 2024 23:58:00 -0800 (PST) Received: from debian.fritz.box ([93.184.186.109]) by smtp.gmail.com with ESMTPSA id jj12-20020a170907984c00b00a3e64bcd2c1sm458732ejc.142.2024.02.17.23.57.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 23:57:59 -0800 (PST) From: Dimitri Fedrau To: Cc: Dimitri Fedrau , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Stefan Eichenberger , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 net-next 01/14] net: phy: Add BaseT1 auto-negotiation constants Date: Sun, 18 Feb 2024 08:57:38 +0100 Message-Id: <20240218075753.18067-2-dima.fedrau@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240218075753.18067-1-dima.fedrau@gmail.com> References: <20240218075753.18067-1-dima.fedrau@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791222728887976329 X-GMAIL-MSGID: 1791222728887976329 Added constants for advertising 100BT1 and 1000BT1 in register BASE-T1 auto-negotiation advertisement register [31:16] (Register 7.515) Reviewed-by: Andrew Lunn Signed-off-by: Dimitri Fedrau --- include/uapi/linux/mdio.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/uapi/linux/mdio.h b/include/uapi/linux/mdio.h index 3c9097502403..c0c8ec995b06 100644 --- a/include/uapi/linux/mdio.h +++ b/include/uapi/linux/mdio.h @@ -350,6 +350,8 @@ /* BASE-T1 auto-negotiation advertisement register [31:16] */ #define MDIO_AN_T1_ADV_M_B10L 0x4000 /* device is compatible with 10BASE-T1L */ +#define MDIO_AN_T1_ADV_M_1000BT1 0x0080 /* advertise 1000BASE-T1 */ +#define MDIO_AN_T1_ADV_M_100BT1 0x0020 /* advertise 100BASE-T1 */ #define MDIO_AN_T1_ADV_M_MST 0x0010 /* advertise master preference */ /* BASE-T1 auto-negotiation advertisement register [47:32] */ From patchwork Sun Feb 18 07:57:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dimitri Fedrau X-Patchwork-Id: 202749 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp676386dyc; Sat, 17 Feb 2024 23:58:48 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWA9KOVaTi54oMBpdPJJmpHz2SgPIoGh9QP/GRrhQFpw9vkcon7osNU58y9qsBoKQL/38a8RNcc6pSaWSHjL+MzcNQdQA== X-Google-Smtp-Source: AGHT+IH85CUJYaCoavjoOm1JAvlZjSpqPmYpJrFtiVh4+UQol690LNywokUpOLBzsRNapoZmftuk X-Received: by 2002:a05:6808:14ce:b0:3c1:3b56:f44a with SMTP id f14-20020a05680814ce00b003c13b56f44amr10259536oiw.51.1708243128150; Sat, 17 Feb 2024 23:58:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708243128; cv=pass; d=google.com; s=arc-20160816; b=oWpaRSqYAP/g3rxhoD5uiOJIQIM9xHECfrwAw2/lMHtbjPlXuTeZgXfPbFNuE9bQCg yhMbzLN7z7KBxkbLJxP5eB47M2JyB8INW9i2X4ZG2B7OMVV1VY+CkKlSvmAtE1smHJlB 16iKsCRQnkP79dcbYGhfJUtUFqhlGL8aWAsGRZ6RfXrfqfKybMjk4zAUVdp5lpX1LOPb tyQRll33PnWw32Dq6adgEFMom8Xbakw7vb5FtCmdvXkXTEGzj96i41Q+jiYo681mn5Uc si/fzonv5F4dLBoB7OxJd59T4GBN4EPdGog3ozGQh08dNIVTWFoMYzou/lII1yOGD4M5 Y7Cw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=ABA/+6oxHumH7163VNUvqNT1eTr+ehROcpiaVQm4GRM=; fh=wVmlpF9/HRbTAdwAYBhq9SEHzDe4fgNd0wklD+ngFdI=; b=VgX8jnitdjO1JZ9g0FbkOiMvzcN5J1sWocnzOQ+iKsm5KyGMOT+lW0gTH9+ezvG9y3 hRVyGu3Rc78yikPRIYkhhVWrm16JB1HRi/BwKVPyh7DZ0B0nXhnZHvaCpDukoqp5iIbN xQadplWF6/gbaj2IwTSe5MVD+bgK5m+iLs0apsuLV1kY9WNYoOnLLqfspVo2MBpLzjZW oOhiCJs55nfdlI/yOlVimY4eAjZPNLSin6um1DVK2feG1L5dr87V5393JFywuC8e6HHF E7M9w33iMWZR5ALnxOzV7EZ6eaKSRYLhK/pwHQfX64kMBvc/kXYXsQNcSf7lHdk4DFge d+Wg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=CqP9sTZy; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-70260-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70260-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id y4-20020a17090aca8400b002970e888ea6si2692978pjt.87.2024.02.17.23.58.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 23:58:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70260-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=CqP9sTZy; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-70260-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70260-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 0A653B20E49 for ; Sun, 18 Feb 2024 07:58:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7D528E554; Sun, 18 Feb 2024 07:58:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CqP9sTZy" Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6222912B91; Sun, 18 Feb 2024 07:58:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708243087; cv=none; b=Ne27pKJWvPFY7gWpRNoMnmHMe6tADYcvkodIH3EY1ZMsl5wHMLUSDDVXJtw4fn1sb6ZrFoCGT8stPo+19mo68d++a+vMtzQpIyDoCA/4Fx/P2AaH1fS3ggaAH3HdgG+GQ8Hge+dpOBGH2GI9awkbjsD1M5tadwVTYruxMaEkaVU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708243087; c=relaxed/simple; bh=Xlt6sMMKAUm7IbZRBGhxEDcRLpN3TDT3XNkJuoLuK4w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=uM2RFIOBk437nqNXOOZtvzusJIdwXRfWQaV8kVnnrC3k9RygBRANnw3oRYhiITi1QepLXUy1W3zwgO64EIVTiFCkzW61xGmODUj9wj0VidPmWfxzz6URdVHVWQIAIJEG5GGgljaLZ1z2uXNI5+HxfqxPkLlrWkwJdb0x4D36T4c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=CqP9sTZy; arc=none smtp.client-ip=209.85.218.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-a3e72ec566aso13741166b.2; Sat, 17 Feb 2024 23:58:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708243084; x=1708847884; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ABA/+6oxHumH7163VNUvqNT1eTr+ehROcpiaVQm4GRM=; b=CqP9sTZyzryAs7iLXK7/LFAjYkvJflQ058VXI3J9RVoGL2tgn5FxdZY2h1RujvURd3 QCFQSp3WAwrMR2ruEekqHsF22hLM8kZgOcW7bbpyf9ASKOqBJto64EDMWVIKeisbWaLL +EFBuDUk6oPMwHThw0uzjCDhihAuHpyEoc1uHUoyQSTQ/mIbJ/nhegU4ZaY1A2NudSpo ITstTCkYlxo5jK8qk/FvOnlPkgfFFXH9eLit99xnpVZGrFZDD+/EXUHemIFTQ2mHtx4W 5Tn9a+9bIapNll6cOSRFgMHHKvv3Tli9aHymokKqoU+99fPJrzFlD/1CEsAF9feA3fbl X57w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708243084; x=1708847884; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ABA/+6oxHumH7163VNUvqNT1eTr+ehROcpiaVQm4GRM=; b=GrQHOY0BCjdq25+V+xTgnWFhAx23Wg3BSB5eJt+bHjr6dH4KS3N1dSPphazuCAQyAn mJ9FE58wkxrvc97nYWM/MyBTCtVccSsdFZS4Y60q3hcxCN9nEgG2PUpdKMZP08VVf1X0 8XqQiPjlI8qp/V0lQDUN3IVjb04qlVBpMTjRt+sRaXdrHaAEjjbfhtjrpvLoqDZzvQ8o Ve5/WEjJR4BRR44nNHi1Y0s2g/C4OCCLDdd618vUbTA05a+eyLUcTA5chFWKNGZrHCRQ vHsybrSREh1ZfDPTu/2izo7XGm/CWM6GeVOMGcs+jQ32FnP6VAiv9HC2guKqNyTtJ5jh B69A== X-Forwarded-Encrypted: i=1; AJvYcCVYmrd9YmIAVeVxAaVayIa6dDWD+ivxuSX6rEzrQSmOTzCvHMaVbazdYXlBqIoaJ4El//QSVht6ZVgN/gOZkM/EatqmagAIZ3pe/YG0JLSRZooJjAGO9S9ivvuRrsX7yDQFlI1M X-Gm-Message-State: AOJu0YwEzs1pqymyrWgkFP9L4OiOrsT9HN+kXrvM/c/Nd+JVM9v3LLdw OMzNhO5F98Vq5Qtbo0/SJ2WWYPzpp7qZMqJTIUS2i0Vs0T9Tc92p X-Received: by 2002:a17:906:3492:b0:a3e:6d75:61df with SMTP id g18-20020a170906349200b00a3e6d7561dfmr501895ejb.45.1708243083483; Sat, 17 Feb 2024 23:58:03 -0800 (PST) Received: from debian.fritz.box ([93.184.186.109]) by smtp.gmail.com with ESMTPSA id jj12-20020a170907984c00b00a3e64bcd2c1sm458732ejc.142.2024.02.17.23.58.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 23:58:03 -0800 (PST) From: Dimitri Fedrau To: Cc: Dimitri Fedrau , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Stefan Eichenberger , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 net-next 02/14] net: phy: Support 100/1000BT1 linkmode advertisements Date: Sun, 18 Feb 2024 08:57:39 +0100 Message-Id: <20240218075753.18067-3-dima.fedrau@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240218075753.18067-1-dima.fedrau@gmail.com> References: <20240218075753.18067-1-dima.fedrau@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791222746245289842 X-GMAIL-MSGID: 1791222746245289842 Extend helper functions mii_t1_adv_m_mod_linkmode_t and linkmode_adv_to_mii_t1_adv_m_t to support 100BT1 and 1000BT1 linkmode advertisements. Reviewed-by: Andrew Lunn Signed-off-by: Dimitri Fedrau --- include/linux/mdio.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/linux/mdio.h b/include/linux/mdio.h index 79ceee3c8673..ecd21acc7eed 100644 --- a/include/linux/mdio.h +++ b/include/linux/mdio.h @@ -373,6 +373,10 @@ static inline void mii_t1_adv_m_mod_linkmode_t(unsigned long *advertising, u32 l { linkmode_mod_bit(ETHTOOL_LINK_MODE_10baseT1L_Full_BIT, advertising, lpa & MDIO_AN_T1_ADV_M_B10L); + linkmode_mod_bit(ETHTOOL_LINK_MODE_100baseT1_Full_BIT, + advertising, lpa & MDIO_AN_T1_ADV_M_100BT1); + linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseT1_Full_BIT, + advertising, lpa & MDIO_AN_T1_ADV_M_1000BT1); } /** @@ -409,6 +413,10 @@ static inline u32 linkmode_adv_to_mii_t1_adv_m_t(unsigned long *advertising) if (linkmode_test_bit(ETHTOOL_LINK_MODE_10baseT1L_Full_BIT, advertising)) result |= MDIO_AN_T1_ADV_M_B10L; + if (linkmode_test_bit(ETHTOOL_LINK_MODE_100baseT1_Full_BIT, advertising)) + result |= MDIO_AN_T1_ADV_M_100BT1; + if (linkmode_test_bit(ETHTOOL_LINK_MODE_1000baseT1_Full_BIT, advertising)) + result |= MDIO_AN_T1_ADV_M_1000BT1; return result; } From patchwork Sun Feb 18 07:57: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: 202750 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp676562dyc; Sat, 17 Feb 2024 23:59:42 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV8yESwIB1gJJA8MRjm9KqkTg/N2AggcjixayF3wnmkdqD+LW+2Rl8PlQ71to9LCJwCoLP777m2tNUCzwo0/s0ouzLvVw== X-Google-Smtp-Source: AGHT+IGz80f0YIYVbD38Hcc1Ek9FxcrM0AAVjooyGXaEjR4zqI5ykjmw/xLr62Ggh47bG0VIwFdz X-Received: by 2002:a17:906:b0d9:b0:a38:63d4:2273 with SMTP id bk25-20020a170906b0d900b00a3863d42273mr6489261ejb.35.1708243182209; Sat, 17 Feb 2024 23:59:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708243182; cv=pass; d=google.com; s=arc-20160816; b=kVcoEd2MMZn4le5h4adKCLndUnnLAAru0nOAeWJu/08Zfh+PWNj3OO+eQ8b1io/nby J2ftYmQroy2RrKcJV79gBs7ZtBedMzEBpYJa6xXZkmSEe50pYeopYInsfwYwvP5NOzaJ TxqVNHphP7eSGIQJAVyy6EDTjUUsQ26zZZnQWD8Rh/EM2CXj0zBhPBenSkLsfNrXnepV UdWl7qkxbogf2hkHClnZxBDDqFuDRG73/exfKXm4I+09rK7k9gm+/OGiRwLRyuy8h6Zb R2oeEeCJcpEhAbq9uRV8QIfHw80oEA7LVx8apt3yWPp0nVG6gfU2HLss7iP7UkgvC0r5 ukbg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=U3SacVFogZ0VIPM9NhlkFSdJIVFVokdqjKp32uGKAe8=; fh=WN4cYmvhtSgAeQZRKBHpGuTw8eT1W7de8lHoX7XVmH8=; b=mdB+6aTz3QNr6GeAahSuAyNNvae9V1rVw7QiMAX3gxUN+uJ6nv9HxHB6CZxqnQFYtC gmFsLOTPLMBF8KUHaVWYWYR1EyIy08W8dorgZBGLxlJUeJIRqhYG2TiRZ0joG/ShpysX rmnlaA2FfbnbH/QQg+mY6uEAWJHZeG9SmAzWDpNS0tftyIPkq4WlEiZyrr/h0xRTOAtE 47WL35ZaNogN3uixV2Msp1OYxUj7OCS+ZXjNG5eqo9WQonlEZ4PkvuxOaDGC3oijgurv t0WGpv6nhTBtkzdcWvm6FnUB0ooQQU5zHbqmRkgZfyJm3hoGZ6vqBtxZuYvz619IUZac g4Ng==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=fWEGKRi1; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-70263-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70263-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id z20-20020a170906241400b00a3e7229fb3dsi280102eja.807.2024.02.17.23.59.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 23:59:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70263-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=fWEGKRi1; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-70263-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70263-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id AB6EF1F21C55 for ; Sun, 18 Feb 2024 07:59:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9F57B1EB27; Sun, 18 Feb 2024 07:58:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fWEGKRi1" Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AD93CEAE4; Sun, 18 Feb 2024 07:58:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708243096; cv=none; b=UPRb95FKOsAfgvrP99d6PpA0W0nvFR8oGZLQFpjtG/C2Aq7ccyW0OrXfbhAb6pYXHjmFZmZ7u7t5aroMBM6c89dj20JH+Uo7V7iN/H3px+IthdJTurHkFCbvvRRNRulPqmISLJNfFBYJe1v8moQdQh/COi1/tKYwnOD/ZG5DlWQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708243096; c=relaxed/simple; bh=FMn1k2LeUHLqPOJ5MrimW8W5ba6/IZNZUrZdnQzwtTM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=IKj6wqYfrtbbLVkRG+vq0O1tr1Nzx3U2LZYrBv0jbOWFZs5uF24AiPIaw3i5IIi5zsAvamYZGGCnkPUrkNp88OLgpQTIq5ep4WoE2hkFyes37WWCFUkW1RlnGZqmEgOQxgfmJ+tCJ1ilArKYxkG1ttsduylm7oBwCnY7WCVg+hQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fWEGKRi1; arc=none smtp.client-ip=209.85.167.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f45.google.com with SMTP id 2adb3069b0e04-512b0cfd79dso152310e87.0; Sat, 17 Feb 2024 23:58:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708243093; x=1708847893; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=U3SacVFogZ0VIPM9NhlkFSdJIVFVokdqjKp32uGKAe8=; b=fWEGKRi1q8OGvHNRqB+kggoRChaOb6zA7/4L4Fc0TyxVMpC1ZD8v2aZeKHNOWHhefO em1Tg3aUqlzp21zB/9qdrh5ZM1gkgE+HKIF1ksEmU2PYGp+ye8WAX8zMcjFzkXlSL3Nx nepo+seJNNU4OLhTHPFzIhjCSd9YtcTdPEA1kh6yFhydT76YYinoNIKju43kq7XUFsQ+ 4UaKSqTxH6F7VyQZx07ql6onoWjuYXULlk1LaswOTGCkXUK7sXm8mqxn0yPLnYy+OSo2 IOpyede2+lYtPLkt8hvmb1ucyDRJkUKpEzRnZMrRSEr2pj17kKUn/PiUSjxDssQW2jdX eO4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708243093; x=1708847893; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=U3SacVFogZ0VIPM9NhlkFSdJIVFVokdqjKp32uGKAe8=; b=sUm5x/dbJ2N6Ey5CS5gUILOqoU/k0CVoIIv/Xx4QyNClPQrEu5VSgnosq1q5NCADKO x2+NN8mN/ZSYtQ5UdRaD3PxLihn9IPJ2+xxdmNf0mfch/ewGrhjXfLXNCttMAa5w82zi 9hIlfNzFy5QTAo7wBNKWB+l7svWtj+Vj+Pb4HqvT+y3ar7VccMnHkZVTtfebkOrOy4dh QUMmWyR9pYnEYuNx7Fo9tGeLwgy/Ki6B3v2lUSZNNU5P9fTj9kL2PLEsmYsMuh1nRT1d qfhp905WgprHPnlB9sY4W1kM0BO0D+q8UWRcJScN3W/PcH9IGiv4owtb1rXmkWxO6qCN 8BYg== X-Forwarded-Encrypted: i=1; AJvYcCXqqDEk/kOoYM3zARruDfvWkgxScFNWv5CwfxGmzr4RK+8tcgb7P5FRIQr9xzFl3c+9iZtsRaySCoUuhmBOoQa15Wx8hZrTSQ1V2OceUK9oFj/zziucIIpXp3g+mQPjJD8fWanP X-Gm-Message-State: AOJu0YyaXfUZURC87WamU70tIt73NFy4QxEduVfZiYhAyW1K6SrlZQs9 yqsoXySWoh7NJznbY68GT4fWs/Bx5cTukl2JoL+OI36UZeVcxyrI X-Received: by 2002:a19:7618:0:b0:512:44c9:fb76 with SMTP id c24-20020a197618000000b0051244c9fb76mr5528232lff.22.1708243092792; Sat, 17 Feb 2024 23:58:12 -0800 (PST) Received: from debian.fritz.box ([93.184.186.109]) by smtp.gmail.com with ESMTPSA id jj12-20020a170907984c00b00a3e64bcd2c1sm458732ejc.142.2024.02.17.23.58.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 23:58:12 -0800 (PST) From: Dimitri Fedrau To: Cc: Dimitri Fedrau , Andrew Lunn , Gregor Herburger , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Stefan Eichenberger , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 net-next 05/14] net: phy: marvell-88q2xxx: add driver for the Marvell 88Q2220 PHY Date: Sun, 18 Feb 2024 08:57:42 +0100 Message-Id: <20240218075753.18067-6-dima.fedrau@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240218075753.18067-1-dima.fedrau@gmail.com> References: <20240218075753.18067-1-dima.fedrau@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791222716491336383 X-GMAIL-MSGID: 1791222802903822439 Add a driver for the Marvell 88Q2220. This driver allows to detect the link, switch between 100BASE-T1 and 1000BASE-T1 and switch between master and slave mode. Autonegotiation is supported. Reviewed-by: Andrew Lunn Tested-by: Gregor Herburger Signed-off-by: Dimitri Fedrau --- drivers/net/phy/marvell-88q2xxx.c | 210 +++++++++++++++++++++++++++++- include/linux/marvell_phy.h | 1 + 2 files changed, 205 insertions(+), 6 deletions(-) diff --git a/drivers/net/phy/marvell-88q2xxx.c b/drivers/net/phy/marvell-88q2xxx.c index dcebb4643aff..9829facde253 100644 --- a/drivers/net/phy/marvell-88q2xxx.c +++ b/drivers/net/phy/marvell-88q2xxx.c @@ -1,11 +1,17 @@ // SPDX-License-Identifier: GPL-2.0 /* * Marvell 88Q2XXX automotive 100BASE-T1/1000BASE-T1 PHY driver + * + * Derived from Marvell Q222x API + * + * Copyright (C) 2024 Liebherr-Electronics and Drives GmbH */ #include #include #include +#define PHY_ID_88Q2220_REVB0 (MARVELL_PHY_ID_88Q2220 | 0x1) + #define MDIO_MMD_AN_MV_STAT 32769 #define MDIO_MMD_AN_MV_STAT_ANEG 0x0100 #define MDIO_MMD_AN_MV_STAT_LOCAL_RX 0x1000 @@ -13,6 +19,11 @@ #define MDIO_MMD_AN_MV_STAT_LOCAL_MASTER 0x4000 #define MDIO_MMD_AN_MV_STAT_MS_CONF_FAULT 0x8000 +#define MDIO_MMD_AN_MV_STAT2 32794 +#define MDIO_MMD_AN_MV_STAT2_AN_RESOLVED 0x0800 +#define MDIO_MMD_AN_MV_STAT2_100BT1 0x2000 +#define MDIO_MMD_AN_MV_STAT2_1000BT1 0x4000 + #define MDIO_MMD_PCS_MV_100BT1_STAT1 33032 #define MDIO_MMD_PCS_MV_100BT1_STAT1_IDLE_ERROR 0x00ff #define MDIO_MMD_PCS_MV_100BT1_STAT1_JABBER 0x0100 @@ -29,6 +40,42 @@ #define MDIO_MMD_PCS_MV_RX_STAT 33328 +struct mmd_val { + int devad; + u32 regnum; + u16 val; +}; + +static const struct mmd_val mv88q222x_revb0_init_seq0[] = { + { MDIO_MMD_PCS, 0x8033, 0x6801 }, + { MDIO_MMD_AN, MDIO_AN_T1_CTRL, 0x0 }, + { MDIO_MMD_PMAPMD, MDIO_CTRL1, + MDIO_CTRL1_LPOWER | MDIO_PMA_CTRL1_SPEED1000 }, + { MDIO_MMD_PCS, 0xfe1b, 0x48 }, + { MDIO_MMD_PCS, 0xffe4, 0x6b6 }, + { MDIO_MMD_PMAPMD, MDIO_CTRL1, 0x0 }, + { MDIO_MMD_PCS, MDIO_CTRL1, 0x0 }, +}; + +static const struct mmd_val mv88q222x_revb0_init_seq1[] = { + { MDIO_MMD_PCS, 0xfe79, 0x0 }, + { MDIO_MMD_PCS, 0xfe07, 0x125a }, + { MDIO_MMD_PCS, 0xfe09, 0x1288 }, + { MDIO_MMD_PCS, 0xfe08, 0x2588 }, + { MDIO_MMD_PCS, 0xfe11, 0x1105 }, + { MDIO_MMD_PCS, 0xfe72, 0x042c }, + { MDIO_MMD_PCS, 0xfbba, 0xcb2 }, + { MDIO_MMD_PCS, 0xfbbb, 0xc4a }, + { MDIO_MMD_AN, 0x8032, 0x2020 }, + { MDIO_MMD_AN, 0x8031, 0xa28 }, + { MDIO_MMD_AN, 0x8031, 0xc28 }, + { MDIO_MMD_PCS, 0xffdb, 0xfc10 }, + { MDIO_MMD_PCS, 0xfe1b, 0x58 }, + { MDIO_MMD_PCS, 0xfe79, 0x4 }, + { MDIO_MMD_PCS, 0xfe5f, 0xe8 }, + { MDIO_MMD_PCS, 0xfe05, 0x755c }, +}; + static int mv88q2xxx_soft_reset(struct phy_device *phydev) { int ret; @@ -125,24 +172,90 @@ static int mv88q2xxx_read_link_100m(struct phy_device *phydev) static int mv88q2xxx_read_link(struct phy_device *phydev) { - int ret; - /* The 88Q2XXX PHYs do not have the PMA/PMD status register available, * therefore we need to read the link status from the vendor specific * registers depending on the speed. */ + if (phydev->speed == SPEED_1000) - ret = mv88q2xxx_read_link_gbit(phydev); + return mv88q2xxx_read_link_gbit(phydev); + else if (phydev->speed == SPEED_100) + return mv88q2xxx_read_link_100m(phydev); + + phydev->link = false; + return 0; +} + +static int mv88q2xxx_read_master_slave_state(struct phy_device *phydev) +{ + int ret; + + phydev->master_slave_state = MASTER_SLAVE_STATE_UNKNOWN; + ret = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_MMD_AN_MV_STAT); + if (ret < 0) + return ret; + + if (ret & MDIO_MMD_AN_MV_STAT_LOCAL_MASTER) + phydev->master_slave_state = MASTER_SLAVE_STATE_MASTER; else - ret = mv88q2xxx_read_link_100m(phydev); + phydev->master_slave_state = MASTER_SLAVE_STATE_SLAVE; - return ret; + return 0; +} + +static int mv88q2xxx_read_aneg_speed(struct phy_device *phydev) +{ + int ret; + + phydev->speed = SPEED_UNKNOWN; + ret = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_MMD_AN_MV_STAT2); + if (ret < 0) + return ret; + + if (!(ret & MDIO_MMD_AN_MV_STAT2_AN_RESOLVED)) + return 0; + + if (ret & MDIO_MMD_AN_MV_STAT2_100BT1) + phydev->speed = SPEED_100; + else if (ret & MDIO_MMD_AN_MV_STAT2_1000BT1) + phydev->speed = SPEED_1000; + + return 0; } static int mv88q2xxx_read_status(struct phy_device *phydev) { int ret; + if (phydev->autoneg == AUTONEG_ENABLE) { + /* We have to get the negotiated speed first, otherwise we are + * not able to read the link. + */ + ret = mv88q2xxx_read_aneg_speed(phydev); + if (ret < 0) + return ret; + + ret = mv88q2xxx_read_link(phydev); + if (ret < 0) + return ret; + + ret = genphy_c45_read_lpa(phydev); + if (ret < 0) + return ret; + + ret = genphy_c45_baset1_read_status(phydev); + if (ret < 0) + return ret; + + ret = mv88q2xxx_read_master_slave_state(phydev); + if (ret < 0) + return ret; + + phy_resolve_aneg_linkmode(phydev); + + return 0; + } + ret = mv88q2xxx_read_link(phydev); if (ret < 0) return ret; @@ -171,7 +284,9 @@ static int mv88q2xxx_get_features(struct phy_device *phydev) * sequence provided by Marvell. Disable it for now until a proper * workaround is found or a new PHY revision is released. */ - linkmode_clear_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, phydev->supported); + if (phydev->drv->phy_id == MARVELL_PHY_ID_88Q2110) + linkmode_clear_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, + phydev->supported); return 0; } @@ -241,6 +356,75 @@ static int mv88q2xxx_get_sqi_max(struct phy_device *phydev) return 15; } +static int mv88q222x_soft_reset(struct phy_device *phydev) +{ + int ret; + + /* Enable RESET of DCL */ + if (phydev->autoneg == AUTONEG_ENABLE || phydev->speed == SPEED_1000) { + ret = phy_write_mmd(phydev, MDIO_MMD_PCS, 0xfe1b, 0x48); + if (ret < 0) + return ret; + } + + ret = phy_write_mmd(phydev, MDIO_MMD_PCS, MDIO_PCS_1000BT1_CTRL, + MDIO_PCS_1000BT1_CTRL_RESET); + if (ret < 0) + return ret; + + ret = phy_write_mmd(phydev, MDIO_MMD_PCS, 0xffe4, 0xc); + if (ret < 0) + return ret; + + /* Disable RESET of DCL */ + if (phydev->autoneg == AUTONEG_ENABLE || phydev->speed == SPEED_1000) + return phy_write_mmd(phydev, MDIO_MMD_PCS, 0xfe1b, 0x58); + + return 0; +} + +static int mv88q222x_config_aneg(struct phy_device *phydev) +{ + int ret; + + ret = genphy_c45_config_aneg(phydev); + if (ret) + return ret; + + return mv88q222x_soft_reset(phydev); +} + +static int mv88q222x_revb0_config_init(struct phy_device *phydev) +{ + int ret, i; + + for (i = 0; i < ARRAY_SIZE(mv88q222x_revb0_init_seq0); i++) { + ret = phy_write_mmd(phydev, mv88q222x_revb0_init_seq0[i].devad, + mv88q222x_revb0_init_seq0[i].regnum, + mv88q222x_revb0_init_seq0[i].val); + if (ret < 0) + return ret; + } + + usleep_range(5000, 10000); + + for (i = 0; i < ARRAY_SIZE(mv88q222x_revb0_init_seq1); i++) { + ret = phy_write_mmd(phydev, mv88q222x_revb0_init_seq1[i].devad, + mv88q222x_revb0_init_seq1[i].regnum, + mv88q222x_revb0_init_seq1[i].val); + if (ret < 0) + return ret; + } + + /* The 88Q2XXX PHYs do have the extended ability register available, but + * register MDIO_PMA_EXTABLE where they should signalize it does not + * work according to specification. Therefore, we force it here. + */ + phydev->pma_extable = MDIO_PMA_EXTABLE_BT1; + + return 0; +} + static struct phy_driver mv88q2xxx_driver[] = { { .phy_id = MARVELL_PHY_ID_88Q2110, @@ -255,12 +439,26 @@ static struct phy_driver mv88q2xxx_driver[] = { .get_sqi = mv88q2xxx_get_sqi, .get_sqi_max = mv88q2xxx_get_sqi_max, }, + { + PHY_ID_MATCH_EXACT(PHY_ID_88Q2220_REVB0), + .name = "mv88q2220", + .get_features = mv88q2xxx_get_features, + .config_aneg = mv88q222x_config_aneg, + .aneg_done = genphy_c45_aneg_done, + .config_init = mv88q222x_revb0_config_init, + .read_status = mv88q2xxx_read_status, + .soft_reset = mv88q222x_soft_reset, + .set_loopback = genphy_c45_loopback, + .get_sqi = mv88q2xxx_get_sqi, + .get_sqi_max = mv88q2xxx_get_sqi_max, + }, }; module_phy_driver(mv88q2xxx_driver); static struct mdio_device_id __maybe_unused mv88q2xxx_tbl[] = { { MARVELL_PHY_ID_88Q2110, MARVELL_PHY_ID_MASK }, + { PHY_ID_MATCH_EXACT(PHY_ID_88Q2220_REVB0), }, { /*sentinel*/ } }; MODULE_DEVICE_TABLE(mdio, mv88q2xxx_tbl); diff --git a/include/linux/marvell_phy.h b/include/linux/marvell_phy.h index 9b54c4f0677f..693eba9869e4 100644 --- a/include/linux/marvell_phy.h +++ b/include/linux/marvell_phy.h @@ -26,6 +26,7 @@ #define MARVELL_PHY_ID_88E2110 0x002b09b0 #define MARVELL_PHY_ID_88X2222 0x01410f10 #define MARVELL_PHY_ID_88Q2110 0x002b0980 +#define MARVELL_PHY_ID_88Q2220 0x002b0b20 /* Marvel 88E1111 in Finisar SFP module with modified PHY ID */ #define MARVELL_PHY_ID_88E1111_FINISAR 0x01ff0cc0