Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
phy_device.c File Reference
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/unistd.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/mii.h>
#include <linux/ethtool.h>
#include <linux/phy.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/uaccess.h>

Go to the source code of this file.

Macros

#define pr_fmt(fmt)   KBUILD_MODNAME ": " fmt
 

Functions

 MODULE_DESCRIPTION ("PHY library")
 
 MODULE_AUTHOR ("Andy Fleming")
 
 MODULE_LICENSE ("GPL")
 
void phy_device_free (struct phy_device *phydev)
 
 EXPORT_SYMBOL (phy_device_free)
 
int mdio_bus_init (void)
 
void mdio_bus_exit (void)
 
int phy_register_fixup (const char *bus_id, u32 phy_uid, u32 phy_uid_mask, int(*run)(struct phy_device *))
 
 EXPORT_SYMBOL (phy_register_fixup)
 
int phy_register_fixup_for_uid (u32 phy_uid, u32 phy_uid_mask, int(*run)(struct phy_device *))
 
 EXPORT_SYMBOL (phy_register_fixup_for_uid)
 
int phy_register_fixup_for_id (const char *bus_id, int(*run)(struct phy_device *))
 
 EXPORT_SYMBOL (phy_register_fixup_for_id)
 
int phy_scan_fixups (struct phy_device *phydev)
 
 EXPORT_SYMBOL (phy_scan_fixups)
 
struct phy_devicephy_device_create (struct mii_bus *bus, int addr, int phy_id, bool is_c45, struct phy_c45_device_ids *c45_ids)
 
 EXPORT_SYMBOL (phy_device_create)
 
struct phy_deviceget_phy_device (struct mii_bus *bus, int addr, bool is_c45)
 
 EXPORT_SYMBOL (get_phy_device)
 
int phy_device_register (struct phy_device *phydev)
 
 EXPORT_SYMBOL (phy_device_register)
 
struct phy_devicephy_find_first (struct mii_bus *bus)
 
 EXPORT_SYMBOL (phy_find_first)
 
int phy_connect_direct (struct net_device *dev, struct phy_device *phydev, void(*handler)(struct net_device *), u32 flags, phy_interface_t interface)
 
 EXPORT_SYMBOL (phy_connect_direct)
 
struct phy_devicephy_connect (struct net_device *dev, const char *bus_id, void(*handler)(struct net_device *), u32 flags, phy_interface_t interface)
 
 EXPORT_SYMBOL (phy_connect)
 
void phy_disconnect (struct phy_device *phydev)
 
 EXPORT_SYMBOL (phy_disconnect)
 
int phy_init_hw (struct phy_device *phydev)
 
struct phy_devicephy_attach (struct net_device *dev, const char *bus_id, u32 flags, phy_interface_t interface)
 
 EXPORT_SYMBOL (phy_attach)
 
void phy_detach (struct phy_device *phydev)
 
 EXPORT_SYMBOL (phy_detach)
 
int genphy_restart_aneg (struct phy_device *phydev)
 
 EXPORT_SYMBOL (genphy_restart_aneg)
 
int genphy_config_aneg (struct phy_device *phydev)
 
 EXPORT_SYMBOL (genphy_config_aneg)
 
int genphy_update_link (struct phy_device *phydev)
 
 EXPORT_SYMBOL (genphy_update_link)
 
int genphy_read_status (struct phy_device *phydev)
 
 EXPORT_SYMBOL (genphy_read_status)
 
int genphy_suspend (struct phy_device *phydev)
 
 EXPORT_SYMBOL (genphy_suspend)
 
int genphy_resume (struct phy_device *phydev)
 
 EXPORT_SYMBOL (genphy_resume)
 
int phy_driver_register (struct phy_driver *new_driver)
 
 EXPORT_SYMBOL (phy_driver_register)
 
int phy_drivers_register (struct phy_driver *new_driver, int n)
 
 EXPORT_SYMBOL (phy_drivers_register)
 
void phy_driver_unregister (struct phy_driver *drv)
 
 EXPORT_SYMBOL (phy_driver_unregister)
 
void phy_drivers_unregister (struct phy_driver *drv, int n)
 
 EXPORT_SYMBOL (phy_drivers_unregister)
 
 subsys_initcall (phy_init)
 
 module_exit (phy_exit)
 

Macro Definition Documentation

#define pr_fmt (   fmt)    KBUILD_MODNAME ": " fmt

Definition at line 18 of file phy_device.c.

Function Documentation

EXPORT_SYMBOL ( phy_device_free  )
EXPORT_SYMBOL ( phy_register_fixup  )
EXPORT_SYMBOL ( phy_register_fixup_for_uid  )
EXPORT_SYMBOL ( phy_register_fixup_for_id  )
EXPORT_SYMBOL ( phy_scan_fixups  )
EXPORT_SYMBOL ( phy_device_create  )
EXPORT_SYMBOL ( get_phy_device  )
EXPORT_SYMBOL ( phy_device_register  )
EXPORT_SYMBOL ( phy_find_first  )
EXPORT_SYMBOL ( phy_connect_direct  )
EXPORT_SYMBOL ( phy_connect  )
EXPORT_SYMBOL ( phy_disconnect  )
EXPORT_SYMBOL ( phy_attach  )
EXPORT_SYMBOL ( phy_detach  )
EXPORT_SYMBOL ( genphy_restart_aneg  )
EXPORT_SYMBOL ( genphy_config_aneg  )
EXPORT_SYMBOL ( genphy_update_link  )
EXPORT_SYMBOL ( genphy_read_status  )
EXPORT_SYMBOL ( genphy_suspend  )
EXPORT_SYMBOL ( genphy_resume  )
EXPORT_SYMBOL ( phy_driver_register  )
EXPORT_SYMBOL ( phy_drivers_register  )
EXPORT_SYMBOL ( phy_driver_unregister  )
EXPORT_SYMBOL ( phy_drivers_unregister  )
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.

struct phy_device* get_phy_device ( struct mii_bus bus,
int  addr,
bool  is_c45 
)
read

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.

void mdio_bus_exit ( void  )

Definition at line 455 of file mdio_bus.c.

int mdio_bus_init ( void  )

Definition at line 441 of file mdio_bus.c.

MODULE_AUTHOR ( "Andy Fleming"  )
MODULE_DESCRIPTION ( "PHY library"  )
module_exit ( phy_exit  )
MODULE_LICENSE ( "GPL"  )
struct phy_device* phy_attach ( struct net_device dev,
const char bus_id,
u32  flags,
phy_interface_t  interface 
)
read

Definition at line 585 of file phy_device.c.

struct phy_device* phy_connect ( struct net_device dev,
const char bus_id,
void(*)(struct net_device *)  handler,
u32  flags,
phy_interface_t  interface 
)
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.

struct phy_device* phy_device_create ( struct mii_bus bus,
int  addr,
int  phy_id,
bool  is_c45,
struct phy_c45_device_ids c45_ids 
)
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.

struct phy_device* phy_find_first ( struct mii_bus bus)
read

phy_find_first - finds the first PHY device on the bus : the target MII bus

Definition at line 384 of file phy_device.c.

int phy_init_hw ( struct phy_device phydev)

Definition at line 499 of file phy_device.c.

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.

int phy_register_fixup_for_id ( const char bus_id,
int(*)(struct phy_device *)  run 
)

Definition at line 106 of file phy_device.c.

int phy_register_fixup_for_uid ( u32  phy_uid,
u32  phy_uid_mask,
int(*)(struct phy_device *)  run 
)

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.

subsys_initcall ( phy_init  )