net: dwc: add a common empty ops eqos_null_ops

Add a common empty ops: eqos_null_ops() to remove the duplicated empty
functions and reduce the driver size for stm32 and imx config.

This patch also aligns the prototype of ops 'eqos_stop_clks' with other
eqos ops by adding return value.

Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
This commit is contained in:
Patrick Delaunay 2021-07-20 20:09:56 +02:00 committed by Ramon Fried
parent 9dbdc234a7
commit c6a0df2d1d

View file

@ -281,7 +281,7 @@ struct eqos_ops {
int (*eqos_remove_resources)(struct udevice *dev); int (*eqos_remove_resources)(struct udevice *dev);
int (*eqos_stop_resets)(struct udevice *dev); int (*eqos_stop_resets)(struct udevice *dev);
int (*eqos_start_resets)(struct udevice *dev); int (*eqos_start_resets)(struct udevice *dev);
void (*eqos_stop_clks)(struct udevice *dev); int (*eqos_stop_clks)(struct udevice *dev);
int (*eqos_start_clks)(struct udevice *dev); int (*eqos_start_clks)(struct udevice *dev);
int (*eqos_calibrate_pads)(struct udevice *dev); int (*eqos_calibrate_pads)(struct udevice *dev);
int (*eqos_disable_calibration)(struct udevice *dev); int (*eqos_disable_calibration)(struct udevice *dev);
@ -613,12 +613,7 @@ err:
#endif #endif
} }
static int eqos_start_clks_imx(struct udevice *dev) static int eqos_stop_clks_tegra186(struct udevice *dev)
{
return 0;
}
static void eqos_stop_clks_tegra186(struct udevice *dev)
{ {
#ifdef CONFIG_CLK #ifdef CONFIG_CLK
struct eqos_priv *eqos = dev_get_priv(dev); struct eqos_priv *eqos = dev_get_priv(dev);
@ -633,9 +628,10 @@ static void eqos_stop_clks_tegra186(struct udevice *dev)
#endif #endif
debug("%s: OK\n", __func__); debug("%s: OK\n", __func__);
return 0;
} }
static void eqos_stop_clks_stm32(struct udevice *dev) static int eqos_stop_clks_stm32(struct udevice *dev)
{ {
#ifdef CONFIG_CLK #ifdef CONFIG_CLK
struct eqos_priv *eqos = dev_get_priv(dev); struct eqos_priv *eqos = dev_get_priv(dev);
@ -648,11 +644,7 @@ static void eqos_stop_clks_stm32(struct udevice *dev)
#endif #endif
debug("%s: OK\n", __func__); debug("%s: OK\n", __func__);
} return 0;
static void eqos_stop_clks_imx(struct udevice *dev)
{
/* empty */
} }
static int eqos_start_resets_tegra186(struct udevice *dev) static int eqos_start_resets_tegra186(struct udevice *dev)
@ -694,16 +686,6 @@ static int eqos_start_resets_tegra186(struct udevice *dev)
return 0; return 0;
} }
static int eqos_start_resets_stm32(struct udevice *dev)
{
return 0;
}
static int eqos_start_resets_imx(struct udevice *dev)
{
return 0;
}
static int eqos_stop_resets_tegra186(struct udevice *dev) static int eqos_stop_resets_tegra186(struct udevice *dev)
{ {
struct eqos_priv *eqos = dev_get_priv(dev); struct eqos_priv *eqos = dev_get_priv(dev);
@ -714,16 +696,6 @@ static int eqos_stop_resets_tegra186(struct udevice *dev)
return 0; return 0;
} }
static int eqos_stop_resets_stm32(struct udevice *dev)
{
return 0;
}
static int eqos_stop_resets_imx(struct udevice *dev)
{
return 0;
}
static int eqos_calibrate_pads_tegra186(struct udevice *dev) static int eqos_calibrate_pads_tegra186(struct udevice *dev)
{ {
struct eqos_priv *eqos = dev_get_priv(dev); struct eqos_priv *eqos = dev_get_priv(dev);
@ -812,26 +784,6 @@ static ulong eqos_get_tick_clk_rate_imx(struct udevice *dev)
return imx_get_eqos_csr_clk(); return imx_get_eqos_csr_clk();
} }
static int eqos_calibrate_pads_stm32(struct udevice *dev)
{
return 0;
}
static int eqos_calibrate_pads_imx(struct udevice *dev)
{
return 0;
}
static int eqos_disable_calibration_stm32(struct udevice *dev)
{
return 0;
}
static int eqos_disable_calibration_imx(struct udevice *dev)
{
return 0;
}
static int eqos_set_full_duplex(struct udevice *dev) static int eqos_set_full_duplex(struct udevice *dev)
{ {
struct eqos_priv *eqos = dev_get_priv(dev); struct eqos_priv *eqos = dev_get_priv(dev);
@ -928,11 +880,6 @@ static int eqos_set_tx_clk_speed_tegra186(struct udevice *dev)
return 0; return 0;
} }
static int eqos_set_tx_clk_speed_stm32(struct udevice *dev)
{
return 0;
}
static int eqos_set_tx_clk_speed_imx(struct udevice *dev) static int eqos_set_tx_clk_speed_imx(struct udevice *dev)
{ {
struct eqos_priv *eqos = dev_get_priv(dev); struct eqos_priv *eqos = dev_get_priv(dev);
@ -1881,11 +1828,6 @@ static int eqos_remove_resources_stm32(struct udevice *dev)
return 0; return 0;
} }
static int eqos_remove_resources_imx(struct udevice *dev)
{
return 0;
}
static int eqos_probe(struct udevice *dev) static int eqos_probe(struct udevice *dev)
{ {
struct eqos_priv *eqos = dev_get_priv(dev); struct eqos_priv *eqos = dev_get_priv(dev);
@ -1974,6 +1916,11 @@ static int eqos_remove(struct udevice *dev)
return 0; return 0;
} }
static int eqos_null_ops(struct udevice *dev)
{
return 0;
}
static const struct eth_ops eqos_ops = { static const struct eth_ops eqos_ops = {
.start = eqos_start, .start = eqos_start,
.stop = eqos_stop, .stop = eqos_stop,
@ -2019,13 +1966,13 @@ static struct eqos_ops eqos_stm32_ops = {
.eqos_flush_buffer = eqos_flush_buffer_generic, .eqos_flush_buffer = eqos_flush_buffer_generic,
.eqos_probe_resources = eqos_probe_resources_stm32, .eqos_probe_resources = eqos_probe_resources_stm32,
.eqos_remove_resources = eqos_remove_resources_stm32, .eqos_remove_resources = eqos_remove_resources_stm32,
.eqos_stop_resets = eqos_stop_resets_stm32, .eqos_stop_resets = eqos_null_ops,
.eqos_start_resets = eqos_start_resets_stm32, .eqos_start_resets = eqos_null_ops,
.eqos_stop_clks = eqos_stop_clks_stm32, .eqos_stop_clks = eqos_stop_clks_stm32,
.eqos_start_clks = eqos_start_clks_stm32, .eqos_start_clks = eqos_start_clks_stm32,
.eqos_calibrate_pads = eqos_calibrate_pads_stm32, .eqos_calibrate_pads = eqos_null_ops,
.eqos_disable_calibration = eqos_disable_calibration_stm32, .eqos_disable_calibration = eqos_null_ops,
.eqos_set_tx_clk_speed = eqos_set_tx_clk_speed_stm32, .eqos_set_tx_clk_speed = eqos_null_ops,
.eqos_get_tick_clk_rate = eqos_get_tick_clk_rate_stm32 .eqos_get_tick_clk_rate = eqos_get_tick_clk_rate_stm32
}; };
@ -2046,13 +1993,13 @@ static struct eqos_ops eqos_imx_ops = {
.eqos_inval_buffer = eqos_inval_buffer_generic, .eqos_inval_buffer = eqos_inval_buffer_generic,
.eqos_flush_buffer = eqos_flush_buffer_generic, .eqos_flush_buffer = eqos_flush_buffer_generic,
.eqos_probe_resources = eqos_probe_resources_imx, .eqos_probe_resources = eqos_probe_resources_imx,
.eqos_remove_resources = eqos_remove_resources_imx, .eqos_remove_resources = eqos_null_ops,
.eqos_stop_resets = eqos_stop_resets_imx, .eqos_stop_resets = eqos_null_ops,
.eqos_start_resets = eqos_start_resets_imx, .eqos_start_resets = eqos_null_ops,
.eqos_stop_clks = eqos_stop_clks_imx, .eqos_stop_clks = eqos_null_ops,
.eqos_start_clks = eqos_start_clks_imx, .eqos_start_clks = eqos_null_ops,
.eqos_calibrate_pads = eqos_calibrate_pads_imx, .eqos_calibrate_pads = eqos_null_ops,
.eqos_disable_calibration = eqos_disable_calibration_imx, .eqos_disable_calibration = eqos_null_ops,
.eqos_set_tx_clk_speed = eqos_set_tx_clk_speed_imx, .eqos_set_tx_clk_speed = eqos_set_tx_clk_speed_imx,
.eqos_get_tick_clk_rate = eqos_get_tick_clk_rate_imx .eqos_get_tick_clk_rate = eqos_get_tick_clk_rate_imx
}; };