From: Patrick Delaunay Date: Tue, 20 Jul 2021 18:09:56 +0000 (+0200) Subject: net: dwc: add a common empty ops eqos_null_ops X-Git-Url: http://git.dujemihanovic.xyz/html/static/git-logo.png?a=commitdiff_plain;h=c6a0df2d1dee30d241ce9831178f5de17dd4a61e;p=u-boot.git 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 Signed-off-by: Patrick Delaunay --- diff --git a/drivers/net/dwc_eth_qos.c b/drivers/net/dwc_eth_qos.c index 9b1746b78b..79eb6cc926 100644 --- a/drivers/net/dwc_eth_qos.c +++ b/drivers/net/dwc_eth_qos.c @@ -281,7 +281,7 @@ struct eqos_ops { int (*eqos_remove_resources)(struct udevice *dev); int (*eqos_stop_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_calibrate_pads)(struct udevice *dev); int (*eqos_disable_calibration)(struct udevice *dev); @@ -613,12 +613,7 @@ err: #endif } -static int eqos_start_clks_imx(struct udevice *dev) -{ - return 0; -} - -static void eqos_stop_clks_tegra186(struct udevice *dev) +static int eqos_stop_clks_tegra186(struct udevice *dev) { #ifdef CONFIG_CLK struct eqos_priv *eqos = dev_get_priv(dev); @@ -633,9 +628,10 @@ static void eqos_stop_clks_tegra186(struct udevice *dev) #endif 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 struct eqos_priv *eqos = dev_get_priv(dev); @@ -648,11 +644,7 @@ static void eqos_stop_clks_stm32(struct udevice *dev) #endif debug("%s: OK\n", __func__); -} - -static void eqos_stop_clks_imx(struct udevice *dev) -{ - /* empty */ + return 0; } static int eqos_start_resets_tegra186(struct udevice *dev) @@ -694,16 +686,6 @@ static int eqos_start_resets_tegra186(struct udevice *dev) 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) { struct eqos_priv *eqos = dev_get_priv(dev); @@ -714,16 +696,6 @@ static int eqos_stop_resets_tegra186(struct udevice *dev) 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) { 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(); } -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) { 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; } -static int eqos_set_tx_clk_speed_stm32(struct udevice *dev) -{ - return 0; -} - static int eqos_set_tx_clk_speed_imx(struct udevice *dev) { struct eqos_priv *eqos = dev_get_priv(dev); @@ -1881,11 +1828,6 @@ static int eqos_remove_resources_stm32(struct udevice *dev) return 0; } -static int eqos_remove_resources_imx(struct udevice *dev) -{ - return 0; -} - static int eqos_probe(struct udevice *dev) { struct eqos_priv *eqos = dev_get_priv(dev); @@ -1974,6 +1916,11 @@ static int eqos_remove(struct udevice *dev) return 0; } +static int eqos_null_ops(struct udevice *dev) +{ + return 0; +} + static const struct eth_ops eqos_ops = { .start = eqos_start, .stop = eqos_stop, @@ -2019,13 +1966,13 @@ static struct eqos_ops eqos_stm32_ops = { .eqos_flush_buffer = eqos_flush_buffer_generic, .eqos_probe_resources = eqos_probe_resources_stm32, .eqos_remove_resources = eqos_remove_resources_stm32, - .eqos_stop_resets = eqos_stop_resets_stm32, - .eqos_start_resets = eqos_start_resets_stm32, + .eqos_stop_resets = eqos_null_ops, + .eqos_start_resets = eqos_null_ops, .eqos_stop_clks = eqos_stop_clks_stm32, .eqos_start_clks = eqos_start_clks_stm32, - .eqos_calibrate_pads = eqos_calibrate_pads_stm32, - .eqos_disable_calibration = eqos_disable_calibration_stm32, - .eqos_set_tx_clk_speed = eqos_set_tx_clk_speed_stm32, + .eqos_calibrate_pads = eqos_null_ops, + .eqos_disable_calibration = eqos_null_ops, + .eqos_set_tx_clk_speed = eqos_null_ops, .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_flush_buffer = eqos_flush_buffer_generic, .eqos_probe_resources = eqos_probe_resources_imx, - .eqos_remove_resources = eqos_remove_resources_imx, - .eqos_stop_resets = eqos_stop_resets_imx, - .eqos_start_resets = eqos_start_resets_imx, - .eqos_stop_clks = eqos_stop_clks_imx, - .eqos_start_clks = eqos_start_clks_imx, - .eqos_calibrate_pads = eqos_calibrate_pads_imx, - .eqos_disable_calibration = eqos_disable_calibration_imx, + .eqos_remove_resources = eqos_null_ops, + .eqos_stop_resets = eqos_null_ops, + .eqos_start_resets = eqos_null_ops, + .eqos_stop_clks = eqos_null_ops, + .eqos_start_clks = eqos_null_ops, + .eqos_calibrate_pads = eqos_null_ops, + .eqos_disable_calibration = eqos_null_ops, .eqos_set_tx_clk_speed = eqos_set_tx_clk_speed_imx, .eqos_get_tick_clk_rate = eqos_get_tick_clk_rate_imx };