Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp3962276rwr; Mon, 8 May 2023 00:12:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6ZDHEPG5DA5VZ2rlCaL3dHKYB2sLDiHV2l9hWqcjGwckArtcguW/7haPEWDSOZLahnI3ZE X-Received: by 2002:a17:903:294c:b0:1ab:1b8:8a5f with SMTP id li12-20020a170903294c00b001ab01b88a5fmr9743556plb.33.1683529960168; Mon, 08 May 2023 00:12:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683529960; cv=none; d=google.com; s=arc-20160816; b=S7GnzRmQ8N/oTHQqep15VdTDRWn9HD3JZ6M1rVeE5D/iO3K8RKukV5DlCTra45p7Q5 AB3rOm5OqHj6EdbZ5EvjU8yQbPBBvCTCrljF0JRaQMLSqBxBbu/5QKzuXJyQSREMsbVW HBy1oXxEn4xq6Y6R5pG3zFCh8cM+UpxWzgiGneUX1cxN8ZRVT3VDlp5Tv7CJmOHyqTsT LD89cAO7/F4leumXoNH2homNhZaSgPJyhu/pVpwA4VDmXWnYm7uPj3REUS9g3m13qh18 sfjLeB7WsQTt86ttsrHw5VvFv1n/VOSfigr8AnAmlFdfCrh9K8E48LjctYYsKpilBPjW 53RQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=chEfS61x65xMVhUCjFBAUnEr02zz7hnvBnAi5qM39/g=; b=tjyB0lLCl0stNFuUZFRnpcMs3ylbKWhopKc4gFvh5t6eqQ3Rql/hhkOQCgYjAH5NA9 Src0TGYK+UC4EQKrLRugTud+PtWmH57GXQdrik4W87VFXMKZi8z+4CmsXL+ihCH5s1Qn yVtZI5JwIzktQcwyqdyWj6y0+h1BXdDIurP4PT5w8xYrOW3p6sp/mcGEwzkJ15vbXIe9 xgCVE3IpgV7oLiVCdJhHtSShF2Rue4nJE+YRInefb+ffaGVQrLi71U+6rHfuHDiu4d2a zPYqx3uL1uM7GWtVFbHprc4ByO1YOEVw+HNT5giHwK6FXyo0lD1g8XNhiqlHHvVO9oEI ifxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="WfL/Z/Yo"; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n9-20020a170902e54900b001ac53744492si5228485plf.2.2023.05.08.00.12.25; Mon, 08 May 2023 00:12:40 -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; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="WfL/Z/Yo"; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233221AbjEHHFd (ORCPT + 99 others); Mon, 8 May 2023 03:05:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233293AbjEHHFC (ORCPT ); Mon, 8 May 2023 03:05:02 -0400 Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AAFA1E991; Mon, 8 May 2023 00:04:26 -0700 (PDT) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 3487440J112127; Mon, 8 May 2023 02:04:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1683529444; bh=chEfS61x65xMVhUCjFBAUnEr02zz7hnvBnAi5qM39/g=; h=From:To:CC:Subject:Date; b=WfL/Z/Yom0nFGVEtslS333Z+GMddMog0YwPxr42Pfv+UtJNi4eZTKm/qePqzh+wq6 /SrSRiwhxRs6CDbo64FmWtqGHvI2xOeV5Xj/TJG4ztIFfdmYk/35cTrvNdUzb5K4eJ k3h1IWoa8Z84GmVPRO/D6us0BVWV9OV3ToRlFZ6s= Received: from DLEE104.ent.ti.com (dlee104.ent.ti.com [157.170.170.34]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 3487440V029859 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 8 May 2023 02:04:04 -0500 Received: from DLEE105.ent.ti.com (157.170.170.35) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 8 May 2023 02:04:03 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Mon, 8 May 2023 02:04:03 -0500 Received: from uda0492258.dhcp.ti.com (ileaxei01-snat2.itg.ti.com [10.180.69.6]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 34873xcx035885; Mon, 8 May 2023 02:04:00 -0500 From: Siddharth Vadapalli To: , , , , , , CC: , , , , Subject: [PATCH net-next] net: phy: dp83869: support mii mode when rgmii strap cfg is used Date: Mon, 8 May 2023 12:33:59 +0530 Message-ID: <20230508070359.357474-1-s-vadapalli@ti.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,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 From: Grygorii Strashko The DP83869 PHY on TI's k3-am642-evm supports both MII and RGMII interfaces and is configured by default to use RGMII interface (strap). However, the board design allows switching dynamically to MII interface for testing purposes by applying different set of pinmuxes. To support switching to MII interface, update the DP83869 PHY driver to configure OP_MODE_DECODE.RGMII_MII_SEL(bit 5) properly when MII PHY interface mode is requested. Signed-off-by: Grygorii Strashko Signed-off-by: Siddharth Vadapalli --- RFC patch at: https://lore.kernel.org/r/20230425054429.3956535-3-s-vadapalli@ti.com/ Changes since RFC patch: - Change patch subject to PATCH net-next. - Reword commit message to indicate that the patch adds new support and is not intended to be a bug fix. - Add check to ensure that MII mode is requested only with valid operational modes. drivers/net/phy/dp83869.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/dp83869.c b/drivers/net/phy/dp83869.c index 9ab5eff502b7..fa8c6fdcf301 100644 --- a/drivers/net/phy/dp83869.c +++ b/drivers/net/phy/dp83869.c @@ -692,8 +692,19 @@ static int dp83869_configure_mode(struct phy_device *phydev, /* Below init sequence for each operational mode is defined in * section 9.4.8 of the datasheet. */ + phy_ctrl_val = dp83869->mode; + if (phydev->interface == PHY_INTERFACE_MODE_MII) { + if (dp83869->mode == DP83869_100M_MEDIA_CONVERT || + dp83869->mode == DP83869_RGMII_100_BASE) { + phy_ctrl_val |= DP83869_OP_MODE_MII; + } else { + phydev_err(phydev, "selected op-mode is not valid with MII mode\n"); + return -EINVAL; + } + } + ret = phy_write_mmd(phydev, DP83869_DEVADDR, DP83869_OP_MODE, - dp83869->mode); + phy_ctrl_val); if (ret) return ret; -- 2.25.1