Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754566AbbHLN0O (ORCPT ); Wed, 12 Aug 2015 09:26:14 -0400 Received: from mail-by2on0128.outbound.protection.outlook.com ([207.46.100.128]:35391 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753000AbbHLN0M (ORCPT ); Wed, 12 Aug 2015 09:26:12 -0400 From: Madalin-Cristian Bucur To: Stas Sergeev , Florian Fainelli , "netdev@vger.kernel.org" , "grant.likely@linaro.org" , "robh+dt@kernel.org" CC: "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Liberman Igal , Stas Sergeev , "joakim.tjernlund@transmode.se" , Shaohui Xie Subject: RE: [PATCH 0/2] of: fsl/fman: reuse the fixed node parsing code Thread-Topic: [PATCH 0/2] of: fsl/fman: reuse the fixed node parsing code Thread-Index: AQHQz40u7/EeGP0M3EaSWT7KT29M554CYVyAgASdLgCAAAcBIIAACVUAgAFL3eA= Date: Wed, 12 Aug 2015 13:26:09 +0000 Message-ID: References: <1438785745-15517-1-git-send-email-madalin.bucur@freescale.com> <55C63D3B.5020005@gmail.com> <55CA1C14.3000202@list.ru> <55CA29C8.5000707@list.ru> In-Reply-To: <55CA29C8.5000707@list.ru> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=madalin.bucur@freescale.com; x-originating-ip: [192.88.166.1] x-microsoft-exchange-diagnostics: 1;BL2PR03MB498;5:M7ir+GgRkmnLiX1xI575AvnfocDcqHQsYOCWjMeVhG8ybtSRFro8O0j3+4Eak3ccHydnhW/8r4RbTV6y0R+0sE+FyIqG6EXfR/nh1JlBoiqwfE+Ifn2JfPliaQyTk3qBCHV+8N57j0+UHTifuwB6oA==;24:3ftaXPoXcislvtm8sA0lzSSNQB5MhDLUurVHuLDx9KhJPuQyFhvKh1LRUnaPDo/+zJhy9HR9VAwaW9pPPs/iRNxMN9dQqOwPsLgY1Ut5Bfw=;20:SF+U51vjrTNgyCwuBbU4FGq9bMheVLRNQfeXmWGWh5RqEqXxEnDZigXWeropqq+XKOG4IGp5HqRIVLwD2jMziQ== x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BL2PR03MB498; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(601004)(5005006)(3002001);SRVR:BL2PR03MB498;BCL:0;PCL:0;RULEID:;SRVR:BL2PR03MB498; x-forefront-prvs: 0666E15D35 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(479174004)(51884002)(13464003)(189002)(199003)(40100003)(99286002)(106116001)(122556002)(105586002)(106356001)(74316001)(77156002)(62966003)(46102003)(19580395003)(50986999)(66066001)(19580405001)(68736005)(102836002)(77096005)(101416001)(54356999)(76176999)(93886004)(2900100001)(33656002)(2950100001)(10400500002)(81156007)(5001770100001)(76576001)(97736004)(2656002)(5001830100001)(5001860100001)(87936001)(4001540100001)(92566002)(86362001)(107886002)(2501003)(64706001)(2201001)(5001960100002)(189998001)(5002640100001)(5003600100002)(4001430100001)(179675005);DIR:OUT;SFP:1102;SCL:1;SRVR:BL2PR03MB498;H:BL2PR03MB545.namprd03.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Aug 2015 13:26:09.0347 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2PR03MB498 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 base64 to 8bit by mail.home.local id t7CDQKVO018723 Content-Length: 3898 Lines: 98 > -----Original Message----- > From: Stas Sergeev [mailto:stsp@list.ru] > > 11.08.2015 19:33, Madalin-Cristian Bucur пишет: > > + Joakim, Shaohui > > > >> -----Original Message----- > >> From: Stas Sergeev [mailto:stsp@list.ru] > >> > >> 08.08.2015 20:32, Florian Fainelli пишет: > >>> CC'ing Stas, > >> Hi. > >> > >>> Le 08/05/15 07:42, Madalin Bucur a écrit : > >>>> The FMan MAC configuration code needs the speed and duplex > >> information > >>>> for fixed-link interfaces that is parsed now by the of function > >>>> of_phy_register_fixed_link(). This parses the fixed-link parameters but > >>>> does not expose to the caller neither the phy_device pointer nor the > >>>> status struct where it loads the fixed-link params. > > I've tried to make the smallest changes that allow me to retrieve those > > without modifying existing API. > > Why is it important to hide the default values from the MAC driver? > My worry is that the fixed values are not really fixed, and > therefore are not always useful to access directly. It is likely > not a problem for your use-case, as, as you say, the AN is > disabled, but this is probably not the best to do in general. Yes, not a problem in my case. > And also you do: > --- > > - err = of_phy_register_fixed_link(mac_node); > - if (err) > + struct phy_device *phy; > + > + mac_dev->fixed_link = kzalloc(sizeof(*mac_dev- > >fixed_link), > + GFP_KERNEL); > + if (of_phy_parse_fixed_link(mac_node, mac_dev- > >fixed_link)) > + goto _return_dev_set_drvdata; > + > + phy = fixed_phy_register(PHY_POLL, mac_dev->fixed_link, > + mac_node); > > --- > > which means you really want to circumvent the current OF > api quite a lot, without saying why in the patch description. I circumvent the API because I din not want to change existing API. If I could get a reference to the status struct without changing any code or without being required to call by myself fixed_phy_register(), I would of done that. Given the existing code in of_phy_register_fixed_link(), this was my only option. I could have broken of_phy_register_fixed_link() in two functions: of_phy_parse_fixed_link() and of_phy_register_fixed_link(), the latter doing only the call to fixed_phy_register() that would allow to keep of_phy_register_fixed_link() as it is, broken in two stages: - parsing - registering than can be used by other drivers in order to get the status but I think it's overkill. > As such, it may be difficult to review. Could you please write > a more complete description to the patch? To better understand this patch, think of it as just a refactoring of the of_phy_register_fixed_link() that does two things inside: - parsing of fixed link node (2 bindings supported) - register phy by calling fixed_phy_register() in the same way, in the same codebase I've extracted the parsing in a separate function ( following the "one function should do one thing" rule). Then I've exported this function to make status available to callers. > As to your problem: would it be possible to set speed & duplex > after you do of_phy_connect()? It returns the phy_device > pointer, and perhaps you can look into phydev->speed and > phydev->duplex at that point? It would be possible but un-natural as I'd have probing information only available at runtime. That would just complicate matters for my particular case ans I suspect there will be other drivers that get into this situation. You are concerned about people abusing this API to read fixed link status when the link is not really fixed, I'm concerned about declaring the link as fixed-link when it's not. Maybe the naming/binding needs to be revised to cover the case when all is fixed but the link. ????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?