From: Alexander Stein <hidden> Date: 2016-05-18 16:03:38
This currently only supports PEF7071 and allows to specify max-speed and
is able to read the LED configuration from device-tree.
Signed-off-by: Alexander Stein <redacted>
---
The main purpose for now is to set a LED configuration from device tree and
to limit the maximum speed. The latter one in my case hardware limited.
As MAC and it's link partner support 1000MBit/s they would try to use that
but will eventually fail due to magnetics only supporting 100MBit/s. So
limit the maximum link speed supported directly from the start.
As this is a RFC I skipped the device tree binding doc.
drivers/net/phy/Kconfig | 5 ++
drivers/net/phy/Makefile | 1 +
drivers/net/phy/lantiq.c | 167 +++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 173 insertions(+)
create mode 100644 drivers/net/phy/lantiq.c
CC'ing Andrew, John,
On 05/18/2016 09:03 AM, Alexander Stein wrote:
This currently only supports PEF7071 and allows to specify max-speed and
is able to read the LED configuration from device-tree.
Signed-off-by: Alexander Stein <redacted>
---
The main purpose for now is to set a LED configuration from device tree and
to limit the maximum speed. The latter one in my case hardware limited.
As MAC and it's link partner support 1000MBit/s they would try to use that
but will eventually fail due to magnetics only supporting 100MBit/s. So
limit the maximum link speed supported directly from the start.
The 'max-speed' parsing that you do in the driver should not be needed,
PHYLIB takes care of that already see
drivers/net/phy/phy_device.c::of_set_phy_supported
For LEDs, we had a patch series floating around adding LED triggers [1],
and it seems to me like the LEDs class subsystem would be a good fit for
controlling PHY LEDs, possibly with the help of PHYLIB when it comes to
doing the low-level work of registering LEDs and their names with the
LEDS subsystem.
[1]: http://lists.openwall.net/netdev/2016/03/23/61
As this is a RFC I skipped the device tree binding doc.
Too bad, that's probably what needs to be discussed here, because the
driver looks pretty reasonable otherwise.
From: Andrew Lunn <andrew@lunn.ch> Date: 2016-05-18 17:01:14
For LEDs, we had a patch series floating around adding LED triggers [1],
and it seems to me like the LEDs class subsystem would be a good fit for
controlling PHY LEDs, possibly with the help of PHYLIB when it comes to
doing the low-level work of registering LEDs and their names with the
LEDS subsystem.
[1]: http://lists.openwall.net/netdev/2016/03/23/61
That patch fizzled out. I got the feeling it was pushing the
capabilities of the coder. I do however think it is a reasonable path
to follow for PHY LEDs.
I took a quick look at the datasheet and the controlling of the LEDs
is very flexible. It should not be a problem to expose some of that
functionality via LED triggers.
Andrew
This currently only supports PEF7071 and allows to specify max-speed and
is able to read the LED configuration from device-tree.
Signed-off-by: Alexander Stein <redacted>
---
The main purpose for now is to set a LED configuration from device tree and
to limit the maximum speed. The latter one in my case hardware limited.
As MAC and it's link partner support 1000MBit/s they would try to use that
but will eventually fail due to magnetics only supporting 100MBit/s. So
limit the maximum link speed supported directly from the start.
The 'max-speed' parsing that you do in the driver should not be needed,
PHYLIB takes care of that already see
drivers/net/phy/phy_device.c::of_set_phy_supported
For LEDs, we had a patch series floating around adding LED triggers [1],
and it seems to me like the LEDs class subsystem would be a good fit for
controlling PHY LEDs, possibly with the help of PHYLIB when it comes to
doing the low-level work of registering LEDs and their names with the
LEDS subsystem.
[1]: http://lists.openwall.net/netdev/2016/03/23/61
quoted
As this is a RFC I skipped the device tree binding doc.
Too bad, that's probably what needs to be discussed here, because the
driver looks pretty reasonable otherwise.
From: Alexander Stein <hidden> Date: 2016-05-19 06:58:05
Hi John,
On Thursday 19 May 2016 06:50:56, John Crispin wrote:
On 18/05/2016 18:24, Florian Fainelli wrote:
quoted
CC'ing Andrew, John,
also CC'ing Matthias and Hauke. we have had a driver in OpenWrt/LEDE for
several years that seems a little more complete than this one.
https://git.lede-project.org/?p=source.git;a=blob;f=target/linux/lantiq/patc
hes-4.4/0023-NET-PHY-adds-driver-for-lantiq-PHY11G.patch;h=93bb4275ec1d261f3
98afb8fdc879c1dd973f997;hb=HEAD
Thanks for the link, I wasn't aware of that patch. I like it in general, but
there are some things I'd like to get addressed first:
* vr9_gphy_of_reg_init() writes uncoditionally to led3h and led3l even on
PEf7071 which does not have this register at all
* Why is PHY_HAS_INTERRUPT commented out everywhere?
* ltq_phy_init and ltq_phy_exit can be simplified using phy_drivers_register
and phy_drivers_unregister
* A mdio_device_id table is missing
Best regards,
Alexander
From: John Crispin <john@phrozen.org> Date: 2016-05-19 07:03:36
[ changing haukes mail addr to the intel one ]
On 19/05/2016 08:57, Alexander Stein wrote:
Hi John,
On Thursday 19 May 2016 06:50:56, John Crispin wrote:
quoted
On 18/05/2016 18:24, Florian Fainelli wrote:
quoted
CC'ing Andrew, John,
also CC'ing Matthias and Hauke. we have had a driver in OpenWrt/LEDE for
several years that seems a little more complete than this one.
https://git.lede-project.org/?p=source.git;a=blob;f=target/linux/lantiq/patc
hes-4.4/0023-NET-PHY-adds-driver-for-lantiq-PHY11G.patch;h=93bb4275ec1d261f3
98afb8fdc879c1dd973f997;hb=HEAD
Thanks for the link, I wasn't aware of that patch. I like it in general, but
there are some things I'd like to get addressed first:
* vr9_gphy_of_reg_init() writes uncoditionally to led3h and led3l even on
PEf7071 which does not have this register at all
we use this driver mainly on the 11g and 22f version. mathias recently
added the led3 handling.
@Mathias, can you have a look at this and fix it inside the lede tree ?
* Why is PHY_HAS_INTERRUPT commented out everywhere?
legacy code, the old mips silicon had a bug and the internal phys irq
lines worked unreliably so we used polling instead. rather than remove
the code i just disabled that part. code is not cleaned up yet for
upstream submission as you can tell :-)
* ltq_phy_init and ltq_phy_exit can be simplified using phy_drivers_register
and phy_drivers_unregister
yes, this driver is based on a version made by daniel from spharion
about 5 years ago. that api probably did not exist at the time
From: Alexander Stein <hidden> Date: 2016-05-19 07:05:16
On Wednesday 18 May 2016 19:01:09, Andrew Lunn wrote:
quoted
For LEDs, we had a patch series floating around adding LED triggers [1],
and it seems to me like the LEDs class subsystem would be a good fit for
controlling PHY LEDs, possibly with the help of PHYLIB when it comes to
doing the low-level work of registering LEDs and their names with the
LEDS subsystem.
[1]: http://lists.openwall.net/netdev/2016/03/23/61
That patch fizzled out. I got the feeling it was pushing the
capabilities of the coder. I do however think it is a reasonable path
to follow for PHY LEDs.
I took a quick look at the datasheet and the controlling of the LEDs
is very flexible. It should not be a problem to expose some of that
functionality via LED triggers.
To be honest I don't know how the PHY LEDs could be set by LED triggers.
Wouldn't that require to create triggers for each value which can be written
to LEDxH and LEDxL? In my case the hardware requires some specific setting due
to LED connections.
Of course making the LED configuration changeable at runtime would be awesome.
Best regards,
Alexander
From: Alexander Stein <hidden> Date: 2016-05-19 07:28:09
On Thursday 19 May 2016 09:03:26, John Crispin wrote:
[ changing haukes mail addr to the intel one ]
On 19/05/2016 08:57, Alexander Stein wrote:
quoted
Hi John,
On Thursday 19 May 2016 06:50:56, John Crispin wrote:
quoted
On 18/05/2016 18:24, Florian Fainelli wrote:
quoted
CC'ing Andrew, John,
also CC'ing Matthias and Hauke. we have had a driver in OpenWrt/LEDE for
several years that seems a little more complete than this one.
https://git.lede-project.org/?p=source.git;a=blob;f=target/linux/lantiq/p
atc
hes-4.4/0023-NET-PHY-adds-driver-for-lantiq-PHY11G.patch;h=93bb4275ec1d2
61f3 98afb8fdc879c1dd973f997;hb=HEAD
Thanks for the link, I wasn't aware of that patch. I like it in general,
but there are some things I'd like to get addressed first:
* vr9_gphy_of_reg_init() writes uncoditionally to led3h and led3l even on
PEf7071 which does not have this register at all
we use this driver mainly on the 11g and 22f version. mathias recently
added the led3 handling.
@Mathias, can you have a look at this and fix it inside the lede tree ?
quoted
* Why is PHY_HAS_INTERRUPT commented out everywhere?
legacy code, the old mips silicon had a bug and the internal phys irq
lines worked unreliably so we used polling instead. rather than remove
the code i just disabled that part. code is not cleaned up yet for
upstream submission as you can tell :-)
Would you or Mathias mind dropping a cleaned up patch to netdev ml, cc'ing me?
I can try it on our hardware using the 11g. Maybe I can even test the IRQ
feature.
Regards,
Alexander
2016-05-19 9:03 GMT+02:00 John Crispin [off-list ref]:
On 19/05/2016 08:57, Alexander Stein wrote:
quoted
Thanks for the link, I wasn't aware of that patch. I like it in general, but
there are some things I'd like to get addressed first:
* vr9_gphy_of_reg_init() writes uncoditionally to led3h and led3l even on
PEf7071 which does not have this register at all
we use this driver mainly on the 11g and 22f version. mathias recently
added the led3 handling.
@Mathias, can you have a look at this and fix it inside the lede tree ?
Well, I haven't added the led3 handling, I've only changed the initial
value (function) of led3.
Maybe it's cleaner to not use a default value for the led function and
completely rely on the device tree bindings. But by adjusting the
initial values, I had to change only the led function of one board in
the openwrt xrx200 subtarget instead of touching all dts files.
I know that the LTQ Datasheet for the PEF 7071 Version 1.5 mentions
the led3 control register albeit there is no pin for a forth led. So I
guess it's safe to write to the led3 register even for the PEF 7071.
Mathias
From: Alexander Stein <hidden> Date: 2016-05-19 10:21:46
On Thursday 19 May 2016 12:03:10, Mathias Kresin wrote:
2016-05-19 9:03 GMT+02:00 John Crispin [off-list ref]:
quoted
On 19/05/2016 08:57, Alexander Stein wrote:
quoted
Thanks for the link, I wasn't aware of that patch. I like it in general,
but there are some things I'd like to get addressed first:
* vr9_gphy_of_reg_init() writes uncoditionally to led3h and led3l even on
PEf7071 which does not have this register at all
we use this driver mainly on the 11g and 22f version. mathias recently
added the led3 handling.
@Mathias, can you have a look at this and fix it inside the lede tree ?
Well, I haven't added the led3 handling, I've only changed the initial
value (function) of led3.
Maybe it's cleaner to not use a default value for the led function and
completely rely on the device tree bindings. But by adjusting the
initial values, I had to change only the led function of one board in
the openwrt xrx200 subtarget instead of touching all dts files.
I think setting default values is good.
I know that the LTQ Datasheet for the PEF 7071 Version 1.5 mentions
the led3 control register albeit there is no pin for a forth led. So I
guess it's safe to write to the led3 register even for the PEF 7071.
Mh, my PEF 7071 User Manual (Version 2.0, 2012-10-17) doesn't mention LED3x
registers. There is LED3DA and LED3EN in PHY_LED but was removed in 1.6
manual.
I think, some flag if the PHY supports LED3 and depend on that is just fine.
Best regards,
Alexander
From: Andrew Lunn <andrew@lunn.ch> Date: 2016-05-19 12:15:48
To be honest I don't know how the PHY LEDs could be set by LED triggers.
Wouldn't that require to create triggers for each value which can be written
to LEDxH and LEDxL? In my case the hardware requires some specific setting due
to LED connections.
Supporting all possibilities is not possible. However you could
picking out a subset which other PHYs could also implement. Think
about the typical patterns you see if you have two LEDs, which seems
to be the most common setup.
We would have generic PHY trigger code, and a driver specific part
which configures the PHY to that configuration, if the trigger is
activated.
Andrew
-----Original Message-----
From: Alexander Stein [mailto:alexander.stein@systec-electronic.com]
Sent: Thursday, May 19, 2016 12:22 PM
To: Mathias Kresin <redacted>
Cc: John Crispin <john@phrozen.org>; Florian Fainelli <f.fainelli@gmail.com>;
netdev@vger.kernel.org; linux-kernel@vger.kernel.org; andrew@lunn.ch;
Mehrtens, Hauke [off-list ref]
Subject: Re: [PATCH 1/1 RFC] net/phy: Add Lantiq PHY driver
On Thursday 19 May 2016 12:03:10, Mathias Kresin wrote:
quoted
2016-05-19 9:03 GMT+02:00 John Crispin [off-list ref]:
quoted
On 19/05/2016 08:57, Alexander Stein wrote:
quoted
Thanks for the link, I wasn't aware of that patch. I like it in
general, but there are some things I'd like to get addressed first:
* vr9_gphy_of_reg_init() writes uncoditionally to led3h and led3l
even on
PEf7071 which does not have this register at all
we use this driver mainly on the 11g and 22f version. mathias
recently added the led3 handling.
@Mathias, can you have a look at this and fix it inside the lede tree ?
Well, I haven't added the led3 handling, I've only changed the initial
value (function) of led3.
Maybe it's cleaner to not use a default value for the led function and
completely rely on the device tree bindings. But by adjusting the
initial values, I had to change only the led function of one board in
the openwrt xrx200 subtarget instead of touching all dts files.
I think setting default values is good.
The registers are set to some reset values after the chip is coming out of reset, but we should set them all to the same value, Mathias said that all except for one board he knows are using only one LED per port, but they are often using different LED pins, I will change my patch.
quoted
I know that the LTQ Datasheet for the PEF 7071 Version 1.5 mentions
the led3 control register albeit there is no pin for a forth led. So I
guess it's safe to write to the led3 register even for the PEF 7071.
Mh, my PEF 7071 User Manual (Version 2.0, 2012-10-17) doesn't mention
LED3x registers. There is LED3DA and LED3EN in PHY_LED but was removed in
1.6 manual.
LED3x is only available in PEF 7072 which is a different package with more pins for the LED3 and some other interfaces.
I think, some flag if the PHY supports LED3 and depend on that is just fine.
I do not know how to distinguish between PEF 7071 and PEF 7072.
Hauke
From: Alexander Stein <hidden> Date: 2016-05-23 09:49:57
Hi Hauke,
On Monday 23 May 2016 09:12:54, Mehrtens, Hauke wrote:
quoted
On Thursday 19 May 2016 12:03:10, Mathias Kresin wrote:
quoted
2016-05-19 9:03 GMT+02:00 John Crispin [off-list ref]:
quoted
On 19/05/2016 08:57, Alexander Stein wrote:
quoted
Thanks for the link, I wasn't aware of that patch. I like it in
general, but there are some things I'd like to get addressed first:
* vr9_gphy_of_reg_init() writes uncoditionally to led3h and led3l
even on
PEf7071 which does not have this register at all
we use this driver mainly on the 11g and 22f version. mathias
recently added the led3 handling.
@Mathias, can you have a look at this and fix it inside the lede tree
?
Well, I haven't added the led3 handling, I've only changed the initial
value (function) of led3.
Maybe it's cleaner to not use a default value for the led function and
completely rely on the device tree bindings. But by adjusting the
initial values, I had to change only the led function of one board in
the openwrt xrx200 subtarget instead of touching all dts files.
I think setting default values is good.
The registers are set to some reset values after the chip is coming out of
reset, but we should set them all to the same value, Mathias said that all
except for one board he knows are using only one LED per port, but they are
often using different LED pins, I will change my patch.
One LED per port? I would think of using one RJ45 socket per port which
usually have 2 LEDs.
quoted
quoted
I know that the LTQ Datasheet for the PEF 7071 Version 1.5 mentions
the led3 control register albeit there is no pin for a forth led. So I
guess it's safe to write to the led3 register even for the PEF 7071.
Mh, my PEF 7071 User Manual (Version 2.0, 2012-10-17) doesn't mention
LED3x registers. There is LED3DA and LED3EN in PHY_LED but was removed in
1.6 manual.
LED3x is only available in PEF 7072 which is a different package with more
pins for the LED3 and some other interfaces.
quoted
I think, some flag if the PHY supports LED3 and depend on that is just
fine.
I do not know how to distinguish between PEF 7071 and PEF 7072.
I expected that PEF 7072 would have a different PHY ID, but apparently this is
not the case, though I don't have a datasheet for 7072. Is there really no way
to distinguish those two?
Alexander
2016-05-23 11:49 GMT+02:00 Alexander Stein
[off-list ref]:
quoted
The registers are set to some reset values after the chip is coming out of
reset, but we should set them all to the same value, Mathias said that all
except for one board he knows are using only one LED per port, but they are
often using different LED pins, I will change my patch.
One LED per port? I would think of using one RJ45 socket per port which
usually have 2 LEDs.
The majority of the CPEs I'm talking about, do not have any leds at
the back side RJ45 socket. They are using a single led at the front
for status indication.
I'm only aware of one CPE that has two LEDs at the RJ45 socket.
Mathias