Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1203338 > unrolled thread

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

Started byFlorian Fainelli <f.fainelli@gmail.com>
First post2015-08-08 19:40 +0200
Last post2015-08-12 18:10 +0200
Articles 10 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 0/2] of: fsl/fman: reuse the fixed node parsing code Florian Fainelli <f.fainelli@gmail.com> - 2015-08-08 19:40 +0200
    Re: [PATCH 0/2] of: fsl/fman: reuse the fixed node parsing code Stas Sergeev <stsp@list.ru> - 2015-08-11 18:10 +0200
      RE: [PATCH 0/2] of: fsl/fman: reuse the fixed node parsing code Madalin-Cristian Bucur <madalin.bucur@freescale.com> - 2015-08-11 18:40 +0200
        Re: [PATCH 0/2] of: fsl/fman: reuse the fixed node parsing code Stas Sergeev <stsp@list.ru> - 2015-08-11 19:00 +0200
          RE: [PATCH 0/2] of: fsl/fman: reuse the fixed node parsing code Madalin-Cristian Bucur <madalin.bucur@freescale.com> - 2015-08-12 15:30 +0200
            Re: [PATCH 0/2] of: fsl/fman: reuse the fixed node parsing code Stas Sergeev <stsp@list.ru> - 2015-08-12 16:00 +0200
              RE: [PATCH 0/2] of: fsl/fman: reuse the fixed node parsing code Madalin-Cristian Bucur <madalin.bucur@freescale.com> - 2015-08-12 16:50 +0200
                Re: [PATCH 0/2] of: fsl/fman: reuse the fixed node parsing code Stas Sergeev <stsp@list.ru> - 2015-08-12 17:20 +0200
                  RE: [PATCH 0/2] of: fsl/fman: reuse the fixed node parsing code Madalin-Cristian Bucur <madalin.bucur@freescale.com> - 2015-08-12 17:30 +0200
                    Re: [PATCH 0/2] of: fsl/fman: reuse the fixed node parsing code Stas Sergeev <stsp@list.ru> - 2015-08-12 18:10 +0200

#1203338 — Re: [PATCH 0/2] of: fsl/fman: reuse the fixed node parsing code

FromFlorian Fainelli <f.fainelli@gmail.com>
Date2015-08-08 19:40 +0200
SubjectRe: [PATCH 0/2] of: fsl/fman: reuse the fixed node parsing code
Message-ID<pVgg9-5yS-15@gated-at.bofh.it>
CC'ing Stas,

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. 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().

I will look into this shortly, sorry for the delay.

> 
> The FMan patch relies on the latest FMan driver v4 submission by Igal Liberman:
> https://patchwork.ozlabs.org/project/netdev/list/?submitter=Igal.Liberman&state=*&q=v4
> 
> Madalin Bucur (2):
>   of: separate fixed link parsing from registration
>   fsl_fman: use fixed_phy_status for MEMAC
> 
>  .../ethernet/freescale/fman/flib/fsl_fman_memac.h  |  6 ++-
>  drivers/net/ethernet/freescale/fman/inc/mac.h      |  2 +-
>  drivers/net/ethernet/freescale/fman/mac/fm_memac.c | 42 ++++++++++++-----
>  drivers/net/ethernet/freescale/fman/mac/fm_memac.h |  3 +-
>  drivers/net/ethernet/freescale/fman/mac/mac.c      | 18 ++++++--
>  drivers/of/of_mdio.c                               | 52 ++++++++++++++--------
>  include/linux/of_mdio.h                            |  9 ++++
>  7 files changed, 94 insertions(+), 38 deletions(-)
> 


-- 
Florian
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1205251

FromStas Sergeev <stsp@list.ru>
Date2015-08-11 18:10 +0200
Message-ID<pWkhI-1Fq-27@gated-at.bofh.it>
In reply to#1203338
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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1205268

