From patchwork Wed Oct 13 03:41:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ong Boon Leong X-Patchwork-Id: 12554423 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BAE13C433EF for ; Wed, 13 Oct 2021 03:35:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9CDA560E53 for ; Wed, 13 Oct 2021 03:35:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237440AbhJMDhZ (ORCPT ); Tue, 12 Oct 2021 23:37:25 -0400 Received: from mga17.intel.com ([192.55.52.151]:58999 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237319AbhJMDhV (ORCPT ); Tue, 12 Oct 2021 23:37:21 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10135"; a="208138754" X-IronPort-AV: E=Sophos;i="5.85,369,1624345200"; d="scan'208";a="208138754" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2021 20:35:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,369,1624345200"; d="scan'208";a="524469773" Received: from glass.png.intel.com ([10.158.65.69]) by orsmga001.jf.intel.com with ESMTP; 12 Oct 2021 20:35:16 -0700 From: Ong Boon Leong To: Andrew Lunn , Heiner Kallweit , Russell King , "David S . Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 1/2] net: phy: dp83867: introduce critical chip default init for non-of platform Date: Wed, 13 Oct 2021 11:41:27 +0800 Message-Id: <20211013034128.2094426-2-boon.leong.ong@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211013034128.2094426-1-boon.leong.ong@intel.com> References: <20211013034128.2094426-1-boon.leong.ong@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: "Lay, Kuan Loon" PHY driver dp83867 has rich supports for OF-platform to fine-tune the PHY chip during phy configuration. However, for non-OF platform, certain PHY tunable parameters such as IO impedence and RX & TX internal delays are critical and should be initialized to its default during PHY driver probe. Signed-off-by: Lay, Kuan Loon Co-developed-by: Ong Boon Leong Tested-by: Clement Signed-off-by: Ong Boon Leong --- drivers/net/phy/dp83867.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c index 6bbc81ad295f..bb4369b75179 100644 --- a/drivers/net/phy/dp83867.c +++ b/drivers/net/phy/dp83867.c @@ -619,6 +619,24 @@ static int dp83867_of_init(struct phy_device *phydev) #else static int dp83867_of_init(struct phy_device *phydev) { + struct dp83867_private *dp83867 = phydev->priv; + u16 delay; + + /* For non-OF device, the RX and TX ID values are either strapped + * or take from default value. So, we init RX & TX ID values here + * so that the RGMIIDCTL is configured correctly later in + * dp83867_config_init(); + */ + delay = phy_read_mmd(phydev, DP83867_DEVADDR, DP83867_RGMIIDCTL); + dp83867->rx_id_delay = delay & DP83867_RGMII_RX_CLK_DELAY_MAX; + dp83867->tx_id_delay = (delay >> DP83867_RGMII_TX_CLK_DELAY_SHIFT) & + DP83867_RGMII_TX_CLK_DELAY_MAX; + + /* Per datasheet, IO impedance is default to 50-ohm, so we set the same + * here or else the default '0' means highest IO impedence which is wrong. + */ + dp83867->io_impedance = DP83867_IO_MUX_CFG_IO_IMPEDANCE_MIN / 2; + return 0; } #endif /* CONFIG_OF_MDIO */ From patchwork Wed Oct 13 03:41:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ong Boon Leong X-Patchwork-Id: 12554425 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9701BC433EF for ; Wed, 13 Oct 2021 03:35:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7A5C160E53 for ; Wed, 13 Oct 2021 03:35:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237482AbhJMDh3 (ORCPT ); Tue, 12 Oct 2021 23:37:29 -0400 Received: from mga17.intel.com ([192.55.52.151]:59005 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237377AbhJMDhX (ORCPT ); Tue, 12 Oct 2021 23:37:23 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10135"; a="208138764" X-IronPort-AV: E=Sophos;i="5.85,369,1624345200"; d="scan'208";a="208138764" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2021 20:35:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,369,1624345200"; d="scan'208";a="524469776" Received: from glass.png.intel.com ([10.158.65.69]) by orsmga001.jf.intel.com with ESMTP; 12 Oct 2021 20:35:18 -0700 From: Ong Boon Leong To: Andrew Lunn , Heiner Kallweit , Russell King , "David S . Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 2/2] net: phy: dp83867: add generic PHY loopback Date: Wed, 13 Oct 2021 11:41:28 +0800 Message-Id: <20211013034128.2094426-3-boon.leong.ong@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211013034128.2094426-1-boon.leong.ong@intel.com> References: <20211013034128.2094426-1-boon.leong.ong@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: "Lay, Kuan Loon" TI DP83867 supports loopback enabled using BMCR, so we add genphy_loopback to the phy driver. Tested-by: Clement Signed-off-by: Lay, Kuan Loon Signed-off-by: Ong Boon Leong --- drivers/net/phy/dp83867.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c index bb4369b75179..af47c62d6e04 100644 --- a/drivers/net/phy/dp83867.c +++ b/drivers/net/phy/dp83867.c @@ -878,6 +878,7 @@ static struct phy_driver dp83867_driver[] = { .suspend = genphy_suspend, .resume = genphy_resume, + .set_loopback = genphy_loopback, }, }; module_phy_driver(dp83867_driver);