Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Srinivas Kandagatla <srinivas.kandagatla@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Srinivas Kandagatla and committed by
David S. Miller
64882709 229a66e3

+14
+9
drivers/net/phy/mdio-bitbang.c
··· 202 202 return 0; 203 203 } 204 204 205 + static int mdiobb_reset(struct mii_bus *bus) 206 + { 207 + struct mdiobb_ctrl *ctrl = bus->priv; 208 + if (ctrl->reset) 209 + ctrl->reset(bus); 210 + return 0; 211 + } 212 + 205 213 struct mii_bus *alloc_mdio_bitbang(struct mdiobb_ctrl *ctrl) 206 214 { 207 215 struct mii_bus *bus; ··· 222 214 223 215 bus->read = mdiobb_read; 224 216 bus->write = mdiobb_write; 217 + bus->reset = mdiobb_reset; 225 218 bus->priv = ctrl; 226 219 227 220 return bus;
+1
drivers/net/phy/mdio-gpio.c
··· 95 95 goto out; 96 96 97 97 bitbang->ctrl.ops = &mdio_gpio_ops; 98 + bitbang->ctrl.reset = pdata->reset; 98 99 bitbang->mdc = pdata->mdc; 99 100 bitbang->mdio = pdata->mdio; 100 101
+2
include/linux/mdio-bitbang.h
··· 32 32 33 33 struct mdiobb_ctrl { 34 34 const struct mdiobb_ops *ops; 35 + /* reset callback */ 36 + int (*reset)(struct mii_bus *bus); 35 37 }; 36 38 37 39 /* The returned bus is not yet registered with the phy layer. */
+2
include/linux/mdio-gpio.h
··· 20 20 21 21 unsigned int phy_mask; 22 22 int irqs[PHY_MAX_ADDR]; 23 + /* reset callback */ 24 + int (*reset)(struct mii_bus *bus); 23 25 }; 24 26 25 27 #endif /* __LINUX_MDIO_GPIO_H */