FromMadalin-Cristian Bucur <madalin.bucur@freescale.com>
Date2015-08-11 18:40 +0200
Message-ID<pWkKK-2d6-13@gated-at.bofh.it>
In reply to#1205251
KyBKb2FraW0sIFNoYW9odWkNCg0KPiAtLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0KPiBGcm9t
OiBTdGFzIFNlcmdlZXYgW21haWx0bzpzdHNwQGxpc3QucnVdDQo+IA0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BBTiBuZWVkcyB0byBiZSBvZmYsDQp0
aGVyZSB3aWxsIGJlIG5vIGxpbmsgYW5kIG5vIGFkanVzdCBsaW5rIHRvIGZpeCB0aGluZ3MgbGF0
ZXIgKGFuZCB0aGUgaW50ZXJuYWwgUEhZIGlzDQpub3QgdXBkYXRlZCBieSBhZGp1c3QgbGluayBh
bnl3YXkpLiBJIGRvIG5vdCBoYXZlIGFjY2VzcyBhdCB0aGUgcGh5IHBvaW50ZXIgYXQNCnRoZSB0
aW1lIEkgbmVlZCB0aGUgc3BlZWQgYW5kIGR1cGxleCwgdG8gcmV0cmlldmUgdGhlIGRlZmF1bHRz
IGZyb20gdGhlcmUgYW5kDQpJJ3ZlIHRyaWVkIHRvIG1ha2UgdGhlIHNtYWxsZXN0IGNoYW5nZXMg
dGhhdCBhbGxvdyBtZSB0byByZXRyaWV2ZSB0aG9zZSB3aXRob3V0DQptb2RpZnlpbmcgZXhpc3Rp
bmcgQVBJLg0KV2h5IGlzIGl0IGltcG9ydGFudCB0byBoaWRlIHRoZSBkZWZhdWx0IHZhbHVlcyBm
cm9tIHRoZSBNQUMgZHJpdmVyPw0KDQpUaGFuayB5b3UsDQpNYWRhbGluDQo=
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1205276

FromStas Sergeev <stsp@list.ru>
Date2015-08-11 19:00 +0200
Message-ID<pWl46-2zU-9@gated-at.bofh.it>
In reply to#1205268
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 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?
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.
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.
As such, it may be difficult to review. Could you please write
a more complete description to the patch?

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?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1206085

FromMadalin-Cristian Bucur <madalin.bucur@freescale.com>
Date2015-08-12 15:30 +0200
Message-ID<pWEgq-5DF-11@gated-at.bofh.it>
In reply to#1205276
PiAtLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0KPiBGcm9tOiBTdGFzIFNlcmdlZXYgW21haWx0
bzpzdHNwQGxpc3QucnVdDQo+IA0KPiAxMS4wOC4yMDE1IDE5OjMzLCBNYWRhbGluLUNyaXN0aWFu
IEJ1Y3VyINC/0LjRiNC10YI6DQo+ID4gKyBKb2FraW0sIFNoYW9odWkNCj4gPg0KPiA+PiAtLS0t
LU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0KPiA+PiBGcm9tOiBTdGFzIFNlcmdlZXYgW21haWx0bzpz
dHNwQGxpc3QucnVdDQo+ID4+DQo+ID4+IDA4LjA4LjIwMTUgMjA6MzIsIEZsb3JpYW4gRmFpbmVs
bGkg0L/QuNGI0LXRgjoNCj4gPj4+IENDJ2luZyBTdGFzLA0KPiA+PiBIaS4NCj4gPj4NCj4gPj4+
IExlIDA4LzA1LzE1IDA3OjQyLCBNYWRhbGluIEJ1Y3VyIGEgw6ljcml0IDoNCj4gPj4+PiBUaGUg
Rk1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CndpbGwgYmUgb3RoZXIgZHJpdmVycyB0aGF0IGdl
dCBpbnRvIHRoaXMgc2l0dWF0aW9uLiBZb3UgYXJlIGNvbmNlcm5lZCBhYm91dCBwZW9wbGUNCmFi
dXNpbmcgdGhpcyBBUEkgdG8gcmVhZCBmaXhlZCBsaW5rIHN0YXR1cyB3aGVuIHRoZSBsaW5rIGlz
IG5vdCByZWFsbHkgZml4ZWQsIEknbSBjb25jZXJuZWQNCmFib3V0IGRlY2xhcmluZyB0aGUgbGlu
ayBhcyBmaXhlZC1saW5rIHdoZW4gaXQncyBub3QuIE1heWJlIHRoZSBuYW1pbmcvYmluZGluZyBu
ZWVkcyB0byBiZQ0KcmV2aXNlZCB0byBjb3ZlciB0aGUgY2FzZSB3aGVuIGFsbCBpcyBmaXhlZCBi
dXQgdGhlIGxpbmsuDQoNCg==
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1206133

FromStas Sergeev <stsp@list.ru>
Date2015-08-12 16:00 +0200
Message-ID<pWEJs-6cZ-17@gated-at.bofh.it>
In reply to#1206085
12.08.2015 16:26, Madalin-Cristian Bucur пишет:
>>> 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.
What I referred to as "circumventing an API" is that you do
phy = fixed_phy_register(PHY_POLL, mac_dev->fixed_link, + mac_node);
by hands, instead of letting the of_phy_register_fixed_link() doing so.

