From patchwork Sun May 22 13:41:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Nazzareno Trimarchi X-Patchwork-Id: 1982 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id B18513F05D for ; Sun, 22 May 2022 15:41:50 +0200 (CEST) Received: by mail-ed1-f70.google.com with SMTP id s9-20020aa7d789000000b0042ab9d77febsf8898068edq.16 for ; Sun, 22 May 2022 06:41:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1653226910; cv=pass; d=google.com; s=arc-20160816; b=cPe12LpbRHgneOC1WBNailLz1qcnta14MP1zw/1Rbq5iEQF5NQ8J8Srya8lCMw6Dx9 +GEl+n45wFrpVAhQxOjIsCsVzVSszqJe4e0zsEXwNJe00y4AwgW50JW20MXKR6WYCTI/ v9Vyhg9sXEcasxOT4xf6RvNLYAcMLIWfTNEyib/5PDyOFak3a08Neyv3dfK1cysgH6T4 N6khv7A76U4LqIOqAwjsCMsKikAj9Wv3nCMCawlDn0cyEkWJQLVlSHgDfGuXXhrNG/uS 1wvlYQBmnpTJcEaNCEc05/rfF6XtZwBiNCwVnQ6VY3Ap49xxh2/XYbOSycCC9qULDMEn rlDQ== 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:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=ohLrwPmHO+/h/Uq8V4cDAN3JaCnzlRvPB7hGsnhfiCs=; b=DoimLFLxCl+j/8AJBOtaK1FGpg7Ci13wfDsj/DTDWJH2D+mLE7eMg5ONq7XN+nO1mN 6NmqIVB9qk9XsCzBxtDG9a+QGEaUtVb/QRci/pL9rJsVvS5xGa0NtTrM5oVPvk+Cm1MT gT8EmudsylYeDp89wpnCMBwnX/sEQuv+TdyaOJPQzplVrqDV8I8OGq8i5ClTMr7k/aou 5egwYAkGX20FK2Ilxnr9bOggVJbtRkJ9kQaob4bUPVnRSLhMQ2NKjfJ4mOPNEjlw2pIS 7NZ7L8T8aUYgbA6KAKBmsJpQGxtAYqm/x4S8bXwqoFDnVWj2DHcfQDxn+YFzuTjhD9B3 igbg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=X5k+KiG3; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=ohLrwPmHO+/h/Uq8V4cDAN3JaCnzlRvPB7hGsnhfiCs=; b=j8BAQH/7rFJdSQE7xacj4xyXK5K2339t8YJHWlqAsBWquzwxT53MRJ4sO7Eyx5fFv6 EEuqny2stQ+4N6+6SRcZFZ4Y6QLAtvn6/SszPv15Sy0HaymRnW6nVaGYbP56D7RLOb6P 9cWKzVjp3hI9xLygUyi/IsGzCgPLgz4h8KgEo= 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:in-reply-to :references: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=ohLrwPmHO+/h/Uq8V4cDAN3JaCnzlRvPB7hGsnhfiCs=; b=d8lKezbjMt0ZFwsqpmyPx83g3TrJwUnq479MJgUDaz0Vr3VOK7y7+6W7FS3r9TLDca i15Gb80qVC+5RBLsT/swGVQjeo7BStgJTQ4uSbQvSWwxunb/fX025PdPOtx+Mevv8DyA FMXX6Y94glBI+wZSN2aVl3pqESPudFK+ql91A6fdcNEMJWZLn8LVVP5UC2bLUifRY0/O w7288DVCIYTH8FxVL7ke4tuh2XnJ13uWUeMEblEXsgrM47McEXuVURahXJyAo5+B2QM8 P6Y8xo1JC2RhMOk0mR665f9snCUy1DHWwEeu3Z1i5JT8EseX3Rd0waUyZp0Kx1kbQ/cE EHcA== X-Gm-Message-State: AOAM533ACD5WuitVTIqamVu+jfIeGfvPTwN7hqnM7arxQRNT3OoPNqob J+wT3YAoMlVOVj/O+znVYqnOU0q7 X-Google-Smtp-Source: ABdhPJwWecfabdRKTyVvXkAkDCf1bDbpje54wvOyxKrWrquOrknv3HBR4A4i4VSjDZSkSa9GI2cGBA== X-Received: by 2002:aa7:d898:0:b0:42a:af71:dc24 with SMTP id u24-20020aa7d898000000b0042aaf71dc24mr19827345edq.162.1653226910556; Sun, 22 May 2022 06:41:50 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:2741:b0:41f:7eee:e393 with SMTP id z1-20020a056402274100b0041f7eeee393ls870790edd.3.gmail; Sun, 22 May 2022 06:41:49 -0700 (PDT) X-Received: by 2002:a05:6402:42d4:b0:412:c26b:789 with SMTP id i20-20020a05640242d400b00412c26b0789mr19348641edc.232.1653226909338; Sun, 22 May 2022 06:41:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653226909; cv=none; d=google.com; s=arc-20160816; b=V6P7RGM0BcHY4AZZxEN5I+/fBBH4xh3cWh6HvxYnhpSdON+dPkbP3T65PdmIzQPREA Fsfelq/HyELfFhs48V4R8mN2ZWi84jfAgzfltRSxvB+I1YUx/R/6yDTVDE497/2VUitb tOUcJR79HMwD443PjAQCklxqO9x+dnb2r1cmhLgt4ELMvrgLVZDr1MwOLOrG39KR8C8S 3cmd3fQ4TfCksJl3j+U3dUOILjmpSTT4P5NJIlBAwnOtdQMGISVoP5V63TteuQWafLhR eBtSS3tmMqhAw+yK6LNYAuGhFIWwkwxChO5yA6WSexFqckwKBzvLDRtuyTuj0zmT5gUg Ohwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=5NXbmyJMpYVQ+QWiWJG7pL4OHe0VXmf42B1KgTipLig=; b=bOfrXPZCFRZBuiN6+7W3IyqnV/uo/k5jM+Wn9yYZnoOoENkwbhrEkZnSBUPP9TEKcc BpiG/vhwjobg/mXL5dUzR48Wl0wbvJYIOCmj2WsVSgmrFLrbIolYqZW0wg+OgN7truc/ 92fQSAKJa8DqiTRTqm7SvDRG2Ik0NT5sKCctahaiDYfeG1CbHqMcihc5ddFC1q4pNTpy dCb578EWtxfkEDXcNzkxpAWTYQn1Qw1Xog+BcLyLqcquy3ALkWM2TrC9ADbIi8k6ClvO BYeN61hxqR1898p72aiviIegdJif0/jZG3lLTZ+/cTBOOEsh5KkPAjvXKjn1XKHOtwvL sCNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=X5k+KiG3; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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 p25-20020a17090664d900b006f44ffc4ba5sor5618404ejn.133.2022.05.22.06.41.49 for (Google Transport Security); Sun, 22 May 2022 06:41:49 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a17:906:65c4:b0:6fe:8829:b8e4 with SMTP id z4-20020a17090665c400b006fe8829b8e4mr16189710ejn.291.1653226909041; Sun, 22 May 2022 06:41:49 -0700 (PDT) Received: from panicking.amarulasolutions.com (host-80-21-24-253.business.telecomitalia.it. [80.21.24.253]) by smtp.gmail.com with ESMTPSA id h22-20020aa7cdd6000000b0042abb914d6asm6772383edw.69.2022.05.22.06.41.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 May 2022 06:41:48 -0700 (PDT) From: Michael Trimarchi To: Tommaso Merciai Cc: linux-amarula@amarulasolutions.com, Alberto Bianchi Subject: [PATCH V2 2/3] net: phy: DP83822: enable rgmii/rmmi mode according to phy interface mode Date: Sun, 22 May 2022 15:41:45 +0200 Message-Id: <20220522134146.120312-2-michael@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220522134146.120312-1-michael@amarulasolutions.com> References: <20220522134146.120312-1-michael@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: michael@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=X5k+KiG3; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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: , RMII/RGMII mode can be enable from dp83822 straps, and also writing bit 9 and bit 5 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. If bit 9 is 0 the RMII/MII mode is determinated by bit 5. 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 --- drivers/net/phy/dp83822.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/dp83822.c b/drivers/net/phy/dp83822.c index c344b8ffaf3c..0b35f6d1a08e 100644 --- a/drivers/net/phy/dp83822.c +++ b/drivers/net/phy/dp83822.c @@ -94,7 +94,9 @@ #define DP83822_WOL_INDICATION_SEL BIT(8) #define DP83822_WOL_CLR_INDICATION BIT(11) -/* RSCR bits */ +/* RCSR bits */ +#define DP83822_RMII_MODE_EN BIT(5) +#define DP83822_RGMII_MODE_EN BIT(9) #define DP83822_RX_CLK_SHIFT BIT(12) #define DP83822_TX_CLK_SHIFT BIT(11) @@ -403,6 +405,15 @@ 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 { + if (phydev->interface == PHY_INTERFACE_MODE_RMII) + value != DP83822_RMII_MODE_EN; + + phy_modify_mmd(phydev, DP83822_DEVADDR, MII_DP83822_RCSR, + DP83822_RGMII_MODE_EN | DP83822_RMII_MODE_EN, value); } if (dp83822->fx_enabled) {