From patchwork Thu May 19 18:50:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tommaso Merciai X-Patchwork-Id: 1965 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 793343F067 for ; Thu, 19 May 2022 20:51:01 +0200 (CEST) Received: by mail-wm1-f72.google.com with SMTP id m26-20020a7bcb9a000000b0039455e871b6sf2095900wmi.8 for ; Thu, 19 May 2022 11:51:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1652986261; cv=pass; d=google.com; s=arc-20160816; b=p6ddBCdtygkDU3CKuzxwX/6l6mSTTvpPnCXIHsDiD0rDHVL5L9d/sZwGz1bfaLuDpr cPpseCQMbVA8BDX95RqRczoXof2DiALOd/SvdKXg2opGhExOwn7kFgK59+7kubmQ9PRZ R4EeLpWGhqiV+XM6Jt3pTStCNIrLf0iBBS6FREt+uzl7/Escnsj9NCVdAMNC3YRkK2FP DgbooYxUftDunoM7Cd6mIWeaoJ8XrEn9jWMxeR8gsd/H6ZBDEjeodliZx8tiZgDTYDvj YrkF66YzUl2sQvRQ0LXdRu9dLtVLCKWEiqFDxONDGKYhLyQ57RSo3yo3Sb68zZ6JVxOT lpjQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:message-id:date:subject:cc:to :from:dkim-signature; bh=Xn60Wfc4iQEkQUyYvtj1Zf63r46dTxu5TtytqnUQhZI=; b=e2voYSpBROS3dL2rPfbW0bxyw+iVrBnenp7HylNuCWeQS2UdkmZlWYeqanU8nYmPSN NUvyZ3YtKZPE1aOrC6twnhm9Os8PxmJwj3hPWKn0hGmHyVjynxiw/SdEnv3hY3XAnZlT +0WDYgC+CY3lHMiPx3IjbgBulwoqIsCJ2mAoySOzBP3KmvlKuMSd4JV2GGNQM8JEmchR YtH6NSTLjk11HNv0JAenM3qBCy2Rf3YbBiZIZ1hAsc439K+DQn15bb8hb0Je8cE8W4kl 6yr2Mgt/aXu8caEEFMnbe37k0ocvYGAEy+oOI6+xcfOgt+qpNu/Z6iMNooaKXt3m+q58 iQlw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=TAeL8EKa; spf=pass (google.com: domain of tommaso.merciai@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=tommaso.merciai@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=Xn60Wfc4iQEkQUyYvtj1Zf63r46dTxu5TtytqnUQhZI=; b=IrSJRLrlME73TJZjwbh5kZIU59Sn82L0woWiRSP/v1xEayQye+y5hL+MniPURHjDfx yhPTdaNn9EL/d1flkxl+KQenJka0h2bhcLWFPNXNMAcs/BcP8c+fBIjcvWnGoOTOffrM ExdbPOsbbWgOloAplpEgk/kArPF/PIufsMNhQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help :list-archive:list-unsubscribe; bh=Xn60Wfc4iQEkQUyYvtj1Zf63r46dTxu5TtytqnUQhZI=; b=lvHVcdHrFHKsfWnFH1fU1VShLNQbOuZEeSE17Zh0hA7lc0yLuaspMiUXY0jSpXJV2X lp9z0PT4YneBuE1ckTIHddaC22dsykEqxoSyWyjAAOlkgRspMEHTZU9tMrc6ch2zFuHt 1NcYrJIhbB44/kBuOqzr8Z2fAgx/8ZyY3CNSRn9sJ8tLp4Bep1BcagRBeY6N2tyhUv0B 23GTRoiURdYkjah/jSoYa8FvyR7giEUNsWFXMVPk07xAiI8onvVnKRxNt2tIdIuoKEaR tSCF9nlKfF5KxNAFzX4xfZYueFEc9gAuEKI1r0b/x62YPl+GP4HGlXnZveuaLcuXXpOR lUhw== X-Gm-Message-State: AOAM531/J0DddOVp7C+EYZVgtFJ7dAHS72vvna6Qwp0h+wM92PqXO+I2 4hUQhrIuNxmwEDC4JBmMgSRrsRyd X-Google-Smtp-Source: ABdhPJy/i+7WAhsSLxizRAHqownCbUidN3MmHzBImllGsTvrraSvyHuRmKLTdjlBTnPjSaGnhkBMow== X-Received: by 2002:a05:6000:154b:b0:20c:4ca6:6f18 with SMTP id 11-20020a056000154b00b0020c4ca66f18mr5285211wry.704.1652986260880; Thu, 19 May 2022 11:51:00 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a5d:64ca:0:b0:20c:bb44:bd7 with SMTP id f10-20020a5d64ca000000b0020cbb440bd7ls5740995wri.0.gmail; Thu, 19 May 2022 11:51:00 -0700 (PDT) X-Received: by 2002:a5d:47ca:0:b0:20c:72c9:d3be with SMTP id o10-20020a5d47ca000000b0020c72c9d3bemr5193071wrc.114.1652986259807; Thu, 19 May 2022 11:50:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652986259; cv=none; d=google.com; s=arc-20160816; b=QAwLwk6fL86wGMZ5Mkos0iKsaU9041qItKhFGDkk/F3wPp91tgQ55UNgY7/eR1VERd CQ8/FQmCi3aqjxi3CQMbOas69njxRErtR1BpNxTLBoeOq8eajcZLcRVVHs9avn9oAJp1 TKf9e9Y7XBylj3datXKRzS+LMgTobHh84iZROBpe2R4n1Pew0BhHKRqBcw9x9Hp2sdOT qEsN0+AuG1A7N8k1Q259BXhmZLKBf42JeEcHBdt8IERybDskhK0kKPDzrfIEBAHzfzxE Uo9pyuzT9fuNm1cuHcIAHHzEnpVqIlOcOWyF0qBccZJxYk7SYYQk2pDqcH+7AHI6QNfr fjHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=zVrso6fiVQrzi/HfLaD8z5m4C5/B3zTk0qBr6sq01RQ=; b=EhMGX4GdUuOWo6lpWUzrdVy4GK9XR4MfM4/CrQ/lnV8HSUNuyEucydJ3JvPE2uA8Df VEtnF/hmmfLk2WPD892dfsX3qF6PV7fpNcJ96AUGy5ITPC/Y2xXgK1BQiKuGkTP3PTey ilGsbBV1/+ixbrW+ykMgx+zEY7HCaoEaFlUznJ6INTrCngGMr8R9zfBBYci9K1/jrHEz R4C/BarkRpDJJ8uN0P/NqHxtNOfpnFbv03BlXy0eY9m1vcCaL7mwFU3zjS4ZJ7fdf6ZI HxsuBbDC2+1NLJK3MmR426K5+UH2yaep5rv9Oo/KquRWAKlg7MHAofeYMIuotoNMACTi 5fXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=TAeL8EKa; spf=pass (google.com: domain of tommaso.merciai@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=tommaso.merciai@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id q187-20020a1c43c4000000b003972c7181c7sor130291wma.8.2022.05.19.11.50.59 for (Google Transport Security); Thu, 19 May 2022 11:50:59 -0700 (PDT) Received-SPF: pass (google.com: domain of tommaso.merciai@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a7b:c4cc:0:b0:394:7d6c:fdf4 with SMTP id g12-20020a7bc4cc000000b003947d6cfdf4mr5578743wmk.163.1652986259580; Thu, 19 May 2022 11:50:59 -0700 (PDT) Received: from tom-ThinkPad-T14s-Gen-2i.station (net-188-217-53-154.cust.vodafonedsl.it. [188.217.53.154]) by smtp.gmail.com with ESMTPSA id j11-20020adfb30b000000b0020c5253d8fdsm300457wrd.73.2022.05.19.11.50.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 May 2022 11:50:59 -0700 (PDT) From: Tommaso Merciai To: Cc: tommaso.merciai@amarulasolutions.com, michael@amarulasolutions.com, alberto.bianchi@amarulasolutions.com, linux-amarula@amarulasolutions.com, linuxfancy@googlegroups.com, Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] net: phy: DP83822: enable rgmii mode if phy_interface_is_rgmii Date: Thu, 19 May 2022 20:50:56 +0200 Message-Id: <20220519185057.1657115-1-tommaso.merciai@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Original-Sender: tommaso.merciai@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=TAeL8EKa; spf=pass (google.com: domain of tommaso.merciai@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=tommaso.merciai@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , RGMII mode can be enable from dp83822 straps, and also writing bit 9 of register 0x17 - RMII and Status Register (RCSR). When phy_interface_is_rgmii rgmii mode must be enabled, same for contrary, this prevents malconfigurations of hw straps References: - https://www.ti.com/lit/gpn/dp83822i p66 Signed-off-by: Tommaso Merciai Co-developed-by: Michael Trimarchi Suggested-by: Alberto Bianchi Tested-by: Tommaso Merciai --- Changes since v1: - Improve commit msg - Add definition of bit 9 reg rcsr (rgmii mode en) - Handle case: phy_interface_is_rgmii is false drivers/net/phy/dp83822.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/net/phy/dp83822.c b/drivers/net/phy/dp83822.c index ce17b2af3218..7cb9d084707b 100644 --- a/drivers/net/phy/dp83822.c +++ b/drivers/net/phy/dp83822.c @@ -94,6 +94,9 @@ #define DP83822_WOL_INDICATION_SEL BIT(8) #define DP83822_WOL_CLR_INDICATION BIT(11) +/* RCSR bits */ +#define DP83822_RGMII_MODE_EN BIT(9) + /* RSCR bits */ #define DP83822_RX_CLK_SHIFT BIT(12) #define DP83822_TX_CLK_SHIFT BIT(11) @@ -408,6 +411,12 @@ static int dp83822_config_init(struct phy_device *phydev) if (err) return err; } + + phy_set_bits_mmd(phydev, DP83822_DEVADDR, + MII_DP83822_RCSR, DP83822_RGMII_MODE_EN); + } else { + phy_clear_bits_mmd(phydev, DP83822_DEVADDR, + MII_DP83822_RCSR, DP83822_RGMII_MODE_EN); } if (dp83822->fx_enabled) {