generic: ar8216: use phydev instead of pdev everywhere
Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 35555
This commit is contained in:
parent
0b1fe07e8e
commit
1afb759b35
1 changed files with 33 additions and 33 deletions
|
@ -1841,15 +1841,15 @@ ar8xxx_probe_switch(struct ar8216_priv *priv)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ar8216_config_init(struct phy_device *pdev)
|
ar8216_config_init(struct phy_device *phydev)
|
||||||
{
|
{
|
||||||
struct ar8216_priv *priv = pdev->priv;
|
struct ar8216_priv *priv = phydev->priv;
|
||||||
struct net_device *dev = pdev->attached_dev;
|
struct net_device *dev = phydev->attached_dev;
|
||||||
struct switch_dev *swdev;
|
struct switch_dev *swdev;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!priv) {
|
if (!priv) {
|
||||||
priv = ar8xxx_create_mii(pdev->bus);
|
priv = ar8xxx_create_mii(phydev->bus);
|
||||||
if (priv == NULL)
|
if (priv == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
@ -1858,29 +1858,29 @@ ar8216_config_init(struct phy_device *pdev)
|
||||||
goto err_free_priv;
|
goto err_free_priv;
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->phy = pdev;
|
priv->phy = phydev;
|
||||||
|
|
||||||
if (pdev->addr != 0) {
|
if (phydev->addr != 0) {
|
||||||
if (chip_is_ar8316(priv)) {
|
if (chip_is_ar8316(priv)) {
|
||||||
/* check if we're attaching to the switch twice */
|
/* check if we're attaching to the switch twice */
|
||||||
pdev = pdev->bus->phy_map[0];
|
phydev = phydev->bus->phy_map[0];
|
||||||
if (!pdev) {
|
if (!phydev) {
|
||||||
ar8xxx_free(priv);
|
ar8xxx_free(priv);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* switch device has not been initialized, reuse priv */
|
/* switch device has not been initialized, reuse priv */
|
||||||
if (!pdev->priv) {
|
if (!phydev->priv) {
|
||||||
priv->port4_phy = true;
|
priv->port4_phy = true;
|
||||||
priv->dev.ports = (AR8216_NUM_PORTS - 1);
|
priv->dev.ports = (AR8216_NUM_PORTS - 1);
|
||||||
pdev->priv = priv;
|
phydev->priv = priv;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ar8xxx_free(priv);
|
ar8xxx_free(priv);
|
||||||
|
|
||||||
/* switch device has been initialized, reinit */
|
/* switch device has been initialized, reinit */
|
||||||
priv = pdev->priv;
|
priv = phydev->priv;
|
||||||
priv->dev.ports = (AR8216_NUM_PORTS - 1);
|
priv->dev.ports = (AR8216_NUM_PORTS - 1);
|
||||||
priv->initialized = false;
|
priv->initialized = false;
|
||||||
priv->port4_phy = true;
|
priv->port4_phy = true;
|
||||||
|
@ -1892,15 +1892,15 @@ ar8216_config_init(struct phy_device *pdev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
pdev->priv = priv;
|
phydev->priv = priv;
|
||||||
|
|
||||||
swdev = &priv->dev;
|
swdev = &priv->dev;
|
||||||
ret = register_switch(swdev, pdev->attached_dev);
|
ret = register_switch(swdev, phydev->attached_dev);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err_free_priv;
|
goto err_free_priv;
|
||||||
|
|
||||||
pr_info("%s: %s switch driver attached.\n",
|
pr_info("%s: %s switch driver attached.\n",
|
||||||
pdev->attached_dev->name, swdev->name);
|
phydev->attached_dev->name, swdev->name);
|
||||||
|
|
||||||
priv->init = true;
|
priv->init = true;
|
||||||
|
|
||||||
|
@ -1930,7 +1930,7 @@ err_unregister_switch:
|
||||||
unregister_switch(&priv->dev);
|
unregister_switch(&priv->dev);
|
||||||
err_free_priv:
|
err_free_priv:
|
||||||
ar8xxx_free(priv);
|
ar8xxx_free(priv);
|
||||||
pdev->priv = NULL;
|
phydev->priv = NULL;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2024,40 +2024,40 @@ ar8xxx_is_possible(struct mii_bus *bus)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ar8216_probe(struct phy_device *pdev)
|
ar8216_probe(struct phy_device *phydev)
|
||||||
{
|
{
|
||||||
struct ar8216_priv *priv;
|
struct ar8216_priv *priv;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* skip PHYs at unused adresses */
|
/* skip PHYs at unused adresses */
|
||||||
if (pdev->addr != 0 && pdev->addr != 4)
|
if (phydev->addr != 0 && phydev->addr != 4)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
if (!ar8xxx_is_possible(pdev->bus))
|
if (!ar8xxx_is_possible(phydev->bus))
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
priv = ar8xxx_create_mii(pdev->bus);
|
priv = ar8xxx_create_mii(phydev->bus);
|
||||||
if (priv == NULL)
|
if (priv == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
priv->phy = pdev;
|
priv->phy = phydev;
|
||||||
|
|
||||||
ret = ar8xxx_probe_switch(priv);
|
ret = ar8xxx_probe_switch(priv);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (pdev->addr == 0) {
|
if (phydev->addr == 0) {
|
||||||
if (ar8xxx_has_gige(priv)) {
|
if (ar8xxx_has_gige(priv)) {
|
||||||
pdev->supported = SUPPORTED_1000baseT_Full;
|
phydev->supported = SUPPORTED_1000baseT_Full;
|
||||||
pdev->advertising = ADVERTISED_1000baseT_Full;
|
phydev->advertising = ADVERTISED_1000baseT_Full;
|
||||||
} else {
|
} else {
|
||||||
pdev->supported = SUPPORTED_100baseT_Full;
|
phydev->supported = SUPPORTED_100baseT_Full;
|
||||||
pdev->advertising = ADVERTISED_100baseT_Full;
|
phydev->advertising = ADVERTISED_100baseT_Full;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (ar8xxx_has_gige(priv)) {
|
if (ar8xxx_has_gige(priv)) {
|
||||||
pdev->supported |= SUPPORTED_1000baseT_Full;
|
phydev->supported |= SUPPORTED_1000baseT_Full;
|
||||||
pdev->advertising |= ADVERTISED_1000baseT_Full;
|
phydev->advertising |= ADVERTISED_1000baseT_Full;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2069,9 +2069,9 @@ out:
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ar8216_detach(struct phy_device *pdev)
|
ar8216_detach(struct phy_device *phydev)
|
||||||
{
|
{
|
||||||
struct net_device *dev = pdev->attached_dev;
|
struct net_device *dev = phydev->attached_dev;
|
||||||
|
|
||||||
if (!dev)
|
if (!dev)
|
||||||
return;
|
return;
|
||||||
|
@ -2083,16 +2083,16 @@ ar8216_detach(struct phy_device *pdev)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ar8216_remove(struct phy_device *pdev)
|
ar8216_remove(struct phy_device *phydev)
|
||||||
{
|
{
|
||||||
struct ar8216_priv *priv = pdev->priv;
|
struct ar8216_priv *priv = phydev->priv;
|
||||||
|
|
||||||
if (!priv)
|
if (!priv)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pdev->priv = NULL;
|
phydev->priv = NULL;
|
||||||
|
|
||||||
if (pdev->addr == 0)
|
if (phydev->addr == 0)
|
||||||
unregister_switch(&priv->dev);
|
unregister_switch(&priv->dev);
|
||||||
|
|
||||||
ar8xxx_mib_stop(priv);
|
ar8xxx_mib_stop(priv);
|
||||||
|
|
Loading…
Reference in a new issue