aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/stmicro
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-06-13 00:59:18 -0400
committerDavid S. Miller <davem@davemloft.net>2012-06-13 00:59:18 -0400
commit43b03f1f6d6832d744918947d185a7aee89d1e0f (patch)
tree53a8c47d67dfcd23450d4068d08ccf2b7714c5e8 /drivers/net/ethernet/stmicro
parent2da45db2bdd432a9dca825099c791f5c851f92b9 (diff)
parent5ee31c6898ea5537fcea160999d60dc63bc0c305 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts: MAINTAINERS drivers/net/wireless/iwlwifi/pcie/trans.c The iwlwifi conflict was resolved by keeping the code added in 'net' that turns off the buggy chip feature. The MAINTAINERS conflict was merely overlapping changes, one change updated all the wireless web site URLs and the other changed some GIT trees to be Johannes's instead of John's. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/stmicro')
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/Kconfig1
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac.h64
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_main.c23
3 files changed, 74 insertions, 14 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
index 0076f770e637..9f448279e12a 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
+++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
@@ -15,6 +15,7 @@ if STMMAC_ETH
15config STMMAC_PLATFORM 15config STMMAC_PLATFORM
16 bool "STMMAC Platform bus support" 16 bool "STMMAC Platform bus support"
17 depends on STMMAC_ETH 17 depends on STMMAC_ETH
18 default y
18 ---help--- 19 ---help---
19 This selects the platform specific bus support for 20 This selects the platform specific bus support for
20 the stmmac device driver. This is the driver used 21 the stmmac device driver. This is the driver used
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index 6d07ba2c8661..dc20c56efc9d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -26,6 +26,7 @@
26#include <linux/clk.h> 26#include <linux/clk.h>
27#include <linux/stmmac.h> 27#include <linux/stmmac.h>
28#include <linux/phy.h> 28#include <linux/phy.h>
29#include <linux/pci.h>
29#include "common.h" 30#include "common.h"
30#ifdef CONFIG_STMMAC_TIMER 31#ifdef CONFIG_STMMAC_TIMER
31#include "stmmac_timer.h" 32#include "stmmac_timer.h"
@@ -95,8 +96,6 @@ extern int stmmac_mdio_register(struct net_device *ndev);
95extern void stmmac_set_ethtool_ops(struct net_device *netdev); 96extern void stmmac_set_ethtool_ops(struct net_device *netdev);
96extern const struct stmmac_desc_ops enh_desc_ops; 97extern const struct stmmac_desc_ops enh_desc_ops;
97extern const struct stmmac_desc_ops ndesc_ops; 98extern const struct stmmac_desc_ops ndesc_ops;
98extern struct pci_driver stmmac_pci_driver;
99extern struct platform_driver stmmac_pltfr_driver;
100int stmmac_freeze(struct net_device *ndev); 99int stmmac_freeze(struct net_device *ndev);
101int stmmac_restore(struct net_device *ndev); 100int stmmac_restore(struct net_device *ndev);
102int stmmac_resume(struct net_device *ndev); 101int stmmac_resume(struct net_device *ndev);
@@ -110,7 +109,7 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
110static inline int stmmac_clk_enable(struct stmmac_priv *priv) 109static inline int stmmac_clk_enable(struct stmmac_priv *priv)
111{ 110{
112 if (!IS_ERR(priv->stmmac_clk)) 111 if (!IS_ERR(priv->stmmac_clk))
113 return clk_enable(priv->stmmac_clk); 112 return clk_prepare_enable(priv->stmmac_clk);
114 113
115 return 0; 114 return 0;
116} 115}
@@ -120,7 +119,7 @@ static inline void stmmac_clk_disable(struct stmmac_priv *priv)
120 if (IS_ERR(priv->stmmac_clk)) 119 if (IS_ERR(priv->stmmac_clk))
121 return; 120 return;
122 121
123 clk_disable(priv->stmmac_clk); 122 clk_disable_unprepare(priv->stmmac_clk);
124} 123}
125static inline int stmmac_clk_get(struct stmmac_priv *priv) 124static inline int stmmac_clk_get(struct stmmac_priv *priv)
126{ 125{
@@ -144,3 +143,60 @@ static inline int stmmac_clk_get(struct stmmac_priv *priv)
144 return 0; 143 return 0;
145} 144}
146#endif /* CONFIG_HAVE_CLK */ 145#endif /* CONFIG_HAVE_CLK */
146
147
148#ifdef CONFIG_STMMAC_PLATFORM
149extern struct platform_driver stmmac_pltfr_driver;
150static inline int stmmac_register_platform(void)
151{
152 int err;
153
154 err = platform_driver_register(&stmmac_pltfr_driver);
155 if (err)
156 pr_err("stmmac: failed to register the platform driver\n");
157
158 return err;
159}
160static inline void stmmac_unregister_platform(void)
161{
162 platform_driver_register(&stmmac_pltfr_driver);
163}
164#else
165static inline int stmmac_register_platform(void)
166{
167 pr_debug("stmmac: do not register the platf driver\n");
168
169 return -EINVAL;
170}
171static inline void stmmac_unregister_platform(void)
172{
173}
174#endif /* CONFIG_STMMAC_PLATFORM */
175
176#ifdef CONFIG_STMMAC_PCI
177extern struct pci_driver stmmac_pci_driver;
178static inline int stmmac_register_pci(void)
179{
180 int err;
181
182 err = pci_register_driver(&stmmac_pci_driver);
183 if (err)
184 pr_err("stmmac: failed to register the PCI driver\n");
185
186 return err;
187}
188static inline void stmmac_unregister_pci(void)
189{
190 pci_unregister_driver(&stmmac_pci_driver);
191}
192#else
193static inline int stmmac_register_pci(void)
194{
195 pr_debug("stmmac: do not register the PCI driver\n");
196
197 return -EINVAL;
198}
199static inline void stmmac_unregister_pci(void)
200{
201}
202#endif /* CONFIG_STMMAC_PCI */
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 8899e105da9f..590e95b4cbfa 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -42,7 +42,6 @@
42#include <linux/dma-mapping.h> 42#include <linux/dma-mapping.h>
43#include <linux/slab.h> 43#include <linux/slab.h>
44#include <linux/prefetch.h> 44#include <linux/prefetch.h>
45#include <linux/pci.h>
46#ifdef CONFIG_STMMAC_DEBUG_FS 45#ifdef CONFIG_STMMAC_DEBUG_FS
47#include <linux/debugfs.h> 46#include <linux/debugfs.h>
48#include <linux/seq_file.h> 47#include <linux/seq_file.h>
@@ -2093,25 +2092,29 @@ int stmmac_restore(struct net_device *ndev)
2093} 2092}
2094#endif /* CONFIG_PM */ 2093#endif /* CONFIG_PM */
2095 2094
2095/* Driver can be configured w/ and w/ both PCI and Platf drivers
2096 * depending on the configuration selected.
2097 */
2096static int __init stmmac_init(void) 2098static int __init stmmac_init(void)
2097{ 2099{
2098 int err = 0; 2100 int err_plt = 0;
2101 int err_pci = 0;
2099 2102
2100 err = platform_driver_register(&stmmac_pltfr_driver); 2103 err_plt = stmmac_register_platform();
2104 err_pci = stmmac_register_pci();
2101 2105
2102 if (!err) { 2106 if ((err_pci) && (err_plt)) {
2103 err = pci_register_driver(&stmmac_pci_driver); 2107 pr_err("stmmac: driver registration failed\n");
2104 if (err) 2108 return -EINVAL;
2105 platform_driver_unregister(&stmmac_pltfr_driver);
2106 } 2109 }
2107 2110
2108 return err; 2111 return 0;
2109} 2112}
2110 2113
2111static void __exit stmmac_exit(void) 2114static void __exit stmmac_exit(void)
2112{ 2115{
2113 pci_unregister_driver(&stmmac_pci_driver); 2116 stmmac_unregister_platform();
2114 platform_driver_unregister(&stmmac_pltfr_driver); 2117 stmmac_unregister_pci();
2115} 2118}
2116 2119
2117module_init(stmmac_init); 2120module_init(stmmac_init);