aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-07-30 20:25:34 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-07-30 20:25:34 -0400
commit27c1ee3f929555b71fa39ec0d81a7e7185de1b16 (patch)
tree42e40bdfe4efac660d650658019391536ce67a42 /drivers/net
parent37cd9600a9e20359b0283983c9e3a55d84347168 (diff)
parent086ff4b3a7fb9cdf41e6a5d0ccd99b86d84633a1 (diff)
Merge branch 'akpm' (Andrew's patch-bomb)
Merge Andrew's first set of patches: "Non-MM patches: - lots of misc bits - tree-wide have_clk() cleanups - quite a lot of printk tweaks. I draw your attention to "printk: convert the format for KERN_<LEVEL> to a 2 byte pattern" which looks a bit scary. But afaict it's solid. - backlight updates - lib/ feature work (notably the addition and use of memweight()) - checkpatch updates - rtc updates - nilfs updates - fatfs updates (partial, still waiting for acks) - kdump, proc, fork, IPC, sysctl, taskstats, pps, etc - new fault-injection feature work" * Merge emailed patches from Andrew Morton <akpm@linux-foundation.org>: (128 commits) drivers/misc/lkdtm.c: fix missing allocation failure check lib/scatterlist: do not re-write gfp_flags in __sg_alloc_table() fault-injection: add tool to run command with failslab or fail_page_alloc fault-injection: add selftests for cpu and memory hotplug powerpc: pSeries reconfig notifier error injection module memory: memory notifier error injection module PM: PM notifier error injection module cpu: rewrite cpu-notifier-error-inject module fault-injection: notifier error injection c/r: fcntl: add F_GETOWNER_UIDS option resource: make sure requested range is included in the root range include/linux/aio.h: cpp->C conversions fs: cachefiles: add support for large files in filesystem caching pps: return PTR_ERR on error in device_create taskstats: check nla_reserve() return sysctl: suppress kmemleak messages ipc: use Kconfig options for __ARCH_WANT_[COMPAT_]IPC_PARSE_VERSION ipc: compat: use signed size_t types for msgsnd and msgrcv ipc: allow compat IPC version field parsing if !ARCH_WANT_OLD_COMPAT_IPC ipc: add COMPAT_SHMLBA support ...
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/can/c_can/c_can_platform.c8
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac.h42
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_main.c33
3 files changed, 17 insertions, 66 deletions
diff --git a/drivers/net/can/c_can/c_can_platform.c b/drivers/net/can/c_can/c_can_platform.c
index f0921d16f0a9..6ff7ad006c30 100644
--- a/drivers/net/can/c_can/c_can_platform.c
+++ b/drivers/net/can/c_can/c_can_platform.c
@@ -74,7 +74,6 @@ static int __devinit c_can_plat_probe(struct platform_device *pdev)
74 const struct platform_device_id *id; 74 const struct platform_device_id *id;
75 struct resource *mem; 75 struct resource *mem;
76 int irq; 76 int irq;
77#ifdef CONFIG_HAVE_CLK
78 struct clk *clk; 77 struct clk *clk;
79 78
80 /* get the appropriate clk */ 79 /* get the appropriate clk */
@@ -84,7 +83,6 @@ static int __devinit c_can_plat_probe(struct platform_device *pdev)
84 ret = -ENODEV; 83 ret = -ENODEV;
85 goto exit; 84 goto exit;
86 } 85 }
87#endif
88 86
89 /* get the platform data */ 87 /* get the platform data */
90 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 88 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -145,10 +143,8 @@ static int __devinit c_can_plat_probe(struct platform_device *pdev)
145 143
146 dev->irq = irq; 144 dev->irq = irq;
147 priv->base = addr; 145 priv->base = addr;
148#ifdef CONFIG_HAVE_CLK
149 priv->can.clock.freq = clk_get_rate(clk); 146 priv->can.clock.freq = clk_get_rate(clk);
150 priv->priv = clk; 147 priv->priv = clk;
151#endif
152 148
153 platform_set_drvdata(pdev, dev); 149 platform_set_drvdata(pdev, dev);
154 SET_NETDEV_DEV(dev, &pdev->dev); 150 SET_NETDEV_DEV(dev, &pdev->dev);
@@ -172,10 +168,8 @@ exit_iounmap:
172exit_release_mem: 168exit_release_mem:
173 release_mem_region(mem->start, resource_size(mem)); 169 release_mem_region(mem->start, resource_size(mem));
174exit_free_clk: 170exit_free_clk:
175#ifdef CONFIG_HAVE_CLK
176 clk_put(clk); 171 clk_put(clk);
177exit: 172exit:
178#endif
179 dev_err(&pdev->dev, "probe failed\n"); 173 dev_err(&pdev->dev, "probe failed\n");
180 174
181 return ret; 175 return ret;
@@ -196,9 +190,7 @@ static int __devexit c_can_plat_remove(struct platform_device *pdev)
196 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 190 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
197 release_mem_region(mem->start, resource_size(mem)); 191 release_mem_region(mem->start, resource_size(mem));
198 192
199#ifdef CONFIG_HAVE_CLK
200 clk_put(priv->priv); 193 clk_put(priv->priv);
201#endif
202 194
203 return 0; 195 return 0;
204} 196}
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index ab4c376cb276..f2d3665430ad 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -82,9 +82,7 @@ struct stmmac_priv {
82 struct stmmac_counters mmc; 82 struct stmmac_counters mmc;
83 struct dma_features dma_cap; 83 struct dma_features dma_cap;
84 int hw_cap_support; 84 int hw_cap_support;
85#ifdef CONFIG_HAVE_CLK
86 struct clk *stmmac_clk; 85 struct clk *stmmac_clk;
87#endif
88 int clk_csr; 86 int clk_csr;
89 int synopsys_id; 87 int synopsys_id;
90 struct timer_list eee_ctrl_timer; 88 struct timer_list eee_ctrl_timer;
@@ -113,46 +111,6 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
113void stmmac_disable_eee_mode(struct stmmac_priv *priv); 111void stmmac_disable_eee_mode(struct stmmac_priv *priv);
114bool stmmac_eee_init(struct stmmac_priv *priv); 112bool stmmac_eee_init(struct stmmac_priv *priv);
115 113
116#ifdef CONFIG_HAVE_CLK
117static inline int stmmac_clk_enable(struct stmmac_priv *priv)
118{
119 if (!IS_ERR(priv->stmmac_clk))
120 return clk_prepare_enable(priv->stmmac_clk);
121
122 return 0;
123}
124
125static inline void stmmac_clk_disable(struct stmmac_priv *priv)
126{
127 if (IS_ERR(priv->stmmac_clk))
128 return;
129
130 clk_disable_unprepare(priv->stmmac_clk);
131}
132static inline int stmmac_clk_get(struct stmmac_priv *priv)
133{
134 priv->stmmac_clk = clk_get(priv->device, NULL);
135
136 if (IS_ERR(priv->stmmac_clk))
137 return PTR_ERR(priv->stmmac_clk);
138
139 return 0;
140}
141#else
142static inline int stmmac_clk_enable(struct stmmac_priv *priv)
143{
144 return 0;
145}
146static inline void stmmac_clk_disable(struct stmmac_priv *priv)
147{
148}
149static inline int stmmac_clk_get(struct stmmac_priv *priv)
150{
151 return 0;
152}
153#endif /* CONFIG_HAVE_CLK */
154
155
156#ifdef CONFIG_STMMAC_PLATFORM 114#ifdef CONFIG_STMMAC_PLATFORM
157extern struct platform_driver stmmac_pltfr_driver; 115extern struct platform_driver stmmac_pltfr_driver;
158static inline int stmmac_register_platform(void) 116static inline int stmmac_register_platform(void)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index f6b04c1a3672..fd8882f9602a 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -28,6 +28,7 @@
28 https://bugzilla.stlinux.com/ 28 https://bugzilla.stlinux.com/
29*******************************************************************************/ 29*******************************************************************************/
30 30
31#include <linux/clk.h>
31#include <linux/kernel.h> 32#include <linux/kernel.h>
32#include <linux/interrupt.h> 33#include <linux/interrupt.h>
33#include <linux/ip.h> 34#include <linux/ip.h>
@@ -173,12 +174,8 @@ static void stmmac_verify_args(void)
173 174
174static void stmmac_clk_csr_set(struct stmmac_priv *priv) 175static void stmmac_clk_csr_set(struct stmmac_priv *priv)
175{ 176{
176#ifdef CONFIG_HAVE_CLK
177 u32 clk_rate; 177 u32 clk_rate;
178 178
179 if (IS_ERR(priv->stmmac_clk))
180 return;
181
182 clk_rate = clk_get_rate(priv->stmmac_clk); 179 clk_rate = clk_get_rate(priv->stmmac_clk);
183 180
184 /* Platform provided default clk_csr would be assumed valid 181 /* Platform provided default clk_csr would be assumed valid
@@ -200,7 +197,6 @@ static void stmmac_clk_csr_set(struct stmmac_priv *priv)
200 * we can not estimate the proper divider as it is not known 197 * we can not estimate the proper divider as it is not known
201 * the frequency of clk_csr_i. So we do not change the default 198 * the frequency of clk_csr_i. So we do not change the default
202 * divider. */ 199 * divider. */
203#endif
204} 200}
205 201
206#if defined(STMMAC_XMIT_DEBUG) || defined(STMMAC_RX_DEBUG) 202#if defined(STMMAC_XMIT_DEBUG) || defined(STMMAC_RX_DEBUG)
@@ -1070,7 +1066,7 @@ static int stmmac_open(struct net_device *dev)
1070 } else 1066 } else
1071 priv->tm->enable = 1; 1067 priv->tm->enable = 1;
1072#endif 1068#endif
1073 stmmac_clk_enable(priv); 1069 clk_enable(priv->stmmac_clk);
1074 1070
1075 stmmac_check_ether_addr(priv); 1071 stmmac_check_ether_addr(priv);
1076 1072
@@ -1192,7 +1188,7 @@ open_error:
1192 if (priv->phydev) 1188 if (priv->phydev)
1193 phy_disconnect(priv->phydev); 1189 phy_disconnect(priv->phydev);
1194 1190
1195 stmmac_clk_disable(priv); 1191 clk_disable(priv->stmmac_clk);
1196 1192
1197 return ret; 1193 return ret;
1198} 1194}
@@ -1250,7 +1246,7 @@ static int stmmac_release(struct net_device *dev)
1250#ifdef CONFIG_STMMAC_DEBUG_FS 1246#ifdef CONFIG_STMMAC_DEBUG_FS
1251 stmmac_exit_fs(); 1247 stmmac_exit_fs();
1252#endif 1248#endif
1253 stmmac_clk_disable(priv); 1249 clk_disable(priv->stmmac_clk);
1254 1250
1255 return 0; 1251 return 0;
1256} 1252}
@@ -2078,11 +2074,14 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
2078 ret = register_netdev(ndev); 2074 ret = register_netdev(ndev);
2079 if (ret) { 2075 if (ret) {
2080 pr_err("%s: ERROR %i registering the device\n", __func__, ret); 2076 pr_err("%s: ERROR %i registering the device\n", __func__, ret);
2081 goto error; 2077 goto error_netdev_register;
2082 } 2078 }
2083 2079
2084 if (stmmac_clk_get(priv)) 2080 priv->stmmac_clk = clk_get(priv->device, NULL);
2081 if (IS_ERR(priv->stmmac_clk)) {
2085 pr_warning("%s: warning: cannot get CSR clock\n", __func__); 2082 pr_warning("%s: warning: cannot get CSR clock\n", __func__);
2083 goto error_clk_get;
2084 }
2086 2085
2087 /* If a specific clk_csr value is passed from the platform 2086 /* If a specific clk_csr value is passed from the platform
2088 * this means that the CSR Clock Range selection cannot be 2087 * this means that the CSR Clock Range selection cannot be
@@ -2100,15 +2099,17 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
2100 if (ret < 0) { 2099 if (ret < 0) {
2101 pr_debug("%s: MDIO bus (id: %d) registration failed", 2100 pr_debug("%s: MDIO bus (id: %d) registration failed",
2102 __func__, priv->plat->bus_id); 2101 __func__, priv->plat->bus_id);
2103 goto error; 2102 goto error_mdio_register;
2104 } 2103 }
2105 2104
2106 return priv; 2105 return priv;
2107 2106
2108error: 2107error_mdio_register:
2109 netif_napi_del(&priv->napi); 2108 clk_put(priv->stmmac_clk);
2110 2109error_clk_get:
2111 unregister_netdev(ndev); 2110 unregister_netdev(ndev);
2111error_netdev_register:
2112 netif_napi_del(&priv->napi);
2112 free_netdev(ndev); 2113 free_netdev(ndev);
2113 2114
2114 return NULL; 2115 return NULL;
@@ -2177,7 +2178,7 @@ int stmmac_suspend(struct net_device *ndev)
2177 else { 2178 else {
2178 stmmac_set_mac(priv->ioaddr, false); 2179 stmmac_set_mac(priv->ioaddr, false);
2179 /* Disable clock in case of PWM is off */ 2180 /* Disable clock in case of PWM is off */
2180 stmmac_clk_disable(priv); 2181 clk_disable(priv->stmmac_clk);
2181 } 2182 }
2182 spin_unlock_irqrestore(&priv->lock, flags); 2183 spin_unlock_irqrestore(&priv->lock, flags);
2183 return 0; 2184 return 0;
@@ -2202,7 +2203,7 @@ int stmmac_resume(struct net_device *ndev)
2202 priv->hw->mac->pmt(priv->ioaddr, 0); 2203 priv->hw->mac->pmt(priv->ioaddr, 0);
2203 else 2204 else
2204 /* enable the clk prevously disabled */ 2205 /* enable the clk prevously disabled */
2205 stmmac_clk_enable(priv); 2206 clk_enable(priv->stmmac_clk);
2206 2207
2207 netif_device_attach(ndev); 2208 netif_device_attach(ndev);
2208 2209