How about a smaller circumvention, like this for instance:
---
err = of_phy_register_fixed_link(mac_node);
phy = of_phy_find_device(dn);
status = fixed_phy_get_link_status(phy);    // no such func, to be coded up
---

Or even like this:
---
err = of_phy_register_fixed_link(mac_node);
phy = of_phy_find_device(dn);
set_speed_and_duplex(phy->speed, phy->duplex);    // not sure if these 
values are available that early
---

Also I meant the description should have been in the patch,
not in the e-mail. :) You only wrote _what_ the patch does
(which is of course obvious from the code itself), but not
_why_ and _what was fixed_ (what didn't work).

>> 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.
This is un-natural only if you deal just with a fixed case.
If your driver can deal also with the non-fixed cases
(either AN or MDIO), then this looks more natural as the
non-fixed management should be done at any point of time,
and certainly _after_ of_phy_connect(). So if your driver is
universal, this look like the natural choise to me, but if it is
limited to the fixed case, then, as a simplification, you move
that to the init time.
But I am not argueing what is more natural. Maybe the
above approaches with of_phy_find_device() can be used
in init time?

>   That would just complicate matters for my particular case ans I suspect there
> will be other drivers that get into this situation.
I suspect only those that are limited to the fixed-link case.
Only then they may decide to move phy management to
init time, but IMHO this is just an optimization.

>   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.
Yes, naming is the problem. fixed-link is just a bad name.
See how it is defined:
---
Some Ethernet MACs have a "fixed link", and are not connected to a
normal MDIO-managed PHY device.
---
To me this means any non-MDIO PHY connection, but
unfortunately the name "fixed-link" suggests a bit more
than advertised. :(
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1206183

FromMadalin-Cristian Bucur <madalin.bucur@freescale.com>
Date2015-08-12 16:50 +0200
Message-ID<pWFvQ-7mW-33@gated-at.bofh.it>
In reply to#1206133
PiAtLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0KPiBGcm9tOiBTdGFzIFNlcmdlZXYgW21haWx0
bzpzdHNwQGxpc3QucnVdDQo+DQo+IDEyLjA4LjIwMTUgMTY6MjYsIE1hZGFsaW4tQ3Jpc3RpYW4g
QnVjdXIg0L/QuNGI0LXRgjoNCj4gPj4+IEkndmUgdHJpZWQgdG8gbWFrZSB0aGUgc21hbGxlc3Qg
Y2hhbmdlcyB0aGF0IGFsbG93IG1lIHRvIHJldHJpZXZlIHRob3NlDQo+ID4+PiB3aXRob3V0IG1v
ZGlmeWluZyBleGlzdGluZyBBUEkuDQo+ID4+PiBXaHkgaXMgaXQgaW1wb3J0YW50IHRvIGhpZGUg
dGhlIGRlZmF1bHQgdmFsdWVzIGZyb20gdGhlIE1BQyBkcml2ZXI/DQo+ID4+IE15IHdvcnJ5IGlz
IHRoYXQgdGhlIGZpeGVkIHZhbHVlcyBhcmUgbm90IHJlYWxseSBmaXhlZCwgYW5kDQo+ID4+IHRo
ZXJlZ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Cj4gPiByZXZpc2VkIHRvIGNvdmVyIHRoZSBj
YXNlIHdoZW4gYWxsIGlzIGZpeGVkIGJ1dCB0aGUgbGluay4NCj4gWWVzLCBuYW1pbmcgaXMgdGhl
IHByb2JsZW0uIGZpeGVkLWxpbmsgaXMganVzdCBhIGJhZCBuYW1lLg0KPiBTZWUgaG93IGl0IGlz
IGRlZmluZWQ6DQo+IC0tLQ0KPiBTb21lIEV0aGVybmV0IE1BQ3MgaGF2ZSBhICJmaXhlZCBsaW5r
IiwgYW5kIGFyZSBub3QgY29ubmVjdGVkIHRvIGENCj4gbm9ybWFsIE1ESU8tbWFuYWdlZCBQSFkg
ZGV2aWNlLg0KPiAtLS0NCj4gVG8gbWUgdGhpcyBtZWFucyBhbnkgbm9uLU1ESU8gUEhZIGNvbm5l
Y3Rpb24sIGJ1dA0KPiB1bmZvcnR1bmF0ZWx5IHRoZSBuYW1lICJmaXhlZC1saW5rIiBzdWdnZXN0
cyBhIGJpdCBtb3JlDQo+IHRoYW4gYWR2ZXJ0aXNlZC4gOigNCg0KWWVzLCBtYXliZSB0aGUgbmV3
IGJpbmRpbmcgY291bGQgYmUgdXBkYXRlZCB0byBsb2FkIHNlbWFudGljYWxseSB0aGUgcHJlc2Vu
Y2UNCm9yIGFic2VuY2Ugb2YgY2VydGFpbiBwYXJhbWV0ZXJzIHN1Y2ggYXMgbGluay4NCg==
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1206207

FromStas Sergeev <stsp@list.ru>
Date2015-08-12 17:20 +0200
Message-ID<pWFYS-8aR-13@gated-at.bofh.it>
In reply to#1206183
12.08.2015 17:43, Madalin-Cristian Bucur пишет:
>> -----Original Message-----
>> From: Stas Sergeev [mailto:stsp@list.ru]
>>
>> 12.08.2015 16:26, Madalin-Cristian Bucur пишет:
>>>>> 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.
>> What I referred to as "circumventing an API" is that you do
>> phy = fixed_phy_register(PHY_POLL, mac_dev->fixed_link, + mac_node);
>> by hands, instead of letting the of_phy_register_fixed_link() doing so.
>>
>> How about a smaller circumvention, like this for instance:
>> ---
>> err = of_phy_register_fixed_link(mac_node);
>> phy = of_phy_find_device(dn);
>> status = fixed_phy_get_link_status(phy);    // no such func, to be coded up
>> ---
>>
>> Or even like this:
>> ---
>> err = of_phy_register_fixed_link(mac_node);
>> phy = of_phy_find_device(dn);
>> set_speed_and_duplex(phy->speed, phy->duplex);    // not sure if these
>> values are available that early
>> ---
> After my patch, all that of_phy_register_fixed_link() does is to call
> the new parsing function I introduced then register the fixed PHY.
> I could have done this (pseudocode):
>
> - add of_phy_parse_fixed_link() as seen in the patch
> - add of_phy_register_fixed_phy() that just calls fixed_phy_register():
>
> int of_phy_register_fixed_phy(node)
> {
> 	phy = fixed_phy_register(PHY_POLL, mac_dev->fixed_link,
> 				     mac_node);
> 	return (!phy);
> }
>
> - change of_phy_register_fixed_link() to contain only this:
>
> int of_phy_register_fixed_link(node)
> {
> 	of_phy_parse_fixed_link(node, &status);
>
> 	return of_phy_register_fixed_phy(node);
> }
But have you looked into the patch I pointed previously?
https://lkml.org/lkml/2015/7/20/711
You code will likely clash with it because my patch extends
of_phy_register_fixed_link().

> Then I could call only of_* functions but the end result would be the same and
> of_phy_register_fixed_phy() would not justify its existence that much...
You didn't say you wanted to obsolete the of_phy_register_fixed_phy().
Since it is there (and even changed by me in a way your
patch will likely clash), IMHO it would be better if it is used,
rather than copy/pasted into the driver.

> The getter for status you suggest would be fine, but not sure how one would retrieve
> it from the mac_node unless we change of_phy_register_fixed_link() to return the
> pointer to phy (and all the drivers that use it...).
If you look for instance to mvneta.c, you'll find the following:
---
err = of_phy_register_fixed_link(dn);
/* In the case of a fixed PHY, the DT node associated
  * to the PHY is the Ethernet MAC DT node.
  */
  phy_node = of_node_get(dn);
...
phy = of_phy_find_device(dn);
---

So the answer is: just use the same mac_node for both.

>> Also I meant the description should have been in the patch,
>> not in the e-mail. :) You only wrote _what_ the patch does
>> (which is of course obvious from the code itself), but not
>> _why_ and _what was fixed_ (what didn't work).
>>
> If you refer to the first, separation patch, I thought the description was enough:
>
>      of: separate fixed link parsing from registration
>      
>      Some drivers may need
"may need"? I don't understand.
If it is a fix, then they _do need_, and in this case it should
be specified what was broken and what is fixed.
If it is just a clean-up, then "may need" may suffice, but it
was not mentioned it is a clean-up. So I still don't know what
this patch is all about.
"Some drivers" - which ones? The ones that are limited to
the purely fixed links, and never support AN or MDIO?
Or some other drivers too?
So really, the description sounds very cryptic to me.

>   to parse the fixed link values before registering
>      the fixed link phy. Separate the parsing from the actual registration
>      and provide an export for the added parsing function.
>      
>      Signed-off-by: Madalin Bucur <madalin.bucur@freescale.com>
>
> For this one it was a bit brief, I admit - the longer version would be that before it
> we were not using from fixed link anything else but the fact the link was fixed
> (ignored actual speed, duplex values there)
And what didn't work as the result?

>   and this patch tries to fix that.
What started to work after that patch that didn't without it?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1206216

FromMadalin-Cristian Bucur <madalin.bucur@freescale.com>
Date2015-08-12 17:30 +0200
Message-ID<pWG8y-8me-19@gated-at.bofh.it>
In reply to#1206207
PiAtLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0KPiBGcm9tOiBTdGFzIFNlcmdlZXYgW21haWx0
bzpzdHNwQGxpc3QucnVdDQoNCjxzbmlwPg0KPiBCdXQgaGF2ZSB5b3UgbG9va2VkIGludG8gdGhl
IHBhdGNoIEkgcG9pbnRlZCBwcmV2aW91c2x5Pw0KPiBodHRwczovL2xrbWwub3JnL2xrbWwvMjAx
NS83LzIwLzcxMQ0KPiBZb3UgY29kZSB3aWxsIGxpa2VseSBjbGFzaCB3aXRoIGl0IGJlY2F1c2Ug
bXkgcGF0Y2ggZXh0ZW5kcw0KPiBvZl9waHlfcmVnaXN0ZXJfZml4ZWRfbGluaygpLg0KPiANCg0K
SSBhZG1pbiBJIGZhaWxlZCB0byBncmFzcCB0aGUgZGV0YWlscyBvZiB5b3VyIGNoYW5nZSAtIHRo
ZSBsYWNrIG9mIGFtcGxlIGNvbnRleHQNCkxpbmVzIG1ha2VzIGl0IGEgYml0IGRpZmZpY3V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org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1206234

FromStas Sergeev <stsp@list.ru>
Date2015-08-12 18:10 +0200
Message-ID<pWGLi-Uh-61@gated-at.bofh.it>
In reply to#1206216
12.08.2015 18:27, Madalin-Cristian Bucur пишет:
>>> Then I could call only of_* functions but the end result would be the same
>>> and  of_phy_register_fixed_phy() would not justify its existence that much...
>> You didn't say you wanted to obsolete the of_phy_register_fixed_phy().
>> Since it is there (and even changed by me in a way your
>> patch will likely clash), IMHO it would be better if it is used,
>> rather than copy/pasted into the driver.
> Please note I was referring to a fictional new function that would embed the call to
> fixed_phy_register(). I was not talking about some existing API, just about a new
> of_call  named of_phy_register_fixed_phy()  that would in the end be called by
> of_phy_register_fixed_link() and by some drivers that want to get in the middle
> of things and get a hold on status.
Hmm, and for exactly unknown reason in your pseudocode
of_phy_register_fixed_phy() doesn't take status as an argument. :)
So I didn't see its point.
If you fix your pseudo-code, you'll add the status argument,
because it is needed for fixed_phy_register() anyway.
After that, the drivers that want to provide the status, will
just use it rather than to call fixed_phy_register() directly.
And with my changes it really have even more merits to exist.

> Maybe the fact we're reviewing two patches in one thread is what makes the
> discussion less than optimal.
I guess the bugs in the pseudo-code made me to miss its point.

>>> The getter for status you suggest would be fine, but not sure how one
>>> would retrieve
>>> it from the mac_node unless we change of_phy_register_fixed_link() to
>>> return the
>>> pointer to phy (and all the drivers that use it...).
>> If you look for instance to mvneta.c, you'll find the following:
>> ---
>> err = of_phy_register_fixed_link(dn);
>> /* In the case of a fixed PHY, the DT node associated
>>    * to the PHY is the Ethernet MAC DT node.
>>    */
>>    phy_node = of_node_get(dn);
>> ...
>> phy = of_phy_find_device(dn);
>> ---
>>
>> So the answer is: just use the same mac_node for both.
> I understand, I'll use this approach although is suboptimal imho to
Exactly!
But at least this way is used in many currently existing
drivers, while getting the fixed-link parameters directly from
DT - is a new way of circumventing the existing API.
So I'd vote for the currently existing hacks, and in fact
I already tried to start a discussion about getting rid of the
need for of_phy_find_device(), but it didn't go.

> scan the device tree again to get a phy pointer that you need just
> to get some of info that was parsed in a call you just made.
Maybe (just maybe) of_phy_register_fixed_link() could
return the phy_device pointer. At least it will solve your
problem very cheaply. But I am sure such API additions
require a separate discussion, can't be done in a context
of discussing a small fix. If you have some free time, feel
free to raise such a discussion with API extension proposals.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web