net: ethernet: stmmac: Add STMMAC_MMC config option

Add this config option to reduce memory usage about 4388 bytes,
if it was not necessary.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: Ia0cac913d226f97ea75b67d9c071ad1323a54535
This commit is contained in:
David Wu
2022-01-26 17:28:54 +08:00
committed by Tao Huang
parent 2d1e65714c
commit 41888ca1af
3 changed files with 29 additions and 1 deletions

View File

@@ -38,6 +38,12 @@ config STMMAC_FULL
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_MMC
bool "Support mmc core for STMMAC"
default STMMAC_ETH
help
This selects the stmmac mmc function, default is Y.
config STMMAC_PTP
bool "PTP feature for STMMAC"
default STMMAC_ETH

View File

@@ -2,7 +2,7 @@
obj-$(CONFIG_STMMAC_ETH) += stmmac.o
stmmac-objs:= stmmac_main.o stmmac_mdio.o dwmac_lib.o \
mmc_core.o dwmac4_descs.o dwmac4_dma.o \
dwmac4_descs.o dwmac4_dma.o \
dwmac4_lib.o dwmac4_core.o hwif.o \
$(stmmac-y)
@@ -11,6 +11,7 @@ stmmac-$(CONFIG_STMMAC_FULL) += ring_mode.o chain_mode.o dwmac1000_core.o \
enh_desc.o norm_desc.o dwmac5.o stmmac_tc.o \
dwxgmac2_core.o dwxgmac2_dma.o dwxgmac2_descs.o
stmmac-$(CONFIG_STMMAC_MMC) +=mmc_core.o
stmmac-$(CONFIG_STMMAC_SELFTESTS) += stmmac_selftests.o
stmmac-$(CONFIG_STMMAC_ETHTOOL) += stmmac_ethtool.o

View File

@@ -104,7 +104,9 @@ static const struct stmmac_hwif_entry {
#endif
const void *mode;
const void *tc;
#ifdef CONFIG_STMMAC_MMC
const void *mmc;
#endif
int (*setup)(struct stmmac_priv *priv);
int (*quirks)(struct stmmac_priv *priv);
} stmmac_hw[] = {
@@ -127,7 +129,9 @@ static const struct stmmac_hwif_entry {
#endif
.mode = NULL,
.tc = NULL,
#ifdef CONFIG_STMMAC_MMC
.mmc = &dwmac_mmc_ops,
#endif
.setup = dwmac100_setup,
.quirks = stmmac_dwmac1_quirks,
}, {
@@ -147,7 +151,9 @@ static const struct stmmac_hwif_entry {
#endif
.mode = NULL,
.tc = NULL,
#ifdef CONFIG_STMMAC_MMC
.mmc = &dwmac_mmc_ops,
#endif
.setup = dwmac1000_setup,
.quirks = stmmac_dwmac1_quirks,
}, {
@@ -167,7 +173,9 @@ static const struct stmmac_hwif_entry {
#endif
.mode = NULL,
.tc = &dwmac510_tc_ops,
#ifdef CONFIG_STMMAC_MMC
.mmc = &dwmac_mmc_ops,
#endif
.setup = dwmac4_setup,
.quirks = stmmac_dwmac4_quirks,
}, {
@@ -187,7 +195,9 @@ static const struct stmmac_hwif_entry {
#endif
.mode = &dwmac4_ring_mode_ops,
.tc = &dwmac510_tc_ops,
#ifdef CONFIG_STMMAC_MMC
.mmc = &dwmac_mmc_ops,
#endif
.setup = dwmac4_setup,
.quirks = NULL,
},
@@ -211,7 +221,10 @@ static const struct stmmac_hwif_entry {
#ifdef CONFIG_STMMAC_FULL
.tc = &dwmac510_tc_ops,
#endif
#ifdef CONFIG_STMMAC_MMC
.mmc = &dwmac_mmc_ops,
#endif
.setup = dwmac4_setup,
.quirks = NULL,
},
@@ -233,7 +246,9 @@ static const struct stmmac_hwif_entry {
#endif
.mode = &dwmac4_ring_mode_ops,
.tc = &dwmac510_tc_ops,
#ifdef CONFIG_STMMAC_MMC
.mmc = &dwmac_mmc_ops,
#endif
.setup = dwmac4_setup,
.quirks = NULL,
}, {
@@ -254,7 +269,9 @@ static const struct stmmac_hwif_entry {
#endif
.mode = NULL,
.tc = &dwmac510_tc_ops,
#ifdef CONFIG_STMMAC_MMC
.mmc = &dwxgmac_mmc_ops,
#endif
.setup = dwxgmac2_setup,
.quirks = NULL,
}, {
@@ -275,7 +292,9 @@ static const struct stmmac_hwif_entry {
#endif
.mode = NULL,
.tc = &dwmac510_tc_ops,
#ifdef CONFIG_STMMAC_MMC
.mmc = &dwxgmac_mmc_ops,
#endif
.setup = dwxlgmac2_setup,
.quirks = stmmac_dwxlgmac_quirks,
},
@@ -348,7 +367,9 @@ int stmmac_hwif_init(struct stmmac_priv *priv)
#endif
mac->mode = mac->mode ? : entry->mode;
mac->tc = mac->tc ? : entry->tc;
#ifdef CONFIG_STMMAC_MMC
mac->mmc = mac->mmc ? : entry->mmc;
#endif
priv->hw = mac;
priv->ptpaddr = priv->ioaddr + entry->regs.ptp_off;