hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/drivers/net/ethernet/wiznet/w5300.c
....@@ -1,11 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Ethernet driver for the WIZnet W5300 chip.
34 *
45 * Copyright (C) 2008-2009 WIZnet Co.,Ltd.
56 * Copyright (C) 2011 Taehun Kim <kth3321 <at> gmail.com>
67 * Copyright (C) 2012 Mike Sinkovsky <msink@permonline.ru>
7
- *
8
- * Licensed under the GPL-2 or later.
98 */
109
1110 #include <linux/kernel.h>
....@@ -141,7 +140,6 @@
141140
142141 spin_lock_irqsave(&priv->reg_lock, flags);
143142 w5300_write_direct(priv, W5300_IDM_AR, addr);
144
- mmiowb();
145143 data = w5300_read_direct(priv, W5300_IDM_DR);
146144 spin_unlock_irqrestore(&priv->reg_lock, flags);
147145
....@@ -154,9 +152,7 @@
154152
155153 spin_lock_irqsave(&priv->reg_lock, flags);
156154 w5300_write_direct(priv, W5300_IDM_AR, addr);
157
- mmiowb();
158155 w5300_write_direct(priv, W5300_IDM_DR, data);
159
- mmiowb();
160156 spin_unlock_irqrestore(&priv->reg_lock, flags);
161157 }
162158
....@@ -192,7 +188,6 @@
192188 unsigned long timeout = jiffies + msecs_to_jiffies(100);
193189
194190 w5300_write(priv, W5300_S0_CR, cmd);
195
- mmiowb();
196191
197192 while (w5300_read(priv, W5300_S0_CR) != 0) {
198193 if (time_after(jiffies, timeout))
....@@ -241,18 +236,15 @@
241236 w5300_write(priv, W5300_SHARH,
242237 ndev->dev_addr[4] << 8 |
243238 ndev->dev_addr[5]);
244
- mmiowb();
245239 }
246240
247241 static void w5300_hw_reset(struct w5300_priv *priv)
248242 {
249243 w5300_write_direct(priv, W5300_MR, MR_RST);
250
- mmiowb();
251244 mdelay(5);
252245 w5300_write_direct(priv, W5300_MR, priv->indirect ?
253246 MR_WDF(7) | MR_PB | MR_IND :
254247 MR_WDF(7) | MR_PB);
255
- mmiowb();
256248 w5300_write(priv, W5300_IMR, 0);
257249 w5300_write_macaddr(priv);
258250
....@@ -264,24 +256,20 @@
264256 w5300_write32(priv, W5300_TMSRL, 64 << 24);
265257 w5300_write32(priv, W5300_TMSRH, 0);
266258 w5300_write(priv, W5300_MTYPE, 0x00ff);
267
- mmiowb();
268259 }
269260
270261 static void w5300_hw_start(struct w5300_priv *priv)
271262 {
272263 w5300_write(priv, W5300_S0_MR, priv->promisc ?
273264 S0_MR_MACRAW : S0_MR_MACRAW_MF);
274
- mmiowb();
275265 w5300_command(priv, S0_CR_OPEN);
276266 w5300_write(priv, W5300_S0_IMR, S0_IR_RECV | S0_IR_SENDOK);
277267 w5300_write(priv, W5300_IMR, IR_S0);
278
- mmiowb();
279268 }
280269
281270 static void w5300_hw_close(struct w5300_priv *priv)
282271 {
283272 w5300_write(priv, W5300_IMR, 0);
284
- mmiowb();
285273 w5300_command(priv, S0_CR_CLOSE);
286274 }
287275
....@@ -353,7 +341,7 @@
353341 }
354342 }
355343
356
-static void w5300_tx_timeout(struct net_device *ndev)
344
+static void w5300_tx_timeout(struct net_device *ndev, unsigned int txqueue)
357345 {
358346 struct w5300_priv *priv = netdev_priv(ndev);
359347
....@@ -372,7 +360,6 @@
372360 netif_stop_queue(ndev);
373361
374362 w5300_write_frame(priv, skb->data, skb->len);
375
- mmiowb();
376363 ndev->stats.tx_packets++;
377364 ndev->stats.tx_bytes += skb->len;
378365 dev_kfree_skb(skb);
....@@ -419,7 +406,6 @@
419406 if (rx_count < budget) {
420407 napi_complete_done(napi, rx_count);
421408 w5300_write(priv, W5300_IMR, IR_S0);
422
- mmiowb();
423409 }
424410
425411 return rx_count;
....@@ -434,7 +420,6 @@
434420 if (!ir)
435421 return IRQ_NONE;
436422 w5300_write(priv, W5300_S0_IR, ir);
437
- mmiowb();
438423
439424 if (ir & S0_IR_SENDOK) {
440425 netif_dbg(priv, tx_done, ndev, "tx done\n");
....@@ -444,7 +429,6 @@
444429 if (ir & S0_IR_RECV) {
445430 if (napi_schedule_prep(&priv->napi)) {
446431 w5300_write(priv, W5300_IMR, 0);
447
- mmiowb();
448432 __napi_schedule(&priv->napi);
449433 }
450434 }
....@@ -661,8 +645,7 @@
661645 #ifdef CONFIG_PM_SLEEP
662646 static int w5300_suspend(struct device *dev)
663647 {
664
- struct platform_device *pdev = to_platform_device(dev);
665
- struct net_device *ndev = platform_get_drvdata(pdev);
648
+ struct net_device *ndev = dev_get_drvdata(dev);
666649 struct w5300_priv *priv = netdev_priv(ndev);
667650
668651 if (netif_running(ndev)) {
....@@ -676,8 +659,7 @@
676659
677660 static int w5300_resume(struct device *dev)
678661 {
679
- struct platform_device *pdev = to_platform_device(dev);
680
- struct net_device *ndev = platform_get_drvdata(pdev);
662
+ struct net_device *ndev = dev_get_drvdata(dev);
681663 struct w5300_priv *priv = netdev_priv(ndev);
682664
683665 if (!netif_running(ndev)) {