aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/stmicro/stmmac
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/stmicro/stmmac')
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/Kconfig4
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/Makefile15
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac.h61
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_main.c36
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c4
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c13
6 files changed, 25 insertions, 108 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
index 33b85bae6c21..7d3af190be55 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
+++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
@@ -14,7 +14,7 @@ config STMMAC_ETH
14if STMMAC_ETH 14if STMMAC_ETH
15 15
16config STMMAC_PLATFORM 16config STMMAC_PLATFORM
17 bool "STMMAC Platform bus support" 17 tristate "STMMAC Platform bus support"
18 depends on STMMAC_ETH 18 depends on STMMAC_ETH
19 default y 19 default y
20 ---help--- 20 ---help---
@@ -27,7 +27,7 @@ config STMMAC_PLATFORM
27 If unsure, say N. 27 If unsure, say N.
28 28
29config STMMAC_PCI 29config STMMAC_PCI
30 bool "STMMAC PCI bus support" 30 tristate "STMMAC PCI bus support"
31 depends on STMMAC_ETH && PCI 31 depends on STMMAC_ETH && PCI
32 ---help--- 32 ---help---
33 This is to select the Synopsys DWMAC available on PCI devices, 33 This is to select the Synopsys DWMAC available on PCI devices,
diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile
index 034da704f22f..ac4d5629d905 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Makefile
+++ b/drivers/net/ethernet/stmicro/stmmac/Makefile
@@ -1,9 +1,12 @@
1obj-$(CONFIG_STMMAC_ETH) += stmmac.o 1obj-$(CONFIG_STMMAC_ETH) += stmmac.o
2stmmac-$(CONFIG_STMMAC_PCI) += stmmac_pci.o
3stmmac-$(CONFIG_STMMAC_PLATFORM) += stmmac_platform.o dwmac-meson.o \
4 dwmac-sunxi.o dwmac-sti.o \
5 dwmac-socfpga.o
6stmmac-objs:= stmmac_main.o stmmac_ethtool.o stmmac_mdio.o ring_mode.o \ 2stmmac-objs:= stmmac_main.o stmmac_ethtool.o stmmac_mdio.o ring_mode.o \
7 chain_mode.o dwmac_lib.o dwmac1000_core.o dwmac1000_dma.o \ 3 chain_mode.o dwmac_lib.o dwmac1000_core.o dwmac1000_dma.o \
8 dwmac100_core.o dwmac100_dma.o enh_desc.o norm_desc.o \ 4 dwmac100_core.o dwmac100_dma.o enh_desc.o norm_desc.o \
9 mmc_core.o stmmac_hwtstamp.o stmmac_ptp.o $(stmmac-y) 5 mmc_core.o stmmac_hwtstamp.o stmmac_ptp.o $(stmmac-y)
6
7obj-$(CONFIG_STMMAC_PLATFORM) += stmmac-platform.o
8stmmac-platform-objs:= stmmac_platform.o dwmac-meson.o dwmac-sunxi.o \
9 dwmac-sti.o dwmac-socfpga.o
10
11obj-$(CONFIG_STMMAC_PCI) += stmmac-pci.o
12stmmac-pci-objs:= stmmac_pci.o
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index bd75ee8b2757..c0a391983372 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -134,65 +134,4 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
134void stmmac_disable_eee_mode(struct stmmac_priv *priv); 134void stmmac_disable_eee_mode(struct stmmac_priv *priv);
135bool stmmac_eee_init(struct stmmac_priv *priv); 135bool stmmac_eee_init(struct stmmac_priv *priv);
136 136
137#ifdef CONFIG_STMMAC_PLATFORM
138extern struct platform_driver stmmac_pltfr_driver;
139
140static inline int stmmac_register_platform(void)
141{
142 int err;
143
144 err = platform_driver_register(&stmmac_pltfr_driver);
145 if (err)
146 pr_err("stmmac: failed to register the platform driver\n");
147
148 return err;
149}
150
151static inline void stmmac_unregister_platform(void)
152{
153 platform_driver_unregister(&stmmac_pltfr_driver);
154}
155#else
156static inline int stmmac_register_platform(void)
157{
158 pr_debug("stmmac: do not register the platf driver\n");
159
160 return 0;
161}
162
163static inline void stmmac_unregister_platform(void)
164{
165}
166#endif /* CONFIG_STMMAC_PLATFORM */
167
168#ifdef CONFIG_STMMAC_PCI
169extern struct pci_driver stmmac_pci_driver;
170static inline int stmmac_register_pci(void)
171{
172 int err;
173
174 err = pci_register_driver(&stmmac_pci_driver);
175 if (err)
176 pr_err("stmmac: failed to register the PCI driver\n");
177
178 return err;
179}
180
181static inline void stmmac_unregister_pci(void)
182{
183 pci_unregister_driver(&stmmac_pci_driver);
184}
185#else
186static inline int stmmac_register_pci(void)
187{
188 pr_debug("stmmac: do not register the PCI driver\n");
189
190 return 0;
191}
192
193static inline void stmmac_unregister_pci(void)
194{
195}
196#endif /* CONFIG_STMMAC_PCI */
197
198#endif /* __STMMAC_H__ */ 137#endif /* __STMMAC_H__ */
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 53db11b29e61..0f1c146fcce1 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -2885,6 +2885,7 @@ error_clk_get:
2885 2885
2886 return ERR_PTR(ret); 2886 return ERR_PTR(ret);
2887} 2887}
2888EXPORT_SYMBOL_GPL(stmmac_dvr_probe);
2888 2889
2889/** 2890/**
2890 * stmmac_dvr_remove 2891 * stmmac_dvr_remove
@@ -2914,8 +2915,8 @@ int stmmac_dvr_remove(struct net_device *ndev)
2914 2915
2915 return 0; 2916 return 0;
2916} 2917}
2918EXPORT_SYMBOL_GPL(stmmac_dvr_remove);
2917 2919
2918#ifdef CONFIG_PM
2919int stmmac_suspend(struct net_device *ndev) 2920int stmmac_suspend(struct net_device *ndev)
2920{ 2921{
2921 struct stmmac_priv *priv = netdev_priv(ndev); 2922 struct stmmac_priv *priv = netdev_priv(ndev);
@@ -2957,6 +2958,7 @@ int stmmac_suspend(struct net_device *ndev)
2957 priv->oldduplex = -1; 2958 priv->oldduplex = -1;
2958 return 0; 2959 return 0;
2959} 2960}
2961EXPORT_SYMBOL_GPL(stmmac_suspend);
2960 2962
2961int stmmac_resume(struct net_device *ndev) 2963int stmmac_resume(struct net_device *ndev)
2962{ 2964{
@@ -3003,37 +3005,7 @@ int stmmac_resume(struct net_device *ndev)
3003 3005
3004 return 0; 3006 return 0;
3005} 3007}
3006#endif /* CONFIG_PM */ 3008EXPORT_SYMBOL_GPL(stmmac_resume);
3007
3008/* Driver can be configured w/ and w/ both PCI and Platf drivers
3009 * depending on the configuration selected.
3010 */
3011static int __init stmmac_init(void)
3012{
3013 int ret;
3014
3015 ret = stmmac_register_platform();
3016 if (ret)
3017 goto err;
3018 ret = stmmac_register_pci();
3019 if (ret)
3020 goto err_pci;
3021 return 0;
3022err_pci:
3023 stmmac_unregister_platform();
3024err:
3025 pr_err("stmmac: driver registration failed\n");
3026 return ret;
3027}
3028
3029static void __exit stmmac_exit(void)
3030{
3031 stmmac_unregister_platform();
3032 stmmac_unregister_pci();
3033}
3034
3035module_init(stmmac_init);
3036module_exit(stmmac_exit);
3037 3009
3038#ifndef MODULE 3010#ifndef MODULE
3039static int __init stmmac_cmdline_opt(char *str) 3011static int __init stmmac_cmdline_opt(char *str)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
index 5084699baeab..77a6d68f7189 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
@@ -158,7 +158,7 @@ static const struct pci_device_id stmmac_id_table[] = {
158 158
159MODULE_DEVICE_TABLE(pci, stmmac_id_table); 159MODULE_DEVICE_TABLE(pci, stmmac_id_table);
160 160
161struct pci_driver stmmac_pci_driver = { 161static struct pci_driver stmmac_pci_driver = {
162 .name = STMMAC_RESOURCE_NAME, 162 .name = STMMAC_RESOURCE_NAME,
163 .id_table = stmmac_id_table, 163 .id_table = stmmac_id_table,
164 .probe = stmmac_pci_probe, 164 .probe = stmmac_pci_probe,
@@ -168,6 +168,8 @@ struct pci_driver stmmac_pci_driver = {
168 }, 168 },
169}; 169};
170 170
171module_pci_driver(stmmac_pci_driver);
172
171MODULE_DESCRIPTION("STMMAC 10/100/1000 Ethernet PCI driver"); 173MODULE_DESCRIPTION("STMMAC 10/100/1000 Ethernet PCI driver");
172MODULE_AUTHOR("Rayagond Kokatanur <rayagond.kokatanur@vayavyalabs.com>"); 174MODULE_AUTHOR("Rayagond Kokatanur <rayagond.kokatanur@vayavyalabs.com>");
173MODULE_AUTHOR("Giuseppe Cavallaro <peppe.cavallaro@st.com>"); 175MODULE_AUTHOR("Giuseppe Cavallaro <peppe.cavallaro@st.com>");
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 9f18401022e1..e22a960f8bd7 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -362,7 +362,7 @@ static int stmmac_pltfr_remove(struct platform_device *pdev)
362 return ret; 362 return ret;
363} 363}
364 364
365#ifdef CONFIG_PM 365#ifdef CONFIG_PM_SLEEP
366static int stmmac_pltfr_suspend(struct device *dev) 366static int stmmac_pltfr_suspend(struct device *dev)
367{ 367{
368 int ret; 368 int ret;
@@ -388,13 +388,12 @@ static int stmmac_pltfr_resume(struct device *dev)
388 388
389 return stmmac_resume(ndev); 389 return stmmac_resume(ndev);
390} 390}
391 391#endif /* CONFIG_PM_SLEEP */
392#endif /* CONFIG_PM */
393 392
394static SIMPLE_DEV_PM_OPS(stmmac_pltfr_pm_ops, 393static SIMPLE_DEV_PM_OPS(stmmac_pltfr_pm_ops,
395 stmmac_pltfr_suspend, stmmac_pltfr_resume); 394 stmmac_pltfr_suspend, stmmac_pltfr_resume);
396 395
397struct platform_driver stmmac_pltfr_driver = { 396static struct platform_driver stmmac_pltfr_driver = {
398 .probe = stmmac_pltfr_probe, 397 .probe = stmmac_pltfr_probe,
399 .remove = stmmac_pltfr_remove, 398 .remove = stmmac_pltfr_remove,
400 .driver = { 399 .driver = {
@@ -402,9 +401,11 @@ struct platform_driver stmmac_pltfr_driver = {
402 .owner = THIS_MODULE, 401 .owner = THIS_MODULE,
403 .pm = &stmmac_pltfr_pm_ops, 402 .pm = &stmmac_pltfr_pm_ops,
404 .of_match_table = of_match_ptr(stmmac_dt_ids), 403 .of_match_table = of_match_ptr(stmmac_dt_ids),
405 }, 404 },
406}; 405};
407 406
407module_platform_driver(stmmac_pltfr_driver);
408
408MODULE_DESCRIPTION("STMMAC 10/100/1000 Ethernet PLATFORM driver"); 409MODULE_DESCRIPTION("STMMAC 10/100/1000 Ethernet PLATFORM driver");
409MODULE_AUTHOR("Giuseppe Cavallaro <peppe.cavallaro@st.com>"); 410MODULE_AUTHOR("Giuseppe Cavallaro <peppe.cavallaro@st.com>");
410MODULE_LICENSE("GPL"); 411MODULE_LICENSE("GPL");