aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/phy.h
diff options
context:
space:
mode:
authorAndy Fleming <afleming@freescale.com>2006-12-01 13:01:06 -0500
committerJeff Garzik <jeff@garzik.org>2006-12-02 00:33:11 -0500
commite8a2b6a4207332a2d59628a12cece9e8c1d769e4 (patch)
tree31028a18413517ed3024450c20cd2e919441b437 /include/linux/phy.h
parentcabdfb373ae74036225826ce260c16a8e260eb0b (diff)
[PATCH] PHY: Add support for configuring the PHY connection interface
Most PHYs connect to an ethernet controller over a GMII or MII interface. However, a growing number are connected over different interfaces, such as RGMII or SGMII. The ethernet driver will tell the PHY what type of connection it is by setting it manually, or passing it in through phy_connect (or phy_attach). Changes include: * Updates to documentation * Updates to PHY Lib consumers * Changes to PHY Lib to add interface support * Some minor changes to whitespace in phy.h * gianfar driver now detects interface and passes appropriate value to PHY Lib Signed-off-by: Andrew Fleming <afleming@freescale.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'include/linux/phy.h')
-rw-r--r--include/linux/phy.h26
1 files changed, 20 insertions, 6 deletions
diff --git a/include/linux/phy.h b/include/linux/phy.h
index ce8bc80b3c86..edd4c88ca7d8 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -47,15 +47,26 @@
47#define PHY_HAS_INTERRUPT 0x00000001 47#define PHY_HAS_INTERRUPT 0x00000001
48#define PHY_HAS_MAGICANEG 0x00000002 48#define PHY_HAS_MAGICANEG 0x00000002
49 49
50/* Interface Mode definitions */
51typedef enum {
52 PHY_INTERFACE_MODE_MII,
53 PHY_INTERFACE_MODE_GMII,
54 PHY_INTERFACE_MODE_SGMII,
55 PHY_INTERFACE_MODE_TBI,
56 PHY_INTERFACE_MODE_RMII,
57 PHY_INTERFACE_MODE_RGMII,
58 PHY_INTERFACE_MODE_RTBI
59} phy_interface_t;
60
50#define MII_BUS_MAX 4 61#define MII_BUS_MAX 4
51 62
52 63
53#define PHY_INIT_TIMEOUT 100000 64#define PHY_INIT_TIMEOUT 100000
54#define PHY_STATE_TIME 1 65#define PHY_STATE_TIME 1
55#define PHY_FORCE_TIMEOUT 10 66#define PHY_FORCE_TIMEOUT 10
56#define PHY_AN_TIMEOUT 10 67#define PHY_AN_TIMEOUT 10
57 68
58#define PHY_MAX_ADDR 32 69#define PHY_MAX_ADDR 32
59 70
60/* Used when trying to connect to a specific phy (mii bus id:phy device id) */ 71/* Used when trying to connect to a specific phy (mii bus id:phy device id) */
61#define PHY_ID_FMT "%x:%02x" 72#define PHY_ID_FMT "%x:%02x"
@@ -87,8 +98,8 @@ struct mii_bus {
87 int *irq; 98 int *irq;
88}; 99};
89 100
90#define PHY_INTERRUPT_DISABLED 0x0 101#define PHY_INTERRUPT_DISABLED 0x0
91#define PHY_INTERRUPT_ENABLED 0x80000000 102#define PHY_INTERRUPT_ENABLED 0x80000000
92 103
93/* PHY state machine states: 104/* PHY state machine states:
94 * 105 *
@@ -230,6 +241,8 @@ struct phy_device {
230 241
231 u32 dev_flags; 242 u32 dev_flags;
232 243
244 phy_interface_t interface;
245
233 /* Bus address of the PHY (0-32) */ 246 /* Bus address of the PHY (0-32) */
234 int addr; 247 int addr;
235 248
@@ -345,9 +358,10 @@ struct phy_device* get_phy_device(struct mii_bus *bus, int addr);
345int phy_clear_interrupt(struct phy_device *phydev); 358int phy_clear_interrupt(struct phy_device *phydev);
346int phy_config_interrupt(struct phy_device *phydev, u32 interrupts); 359int phy_config_interrupt(struct phy_device *phydev, u32 interrupts);
347struct phy_device * phy_attach(struct net_device *dev, 360struct phy_device * phy_attach(struct net_device *dev,
348 const char *phy_id, u32 flags); 361 const char *phy_id, u32 flags, phy_interface_t interface);
349struct phy_device * phy_connect(struct net_device *dev, const char *phy_id, 362struct phy_device * phy_connect(struct net_device *dev, const char *phy_id,
350 void (*handler)(struct net_device *), u32 flags); 363 void (*handler)(struct net_device *), u32 flags,
364 phy_interface_t interface);
351void phy_disconnect(struct phy_device *phydev); 365void phy_disconnect(struct phy_device *phydev);
352void phy_detach(struct phy_device *phydev); 366void phy_detach(struct phy_device *phydev);
353void phy_start(struct phy_device *phydev); 367void phy_start(struct phy_device *phydev);