diff options
Diffstat (limited to 'drivers/net/ethernet/stmicro/stmmac/stmmac.h')
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/stmmac.h | 63 |
1 files changed, 60 insertions, 3 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index 6b5d060ee9de..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,7 +96,6 @@ extern int stmmac_mdio_register(struct net_device *ndev); | |||
95 | extern void stmmac_set_ethtool_ops(struct net_device *netdev); | 96 | extern void stmmac_set_ethtool_ops(struct net_device *netdev); |
96 | extern const struct stmmac_desc_ops enh_desc_ops; | 97 | extern const struct stmmac_desc_ops enh_desc_ops; |
97 | extern const struct stmmac_desc_ops ndesc_ops; | 98 | extern const struct stmmac_desc_ops ndesc_ops; |
98 | |||
99 | int stmmac_freeze(struct net_device *ndev); | 99 | int stmmac_freeze(struct net_device *ndev); |
100 | int stmmac_restore(struct net_device *ndev); | 100 | int stmmac_restore(struct net_device *ndev); |
101 | int stmmac_resume(struct net_device *ndev); | 101 | int stmmac_resume(struct net_device *ndev); |
@@ -109,7 +109,7 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device, | |||
109 | static inline int stmmac_clk_enable(struct stmmac_priv *priv) | 109 | static inline int stmmac_clk_enable(struct stmmac_priv *priv) |
110 | { | 110 | { |
111 | if (!IS_ERR(priv->stmmac_clk)) | 111 | if (!IS_ERR(priv->stmmac_clk)) |
112 | return clk_enable(priv->stmmac_clk); | 112 | return clk_prepare_enable(priv->stmmac_clk); |
113 | 113 | ||
114 | return 0; | 114 | return 0; |
115 | } | 115 | } |
@@ -119,7 +119,7 @@ static inline void stmmac_clk_disable(struct stmmac_priv *priv) | |||
119 | if (IS_ERR(priv->stmmac_clk)) | 119 | if (IS_ERR(priv->stmmac_clk)) |
120 | return; | 120 | return; |
121 | 121 | ||
122 | clk_disable(priv->stmmac_clk); | 122 | clk_disable_unprepare(priv->stmmac_clk); |
123 | } | 123 | } |
124 | static inline int stmmac_clk_get(struct stmmac_priv *priv) | 124 | static inline int stmmac_clk_get(struct stmmac_priv *priv) |
125 | { | 125 | { |
@@ -143,3 +143,60 @@ static inline int stmmac_clk_get(struct stmmac_priv *priv) | |||
143 | return 0; | 143 | return 0; |
144 | } | 144 | } |
145 | #endif /* CONFIG_HAVE_CLK */ | 145 | #endif /* CONFIG_HAVE_CLK */ |
146 | |||
147 | |||
148 | #ifdef CONFIG_STMMAC_PLATFORM | ||
149 | extern struct platform_driver stmmac_pltfr_driver; | ||
150 | static 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 | } | ||
160 | static inline void stmmac_unregister_platform(void) | ||
161 | { | ||
162 | platform_driver_register(&stmmac_pltfr_driver); | ||
163 | } | ||
164 | #else | ||
165 | static inline int stmmac_register_platform(void) | ||
166 | { | ||
167 | pr_debug("stmmac: do not register the platf driver\n"); | ||
168 | |||
169 | return -EINVAL; | ||
170 | } | ||
171 | static inline void stmmac_unregister_platform(void) | ||
172 | { | ||
173 | } | ||
174 | #endif /* CONFIG_STMMAC_PLATFORM */ | ||
175 | |||
176 | #ifdef CONFIG_STMMAC_PCI | ||
177 | extern struct pci_driver stmmac_pci_driver; | ||
178 | static 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 | } | ||
188 | static inline void stmmac_unregister_pci(void) | ||
189 | { | ||
190 | pci_unregister_driver(&stmmac_pci_driver); | ||
191 | } | ||
192 | #else | ||
193 | static inline int stmmac_register_pci(void) | ||
194 | { | ||
195 | pr_debug("stmmac: do not register the PCI driver\n"); | ||
196 | |||
197 | return -EINVAL; | ||
198 | } | ||
199 | static inline void stmmac_unregister_pci(void) | ||
200 | { | ||
201 | } | ||
202 | #endif /* CONFIG_STMMAC_PCI */ | ||