mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 03:15:23 +07:00
Merge branch 'fixed_phy'
Florian Fainelli says: ==================== net: of_phy_connect_fixed_link removal This patch set removes of_phy_connect_fixed_link() from the tree now that we have a better solution for dealing with fixed PHY (emulated PHY) devices for drivers that require them. First two patches update the 'fixed-link' Device Tree binding and drivers to refere to it. Patches 3 to 7 update the in-tree network drivers that use of_phy_connect_fixed_link() Patch 8 removes of_phy_connect_fixed_link Patch 9 removes the PowerPC code that parsed the 'fixed-link' property. Patch 9 can be merged via the net-next tree if the PowerPC folks ack it, but it really has to be merged after the first 8 patches in order to avoid breakage. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
cb421c2845
@ -24,7 +24,7 @@ Optional properties:
|
|||||||
- fixed-link: When the GENET interface is connected to a MoCA hardware block or
|
- fixed-link: When the GENET interface is connected to a MoCA hardware block or
|
||||||
when operating in a RGMII to RGMII type of connection, or when the MDIO bus is
|
when operating in a RGMII to RGMII type of connection, or when the MDIO bus is
|
||||||
voluntarily disabled, this property should be used to describe the "fixed link".
|
voluntarily disabled, this property should be used to describe the "fixed link".
|
||||||
See Documentation/devicetree/bindings/net/fsl-tsec-phy.txt for information on
|
See Documentation/devicetree/bindings/net/fixed-link.txt for information on
|
||||||
the property specifics
|
the property specifics
|
||||||
|
|
||||||
Required child nodes:
|
Required child nodes:
|
||||||
|
@ -8,7 +8,7 @@ Required properties:
|
|||||||
- local-mac-address: Ethernet MAC address (48 bits) of this adapter
|
- local-mac-address: Ethernet MAC address (48 bits) of this adapter
|
||||||
- phy-mode: Should be a string describing the PHY interface to the
|
- phy-mode: Should be a string describing the PHY interface to the
|
||||||
Ethernet switch/PHY, see Documentation/devicetree/bindings/net/ethernet.txt
|
Ethernet switch/PHY, see Documentation/devicetree/bindings/net/ethernet.txt
|
||||||
- fixed-link: see Documentation/devicetree/bindings/net/fsl-tsec-phy.txt for
|
- fixed-link: see Documentation/devicetree/bindings/net/fixed-link.txt for
|
||||||
the property specific details
|
the property specific details
|
||||||
|
|
||||||
Optional properties:
|
Optional properties:
|
||||||
|
@ -18,6 +18,18 @@ properties:
|
|||||||
* 'asym-pause' (boolean, optional), to indicate that asym_pause should
|
* 'asym-pause' (boolean, optional), to indicate that asym_pause should
|
||||||
be enabled.
|
be enabled.
|
||||||
|
|
||||||
|
Old, deprecated 'fixed-link' binding:
|
||||||
|
|
||||||
|
* A 'fixed-link' property in the Ethernet MAC node, with 5 cells, of the
|
||||||
|
form <a b c d e> with the following accepted values:
|
||||||
|
- a: emulated PHY ID, choose any but but unique to the all specified
|
||||||
|
fixed-links, from 0 to 31
|
||||||
|
- b: duplex configuration: 0 for half duplex, 1 for full duplex
|
||||||
|
- c: link speed in Mbits/sec, accepted values are: 10, 100 and 1000
|
||||||
|
- d: pause configuration: 0 for no pause, 1 for pause
|
||||||
|
- e: asymmetric pause configuration: 0 for no asymmetric pause, 1 for
|
||||||
|
asymmetric pause
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
ethernet@0 {
|
ethernet@0 {
|
||||||
|
@ -42,10 +42,7 @@ Properties:
|
|||||||
interrupt. For TSEC and eTSEC devices, the first interrupt is
|
interrupt. For TSEC and eTSEC devices, the first interrupt is
|
||||||
transmit, the second is receive, and the third is error.
|
transmit, the second is receive, and the third is error.
|
||||||
- phy-handle : See ethernet.txt file in the same directory.
|
- phy-handle : See ethernet.txt file in the same directory.
|
||||||
- fixed-link : <a b c d e> where a is emulated phy id - choose any,
|
- fixed-link : See fixed-link.txt in the same directory.
|
||||||
but unique to the all specified fixed-links, b is duplex - 0 half,
|
|
||||||
1 full, c is link speed - d#10/d#100/d#1000, d is pause - 0 no
|
|
||||||
pause, 1 pause, e is asym_pause - 0 no asym_pause, 1 asym_pause.
|
|
||||||
- phy-connection-type : See ethernet.txt file in the same directory.
|
- phy-connection-type : See ethernet.txt file in the same directory.
|
||||||
This property is only really needed if the connection is of type
|
This property is only really needed if the connection is of type
|
||||||
"rgmii-id", as all other connection types are detected by hardware.
|
"rgmii-id", as all other connection types are detected by hardware.
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#include <linux/of.h>
|
#include <linux/of.h>
|
||||||
#include <linux/of_platform.h>
|
#include <linux/of_platform.h>
|
||||||
#include <linux/phy.h>
|
#include <linux/phy.h>
|
||||||
#include <linux/phy_fixed.h>
|
|
||||||
#include <linux/spi/spi.h>
|
#include <linux/spi/spi.h>
|
||||||
#include <linux/fsl_devices.h>
|
#include <linux/fsl_devices.h>
|
||||||
#include <linux/fs_enet_pd.h>
|
#include <linux/fs_enet_pd.h>
|
||||||
@ -178,37 +177,6 @@ u32 get_baudrate(void)
|
|||||||
EXPORT_SYMBOL(get_baudrate);
|
EXPORT_SYMBOL(get_baudrate);
|
||||||
#endif /* CONFIG_CPM2 */
|
#endif /* CONFIG_CPM2 */
|
||||||
|
|
||||||
#ifdef CONFIG_FIXED_PHY
|
|
||||||
static int __init of_add_fixed_phys(void)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
struct device_node *np;
|
|
||||||
u32 *fixed_link;
|
|
||||||
struct fixed_phy_status status = {};
|
|
||||||
|
|
||||||
for_each_node_by_name(np, "ethernet") {
|
|
||||||
fixed_link = (u32 *)of_get_property(np, "fixed-link", NULL);
|
|
||||||
if (!fixed_link)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
status.link = 1;
|
|
||||||
status.duplex = fixed_link[1];
|
|
||||||
status.speed = fixed_link[2];
|
|
||||||
status.pause = fixed_link[3];
|
|
||||||
status.asym_pause = fixed_link[4];
|
|
||||||
|
|
||||||
ret = fixed_phy_add(PHY_POLL, fixed_link[0], &status);
|
|
||||||
if (ret) {
|
|
||||||
of_node_put(np);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
arch_initcall(of_add_fixed_phys);
|
|
||||||
#endif /* CONFIG_FIXED_PHY */
|
|
||||||
|
|
||||||
#if defined(CONFIG_FSL_SOC_BOOKE) || defined(CONFIG_PPC_86xx)
|
#if defined(CONFIG_FSL_SOC_BOOKE) || defined(CONFIG_PPC_86xx)
|
||||||
static __be32 __iomem *rstcr;
|
static __be32 __iomem *rstcr;
|
||||||
|
|
||||||
|
@ -1327,8 +1327,8 @@ static int bcm_sysport_open(struct net_device *dev)
|
|||||||
/* Read CRC forward */
|
/* Read CRC forward */
|
||||||
priv->crc_fwd = !!(umac_readl(priv, UMAC_CMD) & CMD_CRC_FWD);
|
priv->crc_fwd = !!(umac_readl(priv, UMAC_CMD) & CMD_CRC_FWD);
|
||||||
|
|
||||||
priv->phydev = of_phy_connect_fixed_link(dev, bcm_sysport_adj_link,
|
priv->phydev = of_phy_connect(dev, priv->phy_dn, bcm_sysport_adj_link,
|
||||||
priv->phy_interface);
|
0, priv->phy_interface);
|
||||||
if (!priv->phydev) {
|
if (!priv->phydev) {
|
||||||
netdev_err(dev, "could not attach to PHY\n");
|
netdev_err(dev, "could not attach to PHY\n");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
@ -1551,6 +1551,19 @@ static int bcm_sysport_probe(struct platform_device *pdev)
|
|||||||
if (priv->phy_interface < 0)
|
if (priv->phy_interface < 0)
|
||||||
priv->phy_interface = PHY_INTERFACE_MODE_GMII;
|
priv->phy_interface = PHY_INTERFACE_MODE_GMII;
|
||||||
|
|
||||||
|
/* In the case of a fixed PHY, the DT node associated
|
||||||
|
* to the PHY is the Ethernet MAC DT node.
|
||||||
|
*/
|
||||||
|
if (of_phy_is_fixed_link(dn)) {
|
||||||
|
ret = of_phy_register_fixed_link(dn);
|
||||||
|
if (ret) {
|
||||||
|
dev_err(&pdev->dev, "failed to register fixed PHY\n");
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
|
priv->phy_dn = dn;
|
||||||
|
}
|
||||||
|
|
||||||
/* Initialize netdevice members */
|
/* Initialize netdevice members */
|
||||||
macaddr = of_get_mac_address(dn);
|
macaddr = of_get_mac_address(dn);
|
||||||
if (!macaddr || !is_valid_ether_addr(macaddr)) {
|
if (!macaddr || !is_valid_ether_addr(macaddr)) {
|
||||||
|
@ -656,6 +656,7 @@ struct bcm_sysport_priv {
|
|||||||
unsigned int rx_c_index;
|
unsigned int rx_c_index;
|
||||||
|
|
||||||
/* PHY device */
|
/* PHY device */
|
||||||
|
struct device_node *phy_dn;
|
||||||
struct phy_device *phydev;
|
struct phy_device *phydev;
|
||||||
phy_interface_t phy_interface;
|
phy_interface_t phy_interface;
|
||||||
int old_pause;
|
int old_pause;
|
||||||
|
@ -298,6 +298,7 @@ int bcmgenet_mii_config(struct net_device *dev)
|
|||||||
static int bcmgenet_mii_probe(struct net_device *dev)
|
static int bcmgenet_mii_probe(struct net_device *dev)
|
||||||
{
|
{
|
||||||
struct bcmgenet_priv *priv = netdev_priv(dev);
|
struct bcmgenet_priv *priv = netdev_priv(dev);
|
||||||
|
struct device_node *dn = priv->pdev->dev.of_node;
|
||||||
struct phy_device *phydev;
|
struct phy_device *phydev;
|
||||||
unsigned int phy_flags;
|
unsigned int phy_flags;
|
||||||
int ret;
|
int ret;
|
||||||
@ -307,15 +308,19 @@ static int bcmgenet_mii_probe(struct net_device *dev)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->phy_dn)
|
/* In the case of a fixed PHY, the DT node associated
|
||||||
phydev = of_phy_connect(dev, priv->phy_dn,
|
* to the PHY is the Ethernet MAC DT node.
|
||||||
bcmgenet_mii_setup, 0,
|
*/
|
||||||
priv->phy_interface);
|
if (of_phy_is_fixed_link(dn)) {
|
||||||
else
|
ret = of_phy_register_fixed_link(dn);
|
||||||
phydev = of_phy_connect_fixed_link(dev,
|
if (ret)
|
||||||
bcmgenet_mii_setup,
|
return ret;
|
||||||
priv->phy_interface);
|
|
||||||
|
|
||||||
|
priv->phy_dn = dn;
|
||||||
|
}
|
||||||
|
|
||||||
|
phydev = of_phy_connect(dev, priv->phy_dn, bcmgenet_mii_setup, 0,
|
||||||
|
priv->phy_interface);
|
||||||
if (!phydev) {
|
if (!phydev) {
|
||||||
pr_err("could not attach to PHY\n");
|
pr_err("could not attach to PHY\n");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
@ -791,10 +791,6 @@ static int fs_init_phy(struct net_device *dev)
|
|||||||
|
|
||||||
phydev = of_phy_connect(dev, fep->fpi->phy_node, &fs_adjust_link, 0,
|
phydev = of_phy_connect(dev, fep->fpi->phy_node, &fs_adjust_link, 0,
|
||||||
iface);
|
iface);
|
||||||
if (!phydev) {
|
|
||||||
phydev = of_phy_connect_fixed_link(dev, &fs_adjust_link,
|
|
||||||
iface);
|
|
||||||
}
|
|
||||||
if (!phydev) {
|
if (!phydev) {
|
||||||
dev_err(&dev->dev, "Could not attach to PHY\n");
|
dev_err(&dev->dev, "Could not attach to PHY\n");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
@ -1029,9 +1025,16 @@ static int fs_enet_probe(struct platform_device *ofdev)
|
|||||||
fpi->use_napi = 1;
|
fpi->use_napi = 1;
|
||||||
fpi->napi_weight = 17;
|
fpi->napi_weight = 17;
|
||||||
fpi->phy_node = of_parse_phandle(ofdev->dev.of_node, "phy-handle", 0);
|
fpi->phy_node = of_parse_phandle(ofdev->dev.of_node, "phy-handle", 0);
|
||||||
if ((!fpi->phy_node) && (!of_get_property(ofdev->dev.of_node, "fixed-link",
|
if (!fpi->phy_node && of_phy_is_fixed_link(ofdev->dev.of_node)) {
|
||||||
NULL)))
|
err = of_phy_register_fixed_link(ofdev->dev.of_node);
|
||||||
goto out_free_fpi;
|
if (err)
|
||||||
|
goto out_free_fpi;
|
||||||
|
|
||||||
|
/* In the case of a fixed PHY, the DT node associated
|
||||||
|
* to the PHY is the Ethernet MAC DT node.
|
||||||
|
*/
|
||||||
|
fpi->phy_node = ofdev->dev.of_node;
|
||||||
|
}
|
||||||
|
|
||||||
if (of_device_is_compatible(ofdev->dev.of_node, "fsl,mpc5125-fec")) {
|
if (of_device_is_compatible(ofdev->dev.of_node, "fsl,mpc5125-fec")) {
|
||||||
phy_connection_type = of_get_property(ofdev->dev.of_node,
|
phy_connection_type = of_get_property(ofdev->dev.of_node,
|
||||||
|
@ -889,6 +889,17 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev)
|
|||||||
|
|
||||||
priv->phy_node = of_parse_phandle(np, "phy-handle", 0);
|
priv->phy_node = of_parse_phandle(np, "phy-handle", 0);
|
||||||
|
|
||||||
|
/* In the case of a fixed PHY, the DT node associated
|
||||||
|
* to the PHY is the Ethernet MAC DT node.
|
||||||
|
*/
|
||||||
|
if (of_phy_is_fixed_link(np)) {
|
||||||
|
err = of_phy_register_fixed_link(np);
|
||||||
|
if (err)
|
||||||
|
goto err_grp_init;
|
||||||
|
|
||||||
|
priv->phy_node = np;
|
||||||
|
}
|
||||||
|
|
||||||
/* Find the TBI PHY. If it's not there, we don't support SGMII */
|
/* Find the TBI PHY. If it's not there, we don't support SGMII */
|
||||||
priv->tbi_node = of_parse_phandle(np, "tbi-handle", 0);
|
priv->tbi_node = of_parse_phandle(np, "tbi-handle", 0);
|
||||||
|
|
||||||
@ -1660,9 +1671,6 @@ static int init_phy(struct net_device *dev)
|
|||||||
|
|
||||||
priv->phydev = of_phy_connect(dev, priv->phy_node, &adjust_link, 0,
|
priv->phydev = of_phy_connect(dev, priv->phy_node, &adjust_link, 0,
|
||||||
interface);
|
interface);
|
||||||
if (!priv->phydev)
|
|
||||||
priv->phydev = of_phy_connect_fixed_link(dev, &adjust_link,
|
|
||||||
interface);
|
|
||||||
if (!priv->phydev) {
|
if (!priv->phydev) {
|
||||||
dev_err(&dev->dev, "could not attach to PHY\n");
|
dev_err(&dev->dev, "could not attach to PHY\n");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
@ -1728,9 +1728,6 @@ static int init_phy(struct net_device *dev)
|
|||||||
|
|
||||||
phydev = of_phy_connect(dev, ug_info->phy_node, &adjust_link, 0,
|
phydev = of_phy_connect(dev, ug_info->phy_node, &adjust_link, 0,
|
||||||
priv->phy_interface);
|
priv->phy_interface);
|
||||||
if (!phydev)
|
|
||||||
phydev = of_phy_connect_fixed_link(dev, &adjust_link,
|
|
||||||
priv->phy_interface);
|
|
||||||
if (!phydev) {
|
if (!phydev) {
|
||||||
dev_err(&dev->dev, "Could not attach to PHY\n");
|
dev_err(&dev->dev, "Could not attach to PHY\n");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
@ -3790,6 +3787,17 @@ static int ucc_geth_probe(struct platform_device* ofdev)
|
|||||||
ug_info->uf_info.irq = irq_of_parse_and_map(np, 0);
|
ug_info->uf_info.irq = irq_of_parse_and_map(np, 0);
|
||||||
|
|
||||||
ug_info->phy_node = of_parse_phandle(np, "phy-handle", 0);
|
ug_info->phy_node = of_parse_phandle(np, "phy-handle", 0);
|
||||||
|
if (!ug_info->phy_node) {
|
||||||
|
/* In the case of a fixed PHY, the DT node associated
|
||||||
|
* to the PHY is the Ethernet MAC DT node.
|
||||||
|
*/
|
||||||
|
if (of_phy_is_fixed_link(np)) {
|
||||||
|
err = of_phy_register_fixed_link(np);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
ug_info->phy_node = np;
|
||||||
|
}
|
||||||
|
|
||||||
/* Find the TBI PHY node. If it's not there, we don't support SGMII */
|
/* Find the TBI PHY node. If it's not there, we don't support SGMII */
|
||||||
ug_info->tbi_node = of_parse_phandle(np, "tbi-handle", 0);
|
ug_info->tbi_node = of_parse_phandle(np, "tbi-handle", 0);
|
||||||
|
@ -245,44 +245,6 @@ struct phy_device *of_phy_connect(struct net_device *dev,
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL(of_phy_connect);
|
EXPORT_SYMBOL(of_phy_connect);
|
||||||
|
|
||||||
/**
|
|
||||||
* of_phy_connect_fixed_link - Parse fixed-link property and return a dummy phy
|
|
||||||
* @dev: pointer to net_device claiming the phy
|
|
||||||
* @hndlr: Link state callback for the network device
|
|
||||||
* @iface: PHY data interface type
|
|
||||||
*
|
|
||||||
* This function is a temporary stop-gap and will be removed soon. It is
|
|
||||||
* only to support the fs_enet, ucc_geth and gianfar Ethernet drivers. Do
|
|
||||||
* not call this function from new drivers.
|
|
||||||
*/
|
|
||||||
struct phy_device *of_phy_connect_fixed_link(struct net_device *dev,
|
|
||||||
void (*hndlr)(struct net_device *),
|
|
||||||
phy_interface_t iface)
|
|
||||||
{
|
|
||||||
struct device_node *net_np;
|
|
||||||
char bus_id[MII_BUS_ID_SIZE + 3];
|
|
||||||
struct phy_device *phy;
|
|
||||||
const __be32 *phy_id;
|
|
||||||
int sz;
|
|
||||||
|
|
||||||
if (!dev->dev.parent)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
net_np = dev->dev.parent->of_node;
|
|
||||||
if (!net_np)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
phy_id = of_get_property(net_np, "fixed-link", &sz);
|
|
||||||
if (!phy_id || sz < sizeof(*phy_id))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
sprintf(bus_id, PHY_ID_FMT, "fixed-0", be32_to_cpu(phy_id[0]));
|
|
||||||
|
|
||||||
phy = phy_connect(dev, bus_id, hndlr, iface);
|
|
||||||
return IS_ERR(phy) ? NULL : phy;
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(of_phy_connect_fixed_link);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* of_phy_attach - Attach to a PHY without starting the state machine
|
* of_phy_attach - Attach to a PHY without starting the state machine
|
||||||
* @dev: pointer to net_device claiming the phy
|
* @dev: pointer to net_device claiming the phy
|
||||||
|
@ -22,9 +22,6 @@ extern struct phy_device *of_phy_connect(struct net_device *dev,
|
|||||||
struct phy_device *of_phy_attach(struct net_device *dev,
|
struct phy_device *of_phy_attach(struct net_device *dev,
|
||||||
struct device_node *phy_np, u32 flags,
|
struct device_node *phy_np, u32 flags,
|
||||||
phy_interface_t iface);
|
phy_interface_t iface);
|
||||||
extern struct phy_device *of_phy_connect_fixed_link(struct net_device *dev,
|
|
||||||
void (*hndlr)(struct net_device *),
|
|
||||||
phy_interface_t iface);
|
|
||||||
|
|
||||||
extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np);
|
extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np);
|
||||||
|
|
||||||
@ -59,13 +56,6 @@ static inline struct phy_device *of_phy_attach(struct net_device *dev,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline struct phy_device *of_phy_connect_fixed_link(struct net_device *dev,
|
|
||||||
void (*hndlr)(struct net_device *),
|
|
||||||
phy_interface_t iface)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np)
|
static inline struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user