]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/linux/phy.h
ide: factor out debugging code from ide_tf_load()
[linux-2.6-omap-h63xx.git] / include / linux / phy.h
index 6509f377bb10c013c80a98df8453a3f694fed52f..02df20f085fe9e89637affb8cb880d2a1f153628 100644 (file)
@@ -39,7 +39,8 @@
                                 SUPPORTED_1000baseT_Half | \
                                 SUPPORTED_1000baseT_Full)
 
-/* Set phydev->irq to PHY_POLL if interrupts are not supported,
+/*
+ * Set phydev->irq to PHY_POLL if interrupts are not supported,
  * or not desired for this PHY.  Set to PHY_IGNORE_INTERRUPT if
  * the attached driver handles the interrupt
  */
@@ -80,8 +81,10 @@ typedef enum {
  */
 #define MII_BUS_ID_SIZE        (BUS_ID_SIZE - 3)
 
-/* The Bus class for PHYs.  Devices which provide access to
- * PHYs should register using this structure */
+/*
+ * The Bus class for PHYs.  Devices which provide access to
+ * PHYs should register using this structure
+ */
 struct mii_bus {
        const char *name;
        char id[MII_BUS_ID_SIZE];
@@ -90,8 +93,10 @@ struct mii_bus {
        int (*write)(struct mii_bus *bus, int phy_id, int regnum, u16 val);
        int (*reset)(struct mii_bus *bus);
 
-       /* A lock to ensure that only one thing can read/write
-        * the MDIO bus at a time */
+       /*
+        * A lock to ensure that only one thing can read/write
+        * the MDIO bus at a time
+        */
        struct mutex mdio_lock;
 
        struct device *dev;
@@ -102,8 +107,10 @@ struct mii_bus {
        /* Phy addresses to be ignored when probing */
        u32 phy_mask;
 
-       /* Pointer to an array of interrupts, each PHY's
-        * interrupt at the index matching its address */
+       /*
+        * Pointer to an array of interrupts, each PHY's
+        * interrupt at the index matching its address
+        */
        int *irq;
 };
 
@@ -255,7 +262,8 @@ struct phy_device {
        /* Bus address of the PHY (0-32) */
        int addr;
 
-       /* forced speed & duplex (no autoneg)
+       /*
+        * forced speed & duplex (no autoneg)
         * partner speed & duplex & pause (autoneg)
         */
        int speed;
@@ -278,8 +286,10 @@ struct phy_device {
 
        int link_timeout;
 
-       /* Interrupt number for this PHY
-        * -1 means no interrupt */
+       /*
+        * Interrupt number for this PHY
+        * -1 means no interrupt
+        */
        int irq;
 
        /* private data pointer */
@@ -329,22 +339,28 @@ struct phy_driver {
        u32 features;
        u32 flags;
 
-       /* Called to initialize the PHY,
-        * including after a reset */
+       /*
+        * Called to initialize the PHY,
+        * including after a reset
+        */
        int (*config_init)(struct phy_device *phydev);
 
-       /* Called during discovery.  Used to set
-        * up device-specific structures, if any */
+       /*
+        * Called during discovery.  Used to set
+        * up device-specific structures, if any
+        */
        int (*probe)(struct phy_device *phydev);
 
        /* PHY Power Management */
        int (*suspend)(struct phy_device *phydev);
        int (*resume)(struct phy_device *phydev);
 
-       /* Configures the advertisement and resets
+       /*
+        * Configures the advertisement and resets
         * autonegotiation if phydev->autoneg is on,
         * forces the speed to the current settings in phydev
-        * if phydev->autoneg is off */
+        * if phydev->autoneg is off
+        */
        int (*config_aneg)(struct phy_device *phydev);
 
        /* Determines the negotiated speed and duplex */
@@ -363,14 +379,27 @@ struct phy_driver {
 };
 #define to_phy_driver(d) container_of(d, struct phy_driver, driver)
 
+#define PHY_ANY_ID "MATCH ANY PHY"
+#define PHY_ANY_UID 0xffffffff
+
+/* A Structure for boards to register fixups with the PHY Lib */
+struct phy_fixup {
+       struct list_head list;
+       char bus_id[BUS_ID_SIZE];
+       u32 phy_uid;
+       u32 phy_uid_mask;
+       int (*run)(struct phy_device *phydev);
+};
+
 int phy_read(struct phy_device *phydev, u16 regnum);
 int phy_write(struct phy_device *phydev, u16 regnum, u16 val);
+int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id);
 struct phy_device* get_phy_device(struct mii_bus *bus, int addr);
 int phy_clear_interrupt(struct phy_device *phydev);
 int phy_config_interrupt(struct phy_device *phydev, u32 interrupts);
 struct phy_device * phy_attach(struct net_device *dev,
-               const char *phy_id, u32 flags, phy_interface_t interface);
-struct phy_device * phy_connect(struct net_device *dev, const char *phy_id,
+               const char *bus_id, u32 flags, phy_interface_t interface);
+struct phy_device * phy_connect(struct net_device *dev, const char *bus_id,
                void (*handler)(struct net_device *), u32 flags,
                phy_interface_t interface);
 void phy_disconnect(struct phy_device *phydev);
@@ -410,5 +439,13 @@ void phy_print_status(struct phy_device *phydev);
 struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id);
 void phy_device_free(struct phy_device *phydev);
 
+int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask,
+               int (*run)(struct phy_device *));
+int phy_register_fixup_for_id(const char *bus_id,
+               int (*run)(struct phy_device *));
+int phy_register_fixup_for_uid(u32 phy_uid, u32 phy_uid_mask,
+               int (*run)(struct phy_device *));
+int phy_scan_fixups(struct phy_device *phydev);
+
 extern struct bus_type mdio_bus_type;
 #endif /* __PHY_H */