Linux Kernel
3.7.1
|
#include <linux/spinlock.h>
#include <linux/ethtool.h>
#include <linux/mii.h>
#include <linux/timer.h>
#include <linux/workqueue.h>
#include <linux/mod_devicetable.h>
#include <linux/atomic.h>
Go to the source code of this file.
Data Structures | |
struct | mii_bus |
struct | phy_c45_device_ids |
struct | phy_device |
struct | phy_driver |
struct | phy_fixup |
Macros | |
#define | PHY_BASIC_FEATURES |
#define | PHY_GBIT_FEATURES |
#define | PHY_POLL -1 |
#define | PHY_IGNORE_INTERRUPT -2 |
#define | PHY_HAS_INTERRUPT 0x00000001 |
#define | PHY_HAS_MAGICANEG 0x00000002 |
#define | PHY_INIT_TIMEOUT 100000 |
#define | PHY_STATE_TIME 1 |
#define | PHY_FORCE_TIMEOUT 10 |
#define | PHY_AN_TIMEOUT 10 |
#define | PHY_MAX_ADDR 32 |
#define | PHY_ID_FMT "%s:%02x" |
#define | MII_BUS_ID_SIZE (20 - 3) |
#define | MII_ADDR_C45 (1<<30) |
#define | to_mii_bus(d) container_of(d, struct mii_bus, dev) |
#define | PHY_INTERRUPT_DISABLED 0x0 |
#define | PHY_INTERRUPT_ENABLED 0x80000000 |
#define | to_phy_device(d) container_of(d, struct phy_device, dev) |
#define | to_phy_driver(d) container_of(d, struct phy_driver, driver) |
#define | PHY_ANY_ID "MATCH ANY PHY" |
#define | PHY_ANY_UID 0xffffffff |
Variables | |
struct bus_type | mdio_bus_type |
#define PHY_BASIC_FEATURES |
#define PHY_GBIT_FEATURES |
#define to_phy_device | ( | d | ) | container_of(d, struct phy_device, dev) |
#define to_phy_driver | ( | d | ) | container_of(d, struct phy_driver, driver) |
enum phy_interface_t |
enum phy_state |
int genphy_config_aneg | ( | struct phy_device * | phydev | ) |
genphy_config_aneg - restart auto-negotiation or write BMCR : target phy_device struct
Description: If auto-negotiation is enabled, we configure the advertising, and then restart auto-negotiation. If it is not enabled, then we write the BMCR.
Definition at line 754 of file phy_device.c.
int genphy_read_status | ( | struct phy_device * | phydev | ) |
genphy_read_status - check the link status and update current link state : target phy_device struct
Description: Check the link, then figure out the current state by comparing what we advertise with what the link partner advertises. Start by checking the gigabit possibilities, then move on to 10/100.
Definition at line 829 of file phy_device.c.
int genphy_restart_aneg | ( | struct phy_device * | phydev | ) |
genphy_restart_aneg - Enable and Restart Autonegotiation : target phy_device struct
Definition at line 725 of file phy_device.c.
int genphy_resume | ( | struct phy_device * | phydev | ) |
Definition at line 977 of file phy_device.c.
int genphy_suspend | ( | struct phy_device * | phydev | ) |
Definition at line 962 of file phy_device.c.
int genphy_update_link | ( | struct phy_device * | phydev | ) |
genphy_update_link - update link status in : target phy_device struct
Description: Update the value in phydev->link to reflect the current link value. In order to do this, we need to read the status register twice, keeping the second value.
Definition at line 795 of file phy_device.c.
get_phy_device - reads the specified PHY device and returns its struct : the target MII bus : PHY address on the MII bus : If true the PHY uses the 802.3 clause 45 protocol
Description: Reads the ID registers of the PHY at on the , then allocates and returns the phy_device to represent it.
Definition at line 328 of file phy_device.c.
Definition at line 455 of file mdio_bus.c.
Definition at line 441 of file mdio_bus.c.
mdiobus_alloc_size - allocate a mii_bus structure : extra amount of memory to allocate for private storage. If non-zero, then bus->priv is points to that memory.
Description: called by a bus driver to allocate an mii_bus structure to fill in.
Definition at line 52 of file mdio_bus.c.
mdiobus_read - Convenience function for reading a given MII mgmt register : the mii_bus struct : the phy address : register number to read
NOTE: MUST NOT be called from interrupt context, because the bus read/write functions may wait for an interrupt to conclude the operation.
Definition at line 261 of file mdio_bus.c.
|
read |
Definition at line 232 of file mdio_bus.c.
Definition at line 191 of file mdio_bus.c.
mdiobus_write - Convenience function for writing a given MII mgmt register : the mii_bus struct : the phy address : register number to write : value to write to
NOTE: MUST NOT be called from interrupt context, because the bus read/write functions may wait for an interrupt to conclude the operation.
Definition at line 286 of file mdio_bus.c.
|
read |
Definition at line 585 of file phy_device.c.
|
read |
Definition at line 457 of file phy_device.c.
int phy_connect_direct | ( | struct net_device * | dev, |
struct phy_device * | phydev, | ||
void(*)(struct net_device *) | handler, | ||
u32 | flags, | ||
phy_interface_t | interface | ||
) |
Definition at line 422 of file phy_device.c.
void phy_detach | ( | struct phy_device * | phydev | ) |
phy_detach - detach a PHY device from its network device : target phy_device struct
Definition at line 614 of file phy_device.c.
|
read |
Definition at line 155 of file phy_device.c.
void phy_device_free | ( | struct phy_device * | phydev | ) |
Definition at line 45 of file phy_device.c.
int phy_device_register | ( | struct phy_device * | phydev | ) |
phy_device_register - Register the phy device on the MDIO bus : phy_device structure to be added to the MDIO bus
Definition at line 353 of file phy_device.c.
void phy_disconnect | ( | struct phy_device * | phydev | ) |
phy_disconnect - disable interrupts, stop state machine, and detach a PHY device : target phy_device struct
Definition at line 486 of file phy_device.c.
int phy_driver_register | ( | struct phy_driver * | new_driver | ) |
phy_driver_register - register a phy_driver with the PHY layer : new phy_driver to register
Definition at line 1058 of file phy_device.c.
void phy_driver_unregister | ( | struct phy_driver * | drv | ) |
Definition at line 1098 of file phy_device.c.
int phy_drivers_register | ( | struct phy_driver * | new_driver, |
int | n | ||
) |
Definition at line 1082 of file phy_device.c.
void phy_drivers_unregister | ( | struct phy_driver * | drv, |
int | n | ||
) |
Definition at line 1104 of file phy_device.c.
int phy_ethtool_get_eee | ( | struct phy_device * | phydev, |
struct ethtool_eee * | data | ||
) |
phy_ethtool_get_eee - get EEE supported and status : target phy_device struct : ethtool_eee data
Description: it reportes the Supported/Advertisement/LP Advertisement capabilities.
int phy_ethtool_gset | ( | struct phy_device * | phydev, |
struct ethtool_cmd * | cmd | ||
) |
int phy_ethtool_set_eee | ( | struct phy_device * | phydev, |
struct ethtool_eee * | data | ||
) |
phy_ethtool_set_eee - set EEE supported and status : target phy_device struct : ethtool_eee data
Description: it is to program the Advertisement EEE register.
int phy_ethtool_sset | ( | struct phy_device * | phydev, |
struct ethtool_cmd * | cmd | ||
) |
phy_ethtool_sset - generic ethtool sset function, handles all the details : target phy_device struct : ethtool_cmd
A few notes about parameter checking:
|
read |
int phy_get_eee_err | ( | struct phy_device * | phydev | ) |
int phy_init_eee | ( | struct phy_device * | phydev, |
bool | clk_stop_enable | ||
) |
phy_init_eee - init and check the EEE feature : target phy_device struct : PHY may stop the clock during LPI
Description: it checks if the Energy-Efficient Ethernet (EEE) is supported by looking at the MMD registers 3.20 and 7.60/61 and it programs the MMD register 3.0 setting the "Clock stop enable" bit if required.
int phy_init_hw | ( | struct phy_device * | phydev | ) |
Definition at line 499 of file phy_device.c.
phy_mii_ioctl - generic PHY MII ioctl interface : the phy_device struct : &struct ifreq for socket ioctl's : ioctl cmd to execute
Note that this function is currently incompatible with the PHYCONTROL layer. It changes registers without regard to current state. Use at own risk.
void phy_print_status | ( | struct phy_device * | phydev | ) |
phy_print_status - Convenience function to print out the current phy status : the phy_device struct
int phy_register_fixup | ( | const char * | bus_id, |
u32 | phy_uid, | ||
u32 | phy_uid_mask, | ||
int(*)(struct phy_device *) | run | ||
) |
Definition at line 75 of file phy_device.c.
Definition at line 106 of file phy_device.c.
Definition at line 98 of file phy_device.c.
int phy_scan_fixups | ( | struct phy_device * | phydev | ) |
Definition at line 132 of file phy_device.c.
void phy_start | ( | struct phy_device * | phydev | ) |
phy_start - start or restart a PHY device : target phy_device struct
Description: Indicates the attached device's readiness to handle PHY-related work. Used during startup to start the PHY, and after a call to phy_stop() to resume operation. Also used to indicate the MDIO bus has cleared an error condition.
int phy_start_aneg | ( | struct phy_device * | phydev | ) |
phy_start_aneg - start auto-negotiation for this PHY device : the phy_device struct
Description: Sanitizes the settings (if we're not autonegotiating them), and then calls the driver's config_aneg function. If the PHYCONTROL Layer is operating, we change the state to reflect the beginning of Auto-negotiation or forcing.
int phy_start_interrupts | ( | struct phy_device * | phydev | ) |
phy_start_interrupts - request and enable interrupts for a PHY device : target phy_device struct
Description: Request the interrupt for the given PHY. If this fails, then we set irq to PHY_POLL. Otherwise, we enable the interrupts in the PHY. This should only be called with a valid IRQ number. Returns 0 on success or < 0 on error.
void phy_start_machine | ( | struct phy_device * | phydev, |
void(*)(struct net_device *) | handler | ||
) |
phy_start_machine - start PHY state machine tracking : the phy_device struct : callback function for state change notifications
Description: The PHY infrastructure can run a state machine which tracks whether the PHY is starting up, negotiating, etc. This function starts the timer which tracks the state of the PHY. If you want to be notified when the state changes, pass in the callback , otherwise, pass NULL. If you want to maintain your own state machine, do not call this function.
void phy_state_machine | ( | struct work_struct * | work | ) |
phy_state_machine - Handle the state machine : work_struct that describes the work to be done
void phy_stop | ( | struct phy_device * | phydev | ) |
int phy_stop_interrupts | ( | struct phy_device * | phydev | ) |
phy_stop_interrupts - disable interrupts from a PHY device : target phy_device struct
void phy_stop_machine | ( | struct phy_device * | phydev | ) |
Definition at line 434 of file mdio_bus.c.