mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-01-21 01:50:05 +07:00
gianfar: use DT more consistently when selecting PHY connection type
Historically, gianfar only used phy-connection-type DT property when connected to PHY in the rgmii-id mode. It ignored the property otherwise, relying on the connection type auto-detection carried out by MAC and providing that reconstructed mode to of_phy_connect(). It also did not consider alternative phy-mode property at all. Make the driver properly query DT node for PHY connection type first and use an obtained value if it was specified there. Otherwise, if a particular DT relies on connection type auto-detection, fall back to reconstructing the value from MAC registers, as before. Signed-off-by: Arseny Solokha <asolokha@kb.kras.ru> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
887b8194fb
commit
8e578e73ef
@ -639,7 +639,6 @@ static phy_interface_t gfar_get_interface(struct net_device *dev)
|
||||
static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev)
|
||||
{
|
||||
const char *model;
|
||||
const char *ctype;
|
||||
const void *mac_addr;
|
||||
int err = 0, i;
|
||||
struct net_device *dev = NULL;
|
||||
@ -802,13 +801,15 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev)
|
||||
FSL_GIANFAR_DEV_HAS_TIMER |
|
||||
FSL_GIANFAR_DEV_HAS_RX_FILER;
|
||||
|
||||
err = of_property_read_string(np, "phy-connection-type", &ctype);
|
||||
|
||||
/* We only care about rgmii-id. The rest are autodetected */
|
||||
if (err == 0 && !strcmp(ctype, "rgmii-id"))
|
||||
priv->interface = PHY_INTERFACE_MODE_RGMII_ID;
|
||||
/* Use PHY connection type from the DT node if one is specified there.
|
||||
* rgmii-id really needs to be specified. Other types can be
|
||||
* detected by hardware
|
||||
*/
|
||||
err = of_get_phy_mode(np);
|
||||
if (err >= 0)
|
||||
priv->interface = err;
|
||||
else
|
||||
priv->interface = PHY_INTERFACE_MODE_MII;
|
||||
priv->interface = gfar_get_interface(dev);
|
||||
|
||||
if (of_find_property(np, "fsl,magic-packet", NULL))
|
||||
priv->device_flags |= FSL_GIANFAR_DEV_HAS_MAGIC_PACKET;
|
||||
@ -1670,7 +1671,7 @@ static int init_phy(struct net_device *dev)
|
||||
{
|
||||
__ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
|
||||
struct gfar_private *priv = netdev_priv(dev);
|
||||
phy_interface_t interface;
|
||||
phy_interface_t interface = priv->interface;
|
||||
struct phy_device *phydev;
|
||||
struct ethtool_eee edata;
|
||||
|
||||
@ -1686,8 +1687,6 @@ static int init_phy(struct net_device *dev)
|
||||
priv->oldspeed = 0;
|
||||
priv->oldduplex = -1;
|
||||
|
||||
interface = gfar_get_interface(dev);
|
||||
|
||||
phydev = of_phy_connect(dev, priv->phy_node, &adjust_link, 0,
|
||||
interface);
|
||||
if (!phydev) {
|
||||
|
Loading…
Reference in New Issue
Block a user