aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorVitaly Bordug <vitb@kernel.crashing.org>2007-12-06 17:51:22 -0500
committerKumar Gala <galak@kernel.crashing.org>2008-01-23 20:33:58 -0500
commita79d8e93d300adb84cccc38ac396cfb118c238ad (patch)
treed3c6e163a697029b0c7a14c745318f4f58a69445 /include/linux
parent9b6d19dd1d87fcca43ebadfad2f50cee07fbef5e (diff)
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: Anton Vorontsov <avorontsov@ru.mvista.com> Signed-off-by: Vitaly Bordug <vitb@kernel.crashing.org> Acked-by: Jeff Garzik <jeff@garzik.org> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/phy_fixed.h51
1 files changed, 22 insertions, 29 deletions
diff --git a/include/linux/phy_fixed.h b/include/linux/phy_fixed.h
index 04ba70d49fb8..509d8f5f984e 100644
--- a/include/linux/phy_fixed.h
+++ b/include/linux/phy_fixed.h
@@ -1,38 +1,31 @@
1#ifndef __PHY_FIXED_H 1#ifndef __PHY_FIXED_H
2#define __PHY_FIXED_H 2#define __PHY_FIXED_H
3 3
4#define MII_REGS_NUM 29
5
6/* max number of virtual phy stuff */
7#define MAX_PHY_AMNT 10
8/*
9 The idea is to emulate normal phy behavior by responding with
10 pre-defined values to mii BMCR read, so that read_status hook could
11 take all the needed info.
12*/
13
14struct fixed_phy_status { 4struct fixed_phy_status {
15 u8 link; 5 int link;
16 u16 speed; 6 int speed;
17 u8 duplex; 7 int duplex;
8 int pause;
9 int asym_pause;
18}; 10};
19 11
20/*----------------------------------------------------------------------------- 12#ifdef CONFIG_FIXED_PHY
21 * Private information hoder for mii_bus 13extern int fixed_phy_add(unsigned int irq, int phy_id,
22 *-----------------------------------------------------------------------------*/ 14 struct fixed_phy_status *status);
23struct fixed_info { 15#else
24 u16 *regs; 16static inline int fixed_phy_add(unsigned int irq, int phy_id,
25 u8 regs_num; 17 struct fixed_phy_status *status)
26 struct fixed_phy_status phy_status; 18{
27 struct phy_device *phydev; /* pointer to the container */ 19 return -ENODEV;
28 /* link & speed cb */ 20}
29 int (*link_update) (struct net_device *, struct fixed_phy_status *); 21#endif /* CONFIG_FIXED_PHY */
30 22
31}; 23/*
32 24 * This function issued only by fixed_phy-aware drivers, no need
33 25 * protect it with #ifdef
34int fixed_mdio_set_link_update(struct phy_device *, 26 */
35 int (*link_update) (struct net_device *, struct fixed_phy_status *)); 27extern int fixed_phy_set_link_update(struct phy_device *phydev,
36struct fixed_info *fixed_mdio_get_phydev (int phydev_ind); 28 int (*link_update)(struct net_device *,
29 struct fixed_phy_status *));
37 30
38#endif /* __PHY_FIXED_H */ 31#endif /* __PHY_FIXED_H */