From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752516AbdGDQYL (ORCPT ); Tue, 4 Jul 2017 12:24:11 -0400 Received: from mail-oi0-f67.google.com ([209.85.218.67]:36472 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752437AbdGDQYJ (ORCPT ); Tue, 4 Jul 2017 12:24:09 -0400 Date: Tue, 04 Jul 2017 09:24:03 -0700 User-Agent: K-9 Mail for Android In-Reply-To: <20170702101914.5nk27r2h754qzthe@collins.gmr.ssr.upm.es> References: <20170630092541.27234-1-alvaro.gamez@hazent.com> <425aed84-a1b6-b8da-5989-3bef5a03ead4@gmail.com> <20170702101914.5nk27r2h754qzthe@collins.gmr.ssr.upm.es> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Subject: Re: [PATCH] net: axienet: add of_phy_connect call for XAE_PHY_TYPE_MII case To: Alvaro Gamez Machado CC: Anirudha Sarangi , John Linn , Michal Simek , =?ISO-8859-1?Q?S=F6ren_Brinkmann?= , netdev@vger.kernel.org, linux-kernel@vger.kernel.org From: Florian Fainelli Message-ID: <6A2BD6D6-9CBB-4BDD-BF28-F0BF10DB454C@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id v64GOFQr000746 On July 2, 2017 3:19:14 AM PDT, Alvaro Gamez Machado wrote: >On Fri, Jun 30, 2017 at 10:30:38AM -0700, Florian Fainelli wrote: >> On 06/30/2017 02:25 AM, Alvaro Gamez Machado wrote: >> > if (lp->phy_node) { >> > - if (lp->phy_type == XAE_PHY_TYPE_GMII) { >> > + if (lp->phy_type == XAE_PHY_TYPE_MII) { >> > + phydev = of_phy_connect(lp->ndev, lp->phy_node, >> > + axienet_adjust_link, 0, >> > + PHY_INTERFACE_MODE_MII); >> > + } else if (lp->phy_type == XAE_PHY_TYPE_GMII) { >> > phydev = of_phy_connect(lp->ndev, lp->phy_node, >> > axienet_adjust_link, 0, >> > PHY_INTERFACE_MODE_GMII); >> >> Seems like this could be simplified even further if the values of >> lp->phy_type directly mapped to those of phy_interface_t. > >Sadly, that's not the case. PHY_INTERFACE_MODE_* belong to a enum of >twenty >different values, of which only _MII and _GMII overlap with XAW_PHY_* >values, but XAE_PHY_TYPE_RGMII_2_0 doesn't match >PHY_INTERFACE_MODE_RGMII_ID. There are four different rgmii types to account for rx or tx delay, is not there one that really matches? If the driver is using of_get_phy_mode() to retrieve the standard 'phy-mode' / 'phy-connection-type' values then this internal representation is not needed anymore. -- Florian