From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A186C282C2 for ; Wed, 13 Feb 2019 07:01:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E5BA820811 for ; Wed, 13 Feb 2019 07:01:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="aALy5enI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730078AbfBMHB5 (ORCPT ); Wed, 13 Feb 2019 02:01:57 -0500 Received: from fllv0016.ext.ti.com ([198.47.19.142]:33878 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729649AbfBMHB5 (ORCPT ); Wed, 13 Feb 2019 02:01:57 -0500 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x1D71mHQ060498; Wed, 13 Feb 2019 01:01:48 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1550041308; bh=8U2lbXs9EZIvdFsb2uDhqf01DvMdBxCB2NFZleU5O7U=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=aALy5enIqpKRDoEmp85mkqicA1B4A7Uc6yqKGz7FfPjV0UjnDASugLFWpvRKy9b/1 YbKt26FMmAcArDcfLte6zsA3MztmJFEn4eDjn6D5oIfwNx3gN8wexOibD4TkLSs+Bc QuCk4a1n7I4/zhMEBuqLw1QHUIIUdOa9QXrhQsoU= Received: from DLEE110.ent.ti.com (dlee110.ent.ti.com [157.170.170.21]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x1D71maK091218 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 13 Feb 2019 01:01:48 -0600 Received: from DLEE113.ent.ti.com (157.170.170.24) by DLEE110.ent.ti.com (157.170.170.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Wed, 13 Feb 2019 01:01:46 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1591.10 via Frontend Transport; Wed, 13 Feb 2019 01:01:46 -0600 Received: from [192.168.2.6] (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id x1D71idn029296; Wed, 13 Feb 2019 01:01:44 -0600 Subject: Re: [PATCH] net: phy: at803x: disable delay only for RGMII mode To: Vinod Koul , David S Miller CC: , Bjorn Andersson , , Niklas Cassel , Andrew Lunn , Florian Fainelli , "Nori, Sekhar" , Marc Gonzalez References: <20190212141922.12849-1-vkoul@kernel.org> From: Peter Ujfalusi Message-ID: <89c39811-b100-564a-da40-abf46e450c95@ti.com> Date: Wed, 13 Feb 2019 09:02:10 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: <20190212141922.12849-1-vkoul@kernel.org> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Hi Vinod, On 12/02/2019 16.19, Vinod Koul wrote: > Per "Documentation/devicetree/bindings/net/ethernet.txt" RGMII mode > should not have delay in PHY whereas RGMII_ID and RGMII_RXID/RGMII_TXID > can have delay in phy. > > So disable the delay only for RGMII mode and disable for other modes s/disable for other modes/enable for other modes Works fine on am335x-evmsk: Tested-by: Peter Ujfalusi and few comment > Fixes: cd28d1d6e52e: ("net: phy: at803x: Disable phy delay for RGMII mode") > Reported-by: Peter Ujfalusi > Signed-off-by: Vinod Koul > --- > drivers/net/phy/at803x.c | 33 ++++++++++++++++++++++++++------- > 1 file changed, 26 insertions(+), 7 deletions(-) > > diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c > index 8ff12938ab47..7b54b54e3316 100644 > --- a/drivers/net/phy/at803x.c > +++ b/drivers/net/phy/at803x.c > @@ -110,6 +110,18 @@ static int at803x_debug_reg_mask(struct phy_device *phydev, u16 reg, > return phy_write(phydev, AT803X_DEBUG_DATA, val); > } > > +static inline int at803x_enable_rx_delay(struct phy_device *phydev) > +{ > + return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0, 0, > + AT803X_DEBUG_RX_CLK_DLY_EN); > +} static inline int at803x_select_rx_delay(struct phy_device *phydev, bool enable) { } > + > +static inline int at803x_enable_tx_delay(struct phy_device *phydev) > +{ > + return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_5, 0, > + AT803X_DEBUG_TX_CLK_DLY_EN); > +} static inline int at803x_select_tx_delay(struct phy_device *phydev, bool enable) { } perhaps? > + > static inline int at803x_disable_rx_delay(struct phy_device *phydev) > { > return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0, > @@ -255,18 +267,25 @@ static int at803x_config_init(struct phy_device *phydev) > if (ret < 0) > return ret; > > - if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID || > - phydev->interface == PHY_INTERFACE_MODE_RGMII_ID || > - phydev->interface == PHY_INTERFACE_MODE_RGMII) { > + if (phydev->interface == PHY_INTERFACE_MODE_RGMII) { > ret = at803x_disable_rx_delay(phydev); > if (ret < 0) > return ret; > + ret = at803x_disable_tx_delay(phydev); > + if (ret < 0) > + return ret; is it a possibility to have PHY_INTERFACE_MODE_RGMII and other RGMII_ID || RGMII_TXID || RGMII_RXID set at the same time? if not you can just return from here, no need to check for other RGMII modes? > + }; > + > + if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID || > + phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) { > + ret = at803x_enable_rx_delay(phydev); > + if (ret < 0) > + return ret; > } > > - if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID || > - phydev->interface == PHY_INTERFACE_MODE_RGMII_ID || > - phydev->interface == PHY_INTERFACE_MODE_RGMII) { > - ret = at803x_disable_tx_delay(phydev); > + if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID || > + phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) { > + ret = at803x_enable_tx_delay(phydev); > if (ret < 0) > return ret; > } > - Péter Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki