Message ID | 20200512095736.29275-1-david.wu@rock-chips.com |
---|---|
State | New |
Headers | show |
Series | Add dwc_eth_qos support for rockchip | expand |
Hi David On 5/12/20 11:57 AM, David Wu wrote: > If there are definitions for eqos_start_clks and eqos_stop_clks, > then call these callback function. > > Signed-off-by: David Wu <david.wu at rock-chips.com> > --- > > Changes in v2: > - None > > drivers/net/dwc_eth_qos.c | 16 ++++++++++------ > 1 file changed, 10 insertions(+), 6 deletions(-) > > diff --git a/drivers/net/dwc_eth_qos.c b/drivers/net/dwc_eth_qos.c > index e503be5b4b..295707cbb0 100644 > --- a/drivers/net/dwc_eth_qos.c > +++ b/drivers/net/dwc_eth_qos.c > @@ -1184,10 +1184,12 @@ static int eqos_init(struct udevice *dev) > > debug("%s(dev=%p):\n", __func__, dev); > > - ret = eqos->config->ops->eqos_start_clks(dev); > - if (ret < 0) { > - pr_err("eqos_start_clks() failed: %d", ret); > - goto err; > + if (eqos->config->ops->eqos_start_clks) { > + ret = eqos->config->ops->eqos_start_clks(dev); > + if (ret < 0) { > + pr_err("eqos_start_clks() failed: %d", ret); > + goto err; > + } > } > > ret = eqos->config->ops->eqos_start_resets(dev); > @@ -1277,7 +1279,8 @@ err_shutdown_phy: > err_stop_resets: > eqos->config->ops->eqos_stop_resets(dev); > err_stop_clks: > - eqos->config->ops->eqos_stop_clks(dev); > + if (eqos->config->ops->eqos_stop_clks) > + eqos->config->ops->eqos_stop_clks(dev); > err: > pr_err("FAILED: %d", ret); > return ret; > @@ -1576,7 +1579,8 @@ static void eqos_stop(struct udevice *dev) > phy_shutdown(eqos->phy); > } > eqos->config->ops->eqos_stop_resets(dev); > - eqos->config->ops->eqos_stop_clks(dev); > + if (eqos->config->ops->eqos_stop_clks) > + eqos->config->ops->eqos_stop_clks(dev); > > debug("%s: OK\n", __func__); > } Reviewed-by: Patrice Chotard <patrice.chotard at st.com> Thanks
diff --git a/drivers/net/dwc_eth_qos.c b/drivers/net/dwc_eth_qos.c index e503be5b4b..295707cbb0 100644 --- a/drivers/net/dwc_eth_qos.c +++ b/drivers/net/dwc_eth_qos.c @@ -1184,10 +1184,12 @@ static int eqos_init(struct udevice *dev) debug("%s(dev=%p):\n", __func__, dev); - ret = eqos->config->ops->eqos_start_clks(dev); - if (ret < 0) { - pr_err("eqos_start_clks() failed: %d", ret); - goto err; + if (eqos->config->ops->eqos_start_clks) { + ret = eqos->config->ops->eqos_start_clks(dev); + if (ret < 0) { + pr_err("eqos_start_clks() failed: %d", ret); + goto err; + } } ret = eqos->config->ops->eqos_start_resets(dev); @@ -1277,7 +1279,8 @@ err_shutdown_phy: err_stop_resets: eqos->config->ops->eqos_stop_resets(dev); err_stop_clks: - eqos->config->ops->eqos_stop_clks(dev); + if (eqos->config->ops->eqos_stop_clks) + eqos->config->ops->eqos_stop_clks(dev); err: pr_err("FAILED: %d", ret); return ret; @@ -1576,7 +1579,8 @@ static void eqos_stop(struct udevice *dev) phy_shutdown(eqos->phy); } eqos->config->ops->eqos_stop_resets(dev); - eqos->config->ops->eqos_stop_clks(dev); + if (eqos->config->ops->eqos_stop_clks) + eqos->config->ops->eqos_stop_clks(dev); debug("%s: OK\n", __func__); }
If there are definitions for eqos_start_clks and eqos_stop_clks, then call these callback function. Signed-off-by: David Wu <david.wu at rock-chips.com> --- Changes in v2: - None drivers/net/dwc_eth_qos.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)