mirror of
https://github.com/openwrt/openwrt.git
synced 2025-02-01 16:58:22 +00:00
bcm4908: use upstream accepted Ethernet driver patches
Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Signed-off-by: maurerr <mariusd84@gmail.com>
This commit is contained in:
parent
fd3242fb85
commit
13dab2b6b6
@ -1,6 +1,7 @@
|
|||||||
|
From 387d1c1819790aa8398c7cffab587f9a050a0d1a Mon Sep 17 00:00:00 2001
|
||||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||||
Date: Fri, 5 Feb 2021 21:57:41 +0100
|
Date: Sun, 7 Feb 2021 23:26:31 +0100
|
||||||
Subject: [PATCH 1/2] dt-bindings: net: document BCM4908 Ethernet controller
|
Subject: [PATCH] dt-bindings: net: document BCM4908 Ethernet controller
|
||||||
MIME-Version: 1.0
|
MIME-Version: 1.0
|
||||||
Content-Type: text/plain; charset=UTF-8
|
Content-Type: text/plain; charset=UTF-8
|
||||||
Content-Transfer-Encoding: 8bit
|
Content-Transfer-Encoding: 8bit
|
||||||
@ -8,18 +9,19 @@ Content-Transfer-Encoding: 8bit
|
|||||||
BCM4908 is a family of SoCs with integrated Ethernet controller.
|
BCM4908 is a family of SoCs with integrated Ethernet controller.
|
||||||
|
|
||||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||||
|
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||||
---
|
---
|
||||||
.../bindings/net/brcm,bcm4908-enet.yaml | 43 +++++++++++++++++++
|
.../bindings/net/brcm,bcm4908enet.yaml | 45 +++++++++++++++++++
|
||||||
1 file changed, 43 insertions(+)
|
1 file changed, 45 insertions(+)
|
||||||
create mode 100644 Documentation/devicetree/bindings/net/brcm,bcm4908-enet.yaml
|
create mode 100644 Documentation/devicetree/bindings/net/brcm,bcm4908enet.yaml
|
||||||
|
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/Documentation/devicetree/bindings/net/brcm,bcm4908-enet.yaml
|
+++ b/Documentation/devicetree/bindings/net/brcm,bcm4908enet.yaml
|
||||||
@@ -0,0 +1,43 @@
|
@@ -0,0 +1,45 @@
|
||||||
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
|
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
|
||||||
+%YAML 1.2
|
+%YAML 1.2
|
||||||
+---
|
+---
|
||||||
+$id: http://devicetree.org/schemas/net/brcm,bcm4908-enet.yaml#
|
+$id: http://devicetree.org/schemas/net/brcm,bcm4908enet.yaml#
|
||||||
+$schema: http://devicetree.org/meta-schemas/core.yaml#
|
+$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||||
+
|
+
|
||||||
+title: Broadcom BCM4908 Ethernet controller
|
+title: Broadcom BCM4908 Ethernet controller
|
||||||
@ -29,12 +31,9 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|||||||
+maintainers:
|
+maintainers:
|
||||||
+ - Rafał Miłecki <rafal@milecki.pl>
|
+ - Rafał Miłecki <rafal@milecki.pl>
|
||||||
+
|
+
|
||||||
+allOf:
|
|
||||||
+ - $ref: ethernet-controller.yaml#
|
|
||||||
+
|
|
||||||
+properties:
|
+properties:
|
||||||
+ compatible:
|
+ compatible:
|
||||||
+ const: brcm,bcm4908-enet
|
+ const: brcm,bcm4908enet
|
||||||
+
|
+
|
||||||
+ reg:
|
+ reg:
|
||||||
+ maxItems: 1
|
+ maxItems: 1
|
||||||
@ -42,9 +41,13 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|||||||
+ interrupts:
|
+ interrupts:
|
||||||
+ description: RX interrupt
|
+ description: RX interrupt
|
||||||
+
|
+
|
||||||
|
+ interrupt-names:
|
||||||
|
+ const: rx
|
||||||
|
+
|
||||||
+required:
|
+required:
|
||||||
+ - reg
|
+ - reg
|
||||||
+ - interrupts
|
+ - interrupts
|
||||||
|
+ - interrupt-names
|
||||||
+
|
+
|
||||||
+additionalProperties: false
|
+additionalProperties: false
|
||||||
+
|
+
|
||||||
@ -54,8 +57,9 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|||||||
+ #include <dt-bindings/interrupt-controller/arm-gic.h>
|
+ #include <dt-bindings/interrupt-controller/arm-gic.h>
|
||||||
+
|
+
|
||||||
+ ethernet@80002000 {
|
+ ethernet@80002000 {
|
||||||
+ compatible = "brcm,bcm4908-enet";
|
+ compatible = "brcm,bcm4908enet";
|
||||||
+ reg = <0x80002000 0x1000>;
|
+ reg = <0x80002000 0x1000>;
|
||||||
+
|
+
|
||||||
+ interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
|
+ interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
|
||||||
|
+ interrupt-names = "rx";
|
||||||
+ };
|
+ };
|
@ -1,28 +1,26 @@
|
|||||||
|
From 4feffeadbcb2e5b11cbbf191a33c245b74a5837b Mon Sep 17 00:00:00 2001
|
||||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||||
Date: Fri, 5 Feb 2021 21:59:51 +0100
|
Date: Sun, 7 Feb 2021 23:26:32 +0100
|
||||||
Subject: [PATCH 2/2] net: broadcom: bcm4908_enet: add BCM4908 controller
|
Subject: [PATCH] net: broadcom: bcm4908enet: add BCM4908 controller driver
|
||||||
driver
|
|
||||||
MIME-Version: 1.0
|
MIME-Version: 1.0
|
||||||
Content-Type: text/plain; charset=UTF-8
|
Content-Type: text/plain; charset=UTF-8
|
||||||
Content-Transfer-Encoding: 8bit
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
BCM4908 SoCs family has integrated Ethernel controller that includes
|
BCM4908 SoCs family uses Ethernel controller that includes UniMAC but
|
||||||
UniMAC but uses different DMA engine (than other controllers) and
|
uses different DMA engine (than other controllers) and requires
|
||||||
requires different programming.
|
different programming.
|
||||||
|
|
||||||
Ethernet controller in BCM4908 is always connected to the internal SF2
|
|
||||||
switch's port and uses fixed link.
|
|
||||||
|
|
||||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||||
|
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||||
---
|
---
|
||||||
MAINTAINERS | 9 +
|
MAINTAINERS | 9 +
|
||||||
drivers/net/ethernet/broadcom/Kconfig | 8 +
|
drivers/net/ethernet/broadcom/Kconfig | 8 +
|
||||||
drivers/net/ethernet/broadcom/Makefile | 1 +
|
drivers/net/ethernet/broadcom/Makefile | 1 +
|
||||||
drivers/net/ethernet/broadcom/bcm4908_enet.c | 671 +++++++++++++++++++
|
drivers/net/ethernet/broadcom/bcm4908enet.c | 676 ++++++++++++++++++++
|
||||||
drivers/net/ethernet/broadcom/bcm4908_enet.h | 96 +++
|
drivers/net/ethernet/broadcom/bcm4908enet.h | 96 +++
|
||||||
5 files changed, 785 insertions(+)
|
5 files changed, 790 insertions(+)
|
||||||
create mode 100644 drivers/net/ethernet/broadcom/bcm4908_enet.c
|
create mode 100644 drivers/net/ethernet/broadcom/bcm4908enet.c
|
||||||
create mode 100644 drivers/net/ethernet/broadcom/bcm4908_enet.h
|
create mode 100644 drivers/net/ethernet/broadcom/bcm4908enet.h
|
||||||
|
|
||||||
--- a/MAINTAINERS
|
--- a/MAINTAINERS
|
||||||
+++ b/MAINTAINERS
|
+++ b/MAINTAINERS
|
||||||
@ -35,8 +33,8 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|||||||
+M: bcm-kernel-feedback-list@broadcom.com
|
+M: bcm-kernel-feedback-list@broadcom.com
|
||||||
+L: netdev@vger.kernel.org
|
+L: netdev@vger.kernel.org
|
||||||
+S: Maintained
|
+S: Maintained
|
||||||
+F: Documentation/devicetree/bindings/net/brcm,bcm4908-enet.yaml
|
+F: Documentation/devicetree/bindings/net/brcm,bcm4908enet.yaml
|
||||||
+F: drivers/net/ethernet/broadcom/bcm4908_enet.*
|
+F: drivers/net/ethernet/broadcom/bcm4908enet.*
|
||||||
+F: drivers/net/ethernet/broadcom/unimac.h
|
+F: drivers/net/ethernet/broadcom/unimac.h
|
||||||
+
|
+
|
||||||
BROADCOM BCM5301X ARM ARCHITECTURE
|
BROADCOM BCM5301X ARM ARCHITECTURE
|
||||||
@ -48,10 +46,10 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|||||||
depends on B44_PCI_AUTOSELECT && B44_PCICORE_AUTOSELECT
|
depends on B44_PCI_AUTOSELECT && B44_PCICORE_AUTOSELECT
|
||||||
default y
|
default y
|
||||||
|
|
||||||
+config BCM4908_ENET
|
+config BCM4908ENET
|
||||||
+ tristate "Broadcom BCM4908 internal mac support"
|
+ tristate "Broadcom BCM4908 internal mac support"
|
||||||
+ depends on ARCH_BCM4908 || COMPILE_TEST
|
+ depends on ARCH_BCM4908 || COMPILE_TEST
|
||||||
+ default ARCH_BCM4908
|
+ default y
|
||||||
+ help
|
+ help
|
||||||
+ This driver supports Ethernet controller integrated into Broadcom
|
+ This driver supports Ethernet controller integrated into Broadcom
|
||||||
+ BCM4908 family SoCs.
|
+ BCM4908 family SoCs.
|
||||||
@ -65,13 +63,13 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|||||||
#
|
#
|
||||||
|
|
||||||
obj-$(CONFIG_B44) += b44.o
|
obj-$(CONFIG_B44) += b44.o
|
||||||
+obj-$(CONFIG_BCM4908_ENET) += bcm4908_enet.o
|
+obj-$(CONFIG_BCM4908ENET) += bcm4908enet.o
|
||||||
obj-$(CONFIG_BCM63XX_ENET) += bcm63xx_enet.o
|
obj-$(CONFIG_BCM63XX_ENET) += bcm63xx_enet.o
|
||||||
obj-$(CONFIG_BCMGENET) += genet/
|
obj-$(CONFIG_BCMGENET) += genet/
|
||||||
obj-$(CONFIG_BNX2) += bnx2.o
|
obj-$(CONFIG_BNX2) += bnx2.o
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c
|
+++ b/drivers/net/ethernet/broadcom/bcm4908enet.c
|
||||||
@@ -0,0 +1,671 @@
|
@@ -0,0 +1,676 @@
|
||||||
+// SPDX-License-Identifier: GPL-2.0-only
|
+// SPDX-License-Identifier: GPL-2.0-only
|
||||||
+/*
|
+/*
|
||||||
+ * Copyright (C) 2021 Rafał Miłecki <rafal@milecki.pl>
|
+ * Copyright (C) 2021 Rafał Miłecki <rafal@milecki.pl>
|
||||||
@ -86,7 +84,7 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|||||||
+#include <linux/slab.h>
|
+#include <linux/slab.h>
|
||||||
+#include <linux/string.h>
|
+#include <linux/string.h>
|
||||||
+
|
+
|
||||||
+#include "bcm4908_enet.h"
|
+#include "bcm4908enet.h"
|
||||||
+#include "unimac.h"
|
+#include "unimac.h"
|
||||||
+
|
+
|
||||||
+#define ENET_DMA_CH_RX_CFG ENET_DMA_CH0_CFG
|
+#define ENET_DMA_CH_RX_CFG ENET_DMA_CH0_CFG
|
||||||
@ -107,18 +105,18 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|||||||
+#define ENET_MTU_MAX 1500 /* Is it possible to support 2044? */
|
+#define ENET_MTU_MAX 1500 /* Is it possible to support 2044? */
|
||||||
+#define ENET_MTU_MAX_EXTRA_SIZE 32 /* L2 */
|
+#define ENET_MTU_MAX_EXTRA_SIZE 32 /* L2 */
|
||||||
+
|
+
|
||||||
+struct bcm4908_enet_dma_ring_bd {
|
+struct bcm4908enet_dma_ring_bd {
|
||||||
+ __le32 ctl;
|
+ __le32 ctl;
|
||||||
+ __le32 addr;
|
+ __le32 addr;
|
||||||
+} __packed;
|
+} __packed;
|
||||||
+
|
+
|
||||||
+struct bcm4908_enet_dma_ring_slot {
|
+struct bcm4908enet_dma_ring_slot {
|
||||||
+ struct sk_buff *skb;
|
+ struct sk_buff *skb;
|
||||||
+ unsigned int len;
|
+ unsigned int len;
|
||||||
+ dma_addr_t dma_addr;
|
+ dma_addr_t dma_addr;
|
||||||
+};
|
+};
|
||||||
+
|
+
|
||||||
+struct bcm4908_enet_dma_ring {
|
+struct bcm4908enet_dma_ring {
|
||||||
+ int is_tx;
|
+ int is_tx;
|
||||||
+ int read_idx;
|
+ int read_idx;
|
||||||
+ int write_idx;
|
+ int write_idx;
|
||||||
@ -128,38 +126,38 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|||||||
+
|
+
|
||||||
+ union {
|
+ union {
|
||||||
+ void *cpu_addr;
|
+ void *cpu_addr;
|
||||||
+ struct bcm4908_enet_dma_ring_bd *buf_desc;
|
+ struct bcm4908enet_dma_ring_bd *buf_desc;
|
||||||
+ };
|
+ };
|
||||||
+ dma_addr_t dma_addr;
|
+ dma_addr_t dma_addr;
|
||||||
+
|
+
|
||||||
+ struct bcm4908_enet_dma_ring_slot *slots;
|
+ struct bcm4908enet_dma_ring_slot *slots;
|
||||||
+};
|
+};
|
||||||
+
|
+
|
||||||
+struct bcm4908_enet {
|
+struct bcm4908enet {
|
||||||
+ struct device *dev;
|
+ struct device *dev;
|
||||||
+ struct net_device *netdev;
|
+ struct net_device *netdev;
|
||||||
+ struct napi_struct napi;
|
+ struct napi_struct napi;
|
||||||
+ void __iomem *base;
|
+ void __iomem *base;
|
||||||
+
|
+
|
||||||
+ struct bcm4908_enet_dma_ring tx_ring;
|
+ struct bcm4908enet_dma_ring tx_ring;
|
||||||
+ struct bcm4908_enet_dma_ring rx_ring;
|
+ struct bcm4908enet_dma_ring rx_ring;
|
||||||
+};
|
+};
|
||||||
+
|
+
|
||||||
+/***
|
+/***
|
||||||
+ * R/W ops
|
+ * R/W ops
|
||||||
+ */
|
+ */
|
||||||
+
|
+
|
||||||
+static u32 enet_read(struct bcm4908_enet *enet, u16 offset)
|
+static inline u32 enet_read(struct bcm4908enet *enet, u16 offset)
|
||||||
+{
|
+{
|
||||||
+ return readl(enet->base + offset);
|
+ return readl(enet->base + offset);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static void enet_write(struct bcm4908_enet *enet, u16 offset, u32 value)
|
+static inline void enet_write(struct bcm4908enet *enet, u16 offset, u32 value)
|
||||||
+{
|
+{
|
||||||
+ writel(value, enet->base + offset);
|
+ writel(value, enet->base + offset);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static void enet_maskset(struct bcm4908_enet *enet, u16 offset, u32 mask, u32 set)
|
+static inline void enet_maskset(struct bcm4908enet *enet, u16 offset, u32 mask, u32 set)
|
||||||
+{
|
+{
|
||||||
+ u32 val;
|
+ u32 val;
|
||||||
+
|
+
|
||||||
@ -170,22 +168,27 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|||||||
+ enet_write(enet, offset, val);
|
+ enet_write(enet, offset, val);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static void enet_set(struct bcm4908_enet *enet, u16 offset, u32 set)
|
+static inline void enet_set(struct bcm4908enet *enet, u16 offset, u32 set)
|
||||||
+{
|
+{
|
||||||
+ enet_maskset(enet, offset, set, set);
|
+ enet_maskset(enet, offset, set, set);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static u32 enet_umac_read(struct bcm4908_enet *enet, u16 offset)
|
+static inline u32 enet_umac_read(struct bcm4908enet *enet, u16 offset)
|
||||||
+{
|
+{
|
||||||
+ return enet_read(enet, ENET_UNIMAC + offset);
|
+ return enet_read(enet, ENET_UNIMAC + offset);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static void enet_umac_write(struct bcm4908_enet *enet, u16 offset, u32 value)
|
+static inline void enet_umac_write(struct bcm4908enet *enet, u16 offset, u32 value)
|
||||||
+{
|
+{
|
||||||
+ enet_write(enet, ENET_UNIMAC + offset, value);
|
+ enet_write(enet, ENET_UNIMAC + offset, value);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static void enet_umac_set(struct bcm4908_enet *enet, u16 offset, u32 set)
|
+static inline void enet_umac_maskset(struct bcm4908enet *enet, u16 offset, u32 mask, u32 set)
|
||||||
|
+{
|
||||||
|
+ enet_maskset(enet, ENET_UNIMAC + offset, mask, set);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static inline void enet_umac_set(struct bcm4908enet *enet, u16 offset, u32 set)
|
||||||
+{
|
+{
|
||||||
+ enet_set(enet, ENET_UNIMAC + offset, set);
|
+ enet_set(enet, ENET_UNIMAC + offset, set);
|
||||||
+}
|
+}
|
||||||
@ -194,17 +197,17 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|||||||
+ * Helpers
|
+ * Helpers
|
||||||
+ */
|
+ */
|
||||||
+
|
+
|
||||||
+static void bcm4908_enet_intrs_on(struct bcm4908_enet *enet)
|
+static void bcm4908enet_intrs_on(struct bcm4908enet *enet)
|
||||||
+{
|
+{
|
||||||
+ enet_write(enet, ENET_DMA_CH_RX_CFG + ENET_DMA_CH_CFG_INT_MASK, ENET_DMA_INT_DEFAULTS);
|
+ enet_write(enet, ENET_DMA_CH_RX_CFG + ENET_DMA_CH_CFG_INT_MASK, ENET_DMA_INT_DEFAULTS);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static void bcm4908_enet_intrs_off(struct bcm4908_enet *enet)
|
+static void bcm4908enet_intrs_off(struct bcm4908enet *enet)
|
||||||
+{
|
+{
|
||||||
+ enet_write(enet, ENET_DMA_CH_RX_CFG + ENET_DMA_CH_CFG_INT_MASK, 0);
|
+ enet_write(enet, ENET_DMA_CH_RX_CFG + ENET_DMA_CH_CFG_INT_MASK, 0);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static void bcm4908_enet_intrs_ack(struct bcm4908_enet *enet)
|
+static void bcm4908enet_intrs_ack(struct bcm4908enet *enet)
|
||||||
+{
|
+{
|
||||||
+ enet_write(enet, ENET_DMA_CH_RX_CFG + ENET_DMA_CH_CFG_INT_STAT, ENET_DMA_INT_DEFAULTS);
|
+ enet_write(enet, ENET_DMA_CH_RX_CFG + ENET_DMA_CH_CFG_INT_STAT, ENET_DMA_INT_DEFAULTS);
|
||||||
+}
|
+}
|
||||||
@ -213,10 +216,9 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|||||||
+ * DMA
|
+ * DMA
|
||||||
+ */
|
+ */
|
||||||
+
|
+
|
||||||
+static int bcm4908_dma_alloc_buf_descs(struct bcm4908_enet *enet,
|
+static int bcm4908_dma_alloc_buf_descs(struct bcm4908enet *enet, struct bcm4908enet_dma_ring *ring)
|
||||||
+ struct bcm4908_enet_dma_ring *ring)
|
|
||||||
+{
|
+{
|
||||||
+ int size = ring->length * sizeof(struct bcm4908_enet_dma_ring_bd);
|
+ int size = ring->length * sizeof(struct bcm4908enet_dma_ring_bd);
|
||||||
+ struct device *dev = enet->dev;
|
+ struct device *dev = enet->dev;
|
||||||
+
|
+
|
||||||
+ ring->cpu_addr = dma_alloc_coherent(dev, size, &ring->dma_addr, GFP_KERNEL);
|
+ ring->cpu_addr = dma_alloc_coherent(dev, size, &ring->dma_addr, GFP_KERNEL);
|
||||||
@ -232,6 +234,8 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|||||||
+ if (!ring->slots)
|
+ if (!ring->slots)
|
||||||
+ goto err_free_buf_descs;
|
+ goto err_free_buf_descs;
|
||||||
+
|
+
|
||||||
|
+ memset(ring->cpu_addr, 0, size);
|
||||||
|
+
|
||||||
+ ring->read_idx = 0;
|
+ ring->read_idx = 0;
|
||||||
+ ring->write_idx = 0;
|
+ ring->write_idx = 0;
|
||||||
+
|
+
|
||||||
@ -242,28 +246,28 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|||||||
+ return -ENOMEM;
|
+ return -ENOMEM;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static void bcm4908_enet_dma_free(struct bcm4908_enet *enet)
|
+static void bcm4908enet_dma_free(struct bcm4908enet *enet)
|
||||||
+{
|
+{
|
||||||
+ struct bcm4908_enet_dma_ring *tx_ring = &enet->tx_ring;
|
+ struct bcm4908enet_dma_ring *tx_ring = &enet->tx_ring;
|
||||||
+ struct bcm4908_enet_dma_ring *rx_ring = &enet->rx_ring;
|
+ struct bcm4908enet_dma_ring *rx_ring = &enet->rx_ring;
|
||||||
+ struct device *dev = enet->dev;
|
+ struct device *dev = enet->dev;
|
||||||
+ int size;
|
+ int size;
|
||||||
+
|
+
|
||||||
+ size = rx_ring->length * sizeof(struct bcm4908_enet_dma_ring_bd);
|
+ size = rx_ring->length * sizeof(struct bcm4908enet_dma_ring_bd);
|
||||||
+ if (rx_ring->cpu_addr)
|
+ if (rx_ring->cpu_addr)
|
||||||
+ dma_free_coherent(dev, size, rx_ring->cpu_addr, rx_ring->dma_addr);
|
+ dma_free_coherent(dev, size, rx_ring->cpu_addr, rx_ring->dma_addr);
|
||||||
+ kfree(rx_ring->slots);
|
+ kfree(rx_ring->slots);
|
||||||
+
|
+
|
||||||
+ size = tx_ring->length * sizeof(struct bcm4908_enet_dma_ring_bd);
|
+ size = tx_ring->length * sizeof(struct bcm4908enet_dma_ring_bd);
|
||||||
+ if (tx_ring->cpu_addr)
|
+ if (tx_ring->cpu_addr)
|
||||||
+ dma_free_coherent(dev, size, tx_ring->cpu_addr, tx_ring->dma_addr);
|
+ dma_free_coherent(dev, size, tx_ring->cpu_addr, tx_ring->dma_addr);
|
||||||
+ kfree(tx_ring->slots);
|
+ kfree(tx_ring->slots);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static int bcm4908_enet_dma_alloc(struct bcm4908_enet *enet)
|
+static int bcm4908enet_dma_alloc(struct bcm4908enet *enet)
|
||||||
+{
|
+{
|
||||||
+ struct bcm4908_enet_dma_ring *tx_ring = &enet->tx_ring;
|
+ struct bcm4908enet_dma_ring *tx_ring = &enet->tx_ring;
|
||||||
+ struct bcm4908_enet_dma_ring *rx_ring = &enet->rx_ring;
|
+ struct bcm4908enet_dma_ring *rx_ring = &enet->rx_ring;
|
||||||
+ struct device *dev = enet->dev;
|
+ struct device *dev = enet->dev;
|
||||||
+ int err;
|
+ int err;
|
||||||
+
|
+
|
||||||
@ -284,16 +288,16 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|||||||
+ err = bcm4908_dma_alloc_buf_descs(enet, rx_ring);
|
+ err = bcm4908_dma_alloc_buf_descs(enet, rx_ring);
|
||||||
+ if (err) {
|
+ if (err) {
|
||||||
+ dev_err(dev, "Failed to alloc RX buf descriptors: %d\n", err);
|
+ dev_err(dev, "Failed to alloc RX buf descriptors: %d\n", err);
|
||||||
+ bcm4908_enet_dma_free(enet);
|
+ bcm4908enet_dma_free(enet);
|
||||||
+ return err;
|
+ return err;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ return 0;
|
+ return 0;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static void bcm4908_enet_dma_reset(struct bcm4908_enet *enet)
|
+static void bcm4908enet_dma_reset(struct bcm4908enet *enet)
|
||||||
+{
|
+{
|
||||||
+ struct bcm4908_enet_dma_ring *rings[] = { &enet->rx_ring, &enet->tx_ring };
|
+ struct bcm4908enet_dma_ring *rings[] = { &enet->rx_ring, &enet->tx_ring };
|
||||||
+ int i;
|
+ int i;
|
||||||
+
|
+
|
||||||
+ /* Disable the DMA controller and channel */
|
+ /* Disable the DMA controller and channel */
|
||||||
@ -303,7 +307,7 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|||||||
+
|
+
|
||||||
+ /* Reset channels state */
|
+ /* Reset channels state */
|
||||||
+ for (i = 0; i < ARRAY_SIZE(rings); i++) {
|
+ for (i = 0; i < ARRAY_SIZE(rings); i++) {
|
||||||
+ struct bcm4908_enet_dma_ring *ring = rings[i];
|
+ struct bcm4908enet_dma_ring *ring = rings[i];
|
||||||
+
|
+
|
||||||
+ enet_write(enet, ring->st_ram_block + ENET_DMA_CH_STATE_RAM_BASE_DESC_PTR, 0);
|
+ enet_write(enet, ring->st_ram_block + ENET_DMA_CH_STATE_RAM_BASE_DESC_PTR, 0);
|
||||||
+ enet_write(enet, ring->st_ram_block + ENET_DMA_CH_STATE_RAM_STATE_DATA, 0);
|
+ enet_write(enet, ring->st_ram_block + ENET_DMA_CH_STATE_RAM_STATE_DATA, 0);
|
||||||
@ -312,10 +316,10 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static int bcm4908_enet_dma_alloc_rx_buf(struct bcm4908_enet *enet, unsigned int idx)
|
+static int bcm4908enet_dma_alloc_rx_buf(struct bcm4908enet *enet, unsigned int idx)
|
||||||
+{
|
+{
|
||||||
+ struct bcm4908_enet_dma_ring_bd *buf_desc = &enet->rx_ring.buf_desc[idx];
|
+ struct bcm4908enet_dma_ring_bd *buf_desc = &enet->rx_ring.buf_desc[idx];
|
||||||
+ struct bcm4908_enet_dma_ring_slot *slot = &enet->rx_ring.slots[idx];
|
+ struct bcm4908enet_dma_ring_slot *slot = &enet->rx_ring.slots[idx];
|
||||||
+ struct device *dev = enet->dev;
|
+ struct device *dev = enet->dev;
|
||||||
+ u32 tmp;
|
+ u32 tmp;
|
||||||
+ int err;
|
+ int err;
|
||||||
@ -345,8 +349,8 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|||||||
+ return 0;
|
+ return 0;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static void bcm4908_enet_dma_ring_init(struct bcm4908_enet *enet,
|
+static void bcm4908enet_dma_ring_init(struct bcm4908enet *enet,
|
||||||
+ struct bcm4908_enet_dma_ring *ring)
|
+ struct bcm4908enet_dma_ring *ring)
|
||||||
+{
|
+{
|
||||||
+ int reset_channel = 0; /* We support only 1 main channel (with TX and RX) */
|
+ int reset_channel = 0; /* We support only 1 main channel (with TX and RX) */
|
||||||
+ int reset_subch = ring->is_tx ? 1 : 0;
|
+ int reset_subch = ring->is_tx ? 1 : 0;
|
||||||
@ -363,10 +367,10 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|||||||
+ (uint32_t)ring->dma_addr);
|
+ (uint32_t)ring->dma_addr);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static void bcm4908_enet_dma_uninit(struct bcm4908_enet *enet)
|
+static void bcm4908enet_dma_uninit(struct bcm4908enet *enet)
|
||||||
+{
|
+{
|
||||||
+ struct bcm4908_enet_dma_ring *rx_ring = &enet->rx_ring;
|
+ struct bcm4908enet_dma_ring *rx_ring = &enet->rx_ring;
|
||||||
+ struct bcm4908_enet_dma_ring_slot *slot;
|
+ struct bcm4908enet_dma_ring_slot *slot;
|
||||||
+ struct device *dev = enet->dev;
|
+ struct device *dev = enet->dev;
|
||||||
+ int i;
|
+ int i;
|
||||||
+
|
+
|
||||||
@ -380,48 +384,48 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static int bcm4908_enet_dma_init(struct bcm4908_enet *enet)
|
+static int bcm4908enet_dma_init(struct bcm4908enet *enet)
|
||||||
+{
|
+{
|
||||||
+ struct bcm4908_enet_dma_ring *rx_ring = &enet->rx_ring;
|
+ struct bcm4908enet_dma_ring *rx_ring = &enet->rx_ring;
|
||||||
+ struct device *dev = enet->dev;
|
+ struct device *dev = enet->dev;
|
||||||
+ int err;
|
+ int err;
|
||||||
+ int i;
|
+ int i;
|
||||||
+
|
+
|
||||||
+ for (i = 0; i < rx_ring->length; i++) {
|
+ for (i = 0; i < rx_ring->length; i++) {
|
||||||
+ err = bcm4908_enet_dma_alloc_rx_buf(enet, i);
|
+ err = bcm4908enet_dma_alloc_rx_buf(enet, i);
|
||||||
+ if (err) {
|
+ if (err) {
|
||||||
+ dev_err(dev, "Failed to alloc RX buffer: %d\n", err);
|
+ dev_err(dev, "Failed to alloc RX buffer: %d\n", err);
|
||||||
+ bcm4908_enet_dma_uninit(enet);
|
+ bcm4908enet_dma_uninit(enet);
|
||||||
+ return err;
|
+ return err;
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ bcm4908_enet_dma_ring_init(enet, &enet->tx_ring);
|
+ bcm4908enet_dma_ring_init(enet, &enet->tx_ring);
|
||||||
+ bcm4908_enet_dma_ring_init(enet, &enet->rx_ring);
|
+ bcm4908enet_dma_ring_init(enet, &enet->rx_ring);
|
||||||
+
|
+
|
||||||
+ return 0;
|
+ return 0;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static void bcm4908_enet_dma_tx_ring_enable(struct bcm4908_enet *enet,
|
+static void bcm4908enet_dma_tx_ring_ensable(struct bcm4908enet *enet,
|
||||||
+ struct bcm4908_enet_dma_ring *ring)
|
+ struct bcm4908enet_dma_ring *ring)
|
||||||
+{
|
+{
|
||||||
+ enet_write(enet, ring->cfg_block + ENET_DMA_CH_CFG, ENET_DMA_CH_CFG_ENABLE);
|
+ enet_write(enet, ring->cfg_block + ENET_DMA_CH_CFG, ENET_DMA_CH_CFG_ENABLE);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static void bcm4908_enet_dma_tx_ring_disable(struct bcm4908_enet *enet,
|
+static void bcm4908enet_dma_tx_ring_disable(struct bcm4908enet *enet,
|
||||||
+ struct bcm4908_enet_dma_ring *ring)
|
+ struct bcm4908enet_dma_ring *ring)
|
||||||
+{
|
+{
|
||||||
+ enet_write(enet, ring->cfg_block + ENET_DMA_CH_CFG, 0);
|
+ enet_write(enet, ring->cfg_block + ENET_DMA_CH_CFG, 0);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static void bcm4908_enet_dma_rx_ring_enable(struct bcm4908_enet *enet,
|
+static void bcm4908enet_dma_rx_ring_enable(struct bcm4908enet *enet,
|
||||||
+ struct bcm4908_enet_dma_ring *ring)
|
+ struct bcm4908enet_dma_ring *ring)
|
||||||
+{
|
+{
|
||||||
+ enet_set(enet, ring->cfg_block + ENET_DMA_CH_CFG, ENET_DMA_CH_CFG_ENABLE);
|
+ enet_set(enet, ring->cfg_block + ENET_DMA_CH_CFG, ENET_DMA_CH_CFG_ENABLE);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static void bcm4908_enet_dma_rx_ring_disable(struct bcm4908_enet *enet,
|
+static void bcm4908enet_dma_rx_ring_disable(struct bcm4908enet *enet,
|
||||||
+ struct bcm4908_enet_dma_ring *ring)
|
+ struct bcm4908enet_dma_ring *ring)
|
||||||
+{
|
+{
|
||||||
+ unsigned long deadline;
|
+ unsigned long deadline;
|
||||||
+ u32 tmp;
|
+ u32 tmp;
|
||||||
@ -444,7 +448,7 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|||||||
+ * Ethernet driver
|
+ * Ethernet driver
|
||||||
+ */
|
+ */
|
||||||
+
|
+
|
||||||
+static void bcm4908_enet_gmac_init(struct bcm4908_enet *enet)
|
+static void bcm4908enet_gmac_init(struct bcm4908enet *enet)
|
||||||
+{
|
+{
|
||||||
+ u32 cmd;
|
+ u32 cmd;
|
||||||
+
|
+
|
||||||
@ -475,82 +479,82 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|||||||
+ ENET_GMAC_STATUS_LINK_UP);
|
+ ENET_GMAC_STATUS_LINK_UP);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static irqreturn_t bcm4908_enet_irq_handler(int irq, void *dev_id)
|
+static irqreturn_t bcm4908enet_irq_handler(int irq, void *dev_id)
|
||||||
+{
|
+{
|
||||||
+ struct bcm4908_enet *enet = dev_id;
|
+ struct bcm4908enet *enet = dev_id;
|
||||||
+
|
+
|
||||||
+ bcm4908_enet_intrs_off(enet);
|
+ bcm4908enet_intrs_off(enet);
|
||||||
+ bcm4908_enet_intrs_ack(enet);
|
+ bcm4908enet_intrs_ack(enet);
|
||||||
+
|
+
|
||||||
+ napi_schedule(&enet->napi);
|
+ napi_schedule(&enet->napi);
|
||||||
+
|
+
|
||||||
+ return IRQ_HANDLED;
|
+ return IRQ_HANDLED;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static int bcm4908_enet_open(struct net_device *netdev)
|
+static int bcm4908enet_open(struct net_device *netdev)
|
||||||
+{
|
+{
|
||||||
+ struct bcm4908_enet *enet = netdev_priv(netdev);
|
+ struct bcm4908enet *enet = netdev_priv(netdev);
|
||||||
+ struct device *dev = enet->dev;
|
+ struct device *dev = enet->dev;
|
||||||
+ int err;
|
+ int err;
|
||||||
+
|
+
|
||||||
+ err = request_irq(netdev->irq, bcm4908_enet_irq_handler, 0, "enet", enet);
|
+ err = request_irq(netdev->irq, bcm4908enet_irq_handler, 0, "enet", enet);
|
||||||
+ if (err) {
|
+ if (err) {
|
||||||
+ dev_err(dev, "Failed to request IRQ %d: %d\n", netdev->irq, err);
|
+ dev_err(dev, "Failed to request IRQ %d: %d\n", netdev->irq, err);
|
||||||
+ return err;
|
+ return err;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ bcm4908_enet_gmac_init(enet);
|
+ bcm4908enet_gmac_init(enet);
|
||||||
+ bcm4908_enet_dma_reset(enet);
|
+ bcm4908enet_dma_reset(enet);
|
||||||
+ bcm4908_enet_dma_init(enet);
|
+ bcm4908enet_dma_init(enet);
|
||||||
+
|
+
|
||||||
+ enet_umac_set(enet, UMAC_CMD, CMD_TX_EN | CMD_RX_EN);
|
+ enet_umac_set(enet, UMAC_CMD, CMD_TX_EN | CMD_RX_EN);
|
||||||
+
|
+
|
||||||
+ enet_set(enet, ENET_DMA_CONTROLLER_CFG, ENET_DMA_CTRL_CFG_MASTER_EN);
|
+ enet_set(enet, ENET_DMA_CONTROLLER_CFG, ENET_DMA_CTRL_CFG_MASTER_EN);
|
||||||
+ enet_maskset(enet, ENET_DMA_CONTROLLER_CFG, ENET_DMA_CTRL_CFG_FLOWC_CH1_EN, 0);
|
+ enet_maskset(enet, ENET_DMA_CONTROLLER_CFG, ENET_DMA_CTRL_CFG_FLOWC_CH1_EN, 0);
|
||||||
+ bcm4908_enet_dma_rx_ring_enable(enet, &enet->rx_ring);
|
+ bcm4908enet_dma_rx_ring_enable(enet, &enet->rx_ring);
|
||||||
+
|
+
|
||||||
+ napi_enable(&enet->napi);
|
+ napi_enable(&enet->napi);
|
||||||
+ netif_carrier_on(netdev);
|
+ netif_carrier_on(netdev);
|
||||||
+ netif_start_queue(netdev);
|
+ netif_start_queue(netdev);
|
||||||
+
|
+
|
||||||
+ bcm4908_enet_intrs_ack(enet);
|
+ bcm4908enet_intrs_ack(enet);
|
||||||
+ bcm4908_enet_intrs_on(enet);
|
+ bcm4908enet_intrs_on(enet);
|
||||||
+
|
+
|
||||||
+ return 0;
|
+ return 0;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static int bcm4908_enet_stop(struct net_device *netdev)
|
+static int bcm4908enet_stop(struct net_device *netdev)
|
||||||
+{
|
+{
|
||||||
+ struct bcm4908_enet *enet = netdev_priv(netdev);
|
+ struct bcm4908enet *enet = netdev_priv(netdev);
|
||||||
+
|
+
|
||||||
+ netif_stop_queue(netdev);
|
+ netif_stop_queue(netdev);
|
||||||
+ netif_carrier_off(netdev);
|
+ netif_carrier_off(netdev);
|
||||||
+ napi_disable(&enet->napi);
|
+ napi_disable(&enet->napi);
|
||||||
+
|
+
|
||||||
+ bcm4908_enet_dma_rx_ring_disable(enet, &enet->rx_ring);
|
+ bcm4908enet_dma_rx_ring_disable(enet, &enet->rx_ring);
|
||||||
+ bcm4908_enet_dma_tx_ring_disable(enet, &enet->tx_ring);
|
+ bcm4908enet_dma_tx_ring_disable(enet, &enet->tx_ring);
|
||||||
+
|
+
|
||||||
+ bcm4908_enet_dma_uninit(enet);
|
+ bcm4908enet_dma_uninit(enet);
|
||||||
+
|
+
|
||||||
+ free_irq(enet->netdev->irq, enet);
|
+ free_irq(enet->netdev->irq, enet);
|
||||||
+
|
+
|
||||||
+ return 0;
|
+ return 0;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static int bcm4908_enet_start_xmit(struct sk_buff *skb, struct net_device *netdev)
|
+static int bcm4908enet_start_xmit(struct sk_buff *skb, struct net_device *netdev)
|
||||||
+{
|
+{
|
||||||
+ struct bcm4908_enet *enet = netdev_priv(netdev);
|
+ struct bcm4908enet *enet = netdev_priv(netdev);
|
||||||
+ struct bcm4908_enet_dma_ring *ring = &enet->tx_ring;
|
+ struct bcm4908enet_dma_ring *ring = &enet->tx_ring;
|
||||||
+ struct bcm4908_enet_dma_ring_slot *slot;
|
+ struct bcm4908enet_dma_ring_slot *slot;
|
||||||
+ struct device *dev = enet->dev;
|
+ struct device *dev = enet->dev;
|
||||||
+ struct bcm4908_enet_dma_ring_bd *buf_desc;
|
+ struct bcm4908enet_dma_ring_bd *buf_desc;
|
||||||
+ int free_buf_descs;
|
+ int free_buf_descs;
|
||||||
+ u32 tmp;
|
+ u32 tmp;
|
||||||
+
|
+
|
||||||
+ /* Free transmitted skbs */
|
+ /* Free transmitted skbs */
|
||||||
+ while (ring->read_idx != ring->write_idx) {
|
+ while (ring->read_idx != ring->write_idx) {
|
||||||
+ buf_desc = &ring->buf_desc[ring->read_idx];
|
+ buf_desc = &ring->buf_desc[ring->read_idx];
|
||||||
+ if (le32_to_cpu(buf_desc->ctl) & DMA_CTL_STATUS_OWN)
|
+ if (buf_desc->ctl & DMA_CTL_STATUS_OWN)
|
||||||
+ break;
|
+ break;
|
||||||
+ slot = &ring->slots[ring->read_idx];
|
+ slot = &ring->slots[ring->read_idx];
|
||||||
+
|
+
|
||||||
@ -593,7 +597,7 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|||||||
+ buf_desc->addr = cpu_to_le32((uint32_t)slot->dma_addr);
|
+ buf_desc->addr = cpu_to_le32((uint32_t)slot->dma_addr);
|
||||||
+ buf_desc->ctl = cpu_to_le32(tmp);
|
+ buf_desc->ctl = cpu_to_le32(tmp);
|
||||||
+
|
+
|
||||||
+ bcm4908_enet_dma_tx_ring_enable(enet, &enet->tx_ring);
|
+ bcm4908enet_dma_tx_ring_ensable(enet, &enet->tx_ring);
|
||||||
+
|
+
|
||||||
+ if (++ring->write_idx == ring->length - 1)
|
+ if (++ring->write_idx == ring->length - 1)
|
||||||
+ ring->write_idx = 0;
|
+ ring->write_idx = 0;
|
||||||
@ -603,15 +607,15 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|||||||
+ return NETDEV_TX_OK;
|
+ return NETDEV_TX_OK;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static int bcm4908_enet_poll(struct napi_struct *napi, int weight)
|
+static int bcm4908enet_poll(struct napi_struct *napi, int weight)
|
||||||
+{
|
+{
|
||||||
+ struct bcm4908_enet *enet = container_of(napi, struct bcm4908_enet, napi);
|
+ struct bcm4908enet *enet = container_of(napi, struct bcm4908enet, napi);
|
||||||
+ struct device *dev = enet->dev;
|
+ struct device *dev = enet->dev;
|
||||||
+ int handled = 0;
|
+ int handled = 0;
|
||||||
+
|
+
|
||||||
+ while (handled < weight) {
|
+ while (handled < weight) {
|
||||||
+ struct bcm4908_enet_dma_ring_bd *buf_desc;
|
+ struct bcm4908enet_dma_ring_bd *buf_desc;
|
||||||
+ struct bcm4908_enet_dma_ring_slot slot;
|
+ struct bcm4908enet_dma_ring_slot slot;
|
||||||
+ u32 ctl;
|
+ u32 ctl;
|
||||||
+ int len;
|
+ int len;
|
||||||
+ int err;
|
+ int err;
|
||||||
@ -624,7 +628,7 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|||||||
+ slot = enet->rx_ring.slots[enet->rx_ring.read_idx];
|
+ slot = enet->rx_ring.slots[enet->rx_ring.read_idx];
|
||||||
+
|
+
|
||||||
+ /* Provide new buffer before unpinning the old one */
|
+ /* Provide new buffer before unpinning the old one */
|
||||||
+ err = bcm4908_enet_dma_alloc_rx_buf(enet, enet->rx_ring.read_idx);
|
+ err = bcm4908enet_dma_alloc_rx_buf(enet, enet->rx_ring.read_idx);
|
||||||
+ if (err)
|
+ if (err)
|
||||||
+ break;
|
+ break;
|
||||||
+
|
+
|
||||||
@ -635,14 +639,13 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|||||||
+
|
+
|
||||||
+ if (len < ENET_MTU_MIN ||
|
+ if (len < ENET_MTU_MIN ||
|
||||||
+ (ctl & (DMA_CTL_STATUS_SOP | DMA_CTL_STATUS_EOP)) != (DMA_CTL_STATUS_SOP | DMA_CTL_STATUS_EOP)) {
|
+ (ctl & (DMA_CTL_STATUS_SOP | DMA_CTL_STATUS_EOP)) != (DMA_CTL_STATUS_SOP | DMA_CTL_STATUS_EOP)) {
|
||||||
+ kfree(slot.skb);
|
|
||||||
+ enet->netdev->stats.rx_dropped++;
|
+ enet->netdev->stats.rx_dropped++;
|
||||||
+ break;
|
+ break;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ dma_unmap_single(dev, slot.dma_addr, slot.len, DMA_FROM_DEVICE);
|
+ dma_unmap_single(dev, slot.dma_addr, slot.len, DMA_FROM_DEVICE);
|
||||||
+
|
+
|
||||||
+ skb_put(slot.skb, len - ETH_FCS_LEN);
|
+ skb_put(slot.skb, len - 4 + 2);
|
||||||
+ slot.skb->protocol = eth_type_trans(slot.skb, enet->netdev);
|
+ slot.skb->protocol = eth_type_trans(slot.skb, enet->netdev);
|
||||||
+ netif_receive_skb(slot.skb);
|
+ netif_receive_skb(slot.skb);
|
||||||
+
|
+
|
||||||
@ -652,24 +655,24 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|||||||
+
|
+
|
||||||
+ if (handled < weight) {
|
+ if (handled < weight) {
|
||||||
+ napi_complete_done(napi, handled);
|
+ napi_complete_done(napi, handled);
|
||||||
+ bcm4908_enet_intrs_on(enet);
|
+ bcm4908enet_intrs_on(enet);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ return handled;
|
+ return handled;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static const struct net_device_ops bcm4908_enet_netdev_ops = {
|
+static const struct net_device_ops bcm96xx_netdev_ops = {
|
||||||
+ .ndo_open = bcm4908_enet_open,
|
+ .ndo_open = bcm4908enet_open,
|
||||||
+ .ndo_stop = bcm4908_enet_stop,
|
+ .ndo_stop = bcm4908enet_stop,
|
||||||
+ .ndo_start_xmit = bcm4908_enet_start_xmit,
|
+ .ndo_start_xmit = bcm4908enet_start_xmit,
|
||||||
+ .ndo_set_mac_address = eth_mac_addr,
|
+ .ndo_set_mac_address = eth_mac_addr,
|
||||||
+};
|
+};
|
||||||
+
|
+
|
||||||
+static int bcm4908_enet_probe(struct platform_device *pdev)
|
+static int bcm4908enet_probe(struct platform_device *pdev)
|
||||||
+{
|
+{
|
||||||
+ struct device *dev = &pdev->dev;
|
+ struct device *dev = &pdev->dev;
|
||||||
+ struct net_device *netdev;
|
+ struct net_device *netdev;
|
||||||
+ struct bcm4908_enet *enet;
|
+ struct bcm4908enet *enet;
|
||||||
+ int err;
|
+ int err;
|
||||||
+
|
+
|
||||||
+ netdev = devm_alloc_etherdev(dev, sizeof(*enet));
|
+ netdev = devm_alloc_etherdev(dev, sizeof(*enet));
|
||||||
@ -686,27 +689,27 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|||||||
+ return PTR_ERR(enet->base);
|
+ return PTR_ERR(enet->base);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ netdev->irq = platform_get_irq(pdev, 0);
|
+ netdev->irq = platform_get_irq_byname(pdev, "rx");
|
||||||
+ if (netdev->irq < 0)
|
+ if (netdev->irq < 0)
|
||||||
+ return netdev->irq;
|
+ return netdev->irq;
|
||||||
+
|
+
|
||||||
+ dma_set_coherent_mask(dev, DMA_BIT_MASK(32));
|
+ dma_set_coherent_mask(dev, DMA_BIT_MASK(32));
|
||||||
+
|
+
|
||||||
+ err = bcm4908_enet_dma_alloc(enet);
|
+ err = bcm4908enet_dma_alloc(enet);
|
||||||
+ if (err)
|
+ if (err)
|
||||||
+ return err;
|
+ return err;
|
||||||
+
|
+
|
||||||
+ SET_NETDEV_DEV(netdev, &pdev->dev);
|
+ SET_NETDEV_DEV(netdev, &pdev->dev);
|
||||||
+ eth_hw_addr_random(netdev);
|
+ eth_hw_addr_random(netdev);
|
||||||
+ netdev->netdev_ops = &bcm4908_enet_netdev_ops;
|
+ netdev->netdev_ops = &bcm96xx_netdev_ops;
|
||||||
+ netdev->min_mtu = ETH_ZLEN;
|
+ netdev->min_mtu = ETH_ZLEN;
|
||||||
+ netdev->mtu = ENET_MTU_MAX;
|
+ netdev->mtu = ENET_MTU_MAX;
|
||||||
+ netdev->max_mtu = ENET_MTU_MAX;
|
+ netdev->max_mtu = ENET_MTU_MAX;
|
||||||
+ netif_napi_add(netdev, &enet->napi, bcm4908_enet_poll, 64);
|
+ netif_napi_add(netdev, &enet->napi, bcm4908enet_poll, 64);
|
||||||
+
|
+
|
||||||
+ err = register_netdev(netdev);
|
+ err = register_netdev(netdev);
|
||||||
+ if (err) {
|
+ if (err) {
|
||||||
+ bcm4908_enet_dma_free(enet);
|
+ bcm4908enet_dma_free(enet);
|
||||||
+ return err;
|
+ return err;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
@ -715,40 +718,40 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|||||||
+ return 0;
|
+ return 0;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static int bcm4908_enet_remove(struct platform_device *pdev)
|
+static int bcm4908enet_remove(struct platform_device *pdev)
|
||||||
+{
|
+{
|
||||||
+ struct bcm4908_enet *enet = platform_get_drvdata(pdev);
|
+ struct bcm4908enet *enet = platform_get_drvdata(pdev);
|
||||||
+
|
+
|
||||||
+ unregister_netdev(enet->netdev);
|
+ unregister_netdev(enet->netdev);
|
||||||
+ netif_napi_del(&enet->napi);
|
+ netif_napi_del(&enet->napi);
|
||||||
+ bcm4908_enet_dma_free(enet);
|
+ bcm4908enet_dma_free(enet);
|
||||||
+
|
+
|
||||||
+ return 0;
|
+ return 0;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static const struct of_device_id bcm4908_enet_of_match[] = {
|
+static const struct of_device_id bcm4908enet_of_match[] = {
|
||||||
+ { .compatible = "brcm,bcm4908-enet"},
|
+ { .compatible = "brcm,bcm4908enet"},
|
||||||
+ {},
|
+ {},
|
||||||
+};
|
+};
|
||||||
+
|
+
|
||||||
+static struct platform_driver bcm4908_enet_driver = {
|
+static struct platform_driver bcm4908enet_driver = {
|
||||||
+ .driver = {
|
+ .driver = {
|
||||||
+ .name = "bcm4908_enet",
|
+ .name = "bcm4908enet",
|
||||||
+ .of_match_table = bcm4908_enet_of_match,
|
+ .of_match_table = bcm4908enet_of_match,
|
||||||
+ },
|
+ },
|
||||||
+ .probe = bcm4908_enet_probe,
|
+ .probe = bcm4908enet_probe,
|
||||||
+ .remove = bcm4908_enet_remove,
|
+ .remove = bcm4908enet_remove,
|
||||||
+};
|
+};
|
||||||
+module_platform_driver(bcm4908_enet_driver);
|
+module_platform_driver(bcm4908enet_driver);
|
||||||
+
|
+
|
||||||
+MODULE_LICENSE("GPL v2");
|
+MODULE_LICENSE("GPL v2");
|
||||||
+MODULE_DEVICE_TABLE(of, bcm4908_enet_of_match);
|
+MODULE_DEVICE_TABLE(of, bcm4908enet_of_match);
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/drivers/net/ethernet/broadcom/bcm4908_enet.h
|
+++ b/drivers/net/ethernet/broadcom/bcm4908enet.h
|
||||||
@@ -0,0 +1,96 @@
|
@@ -0,0 +1,96 @@
|
||||||
+/* SPDX-License-Identifier: GPL-2.0-only */
|
+/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
+#ifndef __BCM4908_ENET_H
|
+#ifndef __BCM4908ENET_H
|
||||||
+#define __BCM4908_ENET_H
|
+#define __BCM4908ENET_H
|
||||||
+
|
+
|
||||||
+#define ENET_CONTROL 0x000
|
+#define ENET_CONTROL 0x000
|
||||||
+#define ENET_MIB_CTRL 0x004
|
+#define ENET_MIB_CTRL 0x004
|
@ -0,0 +1,68 @@
|
|||||||
|
From 6710c5b0674f8811f7d8fbfc526684e7ed77f765 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||||
|
Date: Thu, 11 Feb 2021 13:12:32 +0100
|
||||||
|
Subject: [PATCH] dt-bindings: net: rename BCM4908 Ethernet binding
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Rob pointed out that a normal convention is "brcm,bcm4908-enet" so
|
||||||
|
update whole binding to match it.
|
||||||
|
|
||||||
|
Suggested-by: Rob Herring <robh@kernel.org>
|
||||||
|
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||||
|
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
|
||||||
|
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||||
|
---
|
||||||
|
.../net/{brcm,bcm4908enet.yaml => brcm,bcm4908-enet.yaml} | 6 +++---
|
||||||
|
MAINTAINERS | 2 +-
|
||||||
|
2 files changed, 4 insertions(+), 4 deletions(-)
|
||||||
|
rename Documentation/devicetree/bindings/net/{brcm,bcm4908enet.yaml => brcm,bcm4908-enet.yaml} (85%)
|
||||||
|
|
||||||
|
diff --git a/Documentation/devicetree/bindings/net/brcm,bcm4908enet.yaml b/Documentation/devicetree/bindings/net/brcm,bcm4908-enet.yaml
|
||||||
|
similarity index 85%
|
||||||
|
rename from Documentation/devicetree/bindings/net/brcm,bcm4908enet.yaml
|
||||||
|
rename to Documentation/devicetree/bindings/net/brcm,bcm4908-enet.yaml
|
||||||
|
index 5f12f51c5b19..c70f222365c0 100644
|
||||||
|
--- a/Documentation/devicetree/bindings/net/brcm,bcm4908enet.yaml
|
||||||
|
+++ b/Documentation/devicetree/bindings/net/brcm,bcm4908-enet.yaml
|
||||||
|
@@ -1,7 +1,7 @@
|
||||||
|
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
|
||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
-$id: http://devicetree.org/schemas/net/brcm,bcm4908enet.yaml#
|
||||||
|
+$id: http://devicetree.org/schemas/net/brcm,bcm4908-enet.yaml#
|
||||||
|
$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||||
|
|
||||||
|
title: Broadcom BCM4908 Ethernet controller
|
||||||
|
@@ -13,7 +13,7 @@ maintainers:
|
||||||
|
|
||||||
|
properties:
|
||||||
|
compatible:
|
||||||
|
- const: brcm,bcm4908enet
|
||||||
|
+ const: brcm,bcm4908-enet
|
||||||
|
|
||||||
|
reg:
|
||||||
|
maxItems: 1
|
||||||
|
@@ -37,7 +37,7 @@ examples:
|
||||||
|
#include <dt-bindings/interrupt-controller/arm-gic.h>
|
||||||
|
|
||||||
|
ethernet@80002000 {
|
||||||
|
- compatible = "brcm,bcm4908enet";
|
||||||
|
+ compatible = "brcm,bcm4908-enet";
|
||||||
|
reg = <0x80002000 0x1000>;
|
||||||
|
|
||||||
|
interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
|
||||||
|
diff --git a/MAINTAINERS b/MAINTAINERS
|
||||||
|
index 3914691fb4a6..68fcd0a6416b 100644
|
||||||
|
--- a/MAINTAINERS
|
||||||
|
+++ b/MAINTAINERS
|
||||||
|
@@ -3450,7 +3450,7 @@ M: Rafał Miłecki <rafal@milecki.pl>
|
||||||
|
M: bcm-kernel-feedback-list@broadcom.com
|
||||||
|
L: netdev@vger.kernel.org
|
||||||
|
S: Maintained
|
||||||
|
-F: Documentation/devicetree/bindings/net/brcm,bcm4908enet.yaml
|
||||||
|
+F: Documentation/devicetree/bindings/net/brcm,bcm4908-enet.yaml
|
||||||
|
F: drivers/net/ethernet/broadcom/bcm4908enet.*
|
||||||
|
F: drivers/net/ethernet/broadcom/unimac.h
|
||||||
|
|
@ -0,0 +1,32 @@
|
|||||||
|
From f08b5cf1eb1f2aefc6fe4a89c8c757ba94721d0b Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||||
|
Date: Thu, 11 Feb 2021 13:12:33 +0100
|
||||||
|
Subject: [PATCH] dt-bindings: net: bcm4908-enet: include
|
||||||
|
ethernet-controller.yaml
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
It should be /included/ by every Ethernet controller binding. It adds
|
||||||
|
support for various generic properties.
|
||||||
|
|
||||||
|
Suggested-by: Rob Herring <robh@kernel.org>
|
||||||
|
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||||
|
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
|
||||||
|
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||||
|
---
|
||||||
|
Documentation/devicetree/bindings/net/brcm,bcm4908-enet.yaml | 3 +++
|
||||||
|
1 file changed, 3 insertions(+)
|
||||||
|
|
||||||
|
--- a/Documentation/devicetree/bindings/net/brcm,bcm4908-enet.yaml
|
||||||
|
+++ b/Documentation/devicetree/bindings/net/brcm,bcm4908-enet.yaml
|
||||||
|
@@ -11,6 +11,9 @@ description: Broadcom's Ethernet control
|
||||||
|
maintainers:
|
||||||
|
- Rafał Miłecki <rafal@milecki.pl>
|
||||||
|
|
||||||
|
+allOf:
|
||||||
|
+ - $ref: ethernet-controller.yaml#
|
||||||
|
+
|
||||||
|
properties:
|
||||||
|
compatible:
|
||||||
|
const: brcm,bcm4908-enet
|
@ -0,0 +1,643 @@
|
|||||||
|
From 9d61d138ab30bbfe4a8609853c81e881c4054a0b Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||||
|
Date: Thu, 11 Feb 2021 13:12:34 +0100
|
||||||
|
Subject: [PATCH] net: broadcom: rename BCM4908 driver & update DT binding
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
compatible string was updated to match normal naming convention so
|
||||||
|
update driver as well
|
||||||
|
|
||||||
|
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||||
|
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
|
||||||
|
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||||
|
---
|
||||||
|
MAINTAINERS | 2 +-
|
||||||
|
drivers/net/ethernet/broadcom/Kconfig | 2 +-
|
||||||
|
drivers/net/ethernet/broadcom/Makefile | 2 +-
|
||||||
|
.../{bcm4908enet.c => bcm4908_enet.c} | 215 +++++++++---------
|
||||||
|
.../{bcm4908enet.h => bcm4908_enet.h} | 4 +-
|
||||||
|
5 files changed, 113 insertions(+), 112 deletions(-)
|
||||||
|
rename drivers/net/ethernet/broadcom/{bcm4908enet.c => bcm4908_enet.c} (68%)
|
||||||
|
rename drivers/net/ethernet/broadcom/{bcm4908enet.h => bcm4908_enet.h} (98%)
|
||||||
|
|
||||||
|
diff --git a/MAINTAINERS b/MAINTAINERS
|
||||||
|
index 68fcd0a6416b..99335fd22c0a 100644
|
||||||
|
--- a/MAINTAINERS
|
||||||
|
+++ b/MAINTAINERS
|
||||||
|
@@ -3451,7 +3451,7 @@ M: bcm-kernel-feedback-list@broadcom.com
|
||||||
|
L: netdev@vger.kernel.org
|
||||||
|
S: Maintained
|
||||||
|
F: Documentation/devicetree/bindings/net/brcm,bcm4908-enet.yaml
|
||||||
|
-F: drivers/net/ethernet/broadcom/bcm4908enet.*
|
||||||
|
+F: drivers/net/ethernet/broadcom/bcm4908_enet.*
|
||||||
|
F: drivers/net/ethernet/broadcom/unimac.h
|
||||||
|
|
||||||
|
BROADCOM BCM5301X ARM ARCHITECTURE
|
||||||
|
diff --git a/drivers/net/ethernet/broadcom/Kconfig b/drivers/net/ethernet/broadcom/Kconfig
|
||||||
|
index bcf9e0a410fd..f8a168b73307 100644
|
||||||
|
--- a/drivers/net/ethernet/broadcom/Kconfig
|
||||||
|
+++ b/drivers/net/ethernet/broadcom/Kconfig
|
||||||
|
@@ -51,7 +51,7 @@ config B44_PCI
|
||||||
|
depends on B44_PCI_AUTOSELECT && B44_PCICORE_AUTOSELECT
|
||||||
|
default y
|
||||||
|
|
||||||
|
-config BCM4908ENET
|
||||||
|
+config BCM4908_ENET
|
||||||
|
tristate "Broadcom BCM4908 internal mac support"
|
||||||
|
depends on ARCH_BCM4908 || COMPILE_TEST
|
||||||
|
default y
|
||||||
|
diff --git a/drivers/net/ethernet/broadcom/Makefile b/drivers/net/ethernet/broadcom/Makefile
|
||||||
|
index 379012de3569..0ddfb5b5d53c 100644
|
||||||
|
--- a/drivers/net/ethernet/broadcom/Makefile
|
||||||
|
+++ b/drivers/net/ethernet/broadcom/Makefile
|
||||||
|
@@ -4,7 +4,7 @@
|
||||||
|
#
|
||||||
|
|
||||||
|
obj-$(CONFIG_B44) += b44.o
|
||||||
|
-obj-$(CONFIG_BCM4908ENET) += bcm4908enet.o
|
||||||
|
+obj-$(CONFIG_BCM4908_ENET) += bcm4908_enet.o
|
||||||
|
obj-$(CONFIG_BCM63XX_ENET) += bcm63xx_enet.o
|
||||||
|
obj-$(CONFIG_BCMGENET) += genet/
|
||||||
|
obj-$(CONFIG_BNX2) += bnx2.o
|
||||||
|
diff --git a/drivers/net/ethernet/broadcom/bcm4908enet.c b/drivers/net/ethernet/broadcom/bcm4908_enet.c
|
||||||
|
similarity index 68%
|
||||||
|
rename from drivers/net/ethernet/broadcom/bcm4908enet.c
|
||||||
|
rename to drivers/net/ethernet/broadcom/bcm4908_enet.c
|
||||||
|
index d68b328e7596..e56348eb188f 100644
|
||||||
|
--- a/drivers/net/ethernet/broadcom/bcm4908enet.c
|
||||||
|
+++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c
|
||||||
|
@@ -12,7 +12,7 @@
|
||||||
|
#include <linux/slab.h>
|
||||||
|
#include <linux/string.h>
|
||||||
|
|
||||||
|
-#include "bcm4908enet.h"
|
||||||
|
+#include "bcm4908_enet.h"
|
||||||
|
#include "unimac.h"
|
||||||
|
|
||||||
|
#define ENET_DMA_CH_RX_CFG ENET_DMA_CH0_CFG
|
||||||
|
@@ -33,18 +33,18 @@
|
||||||
|
#define ENET_MTU_MAX 1500 /* Is it possible to support 2044? */
|
||||||
|
#define ENET_MTU_MAX_EXTRA_SIZE 32 /* L2 */
|
||||||
|
|
||||||
|
-struct bcm4908enet_dma_ring_bd {
|
||||||
|
+struct bcm4908_enet_dma_ring_bd {
|
||||||
|
__le32 ctl;
|
||||||
|
__le32 addr;
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
-struct bcm4908enet_dma_ring_slot {
|
||||||
|
+struct bcm4908_enet_dma_ring_slot {
|
||||||
|
struct sk_buff *skb;
|
||||||
|
unsigned int len;
|
||||||
|
dma_addr_t dma_addr;
|
||||||
|
};
|
||||||
|
|
||||||
|
-struct bcm4908enet_dma_ring {
|
||||||
|
+struct bcm4908_enet_dma_ring {
|
||||||
|
int is_tx;
|
||||||
|
int read_idx;
|
||||||
|
int write_idx;
|
||||||
|
@@ -54,38 +54,38 @@ struct bcm4908enet_dma_ring {
|
||||||
|
|
||||||
|
union {
|
||||||
|
void *cpu_addr;
|
||||||
|
- struct bcm4908enet_dma_ring_bd *buf_desc;
|
||||||
|
+ struct bcm4908_enet_dma_ring_bd *buf_desc;
|
||||||
|
};
|
||||||
|
dma_addr_t dma_addr;
|
||||||
|
|
||||||
|
- struct bcm4908enet_dma_ring_slot *slots;
|
||||||
|
+ struct bcm4908_enet_dma_ring_slot *slots;
|
||||||
|
};
|
||||||
|
|
||||||
|
-struct bcm4908enet {
|
||||||
|
+struct bcm4908_enet {
|
||||||
|
struct device *dev;
|
||||||
|
struct net_device *netdev;
|
||||||
|
struct napi_struct napi;
|
||||||
|
void __iomem *base;
|
||||||
|
|
||||||
|
- struct bcm4908enet_dma_ring tx_ring;
|
||||||
|
- struct bcm4908enet_dma_ring rx_ring;
|
||||||
|
+ struct bcm4908_enet_dma_ring tx_ring;
|
||||||
|
+ struct bcm4908_enet_dma_ring rx_ring;
|
||||||
|
};
|
||||||
|
|
||||||
|
/***
|
||||||
|
* R/W ops
|
||||||
|
*/
|
||||||
|
|
||||||
|
-static inline u32 enet_read(struct bcm4908enet *enet, u16 offset)
|
||||||
|
+static inline u32 enet_read(struct bcm4908_enet *enet, u16 offset)
|
||||||
|
{
|
||||||
|
return readl(enet->base + offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
-static inline void enet_write(struct bcm4908enet *enet, u16 offset, u32 value)
|
||||||
|
+static inline void enet_write(struct bcm4908_enet *enet, u16 offset, u32 value)
|
||||||
|
{
|
||||||
|
writel(value, enet->base + offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
-static inline void enet_maskset(struct bcm4908enet *enet, u16 offset, u32 mask, u32 set)
|
||||||
|
+static inline void enet_maskset(struct bcm4908_enet *enet, u16 offset, u32 mask, u32 set)
|
||||||
|
{
|
||||||
|
u32 val;
|
||||||
|
|
||||||
|
@@ -96,27 +96,27 @@ static inline void enet_maskset(struct bcm4908enet *enet, u16 offset, u32 mask,
|
||||||
|
enet_write(enet, offset, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
-static inline void enet_set(struct bcm4908enet *enet, u16 offset, u32 set)
|
||||||
|
+static inline void enet_set(struct bcm4908_enet *enet, u16 offset, u32 set)
|
||||||
|
{
|
||||||
|
enet_maskset(enet, offset, set, set);
|
||||||
|
}
|
||||||
|
|
||||||
|
-static inline u32 enet_umac_read(struct bcm4908enet *enet, u16 offset)
|
||||||
|
+static inline u32 enet_umac_read(struct bcm4908_enet *enet, u16 offset)
|
||||||
|
{
|
||||||
|
return enet_read(enet, ENET_UNIMAC + offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
-static inline void enet_umac_write(struct bcm4908enet *enet, u16 offset, u32 value)
|
||||||
|
+static inline void enet_umac_write(struct bcm4908_enet *enet, u16 offset, u32 value)
|
||||||
|
{
|
||||||
|
enet_write(enet, ENET_UNIMAC + offset, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
-static inline void enet_umac_maskset(struct bcm4908enet *enet, u16 offset, u32 mask, u32 set)
|
||||||
|
+static inline void enet_umac_maskset(struct bcm4908_enet *enet, u16 offset, u32 mask, u32 set)
|
||||||
|
{
|
||||||
|
enet_maskset(enet, ENET_UNIMAC + offset, mask, set);
|
||||||
|
}
|
||||||
|
|
||||||
|
-static inline void enet_umac_set(struct bcm4908enet *enet, u16 offset, u32 set)
|
||||||
|
+static inline void enet_umac_set(struct bcm4908_enet *enet, u16 offset, u32 set)
|
||||||
|
{
|
||||||
|
enet_set(enet, ENET_UNIMAC + offset, set);
|
||||||
|
}
|
||||||
|
@@ -125,17 +125,17 @@ static inline void enet_umac_set(struct bcm4908enet *enet, u16 offset, u32 set)
|
||||||
|
* Helpers
|
||||||
|
*/
|
||||||
|
|
||||||
|
-static void bcm4908enet_intrs_on(struct bcm4908enet *enet)
|
||||||
|
+static void bcm4908_enet_intrs_on(struct bcm4908_enet *enet)
|
||||||
|
{
|
||||||
|
enet_write(enet, ENET_DMA_CH_RX_CFG + ENET_DMA_CH_CFG_INT_MASK, ENET_DMA_INT_DEFAULTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
-static void bcm4908enet_intrs_off(struct bcm4908enet *enet)
|
||||||
|
+static void bcm4908_enet_intrs_off(struct bcm4908_enet *enet)
|
||||||
|
{
|
||||||
|
enet_write(enet, ENET_DMA_CH_RX_CFG + ENET_DMA_CH_CFG_INT_MASK, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
-static void bcm4908enet_intrs_ack(struct bcm4908enet *enet)
|
||||||
|
+static void bcm4908_enet_intrs_ack(struct bcm4908_enet *enet)
|
||||||
|
{
|
||||||
|
enet_write(enet, ENET_DMA_CH_RX_CFG + ENET_DMA_CH_CFG_INT_STAT, ENET_DMA_INT_DEFAULTS);
|
||||||
|
}
|
||||||
|
@@ -144,9 +144,10 @@ static void bcm4908enet_intrs_ack(struct bcm4908enet *enet)
|
||||||
|
* DMA
|
||||||
|
*/
|
||||||
|
|
||||||
|
-static int bcm4908_dma_alloc_buf_descs(struct bcm4908enet *enet, struct bcm4908enet_dma_ring *ring)
|
||||||
|
+static int bcm4908_dma_alloc_buf_descs(struct bcm4908_enet *enet,
|
||||||
|
+ struct bcm4908_enet_dma_ring *ring)
|
||||||
|
{
|
||||||
|
- int size = ring->length * sizeof(struct bcm4908enet_dma_ring_bd);
|
||||||
|
+ int size = ring->length * sizeof(struct bcm4908_enet_dma_ring_bd);
|
||||||
|
struct device *dev = enet->dev;
|
||||||
|
|
||||||
|
ring->cpu_addr = dma_alloc_coherent(dev, size, &ring->dma_addr, GFP_KERNEL);
|
||||||
|
@@ -174,28 +175,28 @@ static int bcm4908_dma_alloc_buf_descs(struct bcm4908enet *enet, struct bcm4908e
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static void bcm4908enet_dma_free(struct bcm4908enet *enet)
|
||||||
|
+static void bcm4908_enet_dma_free(struct bcm4908_enet *enet)
|
||||||
|
{
|
||||||
|
- struct bcm4908enet_dma_ring *tx_ring = &enet->tx_ring;
|
||||||
|
- struct bcm4908enet_dma_ring *rx_ring = &enet->rx_ring;
|
||||||
|
+ struct bcm4908_enet_dma_ring *tx_ring = &enet->tx_ring;
|
||||||
|
+ struct bcm4908_enet_dma_ring *rx_ring = &enet->rx_ring;
|
||||||
|
struct device *dev = enet->dev;
|
||||||
|
int size;
|
||||||
|
|
||||||
|
- size = rx_ring->length * sizeof(struct bcm4908enet_dma_ring_bd);
|
||||||
|
+ size = rx_ring->length * sizeof(struct bcm4908_enet_dma_ring_bd);
|
||||||
|
if (rx_ring->cpu_addr)
|
||||||
|
dma_free_coherent(dev, size, rx_ring->cpu_addr, rx_ring->dma_addr);
|
||||||
|
kfree(rx_ring->slots);
|
||||||
|
|
||||||
|
- size = tx_ring->length * sizeof(struct bcm4908enet_dma_ring_bd);
|
||||||
|
+ size = tx_ring->length * sizeof(struct bcm4908_enet_dma_ring_bd);
|
||||||
|
if (tx_ring->cpu_addr)
|
||||||
|
dma_free_coherent(dev, size, tx_ring->cpu_addr, tx_ring->dma_addr);
|
||||||
|
kfree(tx_ring->slots);
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int bcm4908enet_dma_alloc(struct bcm4908enet *enet)
|
||||||
|
+static int bcm4908_enet_dma_alloc(struct bcm4908_enet *enet)
|
||||||
|
{
|
||||||
|
- struct bcm4908enet_dma_ring *tx_ring = &enet->tx_ring;
|
||||||
|
- struct bcm4908enet_dma_ring *rx_ring = &enet->rx_ring;
|
||||||
|
+ struct bcm4908_enet_dma_ring *tx_ring = &enet->tx_ring;
|
||||||
|
+ struct bcm4908_enet_dma_ring *rx_ring = &enet->rx_ring;
|
||||||
|
struct device *dev = enet->dev;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
@@ -216,16 +217,16 @@ static int bcm4908enet_dma_alloc(struct bcm4908enet *enet)
|
||||||
|
err = bcm4908_dma_alloc_buf_descs(enet, rx_ring);
|
||||||
|
if (err) {
|
||||||
|
dev_err(dev, "Failed to alloc RX buf descriptors: %d\n", err);
|
||||||
|
- bcm4908enet_dma_free(enet);
|
||||||
|
+ bcm4908_enet_dma_free(enet);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static void bcm4908enet_dma_reset(struct bcm4908enet *enet)
|
||||||
|
+static void bcm4908_enet_dma_reset(struct bcm4908_enet *enet)
|
||||||
|
{
|
||||||
|
- struct bcm4908enet_dma_ring *rings[] = { &enet->rx_ring, &enet->tx_ring };
|
||||||
|
+ struct bcm4908_enet_dma_ring *rings[] = { &enet->rx_ring, &enet->tx_ring };
|
||||||
|
int i;
|
||||||
|
|
||||||
|
/* Disable the DMA controller and channel */
|
||||||
|
@@ -235,7 +236,7 @@ static void bcm4908enet_dma_reset(struct bcm4908enet *enet)
|
||||||
|
|
||||||
|
/* Reset channels state */
|
||||||
|
for (i = 0; i < ARRAY_SIZE(rings); i++) {
|
||||||
|
- struct bcm4908enet_dma_ring *ring = rings[i];
|
||||||
|
+ struct bcm4908_enet_dma_ring *ring = rings[i];
|
||||||
|
|
||||||
|
enet_write(enet, ring->st_ram_block + ENET_DMA_CH_STATE_RAM_BASE_DESC_PTR, 0);
|
||||||
|
enet_write(enet, ring->st_ram_block + ENET_DMA_CH_STATE_RAM_STATE_DATA, 0);
|
||||||
|
@@ -244,10 +245,10 @@ static void bcm4908enet_dma_reset(struct bcm4908enet *enet)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int bcm4908enet_dma_alloc_rx_buf(struct bcm4908enet *enet, unsigned int idx)
|
||||||
|
+static int bcm4908_enet_dma_alloc_rx_buf(struct bcm4908_enet *enet, unsigned int idx)
|
||||||
|
{
|
||||||
|
- struct bcm4908enet_dma_ring_bd *buf_desc = &enet->rx_ring.buf_desc[idx];
|
||||||
|
- struct bcm4908enet_dma_ring_slot *slot = &enet->rx_ring.slots[idx];
|
||||||
|
+ struct bcm4908_enet_dma_ring_bd *buf_desc = &enet->rx_ring.buf_desc[idx];
|
||||||
|
+ struct bcm4908_enet_dma_ring_slot *slot = &enet->rx_ring.slots[idx];
|
||||||
|
struct device *dev = enet->dev;
|
||||||
|
u32 tmp;
|
||||||
|
int err;
|
||||||
|
@@ -277,8 +278,8 @@ static int bcm4908enet_dma_alloc_rx_buf(struct bcm4908enet *enet, unsigned int i
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static void bcm4908enet_dma_ring_init(struct bcm4908enet *enet,
|
||||||
|
- struct bcm4908enet_dma_ring *ring)
|
||||||
|
+static void bcm4908_enet_dma_ring_init(struct bcm4908_enet *enet,
|
||||||
|
+ struct bcm4908_enet_dma_ring *ring)
|
||||||
|
{
|
||||||
|
int reset_channel = 0; /* We support only 1 main channel (with TX and RX) */
|
||||||
|
int reset_subch = ring->is_tx ? 1 : 0;
|
||||||
|
@@ -295,10 +296,10 @@ static void bcm4908enet_dma_ring_init(struct bcm4908enet *enet,
|
||||||
|
(uint32_t)ring->dma_addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
-static void bcm4908enet_dma_uninit(struct bcm4908enet *enet)
|
||||||
|
+static void bcm4908_enet_dma_uninit(struct bcm4908_enet *enet)
|
||||||
|
{
|
||||||
|
- struct bcm4908enet_dma_ring *rx_ring = &enet->rx_ring;
|
||||||
|
- struct bcm4908enet_dma_ring_slot *slot;
|
||||||
|
+ struct bcm4908_enet_dma_ring *rx_ring = &enet->rx_ring;
|
||||||
|
+ struct bcm4908_enet_dma_ring_slot *slot;
|
||||||
|
struct device *dev = enet->dev;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
@@ -312,48 +313,48 @@ static void bcm4908enet_dma_uninit(struct bcm4908enet *enet)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int bcm4908enet_dma_init(struct bcm4908enet *enet)
|
||||||
|
+static int bcm4908_enet_dma_init(struct bcm4908_enet *enet)
|
||||||
|
{
|
||||||
|
- struct bcm4908enet_dma_ring *rx_ring = &enet->rx_ring;
|
||||||
|
+ struct bcm4908_enet_dma_ring *rx_ring = &enet->rx_ring;
|
||||||
|
struct device *dev = enet->dev;
|
||||||
|
int err;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < rx_ring->length; i++) {
|
||||||
|
- err = bcm4908enet_dma_alloc_rx_buf(enet, i);
|
||||||
|
+ err = bcm4908_enet_dma_alloc_rx_buf(enet, i);
|
||||||
|
if (err) {
|
||||||
|
dev_err(dev, "Failed to alloc RX buffer: %d\n", err);
|
||||||
|
- bcm4908enet_dma_uninit(enet);
|
||||||
|
+ bcm4908_enet_dma_uninit(enet);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- bcm4908enet_dma_ring_init(enet, &enet->tx_ring);
|
||||||
|
- bcm4908enet_dma_ring_init(enet, &enet->rx_ring);
|
||||||
|
+ bcm4908_enet_dma_ring_init(enet, &enet->tx_ring);
|
||||||
|
+ bcm4908_enet_dma_ring_init(enet, &enet->rx_ring);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static void bcm4908enet_dma_tx_ring_ensable(struct bcm4908enet *enet,
|
||||||
|
- struct bcm4908enet_dma_ring *ring)
|
||||||
|
+static void bcm4908_enet_dma_tx_ring_ensable(struct bcm4908_enet *enet,
|
||||||
|
+ struct bcm4908_enet_dma_ring *ring)
|
||||||
|
{
|
||||||
|
enet_write(enet, ring->cfg_block + ENET_DMA_CH_CFG, ENET_DMA_CH_CFG_ENABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
-static void bcm4908enet_dma_tx_ring_disable(struct bcm4908enet *enet,
|
||||||
|
- struct bcm4908enet_dma_ring *ring)
|
||||||
|
+static void bcm4908_enet_dma_tx_ring_disable(struct bcm4908_enet *enet,
|
||||||
|
+ struct bcm4908_enet_dma_ring *ring)
|
||||||
|
{
|
||||||
|
enet_write(enet, ring->cfg_block + ENET_DMA_CH_CFG, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
-static void bcm4908enet_dma_rx_ring_enable(struct bcm4908enet *enet,
|
||||||
|
- struct bcm4908enet_dma_ring *ring)
|
||||||
|
+static void bcm4908_enet_dma_rx_ring_enable(struct bcm4908_enet *enet,
|
||||||
|
+ struct bcm4908_enet_dma_ring *ring)
|
||||||
|
{
|
||||||
|
enet_set(enet, ring->cfg_block + ENET_DMA_CH_CFG, ENET_DMA_CH_CFG_ENABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
-static void bcm4908enet_dma_rx_ring_disable(struct bcm4908enet *enet,
|
||||||
|
- struct bcm4908enet_dma_ring *ring)
|
||||||
|
+static void bcm4908_enet_dma_rx_ring_disable(struct bcm4908_enet *enet,
|
||||||
|
+ struct bcm4908_enet_dma_ring *ring)
|
||||||
|
{
|
||||||
|
unsigned long deadline;
|
||||||
|
u32 tmp;
|
||||||
|
@@ -376,7 +377,7 @@ static void bcm4908enet_dma_rx_ring_disable(struct bcm4908enet *enet,
|
||||||
|
* Ethernet driver
|
||||||
|
*/
|
||||||
|
|
||||||
|
-static void bcm4908enet_gmac_init(struct bcm4908enet *enet)
|
||||||
|
+static void bcm4908_enet_gmac_init(struct bcm4908_enet *enet)
|
||||||
|
{
|
||||||
|
u32 cmd;
|
||||||
|
|
||||||
|
@@ -407,75 +408,75 @@ static void bcm4908enet_gmac_init(struct bcm4908enet *enet)
|
||||||
|
ENET_GMAC_STATUS_LINK_UP);
|
||||||
|
}
|
||||||
|
|
||||||
|
-static irqreturn_t bcm4908enet_irq_handler(int irq, void *dev_id)
|
||||||
|
+static irqreturn_t bcm4908_enet_irq_handler(int irq, void *dev_id)
|
||||||
|
{
|
||||||
|
- struct bcm4908enet *enet = dev_id;
|
||||||
|
+ struct bcm4908_enet *enet = dev_id;
|
||||||
|
|
||||||
|
- bcm4908enet_intrs_off(enet);
|
||||||
|
- bcm4908enet_intrs_ack(enet);
|
||||||
|
+ bcm4908_enet_intrs_off(enet);
|
||||||
|
+ bcm4908_enet_intrs_ack(enet);
|
||||||
|
|
||||||
|
napi_schedule(&enet->napi);
|
||||||
|
|
||||||
|
return IRQ_HANDLED;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int bcm4908enet_open(struct net_device *netdev)
|
||||||
|
+static int bcm4908_enet_open(struct net_device *netdev)
|
||||||
|
{
|
||||||
|
- struct bcm4908enet *enet = netdev_priv(netdev);
|
||||||
|
+ struct bcm4908_enet *enet = netdev_priv(netdev);
|
||||||
|
struct device *dev = enet->dev;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
- err = request_irq(netdev->irq, bcm4908enet_irq_handler, 0, "enet", enet);
|
||||||
|
+ err = request_irq(netdev->irq, bcm4908_enet_irq_handler, 0, "enet", enet);
|
||||||
|
if (err) {
|
||||||
|
dev_err(dev, "Failed to request IRQ %d: %d\n", netdev->irq, err);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
- bcm4908enet_gmac_init(enet);
|
||||||
|
- bcm4908enet_dma_reset(enet);
|
||||||
|
- bcm4908enet_dma_init(enet);
|
||||||
|
+ bcm4908_enet_gmac_init(enet);
|
||||||
|
+ bcm4908_enet_dma_reset(enet);
|
||||||
|
+ bcm4908_enet_dma_init(enet);
|
||||||
|
|
||||||
|
enet_umac_set(enet, UMAC_CMD, CMD_TX_EN | CMD_RX_EN);
|
||||||
|
|
||||||
|
enet_set(enet, ENET_DMA_CONTROLLER_CFG, ENET_DMA_CTRL_CFG_MASTER_EN);
|
||||||
|
enet_maskset(enet, ENET_DMA_CONTROLLER_CFG, ENET_DMA_CTRL_CFG_FLOWC_CH1_EN, 0);
|
||||||
|
- bcm4908enet_dma_rx_ring_enable(enet, &enet->rx_ring);
|
||||||
|
+ bcm4908_enet_dma_rx_ring_enable(enet, &enet->rx_ring);
|
||||||
|
|
||||||
|
napi_enable(&enet->napi);
|
||||||
|
netif_carrier_on(netdev);
|
||||||
|
netif_start_queue(netdev);
|
||||||
|
|
||||||
|
- bcm4908enet_intrs_ack(enet);
|
||||||
|
- bcm4908enet_intrs_on(enet);
|
||||||
|
+ bcm4908_enet_intrs_ack(enet);
|
||||||
|
+ bcm4908_enet_intrs_on(enet);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int bcm4908enet_stop(struct net_device *netdev)
|
||||||
|
+static int bcm4908_enet_stop(struct net_device *netdev)
|
||||||
|
{
|
||||||
|
- struct bcm4908enet *enet = netdev_priv(netdev);
|
||||||
|
+ struct bcm4908_enet *enet = netdev_priv(netdev);
|
||||||
|
|
||||||
|
netif_stop_queue(netdev);
|
||||||
|
netif_carrier_off(netdev);
|
||||||
|
napi_disable(&enet->napi);
|
||||||
|
|
||||||
|
- bcm4908enet_dma_rx_ring_disable(enet, &enet->rx_ring);
|
||||||
|
- bcm4908enet_dma_tx_ring_disable(enet, &enet->tx_ring);
|
||||||
|
+ bcm4908_enet_dma_rx_ring_disable(enet, &enet->rx_ring);
|
||||||
|
+ bcm4908_enet_dma_tx_ring_disable(enet, &enet->tx_ring);
|
||||||
|
|
||||||
|
- bcm4908enet_dma_uninit(enet);
|
||||||
|
+ bcm4908_enet_dma_uninit(enet);
|
||||||
|
|
||||||
|
free_irq(enet->netdev->irq, enet);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int bcm4908enet_start_xmit(struct sk_buff *skb, struct net_device *netdev)
|
||||||
|
+static int bcm4908_enet_start_xmit(struct sk_buff *skb, struct net_device *netdev)
|
||||||
|
{
|
||||||
|
- struct bcm4908enet *enet = netdev_priv(netdev);
|
||||||
|
- struct bcm4908enet_dma_ring *ring = &enet->tx_ring;
|
||||||
|
- struct bcm4908enet_dma_ring_slot *slot;
|
||||||
|
+ struct bcm4908_enet *enet = netdev_priv(netdev);
|
||||||
|
+ struct bcm4908_enet_dma_ring *ring = &enet->tx_ring;
|
||||||
|
+ struct bcm4908_enet_dma_ring_slot *slot;
|
||||||
|
struct device *dev = enet->dev;
|
||||||
|
- struct bcm4908enet_dma_ring_bd *buf_desc;
|
||||||
|
+ struct bcm4908_enet_dma_ring_bd *buf_desc;
|
||||||
|
int free_buf_descs;
|
||||||
|
u32 tmp;
|
||||||
|
|
||||||
|
@@ -525,7 +526,7 @@ static int bcm4908enet_start_xmit(struct sk_buff *skb, struct net_device *netdev
|
||||||
|
buf_desc->addr = cpu_to_le32((uint32_t)slot->dma_addr);
|
||||||
|
buf_desc->ctl = cpu_to_le32(tmp);
|
||||||
|
|
||||||
|
- bcm4908enet_dma_tx_ring_ensable(enet, &enet->tx_ring);
|
||||||
|
+ bcm4908_enet_dma_tx_ring_ensable(enet, &enet->tx_ring);
|
||||||
|
|
||||||
|
if (++ring->write_idx == ring->length - 1)
|
||||||
|
ring->write_idx = 0;
|
||||||
|
@@ -535,15 +536,15 @@ static int bcm4908enet_start_xmit(struct sk_buff *skb, struct net_device *netdev
|
||||||
|
return NETDEV_TX_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int bcm4908enet_poll(struct napi_struct *napi, int weight)
|
||||||
|
+static int bcm4908_enet_poll(struct napi_struct *napi, int weight)
|
||||||
|
{
|
||||||
|
- struct bcm4908enet *enet = container_of(napi, struct bcm4908enet, napi);
|
||||||
|
+ struct bcm4908_enet *enet = container_of(napi, struct bcm4908_enet, napi);
|
||||||
|
struct device *dev = enet->dev;
|
||||||
|
int handled = 0;
|
||||||
|
|
||||||
|
while (handled < weight) {
|
||||||
|
- struct bcm4908enet_dma_ring_bd *buf_desc;
|
||||||
|
- struct bcm4908enet_dma_ring_slot slot;
|
||||||
|
+ struct bcm4908_enet_dma_ring_bd *buf_desc;
|
||||||
|
+ struct bcm4908_enet_dma_ring_slot slot;
|
||||||
|
u32 ctl;
|
||||||
|
int len;
|
||||||
|
int err;
|
||||||
|
@@ -556,7 +557,7 @@ static int bcm4908enet_poll(struct napi_struct *napi, int weight)
|
||||||
|
slot = enet->rx_ring.slots[enet->rx_ring.read_idx];
|
||||||
|
|
||||||
|
/* Provide new buffer before unpinning the old one */
|
||||||
|
- err = bcm4908enet_dma_alloc_rx_buf(enet, enet->rx_ring.read_idx);
|
||||||
|
+ err = bcm4908_enet_dma_alloc_rx_buf(enet, enet->rx_ring.read_idx);
|
||||||
|
if (err)
|
||||||
|
break;
|
||||||
|
|
||||||
|
@@ -583,24 +584,24 @@ static int bcm4908enet_poll(struct napi_struct *napi, int weight)
|
||||||
|
|
||||||
|
if (handled < weight) {
|
||||||
|
napi_complete_done(napi, handled);
|
||||||
|
- bcm4908enet_intrs_on(enet);
|
||||||
|
+ bcm4908_enet_intrs_on(enet);
|
||||||
|
}
|
||||||
|
|
||||||
|
return handled;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct net_device_ops bcm96xx_netdev_ops = {
|
||||||
|
- .ndo_open = bcm4908enet_open,
|
||||||
|
- .ndo_stop = bcm4908enet_stop,
|
||||||
|
- .ndo_start_xmit = bcm4908enet_start_xmit,
|
||||||
|
+ .ndo_open = bcm4908_enet_open,
|
||||||
|
+ .ndo_stop = bcm4908_enet_stop,
|
||||||
|
+ .ndo_start_xmit = bcm4908_enet_start_xmit,
|
||||||
|
.ndo_set_mac_address = eth_mac_addr,
|
||||||
|
};
|
||||||
|
|
||||||
|
-static int bcm4908enet_probe(struct platform_device *pdev)
|
||||||
|
+static int bcm4908_enet_probe(struct platform_device *pdev)
|
||||||
|
{
|
||||||
|
struct device *dev = &pdev->dev;
|
||||||
|
struct net_device *netdev;
|
||||||
|
- struct bcm4908enet *enet;
|
||||||
|
+ struct bcm4908_enet *enet;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
netdev = devm_alloc_etherdev(dev, sizeof(*enet));
|
||||||
|
@@ -623,7 +624,7 @@ static int bcm4908enet_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
|
dma_set_coherent_mask(dev, DMA_BIT_MASK(32));
|
||||||
|
|
||||||
|
- err = bcm4908enet_dma_alloc(enet);
|
||||||
|
+ err = bcm4908_enet_dma_alloc(enet);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
|
@@ -633,11 +634,11 @@ static int bcm4908enet_probe(struct platform_device *pdev)
|
||||||
|
netdev->min_mtu = ETH_ZLEN;
|
||||||
|
netdev->mtu = ENET_MTU_MAX;
|
||||||
|
netdev->max_mtu = ENET_MTU_MAX;
|
||||||
|
- netif_napi_add(netdev, &enet->napi, bcm4908enet_poll, 64);
|
||||||
|
+ netif_napi_add(netdev, &enet->napi, bcm4908_enet_poll, 64);
|
||||||
|
|
||||||
|
err = register_netdev(netdev);
|
||||||
|
if (err) {
|
||||||
|
- bcm4908enet_dma_free(enet);
|
||||||
|
+ bcm4908_enet_dma_free(enet);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -646,31 +647,31 @@ static int bcm4908enet_probe(struct platform_device *pdev)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int bcm4908enet_remove(struct platform_device *pdev)
|
||||||
|
+static int bcm4908_enet_remove(struct platform_device *pdev)
|
||||||
|
{
|
||||||
|
- struct bcm4908enet *enet = platform_get_drvdata(pdev);
|
||||||
|
+ struct bcm4908_enet *enet = platform_get_drvdata(pdev);
|
||||||
|
|
||||||
|
unregister_netdev(enet->netdev);
|
||||||
|
netif_napi_del(&enet->napi);
|
||||||
|
- bcm4908enet_dma_free(enet);
|
||||||
|
+ bcm4908_enet_dma_free(enet);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static const struct of_device_id bcm4908enet_of_match[] = {
|
||||||
|
- { .compatible = "brcm,bcm4908enet"},
|
||||||
|
+static const struct of_device_id bcm4908_enet_of_match[] = {
|
||||||
|
+ { .compatible = "brcm,bcm4908-enet"},
|
||||||
|
{},
|
||||||
|
};
|
||||||
|
|
||||||
|
-static struct platform_driver bcm4908enet_driver = {
|
||||||
|
+static struct platform_driver bcm4908_enet_driver = {
|
||||||
|
.driver = {
|
||||||
|
- .name = "bcm4908enet",
|
||||||
|
- .of_match_table = bcm4908enet_of_match,
|
||||||
|
+ .name = "bcm4908_enet",
|
||||||
|
+ .of_match_table = bcm4908_enet_of_match,
|
||||||
|
},
|
||||||
|
- .probe = bcm4908enet_probe,
|
||||||
|
- .remove = bcm4908enet_remove,
|
||||||
|
+ .probe = bcm4908_enet_probe,
|
||||||
|
+ .remove = bcm4908_enet_remove,
|
||||||
|
};
|
||||||
|
-module_platform_driver(bcm4908enet_driver);
|
||||||
|
+module_platform_driver(bcm4908_enet_driver);
|
||||||
|
|
||||||
|
MODULE_LICENSE("GPL v2");
|
||||||
|
-MODULE_DEVICE_TABLE(of, bcm4908enet_of_match);
|
||||||
|
+MODULE_DEVICE_TABLE(of, bcm4908_enet_of_match);
|
||||||
|
diff --git a/drivers/net/ethernet/broadcom/bcm4908enet.h b/drivers/net/ethernet/broadcom/bcm4908_enet.h
|
||||||
|
similarity index 98%
|
||||||
|
rename from drivers/net/ethernet/broadcom/bcm4908enet.h
|
||||||
|
rename to drivers/net/ethernet/broadcom/bcm4908_enet.h
|
||||||
|
index 11aadf0715d3..8a3ede2da537 100644
|
||||||
|
--- a/drivers/net/ethernet/broadcom/bcm4908enet.h
|
||||||
|
+++ b/drivers/net/ethernet/broadcom/bcm4908_enet.h
|
||||||
|
@@ -1,6 +1,6 @@
|
||||||
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
|
-#ifndef __BCM4908ENET_H
|
||||||
|
-#define __BCM4908ENET_H
|
||||||
|
+#ifndef __BCM4908_ENET_H
|
||||||
|
+#define __BCM4908_ENET_H
|
||||||
|
|
||||||
|
#define ENET_CONTROL 0x000
|
||||||
|
#define ENET_MIB_CTRL 0x004
|
@ -0,0 +1,30 @@
|
|||||||
|
From af263af64683f018be9ce3c309edfa9903f5109a Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||||
|
Date: Thu, 11 Feb 2021 13:12:35 +0100
|
||||||
|
Subject: [PATCH] net: broadcom: bcm4908_enet: drop unneeded memset()
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
dma_alloc_coherent takes care of zeroing allocated memory
|
||||||
|
|
||||||
|
Suggested-by: Andrew Lunn <andrew@lunn.ch>
|
||||||
|
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||||
|
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||||
|
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
|
||||||
|
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||||
|
---
|
||||||
|
drivers/net/ethernet/broadcom/bcm4908_enet.c | 2 --
|
||||||
|
1 file changed, 2 deletions(-)
|
||||||
|
|
||||||
|
--- a/drivers/net/ethernet/broadcom/bcm4908_enet.c
|
||||||
|
+++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c
|
||||||
|
@@ -163,8 +163,6 @@ static int bcm4908_dma_alloc_buf_descs(s
|
||||||
|
if (!ring->slots)
|
||||||
|
goto err_free_buf_descs;
|
||||||
|
|
||||||
|
- memset(ring->cpu_addr, 0, size);
|
||||||
|
-
|
||||||
|
ring->read_idx = 0;
|
||||||
|
ring->write_idx = 0;
|
||||||
|
|
@ -0,0 +1,75 @@
|
|||||||
|
From 7b778ae4eb9cd6e1518e4e47902a104b13ae8929 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||||
|
Date: Thu, 11 Feb 2021 13:12:36 +0100
|
||||||
|
Subject: [PATCH] net: broadcom: bcm4908_enet: drop "inline" from C functions
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
It seems preferred to let compiler optimize code if applicable.
|
||||||
|
While at it drop unused enet_umac_maskset().
|
||||||
|
|
||||||
|
Suggested-by: Andrew Lunn <andrew@lunn.ch>
|
||||||
|
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||||
|
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||||
|
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
|
||||||
|
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||||
|
---
|
||||||
|
drivers/net/ethernet/broadcom/bcm4908_enet.c | 19 +++++++------------
|
||||||
|
1 file changed, 7 insertions(+), 12 deletions(-)
|
||||||
|
|
||||||
|
--- a/drivers/net/ethernet/broadcom/bcm4908_enet.c
|
||||||
|
+++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c
|
||||||
|
@@ -75,17 +75,17 @@ struct bcm4908_enet {
|
||||||
|
* R/W ops
|
||||||
|
*/
|
||||||
|
|
||||||
|
-static inline u32 enet_read(struct bcm4908_enet *enet, u16 offset)
|
||||||
|
+static u32 enet_read(struct bcm4908_enet *enet, u16 offset)
|
||||||
|
{
|
||||||
|
return readl(enet->base + offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
-static inline void enet_write(struct bcm4908_enet *enet, u16 offset, u32 value)
|
||||||
|
+static void enet_write(struct bcm4908_enet *enet, u16 offset, u32 value)
|
||||||
|
{
|
||||||
|
writel(value, enet->base + offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
-static inline void enet_maskset(struct bcm4908_enet *enet, u16 offset, u32 mask, u32 set)
|
||||||
|
+static void enet_maskset(struct bcm4908_enet *enet, u16 offset, u32 mask, u32 set)
|
||||||
|
{
|
||||||
|
u32 val;
|
||||||
|
|
||||||
|
@@ -96,27 +96,22 @@ static inline void enet_maskset(struct b
|
||||||
|
enet_write(enet, offset, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
-static inline void enet_set(struct bcm4908_enet *enet, u16 offset, u32 set)
|
||||||
|
+static void enet_set(struct bcm4908_enet *enet, u16 offset, u32 set)
|
||||||
|
{
|
||||||
|
enet_maskset(enet, offset, set, set);
|
||||||
|
}
|
||||||
|
|
||||||
|
-static inline u32 enet_umac_read(struct bcm4908_enet *enet, u16 offset)
|
||||||
|
+static u32 enet_umac_read(struct bcm4908_enet *enet, u16 offset)
|
||||||
|
{
|
||||||
|
return enet_read(enet, ENET_UNIMAC + offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
-static inline void enet_umac_write(struct bcm4908_enet *enet, u16 offset, u32 value)
|
||||||
|
+static void enet_umac_write(struct bcm4908_enet *enet, u16 offset, u32 value)
|
||||||
|
{
|
||||||
|
enet_write(enet, ENET_UNIMAC + offset, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
-static inline void enet_umac_maskset(struct bcm4908_enet *enet, u16 offset, u32 mask, u32 set)
|
||||||
|
-{
|
||||||
|
- enet_maskset(enet, ENET_UNIMAC + offset, mask, set);
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-static inline void enet_umac_set(struct bcm4908_enet *enet, u16 offset, u32 set)
|
||||||
|
+static void enet_umac_set(struct bcm4908_enet *enet, u16 offset, u32 set)
|
||||||
|
{
|
||||||
|
enet_set(enet, ENET_UNIMAC + offset, set);
|
||||||
|
}
|
@ -0,0 +1,60 @@
|
|||||||
|
From e3948811720341f99cd5cb4a8a650473400ec4f8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||||
|
Date: Thu, 11 Feb 2021 13:12:37 +0100
|
||||||
|
Subject: [PATCH] net: broadcom: bcm4908_enet: fix minor typos
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
1. Fix "ensable" typo noticed by Andrew
|
||||||
|
2. Fix chipset name in the struct net_device_ops variable
|
||||||
|
|
||||||
|
Suggested-by: Andrew Lunn <andrew@lunn.ch>
|
||||||
|
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||||
|
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||||
|
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
|
||||||
|
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||||
|
---
|
||||||
|
drivers/net/ethernet/broadcom/bcm4908_enet.c | 10 +++++-----
|
||||||
|
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
--- a/drivers/net/ethernet/broadcom/bcm4908_enet.c
|
||||||
|
+++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c
|
||||||
|
@@ -328,8 +328,8 @@ static int bcm4908_enet_dma_init(struct
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static void bcm4908_enet_dma_tx_ring_ensable(struct bcm4908_enet *enet,
|
||||||
|
- struct bcm4908_enet_dma_ring *ring)
|
||||||
|
+static void bcm4908_enet_dma_tx_ring_enable(struct bcm4908_enet *enet,
|
||||||
|
+ struct bcm4908_enet_dma_ring *ring)
|
||||||
|
{
|
||||||
|
enet_write(enet, ring->cfg_block + ENET_DMA_CH_CFG, ENET_DMA_CH_CFG_ENABLE);
|
||||||
|
}
|
||||||
|
@@ -519,7 +519,7 @@ static int bcm4908_enet_start_xmit(struc
|
||||||
|
buf_desc->addr = cpu_to_le32((uint32_t)slot->dma_addr);
|
||||||
|
buf_desc->ctl = cpu_to_le32(tmp);
|
||||||
|
|
||||||
|
- bcm4908_enet_dma_tx_ring_ensable(enet, &enet->tx_ring);
|
||||||
|
+ bcm4908_enet_dma_tx_ring_enable(enet, &enet->tx_ring);
|
||||||
|
|
||||||
|
if (++ring->write_idx == ring->length - 1)
|
||||||
|
ring->write_idx = 0;
|
||||||
|
@@ -583,7 +583,7 @@ static int bcm4908_enet_poll(struct napi
|
||||||
|
return handled;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static const struct net_device_ops bcm96xx_netdev_ops = {
|
||||||
|
+static const struct net_device_ops bcm4908_enet_netdev_ops = {
|
||||||
|
.ndo_open = bcm4908_enet_open,
|
||||||
|
.ndo_stop = bcm4908_enet_stop,
|
||||||
|
.ndo_start_xmit = bcm4908_enet_start_xmit,
|
||||||
|
@@ -623,7 +623,7 @@ static int bcm4908_enet_probe(struct pla
|
||||||
|
|
||||||
|
SET_NETDEV_DEV(netdev, &pdev->dev);
|
||||||
|
eth_hw_addr_random(netdev);
|
||||||
|
- netdev->netdev_ops = &bcm96xx_netdev_ops;
|
||||||
|
+ netdev->netdev_ops = &bcm4908_enet_netdev_ops;
|
||||||
|
netdev->min_mtu = ETH_ZLEN;
|
||||||
|
netdev->mtu = ENET_MTU_MAX;
|
||||||
|
netdev->max_mtu = ENET_MTU_MAX;
|
@ -0,0 +1,28 @@
|
|||||||
|
From 195e2d9febfbeef1d09701c387925e5c2f5cb038 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||||
|
Date: Thu, 11 Feb 2021 13:12:38 +0100
|
||||||
|
Subject: [PATCH] net: broadcom: bcm4908_enet: fix received skb length
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Use ETH_FCS_LEN instead of magic value and drop incorrect + 2
|
||||||
|
|
||||||
|
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||||
|
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
|
||||||
|
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||||
|
---
|
||||||
|
drivers/net/ethernet/broadcom/bcm4908_enet.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
--- a/drivers/net/ethernet/broadcom/bcm4908_enet.c
|
||||||
|
+++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c
|
||||||
|
@@ -567,7 +567,7 @@ static int bcm4908_enet_poll(struct napi
|
||||||
|
|
||||||
|
dma_unmap_single(dev, slot.dma_addr, slot.len, DMA_FROM_DEVICE);
|
||||||
|
|
||||||
|
- skb_put(slot.skb, len - 4 + 2);
|
||||||
|
+ skb_put(slot.skb, len - ETH_FCS_LEN);
|
||||||
|
slot.skb->protocol = eth_type_trans(slot.skb, enet->netdev);
|
||||||
|
netif_receive_skb(slot.skb);
|
||||||
|
|
@ -0,0 +1,28 @@
|
|||||||
|
From bdd70b997799099597fc0952fb0ec1bd80505bc4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||||
|
Date: Thu, 11 Feb 2021 13:12:39 +0100
|
||||||
|
Subject: [PATCH] net: broadcom: bcm4908_enet: fix endianness in xmit code
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Use le32_to_cpu() for reading __le32 struct field filled by hw.
|
||||||
|
|
||||||
|
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||||
|
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
|
||||||
|
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||||
|
---
|
||||||
|
drivers/net/ethernet/broadcom/bcm4908_enet.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
--- a/drivers/net/ethernet/broadcom/bcm4908_enet.c
|
||||||
|
+++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c
|
||||||
|
@@ -476,7 +476,7 @@ static int bcm4908_enet_start_xmit(struc
|
||||||
|
/* Free transmitted skbs */
|
||||||
|
while (ring->read_idx != ring->write_idx) {
|
||||||
|
buf_desc = &ring->buf_desc[ring->read_idx];
|
||||||
|
- if (buf_desc->ctl & DMA_CTL_STATUS_OWN)
|
||||||
|
+ if (le32_to_cpu(buf_desc->ctl) & DMA_CTL_STATUS_OWN)
|
||||||
|
break;
|
||||||
|
slot = &ring->slots[ring->read_idx];
|
||||||
|
|
@ -24,7 +24,7 @@ Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
|
|||||||
|
|
||||||
--- a/MAINTAINERS
|
--- a/MAINTAINERS
|
||||||
+++ b/MAINTAINERS
|
+++ b/MAINTAINERS
|
||||||
@@ -3405,6 +3405,16 @@ L: linux-mips@vger.kernel.org
|
@@ -3414,6 +3414,16 @@ L: linux-mips@vger.kernel.org
|
||||||
S: Maintained
|
S: Maintained
|
||||||
F: drivers/firmware/broadcom/*
|
F: drivers/firmware/broadcom/*
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|||||||
|
|
||||||
--- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi
|
--- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi
|
||||||
+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi
|
+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi
|
||||||
@@ -112,6 +112,13 @@
|
@@ -112,6 +112,14 @@
|
||||||
#size-cells = <1>;
|
#size-cells = <1>;
|
||||||
ranges = <0x00 0x00 0x80000000 0x281000>;
|
ranges = <0x00 0x00 0x80000000 0x281000>;
|
||||||
|
|
||||||
@ -21,12 +21,13 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|||||||
+ reg = <0x2000 0x1000>;
|
+ reg = <0x2000 0x1000>;
|
||||||
+
|
+
|
||||||
+ interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
|
+ interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
|
||||||
|
+ interrupt-names = "rx";
|
||||||
+ };
|
+ };
|
||||||
+
|
+
|
||||||
usb_phy: usb-phy@c200 {
|
usb_phy: usb-phy@c200 {
|
||||||
compatible = "brcm,bcm4908-usb-phy";
|
compatible = "brcm,bcm4908-usb-phy";
|
||||||
reg = <0xc200 0x100>;
|
reg = <0xc200 0x100>;
|
||||||
@@ -199,6 +206,18 @@
|
@@ -199,6 +207,18 @@
|
||||||
phy-mode = "internal";
|
phy-mode = "internal";
|
||||||
phy-handle = <&phy11>;
|
phy-handle = <&phy11>;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user