diff options
author | Randy Dunlap <randy.dunlap@oracle.com> | 2007-03-06 05:41:48 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-04-28 11:00:57 -0400 |
commit | b3df0da886ffdb3e70c3197f589e959e5f8c9c04 (patch) | |
tree | 7a1f564d31835f31ebab9da370dace187b0aefc6 /drivers/net/phy/phy_device.c | |
parent | 56e1393f82349d8206fe7feb94db96b065c55e51 (diff) |
phy layer: add kernel-doc + DocBook
Convert function documentation in drivers/net/phy/ to kernel-doc
and add it to DocBook.
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/phy/phy_device.c')
-rw-r--r-- | drivers/net/phy/phy_device.c | 114 |
1 files changed, 79 insertions, 35 deletions
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 8f01952c4850..a8b74cdab1ea 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c | |||
@@ -74,11 +74,13 @@ struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id) | |||
74 | } | 74 | } |
75 | EXPORT_SYMBOL(phy_device_create); | 75 | EXPORT_SYMBOL(phy_device_create); |
76 | 76 | ||
77 | /* get_phy_device | 77 | /** |
78 | * get_phy_device - reads the specified PHY device and returns its @phy_device struct | ||
79 | * @bus: the target MII bus | ||
80 | * @addr: PHY address on the MII bus | ||
78 | * | 81 | * |
79 | * description: Reads the ID registers of the PHY at addr on the | 82 | * Description: Reads the ID registers of the PHY at @addr on the |
80 | * bus, then allocates and returns the phy_device to | 83 | * @bus, then allocates and returns the phy_device to represent it. |
81 | * represent it. | ||
82 | */ | 84 | */ |
83 | struct phy_device * get_phy_device(struct mii_bus *bus, int addr) | 85 | struct phy_device * get_phy_device(struct mii_bus *bus, int addr) |
84 | { | 86 | { |
@@ -112,23 +114,33 @@ struct phy_device * get_phy_device(struct mii_bus *bus, int addr) | |||
112 | return dev; | 114 | return dev; |
113 | } | 115 | } |
114 | 116 | ||
115 | /* phy_prepare_link: | 117 | /** |
118 | * phy_prepare_link - prepares the PHY layer to monitor link status | ||
119 | * @phydev: target phy_device struct | ||
120 | * @handler: callback function for link status change notifications | ||
116 | * | 121 | * |
117 | * description: Tells the PHY infrastructure to handle the | 122 | * Description: Tells the PHY infrastructure to handle the |
118 | * gory details on monitoring link status (whether through | 123 | * gory details on monitoring link status (whether through |
119 | * polling or an interrupt), and to call back to the | 124 | * polling or an interrupt), and to call back to the |
120 | * connected device driver when the link status changes. | 125 | * connected device driver when the link status changes. |
121 | * If you want to monitor your own link state, don't call | 126 | * If you want to monitor your own link state, don't call |
122 | * this function */ | 127 | * this function. |
128 | */ | ||
123 | void phy_prepare_link(struct phy_device *phydev, | 129 | void phy_prepare_link(struct phy_device *phydev, |
124 | void (*handler)(struct net_device *)) | 130 | void (*handler)(struct net_device *)) |
125 | { | 131 | { |
126 | phydev->adjust_link = handler; | 132 | phydev->adjust_link = handler; |
127 | } | 133 | } |
128 | 134 | ||
129 | /* phy_connect: | 135 | /** |
136 | * phy_connect - connect an ethernet device to a PHY device | ||
137 | * @dev: the network device to connect | ||
138 | * @phy_id: the PHY device to connect | ||
139 | * @handler: callback function for state change notifications | ||
140 | * @flags: PHY device's dev_flags | ||
141 | * @interface: PHY device's interface | ||
130 | * | 142 | * |
131 | * description: Convenience function for connecting ethernet | 143 | * Description: Convenience function for connecting ethernet |
132 | * devices to PHY devices. The default behavior is for | 144 | * devices to PHY devices. The default behavior is for |
133 | * the PHY infrastructure to handle everything, and only notify | 145 | * the PHY infrastructure to handle everything, and only notify |
134 | * the connected driver when the link status changes. If you | 146 | * the connected driver when the link status changes. If you |
@@ -158,6 +170,10 @@ struct phy_device * phy_connect(struct net_device *dev, const char *phy_id, | |||
158 | } | 170 | } |
159 | EXPORT_SYMBOL(phy_connect); | 171 | EXPORT_SYMBOL(phy_connect); |
160 | 172 | ||
173 | /** | ||
174 | * phy_disconnect - disable interrupts, stop state machine, and detach a PHY device | ||
175 | * @phydev: target phy_device struct | ||
176 | */ | ||
161 | void phy_disconnect(struct phy_device *phydev) | 177 | void phy_disconnect(struct phy_device *phydev) |
162 | { | 178 | { |
163 | if (phydev->irq > 0) | 179 | if (phydev->irq > 0) |
@@ -171,21 +187,25 @@ void phy_disconnect(struct phy_device *phydev) | |||
171 | } | 187 | } |
172 | EXPORT_SYMBOL(phy_disconnect); | 188 | EXPORT_SYMBOL(phy_disconnect); |
173 | 189 | ||
174 | /* phy_attach: | 190 | static int phy_compare_id(struct device *dev, void *data) |
191 | { | ||
192 | return strcmp((char *)data, dev->bus_id) ? 0 : 1; | ||
193 | } | ||
194 | |||
195 | /** | ||
196 | * phy_attach - attach a network device to a particular PHY device | ||
197 | * @dev: network device to attach | ||
198 | * @phy_id: PHY device to attach | ||
199 | * @flags: PHY device's dev_flags | ||
200 | * @interface: PHY device's interface | ||
175 | * | 201 | * |
176 | * description: Called by drivers to attach to a particular PHY | 202 | * Description: Called by drivers to attach to a particular PHY |
177 | * device. The phy_device is found, and properly hooked up | 203 | * device. The phy_device is found, and properly hooked up |
178 | * to the phy_driver. If no driver is attached, then the | 204 | * to the phy_driver. If no driver is attached, then the |
179 | * genphy_driver is used. The phy_device is given a ptr to | 205 | * genphy_driver is used. The phy_device is given a ptr to |
180 | * the attaching device, and given a callback for link status | 206 | * the attaching device, and given a callback for link status |
181 | * change. The phy_device is returned to the attaching | 207 | * change. The phy_device is returned to the attaching driver. |
182 | * driver. | ||
183 | */ | 208 | */ |
184 | static int phy_compare_id(struct device *dev, void *data) | ||
185 | { | ||
186 | return strcmp((char *)data, dev->bus_id) ? 0 : 1; | ||
187 | } | ||
188 | |||
189 | struct phy_device *phy_attach(struct net_device *dev, | 209 | struct phy_device *phy_attach(struct net_device *dev, |
190 | const char *phy_id, u32 flags, phy_interface_t interface) | 210 | const char *phy_id, u32 flags, phy_interface_t interface) |
191 | { | 211 | { |
@@ -246,6 +266,10 @@ struct phy_device *phy_attach(struct net_device *dev, | |||
246 | } | 266 | } |
247 | EXPORT_SYMBOL(phy_attach); | 267 | EXPORT_SYMBOL(phy_attach); |
248 | 268 | ||
269 | /** | ||
270 | * phy_detach - detach a PHY device from its network device | ||
271 | * @phydev: target phy_device struct | ||
272 | */ | ||
249 | void phy_detach(struct phy_device *phydev) | 273 | void phy_detach(struct phy_device *phydev) |
250 | { | 274 | { |
251 | phydev->attached_dev = NULL; | 275 | phydev->attached_dev = NULL; |
@@ -262,11 +286,13 @@ EXPORT_SYMBOL(phy_detach); | |||
262 | 286 | ||
263 | /* Generic PHY support and helper functions */ | 287 | /* Generic PHY support and helper functions */ |
264 | 288 | ||
265 | /* genphy_config_advert | 289 | /** |
290 | * genphy_config_advert - sanitize and advertise auto-negotation parameters | ||
291 | * @phydev: target phy_device struct | ||
266 | * | 292 | * |
267 | * description: Writes MII_ADVERTISE with the appropriate values, | 293 | * Description: Writes MII_ADVERTISE with the appropriate values, |
268 | * after sanitizing the values to make sure we only advertise | 294 | * after sanitizing the values to make sure we only advertise |
269 | * what is supported | 295 | * what is supported. |
270 | */ | 296 | */ |
271 | int genphy_config_advert(struct phy_device *phydev) | 297 | int genphy_config_advert(struct phy_device *phydev) |
272 | { | 298 | { |
@@ -328,11 +354,14 @@ int genphy_config_advert(struct phy_device *phydev) | |||
328 | } | 354 | } |
329 | EXPORT_SYMBOL(genphy_config_advert); | 355 | EXPORT_SYMBOL(genphy_config_advert); |
330 | 356 | ||
331 | /* genphy_setup_forced | 357 | /** |
358 | * genphy_setup_forced - configures/forces speed/duplex from @phydev | ||
359 | * @phydev: target phy_device struct | ||
332 | * | 360 | * |
333 | * description: Configures MII_BMCR to force speed/duplex | 361 | * Description: Configures MII_BMCR to force speed/duplex |
334 | * to the values in phydev. Assumes that the values are valid. | 362 | * to the values in phydev. Assumes that the values are valid. |
335 | * Please see phy_sanitize_settings() */ | 363 | * Please see phy_sanitize_settings(). |
364 | */ | ||
336 | int genphy_setup_forced(struct phy_device *phydev) | 365 | int genphy_setup_forced(struct phy_device *phydev) |
337 | { | 366 | { |
338 | int ctl = BMCR_RESET; | 367 | int ctl = BMCR_RESET; |
@@ -361,7 +390,10 @@ int genphy_setup_forced(struct phy_device *phydev) | |||
361 | } | 390 | } |
362 | 391 | ||
363 | 392 | ||
364 | /* Enable and Restart Autonegotiation */ | 393 | /** |
394 | * genphy_restart_aneg - Enable and Restart Autonegotiation | ||
395 | * @phydev: target phy_device struct | ||
396 | */ | ||
365 | int genphy_restart_aneg(struct phy_device *phydev) | 397 | int genphy_restart_aneg(struct phy_device *phydev) |
366 | { | 398 | { |
367 | int ctl; | 399 | int ctl; |
@@ -382,11 +414,13 @@ int genphy_restart_aneg(struct phy_device *phydev) | |||
382 | } | 414 | } |
383 | 415 | ||
384 | 416 | ||
385 | /* genphy_config_aneg | 417 | /** |
418 | * genphy_config_aneg - restart auto-negotiation or write BMCR | ||
419 | * @phydev: target phy_device struct | ||
386 | * | 420 | * |
387 | * description: If auto-negotiation is enabled, we configure the | 421 | * Description: If auto-negotiation is enabled, we configure the |
388 | * advertising, and then restart auto-negotiation. If it is not | 422 | * advertising, and then restart auto-negotiation. If it is not |
389 | * enabled, then we write the BMCR | 423 | * enabled, then we write the BMCR. |
390 | */ | 424 | */ |
391 | int genphy_config_aneg(struct phy_device *phydev) | 425 | int genphy_config_aneg(struct phy_device *phydev) |
392 | { | 426 | { |
@@ -406,11 +440,13 @@ int genphy_config_aneg(struct phy_device *phydev) | |||
406 | } | 440 | } |
407 | EXPORT_SYMBOL(genphy_config_aneg); | 441 | EXPORT_SYMBOL(genphy_config_aneg); |
408 | 442 | ||
409 | /* genphy_update_link | 443 | /** |
444 | * genphy_update_link - update link status in @phydev | ||
445 | * @phydev: target phy_device struct | ||
410 | * | 446 | * |
411 | * description: Update the value in phydev->link to reflect the | 447 | * Description: Update the value in phydev->link to reflect the |
412 | * current link value. In order to do this, we need to read | 448 | * current link value. In order to do this, we need to read |
413 | * the status register twice, keeping the second value | 449 | * the status register twice, keeping the second value. |
414 | */ | 450 | */ |
415 | int genphy_update_link(struct phy_device *phydev) | 451 | int genphy_update_link(struct phy_device *phydev) |
416 | { | 452 | { |
@@ -437,9 +473,11 @@ int genphy_update_link(struct phy_device *phydev) | |||
437 | } | 473 | } |
438 | EXPORT_SYMBOL(genphy_update_link); | 474 | EXPORT_SYMBOL(genphy_update_link); |
439 | 475 | ||
440 | /* genphy_read_status | 476 | /** |
477 | * genphy_read_status - check the link status and update current link state | ||
478 | * @phydev: target phy_device struct | ||
441 | * | 479 | * |
442 | * description: Check the link, then figure out the current state | 480 | * Description: Check the link, then figure out the current state |
443 | * by comparing what we advertise with what the link partner | 481 | * by comparing what we advertise with what the link partner |
444 | * advertises. Start by checking the gigabit possibilities, | 482 | * advertises. Start by checking the gigabit possibilities, |
445 | * then move on to 10/100. | 483 | * then move on to 10/100. |
@@ -579,9 +617,11 @@ static int genphy_config_init(struct phy_device *phydev) | |||
579 | } | 617 | } |
580 | 618 | ||
581 | 619 | ||
582 | /* phy_probe | 620 | /** |
621 | * phy_probe - probe and init a PHY device | ||
622 | * @dev: device to probe and init | ||
583 | * | 623 | * |
584 | * description: Take care of setting up the phy_device structure, | 624 | * Description: Take care of setting up the phy_device structure, |
585 | * set the state to READY (the driver's init function should | 625 | * set the state to READY (the driver's init function should |
586 | * set it to STARTING if needed). | 626 | * set it to STARTING if needed). |
587 | */ | 627 | */ |
@@ -643,6 +683,10 @@ static int phy_remove(struct device *dev) | |||
643 | return 0; | 683 | return 0; |
644 | } | 684 | } |
645 | 685 | ||
686 | /** | ||
687 | * phy_driver_register - register a phy_driver with the PHY layer | ||
688 | * @new_driver: new phy_driver to register | ||
689 | */ | ||
646 | int phy_driver_register(struct phy_driver *new_driver) | 690 | int phy_driver_register(struct phy_driver *new_driver) |
647 | { | 691 | { |
648 | int retval; | 692 | int retval; |