aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/phy.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/phy.h')
-rw-r--r--include/linux/phy.h29
1 files changed, 22 insertions, 7 deletions
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 892d6abe57e5..edd4c88ca7d8 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -22,7 +22,8 @@
22#include <linux/device.h> 22#include <linux/device.h>
23#include <linux/ethtool.h> 23#include <linux/ethtool.h>
24#include <linux/mii.h> 24#include <linux/mii.h>
25#include <asm/irq.h> 25#include <linux/timer.h>
26#include <linux/workqueue.h>
26 27
27#define PHY_BASIC_FEATURES (SUPPORTED_10baseT_Half | \ 28#define PHY_BASIC_FEATURES (SUPPORTED_10baseT_Half | \
28 SUPPORTED_10baseT_Full | \ 29 SUPPORTED_10baseT_Full | \
@@ -46,15 +47,26 @@
46#define PHY_HAS_INTERRUPT 0x00000001 47#define PHY_HAS_INTERRUPT 0x00000001
47#define PHY_HAS_MAGICANEG 0x00000002 48#define PHY_HAS_MAGICANEG 0x00000002
48 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
49#define MII_BUS_MAX 4 61#define MII_BUS_MAX 4
50 62
51 63
52#define PHY_INIT_TIMEOUT 100000 64#define PHY_INIT_TIMEOUT 100000
53#define PHY_STATE_TIME 1 65#define PHY_STATE_TIME 1
54#define PHY_FORCE_TIMEOUT 10 66#define PHY_FORCE_TIMEOUT 10
55#define PHY_AN_TIMEOUT 10 67#define PHY_AN_TIMEOUT 10
56 68
57#define PHY_MAX_ADDR 32 69#define PHY_MAX_ADDR 32
58 70
59/* 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) */
60#define PHY_ID_FMT "%x:%02x" 72#define PHY_ID_FMT "%x:%02x"
@@ -86,8 +98,8 @@ struct mii_bus {
86 int *irq; 98 int *irq;
87}; 99};
88 100
89#define PHY_INTERRUPT_DISABLED 0x0 101#define PHY_INTERRUPT_DISABLED 0x0
90#define PHY_INTERRUPT_ENABLED 0x80000000 102#define PHY_INTERRUPT_ENABLED 0x80000000
91 103
92/* PHY state machine states: 104/* PHY state machine states:
93 * 105 *
@@ -229,6 +241,8 @@ struct phy_device {
229 241
230 u32 dev_flags; 242 u32 dev_flags;
231 243
244 phy_interface_t interface;
245
232 /* Bus address of the PHY (0-32) */ 246 /* Bus address of the PHY (0-32) */
233 int addr; 247 int addr;
234 248
@@ -344,9 +358,10 @@ struct phy_device* get_phy_device(struct mii_bus *bus, int addr);
344int phy_clear_interrupt(struct phy_device *phydev); 358int phy_clear_interrupt(struct phy_device *phydev);
345int phy_config_interrupt(struct phy_device *phydev, u32 interrupts); 359int phy_config_interrupt(struct phy_device *phydev, u32 interrupts);
346struct phy_device * phy_attach(struct net_device *dev, 360struct phy_device * phy_attach(struct net_device *dev,
347 const char *phy_id, u32 flags); 361 const char *phy_id, u32 flags, phy_interface_t interface);
348struct 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,
349 void (*handler)(struct net_device *), u32 flags); 363 void (*handler)(struct net_device *), u32 flags,
364 phy_interface_t interface);
350void phy_disconnect(struct phy_device *phydev); 365void phy_disconnect(struct phy_device *phydev);
351void phy_detach(struct phy_device *phydev); 366void phy_detach(struct phy_device *phydev);
352void phy_start(struct phy_device *phydev); 367void phy_start(struct phy_device *phydev);