Skip to contentSkip to conversation

phy/fixed.c: rework to not duplicate PHY layer functionality

PATCH Applied Vitaly Bordug 4 participants 8 messages Dec 6, 2007 – Jan 18, 2008

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

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.

---

 drivers/net/phy/Kconfig   |   32 +--
 drivers/net/phy/fixed.c   |  445 +++++++++++++++++----------------------------
 include/linux/phy_fixed.h |   51 ++---
 3 files changed, 195 insertions(+), 333 deletions(-)
drivers/net/phy/Kconfig +5 -27
index 54b2ba9..7fe03ce 100644
@@ -61,34 +61,12 @@ config ICPLUS_PHY
 	  Currently supports the IP175C PHY.
 
 config FIXED_PHY
-	tristate "Drivers for PHY emulation on fixed speed/link"
+	bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs"
 	---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 +168 -277

530 lines not on this page · raw message

include/linux/phy_fixed.h +22 -29

60 lines not on this page · raw message

#1 lore raw

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 |    4 +
 arch/powerpc/sysdev/fsl_soc.c                |   79 ++++++++++++++++++++------
 2 files changed, 66 insertions(+), 17 deletions(-)
Documentation/powerpc/booting-without-of.txt +4 -0
index e9a3cb1..9dfd308 100644
@@ -1254,6 +1254,10 @@ 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 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, e is asym_pause - 0 no asym_pause, 1 asym_pause.
 
   Recommended properties:
 
arch/powerpc/sysdev/fsl_soc.c +62 -17

110 lines not on this page · raw message

Applied
#2 lore raw

Re: [PATCH 2/3] [POWERPC] fsl_soc: add support for gianfar for fixed-link property

Quoted 4 lines · Vitaly Bordug

fixed-link says: register new "Fixed/emulated PHY", i.e. PHY that not connected to the real MDIO bus.

Quoted 9 lines

---

 Documentation/powerpc/booting-without-of.txt |    4 +
 arch/powerpc/sysdev/fsl_soc.c                |   79 ++++++++++++++++++++------
 2 files changed, 66 insertions(+), 17 deletions(-)

applied.

- k

#3 lore raw

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
index 5072f6d..877ee6d 100644
@@ -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 0 0>;
 			linux,network-index = <1>;
 		};
 
#5 lore raw

RE: [PATCH 1/3] [NET] phy/fixed.c: rework to not duplicate PHY layerfunctionality

In reply to Vitaly Bordug
Quoted 22 lines

-----Original Message-----
From:
[email protected] [mailto:linuxppc-dev-bounces+joakim.tjernlund=transmode.se@ozl abs.org] On Behalf Of Vitaly Bordug
Sent: den 6 december 2007 23:51
To: Paul Mackerras
Cc: [email protected]; linuxppc-dev
Subject: [PATCH 1/3] [NET] phy/fixed.c: rework to not duplicate PHY layerfunctionality

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.

Quoted 3 lines

What happened to this patch set? Is it sitting in a tree somewhere waiting for 2.4.25 or does it need more work?

Jocke

#6 lore raw

Re: [PATCH 1/3] [NET] phy/fixed.c: rework to not duplicate PHY layerfunctionality

Quoted 22 lines · Joakim Tjernlund
Quoted 22 lines

-----Original Message-----
From:
[email protected] [mailto:linuxppc-dev-bounces+joakim.tjernlund=transmode.se@ozl abs.org] On Behalf Of Vitaly Bordug
Sent: den 6 december 2007 23:51
To: Paul Mackerras
Cc: [email protected]; linuxppc-dev
Subject: [PATCH 1/3] [NET] phy/fixed.c: rework to not duplicate PHY layerfunctionality

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.

Quoted 6 lines
Quoted 3 lines

What happened to this patch set? Is it sitting in a tree somewhere waiting for 2.4.25 or does it need more work?

^ we're too late then. ;-)

Patches already began to fuzz at the fsl_soc.c, yet more time and they'll reject to apply. So.. Paul, Kumar can we get this in for 2.6.25?

I believe afterward this one will need some attention too:
http://ozlabs.org/pipermail/linuxppc-dev/2007-December/048473.html

Thanks in advance,

p.s. I just noticed that "fsl_soc: add support for gianfar for fixed-link .." patch could be cosmetically improved (removing casts, adding checks for size after the of_get_property), but I hope we can do this on top of already applied patches.

Thanks again,

Signature · 4 lines
Anton Vorontsov
email: [email protected]
backup email: [email protected]
irc://irc.freenode.net/bd2
Applied
#7 lore raw
In reply to Vitaly Bordug
Quoted 15 lines · Vitaly Bordug

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.

Quoted 7 lines

---

 drivers/net/phy/Kconfig   |   32 +--
 drivers/net/phy/fixed.c   |  445 +++++++++++++++++----------------------------
 include/linux/phy_fixed.h |   51 ++---
 3 files changed, 195 insertions(+), 333 deletions(-)

applied.

- k