phy.h 19 KB

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