remarkable-linux/include/linux/phy_fixed.h
Thomas Petazzoni a759512174 net: phy: extend fixed driver with fixed_phy_register()
The existing fixed_phy_add() function has several drawbacks that
prevents it from being used as is for OF-based declaration of fixed
PHYs:

 * The address of the PHY on the fake bus needs to be passed, while a
   dynamic allocation is desired.

 * Since the phy_device instantiation is post-poned until the next
   mdiobus scan, there is no way to associate the fixed PHY with its
   OF node, which later prevents of_phy_connect() from finding this
   fixed PHY from a given OF node.

To solve this, this commit introduces fixed_phy_register(), which will
allocate an available PHY address, add the PHY using fixed_phy_add()
and instantiate the phy_device structure associated with the provided
OF node.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Grant Likely <grant.likely@linaro.org>
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2014-05-16 17:18:49 -04:00

43 lines
980 B
C

#ifndef __PHY_FIXED_H
#define __PHY_FIXED_H
struct fixed_phy_status {
int link;
int speed;
int duplex;
int pause;
int asym_pause;
};
struct device_node;
#ifdef CONFIG_FIXED_PHY
extern int fixed_phy_add(unsigned int irq, int phy_id,
struct fixed_phy_status *status);
extern int fixed_phy_register(unsigned int irq,
struct fixed_phy_status *status,
struct device_node *np);
#else
static inline int fixed_phy_add(unsigned int irq, int phy_id,
struct fixed_phy_status *status)
{
return -ENODEV;
}
static inline int fixed_phy_register(unsigned int irq,
struct fixed_phy_status *status,
struct device_node *np)
{
return -ENODEV;
}
#endif /* CONFIG_FIXED_PHY */
/*
* This function issued only by fixed_phy-aware drivers, no need
* protect it with #ifdef
*/
extern int fixed_phy_set_link_update(struct phy_device *phydev,
int (*link_update)(struct net_device *,
struct fixed_phy_status *));
#endif /* __PHY_FIXED_H */