diff options
Diffstat (limited to 'include/linux/phy.h')
| -rw-r--r-- | include/linux/phy.h | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/include/linux/phy.h b/include/linux/phy.h index 6a7eb402165d..6b0a782c6224 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | #include <linux/mii.h> | 24 | #include <linux/mii.h> |
| 25 | #include <linux/timer.h> | 25 | #include <linux/timer.h> |
| 26 | #include <linux/workqueue.h> | 26 | #include <linux/workqueue.h> |
| 27 | #include <linux/mod_devicetable.h> | ||
| 27 | 28 | ||
| 28 | #include <asm/atomic.h> | 29 | #include <asm/atomic.h> |
| 29 | 30 | ||
| @@ -81,6 +82,10 @@ typedef enum { | |||
| 81 | */ | 82 | */ |
| 82 | #define MII_BUS_ID_SIZE (20 - 3) | 83 | #define MII_BUS_ID_SIZE (20 - 3) |
| 83 | 84 | ||
| 85 | /* Or MII_ADDR_C45 into regnum for read/write on mii_bus to enable the 21 bit | ||
| 86 | IEEE 802.3ae clause 45 addressing mode used by 10GIGE phy chips. */ | ||
| 87 | #define MII_ADDR_C45 (1<<30) | ||
| 88 | |||
| 84 | /* | 89 | /* |
| 85 | * The Bus class for PHYs. Devices which provide access to | 90 | * The Bus class for PHYs. Devices which provide access to |
| 86 | * PHYs should register using this structure | 91 | * PHYs should register using this structure |
| @@ -127,8 +132,8 @@ int mdiobus_register(struct mii_bus *bus); | |||
| 127 | void mdiobus_unregister(struct mii_bus *bus); | 132 | void mdiobus_unregister(struct mii_bus *bus); |
| 128 | void mdiobus_free(struct mii_bus *bus); | 133 | void mdiobus_free(struct mii_bus *bus); |
| 129 | struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr); | 134 | struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr); |
| 130 | int mdiobus_read(struct mii_bus *bus, int addr, u16 regnum); | 135 | int mdiobus_read(struct mii_bus *bus, int addr, u32 regnum); |
| 131 | int mdiobus_write(struct mii_bus *bus, int addr, u16 regnum, u16 val); | 136 | int mdiobus_write(struct mii_bus *bus, int addr, u32 regnum, u16 val); |
| 132 | 137 | ||
| 133 | 138 | ||
| 134 | #define PHY_INTERRUPT_DISABLED 0x0 | 139 | #define PHY_INTERRUPT_DISABLED 0x0 |
| @@ -229,6 +234,8 @@ enum phy_state { | |||
| 229 | PHY_RESUMING | 234 | PHY_RESUMING |
| 230 | }; | 235 | }; |
| 231 | 236 | ||
| 237 | struct sk_buff; | ||
| 238 | |||
| 232 | /* phy_device: An instance of a PHY | 239 | /* phy_device: An instance of a PHY |
| 233 | * | 240 | * |
| 234 | * drv: Pointer to the driver for this PHY instance | 241 | * drv: Pointer to the driver for this PHY instance |
| @@ -397,6 +404,26 @@ struct phy_driver { | |||
| 397 | /* Clears up any memory if needed */ | 404 | /* Clears up any memory if needed */ |
| 398 | void (*remove)(struct phy_device *phydev); | 405 | void (*remove)(struct phy_device *phydev); |
| 399 | 406 | ||
| 407 | /* Handles SIOCSHWTSTAMP ioctl for hardware time stamping. */ | ||
| 408 | int (*hwtstamp)(struct phy_device *phydev, struct ifreq *ifr); | ||
| 409 | |||
| 410 | /* | ||
| 411 | * Requests a Rx timestamp for 'skb'. If the skb is accepted, | ||
| 412 | * the phy driver promises to deliver it using netif_rx() as | ||
| 413 | * soon as a timestamp becomes available. One of the | ||
| 414 | * PTP_CLASS_ values is passed in 'type'. The function must | ||
| 415 | * return true if the skb is accepted for delivery. | ||
| 416 | */ | ||
| 417 | bool (*rxtstamp)(struct phy_device *dev, struct sk_buff *skb, int type); | ||
| 418 | |||
| 419 | /* | ||
| 420 | * Requests a Tx timestamp for 'skb'. The phy driver promises | ||
| 421 | * to deliver it to the socket's error queue as soon as a | ||
| 422 | * timestamp becomes available. One of the PTP_CLASS_ values | ||
| 423 | * is passed in 'type'. | ||
| 424 | */ | ||
| 425 | void (*txtstamp)(struct phy_device *dev, struct sk_buff *skb, int type); | ||
| 426 | |||
| 400 | struct device_driver driver; | 427 | struct device_driver driver; |
| 401 | }; | 428 | }; |
| 402 | #define to_phy_driver(d) container_of(d, struct phy_driver, driver) | 429 | #define to_phy_driver(d) container_of(d, struct phy_driver, driver) |
| @@ -422,7 +449,7 @@ struct phy_fixup { | |||
| 422 | * because the bus read/write functions may wait for an interrupt | 449 | * because the bus read/write functions may wait for an interrupt |
| 423 | * to conclude the operation. | 450 | * to conclude the operation. |
| 424 | */ | 451 | */ |
| 425 | static inline int phy_read(struct phy_device *phydev, u16 regnum) | 452 | static inline int phy_read(struct phy_device *phydev, u32 regnum) |
| 426 | { | 453 | { |
| 427 | return mdiobus_read(phydev->bus, phydev->addr, regnum); | 454 | return mdiobus_read(phydev->bus, phydev->addr, regnum); |
| 428 | } | 455 | } |
| @@ -437,7 +464,7 @@ static inline int phy_read(struct phy_device *phydev, u16 regnum) | |||
| 437 | * because the bus read/write functions may wait for an interrupt | 464 | * because the bus read/write functions may wait for an interrupt |
| 438 | * to conclude the operation. | 465 | * to conclude the operation. |
| 439 | */ | 466 | */ |
| 440 | static inline int phy_write(struct phy_device *phydev, u16 regnum, u16 val) | 467 | static inline int phy_write(struct phy_device *phydev, u32 regnum, u16 val) |
| 441 | { | 468 | { |
| 442 | return mdiobus_write(phydev->bus, phydev->addr, regnum, val); | 469 | return mdiobus_write(phydev->bus, phydev->addr, regnum, val); |
| 443 | } | 470 | } |
| @@ -452,6 +479,7 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, | |||
| 452 | u32 flags, phy_interface_t interface); | 479 | u32 flags, phy_interface_t interface); |
| 453 | struct phy_device * phy_attach(struct net_device *dev, | 480 | struct phy_device * phy_attach(struct net_device *dev, |
| 454 | const char *bus_id, u32 flags, phy_interface_t interface); | 481 | const char *bus_id, u32 flags, phy_interface_t interface); |
| 482 | struct phy_device *phy_find_first(struct mii_bus *bus); | ||
| 455 | int phy_connect_direct(struct net_device *dev, struct phy_device *phydev, | 483 | int phy_connect_direct(struct net_device *dev, struct phy_device *phydev, |
| 456 | void (*handler)(struct net_device *), u32 flags, | 484 | void (*handler)(struct net_device *), u32 flags, |
| 457 | phy_interface_t interface); | 485 | phy_interface_t interface); |
| @@ -492,7 +520,7 @@ void phy_stop_machine(struct phy_device *phydev); | |||
| 492 | int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd); | 520 | int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd); |
| 493 | int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd); | 521 | int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd); |
| 494 | int phy_mii_ioctl(struct phy_device *phydev, | 522 | int phy_mii_ioctl(struct phy_device *phydev, |
| 495 | struct mii_ioctl_data *mii_data, int cmd); | 523 | struct ifreq *ifr, int cmd); |
| 496 | int phy_start_interrupts(struct phy_device *phydev); | 524 | int phy_start_interrupts(struct phy_device *phydev); |
| 497 | void phy_print_status(struct phy_device *phydev); | 525 | void phy_print_status(struct phy_device *phydev); |
| 498 | struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id); | 526 | struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id); |
