Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp8695106rwr; Thu, 11 May 2023 05:10:28 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4MtbX2DnE4DqCn2NXmMPx8TvQFpbL6QcEQtQ33LuKrg1OVhKDpFfeV6HXsqsoNU+OVYYxd X-Received: by 2002:a17:902:db06:b0:1ac:712d:2049 with SMTP id m6-20020a170902db0600b001ac712d2049mr18816613plx.6.1683807027660; Thu, 11 May 2023 05:10:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683807027; cv=none; d=google.com; s=arc-20160816; b=gZnhPaq4Oct3RpDSsjMpFcDNiruUhob4CuPKHAnAPvs3t2t03h7l7z4zVd2YAguFkv 15MlLMBfX5iM9f/+W1ZsQ4ZdQUX/QmsUayudv+OYNdex+937fhc913KfDZ11XJfLp7lo 5is9NI05p9lCn9U3jhCtSlwxbbdKt9wNXxHTkNsI0wamXKYFCkRPDY4lxsZdFiyXDzcE Y4vMkBQWs0+gQ6eDmhz2j3+GFLmS5PHhcKAhnDzK8BMnxxBUQy6WZ8yiv0RJUqb3VuR8 zijY/6G4KvdN6cF3pdMAenPt7QmWCo4Vozd/Yb8V4/hb5GwEUXCwMmMSEjzoKFoVW7me mLFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=RGnMREyDDGJIN58aJJKcAy1OpZorqiOEeiQkd8TXN9U=; b=MxIYulXasquS26llCiEnPDB8F+Ji0yfd3Qr+gL/ALWNFUT0uAmM5ICOGYgLl4UP5Fa lRYiIMWsVz9AOcTJIoRWJdouQwLhryy10m+qsNNIvIDt12zXH7SXxBzpRXgNkgEJ1zTB tyB7+Kqp5/SDvWcMELzqqi/+TetflcbLPU9D0cTK4PwOy01BirfcKFKGloZtlAa9rQVW sYA9zRVj6eGTqUpdrt26rYClK53iJIa8NsKW31593QNXEQy4K4KZVBi1WK+7yUExocYR 29KI3RsuEDfXnj9qmXL4SfaQDiknjnGMWBdSY5hxf47HhuttM3erj045F0PmL1MzKS0y Q8Xg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id in16-20020a17090b439000b0024e13530c0dsi24216923pjb.38.2023.05.11.05.10.05; Thu, 11 May 2023 05:10:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237451AbjEKL4B (ORCPT + 99 others); Thu, 11 May 2023 07:56:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229815AbjEKLz7 (ORCPT ); Thu, 11 May 2023 07:55:59 -0400 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7F612680; Thu, 11 May 2023 04:55:58 -0700 (PDT) Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96) (envelope-from ) id 1px4tm-0008Rg-01; Thu, 11 May 2023 11:55:57 +0000 Date: Thu, 11 May 2023 13:53:53 +0200 From: Daniel Golle To: Andrew Lunn Cc: netdev@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , AngeloGioacchino Del Regno Subject: Re: [PATCH 1/8] net: phy: realtek: rtl8221: allow to configure SERDES mode Message-ID: References: <302d982c5550f10d589735fc2e46cf27386c39f4.1683756691.git.daniel@makrotopia.org> <81c3f04d-ec48-4ac0-ac16-b69dc6ae72e0@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <81c3f04d-ec48-4ac0-ac16-b69dc6ae72e0@lunn.ch> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 11, 2023 at 02:41:07AM +0200, Andrew Lunn wrote: > > +#define RTL8221B_MMD_SERDES_CTRL MDIO_MMD_VEND1 > > +#define RTL8221B_MMD_PHY_CTRL MDIO_MMD_VEND2 > > I suggest you don't do this. Use MDIO_MMD_VEND[1|2] to make it clear > these are vendor registers. Ack, I will not introduce new macros to label them, but just use MDIO_MMD_VEND1 and MDIO_MMD_VEND2 then. > > > + case RTL8221B_SERDES_OPTION_MODE_2500BASEX_SGMII: > > + case RTL8221B_SERDES_OPTION_MODE_2500BASEX: > > + phy_write_mmd(phydev, RTL8221B_MMD_SERDES_CTRL, 0x6a04, 0x0503); > > + phy_write_mmd(phydev, RTL8221B_MMD_SERDES_CTRL, 0x6f10, 0xd455); > > + phy_write_mmd(phydev, RTL8221B_MMD_SERDES_CTRL, 0x6f11, 0x8020); > > + break; > > + case RTL8221B_SERDES_OPTION_MODE_HISGMII_SGMII: > > + case RTL8221B_SERDES_OPTION_MODE_HISGMII: > > + phy_write_mmd(phydev, RTL8221B_MMD_SERDES_CTRL, 0x6a04, 0x0503); > > + phy_write_mmd(phydev, RTL8221B_MMD_SERDES_CTRL, 0x6f10, 0xd433); > > + phy_write_mmd(phydev, RTL8221B_MMD_SERDES_CTRL, 0x6f11, 0x8020); > > + break; > > + } > > Is there anything in the datasheet to indicate register names and what > the values mean? It would be good to replace these magic values with > #defines. Unfortunately they are only mentioned as magic values which have to be written to magic registers also in the datasheet :(