Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a01d7baa authored by Grygorii Strashko's avatar Grygorii Strashko Committed by David S. Miller
Browse files

drivers: net: davinci_mdio: drop suspended and lock fields from mdio_data



It's not expected Davinci MDIO to be accessible after its suspend
callbacks have been called:
 - all consumers of Davinci MDIO will stop/disconnect phys at Device
suspend stage;
 - all phys are expected to be suspned already by PHY/MDIO core;
 - MDIO locking is done by MDIO Bus code.

Hence, it's safe to drop "suspended" and "lock" fields from mdio_data.

Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3f655909
Loading
Loading
Loading
Loading
+0 −30
Original line number Original line Diff line number Diff line
@@ -90,11 +90,9 @@ static const struct mdio_platform_data default_pdata = {
struct davinci_mdio_data {
struct davinci_mdio_data {
	struct mdio_platform_data pdata;
	struct mdio_platform_data pdata;
	struct davinci_mdio_regs __iomem *regs;
	struct davinci_mdio_regs __iomem *regs;
	spinlock_t	lock;
	struct clk	*clk;
	struct clk	*clk;
	struct device	*dev;
	struct device	*dev;
	struct mii_bus	*bus;
	struct mii_bus	*bus;
	bool		suspended;
	unsigned long	access_time; /* jiffies */
	unsigned long	access_time; /* jiffies */
	/* Indicates that driver shouldn't modify phy_mask in case
	/* Indicates that driver shouldn't modify phy_mask in case
	 * if MDIO bus is registered from DT.
	 * if MDIO bus is registered from DT.
@@ -225,13 +223,6 @@ static int davinci_mdio_read(struct mii_bus *bus, int phy_id, int phy_reg)
	if (phy_reg & ~PHY_REG_MASK || phy_id & ~PHY_ID_MASK)
	if (phy_reg & ~PHY_REG_MASK || phy_id & ~PHY_ID_MASK)
		return -EINVAL;
		return -EINVAL;


	spin_lock(&data->lock);

	if (data->suspended) {
		spin_unlock(&data->lock);
		return -ENODEV;
	}

	reg = (USERACCESS_GO | USERACCESS_READ | (phy_reg << 21) |
	reg = (USERACCESS_GO | USERACCESS_READ | (phy_reg << 21) |
	       (phy_id << 16));
	       (phy_id << 16));


@@ -255,8 +246,6 @@ static int davinci_mdio_read(struct mii_bus *bus, int phy_id, int phy_reg)
		break;
		break;
	}
	}


	spin_unlock(&data->lock);

	return ret;
	return ret;
}
}


@@ -270,13 +259,6 @@ static int davinci_mdio_write(struct mii_bus *bus, int phy_id,
	if (phy_reg & ~PHY_REG_MASK || phy_id & ~PHY_ID_MASK)
	if (phy_reg & ~PHY_REG_MASK || phy_id & ~PHY_ID_MASK)
		return -EINVAL;
		return -EINVAL;


	spin_lock(&data->lock);

	if (data->suspended) {
		spin_unlock(&data->lock);
		return -ENODEV;
	}

	reg = (USERACCESS_GO | USERACCESS_WRITE | (phy_reg << 21) |
	reg = (USERACCESS_GO | USERACCESS_WRITE | (phy_reg << 21) |
		   (phy_id << 16) | (phy_data & USERACCESS_DATA));
		   (phy_id << 16) | (phy_data & USERACCESS_DATA));


@@ -295,8 +277,6 @@ static int davinci_mdio_write(struct mii_bus *bus, int phy_id,
		break;
		break;
	}
	}


	spin_unlock(&data->lock);

	return 0;
	return 0;
}
}


@@ -364,7 +344,6 @@ static int davinci_mdio_probe(struct platform_device *pdev)


	dev_set_drvdata(dev, data);
	dev_set_drvdata(dev, data);
	data->dev = dev;
	data->dev = dev;
	spin_lock_init(&data->lock);


	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	data->regs = devm_ioremap_resource(dev, res);
	data->regs = devm_ioremap_resource(dev, res);
@@ -426,17 +405,12 @@ static int davinci_mdio_suspend(struct device *dev)
	struct davinci_mdio_data *data = dev_get_drvdata(dev);
	struct davinci_mdio_data *data = dev_get_drvdata(dev);
	u32 ctrl;
	u32 ctrl;


	spin_lock(&data->lock);

	/* shutdown the scan state machine */
	/* shutdown the scan state machine */
	ctrl = __raw_readl(&data->regs->control);
	ctrl = __raw_readl(&data->regs->control);
	ctrl &= ~CONTROL_ENABLE;
	ctrl &= ~CONTROL_ENABLE;
	__raw_writel(ctrl, &data->regs->control);
	__raw_writel(ctrl, &data->regs->control);
	wait_for_idle(data);
	wait_for_idle(data);


	data->suspended = true;
	spin_unlock(&data->lock);

	/* Select sleep pin state */
	/* Select sleep pin state */
	pinctrl_pm_select_sleep_state(dev);
	pinctrl_pm_select_sleep_state(dev);


@@ -450,13 +424,9 @@ static int davinci_mdio_resume(struct device *dev)
	/* Select default pin state */
	/* Select default pin state */
	pinctrl_pm_select_default_state(dev);
	pinctrl_pm_select_default_state(dev);


	spin_lock(&data->lock);
	/* restart the scan state machine */
	/* restart the scan state machine */
	__davinci_mdio_reset(data);
	__davinci_mdio_reset(data);


	data->suspended = false;
	spin_unlock(&data->lock);

	return 0;
	return 0;
}
}
#endif
#endif