Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965380AbbHKQd5 (ORCPT ); Tue, 11 Aug 2015 12:33:57 -0400 Received: from mail-bn1on0144.outbound.protection.outlook.com ([157.56.110.144]:20880 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755368AbbHKQdz (ORCPT ); Tue, 11 Aug 2015 12:33:55 -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/EeGP0M3EaSWT7KT29M554CYVyAgASdLgCAAAcBIA== Date: Tue, 11 Aug 2015 16:33:52 +0000 Message-ID: References: <1438785745-15517-1-git-send-email-madalin.bucur@freescale.com> <55C63D3B.5020005@gmail.com> <55CA1C14.3000202@list.ru> In-Reply-To: <55CA1C14.3000202@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;BL2PR03MB499;5:aVEsGXuidqqeWsGZYFfVpphI7lbt+iGZzmMDr26jG0Ace1wyeeouDdtO5FhPDcYcksDkPK/ON3ILs1rLddJihaEuKL5lVora3+E+OK3M6FwvY3U8BAQunrnYtjCq+d/0sJP5DjnNJpGfG+UtaH4wHA==;24:gCacdR093c5BytAg/OEofNrF2trCFDX0bq2LS00jsV8GcY02Fd7jbrnyi5nlK/NiTI+PSJK/H4sSOZkwbEdA4FfoQG2d+2heaH4RYxpWwos=;20:+B8JeEBWXZ9zhtnUF4CpLNnOnhKrBqHkOkCbjvgGPYc/VrZsnXGMWExtwaK8vm7cNRsCcz2IxDuobEae9XthCw== x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BL2PR03MB499; 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:BL2PR03MB499;BCL:0;PCL:0;RULEID:;SRVR:BL2PR03MB499; x-forefront-prvs: 066517B35B x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(57704003)(13464003)(199003)(479174004)(189002)(87936001)(107886002)(10400500002)(46102003)(2950100001)(4001540100001)(5001960100002)(76576001)(2656002)(5001770100001)(86362001)(74316001)(5001830100001)(105586002)(97736004)(2900100001)(81156007)(99286002)(15975445007)(106116001)(102836002)(66066001)(5002640100001)(33656002)(77096005)(5003600100002)(2501003)(92566002)(101416001)(76176999)(2201001)(5001860100001)(19580405001)(54356999)(64706001)(106356001)(189998001)(19580395003)(77156002)(122556002)(40100003)(62966003)(68736005)(50986999)(4001430100001)(179675005);DIR:OUT;SFP:1102;SCL:1;SRVR:BL2PR03MB499;H:BL2PR03MB545.namprd03.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Aug 2015 16:33:52.9009 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2PR03MB499 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 t7BGY2dG012009 Content-Length: 2994 Lines: 61 + 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 have only barely touched that code, but IMO both things > are by design. There are some API deficiencies, and so, many > drivers still use of_phy_find_device() to circumvent the encapsulation > and get the phy_device pointer, but this is unlikely a good thing > to do. I even proposed some API extensions, but there was no > interest. > > >> By extracting the > >> fixed-link parsing code from of_phy_register_fixed_link() into a > >> separate function the parsed values are made available without changing > >> the existing API. This change also removes a small redundancy in the > >> previous code calling fixed_phy_register(). > Today, the fixed_link is not always fixed. > See for example this patch (already mainlined): > https://lkml.org/lkml/2015/7/20/711 > of_phy_is_fixed_link() returns 'true' if you have > managed="in-band-status", and so the SGMII in-band status > can update fixed-link params. > > So my question is: why do you even need to know whether > the link is fixed or not? IIRC you can check the phy_device > pointer in the adjust_link callback of of_phy_connect() to get > the current link status values. Why is this not enough for your > task? Maybe the patch description should be updated to include > why the current technique is bad, what is actually fixed by the > change. > I think using the fixed-link DT values directly is not something > to be done. The encapsulation is there for a reason, so maybe > instead we can see what API additions do we need to avoid the > current limitations that force people to use of_phy_find_device() > and other work-arounds. I need to be able to determine the imposed speed and duplex for fixed link external PHYs because I need to configure the internal PHY with matching values. If I do not set the same speed, given the fact that AN needs to be off, there will be no link and no adjust link to fix things later (and the internal PHY is not updated by adjust link anyway). I do not have access at the phy pointer at the time I need the speed and duplex, to retrieve the defaults from there and 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? Thank you, Madalin ????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?