phy.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. /*
  2. * include/linux/phy.h
  3. *
  4. * Framework and drivers for configuring and reading different PHYs
  5. * Based on code in sungem_phy.c and gianfar_phy.c
  6. *
  7. * Author: Andy Fleming
  8. *
  9. * Copyright (c) 2004 Freescale Semiconductor, Inc.
  10. *
  11. * This program is free software; you can redistribute it and/or modify it
  12. * under the terms of the GNU General Public License as published by the
  13. * Free Software Foundation; either version 2 of the License, or (at your
  14. * option) any later version.
  15. *
  16. */
  17. #ifndef __PHY_H
  18. #define __PHY_H
  19. #include <linux/spinlock.h>
  20. #include <linux/ethtool.h>
  21. #include <linux/mii.h>
  22. #include <linux/timer.h>
  23. #include <linux/workqueue.h>
  24. #include <linux/mod_devicetable.h>
  25. #include <linux/atomic.h>
  26. #define PHY_BASIC_FEATURES (SUPPORTED_10baseT_Half | \
  27. SUPPORTED_10baseT_Full | \
  28. SUPPORTED_100baseT_Half | \
  29. SUPPORTED_100baseT_Full | \
  30. SUPPORTED_Autoneg | \
  31. SUPPORTED_TP | \
  32. SUPPORTED_MII)
  33. #define PHY_GBIT_FEATURES (PHY_BASIC_FEATURES | \
  34. SUPPORTED_1000baseT_Half | \
  35. SUPPORTED_1000baseT_Full)
  36. /*
  37. * Set phydev->irq to PHY_POLL if interrupts are not supported,
  38. * or not desired for this PHY. Set to PHY_IGNORE_INTERRUPT if
  39. * the attached driver handles the interrupt
  40. */
  41. #define PHY_POLL -1
  42. #define PHY_IGNORE_INTERRUPT -2
  43. #define PHY_HAS_INTERRUPT 0x00000001
  44. #define PHY_HAS_MAGICANEG 0x00000002
  45. #define PHY_IS_INTERNAL 0x00000004
  46. /* Interface Mode definitions */
  47. typedef enum {
  48. PHY_INTERFACE_MODE_NA,
  49. PHY_INTERFACE_MODE_MII,
  50. PHY_INTERFACE_MODE_GMII,
  51. PHY_INTERFACE_MODE_SGMII,
  52. PHY_INTERFACE_MODE_TBI,
  53. PHY_INTERFACE_MODE_REVMII,
  54. PHY_INTERFACE_MODE_RMII,
  55. PHY_INTERFACE_MODE_RGMII,
  56. PHY_INTERFACE_MODE_RGMII_ID,
  57. PHY_INTERFACE_MODE_RGMII_RXID,
  58. PHY_INTERFACE_MODE_RGMII_TXID,
  59. PHY_INTERFACE_MODE_RTBI,
  60. PHY_INTERFACE_MODE_SMII,
  61. } phy_interface_t;
  62. #define PHY_INIT_TIMEOUT 100000
  63. #define PHY_STATE_TIME 1
  64. #define PHY_FORCE_TIMEOUT 10
  65. #define PHY_AN_TIMEOUT 10
  66. #define PHY_MAX_ADDR 32
  67. /* Used when trying to connect to a specific phy (mii bus id:phy device id) */
  68. #define PHY_ID_FMT "%s:%02x"
  69. /*
  70. * Need to be a little smaller than phydev->dev.bus_id to leave room
  71. * for the ":%02x"
  72. */
  73. #define MII_BUS_ID_SIZE (20 - 3)
  74. /* Or MII_ADDR_C45 into regnum for read/write on mii_bus to enable the 21 bit
  75. IEEE 802.3ae clause 45 addressing mode used by 10GIGE phy chips. */
  76. #define MII_ADDR_C45 (1<<30)
  77. struct device;
  78. struct sk_buff;
  79. /*
  80. * The Bus class for PHYs. Devices which provide access to
  81. * PHYs should register using this structure
  82. */
  83. struct mii_bus {
  84. const char *name;
  85. char id[MII_BUS_ID_SIZE];
  86. void *priv;
  87. int (*read)(struct mii_bus *bus, int phy_id, int regnum);
  88. int (*write)(struct mii_bus *bus, int phy_id, int regnum, u16 val);
  89. int (*reset)(struct mii_bus *bus);
  90. /*
  91. * A lock to ensure that only one thing can read/write
  92. * the MDIO bus at a time
  93. */
  94. struct mutex mdio_lock;
  95. struct device *parent;
  96. enum {
  97. MDIOBUS_ALLOCATED = 1,
  98. MDIOBUS_REGISTERED,
  99. MDIOBUS_UNREGISTERED,
  100. MDIOBUS_RELEASED,
  101. } state;
  102. struct device dev;
  103. /* list of all PHYs on bus */
  104. struct phy_device *phy_map[PHY_MAX_ADDR];
  105. /* PHY addresses to be ignored when probing */
  106. u32 phy_mask;
  107. /*
  108. * Pointer to an array of interrupts, each PHY's
  109. * interrupt at the index matching its address
  110. */
  111. int *irq;
  112. };
  113. #define to_mii_bus(d) container_of(d, struct mii_bus, dev)
  114. struct mii_bus *mdiobus_alloc_size(size_t);
  115. static inline struct mii_bus *mdiobus_alloc(void)
  116. {
  117. return mdiobus_alloc_size(0);
  118. }
  119. int mdiobus_register(struct mii_bus *bus);
  120. void mdiobus_unregister(struct mii_bus *bus);
  121. void mdiobus_free(struct mii_bus *bus);
  122. struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr);
  123. int mdiobus_read(struct mii_bus *bus, int addr, u32 regnum);
  124. int mdiobus_write(struct mii_bus *bus, int addr, u32 regnum, u16 val);
  125. #define PHY_INTERRUPT_DISABLED 0x0
  126. #define PHY_INTERRUPT_ENABLED 0x80000000
  127. /* PHY state machine states:
  128. *
  129. * DOWN: PHY device and driver are not ready for anything. probe
  130. * should be called if and only if the PHY is in this state,
  131. * given that the PHY device exists.
  132. * - PHY driver probe function will, depending on the PHY, set
  133. * the state to STARTING or READY
  134. *
  135. * STARTING: PHY device is coming up, and the ethernet driver is
  136. * not ready. PHY drivers may set this in the probe function.
  137. * If they do, they are responsible for making sure the state is
  138. * eventually set to indicate whether the PHY is UP or READY,
  139. * depending on the state when the PHY is done starting up.
  140. * - PHY driver will set the state to READY
  141. * - start will set the state to PENDING
  142. *
  143. * READY: PHY is ready to send and receive packets, but the
  144. * controller is not. By default, PHYs which do not implement
  145. * probe will be set to this state by phy_probe(). If the PHY
  146. * driver knows the PHY is ready, and the PHY state is STARTING,
  147. * then it sets this STATE.
  148. * - start will set the state to UP
  149. *
  150. * PENDING: PHY device is coming up, but the ethernet driver is
  151. * ready. phy_start will set this state if the PHY state is
  152. * STARTING.
  153. * - PHY driver will set the state to UP when the PHY is ready
  154. *
  155. * UP: The PHY and attached device are ready to do work.
  156. * Interrupts should be started here.
  157. * - timer moves to AN
  158. *
  159. * AN: The PHY is currently negotiating the link state. Link is
  160. * therefore down for now. phy_timer will set this state when it
  161. * detects the state is UP. config_aneg will set this state
  162. * whenever called with phydev->autoneg set to AUTONEG_ENABLE.
  163. * - If autonegotiation finishes, but there's no link, it sets
  164. * the state to NOLINK.
  165. * - If aneg finishes with link, it sets the state to RUNNING,
  166. * and calls adjust_link
  167. * - If autonegotiation did not finish after an arbitrary amount
  168. * of time, autonegotiation should be tried again if the PHY
  169. * supports "magic" autonegotiation (back to AN)
  170. * - If it didn't finish, and no magic_aneg, move to FORCING.
  171. *
  172. * NOLINK: PHY is up, but not currently plugged in.
  173. * - If the timer notes that the link comes back, we move to RUNNING
  174. * - config_aneg moves to AN
  175. * - phy_stop moves to HALTED
  176. *
  177. * FORCING: PHY is being configured with forced settings
  178. * - if link is up, move to RUNNING
  179. * - If link is down, we drop to the next highest setting, and
  180. * retry (FORCING) after a timeout
  181. * - phy_stop moves to HALTED
  182. *
  183. * RUNNING: PHY is currently up, running, and possibly sending
  184. * and/or receiving packets
  185. * - timer will set CHANGELINK if we're polling (this ensures the
  186. * link state is polled every other cycle of this state machine,
  187. * which makes it every other second)
  188. * - irq will set CHANGELINK
  189. * - config_aneg will set AN
  190. * - phy_stop moves to HALTED
  191. *
  192. * CHANGELINK: PHY experienced a change in link state
  193. * - timer moves to RUNNING if link
  194. * - timer moves to NOLINK if the link is down
  195. * - phy_stop moves to HALTED
  196. *
  197. * HALTED: PHY is up, but no polling or interrupts are done. Or
  198. * PHY is in an error state.
  199. *
  200. * - phy_start moves to RESUMING
  201. *
  202. * RESUMING: PHY was halted, but now wants to run again.
  203. * - If we are forcing, or aneg is done, timer moves to RUNNING
  204. * - If aneg is not done, timer moves to AN
  205. * - phy_stop moves to HALTED
  206. */
  207. enum phy_state {
  208. PHY_DOWN=0,
  209. PHY_STARTING,
  210. PHY_READY,
  211. PHY_PENDING,
  212. PHY_UP,
  213. PHY_AN,
  214. PHY_RUNNING,
  215. PHY_NOLINK,
  216. PHY_FORCING,
  217. PHY_CHANGELINK,
  218. PHY_HALTED,
  219. PHY_RESUMING
  220. };
  221. /**
  222. * struct phy_c45_device_ids - 802.3-c45 Device Identifiers
  223. * @devices_in_package: Bit vector of devices present.
  224. * @device_ids: The device identifer for each present device.
  225. */
  226. struct phy_c45_device_ids {
  227. u32 devices_in_package;
  228. u32 device_ids[8];
  229. };
  230. /* phy_device: An instance of a PHY
  231. *
  232. * drv: Pointer to the driver for this PHY instance
  233. * bus: Pointer to the bus this PHY is on
  234. * dev: driver model device structure for this PHY
  235. * phy_id: UID for this device found during discovery
  236. * c45_ids: 802.3-c45 Device Identifers if is_c45.
  237. * is_c45: Set to true if this phy uses clause 45 addressing.
  238. * is_internal: Set to true if this phy is internal to a MAC.
  239. * state: state of the PHY for management purposes
  240. * dev_flags: Device-specific flags used by the PHY driver.
  241. * addr: Bus address of PHY
  242. * link_timeout: The number of timer firings to wait before the
  243. * giving up on the current attempt at acquiring a link
  244. * irq: IRQ number of the PHY's interrupt (-1 if none)
  245. * phy_timer: The timer for handling the state machine
  246. * phy_queue: A work_queue for the interrupt
  247. * attached_dev: The attached enet driver's device instance ptr
  248. * adjust_link: Callback for the enet controller to respond to
  249. * changes in the link state.
  250. * adjust_state: Callback for the enet driver to respond to
  251. * changes in the state machine.
  252. *
  253. * speed, duplex, pause, supported, advertising, and
  254. * autoneg are used like in mii_if_info
  255. *
  256. * interrupts currently only supports enabled or disabled,
  257. * but could be changed in the future to support enabling
  258. * and disabling specific interrupts
  259. *
  260. * Contains some infrastructure for polling and interrupt
  261. * handling, as well as handling shifts in PHY hardware state
  262. */
  263. struct phy_device {
  264. /* Information about the PHY type */
  265. /* And management functions */
  266. struct phy_driver *drv;
  267. struct mii_bus *bus;
  268. struct device dev;
  269. u32 phy_id;
  270. struct phy_c45_device_ids c45_ids;
  271. bool is_c45;
  272. bool is_internal;
  273. enum phy_state state;
  274. u32 dev_flags;
  275. phy_interface_t interface;
  276. /* Bus address of the PHY (0-31) */
  277. int addr;
  278. /*
  279. * forced speed & duplex (no autoneg)
  280. * partner speed & duplex & pause (autoneg)
  281. */
  282. int speed;
  283. int duplex;
  284. int pause;
  285. int asym_pause;
  286. /* The most recently read link state */
  287. int link;
  288. /* Enabled Interrupts */
  289. u32 interrupts;
  290. /* Union of PHY and Attached devices' supported modes */
  291. /* See mii.h for more info */
  292. u32 supported;
  293. u32 advertising;
  294. int autoneg;
  295. int link_timeout;
  296. /*
  297. * Interrupt number for this PHY
  298. * -1 means no interrupt
  299. */
  300. int irq;
  301. /* private data pointer */
  302. /* For use by PHYs to maintain extra state */
  303. void *priv;
  304. /* Interrupt and Polling infrastructure */
  305. struct work_struct phy_queue;
  306. struct delayed_work state_queue;
  307. atomic_t irq_disable;
  308. struct mutex lock;
  309. struct net_device *attached_dev;
  310. void (*adjust_link)(struct net_device *dev);
  311. void (*adjust_state)(struct net_device *dev);
  312. };
  313. #define to_phy_device(d) container_of(d, struct phy_device, dev)
  314. /* struct phy_driver: Driver structure for a particular PHY type
  315. *
  316. * phy_id: The result of reading the UID registers of this PHY
  317. * type, and ANDing them with the phy_id_mask. This driver
  318. * only works for PHYs with IDs which match this field
  319. * name: The friendly name of this PHY type
  320. * phy_id_mask: Defines the important bits of the phy_id
  321. * features: A list of features (speed, duplex, etc) supported
  322. * by this PHY
  323. * flags: A bitfield defining certain other features this PHY
  324. * supports (like interrupts)
  325. *
  326. * The drivers must implement config_aneg and read_status. All
  327. * other functions are optional. Note that none of these
  328. * functions should be called from interrupt time. The goal is
  329. * for the bus read/write functions to be able to block when the
  330. * bus transaction is happening, and be freed up by an interrupt
  331. * (The MPC85xx has this ability, though it is not currently
  332. * supported in the driver).
  333. */
  334. struct phy_driver {
  335. u32 phy_id;
  336. char *name;
  337. unsigned int phy_id_mask;
  338. u32 features;
  339. u32 flags;
  340. /*
  341. * Called to initialize the PHY,
  342. * including after a reset
  343. */
  344. int (*config_init)(struct phy_device *phydev);
  345. /*
  346. * Called during discovery. Used to set
  347. * up device-specific structures, if any
  348. */
  349. int (*probe)(struct phy_device *phydev);
  350. /* PHY Power Management */
  351. int (*suspend)(struct phy_device *phydev);
  352. int (*resume)(struct phy_device *phydev);
  353. /*
  354. * Configures the advertisement and resets
  355. * autonegotiation if phydev->autoneg is on,
  356. * forces the speed to the current settings in phydev
  357. * if phydev->autoneg is off
  358. */
  359. int (*config_aneg)(struct phy_device *phydev);
  360. /* Determines the negotiated speed and duplex */
  361. int (*read_status)(struct phy_device *phydev);
  362. /* Clears any pending interrupts */
  363. int (*ack_interrupt)(struct phy_device *phydev);
  364. /* Enables or disables interrupts */
  365. int (*config_intr)(struct phy_device *phydev);
  366. /*
  367. * Checks if the PHY generated an interrupt.
  368. * For multi-PHY devices with shared PHY interrupt pin
  369. */
  370. int (*did_interrupt)(struct phy_device *phydev);
  371. /* Clears up any memory if needed */
  372. void (*remove)(struct phy_device *phydev);
  373. /* Returns true if this is a suitable driver for the given
  374. * phydev. If NULL, matching is based on phy_id and
  375. * phy_id_mask.
  376. */
  377. int (*match_phy_device)(struct phy_device *phydev);
  378. /* Handles ethtool queries for hardware time stamping. */
  379. int (*ts_info)(struct phy_device *phydev, struct ethtool_ts_info *ti);
  380. /* Handles SIOCSHWTSTAMP ioctl for hardware time stamping. */
  381. int (*hwtstamp)(struct phy_device *phydev, struct ifreq *ifr);
  382. /*
  383. * Requests a Rx timestamp for 'skb'. If the skb is accepted,
  384. * the phy driver promises to deliver it using netif_rx() as
  385. * soon as a timestamp becomes available. One of the
  386. * PTP_CLASS_ values is passed in 'type'. The function must
  387. * return true if the skb is accepted for delivery.
  388. */
  389. bool (*rxtstamp)(struct phy_device *dev, struct sk_buff *skb, int type);
  390. /*
  391. * Requests a Tx timestamp for 'skb'. The phy driver promises
  392. * to deliver it using skb_complete_tx_timestamp() as soon as a
  393. * timestamp becomes available. One of the PTP_CLASS_ values
  394. * is passed in 'type'.
  395. */
  396. void (*txtstamp)(struct phy_device *dev, struct sk_buff *skb, int type);
  397. /* Some devices (e.g. qnap TS-119P II) require PHY register changes to
  398. * enable Wake on LAN, so set_wol is provided to be called in the
  399. * ethernet driver's set_wol function. */
  400. int (*set_wol)(struct phy_device *dev, struct ethtool_wolinfo *wol);
  401. /* See set_wol, but for checking whether Wake on LAN is enabled. */
  402. void (*get_wol)(struct phy_device *dev, struct ethtool_wolinfo *wol);
  403. struct device_driver driver;
  404. };
  405. #define to_phy_driver(d) container_of(d, struct phy_driver, driver)
  406. #define PHY_ANY_ID "MATCH ANY PHY"
  407. #define PHY_ANY_UID 0xffffffff
  408. /* A Structure for boards to register fixups with the PHY Lib */
  409. struct phy_fixup {
  410. struct list_head list;
  411. char bus_id[20];
  412. u32 phy_uid;
  413. u32 phy_uid_mask;
  414. int (*run)(struct phy_device *phydev);
  415. };
  416. /**
  417. * phy_read - Convenience function for reading a given PHY register
  418. * @phydev: the phy_device struct
  419. * @regnum: register number to read
  420. *
  421. * NOTE: MUST NOT be called from interrupt context,
  422. * because the bus read/write functions may wait for an interrupt
  423. * to conclude the operation.
  424. */
  425. static inline int phy_read(struct phy_device *phydev, u32 regnum)
  426. {
  427. return mdiobus_read(phydev->bus, phydev->addr, regnum);
  428. }
  429. /**
  430. * phy_write - Convenience function for writing a given PHY register
  431. * @phydev: the phy_device struct
  432. * @regnum: register number to write
  433. * @val: value to write to @regnum
  434. *
  435. * NOTE: MUST NOT be called from interrupt context,
  436. * because the bus read/write functions may wait for an interrupt
  437. * to conclude the operation.
  438. */
  439. static inline int phy_write(struct phy_device *phydev, u32 regnum, u16 val)
  440. {
  441. return mdiobus_write(phydev->bus, phydev->addr, regnum, val);
  442. }
  443. /**
  444. * phy_interrupt_is_valid - Convenience function for testing a given PHY irq
  445. * @phydev: the phy_device struct
  446. *
  447. * NOTE: must be kept in sync with addition/removal of PHY_POLL and
  448. * PHY_IGNORE_INTERRUPT
  449. */
  450. static inline bool phy_interrupt_is_valid(struct phy_device *phydev)
  451. {
  452. return phydev->irq != PHY_POLL && phydev->irq != PHY_IGNORE_INTERRUPT;
  453. }
  454. /**
  455. * phy_is_internal - Convenience function for testing if a PHY is internal
  456. * @phydev: the phy_device struct
  457. */
  458. static inline bool phy_is_internal(struct phy_device *phydev)
  459. {
  460. return phydev->is_internal;
  461. }
  462. struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id,
  463. bool is_c45, struct phy_c45_device_ids *c45_ids);
  464. struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45);
  465. int phy_device_register(struct phy_device *phy);
  466. int phy_init_hw(struct phy_device *phydev);
  467. struct phy_device * phy_attach(struct net_device *dev,
  468. const char *bus_id, phy_interface_t interface);
  469. struct phy_device *phy_find_first(struct mii_bus *bus);
  470. int phy_connect_direct(struct net_device *dev, struct phy_device *phydev,
  471. void (*handler)(struct net_device *),
  472. phy_interface_t interface);
  473. struct phy_device * phy_connect(struct net_device *dev, const char *bus_id,
  474. void (*handler)(struct net_device *),
  475. phy_interface_t interface);
  476. void phy_disconnect(struct phy_device *phydev);
  477. void phy_detach(struct phy_device *phydev);
  478. void phy_start(struct phy_device *phydev);
  479. void phy_stop(struct phy_device *phydev);
  480. int phy_start_aneg(struct phy_device *phydev);
  481. int phy_stop_interrupts(struct phy_device *phydev);
  482. static inline int phy_read_status(struct phy_device *phydev) {
  483. return phydev->drv->read_status(phydev);
  484. }
  485. int genphy_setup_forced(struct phy_device *phydev);
  486. int genphy_restart_aneg(struct phy_device *phydev);
  487. int genphy_config_aneg(struct phy_device *phydev);
  488. int genphy_update_link(struct phy_device *phydev);
  489. int genphy_read_status(struct phy_device *phydev);
  490. int genphy_suspend(struct phy_device *phydev);
  491. int genphy_resume(struct phy_device *phydev);
  492. void phy_driver_unregister(struct phy_driver *drv);
  493. void phy_drivers_unregister(struct phy_driver *drv, int n);
  494. int phy_driver_register(struct phy_driver *new_driver);
  495. int phy_drivers_register(struct phy_driver *new_driver, int n);
  496. void phy_state_machine(struct work_struct *work);
  497. void phy_change(struct work_struct *work);
  498. void phy_mac_interrupt(struct phy_device *phydev, int new_link);
  499. void phy_start_machine(struct phy_device *phydev,
  500. void (*handler)(struct net_device *));
  501. void phy_stop_machine(struct phy_device *phydev);
  502. int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd);
  503. int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd);
  504. int phy_mii_ioctl(struct phy_device *phydev,
  505. struct ifreq *ifr, int cmd);
  506. int phy_start_interrupts(struct phy_device *phydev);
  507. void phy_print_status(struct phy_device *phydev);
  508. void phy_device_free(struct phy_device *phydev);
  509. int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask,
  510. int (*run)(struct phy_device *));
  511. int phy_register_fixup_for_id(const char *bus_id,
  512. int (*run)(struct phy_device *));
  513. int phy_register_fixup_for_uid(u32 phy_uid, u32 phy_uid_mask,
  514. int (*run)(struct phy_device *));
  515. int phy_scan_fixups(struct phy_device *phydev);
  516. int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable);
  517. int phy_get_eee_err(struct phy_device *phydev);
  518. int phy_ethtool_set_eee(struct phy_device *phydev, struct ethtool_eee *data);
  519. int phy_ethtool_get_eee(struct phy_device *phydev, struct ethtool_eee *data);
  520. int phy_ethtool_set_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol);
  521. void phy_ethtool_get_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol);
  522. int __init mdio_bus_init(void);
  523. void mdio_bus_exit(void);
  524. extern struct bus_type mdio_bus_type;
  525. #endif /* __PHY_H */