From defb18abcd5ea5246789ceeb4c70981bd6737611 Mon Sep 17 00:00:00 2001 From: David Wu Date: Fri, 17 Sep 2021 15:28:28 +0800 Subject: [PATCH] net: ethernet: stmmac: dwmac-rk: Add config option for dwmac-rk-tool Add this config option to reduce memory usage, if it was not necessary. ./ksize.sh drivers/net/ethernet/stmicro/ before size: 131758 Bytes after size: 121861 Bytes save size: 9897 Bytes Signed-off-by: David Wu Change-Id: I96c88d5eb5109fc956a85b8685e1746d76545a87 --- drivers/net/ethernet/stmicro/stmmac/Kconfig | 10 ++++++++++ drivers/net/ethernet/stmicro/stmmac/Makefile | 3 ++- drivers/net/ethernet/stmicro/stmmac/dwmac-rk-tool.h | 12 ++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig index 53f14c5a9e02..8c1ab22c61bc 100644 --- a/drivers/net/ethernet/stmicro/stmmac/Kconfig +++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig @@ -138,6 +138,16 @@ config DWMAC_ROCKCHIP This selects the Rockchip RK3288 SoC glue layer support for the stmmac device driver. +config DWMAC_ROCKCHIP_TOOL + bool "Rockchip dwmac tool support" + depends on DWMAC_ROCKCHIP + default DWMAC_ROCKCHIP + help + Support for Ethernet functions on Rockchip SoCs. + + This selects the features for Rockchip's Ethernet, include PHY loopback, + MAC loopback, and delayline scanning of RGMII mode. + config DWMAC_SOCFPGA tristate "SOCFPGA dwmac support" default (ARCH_SOCFPGA || ARCH_STRATIX10) diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile index be661832cef8..b4d6aac7cb84 100644 --- a/drivers/net/ethernet/stmicro/stmmac/Makefile +++ b/drivers/net/ethernet/stmicro/stmmac/Makefile @@ -20,7 +20,8 @@ obj-$(CONFIG_DWMAC_MESON) += dwmac-meson.o dwmac-meson8b.o obj-$(CONFIG_DWMAC_OXNAS) += dwmac-oxnas.o obj-$(CONFIG_DWMAC_QCOM_ETHQOS) += dwmac-qcom-ethqos.o obj-$(CONFIG_DWMAC_ROCKCHIP) += dwmac-rockchip.o -dwmac-rockchip-objs := dwmac-rk.o dwmac-rk-tool.o +dwmac-rockchip-objs := dwmac-rk.o +dwmac-rockchip-$(CONFIG_DWMAC_ROCKCHIP_TOOL) += dwmac-rk-tool.o obj-$(CONFIG_DWMAC_SOCFPGA) += dwmac-altr-socfpga.o obj-$(CONFIG_DWMAC_STI) += dwmac-sti.o obj-$(CONFIG_DWMAC_STM32) += dwmac-stm32.o diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk-tool.h b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk-tool.h index d71989b0fc74..5b87c27af62c 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk-tool.h +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk-tool.h @@ -13,8 +13,20 @@ void dwmac_rk_set_rgmii_delayline(struct stmmac_priv *priv, int tx_delay, int rx void dwmac_rk_get_rgmii_delayline(struct stmmac_priv *priv, int *tx_delay, int *rx_delay); int dwmac_rk_get_phy_interface(struct stmmac_priv *priv); +#ifdef CONFIG_DWMAC_ROCKCHIP_TOOL int dwmac_rk_create_loopback_sysfs(struct device *dev); int dwmac_rk_remove_loopback_sysfs(struct device *device); +#else +static inline int dwmac_rk_create_loopback_sysfs(struct device *dev) +{ + return 0; +} + +static inline int dwmac_rk_remove_loopback_sysfs(struct device *device) +{ + return 0; +} +#endif #ifdef CONFIG_DWMAC_RK_AUTO_DELAYLINE int dwmac_rk_get_rgmii_delayline_from_vendor(struct stmmac_priv *priv);