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

Commit 64882709 authored by Srinivas Kandagatla's avatar Srinivas Kandagatla Committed by David S. Miller
Browse files

mdio-gpio: Add reset functionality to mdio-gpio driver(v2).



This patch adds phy reset functionality to mdio-gpio driver. Now
mdio_gpio_platform_data has new member as function pointer which can be
filled at the bsp level for a callback from phy infrastructure. Also the
mdio-bitbang driver fills-in the reset function of mii_bus structure.

Without this patch the bsp level code has to takecare of the reseting
PHY's on the bus, which become bit hacky for every bsp and
phy-infrastructure is ignored aswell.

Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@st.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 229a66e3
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -202,6 +202,14 @@ static int mdiobb_write(struct mii_bus *bus, int phy, int reg, u16 val)
	return 0;
}

static int mdiobb_reset(struct mii_bus *bus)
{
	struct mdiobb_ctrl *ctrl = bus->priv;
	if (ctrl->reset)
		ctrl->reset(bus);
	return 0;
}

struct mii_bus *alloc_mdio_bitbang(struct mdiobb_ctrl *ctrl)
{
	struct mii_bus *bus;
@@ -214,6 +222,7 @@ struct mii_bus *alloc_mdio_bitbang(struct mdiobb_ctrl *ctrl)

	bus->read = mdiobb_read;
	bus->write = mdiobb_write;
	bus->reset = mdiobb_reset;
	bus->priv = ctrl;

	return bus;
+1 −0
Original line number Diff line number Diff line
@@ -95,6 +95,7 @@ static struct mii_bus * __devinit mdio_gpio_bus_init(struct device *dev,
		goto out;

	bitbang->ctrl.ops = &mdio_gpio_ops;
	bitbang->ctrl.reset = pdata->reset;
	bitbang->mdc = pdata->mdc;
	bitbang->mdio = pdata->mdio;

+2 −0
Original line number Diff line number Diff line
@@ -32,6 +32,8 @@ struct mdiobb_ops {

struct mdiobb_ctrl {
	const struct mdiobb_ops *ops;
	/* reset callback */
	int (*reset)(struct mii_bus *bus);
};

/* The returned bus is not yet registered with the phy layer. */
+2 −0
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@ struct mdio_gpio_platform_data {

	unsigned int phy_mask;
	int irqs[PHY_MAX_ADDR];
	/* reset callback */
	int (*reset)(struct mii_bus *bus);
};

#endif /* __LINUX_MDIO_GPIO_H */