mirror of https://gitee.com/openkylin/linux.git
Merge branch 'phy-mdio-split'
Florian Fainelli says: ==================== net: phy: Allow splitting MDIO bus/device support This patch series allows building support for MDIO bus controllers which are sometimes usable and necessary in cases where there are no Ethernet PHYs. Changes in v3: - corrected of_mdio compile guards for prototypes vs. stubs - added a missing OF_MDIO dependency for MDIO_BCM_UNIMAC - fixed Kbuild bot reported errors against mdio-bitbang Changes in v2: - implement Russell's feedback - solve the circular dependency in the CONFIG_MDIO_DEVICE + CONFIG_PHYLIB case ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
12459cbd98
|
@ -18,7 +18,7 @@ obj-$(CONFIG_MII) += mii.o
|
||||||
obj-$(CONFIG_MDIO) += mdio.o
|
obj-$(CONFIG_MDIO) += mdio.o
|
||||||
obj-$(CONFIG_NET) += Space.o loopback.o
|
obj-$(CONFIG_NET) += Space.o loopback.o
|
||||||
obj-$(CONFIG_NETCONSOLE) += netconsole.o
|
obj-$(CONFIG_NETCONSOLE) += netconsole.o
|
||||||
obj-$(CONFIG_PHYLIB) += phy/
|
obj-$(CONFIG_MDIO_DEVICE) += phy/
|
||||||
obj-$(CONFIG_RIONET) += rionet.o
|
obj-$(CONFIG_RIONET) += rionet.o
|
||||||
obj-$(CONFIG_NET_TEAM) += team/
|
obj-$(CONFIG_NET_TEAM) += team/
|
||||||
obj-$(CONFIG_TUN) += tun.o
|
obj-$(CONFIG_TUN) += tun.o
|
||||||
|
|
|
@ -2,33 +2,12 @@
|
||||||
# PHY Layer Configuration
|
# PHY Layer Configuration
|
||||||
#
|
#
|
||||||
|
|
||||||
menuconfig PHYLIB
|
menuconfig MDIO_DEVICE
|
||||||
tristate "PHY Device support and infrastructure"
|
tristate "MDIO bus device drivers"
|
||||||
depends on NETDEVICES
|
|
||||||
help
|
help
|
||||||
Ethernet controllers are usually attached to PHY
|
MDIO devices and driver infrastructure code.
|
||||||
devices. This option provides infrastructure for
|
|
||||||
managing PHY devices.
|
|
||||||
|
|
||||||
if PHYLIB
|
if MDIO_DEVICE
|
||||||
|
|
||||||
config SWPHY
|
|
||||||
bool
|
|
||||||
|
|
||||||
config LED_TRIGGER_PHY
|
|
||||||
bool "Support LED triggers for tracking link state"
|
|
||||||
depends on LEDS_TRIGGERS
|
|
||||||
---help---
|
|
||||||
Adds support for a set of LED trigger events per-PHY. Link
|
|
||||||
state change will trigger the events, for consumption by an
|
|
||||||
LED class driver. There are triggers for each link speed currently
|
|
||||||
supported by the phy, and are of the form:
|
|
||||||
<mii bus id>:<phy>:<speed>
|
|
||||||
|
|
||||||
Where speed is in the form:
|
|
||||||
<Speed in megabits>Mbps or <Speed in gigabits>Gbps
|
|
||||||
|
|
||||||
comment "MDIO bus device drivers"
|
|
||||||
|
|
||||||
config MDIO_BCM_IPROC
|
config MDIO_BCM_IPROC
|
||||||
tristate "Broadcom iProc MDIO bus controller"
|
tristate "Broadcom iProc MDIO bus controller"
|
||||||
|
@ -40,7 +19,7 @@ config MDIO_BCM_IPROC
|
||||||
|
|
||||||
config MDIO_BCM_UNIMAC
|
config MDIO_BCM_UNIMAC
|
||||||
tristate "Broadcom UniMAC MDIO bus controller"
|
tristate "Broadcom UniMAC MDIO bus controller"
|
||||||
depends on HAS_IOMEM
|
depends on HAS_IOMEM && OF_MDIO
|
||||||
help
|
help
|
||||||
This module provides a driver for the Broadcom UniMAC MDIO busses.
|
This module provides a driver for the Broadcom UniMAC MDIO busses.
|
||||||
This hardware can be found in the Broadcom GENET Ethernet MAC
|
This hardware can be found in the Broadcom GENET Ethernet MAC
|
||||||
|
@ -49,6 +28,7 @@ config MDIO_BCM_UNIMAC
|
||||||
|
|
||||||
config MDIO_BITBANG
|
config MDIO_BITBANG
|
||||||
tristate "Bitbanged MDIO buses"
|
tristate "Bitbanged MDIO buses"
|
||||||
|
depends on !(MDIO_DEVICE=y && PHYLIB=m)
|
||||||
help
|
help
|
||||||
This module implements the MDIO bus protocol in software,
|
This module implements the MDIO bus protocol in software,
|
||||||
for use by low level drivers that export the ability to
|
for use by low level drivers that export the ability to
|
||||||
|
@ -160,6 +140,36 @@ config MDIO_XGENE
|
||||||
This module provides a driver for the MDIO busses found in the
|
This module provides a driver for the MDIO busses found in the
|
||||||
APM X-Gene SoC's.
|
APM X-Gene SoC's.
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
menuconfig PHYLIB
|
||||||
|
tristate "PHY Device support and infrastructure"
|
||||||
|
depends on NETDEVICES
|
||||||
|
select MDIO_DEVICE
|
||||||
|
help
|
||||||
|
Ethernet controllers are usually attached to PHY
|
||||||
|
devices. This option provides infrastructure for
|
||||||
|
managing PHY devices.
|
||||||
|
|
||||||
|
if PHYLIB
|
||||||
|
|
||||||
|
config SWPHY
|
||||||
|
bool
|
||||||
|
|
||||||
|
config LED_TRIGGER_PHY
|
||||||
|
bool "Support LED triggers for tracking link state"
|
||||||
|
depends on LEDS_TRIGGERS
|
||||||
|
---help---
|
||||||
|
Adds support for a set of LED trigger events per-PHY. Link
|
||||||
|
state change will trigger the events, for consumption by an
|
||||||
|
LED class driver. There are triggers for each link speed currently
|
||||||
|
supported by the phy, and are of the form:
|
||||||
|
<mii bus id>:<phy>:<speed>
|
||||||
|
|
||||||
|
Where speed is in the form:
|
||||||
|
<Speed in megabits>Mbps or <Speed in gigabits>Gbps
|
||||||
|
|
||||||
|
|
||||||
comment "MII PHY device drivers"
|
comment "MII PHY device drivers"
|
||||||
|
|
||||||
config AMD_PHY
|
config AMD_PHY
|
||||||
|
|
|
@ -1,7 +1,16 @@
|
||||||
# Makefile for Linux PHY drivers and MDIO bus drivers
|
# Makefile for Linux PHY drivers and MDIO bus drivers
|
||||||
|
|
||||||
libphy-y := phy.o phy_device.o mdio_bus.o mdio_device.o \
|
libphy-y := phy.o phy-core.o phy_device.o
|
||||||
mdio-boardinfo.o phy-core.o
|
mdio-bus-y += mdio_bus.o mdio_device.o mdio-boardinfo.o
|
||||||
|
|
||||||
|
# PHYLIB implies MDIO_DEVICE, in that case, we have a bunch of circular
|
||||||
|
# dependencies that does not make it possible to split mdio-bus objects into a
|
||||||
|
# dedicated loadable module, so we bundle them all together into libphy.ko
|
||||||
|
ifdef CONFIG_PHYLIB
|
||||||
|
libphy-y += $(mdio-bus-y)
|
||||||
|
else
|
||||||
|
obj-$(CONFIG_MDIO_DEVICE) += mdio-bus.o
|
||||||
|
endif
|
||||||
libphy-$(CONFIG_SWPHY) += swphy.o
|
libphy-$(CONFIG_SWPHY) += swphy.o
|
||||||
libphy-$(CONFIG_LED_TRIGGER_PHY) += phy_led_triggers.o
|
libphy-$(CONFIG_LED_TRIGGER_PHY) += phy_led_triggers.o
|
||||||
|
|
||||||
|
|
|
@ -84,3 +84,4 @@ int mdiobus_register_board_info(const struct mdio_board_info *info,
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(mdiobus_register_board_info);
|
||||||
|
|
|
@ -648,9 +648,18 @@ int __init mdio_bus_init(void)
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(mdio_bus_init);
|
||||||
|
|
||||||
|
#if IS_ENABLED(CONFIG_PHYLIB)
|
||||||
void mdio_bus_exit(void)
|
void mdio_bus_exit(void)
|
||||||
{
|
{
|
||||||
class_unregister(&mdio_bus_class);
|
class_unregister(&mdio_bus_class);
|
||||||
bus_unregister(&mdio_bus_type);
|
bus_unregister(&mdio_bus_type);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(mdio_bus_exit);
|
||||||
|
#else
|
||||||
|
module_init(mdio_bus_init);
|
||||||
|
/* no module_exit, intentional */
|
||||||
|
MODULE_LICENSE("GPL");
|
||||||
|
MODULE_DESCRIPTION("MDIO bus/device layer");
|
||||||
|
#endif
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include <linux/phy.h>
|
#include <linux/phy.h>
|
||||||
#include <linux/of.h>
|
#include <linux/of.h>
|
||||||
|
|
||||||
#ifdef CONFIG_OF
|
#if IS_ENABLED(CONFIG_OF_MDIO)
|
||||||
extern int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np);
|
extern int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np);
|
||||||
extern struct phy_device *of_phy_find_device(struct device_node *phy_np);
|
extern struct phy_device *of_phy_find_device(struct device_node *phy_np);
|
||||||
extern struct phy_device *of_phy_connect(struct net_device *dev,
|
extern struct phy_device *of_phy_connect(struct net_device *dev,
|
||||||
|
@ -32,7 +32,7 @@ extern int of_phy_register_fixed_link(struct device_node *np);
|
||||||
extern void of_phy_deregister_fixed_link(struct device_node *np);
|
extern void of_phy_deregister_fixed_link(struct device_node *np);
|
||||||
extern bool of_phy_is_fixed_link(struct device_node *np);
|
extern bool of_phy_is_fixed_link(struct device_node *np);
|
||||||
|
|
||||||
#else /* CONFIG_OF */
|
#else /* CONFIG_OF_MDIO */
|
||||||
static inline int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
|
static inline int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -745,8 +745,24 @@ int phy_write_mmd(struct phy_device *phydev, int devad, u32 regnum, u16 val);
|
||||||
struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id,
|
struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id,
|
||||||
bool is_c45,
|
bool is_c45,
|
||||||
struct phy_c45_device_ids *c45_ids);
|
struct phy_c45_device_ids *c45_ids);
|
||||||
|
#if IS_ENABLED(CONFIG_PHYLIB)
|
||||||
struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45);
|
struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45);
|
||||||
int phy_device_register(struct phy_device *phy);
|
int phy_device_register(struct phy_device *phy);
|
||||||
|
void phy_device_free(struct phy_device *phydev);
|
||||||
|
#else
|
||||||
|
static inline
|
||||||
|
struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int phy_device_register(struct phy_device *phy)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void phy_device_free(struct phy_device *phydev) { }
|
||||||
|
#endif /* CONFIG_PHYLIB */
|
||||||
void phy_device_remove(struct phy_device *phydev);
|
void phy_device_remove(struct phy_device *phydev);
|
||||||
int phy_init_hw(struct phy_device *phydev);
|
int phy_init_hw(struct phy_device *phydev);
|
||||||
int phy_suspend(struct phy_device *phydev);
|
int phy_suspend(struct phy_device *phydev);
|
||||||
|
@ -827,7 +843,6 @@ int phy_ethtool_ksettings_set(struct phy_device *phydev,
|
||||||
int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd);
|
int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd);
|
||||||
int phy_start_interrupts(struct phy_device *phydev);
|
int phy_start_interrupts(struct phy_device *phydev);
|
||||||
void phy_print_status(struct phy_device *phydev);
|
void phy_print_status(struct phy_device *phydev);
|
||||||
void phy_device_free(struct phy_device *phydev);
|
|
||||||
int phy_set_max_speed(struct phy_device *phydev, u32 max_speed);
|
int phy_set_max_speed(struct phy_device *phydev, u32 max_speed);
|
||||||
|
|
||||||
int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask,
|
int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask,
|
||||||
|
@ -854,8 +869,10 @@ int phy_ethtool_set_link_ksettings(struct net_device *ndev,
|
||||||
const struct ethtool_link_ksettings *cmd);
|
const struct ethtool_link_ksettings *cmd);
|
||||||
int phy_ethtool_nway_reset(struct net_device *ndev);
|
int phy_ethtool_nway_reset(struct net_device *ndev);
|
||||||
|
|
||||||
|
#if IS_ENABLED(CONFIG_PHYLIB)
|
||||||
int __init mdio_bus_init(void);
|
int __init mdio_bus_init(void);
|
||||||
void mdio_bus_exit(void);
|
void mdio_bus_exit(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
extern struct bus_type mdio_bus_type;
|
extern struct bus_type mdio_bus_type;
|
||||||
|
|
||||||
|
@ -866,7 +883,7 @@ struct mdio_board_info {
|
||||||
const void *platform_data;
|
const void *platform_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_PHYLIB)
|
#if IS_ENABLED(CONFIG_MDIO_DEVICE)
|
||||||
int mdiobus_register_board_info(const struct mdio_board_info *info,
|
int mdiobus_register_board_info(const struct mdio_board_info *info,
|
||||||
unsigned int n);
|
unsigned int n);
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in New Issue