Commit a79d8e93 authored by Vitaly Bordug's avatar Vitaly Bordug Committed by Kumar Gala

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.
Signed-off-by: default avatarAnton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: default avatarVitaly Bordug <vitb@kernel.crashing.org>
Acked-by: default avatarJeff Garzik <jeff@garzik.org>
Signed-off-by: default avatarKumar Gala <galak@kernel.crashing.org>
parent 9b6d19dd
...@@ -61,34 +61,12 @@ config ICPLUS_PHY ...@@ -61,34 +61,12 @@ config ICPLUS_PHY
Currently supports the IP175C PHY. Currently supports the IP175C PHY.
config FIXED_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--- ---help---
Adds the driver to PHY layer to cover the boards that do not have any PHY bound, Adds the platform "fixed" MDIO Bus to cover the boards that use
but with the ability to manipulate the speed/link in software. The relevant MII PHYs that are not connected to the real MDIO bus.
speed/duplex parameters could be effectively handled in a user-specified function.
Currently tested with mpc866ads. Currently tested with mpc866ads and mpc8349e-mitx.
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.
config MDIO_BITBANG config MDIO_BITBANG
tristate "Support for bitbanged MDIO buses" tristate "Support for bitbanged MDIO buses"
......
This diff is collapsed.
#ifndef __PHY_FIXED_H #ifndef __PHY_FIXED_H
#define __PHY_FIXED_H #define __PHY_FIXED_H
#define MII_REGS_NUM 29
/* max number of virtual phy stuff */
#define MAX_PHY_AMNT 10
/*
The idea is to emulate normal phy behavior by responding with
pre-defined values to mii BMCR read, so that read_status hook could
take all the needed info.
*/
struct fixed_phy_status { struct fixed_phy_status {
u8 link; int link;
u16 speed; int speed;
u8 duplex; int duplex;
int pause;
int asym_pause;
}; };
/*----------------------------------------------------------------------------- #ifdef CONFIG_FIXED_PHY
* Private information hoder for mii_bus extern int fixed_phy_add(unsigned int irq, int phy_id,
*-----------------------------------------------------------------------------*/ struct fixed_phy_status *status);
struct fixed_info { #else
u16 *regs; static inline int fixed_phy_add(unsigned int irq, int phy_id,
u8 regs_num; struct fixed_phy_status *status)
struct fixed_phy_status phy_status; {
struct phy_device *phydev; /* pointer to the container */ return -ENODEV;
/* link & speed cb */ }
int (*link_update) (struct net_device *, struct fixed_phy_status *); #endif /* CONFIG_FIXED_PHY */
}; /*
* This function issued only by fixed_phy-aware drivers, no need
* protect it with #ifdef
int fixed_mdio_set_link_update(struct phy_device *, */
int (*link_update) (struct net_device *, struct fixed_phy_status *)); extern int fixed_phy_set_link_update(struct phy_device *phydev,
struct fixed_info *fixed_mdio_get_phydev (int phydev_ind); int (*link_update)(struct net_device *,
struct fixed_phy_status *));
#endif /* __PHY_FIXED_H */ #endif /* __PHY_FIXED_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment