RE: [PATCH 0/2] of: fsl/fman: reuse the fixed node parsing code

Madalin-Cristian Bucur
2015-08-11T16:33:57Z

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 2994 bytes --]

+ 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Ç+‰·Ÿ®‰­†+%ŠËÿ±éÝ¶\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dÊ‡Ú™ë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