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

Commit 22f6bba7 authored by Shaohui Xie's avatar Shaohui Xie Committed by David S. Miller
Browse files

net/fsl: Replace spin_event_timeout() with arch independent in xgmac_mdio



spin_event_timeout() is PPC dependent, use an arch independent
equivalent instead.

Signed-off-by: default avatarShaohui Xie <Shaohui.Xie@freescale.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ca43e58c
Loading
Loading
Loading
Loading
+16 −8
Original line number Diff line number Diff line
@@ -52,12 +52,16 @@ struct tgec_mdio_controller {
static int xgmac_wait_until_free(struct device *dev,
				 struct tgec_mdio_controller __iomem *regs)
{
	uint32_t status;
	unsigned int timeout;

	/* Wait till the bus is free */
	status = spin_event_timeout(
		!((ioread32be(&regs->mdio_stat)) & MDIO_STAT_BSY), TIMEOUT, 0);
	if (!status) {
	timeout = TIMEOUT;
	while ((ioread32be(&regs->mdio_stat) & MDIO_STAT_BSY) && timeout) {
		cpu_relax();
		timeout--;
	}

	if (!timeout) {
		dev_err(dev, "timeout waiting for bus to be free\n");
		return -ETIMEDOUT;
	}
@@ -71,12 +75,16 @@ static int xgmac_wait_until_free(struct device *dev,
static int xgmac_wait_until_done(struct device *dev,
				 struct tgec_mdio_controller __iomem *regs)
{
	uint32_t status;
	unsigned int timeout;

	/* Wait till the MDIO write is complete */
	status = spin_event_timeout(
		!((ioread32be(&regs->mdio_data)) & MDIO_DATA_BSY), TIMEOUT, 0);
	if (!status) {
	timeout = TIMEOUT;
	while ((ioread32be(&regs->mdio_data) & MDIO_DATA_BSY) && timeout) {
		cpu_relax();
		timeout--;
	}

	if (!timeout) {
		dev_err(dev, "timeout waiting for operation to complete\n");
		return -ETIMEDOUT;
	}