mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 03:40:35 +09:00
net: ethernet: stmmac: Add config option for full driver
Add this config option to reduce memory usage, if it was not necessary. ./ksize.sh drivers/net/ethernet/stmicro/ before size: 82879 Bytes after size: 59075 Bytes save size: 23804 Bytes Change-Id: I5f6b4573d7358c3b6f046e960c7ddf7d53541b14 Signed-off-by: David Wu <david.wu@rock-chips.com>
This commit is contained in:
@@ -18,6 +18,13 @@ config STMMAC_ETHTOOL
|
||||
help
|
||||
This selects the ethtool function, default is Y.
|
||||
|
||||
config STMMAC_FULL
|
||||
bool "Support full driver for STMMAC"
|
||||
default STMMAC_ETH
|
||||
help
|
||||
This selects the full function, default is Y, full-featured version
|
||||
includes 4.10 and other versions, if it is N, only 4.10 core working.
|
||||
|
||||
config STMMAC_PLATFORM
|
||||
tristate "STMMAC Platform bus support"
|
||||
depends on STMMAC_ETH
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
obj-$(CONFIG_STMMAC_ETH) += stmmac.o
|
||||
stmmac-objs:= stmmac_main.o stmmac_mdio.o ring_mode.o \
|
||||
chain_mode.o dwmac_lib.o dwmac1000_core.o dwmac1000_dma.o \
|
||||
dwmac100_core.o dwmac100_dma.o enh_desc.o norm_desc.o \
|
||||
mmc_core.o stmmac_hwtstamp.o stmmac_ptp.o dwmac4_descs.o \
|
||||
dwmac4_dma.o dwmac4_lib.o dwmac4_core.o dwmac5.o hwif.o \
|
||||
stmmac_tc.o dwxgmac2_core.o dwxgmac2_dma.o dwxgmac2_descs.o \
|
||||
|
||||
stmmac-objs:= stmmac_main.o stmmac_mdio.o dwmac_lib.o \
|
||||
mmc_core.o stmmac_hwtstamp.o stmmac_ptp.o \
|
||||
dwmac4_descs.o dwmac4_dma.o \
|
||||
dwmac4_lib.o dwmac4_core.o hwif.o \
|
||||
$(stmmac-y)
|
||||
|
||||
stmmac-$(CONFIG_STMMAC_FULL) += ring_mode.o chain_mode.o dwmac1000_core.o \
|
||||
dwmac1000_dma.o dwmac100_core.o dwmac100_dma.o \
|
||||
enh_desc.o norm_desc.o dwmac5.o stmmac_tc.o \
|
||||
dwxgmac2_core.o dwxgmac2_dma.o dwxgmac2_descs.o
|
||||
|
||||
stmmac-$(CONFIG_STMMAC_ETHTOOL) += stmmac_ethtool.o
|
||||
|
||||
# Ordering matters. Generic driver must be last.
|
||||
|
||||
@@ -715,6 +715,7 @@ static void dwmac4_debug(void __iomem *ioaddr, struct stmmac_extra_stats *x,
|
||||
x->mac_gmii_rx_proto_engine++;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_STMMAC_FULL
|
||||
const struct stmmac_ops dwmac4_ops = {
|
||||
.core_init = dwmac4_core_init,
|
||||
.set_mac = stmmac_set_mac,
|
||||
@@ -745,6 +746,7 @@ const struct stmmac_ops dwmac4_ops = {
|
||||
.debug = dwmac4_debug,
|
||||
.set_filter = dwmac4_set_filter,
|
||||
};
|
||||
#endif
|
||||
|
||||
const struct stmmac_ops dwmac410_ops = {
|
||||
.core_init = dwmac4_core_init,
|
||||
@@ -777,6 +779,7 @@ const struct stmmac_ops dwmac410_ops = {
|
||||
.set_filter = dwmac4_set_filter,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_STMMAC_FULL
|
||||
const struct stmmac_ops dwmac510_ops = {
|
||||
.core_init = dwmac4_core_init,
|
||||
.set_mac = stmmac_dwmac4_set_mac,
|
||||
@@ -812,6 +815,7 @@ const struct stmmac_ops dwmac510_ops = {
|
||||
.rxp_config = dwmac5_rxp_config,
|
||||
.flex_pps_config = dwmac5_flex_pps_config,
|
||||
};
|
||||
#endif
|
||||
|
||||
int dwmac4_setup(struct stmmac_priv *priv)
|
||||
{
|
||||
|
||||
@@ -23,6 +23,7 @@ static u32 stmmac_get_id(struct stmmac_priv *priv, u32 id_reg)
|
||||
return reg & GENMASK(7, 0);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_STMMAC_FULL
|
||||
static void stmmac_dwmac_mode_quirk(struct stmmac_priv *priv)
|
||||
{
|
||||
struct mac_device_info *mac = priv->hw;
|
||||
@@ -68,6 +69,7 @@ static int stmmac_dwmac4_quirks(struct stmmac_priv *priv)
|
||||
stmmac_dwmac_mode_quirk(priv);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static const struct stmmac_hwif_entry {
|
||||
bool gmac;
|
||||
@@ -85,6 +87,7 @@ static const struct stmmac_hwif_entry {
|
||||
int (*quirks)(struct stmmac_priv *priv);
|
||||
} stmmac_hw[] = {
|
||||
/* NOTE: New HW versions shall go to the end of this table */
|
||||
#ifdef CONFIG_STMMAC_FULL
|
||||
{
|
||||
.gmac = false,
|
||||
.gmac4 = false,
|
||||
@@ -153,7 +156,9 @@ static const struct stmmac_hwif_entry {
|
||||
.tc = NULL,
|
||||
.setup = dwmac4_setup,
|
||||
.quirks = NULL,
|
||||
}, {
|
||||
},
|
||||
#endif /* CONFIG_STMMAC_FULL */
|
||||
{
|
||||
.gmac = false,
|
||||
.gmac4 = true,
|
||||
.xgmac = false,
|
||||
@@ -170,7 +175,9 @@ static const struct stmmac_hwif_entry {
|
||||
.tc = NULL,
|
||||
.setup = dwmac4_setup,
|
||||
.quirks = NULL,
|
||||
}, {
|
||||
},
|
||||
#ifdef CONFIG_STMMAC_FULL
|
||||
{
|
||||
.gmac = false,
|
||||
.gmac4 = true,
|
||||
.xgmac = false,
|
||||
@@ -205,6 +212,7 @@ static const struct stmmac_hwif_entry {
|
||||
.setup = dwxgmac2_setup,
|
||||
.quirks = NULL,
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
||||
int stmmac_hwif_init(struct stmmac_priv *priv)
|
||||
|
||||
Reference in New Issue
Block a user