Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3172273pxb; Tue, 12 Oct 2021 23:55:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzFrl59iJIMX/NhTbAvoTjHk0uYP6tNuEnNJPHcTUKJY9yEdkBsr4h4zryHj2eSFB8LQUEh X-Received: by 2002:a05:6402:40c2:: with SMTP id z2mr7252799edb.41.1634108146411; Tue, 12 Oct 2021 23:55:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634108146; cv=none; d=google.com; s=arc-20160816; b=WIJzpPivGc7JOk3gziMXwMiYX2pU+TW70MXT1mVEA+JBl3QVveLjU+y7vp5rgg2Y+d 5BWZbKTCrar+4x1j4YCAfIF0xTnAPmZrUzjV68+vlf4dq9c4QMrgvL/gSQz64DFJkM1e OE9SLejay7UHIxBmQpG3V1JXnsgQB8oI36+07enBG0CG/KdcNmkDs0CMps3Wv7qxu/0P KbYbUYHEasnmjlkNy0iXu/mZ04VmIot8cEUx1NkfzsmK7BPFc8cVuwkp8lg7CWGnXGP2 Y7/09S2C74IVRn/AwmPh/lmQatKChRdgfHxYpAp0TjnfAr3V1tPEk9qz2uz/f+yVwecN w70w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=VdgtoxrXMyaIlDvOuhYZfjIgzWcxpc3GOheJUDkAcqo=; b=aR8bEYASdbH+cXvW6uAztXV0NvsE6Pddy+GecXJTu0XdAeSU2J1czmtD4ZyrKlmGAB lbNT50f4U/4dLG0Qp0/R4ATGwgk+4I6iM4H+OJOUIMVpk1QGoo7XGP6/8/SdEaR3thXa 0J+0pLR/ck3MG1Uyr5cHxFrssgF6nuQJNWLA0mQaQnzIUVDJfcmSqNjUdMyEh4b0WGqi WIATWjqOvbIXTs2Q8GqWPO0Oyxwg8+4BozC86wBoDN5d3bIucctOYhDHg7TkDuLe9Jj0 elMVNmaYXLgVxOG9z8wbFUgR84Zua4I0YqbEha1z/jIy1suxvV5boazv0ptIPu4u392Y RUcw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v18si21228245ejh.182.2021.10.12.23.55.23; Tue, 12 Oct 2021 23:55:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238129AbhJMGzn (ORCPT + 99 others); Wed, 13 Oct 2021 02:55:43 -0400 Received: from mga11.intel.com ([192.55.52.93]:41478 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231495AbhJMGzj (ORCPT ); Wed, 13 Oct 2021 02:55:39 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10135"; a="224801994" X-IronPort-AV: E=Sophos;i="5.85,369,1624345200"; d="scan'208";a="224801994" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2021 23:53:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,369,1624345200"; d="scan'208";a="626229936" Received: from glass.png.intel.com ([10.158.65.69]) by fmsmga001.fm.intel.com with ESMTP; 12 Oct 2021 23:53:31 -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, Lay Kuan Loon , Wong Vee Khee Subject: [PATCH net-next v2 1/1] net: phy: dp83867: introduce critical chip default init for non-of platform Date: Wed, 13 Oct 2021 14:59:41 +0800 Message-Id: <20211013065941.2124858-2-boon.leong.ong@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211013065941.2124858-1-boon.leong.ong@intel.com> References: <20211013065941.2124858-1-boon.leong.ong@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.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 impedance and RX & TX internal delays are critical and should be initialized to its default during PHY driver probe. Tested-by: Clement Signed-off-by: Lay, Kuan Loon Co-developed-by: Ong Boon Leong Signed-off-by: Ong Boon Leong --- drivers/net/phy/dp83867.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c index 6bbc81ad295f..914619f3f0e3 100644 --- a/drivers/net/phy/dp83867.c +++ b/drivers/net/phy/dp83867.c @@ -619,6 +619,25 @@ 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 impedance + * which is wrong. + */ + dp83867->io_impedance = DP83867_IO_MUX_CFG_IO_IMPEDANCE_MIN / 2; + return 0; } #endif /* CONFIG_OF_MDIO */ -- 2.25.1