From f7e79c99d7f545a7150f004a8826634d76206cab Mon Sep 17 00:00:00 2001 From: Tao Huang Date: Tue, 12 Jul 2022 19:55:04 +0800 Subject: [PATCH] Revert "net: ethernet: stmmac: Add STMMAC_PTP config option" This reverts commit 2d1e65714ce5ad06ff7a2d0e9dd32923de3c5fe1. Signed-off-by: Tao Huang Change-Id: Idf56629b15c26e9a28de4c1ba525c7423c7d009e --- drivers/net/ethernet/stmicro/stmmac/Kconfig | 6 ------ drivers/net/ethernet/stmicro/stmmac/Makefile | 5 ++--- drivers/net/ethernet/stmicro/stmmac/hwif.c | 20 ------------------- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 10 ---------- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 20 ++++++------------- 5 files changed, 8 insertions(+), 53 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig index b8bcb59b33fa..38039c9c1e60 100644 --- a/drivers/net/ethernet/stmicro/stmmac/Kconfig +++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig @@ -38,12 +38,6 @@ 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_PTP - bool "PTP feature for STMMAC" - default STMMAC_ETH if !ROCKCHIP_MINI_KERNEL - help - This selects the ptp timestamp function, default is Y. - config STMMAC_PLATFORM tristate "STMMAC Platform bus support" depends on STMMAC_ETH diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile index 0244b5985309..05c792eb473f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/Makefile +++ b/drivers/net/ethernet/stmicro/stmmac/Makefile @@ -2,7 +2,8 @@ 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 \ + 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) @@ -14,8 +15,6 @@ stmmac-$(CONFIG_STMMAC_FULL) += ring_mode.o chain_mode.o dwmac1000_core.o \ stmmac-$(CONFIG_STMMAC_SELFTESTS) += stmmac_selftests.o stmmac-$(CONFIG_STMMAC_ETHTOOL) += stmmac_ethtool.o -stmmac-$(CONFIG_STMMAC_PTP) += stmmac_hwtstamp.o stmmac_ptp.o - # Ordering matters. Generic driver must be last. obj-$(CONFIG_STMMAC_PLATFORM) += stmmac-platform.o obj-$(CONFIG_DWMAC_ANARION) += dwmac-anarion.o diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.c b/drivers/net/ethernet/stmicro/stmmac/hwif.c index 704b60ec57f9..e609de3609bf 100644 --- a/drivers/net/ethernet/stmicro/stmmac/hwif.c +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.c @@ -99,9 +99,7 @@ static const struct stmmac_hwif_entry { const void *desc; const void *dma; const void *mac; -#ifdef CONFIG_STMMAC_PTP const void *hwtimestamp; -#endif const void *mode; const void *tc; const void *mmc; @@ -122,9 +120,7 @@ static const struct stmmac_hwif_entry { .desc = NULL, .dma = &dwmac100_dma_ops, .mac = &dwmac100_ops, -#ifdef CONFIG_STMMAC_PTP .hwtimestamp = &stmmac_ptp, -#endif .mode = NULL, .tc = NULL, .mmc = &dwmac_mmc_ops, @@ -142,9 +138,7 @@ static const struct stmmac_hwif_entry { .desc = NULL, .dma = &dwmac1000_dma_ops, .mac = &dwmac1000_ops, -#ifdef CONFIG_STMMAC_PTP .hwtimestamp = &stmmac_ptp, -#endif .mode = NULL, .tc = NULL, .mmc = &dwmac_mmc_ops, @@ -162,9 +156,7 @@ static const struct stmmac_hwif_entry { .desc = &dwmac4_desc_ops, .dma = &dwmac4_dma_ops, .mac = &dwmac4_ops, -#ifdef CONFIG_STMMAC_PTP .hwtimestamp = &stmmac_ptp, -#endif .mode = NULL, .tc = &dwmac510_tc_ops, .mmc = &dwmac_mmc_ops, @@ -182,9 +174,7 @@ static const struct stmmac_hwif_entry { .desc = &dwmac4_desc_ops, .dma = &dwmac4_dma_ops, .mac = &dwmac410_ops, -#ifdef CONFIG_STMMAC_PTP .hwtimestamp = &stmmac_ptp, -#endif .mode = &dwmac4_ring_mode_ops, .tc = &dwmac510_tc_ops, .mmc = &dwmac_mmc_ops, @@ -204,9 +194,7 @@ static const struct stmmac_hwif_entry { .desc = &dwmac4_desc_ops, .dma = &dwmac410_dma_ops, .mac = &dwmac410_ops, -#ifdef CONFIG_STMMAC_PTP .hwtimestamp = &stmmac_ptp, -#endif .mode = &dwmac4_ring_mode_ops, #ifdef CONFIG_STMMAC_FULL .tc = &dwmac510_tc_ops, @@ -228,9 +216,7 @@ static const struct stmmac_hwif_entry { .desc = &dwmac4_desc_ops, .dma = &dwmac410_dma_ops, .mac = &dwmac510_ops, -#ifdef CONFIG_STMMAC_PTP .hwtimestamp = &stmmac_ptp, -#endif .mode = &dwmac4_ring_mode_ops, .tc = &dwmac510_tc_ops, .mmc = &dwmac_mmc_ops, @@ -249,9 +235,7 @@ static const struct stmmac_hwif_entry { .desc = &dwxgmac210_desc_ops, .dma = &dwxgmac210_dma_ops, .mac = &dwxgmac210_ops, -#ifdef CONFIG_STMMAC_PTP .hwtimestamp = &stmmac_ptp, -#endif .mode = NULL, .tc = &dwmac510_tc_ops, .mmc = &dwxgmac_mmc_ops, @@ -270,9 +254,7 @@ static const struct stmmac_hwif_entry { .desc = &dwxgmac210_desc_ops, .dma = &dwxgmac210_dma_ops, .mac = &dwxlgmac2_ops, -#ifdef CONFIG_STMMAC_PTP .hwtimestamp = &stmmac_ptp, -#endif .mode = NULL, .tc = &dwmac510_tc_ops, .mmc = &dwxgmac_mmc_ops, @@ -343,9 +325,7 @@ int stmmac_hwif_init(struct stmmac_priv *priv) mac->desc = mac->desc ? : entry->desc; mac->dma = mac->dma ? : entry->dma; mac->mac = mac->mac ? : entry->mac; -#ifdef CONFIG_STMMAC_PTP mac->ptp = mac->ptp ? : entry->hwtimestamp; -#endif mac->mode = mac->mode ? : entry->mode; mac->tc = mac->tc ? : entry->tc; mac->mmc = mac->mmc ? : entry->mmc; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index b57c83b2460c..8608984f7cf5 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -265,18 +265,8 @@ static inline void stmmac_set_ethtool_ops(struct net_device *netdev) } #endif -#ifdef CONFIG_STMMAC_PTP void stmmac_ptp_register(struct stmmac_priv *priv); void stmmac_ptp_unregister(struct stmmac_priv *priv); -#else -static inline void stmmac_ptp_register(struct stmmac_priv *priv) -{ -} - -static inline void stmmac_ptp_unregister(struct stmmac_priv *priv) -{ -} -#endif int stmmac_resume(struct device *dev); int stmmac_suspend(struct device *dev); int stmmac_dvr_remove(struct device *dev); diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 3b5023240fed..f6acf9469597 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -470,7 +470,6 @@ static void stmmac_get_rx_hwtstamp(struct stmmac_priv *priv, struct dma_desc *p, } } -#ifdef CONFIG_STMMAC_PTP /** * stmmac_hwtstamp_set - control hardware timestamping. * @dev: device pointer. @@ -724,7 +723,6 @@ static int stmmac_hwtstamp_get(struct net_device *dev, struct ifreq *ifr) return copy_to_user(ifr->ifr_data, config, sizeof(*config)) ? -EFAULT : 0; } -#endif /* CONFIG_STMMAC_PTP */ /** * stmmac_init_ptp - init PTP @@ -765,8 +763,7 @@ static int stmmac_init_ptp(struct stmmac_priv *priv) static void stmmac_release_ptp(struct stmmac_priv *priv) { - if (IS_ENABLED(CONFIG_STMMAC_PTP)) - clk_disable_unprepare(priv->plat->clk_ptp_ref); + clk_disable_unprepare(priv->plat->clk_ptp_ref); stmmac_ptp_unregister(priv); } @@ -2711,7 +2708,7 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp) stmmac_mmc_setup(priv); - if (IS_ENABLED(CONFIG_STMMAC_PTP) && init_ptp) { + if (init_ptp) { ret = clk_prepare_enable(priv->plat->clk_ptp_ref); if (ret < 0) netdev_warn(priv->dev, "failed to enable PTP reference clock: %d\n", ret); @@ -2787,8 +2784,7 @@ static void stmmac_hw_teardown(struct net_device *dev) { struct stmmac_priv *priv = netdev_priv(dev); - if (IS_ENABLED(CONFIG_STMMAC_PTP)) - clk_disable_unprepare(priv->plat->clk_ptp_ref); + clk_disable_unprepare(priv->plat->clk_ptp_ref); } /** @@ -2984,8 +2980,7 @@ static int stmmac_release(struct net_device *dev) netif_carrier_off(dev); - if (IS_ENABLED(CONFIG_STMMAC_PTP)) - stmmac_release_ptp(priv); + stmmac_release_ptp(priv); return 0; } @@ -4221,14 +4216,12 @@ static int stmmac_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) case SIOCSMIIREG: ret = phylink_mii_ioctl(priv->phylink, rq, cmd); break; -#ifdef CONFIG_STMMAC_PTP case SIOCSHWTSTAMP: ret = stmmac_hwtstamp_set(dev, rq); break; case SIOCGHWTSTAMP: ret = stmmac_hwtstamp_get(dev, rq); break; -#endif default: break; } @@ -5246,8 +5239,7 @@ int stmmac_suspend(struct device *dev) stmmac_mac_set(priv, priv->ioaddr, false); pinctrl_pm_select_sleep_state(priv->device); /* Disable clock in case of PWM is off */ - if (IS_ENABLED(CONFIG_STMMAC_PTP)) - clk_disable_unprepare(priv->plat->clk_ptp_ref); + clk_disable_unprepare(priv->plat->clk_ptp_ref); clk_disable_unprepare(priv->plat->pclk); clk_disable_unprepare(priv->plat->stmmac_clk); } @@ -5317,7 +5309,7 @@ int stmmac_resume(struct device *dev) /* enable the clk previously disabled */ clk_prepare_enable(priv->plat->stmmac_clk); clk_prepare_enable(priv->plat->pclk); - if (IS_ENABLED(CONFIG_STMMAC_PTP) && priv->plat->clk_ptp_ref) + if (priv->plat->clk_ptp_ref) clk_prepare_enable(priv->plat->clk_ptp_ref); /* reset the phy so that it's ready */ if (priv->mii)