Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'bcm4908_enet-post-review-fixes'

Rafał Miłecki says:

====================
bcm4908_enet: post-review fixes

V2 of my BCM4908 Ethernet patchset was applied to the net-next.git and
it was later that is received some extra reviews. I'm sending patches
that handle pointed out issues.

David: earler I missed that V2 was applied and I sent V3 and V4 of my
inital patchset. Sorry for that. I think it's the best to ignore V3 and
V4 I sent and proceed with this fixes patchset instead.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>

+123 -126
+6 -3
Documentation/devicetree/bindings/net/brcm,bcm4908enet.yaml Documentation/devicetree/bindings/net/brcm,bcm4908-enet.yaml
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause 2 2 %YAML 1.2 3 3 --- 4 - $id: http://devicetree.org/schemas/net/brcm,bcm4908enet.yaml# 4 + $id: http://devicetree.org/schemas/net/brcm,bcm4908-enet.yaml# 5 5 $schema: http://devicetree.org/meta-schemas/core.yaml# 6 6 7 7 title: Broadcom BCM4908 Ethernet controller ··· 11 11 maintainers: 12 12 - Rafał Miłecki <rafal@milecki.pl> 13 13 14 + allOf: 15 + - $ref: ethernet-controller.yaml# 16 + 14 17 properties: 15 18 compatible: 16 - const: brcm,bcm4908enet 19 + const: brcm,bcm4908-enet 17 20 18 21 reg: 19 22 maxItems: 1 ··· 40 37 #include <dt-bindings/interrupt-controller/arm-gic.h> 41 38 42 39 ethernet@80002000 { 43 - compatible = "brcm,bcm4908enet"; 40 + compatible = "brcm,bcm4908-enet"; 44 41 reg = <0x80002000 0x1000>; 45 42 46 43 interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
+2 -2
MAINTAINERS
··· 3450 3450 M: bcm-kernel-feedback-list@broadcom.com 3451 3451 L: netdev@vger.kernel.org 3452 3452 S: Maintained 3453 - F: Documentation/devicetree/bindings/net/brcm,bcm4908enet.yaml 3454 - F: drivers/net/ethernet/broadcom/bcm4908enet.* 3453 + F: Documentation/devicetree/bindings/net/brcm,bcm4908-enet.yaml 3454 + F: drivers/net/ethernet/broadcom/bcm4908_enet.* 3455 3455 F: drivers/net/ethernet/broadcom/unimac.h 3456 3456 3457 3457 BROADCOM BCM5301X ARM ARCHITECTURE
+1 -1
drivers/net/ethernet/broadcom/Kconfig
··· 51 51 depends on B44_PCI_AUTOSELECT && B44_PCICORE_AUTOSELECT 52 52 default y 53 53 54 - config BCM4908ENET 54 + config BCM4908_ENET 55 55 tristate "Broadcom BCM4908 internal mac support" 56 56 depends on ARCH_BCM4908 || COMPILE_TEST 57 57 default y
+1 -1
drivers/net/ethernet/broadcom/Makefile
··· 4 4 # 5 5 6 6 obj-$(CONFIG_B44) += b44.o 7 - obj-$(CONFIG_BCM4908ENET) += bcm4908enet.o 7 + obj-$(CONFIG_BCM4908_ENET) += bcm4908_enet.o 8 8 obj-$(CONFIG_BCM63XX_ENET) += bcm63xx_enet.o 9 9 obj-$(CONFIG_BCMGENET) += genet/ 10 10 obj-$(CONFIG_BNX2) += bnx2.o
+111 -117
drivers/net/ethernet/broadcom/bcm4908enet.c drivers/net/ethernet/broadcom/bcm4908_enet.c
··· 12 12 #include <linux/slab.h> 13 13 #include <linux/string.h> 14 14 15 - #include "bcm4908enet.h" 15 + #include "bcm4908_enet.h" 16 16 #include "unimac.h" 17 17 18 18 #define ENET_DMA_CH_RX_CFG ENET_DMA_CH0_CFG ··· 33 33 #define ENET_MTU_MAX 1500 /* Is it possible to support 2044? */ 34 34 #define ENET_MTU_MAX_EXTRA_SIZE 32 /* L2 */ 35 35 36 - struct bcm4908enet_dma_ring_bd { 36 + struct bcm4908_enet_dma_ring_bd { 37 37 __le32 ctl; 38 38 __le32 addr; 39 39 } __packed; 40 40 41 - struct bcm4908enet_dma_ring_slot { 41 + struct bcm4908_enet_dma_ring_slot { 42 42 struct sk_buff *skb; 43 43 unsigned int len; 44 44 dma_addr_t dma_addr; 45 45 }; 46 46 47 - struct bcm4908enet_dma_ring { 47 + struct bcm4908_enet_dma_ring { 48 48 int is_tx; 49 49 int read_idx; 50 50 int write_idx; ··· 54 54 55 55 union { 56 56 void *cpu_addr; 57 - struct bcm4908enet_dma_ring_bd *buf_desc; 57 + struct bcm4908_enet_dma_ring_bd *buf_desc; 58 58 }; 59 59 dma_addr_t dma_addr; 60 60 61 - struct bcm4908enet_dma_ring_slot *slots; 61 + struct bcm4908_enet_dma_ring_slot *slots; 62 62 }; 63 63 64 - struct bcm4908enet { 64 + struct bcm4908_enet { 65 65 struct device *dev; 66 66 struct net_device *netdev; 67 67 struct napi_struct napi; 68 68 void __iomem *base; 69 69 70 - struct bcm4908enet_dma_ring tx_ring; 71 - struct bcm4908enet_dma_ring rx_ring; 70 + struct bcm4908_enet_dma_ring tx_ring; 71 + struct bcm4908_enet_dma_ring rx_ring; 72 72 }; 73 73 74 74 /*** 75 75 * R/W ops 76 76 */ 77 77 78 - static inline u32 enet_read(struct bcm4908enet *enet, u16 offset) 78 + static u32 enet_read(struct bcm4908_enet *enet, u16 offset) 79 79 { 80 80 return readl(enet->base + offset); 81 81 } 82 82 83 - static inline void enet_write(struct bcm4908enet *enet, u16 offset, u32 value) 83 + static void enet_write(struct bcm4908_enet *enet, u16 offset, u32 value) 84 84 { 85 85 writel(value, enet->base + offset); 86 86 } 87 87 88 - static inline void enet_maskset(struct bcm4908enet *enet, u16 offset, u32 mask, u32 set) 88 + static void enet_maskset(struct bcm4908_enet *enet, u16 offset, u32 mask, u32 set) 89 89 { 90 90 u32 val; 91 91 ··· 96 96 enet_write(enet, offset, val); 97 97 } 98 98 99 - static inline void enet_set(struct bcm4908enet *enet, u16 offset, u32 set) 99 + static void enet_set(struct bcm4908_enet *enet, u16 offset, u32 set) 100 100 { 101 101 enet_maskset(enet, offset, set, set); 102 102 } 103 103 104 - static inline u32 enet_umac_read(struct bcm4908enet *enet, u16 offset) 104 + static u32 enet_umac_read(struct bcm4908_enet *enet, u16 offset) 105 105 { 106 106 return enet_read(enet, ENET_UNIMAC + offset); 107 107 } 108 108 109 - static inline void enet_umac_write(struct bcm4908enet *enet, u16 offset, u32 value) 109 + static void enet_umac_write(struct bcm4908_enet *enet, u16 offset, u32 value) 110 110 { 111 111 enet_write(enet, ENET_UNIMAC + offset, value); 112 112 } 113 113 114 - static inline void enet_umac_maskset(struct bcm4908enet *enet, u16 offset, u32 mask, u32 set) 115 - { 116 - enet_maskset(enet, ENET_UNIMAC + offset, mask, set); 117 - } 118 - 119 - static inline void enet_umac_set(struct bcm4908enet *enet, u16 offset, u32 set) 114 + static void enet_umac_set(struct bcm4908_enet *enet, u16 offset, u32 set) 120 115 { 121 116 enet_set(enet, ENET_UNIMAC + offset, set); 122 117 } ··· 120 125 * Helpers 121 126 */ 122 127 123 - static void bcm4908enet_intrs_on(struct bcm4908enet *enet) 128 + static void bcm4908_enet_intrs_on(struct bcm4908_enet *enet) 124 129 { 125 130 enet_write(enet, ENET_DMA_CH_RX_CFG + ENET_DMA_CH_CFG_INT_MASK, ENET_DMA_INT_DEFAULTS); 126 131 } 127 132 128 - static void bcm4908enet_intrs_off(struct bcm4908enet *enet) 133 + static void bcm4908_enet_intrs_off(struct bcm4908_enet *enet) 129 134 { 130 135 enet_write(enet, ENET_DMA_CH_RX_CFG + ENET_DMA_CH_CFG_INT_MASK, 0); 131 136 } 132 137 133 - static void bcm4908enet_intrs_ack(struct bcm4908enet *enet) 138 + static void bcm4908_enet_intrs_ack(struct bcm4908_enet *enet) 134 139 { 135 140 enet_write(enet, ENET_DMA_CH_RX_CFG + ENET_DMA_CH_CFG_INT_STAT, ENET_DMA_INT_DEFAULTS); 136 141 } ··· 139 144 * DMA 140 145 */ 141 146 142 - static int bcm4908_dma_alloc_buf_descs(struct bcm4908enet *enet, struct bcm4908enet_dma_ring *ring) 147 + static int bcm4908_dma_alloc_buf_descs(struct bcm4908_enet *enet, 148 + struct bcm4908_enet_dma_ring *ring) 143 149 { 144 - int size = ring->length * sizeof(struct bcm4908enet_dma_ring_bd); 150 + int size = ring->length * sizeof(struct bcm4908_enet_dma_ring_bd); 145 151 struct device *dev = enet->dev; 146 152 147 153 ring->cpu_addr = dma_alloc_coherent(dev, size, &ring->dma_addr, GFP_KERNEL); ··· 158 162 if (!ring->slots) 159 163 goto err_free_buf_descs; 160 164 161 - memset(ring->cpu_addr, 0, size); 162 - 163 165 ring->read_idx = 0; 164 166 ring->write_idx = 0; 165 167 ··· 168 174 return -ENOMEM; 169 175 } 170 176 171 - static void bcm4908enet_dma_free(struct bcm4908enet *enet) 177 + static void bcm4908_enet_dma_free(struct bcm4908_enet *enet) 172 178 { 173 - struct bcm4908enet_dma_ring *tx_ring = &enet->tx_ring; 174 - struct bcm4908enet_dma_ring *rx_ring = &enet->rx_ring; 179 + struct bcm4908_enet_dma_ring *tx_ring = &enet->tx_ring; 180 + struct bcm4908_enet_dma_ring *rx_ring = &enet->rx_ring; 175 181 struct device *dev = enet->dev; 176 182 int size; 177 183 178 - size = rx_ring->length * sizeof(struct bcm4908enet_dma_ring_bd); 184 + size = rx_ring->length * sizeof(struct bcm4908_enet_dma_ring_bd); 179 185 if (rx_ring->cpu_addr) 180 186 dma_free_coherent(dev, size, rx_ring->cpu_addr, rx_ring->dma_addr); 181 187 kfree(rx_ring->slots); 182 188 183 - size = tx_ring->length * sizeof(struct bcm4908enet_dma_ring_bd); 189 + size = tx_ring->length * sizeof(struct bcm4908_enet_dma_ring_bd); 184 190 if (tx_ring->cpu_addr) 185 191 dma_free_coherent(dev, size, tx_ring->cpu_addr, tx_ring->dma_addr); 186 192 kfree(tx_ring->slots); 187 193 } 188 194 189 - static int bcm4908enet_dma_alloc(struct bcm4908enet *enet) 195 + static int bcm4908_enet_dma_alloc(struct bcm4908_enet *enet) 190 196 { 191 - struct bcm4908enet_dma_ring *tx_ring = &enet->tx_ring; 192 - struct bcm4908enet_dma_ring *rx_ring = &enet->rx_ring; 197 + struct bcm4908_enet_dma_ring *tx_ring = &enet->tx_ring; 198 + struct bcm4908_enet_dma_ring *rx_ring = &enet->rx_ring; 193 199 struct device *dev = enet->dev; 194 200 int err; 195 201 ··· 210 216 err = bcm4908_dma_alloc_buf_descs(enet, rx_ring); 211 217 if (err) { 212 218 dev_err(dev, "Failed to alloc RX buf descriptors: %d\n", err); 213 - bcm4908enet_dma_free(enet); 219 + bcm4908_enet_dma_free(enet); 214 220 return err; 215 221 } 216 222 217 223 return 0; 218 224 } 219 225 220 - static void bcm4908enet_dma_reset(struct bcm4908enet *enet) 226 + static void bcm4908_enet_dma_reset(struct bcm4908_enet *enet) 221 227 { 222 - struct bcm4908enet_dma_ring *rings[] = { &enet->rx_ring, &enet->tx_ring }; 228 + struct bcm4908_enet_dma_ring *rings[] = { &enet->rx_ring, &enet->tx_ring }; 223 229 int i; 224 230 225 231 /* Disable the DMA controller and channel */ ··· 229 235 230 236 /* Reset channels state */ 231 237 for (i = 0; i < ARRAY_SIZE(rings); i++) { 232 - struct bcm4908enet_dma_ring *ring = rings[i]; 238 + struct bcm4908_enet_dma_ring *ring = rings[i]; 233 239 234 240 enet_write(enet, ring->st_ram_block + ENET_DMA_CH_STATE_RAM_BASE_DESC_PTR, 0); 235 241 enet_write(enet, ring->st_ram_block + ENET_DMA_CH_STATE_RAM_STATE_DATA, 0); ··· 238 244 } 239 245 } 240 246 241 - static int bcm4908enet_dma_alloc_rx_buf(struct bcm4908enet *enet, unsigned int idx) 247 + static int bcm4908_enet_dma_alloc_rx_buf(struct bcm4908_enet *enet, unsigned int idx) 242 248 { 243 - struct bcm4908enet_dma_ring_bd *buf_desc = &enet->rx_ring.buf_desc[idx]; 244 - struct bcm4908enet_dma_ring_slot *slot = &enet->rx_ring.slots[idx]; 249 + struct bcm4908_enet_dma_ring_bd *buf_desc = &enet->rx_ring.buf_desc[idx]; 250 + struct bcm4908_enet_dma_ring_slot *slot = &enet->rx_ring.slots[idx]; 245 251 struct device *dev = enet->dev; 246 252 u32 tmp; 247 253 int err; ··· 271 277 return 0; 272 278 } 273 279 274 - static void bcm4908enet_dma_ring_init(struct bcm4908enet *enet, 275 - struct bcm4908enet_dma_ring *ring) 280 + static void bcm4908_enet_dma_ring_init(struct bcm4908_enet *enet, 281 + struct bcm4908_enet_dma_ring *ring) 276 282 { 277 283 int reset_channel = 0; /* We support only 1 main channel (with TX and RX) */ 278 284 int reset_subch = ring->is_tx ? 1 : 0; ··· 289 295 (uint32_t)ring->dma_addr); 290 296 } 291 297 292 - static void bcm4908enet_dma_uninit(struct bcm4908enet *enet) 298 + static void bcm4908_enet_dma_uninit(struct bcm4908_enet *enet) 293 299 { 294 - struct bcm4908enet_dma_ring *rx_ring = &enet->rx_ring; 295 - struct bcm4908enet_dma_ring_slot *slot; 300 + struct bcm4908_enet_dma_ring *rx_ring = &enet->rx_ring; 301 + struct bcm4908_enet_dma_ring_slot *slot; 296 302 struct device *dev = enet->dev; 297 303 int i; 298 304 ··· 306 312 } 307 313 } 308 314 309 - static int bcm4908enet_dma_init(struct bcm4908enet *enet) 315 + static int bcm4908_enet_dma_init(struct bcm4908_enet *enet) 310 316 { 311 - struct bcm4908enet_dma_ring *rx_ring = &enet->rx_ring; 317 + struct bcm4908_enet_dma_ring *rx_ring = &enet->rx_ring; 312 318 struct device *dev = enet->dev; 313 319 int err; 314 320 int i; 315 321 316 322 for (i = 0; i < rx_ring->length; i++) { 317 - err = bcm4908enet_dma_alloc_rx_buf(enet, i); 323 + err = bcm4908_enet_dma_alloc_rx_buf(enet, i); 318 324 if (err) { 319 325 dev_err(dev, "Failed to alloc RX buffer: %d\n", err); 320 - bcm4908enet_dma_uninit(enet); 326 + bcm4908_enet_dma_uninit(enet); 321 327 return err; 322 328 } 323 329 } 324 330 325 - bcm4908enet_dma_ring_init(enet, &enet->tx_ring); 326 - bcm4908enet_dma_ring_init(enet, &enet->rx_ring); 331 + bcm4908_enet_dma_ring_init(enet, &enet->tx_ring); 332 + bcm4908_enet_dma_ring_init(enet, &enet->rx_ring); 327 333 328 334 return 0; 329 335 } 330 336 331 - static void bcm4908enet_dma_tx_ring_ensable(struct bcm4908enet *enet, 332 - struct bcm4908enet_dma_ring *ring) 337 + static void bcm4908_enet_dma_tx_ring_enable(struct bcm4908_enet *enet, 338 + struct bcm4908_enet_dma_ring *ring) 333 339 { 334 340 enet_write(enet, ring->cfg_block + ENET_DMA_CH_CFG, ENET_DMA_CH_CFG_ENABLE); 335 341 } 336 342 337 - static void bcm4908enet_dma_tx_ring_disable(struct bcm4908enet *enet, 338 - struct bcm4908enet_dma_ring *ring) 343 + static void bcm4908_enet_dma_tx_ring_disable(struct bcm4908_enet *enet, 344 + struct bcm4908_enet_dma_ring *ring) 339 345 { 340 346 enet_write(enet, ring->cfg_block + ENET_DMA_CH_CFG, 0); 341 347 } 342 348 343 - static void bcm4908enet_dma_rx_ring_enable(struct bcm4908enet *enet, 344 - struct bcm4908enet_dma_ring *ring) 349 + static void bcm4908_enet_dma_rx_ring_enable(struct bcm4908_enet *enet, 350 + struct bcm4908_enet_dma_ring *ring) 345 351 { 346 352 enet_set(enet, ring->cfg_block + ENET_DMA_CH_CFG, ENET_DMA_CH_CFG_ENABLE); 347 353 } 348 354 349 - static void bcm4908enet_dma_rx_ring_disable(struct bcm4908enet *enet, 350 - struct bcm4908enet_dma_ring *ring) 355 + static void bcm4908_enet_dma_rx_ring_disable(struct bcm4908_enet *enet, 356 + struct bcm4908_enet_dma_ring *ring) 351 357 { 352 358 unsigned long deadline; 353 359 u32 tmp; ··· 370 376 * Ethernet driver 371 377 */ 372 378 373 - static void bcm4908enet_gmac_init(struct bcm4908enet *enet) 379 + static void bcm4908_enet_gmac_init(struct bcm4908_enet *enet) 374 380 { 375 381 u32 cmd; 376 382 ··· 401 407 ENET_GMAC_STATUS_LINK_UP); 402 408 } 403 409 404 - static irqreturn_t bcm4908enet_irq_handler(int irq, void *dev_id) 410 + static irqreturn_t bcm4908_enet_irq_handler(int irq, void *dev_id) 405 411 { 406 - struct bcm4908enet *enet = dev_id; 412 + struct bcm4908_enet *enet = dev_id; 407 413 408 - bcm4908enet_intrs_off(enet); 409 - bcm4908enet_intrs_ack(enet); 414 + bcm4908_enet_intrs_off(enet); 415 + bcm4908_enet_intrs_ack(enet); 410 416 411 417 napi_schedule(&enet->napi); 412 418 413 419 return IRQ_HANDLED; 414 420 } 415 421 416 - static int bcm4908enet_open(struct net_device *netdev) 422 + static int bcm4908_enet_open(struct net_device *netdev) 417 423 { 418 - struct bcm4908enet *enet = netdev_priv(netdev); 424 + struct bcm4908_enet *enet = netdev_priv(netdev); 419 425 struct device *dev = enet->dev; 420 426 int err; 421 427 422 - err = request_irq(netdev->irq, bcm4908enet_irq_handler, 0, "enet", enet); 428 + err = request_irq(netdev->irq, bcm4908_enet_irq_handler, 0, "enet", enet); 423 429 if (err) { 424 430 dev_err(dev, "Failed to request IRQ %d: %d\n", netdev->irq, err); 425 431 return err; 426 432 } 427 433 428 - bcm4908enet_gmac_init(enet); 429 - bcm4908enet_dma_reset(enet); 430 - bcm4908enet_dma_init(enet); 434 + bcm4908_enet_gmac_init(enet); 435 + bcm4908_enet_dma_reset(enet); 436 + bcm4908_enet_dma_init(enet); 431 437 432 438 enet_umac_set(enet, UMAC_CMD, CMD_TX_EN | CMD_RX_EN); 433 439 434 440 enet_set(enet, ENET_DMA_CONTROLLER_CFG, ENET_DMA_CTRL_CFG_MASTER_EN); 435 441 enet_maskset(enet, ENET_DMA_CONTROLLER_CFG, ENET_DMA_CTRL_CFG_FLOWC_CH1_EN, 0); 436 - bcm4908enet_dma_rx_ring_enable(enet, &enet->rx_ring); 442 + bcm4908_enet_dma_rx_ring_enable(enet, &enet->rx_ring); 437 443 438 444 napi_enable(&enet->napi); 439 445 netif_carrier_on(netdev); 440 446 netif_start_queue(netdev); 441 447 442 - bcm4908enet_intrs_ack(enet); 443 - bcm4908enet_intrs_on(enet); 448 + bcm4908_enet_intrs_ack(enet); 449 + bcm4908_enet_intrs_on(enet); 444 450 445 451 return 0; 446 452 } 447 453 448 - static int bcm4908enet_stop(struct net_device *netdev) 454 + static int bcm4908_enet_stop(struct net_device *netdev) 449 455 { 450 - struct bcm4908enet *enet = netdev_priv(netdev); 456 + struct bcm4908_enet *enet = netdev_priv(netdev); 451 457 452 458 netif_stop_queue(netdev); 453 459 netif_carrier_off(netdev); 454 460 napi_disable(&enet->napi); 455 461 456 - bcm4908enet_dma_rx_ring_disable(enet, &enet->rx_ring); 457 - bcm4908enet_dma_tx_ring_disable(enet, &enet->tx_ring); 462 + bcm4908_enet_dma_rx_ring_disable(enet, &enet->rx_ring); 463 + bcm4908_enet_dma_tx_ring_disable(enet, &enet->tx_ring); 458 464 459 - bcm4908enet_dma_uninit(enet); 465 + bcm4908_enet_dma_uninit(enet); 460 466 461 467 free_irq(enet->netdev->irq, enet); 462 468 463 469 return 0; 464 470 } 465 471 466 - static int bcm4908enet_start_xmit(struct sk_buff *skb, struct net_device *netdev) 472 + static int bcm4908_enet_start_xmit(struct sk_buff *skb, struct net_device *netdev) 467 473 { 468 - struct bcm4908enet *enet = netdev_priv(netdev); 469 - struct bcm4908enet_dma_ring *ring = &enet->tx_ring; 470 - struct bcm4908enet_dma_ring_slot *slot; 474 + struct bcm4908_enet *enet = netdev_priv(netdev); 475 + struct bcm4908_enet_dma_ring *ring = &enet->tx_ring; 476 + struct bcm4908_enet_dma_ring_slot *slot; 471 477 struct device *dev = enet->dev; 472 - struct bcm4908enet_dma_ring_bd *buf_desc; 478 + struct bcm4908_enet_dma_ring_bd *buf_desc; 473 479 int free_buf_descs; 474 480 u32 tmp; 475 481 476 482 /* Free transmitted skbs */ 477 483 while (ring->read_idx != ring->write_idx) { 478 484 buf_desc = &ring->buf_desc[ring->read_idx]; 479 - if (buf_desc->ctl & DMA_CTL_STATUS_OWN) 485 + if (le32_to_cpu(buf_desc->ctl) & DMA_CTL_STATUS_OWN) 480 486 break; 481 487 slot = &ring->slots[ring->read_idx]; 482 488 ··· 519 525 buf_desc->addr = cpu_to_le32((uint32_t)slot->dma_addr); 520 526 buf_desc->ctl = cpu_to_le32(tmp); 521 527 522 - bcm4908enet_dma_tx_ring_ensable(enet, &enet->tx_ring); 528 + bcm4908_enet_dma_tx_ring_enable(enet, &enet->tx_ring); 523 529 524 530 if (++ring->write_idx == ring->length - 1) 525 531 ring->write_idx = 0; ··· 529 535 return NETDEV_TX_OK; 530 536 } 531 537 532 - static int bcm4908enet_poll(struct napi_struct *napi, int weight) 538 + static int bcm4908_enet_poll(struct napi_struct *napi, int weight) 533 539 { 534 - struct bcm4908enet *enet = container_of(napi, struct bcm4908enet, napi); 540 + struct bcm4908_enet *enet = container_of(napi, struct bcm4908_enet, napi); 535 541 struct device *dev = enet->dev; 536 542 int handled = 0; 537 543 538 544 while (handled < weight) { 539 - struct bcm4908enet_dma_ring_bd *buf_desc; 540 - struct bcm4908enet_dma_ring_slot slot; 545 + struct bcm4908_enet_dma_ring_bd *buf_desc; 546 + struct bcm4908_enet_dma_ring_slot slot; 541 547 u32 ctl; 542 548 int len; 543 549 int err; ··· 550 556 slot = enet->rx_ring.slots[enet->rx_ring.read_idx]; 551 557 552 558 /* Provide new buffer before unpinning the old one */ 553 - err = bcm4908enet_dma_alloc_rx_buf(enet, enet->rx_ring.read_idx); 559 + err = bcm4908_enet_dma_alloc_rx_buf(enet, enet->rx_ring.read_idx); 554 560 if (err) 555 561 break; 556 562 ··· 567 573 568 574 dma_unmap_single(dev, slot.dma_addr, slot.len, DMA_FROM_DEVICE); 569 575 570 - skb_put(slot.skb, len - 4 + 2); 576 + skb_put(slot.skb, len - ETH_FCS_LEN); 571 577 slot.skb->protocol = eth_type_trans(slot.skb, enet->netdev); 572 578 netif_receive_skb(slot.skb); 573 579 ··· 577 583 578 584 if (handled < weight) { 579 585 napi_complete_done(napi, handled); 580 - bcm4908enet_intrs_on(enet); 586 + bcm4908_enet_intrs_on(enet); 581 587 } 582 588 583 589 return handled; 584 590 } 585 591 586 - static const struct net_device_ops bcm96xx_netdev_ops = { 587 - .ndo_open = bcm4908enet_open, 588 - .ndo_stop = bcm4908enet_stop, 589 - .ndo_start_xmit = bcm4908enet_start_xmit, 592 + static const struct net_device_ops bcm4908_enet_netdev_ops = { 593 + .ndo_open = bcm4908_enet_open, 594 + .ndo_stop = bcm4908_enet_stop, 595 + .ndo_start_xmit = bcm4908_enet_start_xmit, 590 596 .ndo_set_mac_address = eth_mac_addr, 591 597 }; 592 598 593 - static int bcm4908enet_probe(struct platform_device *pdev) 599 + static int bcm4908_enet_probe(struct platform_device *pdev) 594 600 { 595 601 struct device *dev = &pdev->dev; 596 602 struct net_device *netdev; 597 - struct bcm4908enet *enet; 603 + struct bcm4908_enet *enet; 598 604 int err; 599 605 600 606 netdev = devm_alloc_etherdev(dev, sizeof(*enet)); ··· 617 623 618 624 dma_set_coherent_mask(dev, DMA_BIT_MASK(32)); 619 625 620 - err = bcm4908enet_dma_alloc(enet); 626 + err = bcm4908_enet_dma_alloc(enet); 621 627 if (err) 622 628 return err; 623 629 624 630 SET_NETDEV_DEV(netdev, &pdev->dev); 625 631 eth_hw_addr_random(netdev); 626 - netdev->netdev_ops = &bcm96xx_netdev_ops; 632 + netdev->netdev_ops = &bcm4908_enet_netdev_ops; 627 633 netdev->min_mtu = ETH_ZLEN; 628 634 netdev->mtu = ENET_MTU_MAX; 629 635 netdev->max_mtu = ENET_MTU_MAX; 630 - netif_napi_add(netdev, &enet->napi, bcm4908enet_poll, 64); 636 + netif_napi_add(netdev, &enet->napi, bcm4908_enet_poll, 64); 631 637 632 638 err = register_netdev(netdev); 633 639 if (err) { 634 - bcm4908enet_dma_free(enet); 640 + bcm4908_enet_dma_free(enet); 635 641 return err; 636 642 } 637 643 ··· 640 646 return 0; 641 647 } 642 648 643 - static int bcm4908enet_remove(struct platform_device *pdev) 649 + static int bcm4908_enet_remove(struct platform_device *pdev) 644 650 { 645 - struct bcm4908enet *enet = platform_get_drvdata(pdev); 651 + struct bcm4908_enet *enet = platform_get_drvdata(pdev); 646 652 647 653 unregister_netdev(enet->netdev); 648 654 netif_napi_del(&enet->napi); 649 - bcm4908enet_dma_free(enet); 655 + bcm4908_enet_dma_free(enet); 650 656 651 657 return 0; 652 658 } 653 659 654 - static const struct of_device_id bcm4908enet_of_match[] = { 655 - { .compatible = "brcm,bcm4908enet"}, 660 + static const struct of_device_id bcm4908_enet_of_match[] = { 661 + { .compatible = "brcm,bcm4908-enet"}, 656 662 {}, 657 663 }; 658 664 659 - static struct platform_driver bcm4908enet_driver = { 665 + static struct platform_driver bcm4908_enet_driver = { 660 666 .driver = { 661 - .name = "bcm4908enet", 662 - .of_match_table = bcm4908enet_of_match, 667 + .name = "bcm4908_enet", 668 + .of_match_table = bcm4908_enet_of_match, 663 669 }, 664 - .probe = bcm4908enet_probe, 665 - .remove = bcm4908enet_remove, 670 + .probe = bcm4908_enet_probe, 671 + .remove = bcm4908_enet_remove, 666 672 }; 667 - module_platform_driver(bcm4908enet_driver); 673 + module_platform_driver(bcm4908_enet_driver); 668 674 669 675 MODULE_LICENSE("GPL v2"); 670 - MODULE_DEVICE_TABLE(of, bcm4908enet_of_match); 676 + MODULE_DEVICE_TABLE(of, bcm4908_enet_of_match);
+2 -2
drivers/net/ethernet/broadcom/bcm4908enet.h drivers/net/ethernet/broadcom/bcm4908_enet.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 - #ifndef __BCM4908ENET_H 3 - #define __BCM4908ENET_H 2 + #ifndef __BCM4908_ENET_H 3 + #define __BCM4908_ENET_H 4 4 5 5 #define ENET_CONTROL 0x000 6 6 #define ENET_MIB_CTRL 0x004