summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Dufour2013-05-28 14:00:59 +0200
committerOlivier Dufour2013-05-30 15:35:38 +0200
commitb9a54a98bee16ffefd808389bad9d4fe40f8dd11 (patch)
tree1b7207e0feda33acbf9b196cbb807dd24db243cb
parent5c2e18e74de7f52f572d22980281fded8af67efa (diff)
cleo/linux/drivers/net/phy: add getters in fixed driver, refs #4009
-rw-r--r--cleopatre/linux-2.6.25.10-spc300/drivers/net/phy/fixed.c27
-rw-r--r--cleopatre/linux-2.6.25.10-spc300/include/linux/phy_fixed.h10
2 files changed, 37 insertions, 0 deletions
diff --git a/cleopatre/linux-2.6.25.10-spc300/drivers/net/phy/fixed.c b/cleopatre/linux-2.6.25.10-spc300/drivers/net/phy/fixed.c
index 6c79a68edb..5a5e074ff2 100644
--- a/cleopatre/linux-2.6.25.10-spc300/drivers/net/phy/fixed.c
+++ b/cleopatre/linux-2.6.25.10-spc300/drivers/net/phy/fixed.c
@@ -143,6 +143,33 @@ static int fixed_mdio_write(struct mii_bus *bus, int phy_id, int reg_num,
return 0;
}
+/* For ethernet drivers using a phy device, we need to retrieve the
+ * phy_device. */
+struct phy_device *
+fixed_phy_find (int phy_id)
+{
+ struct fixed_mdio_bus *fmb = &platform_fmb;
+ struct fixed_phy *fp;
+
+ list_for_each_entry(fp, &fmb->phys, node) {
+ if (fp->id == phy_id) {
+ return fp->phydev;
+ }
+ }
+
+ return NULL;
+}
+EXPORT_SYMBOL_GPL(fixed_phy_find);
+
+/* For ethernet drivers allowing auto neg or any other operation on the PHY,
+ * we need to retrieve the mii_bus. */
+struct mii_bus *
+fixed_mii_get (void)
+{
+ return &(platform_fmb.mii_bus);
+}
+EXPORT_SYMBOL_GPL(fixed_mii_get);
+
/*
* If something weird is required to be done with link/speed,
* network driver is able to assign a function to implement this.
diff --git a/cleopatre/linux-2.6.25.10-spc300/include/linux/phy_fixed.h b/cleopatre/linux-2.6.25.10-spc300/include/linux/phy_fixed.h
index 509d8f5f98..57922e5e6a 100644
--- a/cleopatre/linux-2.6.25.10-spc300/include/linux/phy_fixed.h
+++ b/cleopatre/linux-2.6.25.10-spc300/include/linux/phy_fixed.h
@@ -12,12 +12,22 @@ struct fixed_phy_status {
#ifdef CONFIG_FIXED_PHY
extern int fixed_phy_add(unsigned int irq, int phy_id,
struct fixed_phy_status *status);
+extern struct mii_bus *fixed_mii_get (void);
+extern struct phy_device *fixed_phy_find (int phy_id);
#else
static inline int fixed_phy_add(unsigned int irq, int phy_id,
struct fixed_phy_status *status)
{
return -ENODEV;
}
+static inline struct mii_bus *fixed_mii_get (void)
+{
+ return NULL;
+}
+static inline struct phy_device *fixed_phy_find (int phy_id)
+{
+ return NULL;
+}
#endif /* CONFIG_FIXED_PHY */
/*