phy/fixed.c: rework to not duplicate PHY layer functionality
Subsystems (6)
PATCH 1/3 phy/fixed.c: rework to not duplicate PHY layer functionality
With that patch fixed.c now fully emulates MDIO bus, thus no need to duplicate PHY layer functionality. That, in turn, drastically simplifies the code, and drops down line count.
As an additional bonus, now there is no need to register MDIO bus for each PHY, all emulated PHYs placed on the platform fixed MDIO bus. There is also no more need to pre-allocate PHYs via .config option, this is all now handled dynamically.
p.s. Don't even try to understand patch content! Better: apply patch and look into resulting drivers/net/phy/fixed.c.
---
drivers/net/phy/Kconfig | 32 +-- drivers/net/phy/fixed.c | 427 ++++++++++++++++----------------------------- include/linux/phy_fixed.h | 49 ++--- 3 files changed, 176 insertions(+), 332 deletions(-)
drivers/net/phy/Kconfig +5 -27
@@ -61,34 +61,12 @@ config ICPLUS_PHY Currently supports the IP175C PHY. config FIXED_PHY - tristate "Drivers for PHY emulation on fixed speed/link" + tristate "Drivers for MDIO Bus/PHY emulation on fixed speed/link" ---help--- - Adds the driver to PHY layer to cover the boards that do not have any PHY bound, - but with the ability to manipulate the speed/link in software. The relevant MII - speed/duplex parameters could be effectively handled in a user-specified function. - Currently tested with mpc866ads. - -config FIXED_MII_10_FDX - bool "Emulation for 10M Fdx fixed PHY behavior" - depends on FIXED_PHY - -config FIXED_MII_100_FDX - bool "Emulation for 100M Fdx fixed PHY behavior" - depends on FIXED_PHY - -config FIXED_MII_1000_FDX - bool "Emulation for 1000M Fdx fixed PHY behavior" - depends on FIXED_PHY - -config FIXED_MII_AMNT - int "Number of emulated PHYs to allocate " - depends on FIXED_PHY - default "1" - ---help--- - Sometimes it is required to have several independent emulated - PHYs on the bus (in case of multi-eth but phy-less HW for instance). - This control will have specified number allocated for each fixed - PHY type enabled. + Adds the platform "fixed" MDIO Bus to cover the boards that use + PHYs that are not connected to the real MDIO bus. + + Currently tested with mpc866ads and mpc8349e-mitx. config MDIO_BITBANG tristate "Support for bitbanged MDIO buses"
drivers/net/phy/fixed.c +151 -276
513 lines not on this page · raw message
include/linux/phy_fixed.h +20 -29
58 lines not on this page · raw message
PATCH 2/3 fsl_soc: add support for gianfar for fixed-link property
fixed-link says: register new "Fixed/emulated PHY", i.e. PHY that not connected to the real MDIO bus.
---
Documentation/powerpc/booting-without-of.txt | 3 + arch/powerpc/sysdev/fsl_soc.c | 56 ++++++++++++++++++-------- 2 files changed, 42 insertions(+), 17 deletions(-)
Documentation/powerpc/booting-without-of.txt +3 -0
@@ -1254,6 +1254,9 @@ platforms are moved over to use the flattened-device-tree model. services interrupts for this device. - phy-handle : The phandle for the PHY connected to this ethernet controller. + - fixed-link : <a b c> where a is emulated phy id - choose any, + but unique to the all specified fixed-links, b is duplex - 0 half, + 1 full, c is link speed - d#10/d#100/d#1000. Recommended properties:
arch/powerpc/sysdev/fsl_soc.c +39 -17
81 lines not on this page · raw message
Re: [PATCH 2/3] [POWERPC] fsl_soc: add support for gianfar forfixed-link property
Quoted 18 lines · Vitaly Bordug
fixed-link says: register new "Fixed/emulated PHY", i.e. PHY that not connected to the real MDIO bus.
Signed-off-by Vitaly Bordug <[email protected]>Signed-off-by Anton Vorontsov <[email protected]>---
Documentation/powerpc/booting-without-of.txt | 3 + arch/powerpc/sysdev/fsl_soc.c | 56 ++++++++++++++++++-------- 2 files changed, 42 insertions(+), 17 deletions(-)Documentation/powerpc/booting-without-of.txt +0
-0
Documentation/powerpc/booting-without-of.txt platforms are moved over to use the flattened-device-tree model. · line 1259
Quoted 6 lines
Documentation/powerpc/booting-without-of.txt +3
-0@@ -1254,6 +1254,9 @@ platforms are moved over to use the flattened-device-tree model. services interrupts for this device. - phy-handle : The phandle for the PHY connected to this ethernet controller. + - fixed-link : <a b c> where a is emulated phy id - choose any, + but unique to the all specified fixed-links, b is duplex - 0 half, + 1 full, c is link speed - d#10/d#100/d#1000.
Good work!
May I suggest adding a "d" to <a b c> where d is flow control - 0 no, 1 yes
flow control or not just popped up here today so I got a use for it.
Jocke
Re: [PATCH 2/3] [POWERPC] fsl_soc: add support for gianfar for fixed-link property
Quoted 14 lines · Joakim Tjernlund
Quoted 13 lines · Vitaly Bordug
fixed-link says: register new "Fixed/emulated PHY", i.e. PHY that not connected to the real MDIO bus.
Signed-off-by Vitaly Bordug <[email protected]>Signed-off-by Anton Vorontsov <[email protected]>---
Documentation/powerpc/booting-without-of.txt | 3 + arch/powerpc/sysdev/fsl_soc.c | 56 ++++++++++++++++++-------- 2 files changed, 42 insertions(+), 17 deletions(-)
Quoted 14 lines
Documentation/powerpc/booting-without-of.txt platforms are moved over to use the flattened-device-tree model. · line 1259
Quoted 11 lines
Documentation/powerpc/booting-without-of.txt +3
-0@@ -1254,6 +1254,9 @@ platforms are moved over to use the flattened-device-tree model. services interrupts for this device. - phy-handle : The phandle for the PHY connected to this ethernet controller. + - fixed-link : <a b c> where a is emulated phy id - choose any, + but unique to the all specified fixed-links, b is duplex - 0 half, + 1 full, c is link speed - d#10/d#100/d#1000.Good work!
May I suggest adding a "d" to <a b c> where d is flow control - 0 no, 1 yes
Well, I see no reference of the "flow" neither in the include/linux/mii.h nor in the drivers/net/phy/*. :-/ Thus today there is no such register bit we can emulate?..
Quoted 1 line
flow control or not just popped up here today so I got a use for it.
..and I looked into few drivers (gianfar, ucc), and they seem to use hard-coded flow control values, thus they don't speak to the PHYs about that.
Can you give any reference to the driver that needs that parameter? Does it use PHY subsystem to obtain flow-control on/off information?
Thanks,
Signature · 4 lines
Anton Vorontsov email: [email protected] backup email: [email protected] irc://irc.freenode.net/bd2
Re: [PATCH 2/3] [POWERPC] fsl_soc: add support for gianfar for fixed-link property
Quoted 30 lines · Anton Vorontsov
Quoted 14 lines · Joakim Tjernlund
Quoted 13 lines · Vitaly Bordug
fixed-link says: register new "Fixed/emulated PHY", i.e. PHY that not connected to the real MDIO bus.
Signed-off-by Vitaly Bordug <[email protected]>Signed-off-by Anton Vorontsov <[email protected]>---
Documentation/powerpc/booting-without-of.txt | 3 + arch/powerpc/sysdev/fsl_soc.c | 56 ++++++++++++++++++-------- 2 files changed, 42 insertions(+), 17 deletions(-)Quoted 14 lines
Documentation/powerpc/booting-without-of.txt platforms are moved over to use the flattened-device-tree model. · line 1259
Quoted 11 lines
Documentation/powerpc/booting-without-of.txt +3
-0@@ -1254,6 +1254,9 @@ platforms are moved over to use the flattened-device-tree model. services interrupts for this device. - phy-handle : The phandle for the PHY connected to this ethernet controller. + - fixed-link : <a b c> where a is emulated phy id - choose any, + but unique to the all specified fixed-links, b is duplex - 0 half, + 1 full, c is link speed - d#10/d#100/d#1000.Good work!
May I suggest adding a "d" to <a b c> where d is flow control - 0 no, 1 yes
Quoted 3 lines
Well, I see no reference of the "flow" neither in the
include/linux/mii.hnor in thedrivers/net/phy/*. :-/ Thus today there is no such register bit we can emulate?..
Well, as good as I can recall, flow control(pause) is something that the PHY negotiates, just like FDX/HDX and should be dealt with in the adjust_link callback but not many do currently.
If you seach for pause in phy_device.c you will find it.
Quoted 6 lines
Quoted 2 lines
flow control or not just popped up here today so I got a use for it.
..and I looked into few drivers (gianfar, ucc), and they seem to use hard-coded flow control values, thus they don't speak to the PHYs about that.
Yes, but they should.
Quoted 6 lines
Can you give any reference to the driver that needs that parameter? Does it use PHY subsystem to obtain flow-control on/off information?
Thanks,
Re: [PATCH 2/3] [POWERPC] fsl_soc: add support for gianfar for fixed-link property
Quoted 36 lines · Joakim Tjernlund
Quoted 30 lines · Anton Vorontsov
Quoted 14 lines · Joakim Tjernlund
Quoted 13 lines · Vitaly Bordug
fixed-link says: register new "Fixed/emulated PHY", i.e. PHY that not connected to the real MDIO bus.
Signed-off-by Vitaly Bordug <[email protected]>Signed-off-by Anton Vorontsov <[email protected]>---
Documentation/powerpc/booting-without-of.txt | 3 + arch/powerpc/sysdev/fsl_soc.c | 56 ++++++++++++++++++-------- 2 files changed, 42 insertions(+), 17 deletions(-)Quoted 14 lines
Documentation/powerpc/booting-without-of.txt platforms are moved over to use the flattened-device-tree model. · line 1259
Quoted 11 lines
Documentation/powerpc/booting-without-of.txt +3
-0@@ -1254,6 +1254,9 @@ platforms are moved over to use the flattened-device-tree model. services interrupts for this device. - phy-handle : The phandle for the PHY connected to this ethernet controller. + - fixed-link : <a b c> where a is emulated phy id - choose any, + but unique to the all specified fixed-links, b is duplex - 0 half, + 1 full, c is link speed - d#10/d#100/d#1000.Good work!
May I suggest adding a "d" to <a b c> where d is flow control - 0 no, 1 yesQuoted 3 lines
Well, I see no reference of the "flow" neither in the
include/linux/mii.hnor in thedrivers/net/phy/*. :-/ Thus today there is no such register bit we can emulate?..
Quoted 5 lines
Well, as good as I can recall, flow control(pause) is something that the PHY negotiates, just like FDX/HDX and should be dealt with in the
adjust_linkcallback but not many do currently.If you seach for pause in
phy_device.cyou will find it.
Ah, pause. Sure, we can emulate that.
Signature · 4 lines
Anton Vorontsov email: [email protected] backup email: [email protected] irc://irc.freenode.net/bd2
Re: [PATCH 2/3] [POWERPC] fsl_soc: add support for gianfar for fixed-link property
Quoted 37 lines · Anton Vorontsov
Quoted 36 lines · Joakim Tjernlund
Quoted 33 lines · Anton Vorontsov
Quoted 14 lines · Joakim Tjernlund
Quoted 13 lines · Vitaly Bordug
fixed-link says: register new "Fixed/emulated PHY", i.e. PHY that not connected to the real MDIO bus.
Signed-off-by Vitaly Bordug <[email protected]>Signed-off-by Anton Vorontsov <[email protected]>---
Documentation/powerpc/booting-without-of.txt | 3 + arch/powerpc/sysdev/fsl_soc.c | 56 ++++++++++++++++++-------- 2 files changed, 42 insertions(+), 17 deletions(-)Quoted 14 lines
Documentation/powerpc/booting-without-of.txt platforms are moved over to use the flattened-device-tree model. · line 1259
Quoted 11 lines
Documentation/powerpc/booting-without-of.txt +3
-0@@ -1254,6 +1254,9 @@ platforms are moved over to use the flattened-device-tree model. services interrupts for this device. - phy-handle : The phandle for the PHY connected to this ethernet controller. + - fixed-link : <a b c> where a is emulated phy id - choose any, + but unique to the all specified fixed-links, b is duplex - 0 half, + 1 full, c is link speed - d#10/d#100/d#1000.Good work!
May I suggest adding a "d" to <a b c> where d is flow control - 0 no, 1 yesWell, I see no reference of the "flow" neither in the
include/linux/mii.hnor in thedrivers/net/phy/*. :-/ Thus today there is no such register bit we can emulate?..
Quoted 7 lines
Quoted 5 lines
Well, as good as I can recall, flow control(pause) is something that the PHY negotiates, just like FDX/HDX and should be dealt with in the
adjust_linkcallback but not many do currently.If you seach for pause in
phy_device.cyou will find it.Ah, pause. Sure, we can emulate that.
Good, looking into phy_device there seems to be 2 pauses:ADVERTISED_Pause and ADVERTISE_PAUSE_ASYM which maps to phydev->pause and phydev->asym_pause
so "d" should reflect that or a "e" should be added for the asym pause.
Jocke
Jocke
PATCH 3/3 MPC8349E-mITX: Vitesse 7385 PHY is not connected to the MDIO bus
In reply to Vitaly Bordug...thus use fixed-link to register proper "Fixed PHY"
---
arch/powerpc/boot/dts/mpc8349emitx.dts | 11 ++--------- 1 files changed, 2 insertions(+), 9 deletions(-)
arch/powerpc/boot/dts/mpc8349emitx.dts +2 -9
@@ -115,14 +115,6 @@ reg = <1c>; device_type = "ethernet-phy"; }; - - /* Vitesse 7385 */ - phy1f: ethernet-phy@1f { - interrupt-parent = < &ipic >; - interrupts = <12 8>; - reg = <1f>; - device_type = "ethernet-phy"; - }; }; ethernet@24000 {
@@ -159,7 +151,8 @@ local-mac-address = [ 00 00 00 00 00 00 ]; interrupts = <23 8 24 8 25 8>; interrupt-parent = < &ipic >; - phy-handle = < &phy1f >; + /* Vitesse 7385 isn't on the MDIO bus */ + fixed-link = <1 1 d#1000>; linux,network-index = <1>; };
Hi Vitaly,
Quoted 4 lines
With that patch
fixed.cnow fully emulates MDIO bus, thus no need to duplicate PHY layer functionality. That, in turn, drastically simplifies the code, and drops down line count.
Quoted 8 lines
As an additional bonus, now there is no need to register MDIO bus for each PHY, all emulated PHYs placed on the platform fixed MDIO bus. There is also no more need to pre-allocate PHYs via .config option, this is all now handled dynamically.
p.s. Don't even try to understand patch content! Better: apply patch and look into resulting
drivers/net/phy/fixed.c.
If i understand your code correctly, you seem to rely on the fact that fixed_phy_add() is called before the fixed MDIO bus is scanned for devices. How is this supposed to work for modules or for the PPC_CPM_NEW_BINDING mode where the device tree is no longer scanned during fs_soc initialization but during device initialization?
I tried to add fixed-phy support to fs_enet, but the fixed phy is not found this way.
drivers/net/fs_enet/fs_enet-main.c +0 -0
@@ -36,6 +36,7 @@
#include <linux/fs.h>
#include <linux/platform_device.h>
#include <linux/phy.h>
+#include <linux/phy_fixed.h>
#include <linux/vmalloc.h>
#include <asm/pgtable.h>
@@ -1174,8 +1175,24 @@ static int __devinit find_phy(struct device_node *np,
struct device_node *phynode, *mdionode;
struct resource res;
int ret = 0, len;+ const u32 *data;
+ struct fixed_phy_status status = {};
+
+ data = of_get_property(np, "fixed-link", NULL);
+ if (data) {
+ status.link = 1; + status.duplex = data[1]; + status.speed = data[2];
+
+ ret = fixed_phy_add(PHY_POLL, data[0], &status);
+ if (ret)
+ return ret;
+
+ snprintf(fpi->bus_id, 16, PHY_ID_FMT, 0, *data);
+ return 0;
+ }
- const u32 *data = of_get_property(np, "phy-handle", &len);
+ data = of_get_property(np, "phy-handle", &len);
if (!data || len != 4)
return -EINVAL;Thanks,
Jochen
Quoted 11 lines · On Sat, 01 Dec 2007 14:48:54 +0100 Jochen Friedrich wrote:
Hi Vitaly,
Quoted 9 lines
With that patch
fixed.cnow fully emulates MDIO bus, thus no need to duplicate PHY layer functionality. That, in turn, drastically simplifies the code, and drops down line count.As an additional bonus, now there is no need to register MDIO bus for each PHY, all emulated PHYs placed on the platform fixed MDIO bus. There is also no more need to pre-allocate PHYs via .config option, this is all now handled dynamically.
Quoted 9 lines
Quoted 3 lines
p.s. Don't even try to understand patch content! Better: apply patch and look into resulting
drivers/net/phy/fixed.c.If i understand your code correctly, you seem to rely on the fact that
fixed_phy_add()is called before the fixed MDIO bus is scanned for devices. How is this supposed to work for modules or for thePPC_CPM_NEW_BINDINGmode where the device tree is no longer scanned duringfs_socinitialization but during device initialization?
Well, this is kind of known issue - to work it around for now, place PHY lib after fs_enet in Makefile. This way it works for me for _NEW_BINDING and mpc866ads.
Quoted 3 lines
I tried to add fixed-phy support to
fs_enet, but the fixed phy is not found this way.
The point is I have the code and it works now(for fs_enet etc.), but I need to find the way for the fixed phy pinning to work in either order with phylib. If you have ideas, please go ahead :)
Quoted 38 lines
drivers/net/fs_enet/fs_enet-main.c +18
-1@@ -36,6 +36,7 @@#include <linux/fs.h> #include <linux/platform_device.h> #include <linux/phy.h> +#include <linux/phy_fixed.h> #include <linux/vmalloc.h> #include <asm/pgtable.h> @@ -1174,8 +1175,24 @@ static int __devinit find_phy(struct device_node *np, struct device_node *phynode, *mdionode;struct resource res;int ret =0 , len; +const u32 *data; +struct fixed_phy_status status = {}; + + data =of_get_property (np,"fixed-link" ,NULL ); +if (data) { + status.link =1 ; + status.duplex = data[1 ]; + status.speed = data[2 ]; + + ret =fixed_phy_add (PHY_POLL , data[0 ], &status); +if (ret) +return ret; + +snprintf (fpi->bus_id,16 ,PHY_ID_FMT ,0 , *data); +return 0 ; + } -const u32 *data =of_get_property (np,"phy-handle" , &len); + data =of_get_property (np,"phy-handle" , &len);if (!data || len !=4 )return -EINVAL ;Thanks,
Jochen
Signature · 1 line
Sincerely, Vitaly
Quoted 11 lines · Jochen Friedrich
Hi Vitaly,
Quoted 9 lines
With that patch
fixed.cnow fully emulates MDIO bus, thus no need to duplicate PHY layer functionality. That, in turn, drastically simplifies the code, and drops down line count.As an additional bonus, now there is no need to register MDIO bus for each PHY, all emulated PHYs placed on the platform fixed MDIO bus. There is also no more need to pre-allocate PHYs via .config option, this is all now handled dynamically.
Quoted 6 lines
Quoted 3 lines
p.s. Don't even try to understand patch content! Better: apply patch and look into resulting
drivers/net/phy/fixed.c.If i understand your code correctly, you seem to rely on the fact that
fixed_phy_add()is called before the fixed MDIO bus is scanned for devices.
Yes, indeed. The other name of "fixed phys" are "platform phys" or "platform MDIO bus" on which virtual PHYs are placed.
That is, these phys supposed to be created by the platform setup code (arch/). The rationale here is: we do hardware emulation, thus to make drivers actually see that "hardware", we have to create it early.
Quoted 28 lines
I tried to add fixed-phy support to
fs_enet, but the fixed phy is not found this way.drivers/net/fs_enet/fs_enet-main.c +12
-0@@ -36,6 +36,7 @@#include <linux/fs.h> #include <linux/platform_device.h> #include <linux/phy.h> +#include <linux/phy_fixed.h> #include <linux/vmalloc.h> #include <asm/pgtable.h> @@ -1174,8 +1175,24 @@ static int __devinit find_phy(struct device_node *np,struct device_node *phynode, *mdionode;struct resource res;int ret =0 , len; +const u32 *data; +struct fixed_phy_status status = {}; + + data =of_get_property (np,"fixed-link" ,NULL ); +if (data) { + status.link =1 ; + status.duplex = data[1 ]; + status.speed = data[2 ]; + + ret =fixed_phy_add (PHY_POLL , data[0 ], &status); +if (ret)
drivers/net/fs_enet/fs_enet-main.c static int __devinit find_phy(struct device_node *np, · line 1197
Quoted 10 lines
drivers/net/fs_enet/fs_enet-main.c +6
-1+return ret; + +snprintf (fpi->bus_id,16 ,PHY_ID_FMT ,0 , *data); +return 0 ; + } -const u32 *data =of_get_property (np,"phy-handle" , &len); + data =of_get_property (np,"phy-handle" , &len);if (!data || len !=4 )return -EINVAL ;
^^ the correct solution is to implement arch_initcall function which will create fixed PHYs, and then leave only snprintf(fpi->bus_id, 16, PHY_ID_FMT, 0, *data); part in the fs_enet's find_phy().
Try add something like this to the fsl_soc.c (compile untested):
- - - -
static int __init of_add_fixed_phys(void)
{
struct device_node *np;
const u32 *prop;
struct fixed_phy_status status = {};
while ((np = of_find_node_by_name(NULL, "ethernet"))) {
data = of_get_property(np, "fixed-link", NULL);
if (!data)
continue;
status.link = 1;
status.duplex = data[1];
status.speed = data[2];
ret = fixed_phy_add(PHY_POLL, data[0], &status);
if (ret)
return ret;
}
return 0;
}arch_initcall(of_add_fixed_phys);
- - - -
And remove fixed_phy_add() from the fs_enet. This should work nicely and also should be ideologically correct. ;-)
Quoted 3 lines
How is this supposed to work for modules or for the
PPC_CPM_NEW_BINDINGmode where the device tree is no longer scanned duringfs_socinitialization but during device initialization?
We should mark fixed.c as bool. Fake/virtual/fixed/platform PHYs creation is architecture code anyway, can't be =m.
Signature · 4 lines
Anton Vorontsov email: [email protected] backup email: [email protected] irc://irc.freenode.net/bd2
Quoted 11 lines · On Sun, 2 Dec 2007 00:34:03 +0300 Anton Vorontsov wrote:
Quoted 3 lines
If i understand your code correctly, you seem to rely on the fact that
fixed_phy_add()is called before the fixed MDIO bus is scanned for devices.Yes, indeed. The other name of "fixed phys" are "platform phys" or "platform MDIO bus" on which virtual PHYs are placed.
That is, these phys supposed to be created by the platform setup code (
arch/). The rationale here is: we do hardware emulation, thus to make drivers actually see that "hardware", we have to create it early.
well that was the intention but... The point is - as device is emulated, (nearly) everything is doable, and the only tradeoff to consider, is how far will we go with that emulation. IOW, PHYlib could be tricked to "do the right thing", and I thought about adding module flexibility...
But thinking more about it, it seems that BSP-code-phy-creation just sucks less and is clear enough yet flexible.
Signature · 1 line
Sincerely, Vitaly
Just a little reminder ...
Quoted 8 lines · On Sun, 2 Dec 2007 00:34:03 +0300 Anton Vorontsov <[email protected]> wrote:
static int
__initof_add_fixed_phys(void){ struct device_node *np; const u32 *prop; struct fixed_phy_status status = {}; while ((np = of_find_node_by_name(NULL, "ethernet"))) {
for_each_node_by_name(np, "ethernet") {(this probably does what you want instead of finding just the first ethernet over and over again. :-))
Quoted 11 lines
data = of_get_property(np, "fixed-link", NULL); if (!data) continue; status.link = 1; status.duplex = data[1]; status.speed = data[2]; ret = fixed_phy_add(PHY_POLL, data[0], &status); if (ret) return ret;
if (ret) {
of_put_node(np);
retun ret;
}Quoted 1 line
}
Signature · 3 lines
Cheers, Stephen Rothwell [email protected] http://www.canb.auug.org.au/~sfr/
RE: [PATCH 1/3] [NET] phy/fixed.c: rework to not duplicate PHYlayer functionality
In reply to Anton Vorontsov[SNIP]
Quoted 9 lines
^^ the correct solution is to implement
arch_initcallfunction which will create fixed PHYs, and then leave onlysnprintf(fpi->bus_id, 16, PHY_ID_FMT, 0, *data); part in the fs_enet'sfind_phy().Try add something like this to the
fsl_soc.c(compile untested):- - - -
static int__initof_add_fixed_phys(void)
Quoted 13 lines
{
struct device_node *np;
const u32 *prop;
struct fixed_phy_status status = {};
while ((np = of_find_node_by_name(NULL, "ethernet"))) {
data = of_get_property(np, "fixed-link", NULL);
if (!data)
continue;
status.link = 1;
status.duplex = data[1];
status.speed = data[2];What about Pause and Asym_Pause? Dunno why so few, if any, eth drivers impl. it, but the PHY lib supports it.
Even if fixed PHYs doesn't support it directly I think the OF interface should have it.
- fixed-link : <a b c d e> where a is emulated phy id - choose any, but unique to the all specified fixed-links, b is duplex - 0 half, 1 full, c is link speed - d#10/d#100/d#1000, d is pause - 0 no pause, 1 pause, d asym_pause - 0 no asym_pause, 1 asym_pause.
Jocke
Quoted 26 lines
ret = fixed_phy_add(PHY_POLL, data[0], &status); if (ret) return ret; } return 0; }
arch_initcall(of_add_fixed_phys);
- - - -And remove
fixed_phy_add()from thefs_enet. This should work nicely and also should be ideologically correct. ;-)Quoted 3 lines
How is this supposed to work for modules or for the
PPC_CPM_NEW_BINDINGmode where the device tree is no longer scanned duringfs_socinitialization but during device initialization?We should mark
fixed.cas bool. Fake/virtual/fixed/platform PHYs creation is architecture code anyway, can't be =m.Signature · 4 lines
Anton Vorontsov email: [email protected] backup email: [email protected] irc://irc.freenode.net/bd2
Re: [PATCH 1/3] [NET] phy/fixed.c: rework to not duplicate PHYlayer functionality
Quoted 20 lines · Joakim Tjernlund
[SNIP]
Quoted 19 lines
^^ the correct solution is to implement
arch_initcallfunction which will create fixed PHYs, and then leave onlysnprintf(fpi->bus_id, 16, PHY_ID_FMT, 0, *data); part in the fs_enet'sfind_phy().Try add something like this to the
fsl_soc.c(compile untested):- - - -
static int__initof_add_fixed_phys(void){ struct device_node *np; const u32 *prop; struct fixed_phy_status status = {}; while ((np = of_find_node_by_name(NULL, "ethernet"))) { data = of_get_property(np, "fixed-link", NULL); if (!data) continue;
Quoted 5 lines
Quoted 3 lines
status.link = 1; status.duplex = data[1]; status.speed = data[2];What about Pause and
Asym_Pause?
Will be addressed in the next respin of these patches. Let's hope on Monday.
Quoted 9 lines
Dunno why so few, if any, eth drivers
impl. it, but the PHY lib supports it.
Even if fixed PHYs doesn't support it directly I think the OF interface should have it.- fixed-link : <a b c d e> where a is emulated phy id - choose any, but unique to the all specified fixed-links, b is duplex - 0 half, 1 full, c is link speed - d#10/d#100/d#1000, d is pause - 0 no pause, 1 pause, d
asym_pause- 0 noasym_pause, 1asym_pause.
Signature · 4 lines
Anton Vorontsov email: [email protected] backup email: [email protected] irc://irc.freenode.net/bd2
Quoted 9 lines · Vitaly Bordug
With that patch
fixed.cnow fully emulates MDIO bus, thus no need to duplicate PHY layer functionality. That, in turn, drastically simplifies the code, and drops down line count.As an additional bonus, now there is no need to register MDIO bus for each PHY, all emulated PHYs placed on the platform fixed MDIO bus. There is also no more need to pre-allocate PHYs via .config option, this is all now handled dynamically.
Quoted 5 lines
p.s. Don't even try to understand patch content! Better: apply patch and look into resulting
drivers/net/phy/fixed.c.Signed-off-by Anton Vorontsov <[email protected]>Signed-off-by Vitaly Bordug <[email protected]>
what's the context of this patchset? 2.6.25?
it's late for 2.6.24-rc, IMO.
Do I have the latest version (sent Nov 26 @ 9:29am)?
Jeff
Quoted 10 lines · On Sat, 01 Dec 2007 16:59:52 -0500 Jeff Garzik wrote:
Quoted 9 lines · Vitaly Bordug
With that patch
fixed.cnow fully emulates MDIO bus, thus no need to duplicate PHY layer functionality. That, in turn, drastically simplifies the code, and drops down line count.As an additional bonus, now there is no need to register MDIO bus for each PHY, all emulated PHYs placed on the platform fixed MDIO bus. There is also no more need to pre-allocate PHYs via .config option, this is all now handled dynamically.
Quoted 8 lines
Quoted 5 lines
p.s. Don't even try to understand patch content! Better: apply patch and look into resulting
drivers/net/phy/fixed.c.Signed-off-by Anton Vorontsov <[email protected]>Signed-off-by Vitaly Bordug <[email protected]>what's the context of this patchset? 2.6.25?
Fine with it.
Quoted 3 lines
it's late for 2.6.24-rc, IMO.
Do I have the latest version (sent Nov 26 @ 9:29am)?
yes, that's it.
Signature · 1 line
Sincerely, Vitaly
Quoted 9 lines · Vitaly Bordug
With that patch
fixed.cnow fully emulates MDIO bus, thus no need to duplicate PHY layer functionality. That, in turn, drastically simplifies the code, and drops down line count.As an additional bonus, now there is no need to register MDIO bus for each PHY, all emulated PHYs placed on the platform fixed MDIO bus. There is also no more need to pre-allocate PHYs via .config option, this is all now handled dynamically.
Quoted 5 lines
p.s. Don't even try to understand patch content! Better: apply patch and look into resulting
drivers/net/phy/fixed.c.Signed-off-by Anton Vorontsov <[email protected]>Signed-off-by Vitaly Bordug <[email protected]>
ACK, I presume this will go via the ppc tree?
Quoted 10 lines · On Tue, 04 Dec 2007 15:07:49 -0500 Jeff Garzik wrote:
Quoted 9 lines · Vitaly Bordug
With that patch
fixed.cnow fully emulates MDIO bus, thus no need to duplicate PHY layer functionality. That, in turn, drastically simplifies the code, and drops down line count.As an additional bonus, now there is no need to register MDIO bus for each PHY, all emulated PHYs placed on the platform fixed MDIO bus. There is also no more need to pre-allocate PHYs via .config option, this is all now handled dynamically.
Quoted 8 lines
Quoted 5 lines
p.s. Don't even try to understand patch content! Better: apply patch and look into resulting
drivers/net/phy/fixed.c.Signed-off-by Anton Vorontsov <[email protected]>Signed-off-by Vitaly Bordug <[email protected]>ACK, I presume this will go via the ppc tree?
Yes, I'll add your ack in next respin and will ask Paul to consider it, if you don't mind.
Signature · 1 line
Sincerely, Vitaly