37285f62738c9c599a57095b945308139fcbfbcc
[openwrt/staging/chunkeey.git] /
1 From 9d61d138ab30bbfe4a8609853c81e881c4054a0b Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
3 Date: Thu, 11 Feb 2021 13:12:34 +0100
4 Subject: [PATCH] net: broadcom: rename BCM4908 driver & update DT binding
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 compatible string was updated to match normal naming convention so
10 update driver as well
11
12 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
13 Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
14 Signed-off-by: David S. Miller <davem@davemloft.net>
15 ---
16 MAINTAINERS | 2 +-
17 drivers/net/ethernet/broadcom/Kconfig | 2 +-
18 drivers/net/ethernet/broadcom/Makefile | 2 +-
19 .../{bcm4908enet.c => bcm4908_enet.c} | 215 +++++++++---------
20 .../{bcm4908enet.h => bcm4908_enet.h} | 4 +-
21 5 files changed, 113 insertions(+), 112 deletions(-)
22 rename drivers/net/ethernet/broadcom/{bcm4908enet.c => bcm4908_enet.c} (68%)
23 rename drivers/net/ethernet/broadcom/{bcm4908enet.h => bcm4908_enet.h} (98%)
24
25 diff --git a/MAINTAINERS b/MAINTAINERS
26 index 68fcd0a6416b..99335fd22c0a 100644
27 --- a/MAINTAINERS
28 +++ b/MAINTAINERS
29 @@ -3451,7 +3451,7 @@ M: bcm-kernel-feedback-list@broadcom.com
30 L: netdev@vger.kernel.org
31 S: Maintained
32 F: Documentation/devicetree/bindings/net/brcm,bcm4908-enet.yaml
33 -F: drivers/net/ethernet/broadcom/bcm4908enet.*
34 +F: drivers/net/ethernet/broadcom/bcm4908_enet.*
35 F: drivers/net/ethernet/broadcom/unimac.h
36
37 BROADCOM BCM5301X ARM ARCHITECTURE
38 diff --git a/drivers/net/ethernet/broadcom/Kconfig b/drivers/net/ethernet/broadcom/Kconfig
39 index bcf9e0a410fd..f8a168b73307 100644
40 --- a/drivers/net/ethernet/broadcom/Kconfig
41 +++ b/drivers/net/ethernet/broadcom/Kconfig
42 @@ -51,7 +51,7 @@ config B44_PCI
43 depends on B44_PCI_AUTOSELECT && B44_PCICORE_AUTOSELECT
44 default y
45
46 -config BCM4908ENET
47 +config BCM4908_ENET
48 tristate "Broadcom BCM4908 internal mac support"
49 depends on ARCH_BCM4908 || COMPILE_TEST
50 default y
51 diff --git a/drivers/net/ethernet/broadcom/Makefile b/drivers/net/ethernet/broadcom/Makefile
52 index 379012de3569..0ddfb5b5d53c 100644
53 --- a/drivers/net/ethernet/broadcom/Makefile
54 +++ b/drivers/net/ethernet/broadcom/Makefile
55 @@ -4,7 +4,7 @@
56 #
57
58 obj-$(CONFIG_B44) += b44.o
59 -obj-$(CONFIG_BCM4908ENET) += bcm4908enet.o
60 +obj-$(CONFIG_BCM4908_ENET) += bcm4908_enet.o
61 obj-$(CONFIG_BCM63XX_ENET) += bcm63xx_enet.o
62 obj-$(CONFIG_BCMGENET) += genet/
63 obj-$(CONFIG_BNX2) += bnx2.o
64 diff --git a/drivers/net/ethernet/broadcom/bcm4908enet.c b/drivers/net/ethernet/broadcom/bcm4908_enet.c
65 similarity index 68%
66 rename from drivers/net/ethernet/broadcom/bcm4908enet.c
67 rename to drivers/net/ethernet/broadcom/bcm4908_enet.c
68 index d68b328e7596..e56348eb188f 100644
69 --- a/drivers/net/ethernet/broadcom/bcm4908enet.c
70 +++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c
71 @@ -12,7 +12,7 @@
72 #include <linux/slab.h>
73 #include <linux/string.h>
74
75 -#include "bcm4908enet.h"
76 +#include "bcm4908_enet.h"
77 #include "unimac.h"
78
79 #define ENET_DMA_CH_RX_CFG ENET_DMA_CH0_CFG
80 @@ -33,18 +33,18 @@
81 #define ENET_MTU_MAX 1500 /* Is it possible to support 2044? */
82 #define ENET_MTU_MAX_EXTRA_SIZE 32 /* L2 */
83
84 -struct bcm4908enet_dma_ring_bd {
85 +struct bcm4908_enet_dma_ring_bd {
86 __le32 ctl;
87 __le32 addr;
88 } __packed;
89
90 -struct bcm4908enet_dma_ring_slot {
91 +struct bcm4908_enet_dma_ring_slot {
92 struct sk_buff *skb;
93 unsigned int len;
94 dma_addr_t dma_addr;
95 };
96
97 -struct bcm4908enet_dma_ring {
98 +struct bcm4908_enet_dma_ring {
99 int is_tx;
100 int read_idx;
101 int write_idx;
102 @@ -54,38 +54,38 @@ struct bcm4908enet_dma_ring {
103
104 union {
105 void *cpu_addr;
106 - struct bcm4908enet_dma_ring_bd *buf_desc;
107 + struct bcm4908_enet_dma_ring_bd *buf_desc;
108 };
109 dma_addr_t dma_addr;
110
111 - struct bcm4908enet_dma_ring_slot *slots;
112 + struct bcm4908_enet_dma_ring_slot *slots;
113 };
114
115 -struct bcm4908enet {
116 +struct bcm4908_enet {
117 struct device *dev;
118 struct net_device *netdev;
119 struct napi_struct napi;
120 void __iomem *base;
121
122 - struct bcm4908enet_dma_ring tx_ring;
123 - struct bcm4908enet_dma_ring rx_ring;
124 + struct bcm4908_enet_dma_ring tx_ring;
125 + struct bcm4908_enet_dma_ring rx_ring;
126 };
127
128 /***
129 * R/W ops
130 */
131
132 -static inline u32 enet_read(struct bcm4908enet *enet, u16 offset)
133 +static inline u32 enet_read(struct bcm4908_enet *enet, u16 offset)
134 {
135 return readl(enet->base + offset);
136 }
137
138 -static inline void enet_write(struct bcm4908enet *enet, u16 offset, u32 value)
139 +static inline void enet_write(struct bcm4908_enet *enet, u16 offset, u32 value)
140 {
141 writel(value, enet->base + offset);
142 }
143
144 -static inline void enet_maskset(struct bcm4908enet *enet, u16 offset, u32 mask, u32 set)
145 +static inline void enet_maskset(struct bcm4908_enet *enet, u16 offset, u32 mask, u32 set)
146 {
147 u32 val;
148
149 @@ -96,27 +96,27 @@ static inline void enet_maskset(struct bcm4908enet *enet, u16 offset, u32 mask,
150 enet_write(enet, offset, val);
151 }
152
153 -static inline void enet_set(struct bcm4908enet *enet, u16 offset, u32 set)
154 +static inline void enet_set(struct bcm4908_enet *enet, u16 offset, u32 set)
155 {
156 enet_maskset(enet, offset, set, set);
157 }
158
159 -static inline u32 enet_umac_read(struct bcm4908enet *enet, u16 offset)
160 +static inline u32 enet_umac_read(struct bcm4908_enet *enet, u16 offset)
161 {
162 return enet_read(enet, ENET_UNIMAC + offset);
163 }
164
165 -static inline void enet_umac_write(struct bcm4908enet *enet, u16 offset, u32 value)
166 +static inline void enet_umac_write(struct bcm4908_enet *enet, u16 offset, u32 value)
167 {
168 enet_write(enet, ENET_UNIMAC + offset, value);
169 }
170
171 -static inline void enet_umac_maskset(struct bcm4908enet *enet, u16 offset, u32 mask, u32 set)
172 +static inline void enet_umac_maskset(struct bcm4908_enet *enet, u16 offset, u32 mask, u32 set)
173 {
174 enet_maskset(enet, ENET_UNIMAC + offset, mask, set);
175 }
176
177 -static inline void enet_umac_set(struct bcm4908enet *enet, u16 offset, u32 set)
178 +static inline void enet_umac_set(struct bcm4908_enet *enet, u16 offset, u32 set)
179 {
180 enet_set(enet, ENET_UNIMAC + offset, set);
181 }
182 @@ -125,17 +125,17 @@ static inline void enet_umac_set(struct bcm4908enet *enet, u16 offset, u32 set)
183 * Helpers
184 */
185
186 -static void bcm4908enet_intrs_on(struct bcm4908enet *enet)
187 +static void bcm4908_enet_intrs_on(struct bcm4908_enet *enet)
188 {
189 enet_write(enet, ENET_DMA_CH_RX_CFG + ENET_DMA_CH_CFG_INT_MASK, ENET_DMA_INT_DEFAULTS);
190 }
191
192 -static void bcm4908enet_intrs_off(struct bcm4908enet *enet)
193 +static void bcm4908_enet_intrs_off(struct bcm4908_enet *enet)
194 {
195 enet_write(enet, ENET_DMA_CH_RX_CFG + ENET_DMA_CH_CFG_INT_MASK, 0);
196 }
197
198 -static void bcm4908enet_intrs_ack(struct bcm4908enet *enet)
199 +static void bcm4908_enet_intrs_ack(struct bcm4908_enet *enet)
200 {
201 enet_write(enet, ENET_DMA_CH_RX_CFG + ENET_DMA_CH_CFG_INT_STAT, ENET_DMA_INT_DEFAULTS);
202 }
203 @@ -144,9 +144,10 @@ static void bcm4908enet_intrs_ack(struct bcm4908enet *enet)
204 * DMA
205 */
206
207 -static int bcm4908_dma_alloc_buf_descs(struct bcm4908enet *enet, struct bcm4908enet_dma_ring *ring)
208 +static int bcm4908_dma_alloc_buf_descs(struct bcm4908_enet *enet,
209 + struct bcm4908_enet_dma_ring *ring)
210 {
211 - int size = ring->length * sizeof(struct bcm4908enet_dma_ring_bd);
212 + int size = ring->length * sizeof(struct bcm4908_enet_dma_ring_bd);
213 struct device *dev = enet->dev;
214
215 ring->cpu_addr = dma_alloc_coherent(dev, size, &ring->dma_addr, GFP_KERNEL);
216 @@ -174,28 +175,28 @@ static int bcm4908_dma_alloc_buf_descs(struct bcm4908enet *enet, struct bcm4908e
217 return -ENOMEM;
218 }
219
220 -static void bcm4908enet_dma_free(struct bcm4908enet *enet)
221 +static void bcm4908_enet_dma_free(struct bcm4908_enet *enet)
222 {
223 - struct bcm4908enet_dma_ring *tx_ring = &enet->tx_ring;
224 - struct bcm4908enet_dma_ring *rx_ring = &enet->rx_ring;
225 + struct bcm4908_enet_dma_ring *tx_ring = &enet->tx_ring;
226 + struct bcm4908_enet_dma_ring *rx_ring = &enet->rx_ring;
227 struct device *dev = enet->dev;
228 int size;
229
230 - size = rx_ring->length * sizeof(struct bcm4908enet_dma_ring_bd);
231 + size = rx_ring->length * sizeof(struct bcm4908_enet_dma_ring_bd);
232 if (rx_ring->cpu_addr)
233 dma_free_coherent(dev, size, rx_ring->cpu_addr, rx_ring->dma_addr);
234 kfree(rx_ring->slots);
235
236 - size = tx_ring->length * sizeof(struct bcm4908enet_dma_ring_bd);
237 + size = tx_ring->length * sizeof(struct bcm4908_enet_dma_ring_bd);
238 if (tx_ring->cpu_addr)
239 dma_free_coherent(dev, size, tx_ring->cpu_addr, tx_ring->dma_addr);
240 kfree(tx_ring->slots);
241 }
242
243 -static int bcm4908enet_dma_alloc(struct bcm4908enet *enet)
244 +static int bcm4908_enet_dma_alloc(struct bcm4908_enet *enet)
245 {
246 - struct bcm4908enet_dma_ring *tx_ring = &enet->tx_ring;
247 - struct bcm4908enet_dma_ring *rx_ring = &enet->rx_ring;
248 + struct bcm4908_enet_dma_ring *tx_ring = &enet->tx_ring;
249 + struct bcm4908_enet_dma_ring *rx_ring = &enet->rx_ring;
250 struct device *dev = enet->dev;
251 int err;
252
253 @@ -216,16 +217,16 @@ static int bcm4908enet_dma_alloc(struct bcm4908enet *enet)
254 err = bcm4908_dma_alloc_buf_descs(enet, rx_ring);
255 if (err) {
256 dev_err(dev, "Failed to alloc RX buf descriptors: %d\n", err);
257 - bcm4908enet_dma_free(enet);
258 + bcm4908_enet_dma_free(enet);
259 return err;
260 }
261
262 return 0;
263 }
264
265 -static void bcm4908enet_dma_reset(struct bcm4908enet *enet)
266 +static void bcm4908_enet_dma_reset(struct bcm4908_enet *enet)
267 {
268 - struct bcm4908enet_dma_ring *rings[] = { &enet->rx_ring, &enet->tx_ring };
269 + struct bcm4908_enet_dma_ring *rings[] = { &enet->rx_ring, &enet->tx_ring };
270 int i;
271
272 /* Disable the DMA controller and channel */
273 @@ -235,7 +236,7 @@ static void bcm4908enet_dma_reset(struct bcm4908enet *enet)
274
275 /* Reset channels state */
276 for (i = 0; i < ARRAY_SIZE(rings); i++) {
277 - struct bcm4908enet_dma_ring *ring = rings[i];
278 + struct bcm4908_enet_dma_ring *ring = rings[i];
279
280 enet_write(enet, ring->st_ram_block + ENET_DMA_CH_STATE_RAM_BASE_DESC_PTR, 0);
281 enet_write(enet, ring->st_ram_block + ENET_DMA_CH_STATE_RAM_STATE_DATA, 0);
282 @@ -244,10 +245,10 @@ static void bcm4908enet_dma_reset(struct bcm4908enet *enet)
283 }
284 }
285
286 -static int bcm4908enet_dma_alloc_rx_buf(struct bcm4908enet *enet, unsigned int idx)
287 +static int bcm4908_enet_dma_alloc_rx_buf(struct bcm4908_enet *enet, unsigned int idx)
288 {
289 - struct bcm4908enet_dma_ring_bd *buf_desc = &enet->rx_ring.buf_desc[idx];
290 - struct bcm4908enet_dma_ring_slot *slot = &enet->rx_ring.slots[idx];
291 + struct bcm4908_enet_dma_ring_bd *buf_desc = &enet->rx_ring.buf_desc[idx];
292 + struct bcm4908_enet_dma_ring_slot *slot = &enet->rx_ring.slots[idx];
293 struct device *dev = enet->dev;
294 u32 tmp;
295 int err;
296 @@ -277,8 +278,8 @@ static int bcm4908enet_dma_alloc_rx_buf(struct bcm4908enet *enet, unsigned int i
297 return 0;
298 }
299
300 -static void bcm4908enet_dma_ring_init(struct bcm4908enet *enet,
301 - struct bcm4908enet_dma_ring *ring)
302 +static void bcm4908_enet_dma_ring_init(struct bcm4908_enet *enet,
303 + struct bcm4908_enet_dma_ring *ring)
304 {
305 int reset_channel = 0; /* We support only 1 main channel (with TX and RX) */
306 int reset_subch = ring->is_tx ? 1 : 0;
307 @@ -295,10 +296,10 @@ static void bcm4908enet_dma_ring_init(struct bcm4908enet *enet,
308 (uint32_t)ring->dma_addr);
309 }
310
311 -static void bcm4908enet_dma_uninit(struct bcm4908enet *enet)
312 +static void bcm4908_enet_dma_uninit(struct bcm4908_enet *enet)
313 {
314 - struct bcm4908enet_dma_ring *rx_ring = &enet->rx_ring;
315 - struct bcm4908enet_dma_ring_slot *slot;
316 + struct bcm4908_enet_dma_ring *rx_ring = &enet->rx_ring;
317 + struct bcm4908_enet_dma_ring_slot *slot;
318 struct device *dev = enet->dev;
319 int i;
320
321 @@ -312,48 +313,48 @@ static void bcm4908enet_dma_uninit(struct bcm4908enet *enet)
322 }
323 }
324
325 -static int bcm4908enet_dma_init(struct bcm4908enet *enet)
326 +static int bcm4908_enet_dma_init(struct bcm4908_enet *enet)
327 {
328 - struct bcm4908enet_dma_ring *rx_ring = &enet->rx_ring;
329 + struct bcm4908_enet_dma_ring *rx_ring = &enet->rx_ring;
330 struct device *dev = enet->dev;
331 int err;
332 int i;
333
334 for (i = 0; i < rx_ring->length; i++) {
335 - err = bcm4908enet_dma_alloc_rx_buf(enet, i);
336 + err = bcm4908_enet_dma_alloc_rx_buf(enet, i);
337 if (err) {
338 dev_err(dev, "Failed to alloc RX buffer: %d\n", err);
339 - bcm4908enet_dma_uninit(enet);
340 + bcm4908_enet_dma_uninit(enet);
341 return err;
342 }
343 }
344
345 - bcm4908enet_dma_ring_init(enet, &enet->tx_ring);
346 - bcm4908enet_dma_ring_init(enet, &enet->rx_ring);
347 + bcm4908_enet_dma_ring_init(enet, &enet->tx_ring);
348 + bcm4908_enet_dma_ring_init(enet, &enet->rx_ring);
349
350 return 0;
351 }
352
353 -static void bcm4908enet_dma_tx_ring_ensable(struct bcm4908enet *enet,
354 - struct bcm4908enet_dma_ring *ring)
355 +static void bcm4908_enet_dma_tx_ring_ensable(struct bcm4908_enet *enet,
356 + struct bcm4908_enet_dma_ring *ring)
357 {
358 enet_write(enet, ring->cfg_block + ENET_DMA_CH_CFG, ENET_DMA_CH_CFG_ENABLE);
359 }
360
361 -static void bcm4908enet_dma_tx_ring_disable(struct bcm4908enet *enet,
362 - struct bcm4908enet_dma_ring *ring)
363 +static void bcm4908_enet_dma_tx_ring_disable(struct bcm4908_enet *enet,
364 + struct bcm4908_enet_dma_ring *ring)
365 {
366 enet_write(enet, ring->cfg_block + ENET_DMA_CH_CFG, 0);
367 }
368
369 -static void bcm4908enet_dma_rx_ring_enable(struct bcm4908enet *enet,
370 - struct bcm4908enet_dma_ring *ring)
371 +static void bcm4908_enet_dma_rx_ring_enable(struct bcm4908_enet *enet,
372 + struct bcm4908_enet_dma_ring *ring)
373 {
374 enet_set(enet, ring->cfg_block + ENET_DMA_CH_CFG, ENET_DMA_CH_CFG_ENABLE);
375 }
376
377 -static void bcm4908enet_dma_rx_ring_disable(struct bcm4908enet *enet,
378 - struct bcm4908enet_dma_ring *ring)
379 +static void bcm4908_enet_dma_rx_ring_disable(struct bcm4908_enet *enet,
380 + struct bcm4908_enet_dma_ring *ring)
381 {
382 unsigned long deadline;
383 u32 tmp;
384 @@ -376,7 +377,7 @@ static void bcm4908enet_dma_rx_ring_disable(struct bcm4908enet *enet,
385 * Ethernet driver
386 */
387
388 -static void bcm4908enet_gmac_init(struct bcm4908enet *enet)
389 +static void bcm4908_enet_gmac_init(struct bcm4908_enet *enet)
390 {
391 u32 cmd;
392
393 @@ -407,75 +408,75 @@ static void bcm4908enet_gmac_init(struct bcm4908enet *enet)
394 ENET_GMAC_STATUS_LINK_UP);
395 }
396
397 -static irqreturn_t bcm4908enet_irq_handler(int irq, void *dev_id)
398 +static irqreturn_t bcm4908_enet_irq_handler(int irq, void *dev_id)
399 {
400 - struct bcm4908enet *enet = dev_id;
401 + struct bcm4908_enet *enet = dev_id;
402
403 - bcm4908enet_intrs_off(enet);
404 - bcm4908enet_intrs_ack(enet);
405 + bcm4908_enet_intrs_off(enet);
406 + bcm4908_enet_intrs_ack(enet);
407
408 napi_schedule(&enet->napi);
409
410 return IRQ_HANDLED;
411 }
412
413 -static int bcm4908enet_open(struct net_device *netdev)
414 +static int bcm4908_enet_open(struct net_device *netdev)
415 {
416 - struct bcm4908enet *enet = netdev_priv(netdev);
417 + struct bcm4908_enet *enet = netdev_priv(netdev);
418 struct device *dev = enet->dev;
419 int err;
420
421 - err = request_irq(netdev->irq, bcm4908enet_irq_handler, 0, "enet", enet);
422 + err = request_irq(netdev->irq, bcm4908_enet_irq_handler, 0, "enet", enet);
423 if (err) {
424 dev_err(dev, "Failed to request IRQ %d: %d\n", netdev->irq, err);
425 return err;
426 }
427
428 - bcm4908enet_gmac_init(enet);
429 - bcm4908enet_dma_reset(enet);
430 - bcm4908enet_dma_init(enet);
431 + bcm4908_enet_gmac_init(enet);
432 + bcm4908_enet_dma_reset(enet);
433 + bcm4908_enet_dma_init(enet);
434
435 enet_umac_set(enet, UMAC_CMD, CMD_TX_EN | CMD_RX_EN);
436
437 enet_set(enet, ENET_DMA_CONTROLLER_CFG, ENET_DMA_CTRL_CFG_MASTER_EN);
438 enet_maskset(enet, ENET_DMA_CONTROLLER_CFG, ENET_DMA_CTRL_CFG_FLOWC_CH1_EN, 0);
439 - bcm4908enet_dma_rx_ring_enable(enet, &enet->rx_ring);
440 + bcm4908_enet_dma_rx_ring_enable(enet, &enet->rx_ring);
441
442 napi_enable(&enet->napi);
443 netif_carrier_on(netdev);
444 netif_start_queue(netdev);
445
446 - bcm4908enet_intrs_ack(enet);
447 - bcm4908enet_intrs_on(enet);
448 + bcm4908_enet_intrs_ack(enet);
449 + bcm4908_enet_intrs_on(enet);
450
451 return 0;
452 }
453
454 -static int bcm4908enet_stop(struct net_device *netdev)
455 +static int bcm4908_enet_stop(struct net_device *netdev)
456 {
457 - struct bcm4908enet *enet = netdev_priv(netdev);
458 + struct bcm4908_enet *enet = netdev_priv(netdev);
459
460 netif_stop_queue(netdev);
461 netif_carrier_off(netdev);
462 napi_disable(&enet->napi);
463
464 - bcm4908enet_dma_rx_ring_disable(enet, &enet->rx_ring);
465 - bcm4908enet_dma_tx_ring_disable(enet, &enet->tx_ring);
466 + bcm4908_enet_dma_rx_ring_disable(enet, &enet->rx_ring);
467 + bcm4908_enet_dma_tx_ring_disable(enet, &enet->tx_ring);
468
469 - bcm4908enet_dma_uninit(enet);
470 + bcm4908_enet_dma_uninit(enet);
471
472 free_irq(enet->netdev->irq, enet);
473
474 return 0;
475 }
476
477 -static int bcm4908enet_start_xmit(struct sk_buff *skb, struct net_device *netdev)
478 +static int bcm4908_enet_start_xmit(struct sk_buff *skb, struct net_device *netdev)
479 {
480 - struct bcm4908enet *enet = netdev_priv(netdev);
481 - struct bcm4908enet_dma_ring *ring = &enet->tx_ring;
482 - struct bcm4908enet_dma_ring_slot *slot;
483 + struct bcm4908_enet *enet = netdev_priv(netdev);
484 + struct bcm4908_enet_dma_ring *ring = &enet->tx_ring;
485 + struct bcm4908_enet_dma_ring_slot *slot;
486 struct device *dev = enet->dev;
487 - struct bcm4908enet_dma_ring_bd *buf_desc;
488 + struct bcm4908_enet_dma_ring_bd *buf_desc;
489 int free_buf_descs;
490 u32 tmp;
491
492 @@ -525,7 +526,7 @@ static int bcm4908enet_start_xmit(struct sk_buff *skb, struct net_device *netdev
493 buf_desc->addr = cpu_to_le32((uint32_t)slot->dma_addr);
494 buf_desc->ctl = cpu_to_le32(tmp);
495
496 - bcm4908enet_dma_tx_ring_ensable(enet, &enet->tx_ring);
497 + bcm4908_enet_dma_tx_ring_ensable(enet, &enet->tx_ring);
498
499 if (++ring->write_idx == ring->length - 1)
500 ring->write_idx = 0;
501 @@ -535,15 +536,15 @@ static int bcm4908enet_start_xmit(struct sk_buff *skb, struct net_device *netdev
502 return NETDEV_TX_OK;
503 }
504
505 -static int bcm4908enet_poll(struct napi_struct *napi, int weight)
506 +static int bcm4908_enet_poll(struct napi_struct *napi, int weight)
507 {
508 - struct bcm4908enet *enet = container_of(napi, struct bcm4908enet, napi);
509 + struct bcm4908_enet *enet = container_of(napi, struct bcm4908_enet, napi);
510 struct device *dev = enet->dev;
511 int handled = 0;
512
513 while (handled < weight) {
514 - struct bcm4908enet_dma_ring_bd *buf_desc;
515 - struct bcm4908enet_dma_ring_slot slot;
516 + struct bcm4908_enet_dma_ring_bd *buf_desc;
517 + struct bcm4908_enet_dma_ring_slot slot;
518 u32 ctl;
519 int len;
520 int err;
521 @@ -556,7 +557,7 @@ static int bcm4908enet_poll(struct napi_struct *napi, int weight)
522 slot = enet->rx_ring.slots[enet->rx_ring.read_idx];
523
524 /* Provide new buffer before unpinning the old one */
525 - err = bcm4908enet_dma_alloc_rx_buf(enet, enet->rx_ring.read_idx);
526 + err = bcm4908_enet_dma_alloc_rx_buf(enet, enet->rx_ring.read_idx);
527 if (err)
528 break;
529
530 @@ -583,24 +584,24 @@ static int bcm4908enet_poll(struct napi_struct *napi, int weight)
531
532 if (handled < weight) {
533 napi_complete_done(napi, handled);
534 - bcm4908enet_intrs_on(enet);
535 + bcm4908_enet_intrs_on(enet);
536 }
537
538 return handled;
539 }
540
541 static const struct net_device_ops bcm96xx_netdev_ops = {
542 - .ndo_open = bcm4908enet_open,
543 - .ndo_stop = bcm4908enet_stop,
544 - .ndo_start_xmit = bcm4908enet_start_xmit,
545 + .ndo_open = bcm4908_enet_open,
546 + .ndo_stop = bcm4908_enet_stop,
547 + .ndo_start_xmit = bcm4908_enet_start_xmit,
548 .ndo_set_mac_address = eth_mac_addr,
549 };
550
551 -static int bcm4908enet_probe(struct platform_device *pdev)
552 +static int bcm4908_enet_probe(struct platform_device *pdev)
553 {
554 struct device *dev = &pdev->dev;
555 struct net_device *netdev;
556 - struct bcm4908enet *enet;
557 + struct bcm4908_enet *enet;
558 int err;
559
560 netdev = devm_alloc_etherdev(dev, sizeof(*enet));
561 @@ -623,7 +624,7 @@ static int bcm4908enet_probe(struct platform_device *pdev)
562
563 dma_set_coherent_mask(dev, DMA_BIT_MASK(32));
564
565 - err = bcm4908enet_dma_alloc(enet);
566 + err = bcm4908_enet_dma_alloc(enet);
567 if (err)
568 return err;
569
570 @@ -633,11 +634,11 @@ static int bcm4908enet_probe(struct platform_device *pdev)
571 netdev->min_mtu = ETH_ZLEN;
572 netdev->mtu = ENET_MTU_MAX;
573 netdev->max_mtu = ENET_MTU_MAX;
574 - netif_napi_add(netdev, &enet->napi, bcm4908enet_poll, 64);
575 + netif_napi_add(netdev, &enet->napi, bcm4908_enet_poll, 64);
576
577 err = register_netdev(netdev);
578 if (err) {
579 - bcm4908enet_dma_free(enet);
580 + bcm4908_enet_dma_free(enet);
581 return err;
582 }
583
584 @@ -646,31 +647,31 @@ static int bcm4908enet_probe(struct platform_device *pdev)
585 return 0;
586 }
587
588 -static int bcm4908enet_remove(struct platform_device *pdev)
589 +static int bcm4908_enet_remove(struct platform_device *pdev)
590 {
591 - struct bcm4908enet *enet = platform_get_drvdata(pdev);
592 + struct bcm4908_enet *enet = platform_get_drvdata(pdev);
593
594 unregister_netdev(enet->netdev);
595 netif_napi_del(&enet->napi);
596 - bcm4908enet_dma_free(enet);
597 + bcm4908_enet_dma_free(enet);
598
599 return 0;
600 }
601
602 -static const struct of_device_id bcm4908enet_of_match[] = {
603 - { .compatible = "brcm,bcm4908enet"},
604 +static const struct of_device_id bcm4908_enet_of_match[] = {
605 + { .compatible = "brcm,bcm4908-enet"},
606 {},
607 };
608
609 -static struct platform_driver bcm4908enet_driver = {
610 +static struct platform_driver bcm4908_enet_driver = {
611 .driver = {
612 - .name = "bcm4908enet",
613 - .of_match_table = bcm4908enet_of_match,
614 + .name = "bcm4908_enet",
615 + .of_match_table = bcm4908_enet_of_match,
616 },
617 - .probe = bcm4908enet_probe,
618 - .remove = bcm4908enet_remove,
619 + .probe = bcm4908_enet_probe,
620 + .remove = bcm4908_enet_remove,
621 };
622 -module_platform_driver(bcm4908enet_driver);
623 +module_platform_driver(bcm4908_enet_driver);
624
625 MODULE_LICENSE("GPL v2");
626 -MODULE_DEVICE_TABLE(of, bcm4908enet_of_match);
627 +MODULE_DEVICE_TABLE(of, bcm4908_enet_of_match);
628 diff --git a/drivers/net/ethernet/broadcom/bcm4908enet.h b/drivers/net/ethernet/broadcom/bcm4908_enet.h
629 similarity index 98%
630 rename from drivers/net/ethernet/broadcom/bcm4908enet.h
631 rename to drivers/net/ethernet/broadcom/bcm4908_enet.h
632 index 11aadf0715d3..8a3ede2da537 100644
633 --- a/drivers/net/ethernet/broadcom/bcm4908enet.h
634 +++ b/drivers/net/ethernet/broadcom/bcm4908_enet.h
635 @@ -1,6 +1,6 @@
636 /* SPDX-License-Identifier: GPL-2.0-only */
637 -#ifndef __BCM4908ENET_H
638 -#define __BCM4908ENET_H
639 +#ifndef __BCM4908_ENET_H
640 +#define __BCM4908_ENET_H
641
642 #define ENET_CONTROL 0x000
643 #define ENET_MIB_CTRL 0x004