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=-2.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS, USER_AGENT_MUTT 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 3AD76C43381 for ; Thu, 14 Feb 2019 15:06:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0872820823 for ; Thu, 14 Feb 2019 15:06:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="eRUDpMHu" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404854AbfBNPGz (ORCPT ); Thu, 14 Feb 2019 10:06:55 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:45006 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404721AbfBNPGz (ORCPT ); Thu, 14 Feb 2019 10:06:55 -0500 Received: by mail-lj1-f194.google.com with SMTP id q128so5496722ljb.11 for ; Thu, 14 Feb 2019 07:06:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=gFtX+6b9AwSgrv9AdhF+pnR2JbrQh38uk/YyvugU5Og=; b=eRUDpMHubAk+8JymhhMcioYmKgcimQtg8G3wDzNjGL7t2D//X8UCLclgrevEfnnJ/j No1BL66gtl9ho/jSd8EKlq19/5aKSfHp1TjtvWw3CE+3tYSjwu/pokYHwYdeXsleaAx5 vHLlCHM0k0WQ1ZCR0M5TPIKyxtsWl/l34dwFnMIJzAtywqcqe8dkQYBwcR95htbqhCry +5x7Uy2ah4KxAaUigcz8cyb4MugdXvXd8sOc2/2dXHhh9bczrn0zq1bRcSVbT5he95+z +n2pADIXKxAeueX0nm2vXa/HlthbedSAjatMbAjlBEvEMPwZr6mEYnpNISgPDW+o8xbv lWQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=gFtX+6b9AwSgrv9AdhF+pnR2JbrQh38uk/YyvugU5Og=; b=fdK2zFlv+UzweH0PAGGVCq9aIWZB8zlZi5p3cGB1uw7pcY+cub043V3Gb3yBDczlsl cdVz1Bi3icmHtUn8OsQwrlTtUzefYTIEMD+Ia/dPMEveQgVns+/6ccCws/6lRgjnWtDB QGY+2YxoIgv01KzkBPBXYaymSK4Q+YCf2cwS99QV5s2FM9zp6K0KhSzz8SA6vuwOWeDh y0esh15O5EHiQ+ad8BKy6om18PSvODtbl18bdaMYdJ/23IX1kv255PQYD/Z055lqfcHM mLbeaPFY7OhVvNdChZjPzaQuk7a3RidiiI+/JjCoJnNrqFhRcEA3gUfF3kb8Wqbnu4ev eMyw== X-Gm-Message-State: AHQUAuZuCJMrvwW0+j4FnrLerONAmM2AdZPlrLv8AA210w2OkFBcaAwT sUOs0Xg/PNTibgol1CVjrAANMw== X-Google-Smtp-Source: AHgI3IaU+7PKgQ0zT8sD2b7kOndZXhPBhRGAYIkxEel7TWfLlFqXeKAIMnMtvANwpRSz0ANmeZ8XbQ== X-Received: by 2002:a2e:8349:: with SMTP id l9-v6mr2622816ljh.83.1550156812326; Thu, 14 Feb 2019 07:06:52 -0800 (PST) Received: from centauri.lan (h-229-118.A785.priv.bahnhof.se. [5.150.229.118]) by smtp.gmail.com with ESMTPSA id o5-v6sm467397ljh.75.2019.02.14.07.06.50 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 14 Feb 2019 07:06:51 -0800 (PST) Date: Thu, 14 Feb 2019 16:06:49 +0100 From: Niklas Cassel To: Peter Ujfalusi Cc: Marc Gonzalez , Andrew Lunn , Florian Fainelli , Vinod Koul , David S Miller , linux-arm-msm@vger.kernel.org, Bjorn Andersson , netdev@vger.kernel.org, "Nori, Sekhar" Subject: Re: [PATCH] net: phy: at803x: disable delay only for RGMII mode Message-ID: <20190214150649.GA29957@centauri.lan> References: <20190212141922.12849-1-vkoul@kernel.org> <20190213131206.GA460@centauri.lan> <20190213132900.GA24589@lunn.ch> <1ab5edac-a36c-9dc5-52e5-dbd3b70e7728@free.fr> <20190213174034.GA6954@centauri.lan> <3356ff05-8d08-591e-03bf-9d846f79097b@ti.com> <20190214123922.GA28897@centauri.ideon.se> <96271de7-bda1-a86a-a78e-e132bc097efb@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <96271de7-bda1-a86a-a78e-e132bc097efb@ti.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Thu, Feb 14, 2019 at 03:22:28PM +0200, Peter Ujfalusi wrote: > Hi Niklas, > > On 14/02/2019 14.39, Niklas Cassel wrote: > >>> So, I've rebased your old patch, see attachment. > >>> I suggest that Peter test it on am335x-evm. > >> > >> with the patch + s/rgmii-txid/rgmii-id in the am335x-evmsk.dts ethernet > >> is working. > >> I don't have am335x-evm to test, but it has the same PHY as evmsk. > >> > > > > Florian's concern was that this PHY driver looked at "phy-mode" from the > > perspective of the MAC rather than the PHY. > > However, if s/rgmii-txid/rgmii-id is the correct fix for am335x-evm, > > then this means that this PHY driver was just broken. > > > > If the driver had misinterpreted the perspective, then the correct > > fix for am335x-evm would have been s/rgmii-txid/rgmii-rxid. > > Not sure if I got this right, but: > rgmii-id/txid/rxid is the delay mode between PHY and MAC, right? > on the PHY node it is from the PHY perspective, right? Yes, from the PHY perspective. (According to Florian, IIUC, some old PHY drivers were implemented before it was decided that it is from PHY perspective, rather than from MAC perspective.) > > The errata I have mentioned for am335x say: > "The reset state of RGMII1_IDMODE (bit 4) and RGMII2_IDMODE (bit 5) in > the GMII_SEL register enables internal delay mode on the transmit clock > of the respective RGMII port. The AM335x device does not support > internal delay mode, so RGMII1_IDMODE and RGMII2_IDMODE must be set to 1b." > > If the delay mode on the transmit clock is not working on the am335x, > then this translate that the rxid needs to be enabled on the PHY side? IIUC what Florian explained, then either MAC or PHY needs to add delays, so if the PHY only adds delay on e.g. TX, then the MAC needs to add delay on RX. However, in your case, the errata says that your MAC is not capable of adding a delay on TX, therefore the PHY needs to add a delay on TX. > > But then why it worked when only the txid was enabled and rxid was not > on the PHY side, and why it works if both txid and rxid is enabled? Because the PHY driver was broken, so the PHY driver always enabled delays on both TX and RX. This is how the driver looked before Vinod's change: if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID || phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) { 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) { ret = at803x_enable_tx_delay(phydev); if (ret < 0) return ret; } Yet, the initial value for this PHY is that both TX and RX delay is enabled, and since this driver never disabled TX/RX delays, the TX and RX delays were always enabled, no matter what phy-mode you specified. > > Just tried w/ your patch and setting rgmii-rxid for am335x-evmsk and > ethernet is not working, it only works w/ rgmii-id (so both tx and rx > delay is enabled on the PHY side?) > > > So considering that this driver seems to be really broken > > (rather then just inverted perspective), > > perhaps we can merge the patch I attached in my previous email after all? > > (Together with a s/rgmii-txid/rgmii-id in the am335x-evmsk.dts.) > > at the same time am335x-evm.dts needs to have the same change and most > likely other boards which uses the same PHY needs to be checked? > > PS: sorry for my lack of knowledge on the networking stuff... > > - Péter > > Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. > Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki