diff options
Diffstat (limited to 'target/linux/bcm4908')
101 files changed, 0 insertions, 12431 deletions
diff --git a/target/linux/bcm4908/config-5.4 b/target/linux/bcm4908/config-5.4 deleted file mode 100644 index 0f0b80f362..0000000000 --- a/target/linux/bcm4908/config-5.4 +++ /dev/null @@ -1,225 +0,0 @@ -CONFIG_64BIT=y -CONFIG_ARCH_BCM4908=y -CONFIG_ARCH_CLOCKSOURCE_DATA=y -CONFIG_ARCH_DMA_ADDR_T_64BIT=y -CONFIG_ARCH_KEEP_MEMBLOCK=y -CONFIG_ARCH_MMAP_RND_BITS=18 -CONFIG_ARCH_MMAP_RND_BITS_MAX=24 -CONFIG_ARCH_MMAP_RND_BITS_MIN=18 -CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11 -CONFIG_ARCH_PROC_KCORE_TEXT=y -CONFIG_ARCH_SELECT_MEMORY_MODEL=y -CONFIG_ARCH_SPARSEMEM_DEFAULT=y -CONFIG_ARCH_SPARSEMEM_ENABLE=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARM64=y -CONFIG_ARM64_4K_PAGES=y -CONFIG_ARM64_CONT_SHIFT=4 -CONFIG_ARM64_PAGE_SHIFT=12 -CONFIG_ARM64_PA_BITS=48 -CONFIG_ARM64_PA_BITS_48=y -CONFIG_ARM64_PTR_AUTH=y -CONFIG_ARM64_SSBD=y -CONFIG_ARM64_SVE=y -CONFIG_ARM64_TAGGED_ADDR_ABI=y -CONFIG_ARM64_VA_BITS=39 -CONFIG_ARM64_VA_BITS_39=y -CONFIG_ARM_AMBA=y -CONFIG_ARM_ARCH_TIMER=y -CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y -CONFIG_ARM_GIC=y -CONFIG_ARM_GIC_V3=y -CONFIG_ARM_GIC_V3_ITS=y -CONFIG_ARM_PSCI_FW=y -CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y -CONFIG_B53=y -CONFIG_BCM4908_ENET=y -CONFIG_BCM7038_WDT=y -CONFIG_BCM7XXX_PHY=y -CONFIG_BCM_NET_PHYLIB=y -CONFIG_BCM_PMB=y -# CONFIG_BLK_DEV_INITRD is not set -CONFIG_BLK_PM=y -CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y -CONFIG_CLKDEV_LOOKUP=y -CONFIG_CLONE_BACKWARDS=y -CONFIG_CMDLINE="earlycon=bcm63xx_uart,0xff800640 console=ttyS0,115200" -CONFIG_CMDLINE_FORCE=y -CONFIG_COMMON_CLK=y -CONFIG_CPU_RMAP=y -CONFIG_CRC16=y -CONFIG_CRYPTO_ACOMP2=y -CONFIG_CRYPTO_AEAD=y -CONFIG_CRYPTO_AEAD2=y -CONFIG_CRYPTO_DEFLATE=y -CONFIG_CRYPTO_HASH2=y -CONFIG_CRYPTO_HASH_INFO=y -CONFIG_CRYPTO_LZO=y -CONFIG_CRYPTO_MANAGER=y -CONFIG_CRYPTO_MANAGER2=y -CONFIG_CRYPTO_NULL2=y -CONFIG_CRYPTO_RNG2=y -CONFIG_CRYPTO_ZSTD=y -CONFIG_DCACHE_WORD_ACCESS=y -CONFIG_DMA_DIRECT_REMAP=y -CONFIG_DMA_REMAP=y -CONFIG_DRM_RCAR_WRITEBACK=y -CONFIG_DTC=y -CONFIG_EDAC_SUPPORT=y -CONFIG_FIXED_PHY=y -CONFIG_FIX_EARLYCON_MEM=y -CONFIG_FRAME_POINTER=y -CONFIG_FW_LOADER_PAGED_BUF=y -CONFIG_GENERIC_ALLOCATOR=y -CONFIG_GENERIC_ARCH_TOPOLOGY=y -CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y -CONFIG_GENERIC_CPU_AUTOPROBE=y -CONFIG_GENERIC_CPU_VULNERABILITIES=y -CONFIG_GENERIC_CSUM=y -CONFIG_GENERIC_EARLY_IOREMAP=y -CONFIG_GENERIC_GETTIMEOFDAY=y -CONFIG_GENERIC_IDLE_POLL_SETUP=y -CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y -CONFIG_GENERIC_IRQ_MULTI_HANDLER=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_GENERIC_IRQ_SHOW_LEVEL=y -CONFIG_GENERIC_MSI_IRQ=y -CONFIG_GENERIC_MSI_IRQ_DOMAIN=y -CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_GENERIC_PHY=y -CONFIG_GENERIC_PINCONF=y -CONFIG_GENERIC_PINCTRL_GROUPS=y -CONFIG_GENERIC_PINMUX_FUNCTIONS=y -CONFIG_GENERIC_SCHED_CLOCK=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_GENERIC_STRNCPY_FROM_USER=y -CONFIG_GENERIC_STRNLEN_USER=y -CONFIG_GENERIC_TIME_VSYSCALL=y -CONFIG_GPIOLIB=y -CONFIG_GPIO_GENERIC=y -CONFIG_GPIO_GENERIC_PLATFORM=y -CONFIG_GRO_CELLS=y -CONFIG_HANDLE_DOMAIN_IRQ=y -CONFIG_HARDEN_BRANCH_PREDICTOR=y -CONFIG_HARDIRQS_SW_RESEND=y -CONFIG_HAS_DMA=y -CONFIG_HAS_IOMEM=y -CONFIG_HOLES_IN_ZONE=y -CONFIG_HZ_PERIODIC=y -CONFIG_I2C=y -CONFIG_I2C_BOARDINFO=y -CONFIG_I2C_BRCMSTB=y -CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 -CONFIG_IRQCHIP=y -CONFIG_IRQ_DOMAIN=y -CONFIG_IRQ_DOMAIN_HIERARCHY=y -CONFIG_IRQ_FORCED_THREADING=y -CONFIG_IRQ_WORK=y -CONFIG_LEDS_GPIO=y -CONFIG_LIBFDT=y -CONFIG_LOCK_DEBUGGING_SUPPORT=y -CONFIG_LOCK_SPIN_ON_OWNER=y -CONFIG_LZO_COMPRESS=y -CONFIG_LZO_DECOMPRESS=y -CONFIG_MDIO_BCM_UNIMAC=y -CONFIG_MDIO_BUS=y -CONFIG_MDIO_DEVICE=y -CONFIG_MEMFD_CREATE=y -CONFIG_MFD_SYSCON=y -CONFIG_MIGRATION=y -CONFIG_MODULES_USE_ELF_RELA=y -CONFIG_MTD_CMDLINE_PARTS=y -CONFIG_MTD_NAND_BRCMNAND=y -CONFIG_MTD_NAND_CORE=y -CONFIG_MTD_NAND_ECC_SW_HAMMING=y -CONFIG_MTD_OF_PARTS_BCM4908=y -# CONFIG_MTD_OF_PARTS_LINKSYS_NS is not set -CONFIG_MTD_RAW_NAND=y -CONFIG_MTD_SPLIT_CFE_BOOTFS=y -# CONFIG_MTD_SPLIT_SQUASHFS_ROOT is not set -CONFIG_MTD_UBI=y -CONFIG_MTD_UBI_BEB_LIMIT=20 -CONFIG_MTD_UBI_BLOCK=y -CONFIG_MTD_UBI_WL_THRESHOLD=4096 -CONFIG_MUTEX_SPIN_ON_OWNER=y -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_NEED_SG_DMA_LENGTH=y -CONFIG_NET_DEVLINK=y -CONFIG_NET_DSA=y -CONFIG_NET_DSA_BCM_SF2=y -CONFIG_NET_DSA_TAG_BRCM=y -CONFIG_NET_DSA_TAG_BRCM_COMMON=y -CONFIG_NET_DSA_TAG_BRCM_PREPEND=y -CONFIG_NET_FLOW_LIMIT=y -CONFIG_NET_SWITCHDEV=y -CONFIG_NO_IOPORT_MAP=y -CONFIG_NR_CPUS=4 -CONFIG_OF=y -CONFIG_OF_ADDRESS=y -CONFIG_OF_EARLY_FLATTREE=y -CONFIG_OF_FLATTREE=y -CONFIG_OF_GPIO=y -CONFIG_OF_IRQ=y -CONFIG_OF_KOBJ=y -CONFIG_OF_MDIO=y -CONFIG_OF_NET=y -CONFIG_PADATA=y -CONFIG_PARTITION_PERCPU=y -CONFIG_PGTABLE_LEVELS=3 -CONFIG_PHYLIB=y -CONFIG_PHYLINK=y -CONFIG_PHYS_ADDR_T_64BIT=y -CONFIG_PHY_BRCM_USB=y -CONFIG_PINCTRL=y -CONFIG_PINCTRL_BCM4908=y -# CONFIG_PINCTRL_SINGLE is not set -CONFIG_PM=y -CONFIG_PM_CLK=y -CONFIG_PM_GENERIC_DOMAINS=y -CONFIG_PM_GENERIC_DOMAINS_OF=y -CONFIG_POWER_RESET=y -CONFIG_POWER_RESET_SYSCON=y -CONFIG_POWER_SUPPLY=y -CONFIG_QUEUED_RWLOCKS=y -CONFIG_QUEUED_SPINLOCKS=y -CONFIG_RATIONAL=y -CONFIG_REFCOUNT_FULL=y -CONFIG_REGMAP=y -CONFIG_REGMAP_MMIO=y -CONFIG_RFS_ACCEL=y -CONFIG_RODATA_FULL_DEFAULT_ENABLED=y -CONFIG_RPS=y -CONFIG_RWSEM_SPIN_ON_OWNER=y -# CONFIG_SERIAL_8250 is not set -CONFIG_SERIAL_BCM63XX=y -CONFIG_SERIAL_BCM63XX_CONSOLE=y -CONFIG_SGL_ALLOC=y -CONFIG_SMP=y -CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y -CONFIG_SPARSE_IRQ=y -CONFIG_SRCU=y -CONFIG_SWIOTLB=y -CONFIG_SWPHY=y -CONFIG_SYSCTL_EXCEPTION_TRACE=y -CONFIG_SYS_SUPPORTS_HUGETLBFS=y -CONFIG_THREAD_INFO_IN_TASK=y -CONFIG_TICK_CPU_ACCOUNTING=y -CONFIG_TIMER_OF=y -CONFIG_TIMER_PROBE=y -CONFIG_TREE_RCU=y -CONFIG_TREE_SRCU=y -CONFIG_UBIFS_FS=y -CONFIG_UNMAP_KERNEL_AT_EL0=y -CONFIG_USB_SUPPORT=y -CONFIG_VMAP_STACK=y -CONFIG_WATCHDOG_CORE=y -CONFIG_XPS=y -CONFIG_XXHASH=y -CONFIG_ZLIB_DEFLATE=y -CONFIG_ZLIB_INFLATE=y -CONFIG_ZONE_DMA32=y -CONFIG_ZSTD_COMPRESS=y -CONFIG_ZSTD_DECOMPRESS=y diff --git a/target/linux/bcm4908/files-5.4/drivers/net/ethernet/broadcom/unimac.h b/target/linux/bcm4908/files-5.4/drivers/net/ethernet/broadcom/unimac.h deleted file mode 100644 index 585a852862..0000000000 --- a/target/linux/bcm4908/files-5.4/drivers/net/ethernet/broadcom/unimac.h +++ /dev/null @@ -1,68 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -#ifndef __UNIMAC_H -#define __UNIMAC_H - -#define UMAC_HD_BKP_CTRL 0x004 -#define HD_FC_EN (1 << 0) -#define HD_FC_BKOFF_OK (1 << 1) -#define IPG_CONFIG_RX_SHIFT 2 -#define IPG_CONFIG_RX_MASK 0x1F -#define UMAC_CMD 0x008 -#define CMD_TX_EN (1 << 0) -#define CMD_RX_EN (1 << 1) -#define CMD_SPEED_10 0 -#define CMD_SPEED_100 1 -#define CMD_SPEED_1000 2 -#define CMD_SPEED_2500 3 -#define CMD_SPEED_SHIFT 2 -#define CMD_SPEED_MASK 3 -#define CMD_PROMISC (1 << 4) -#define CMD_PAD_EN (1 << 5) -#define CMD_CRC_FWD (1 << 6) -#define CMD_PAUSE_FWD (1 << 7) -#define CMD_RX_PAUSE_IGNORE (1 << 8) -#define CMD_TX_ADDR_INS (1 << 9) -#define CMD_HD_EN (1 << 10) -#define CMD_SW_RESET_OLD (1 << 11) -#define CMD_SW_RESET (1 << 13) -#define CMD_LCL_LOOP_EN (1 << 15) -#define CMD_AUTO_CONFIG (1 << 22) -#define CMD_CNTL_FRM_EN (1 << 23) -#define CMD_NO_LEN_CHK (1 << 24) -#define CMD_RMT_LOOP_EN (1 << 25) -#define CMD_RX_ERR_DISC (1 << 26) -#define CMD_PRBL_EN (1 << 27) -#define CMD_TX_PAUSE_IGNORE (1 << 28) -#define CMD_TX_RX_EN (1 << 29) -#define CMD_RUNT_FILTER_DIS (1 << 30) -#define UMAC_MAC0 0x00c -#define UMAC_MAC1 0x010 -#define UMAC_MAX_FRAME_LEN 0x014 -#define UMAC_PAUSE_QUANTA 0x018 -#define UMAC_MODE 0x044 -#define MODE_LINK_STATUS (1 << 5) -#define UMAC_FRM_TAG0 0x048 /* outer tag */ -#define UMAC_FRM_TAG1 0x04c /* inner tag */ -#define UMAC_TX_IPG_LEN 0x05c -#define UMAC_EEE_CTRL 0x064 -#define EN_LPI_RX_PAUSE (1 << 0) -#define EN_LPI_TX_PFC (1 << 1) -#define EN_LPI_TX_PAUSE (1 << 2) -#define EEE_EN (1 << 3) -#define RX_FIFO_CHECK (1 << 4) -#define EEE_TX_CLK_DIS (1 << 5) -#define DIS_EEE_10M (1 << 6) -#define LP_IDLE_PREDICTION_MODE (1 << 7) -#define UMAC_EEE_LPI_TIMER 0x068 -#define UMAC_EEE_WAKE_TIMER 0x06C -#define UMAC_EEE_REF_COUNT 0x070 -#define EEE_REFERENCE_COUNT_MASK 0xffff -#define UMAC_RX_IPG_INV 0x078 -#define UMAC_MACSEC_PROG_TX_CRC 0x310 -#define UMAC_MACSEC_CTRL 0x314 -#define UMAC_PAUSE_CTRL 0x330 -#define UMAC_TX_FLUSH 0x334 -#define UMAC_RX_FIFO_STATUS 0x338 -#define UMAC_TX_FIFO_STATUS 0x33c - -#endif diff --git a/target/linux/bcm4908/patches-5.4/030-v5.11-0001-dt-bindings-arm-bcm-document-BCM4908-bindings.patch b/target/linux/bcm4908/patches-5.4/030-v5.11-0001-dt-bindings-arm-bcm-document-BCM4908-bindings.patch deleted file mode 100644 index 66726cbf0b..0000000000 --- a/target/linux/bcm4908/patches-5.4/030-v5.11-0001-dt-bindings-arm-bcm-document-BCM4908-bindings.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 2f8913a7b17efd3a116825160a2d3a6610444587 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Thu, 12 Nov 2020 16:08:31 +0100 -Subject: [PATCH] dt-bindings: arm: bcm: document BCM4908 bindings -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -BCM4908 is a new family that includes BCM4906, BCM4908 and BCM49408. -It's mostly used in home routers and often replaces Northstar in vendors -portfolio. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> ---- - .../bindings/arm/bcm/brcm,bcm4908.yaml | 38 +++++++++++++++++++ - 1 file changed, 38 insertions(+) - create mode 100644 Documentation/devicetree/bindings/arm/bcm/brcm,bcm4908.yaml - ---- /dev/null -+++ b/Documentation/devicetree/bindings/arm/bcm/brcm,bcm4908.yaml -@@ -0,0 +1,38 @@ -+# SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause -+%YAML 1.2 -+--- -+$id: http://devicetree.org/schemas/arm/bcm/brcm,bcm4908.yaml# -+$schema: http://devicetree.org/meta-schemas/core.yaml# -+ -+title: Broadcom BCM4908 device tree bindings -+ -+description: -+ Broadcom BCM4906 / BCM4908 / BCM49408 Wi-Fi/network SoCs with Brahma CPUs. -+ -+maintainers: -+ - Rafał Miłecki <rafal@milecki.pl> -+ -+properties: -+ $nodename: -+ const: '/' -+ compatible: -+ oneOf: -+ - description: BCM4906 based boards -+ items: -+ - const: brcm,bcm4906 -+ - const: brcm,bcm4908 -+ -+ - description: BCM4908 based boards -+ items: -+ - enum: -+ - asus,gt-ac5300 -+ - const: brcm,bcm4908 -+ -+ - description: BCM49408 based boards -+ items: -+ - const: brcm,bcm49408 -+ - const: brcm,bcm4908 -+ -+additionalProperties: true -+ -+... diff --git a/target/linux/bcm4908/patches-5.4/030-v5.11-0002-arm64-dts-broadcom-add-BCM4908-and-Asus-GT-AC5300-ea.patch b/target/linux/bcm4908/patches-5.4/030-v5.11-0002-arm64-dts-broadcom-add-BCM4908-and-Asus-GT-AC5300-ea.patch deleted file mode 100644 index 3598b5b9c7..0000000000 --- a/target/linux/bcm4908/patches-5.4/030-v5.11-0002-arm64-dts-broadcom-add-BCM4908-and-Asus-GT-AC5300-ea.patch +++ /dev/null @@ -1,307 +0,0 @@ -From 2961f69f151c0a6771f55cef46398fe49ca20902 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Thu, 12 Nov 2020 16:08:32 +0100 -Subject: [PATCH] arm64: dts: broadcom: add BCM4908 and Asus GT-AC5300 early - DTS files -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -They don't descibe hardware fully yet but it's enough to boot a system. - -Some missing blocks: -1. PMC (Power Management Controller?) -2. Ethernet -3. Crypto -4. Thermal - -Asus DTS is missing defining full NAND partitions layout and buttons. - -Further changes will fill those gaps as soon as required bindings will -be found / tested / added. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> ---- - arch/arm64/boot/dts/broadcom/Makefile | 1 + - arch/arm64/boot/dts/broadcom/bcm4908/Makefile | 2 + - .../bcm4908/bcm4908-asus-gt-ac5300.dts | 66 +++++++ - .../boot/dts/broadcom/bcm4908/bcm4908.dtsi | 187 ++++++++++++++++++ - 4 files changed, 256 insertions(+) - create mode 100644 arch/arm64/boot/dts/broadcom/bcm4908/Makefile - create mode 100644 arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-asus-gt-ac5300.dts - create mode 100644 arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi - ---- a/arch/arm64/boot/dts/broadcom/Makefile -+++ b/arch/arm64/boot/dts/broadcom/Makefile -@@ -4,5 +4,6 @@ dtb-$(CONFIG_ARCH_BCM2835) += bcm2837-rp - bcm2837-rpi-3-b-plus.dtb \ - bcm2837-rpi-cm3-io3.dtb - -+subdir-y += bcm4908 - subdir-y += northstar2 - subdir-y += stingray ---- /dev/null -+++ b/arch/arm64/boot/dts/broadcom/bcm4908/Makefile -@@ -0,0 +1,2 @@ -+# SPDX-License-Identifier: GPL-2.0 -+dtb-$(CONFIG_ARCH_BCM4908) += bcm4908-asus-gt-ac5300.dtb ---- /dev/null -+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-asus-gt-ac5300.dts -@@ -0,0 +1,66 @@ -+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -+ -+#include <dt-bindings/gpio/gpio.h> -+#include <dt-bindings/input/input.h> -+ -+#include "bcm4908.dtsi" -+ -+/ { -+ compatible = "asus,gt-ac5300", "brcm,bcm4908"; -+ model = "Asus GT-AC5300"; -+ -+ memory@0 { -+ device_type = "memory"; -+ reg = <0x00 0x00 0x00 0x40000000>; -+ }; -+ -+ gpio-keys-polled { -+ compatible = "gpio-keys-polled"; -+ poll-interval = <100>; -+ -+ wifi { -+ label = "WiFi"; -+ linux,code = <KEY_RFKILL>; -+ gpios = <&gpio0 28 GPIO_ACTIVE_LOW>; -+ }; -+ -+ wps { -+ label = "WPS"; -+ linux,code = <KEY_WPS_BUTTON>; -+ gpios = <&gpio0 29 GPIO_ACTIVE_LOW>; -+ }; -+ -+ restart { -+ label = "Reset"; -+ linux,code = <KEY_RESTART>; -+ gpios = <&gpio0 30 GPIO_ACTIVE_LOW>; -+ }; -+ -+ brightness { -+ label = "LEDs"; -+ linux,code = <KEY_BRIGHTNESS_ZERO>; -+ gpios = <&gpio0 31 GPIO_ACTIVE_LOW>; -+ }; -+ }; -+}; -+ -+&nandcs { -+ nand-ecc-strength = <4>; -+ nand-ecc-step-size = <512>; -+ nand-on-flash-bbt; -+ brcm,nand-has-wp; -+ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ partitions { -+ compatible = "fixed-partitions"; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ -+ partition@0 { -+ label = "cferom"; -+ reg = <0x0 0x100000>; -+ }; -+ }; -+}; ---- /dev/null -+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi -@@ -0,0 +1,187 @@ -+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -+ -+#include <dt-bindings/interrupt-controller/irq.h> -+#include <dt-bindings/interrupt-controller/arm-gic.h> -+ -+/dts-v1/; -+ -+/ { -+ interrupt-parent = <&gic>; -+ -+ #address-cells = <2>; -+ #size-cells = <2>; -+ -+ aliases { -+ serial0 = &uart0; -+ }; -+ -+ chosen { -+ stdout-path = "serial0:115200n8"; -+ }; -+ -+ cpus { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ cpu0: cpu@0 { -+ device_type = "cpu"; -+ compatible = "brcm,brahma-b53"; -+ reg = <0x0>; -+ next-level-cache = <&l2>; -+ }; -+ -+ cpu1: cpu@1 { -+ device_type = "cpu"; -+ compatible = "brcm,brahma-b53"; -+ reg = <0x1>; -+ enable-method = "spin-table"; -+ cpu-release-addr = <0x0 0xfff8>; -+ next-level-cache = <&l2>; -+ }; -+ -+ cpu2: cpu@2 { -+ device_type = "cpu"; -+ compatible = "brcm,brahma-b53"; -+ reg = <0x2>; -+ enable-method = "spin-table"; -+ cpu-release-addr = <0x0 0xfff8>; -+ next-level-cache = <&l2>; -+ }; -+ -+ cpu3: cpu@3 { -+ device_type = "cpu"; -+ compatible = "brcm,brahma-b53"; -+ reg = <0x3>; -+ enable-method = "spin-table"; -+ cpu-release-addr = <0x0 0xfff8>; -+ next-level-cache = <&l2>; -+ }; -+ -+ l2: l2-cache0 { -+ compatible = "cache"; -+ }; -+ }; -+ -+ axi@81000000 { -+ compatible = "simple-bus"; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ ranges = <0x00 0x00 0x81000000 0x4000>; -+ -+ gic: interrupt-controller@1000 { -+ compatible = "arm,gic-400"; -+ #interrupt-cells = <3>; -+ #address-cells = <0>; -+ interrupt-controller; -+ reg = <0x1000 0x1000>, -+ <0x2000 0x2000>; -+ }; -+ }; -+ -+ timer { -+ compatible = "arm,armv8-timer"; -+ interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, -+ <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, -+ <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, -+ <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>; -+ }; -+ -+ pmu { -+ compatible = "arm,cortex-a53-pmu"; -+ interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>, -+ <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>, -+ <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>, -+ <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>; -+ interrupt-affinity = <&cpu0>, <&cpu1>, <&cpu2>, <&cpu3>; -+ }; -+ -+ clocks { -+ periph_clk: periph_clk { -+ compatible = "fixed-clock"; -+ #clock-cells = <0>; -+ clock-frequency = <50000000>; -+ clock-output-names = "periph"; -+ }; -+ }; -+ -+ soc { -+ compatible = "simple-bus"; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ ranges = <0x00 0x00 0x80000000 0x10000>; -+ -+ usb@c300 { -+ compatible = "generic-ehci"; -+ reg = <0xc300 0x100>; -+ interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>; -+ status = "disabled"; -+ }; -+ -+ usb@c400 { -+ compatible = "generic-ohci"; -+ reg = <0xc400 0x100>; -+ interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>; -+ status = "disabled"; -+ }; -+ -+ usb@d000 { -+ compatible = "generic-xhci"; -+ reg = <0xd000 0x8c8>; -+ interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>; -+ status = "disabled"; -+ }; -+ }; -+ -+ bus@ff800000 { -+ compatible = "simple-bus"; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ ranges = <0x00 0x00 0xff800000 0x3000>; -+ -+ timer: timer@400 { -+ compatible = "brcm,bcm6328-timer", "syscon"; -+ reg = <0x400 0x3c>; -+ }; -+ -+ gpio0: gpio-controller@500 { -+ compatible = "brcm,bcm6345-gpio"; -+ reg-names = "dirout", "dat"; -+ reg = <0x500 0x28>, <0x528 0x28>; -+ -+ #gpio-cells = <2>; -+ gpio-controller; -+ }; -+ -+ uart0: serial@640 { -+ compatible = "brcm,bcm6345-uart"; -+ reg = <0x640 0x18>; -+ interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>; -+ clocks = <&periph_clk>; -+ clock-names = "periph"; -+ status = "okay"; -+ }; -+ -+ nand@1800 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ compatible = "brcm,brcmnand-v7.1", "brcm,brcmnand"; -+ reg = <0x1800 0x600>, <0x2000 0x10>; -+ reg-names = "nand", "nand-int-base"; -+ interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>; -+ interrupt-names = "nand"; -+ status = "okay"; -+ -+ nandcs: nandcs@0 { -+ compatible = "brcm,nandcs"; -+ reg = <0>; -+ }; -+ }; -+ -+ reboot { -+ compatible = "syscon-reboot"; -+ regmap = <&timer>; -+ offset = <0x34>; -+ mask = <1>; -+ }; -+ }; -+}; diff --git a/target/linux/bcm4908/patches-5.4/030-v5.11-0003-v5.11-arm64-add-config-for-Broadcom-BCM4908-SoCs.patch b/target/linux/bcm4908/patches-5.4/030-v5.11-0003-v5.11-arm64-add-config-for-Broadcom-BCM4908-SoCs.patch deleted file mode 100644 index 42bdbf51b6..0000000000 --- a/target/linux/bcm4908/patches-5.4/030-v5.11-0003-v5.11-arm64-add-config-for-Broadcom-BCM4908-SoCs.patch +++ /dev/null @@ -1,44 +0,0 @@ -From dccb22d078ebd098115e4f66bde1ee2249c8640b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Thu, 12 Nov 2020 16:08:30 +0100 -Subject: [PATCH] arm64: add config for Broadcom BCM4908 SoCs -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Add ARCH_BCM4908 config that can be used for compiling DTS files. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> ---- - arch/arm64/Kconfig.platforms | 8 ++++++++ - arch/arm64/configs/defconfig | 1 + - 2 files changed, 9 insertions(+) - ---- a/arch/arm64/Kconfig.platforms -+++ b/arch/arm64/Kconfig.platforms -@@ -43,6 +43,14 @@ config ARCH_BCM2835 - This enables support for the Broadcom BCM2837 SoC. - This SoC is used in the Raspberry Pi 3 device. - -+config ARCH_BCM4908 -+ bool "Broadcom BCM4908 family" -+ select GPIOLIB -+ help -+ This enables support for the Broadcom BCM4906, BCM4908 and -+ BCM49408 SoCs. These SoCs use Brahma-B53 cores and can be -+ found in home routers. -+ - config ARCH_BCM_IPROC - bool "Broadcom iProc SoC Family" - select COMMON_CLK_IPROC ---- a/arch/arm64/configs/defconfig -+++ b/arch/arm64/configs/defconfig -@@ -33,6 +33,7 @@ CONFIG_ARCH_AGILEX=y - CONFIG_ARCH_SUNXI=y - CONFIG_ARCH_ALPINE=y - CONFIG_ARCH_BCM2835=y -+CONFIG_ARCH_BCM4908=y - CONFIG_ARCH_BCM_IPROC=y - CONFIG_ARCH_BERLIN=y - CONFIG_ARCH_BRCMSTB=y diff --git a/target/linux/bcm4908/patches-5.4/031-v5.12-0001-dt-bindings-arm-bcm-document-Netgear-R8000P-binding.patch b/target/linux/bcm4908/patches-5.4/031-v5.12-0001-dt-bindings-arm-bcm-document-Netgear-R8000P-binding.patch deleted file mode 100644 index 24a0749c77..0000000000 --- a/target/linux/bcm4908/patches-5.4/031-v5.12-0001-dt-bindings-arm-bcm-document-Netgear-R8000P-binding.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 3a5da4f54801ac42837a0b3151fa8285e01e8b0e Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Tue, 8 Dec 2020 08:03:03 +0100 -Subject: [PATCH] dt-bindings: arm: bcm: document Netgear R8000P binding -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -It's a BCM4906 based device. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Acked-by: Rob Herring <robh@kernel.org> -Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> ---- - Documentation/devicetree/bindings/arm/bcm/brcm,bcm4908.yaml | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/Documentation/devicetree/bindings/arm/bcm/brcm,bcm4908.yaml -+++ b/Documentation/devicetree/bindings/arm/bcm/brcm,bcm4908.yaml -@@ -19,6 +19,8 @@ properties: - oneOf: - - description: BCM4906 based boards - items: -+ - enum: -+ - netgear,r8000p - - const: brcm,bcm4906 - - const: brcm,bcm4908 - diff --git a/target/linux/bcm4908/patches-5.4/031-v5.12-0002-arm64-dts-broadcom-bcm4908-add-BCM4906-Netgear-R8000.patch b/target/linux/bcm4908/patches-5.4/031-v5.12-0002-arm64-dts-broadcom-bcm4908-add-BCM4906-Netgear-R8000.patch deleted file mode 100644 index 93fa2150af..0000000000 --- a/target/linux/bcm4908/patches-5.4/031-v5.12-0002-arm64-dts-broadcom-bcm4908-add-BCM4906-Netgear-R8000.patch +++ /dev/null @@ -1,104 +0,0 @@ -From c8b404fb05dcfadff477e49b7ea6b500e015f101 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Tue, 8 Dec 2020 08:03:04 +0100 -Subject: [PATCH 2/4] arm64: dts: broadcom: bcm4908: add BCM4906 Netgear R8000P - DTS files -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Netgear R8000P is home router based on BCM4906 that is a cheaper variant -of BCM4908 (e.g. 2 cores instead of 4). - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> ---- - arch/arm64/boot/dts/broadcom/bcm4908/Makefile | 1 + - .../bcm4908/bcm4906-netgear-r8000p.dts | 52 +++++++++++++++++++ - .../boot/dts/broadcom/bcm4908/bcm4906.dtsi | 18 +++++++ - 3 files changed, 71 insertions(+) - create mode 100644 arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-netgear-r8000p.dts - create mode 100644 arch/arm64/boot/dts/broadcom/bcm4908/bcm4906.dtsi - ---- a/arch/arm64/boot/dts/broadcom/bcm4908/Makefile -+++ b/arch/arm64/boot/dts/broadcom/bcm4908/Makefile -@@ -1,2 +1,3 @@ - # SPDX-License-Identifier: GPL-2.0 -+dtb-$(CONFIG_ARCH_BCM4908) += bcm4906-netgear-r8000p.dtb - dtb-$(CONFIG_ARCH_BCM4908) += bcm4908-asus-gt-ac5300.dtb ---- /dev/null -+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-netgear-r8000p.dts -@@ -0,0 +1,52 @@ -+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -+ -+#include <dt-bindings/gpio/gpio.h> -+#include <dt-bindings/input/input.h> -+#include <dt-bindings/leds/common.h> -+ -+#include "bcm4906.dtsi" -+ -+/ { -+ compatible = "netgear,r8000p", "brcm,bcm4906", "brcm,bcm4908"; -+ model = "Netgear R8000P"; -+ -+ memory@0 { -+ device_type = "memory"; -+ reg = <0x00 0x00 0x00 0x20000000>; -+ }; -+ -+ leds { -+ compatible = "gpio-leds"; -+ -+ wps { -+ function = LED_FUNCTION_WPS; -+ color = <LED_COLOR_ID_WHITE>; -+ gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; -+ }; -+ }; -+}; -+ -+&nandcs { -+ nand-ecc-strength = <4>; -+ nand-ecc-step-size = <512>; -+ nand-on-flash-bbt; -+ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ partitions { -+ compatible = "fixed-partitions"; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ -+ partition@0 { -+ label = "cferom"; -+ reg = <0x0 0x100000>; -+ }; -+ -+ partition@100000 { -+ label = "firmware"; -+ reg = <0x100000 0x4400000>; -+ }; -+ }; -+}; ---- /dev/null -+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906.dtsi -@@ -0,0 +1,18 @@ -+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -+ -+#include "bcm4908.dtsi" -+ -+/ { -+ cpus { -+ /delete-node/ cpu@2; -+ -+ /delete-node/ cpu@3; -+ }; -+ -+ pmu { -+ compatible = "arm,cortex-a53-pmu"; -+ interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>, -+ <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>; -+ interrupt-affinity = <&cpu0>, <&cpu1>; -+ }; -+}; diff --git a/target/linux/bcm4908/patches-5.4/031-v5.12-0003-arm64-dts-broadcom-bcm4908-use-proper-NAND-binding.patch b/target/linux/bcm4908/patches-5.4/031-v5.12-0003-arm64-dts-broadcom-bcm4908-use-proper-NAND-binding.patch deleted file mode 100644 index ccd260fadf..0000000000 --- a/target/linux/bcm4908/patches-5.4/031-v5.12-0003-arm64-dts-broadcom-bcm4908-use-proper-NAND-binding.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 56098be85d19cd56b59d7b3854ea035cc8cb9e95 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Tue, 8 Dec 2020 11:49:50 +0100 -Subject: [PATCH 3/4] arm64: dts: broadcom: bcm4908: use proper NAND binding -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -BCM4908 has controller that needs different IRQ handling just like the -BCM63138. Describe it properly. - -On Linux this change fixes: -brcmstb_nand ff801800.nand: timeout waiting for command 0x9 -brcmstb_nand ff801800.nand: intfc status d0000000 - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> ---- - arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi -+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi -@@ -164,7 +164,7 @@ - nand@1800 { - #address-cells = <1>; - #size-cells = <0>; -- compatible = "brcm,brcmnand-v7.1", "brcm,brcmnand"; -+ compatible = "brcm,nand-bcm63138", "brcm,brcmnand-v7.1", "brcm,brcmnand"; - reg = <0x1800 0x600>, <0x2000 0x10>; - reg-names = "nand", "nand-int-base"; - interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>; diff --git a/target/linux/bcm4908/patches-5.4/031-v5.12-0004-arm64-dts-broadcom-bcm4908-describe-PCIe-reset-contr.patch b/target/linux/bcm4908/patches-5.4/031-v5.12-0004-arm64-dts-broadcom-bcm4908-describe-PCIe-reset-contr.patch deleted file mode 100644 index 8ce4d69d8f..0000000000 --- a/target/linux/bcm4908/patches-5.4/031-v5.12-0004-arm64-dts-broadcom-bcm4908-describe-PCIe-reset-contr.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 1b88c6ed26a1aa1d68d1661404e6e939709ff530 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Thu, 10 Dec 2020 08:21:54 +0100 -Subject: [PATCH 4/4] arm64: dts: broadcom: bcm4908: describe PCIe reset - controller -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This reset controller is a single register in the Broadcom's MISC block. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> ---- - arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - ---- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi -+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi -@@ -177,6 +177,21 @@ - }; - }; - -+ misc@2600 { -+ compatible = "brcm,misc", "simple-mfd"; -+ reg = <0x2600 0xe4>; -+ -+ #address-cells = <1>; -+ #size-cells = <1>; -+ ranges = <0x00 0x2600 0xe4>; -+ -+ reset-controller@2644 { -+ compatible = "brcm,bcm4908-misc-pcie-reset"; -+ reg = <0x44 0x04>; -+ #reset-cells = <1>; -+ }; -+ }; -+ - reboot { - compatible = "syscon-reboot"; - regmap = <&timer>; diff --git a/target/linux/bcm4908/patches-5.4/031-v5.12-0005-arm64-dts-broadcom-bcm4908-describe-internal-switch.patch b/target/linux/bcm4908/patches-5.4/031-v5.12-0005-arm64-dts-broadcom-bcm4908-describe-internal-switch.patch deleted file mode 100644 index f80dc239bc..0000000000 --- a/target/linux/bcm4908/patches-5.4/031-v5.12-0005-arm64-dts-broadcom-bcm4908-describe-internal-switch.patch +++ /dev/null @@ -1,184 +0,0 @@ -From 527a3ac9bdf81da4b7160ce3cea57f28a0e5eb64 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Wed, 13 Jan 2021 12:14:06 +0100 -Subject: [PATCH] arm64: dts: broadcom: bcm4908: describe internal switch -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -BCM4908 has internal switch with 5 GPHYs. Ports 0 - 3 are always -connected to the internal PHYs. Remaining ports depend on device setup. - -Asus GT-AC5300 has an extra switch with its PHYs accessible using the -internal MDIO. - -CPU port and Ethernet interface remain to be documented. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> ---- - .../bcm4908/bcm4908-asus-gt-ac5300.dts | 51 +++++++++++ - .../boot/dts/broadcom/bcm4908/bcm4908.dtsi | 85 ++++++++++++++++++- - 2 files changed, 135 insertions(+), 1 deletion(-) - ---- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-asus-gt-ac5300.dts -+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-asus-gt-ac5300.dts -@@ -44,6 +44,57 @@ - }; - }; - -+&ports { -+ port@0 { -+ label = "lan2"; -+ }; -+ -+ port@1 { -+ label = "lan1"; -+ }; -+ -+ port@2 { -+ label = "lan6"; -+ }; -+ -+ port@3 { -+ label = "lan5"; -+ }; -+ -+ /* External BCM53134S switch */ -+ port@7 { -+ label = "sw"; -+ reg = <7>; -+ -+ fixed-link { -+ speed = <1000>; -+ full-duplex; -+ }; -+ }; -+}; -+ -+&mdio { -+ /* lan8 */ -+ ethernet-phy@0 { -+ reg = <0>; -+ }; -+ -+ /* lan7 */ -+ ethernet-phy@1 { -+ reg = <1>; -+ }; -+ -+ /* lan4 */ -+ ethernet-phy@2 { -+ reg = <2>; -+ }; -+ -+ /* lan3 */ -+ ethernet-phy@3 { -+ reg = <3>; -+ }; -+}; -+ - &nandcs { - nand-ecc-strength = <4>; - nand-ecc-step-size = <512>; ---- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi -+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi -@@ -108,7 +108,7 @@ - compatible = "simple-bus"; - #address-cells = <1>; - #size-cells = <1>; -- ranges = <0x00 0x00 0x80000000 0x10000>; -+ ranges = <0x00 0x00 0x80000000 0xd0000>; - - usb@c300 { - compatible = "generic-ehci"; -@@ -130,6 +130,89 @@ - interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>; - status = "disabled"; - }; -+ -+ ethernet-switch@80000 { -+ compatible = "simple-bus"; -+ #size-cells = <1>; -+ #address-cells = <1>; -+ ranges = <0 0x80000 0x50000>; -+ -+ ethernet-switch@0 { -+ compatible = "brcm,bcm4908-switch"; -+ reg = <0x0 0x40000>, -+ <0x40000 0x110>, -+ <0x40340 0x30>, -+ <0x40380 0x30>, -+ <0x40600 0x34>, -+ <0x40800 0x208>; -+ reg-names = "core", "reg", "intrl2_0", -+ "intrl2_1", "fcb", "acb"; -+ interrupts = <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>, -+ <GIC_SPI 58 IRQ_TYPE_LEVEL_HIGH>; -+ brcm,num-gphy = <5>; -+ brcm,num-rgmii-ports = <2>; -+ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ ports: ports { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ port@0 { -+ reg = <0>; -+ phy-mode = "internal"; -+ phy-handle = <&phy8>; -+ }; -+ -+ port@1 { -+ reg = <1>; -+ phy-mode = "internal"; -+ phy-handle = <&phy9>; -+ }; -+ -+ port@2 { -+ reg = <2>; -+ phy-mode = "internal"; -+ phy-handle = <&phy10>; -+ }; -+ -+ port@3 { -+ reg = <3>; -+ phy-mode = "internal"; -+ phy-handle = <&phy11>; -+ }; -+ }; -+ }; -+ -+ mdio: mdio@405c0 { -+ compatible = "brcm,unimac-mdio"; -+ reg = <0x405c0 0x8>; -+ reg-names = "mdio"; -+ #size-cells = <0>; -+ #address-cells = <1>; -+ -+ phy8: ethernet-phy@8 { -+ reg = <8>; -+ }; -+ -+ phy9: ethernet-phy@9 { -+ reg = <9>; -+ }; -+ -+ phy10: ethernet-phy@a { -+ reg = <10>; -+ }; -+ -+ phy11: ethernet-phy@b { -+ reg = <11>; -+ }; -+ -+ phy12: ethernet-phy@c { -+ reg = <12>; -+ }; -+ }; -+ }; - }; - - bus@ff800000 { diff --git a/target/linux/bcm4908/patches-5.4/031-v5.12-0006-arm64-dts-broadcom-bcm4908-describe-PMB-block.patch b/target/linux/bcm4908/patches-5.4/031-v5.12-0006-arm64-dts-broadcom-bcm4908-describe-PMB-block.patch deleted file mode 100644 index c1a9c35837..0000000000 --- a/target/linux/bcm4908/patches-5.4/031-v5.12-0006-arm64-dts-broadcom-bcm4908-describe-PMB-block.patch +++ /dev/null @@ -1,50 +0,0 @@ -From edcf90801c8e58bd6306d85a4e714a6f09f452df Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Wed, 13 Jan 2021 12:15:47 +0100 -Subject: [PATCH] arm64: dts: broadcom: bcm4908: describe PMB block -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -PMB (Power Management Bus) controls powering connected devices (e.g. -PCIe, USB, SATA). In BCM4908 it's a part of the PROCMON block. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> ---- - .../boot/dts/broadcom/bcm4908/bcm4908.dtsi | 17 ++++++++++++++++- - 1 file changed, 16 insertions(+), 1 deletion(-) - ---- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi -+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi -@@ -108,7 +108,7 @@ - compatible = "simple-bus"; - #address-cells = <1>; - #size-cells = <1>; -- ranges = <0x00 0x00 0x80000000 0xd0000>; -+ ranges = <0x00 0x00 0x80000000 0x281000>; - - usb@c300 { - compatible = "generic-ehci"; -@@ -213,6 +213,21 @@ - }; - }; - }; -+ -+ procmon: syscon@280000 { -+ compatible = "simple-bus"; -+ reg = <0x280000 0x1000>; -+ ranges; -+ -+ #address-cells = <1>; -+ #size-cells = <1>; -+ -+ power-controller@2800c0 { -+ compatible = "brcm,bcm4908-pmb"; -+ reg = <0x2800c0 0x40>; -+ #power-domain-cells = <1>; -+ }; -+ }; - }; - - bus@ff800000 { diff --git a/target/linux/bcm4908/patches-5.4/032-v5.13-0001-arm64-dts-broadcom-bcm4908-describe-USB-PHY.patch b/target/linux/bcm4908/patches-5.4/032-v5.13-0001-arm64-dts-broadcom-bcm4908-describe-USB-PHY.patch deleted file mode 100644 index edf2ca6a38..0000000000 --- a/target/linux/bcm4908/patches-5.4/032-v5.13-0001-arm64-dts-broadcom-bcm4908-describe-USB-PHY.patch +++ /dev/null @@ -1,134 +0,0 @@ -From 3c321ba794ca6383a4aa68ea803e18cc6ad44412 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Fri, 19 Feb 2021 06:50:26 +0100 -Subject: [PATCH] arm64: dts: broadcom: bcm4908: describe USB PHY -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -BCM4908 uses slightly modified STB family USB PHY. It handles OHCI/EHCI -and XHCI. It requires powering up using the PMB. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> ---- - .../bcm4908/bcm4906-netgear-r8000p.dts | 17 +++++++++++++ - .../bcm4908/bcm4908-asus-gt-ac5300.dts | 17 +++++++++++++ - .../boot/dts/broadcom/bcm4908/bcm4908.dtsi | 25 ++++++++++++++++--- - 3 files changed, 55 insertions(+), 4 deletions(-) - ---- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-netgear-r8000p.dts -+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-netgear-r8000p.dts -@@ -26,6 +26,23 @@ - }; - }; - -+&usb_phy { -+ brcm,ioc = <1>; -+ status = "okay"; -+}; -+ -+&ehci { -+ status = "okay"; -+}; -+ -+&ohci { -+ status = "okay"; -+}; -+ -+&xhci { -+ status = "okay"; -+}; -+ - &nandcs { - nand-ecc-strength = <4>; - nand-ecc-step-size = <512>; ---- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-asus-gt-ac5300.dts -+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-asus-gt-ac5300.dts -@@ -44,6 +44,23 @@ - }; - }; - -+&usb_phy { -+ brcm,ioc = <1>; -+ status = "okay"; -+}; -+ -+&ehci { -+ status = "okay"; -+}; -+ -+&ohci { -+ status = "okay"; -+}; -+ -+&xhci { -+ status = "okay"; -+}; -+ - &ports { - port@0 { - label = "lan2"; ---- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi -+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi -@@ -2,6 +2,8 @@ - - #include <dt-bindings/interrupt-controller/irq.h> - #include <dt-bindings/interrupt-controller/arm-gic.h> -+#include <dt-bindings/phy/phy.h> -+#include <dt-bindings/soc/bcm-pmb.h> - - /dts-v1/; - -@@ -110,24 +112,39 @@ - #size-cells = <1>; - ranges = <0x00 0x00 0x80000000 0x281000>; - -- usb@c300 { -+ usb_phy: usb-phy@c200 { -+ compatible = "brcm,bcm4908-usb-phy"; -+ reg = <0xc200 0x100>; -+ reg-names = "ctrl"; -+ power-domains = <&pmb BCM_PMB_HOST_USB>; -+ dr_mode = "host"; -+ brcm,has-xhci; -+ brcm,has-eohci; -+ #phy-cells = <1>; -+ status = "disabled"; -+ }; -+ -+ ehci: usb@c300 { - compatible = "generic-ehci"; - reg = <0xc300 0x100>; - interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>; -+ phys = <&usb_phy PHY_TYPE_USB2>; - status = "disabled"; - }; - -- usb@c400 { -+ ohci: usb@c400 { - compatible = "generic-ohci"; - reg = <0xc400 0x100>; - interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>; -+ phys = <&usb_phy PHY_TYPE_USB2>; - status = "disabled"; - }; - -- usb@d000 { -+ xhci: usb@d000 { - compatible = "generic-xhci"; - reg = <0xd000 0x8c8>; - interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>; -+ phys = <&usb_phy PHY_TYPE_USB3>; - status = "disabled"; - }; - -@@ -222,7 +239,7 @@ - #address-cells = <1>; - #size-cells = <1>; - -- power-controller@2800c0 { -+ pmb: power-controller@2800c0 { - compatible = "brcm,bcm4908-pmb"; - reg = <0x2800c0 0x40>; - #power-domain-cells = <1>; diff --git a/target/linux/bcm4908/patches-5.4/032-v5.13-0002-arm64-dts-broadcom-bcm4908-describe-Ethernet-control.patch b/target/linux/bcm4908/patches-5.4/032-v5.13-0002-arm64-dts-broadcom-bcm4908-describe-Ethernet-control.patch deleted file mode 100644 index 6c41e3d797..0000000000 --- a/target/linux/bcm4908/patches-5.4/032-v5.13-0002-arm64-dts-broadcom-bcm4908-describe-Ethernet-control.patch +++ /dev/null @@ -1,51 +0,0 @@ -From b1bbe48eec190b6a35f400c5a3ec6b0fc8fc3fe6 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Fri, 19 Feb 2021 06:50:27 +0100 -Subject: [PATCH] arm64: dts: broadcom: bcm4908: describe Ethernet controller -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -BCM4908 SoCs have an integrated Ethernet controller. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> ---- - .../boot/dts/broadcom/bcm4908/bcm4908.dtsi | 19 +++++++++++++++++++ - 1 file changed, 19 insertions(+) - ---- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi -+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi -@@ -112,6 +112,14 @@ - #size-cells = <1>; - ranges = <0x00 0x00 0x80000000 0x281000>; - -+ enet: ethernet@2000 { -+ compatible = "brcm,bcm4908-enet"; -+ reg = <0x2000 0x1000>; -+ -+ interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>; -+ interrupt-names = "rx"; -+ }; -+ - usb_phy: usb-phy@c200 { - compatible = "brcm,bcm4908-usb-phy"; - reg = <0xc200 0x100>; -@@ -199,6 +207,17 @@ - phy-mode = "internal"; - phy-handle = <&phy11>; - }; -+ -+ port@8 { -+ reg = <8>; -+ phy-mode = "internal"; -+ ethernet = <&enet>; -+ -+ fixed-link { -+ speed = <1000>; -+ full-duplex; -+ }; -+ }; - }; - }; - diff --git a/target/linux/bcm4908/patches-5.4/032-v5.13-0003-arm64-dts-broadcom-bcm4908-describe-Netgear-R8000P-s.patch b/target/linux/bcm4908/patches-5.4/032-v5.13-0003-arm64-dts-broadcom-bcm4908-describe-Netgear-R8000P-s.patch deleted file mode 100644 index 9c7f9cee6c..0000000000 --- a/target/linux/bcm4908/patches-5.4/032-v5.13-0003-arm64-dts-broadcom-bcm4908-describe-Netgear-R8000P-s.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 406e98afffe975982f63ea5d21bf9a47a81b56ee Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Fri, 19 Feb 2021 06:50:28 +0100 -Subject: [PATCH] arm64: dts: broadcom: bcm4908: describe Netgear R8000P switch -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -R8000P model has 4 LAN ports and 1 WAN port. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> ---- - .../bcm4908/bcm4906-netgear-r8000p.dts | 25 +++++++++++++++++++ - 1 file changed, 25 insertions(+) - ---- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-netgear-r8000p.dts -+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-netgear-r8000p.dts -@@ -43,6 +43,31 @@ - status = "okay"; - }; - -+&ports { -+ port@0 { -+ label = "lan4"; -+ }; -+ -+ port@1 { -+ label = "lan3"; -+ }; -+ -+ port@2 { -+ label = "lan2"; -+ }; -+ -+ port@3 { -+ label = "lan1"; -+ }; -+ -+ port@7 { -+ reg = <7>; -+ phy-mode = "internal"; -+ phy-handle = <&phy12>; -+ label = "wan"; -+ }; -+}; -+ - &nandcs { - nand-ecc-strength = <4>; - nand-ecc-step-size = <512>; diff --git a/target/linux/bcm4908/patches-5.4/032-v5.13-0004-arm64-dts-broadcom-bcm4908-add-remaining-Netgear-R80.patch b/target/linux/bcm4908/patches-5.4/032-v5.13-0004-arm64-dts-broadcom-bcm4908-add-remaining-Netgear-R80.patch deleted file mode 100644 index 56249c82f8..0000000000 --- a/target/linux/bcm4908/patches-5.4/032-v5.13-0004-arm64-dts-broadcom-bcm4908-add-remaining-Netgear-R80.patch +++ /dev/null @@ -1,81 +0,0 @@ -From 6224415c0389ba6661825746312163a64ece8f3a Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Fri, 19 Feb 2021 06:50:29 +0100 -Subject: [PATCH] arm64: dts: broadcom: bcm4908: add remaining Netgear R8000P - LEDs -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -There are a few more GPIO connected LEDs there didn't get described -initially. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> ---- - .../bcm4908/bcm4906-netgear-r8000p.dts | 50 ++++++++++++++++++- - 1 file changed, 49 insertions(+), 1 deletion(-) - ---- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-netgear-r8000p.dts -+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-netgear-r8000p.dts -@@ -18,11 +18,59 @@ - leds { - compatible = "gpio-leds"; - -- wps { -+ led-power-white { -+ function = LED_FUNCTION_POWER; -+ color = <LED_COLOR_ID_WHITE>; -+ gpios = <&gpio0 8 GPIO_ACTIVE_LOW>; -+ }; -+ -+ led-power-amber { -+ function = LED_FUNCTION_POWER; -+ color = <LED_COLOR_ID_AMBER>; -+ gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; -+ }; -+ -+ led-wps { - function = LED_FUNCTION_WPS; - color = <LED_COLOR_ID_WHITE>; - gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; - }; -+ -+ led-2ghz { -+ function = "2ghz"; -+ color = <LED_COLOR_ID_WHITE>; -+ gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; -+ }; -+ -+ led-5ghz-1 { -+ function = "5ghz-1"; -+ color = <LED_COLOR_ID_WHITE>; -+ gpios = <&gpio0 15 GPIO_ACTIVE_LOW>; -+ }; -+ -+ led-5ghz-2 { -+ function = "5ghz-2"; -+ color = <LED_COLOR_ID_WHITE>; -+ gpios = <&gpio0 16 GPIO_ACTIVE_LOW>; -+ }; -+ -+ led-usb2 { -+ function = "usb2"; -+ color = <LED_COLOR_ID_WHITE>; -+ gpios = <&gpio0 17 GPIO_ACTIVE_LOW>; -+ }; -+ -+ led-usb3 { -+ function = "usb3"; -+ color = <LED_COLOR_ID_WHITE>; -+ gpios = <&gpio0 18 GPIO_ACTIVE_LOW>; -+ }; -+ -+ led-wifi { -+ function = "wifi"; -+ color = <LED_COLOR_ID_WHITE>; -+ gpios = <&gpio0 56 GPIO_ACTIVE_LOW>; -+ }; - }; - }; - diff --git a/target/linux/bcm4908/patches-5.4/032-v5.13-0005-arm64-dts-broadcom-bcm4908-describe-firmware-partiti.patch b/target/linux/bcm4908/patches-5.4/032-v5.13-0005-arm64-dts-broadcom-bcm4908-describe-firmware-partiti.patch deleted file mode 100644 index d03adc1743..0000000000 --- a/target/linux/bcm4908/patches-5.4/032-v5.13-0005-arm64-dts-broadcom-bcm4908-describe-firmware-partiti.patch +++ /dev/null @@ -1,55 +0,0 @@ -From cbaca2c467dc25a163107e14a53b7925214eab17 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Fri, 19 Feb 2021 06:50:30 +0100 -Subject: [PATCH] arm64: dts: broadcom: bcm4908: describe firmware partitions -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -BCM4908 bootloader supports multiple firmware partitions and has its own -bindings defined for them. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> ---- - .../dts/broadcom/bcm4908/bcm4906-netgear-r8000p.dts | 1 + - .../dts/broadcom/bcm4908/bcm4908-asus-gt-ac5300.dts | 12 +++++++++++- - 2 files changed, 12 insertions(+), 1 deletion(-) - ---- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-netgear-r8000p.dts -+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-netgear-r8000p.dts -@@ -135,6 +135,7 @@ - }; - - partition@100000 { -+ compatible = "brcm,bcm4908-firmware"; - label = "firmware"; - reg = <0x100000 0x4400000>; - }; ---- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-asus-gt-ac5300.dts -+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-asus-gt-ac5300.dts -@@ -122,7 +122,7 @@ - #size-cells = <0>; - - partitions { -- compatible = "fixed-partitions"; -+ compatible = "brcm,bcm4908-partitions"; - #address-cells = <1>; - #size-cells = <1>; - -@@ -130,5 +130,15 @@ - label = "cferom"; - reg = <0x0 0x100000>; - }; -+ -+ partition@100000 { -+ compatible = "brcm,bcm4908-firmware"; -+ reg = <0x100000 0x5700000>; -+ }; -+ -+ partition@5800000 { -+ compatible = "brcm,bcm4908-firmware"; -+ reg = <0x5800000 0x5700000>; -+ }; - }; - }; diff --git a/target/linux/bcm4908/patches-5.4/032-v5.13-0006-arm64-dts-broadcom-bcm4908-fix-switch-parent-node-na.patch b/target/linux/bcm4908/patches-5.4/032-v5.13-0006-arm64-dts-broadcom-bcm4908-fix-switch-parent-node-na.patch deleted file mode 100644 index 8b95fc2759..0000000000 --- a/target/linux/bcm4908/patches-5.4/032-v5.13-0006-arm64-dts-broadcom-bcm4908-fix-switch-parent-node-na.patch +++ /dev/null @@ -1,30 +0,0 @@ -From a348ff97ffb840b9d74b0e64b3e0e6002187d224 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Tue, 9 Mar 2021 19:44:09 +0100 -Subject: [PATCH] arm64: dts: broadcom: bcm4908: fix switch parent node name -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Ethernet switch and MDIO are grouped using "simple-bus". It's not -allowed to use "ethernet-switch" node name as it isn't a switch. Replace -it with "bus". - -Fixes: 527a3ac9bdf8 ("arm64: dts: broadcom: bcm4908: describe internal switch") -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> ---- - arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi -+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi -@@ -156,7 +156,7 @@ - status = "disabled"; - }; - -- ethernet-switch@80000 { -+ bus@80000 { - compatible = "simple-bus"; - #size-cells = <1>; - #address-cells = <1>; diff --git a/target/linux/bcm4908/patches-5.4/032-v5.13-0007-dt-bindings-arm-bcm-document-TP-Link-Archer-C2300-bi.patch b/target/linux/bcm4908/patches-5.4/032-v5.13-0007-dt-bindings-arm-bcm-document-TP-Link-Archer-C2300-bi.patch deleted file mode 100644 index 07d4121ef1..0000000000 --- a/target/linux/bcm4908/patches-5.4/032-v5.13-0007-dt-bindings-arm-bcm-document-TP-Link-Archer-C2300-bi.patch +++ /dev/null @@ -1,27 +0,0 @@ -From b3de2a12d1a61d90a4d86c9840acc7d05066137f Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Wed, 10 Mar 2021 08:46:02 +0100 -Subject: [PATCH] dt-bindings: arm: bcm: document TP-Link Archer C2300 binding -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -One more BCM4906 based device. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Reviewed-by: Rob Herring <robh@kernel.org> -Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> ---- - Documentation/devicetree/bindings/arm/bcm/brcm,bcm4908.yaml | 1 + - 1 file changed, 1 insertion(+) - ---- a/Documentation/devicetree/bindings/arm/bcm/brcm,bcm4908.yaml -+++ b/Documentation/devicetree/bindings/arm/bcm/brcm,bcm4908.yaml -@@ -21,6 +21,7 @@ properties: - items: - - enum: - - netgear,r8000p -+ - tplink,archer-c2300-v1 - - const: brcm,bcm4906 - - const: brcm,bcm4908 - diff --git a/target/linux/bcm4908/patches-5.4/032-v5.13-0008-arm64-dts-broadcom-bcm4908-add-TP-Link-Archer-C2300-.patch b/target/linux/bcm4908/patches-5.4/032-v5.13-0008-arm64-dts-broadcom-bcm4908-add-TP-Link-Archer-C2300-.patch deleted file mode 100644 index 0dd7f2301f..0000000000 --- a/target/linux/bcm4908/patches-5.4/032-v5.13-0008-arm64-dts-broadcom-bcm4908-add-TP-Link-Archer-C2300-.patch +++ /dev/null @@ -1,212 +0,0 @@ -From 6a30934a5470a0ce7ea32b0c6b600accfae94b1a Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Wed, 10 Mar 2021 08:46:03 +0100 -Subject: [PATCH] arm64: dts: broadcom: bcm4908: add TP-Link Archer C2300 V1 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Archer C2300 V1 is a home router based on the BCM4906 (2 CPU cores). It -has 512 MiB of RAM, NAND flash, USB 2.0 and USB 3.0 ports, 4 LAN ports, -1 WAN port. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> ---- - arch/arm64/boot/dts/broadcom/bcm4908/Makefile | 1 + - .../bcm4906-tplink-archer-c2300-v1.dts | 182 ++++++++++++++++++ - 2 files changed, 183 insertions(+) - create mode 100644 arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-tplink-archer-c2300-v1.dts - ---- a/arch/arm64/boot/dts/broadcom/bcm4908/Makefile -+++ b/arch/arm64/boot/dts/broadcom/bcm4908/Makefile -@@ -1,3 +1,4 @@ - # SPDX-License-Identifier: GPL-2.0 - dtb-$(CONFIG_ARCH_BCM4908) += bcm4906-netgear-r8000p.dtb -+dtb-$(CONFIG_ARCH_BCM4908) += bcm4906-tplink-archer-c2300-v1.dtb - dtb-$(CONFIG_ARCH_BCM4908) += bcm4908-asus-gt-ac5300.dtb ---- /dev/null -+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-tplink-archer-c2300-v1.dts -@@ -0,0 +1,182 @@ -+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -+ -+#include <dt-bindings/gpio/gpio.h> -+#include <dt-bindings/input/input.h> -+#include <dt-bindings/leds/common.h> -+ -+#include "bcm4906.dtsi" -+ -+/ { -+ compatible = "tplink,archer-c2300-v1", "brcm,bcm4906", "brcm,bcm4908"; -+ model = "TP-Link Archer C2300 V1"; -+ -+ memory@0 { -+ device_type = "memory"; -+ reg = <0x00 0x00 0x00 0x20000000>; -+ }; -+ -+ leds { -+ compatible = "gpio-leds"; -+ -+ led-power { -+ function = LED_FUNCTION_POWER; -+ color = <LED_COLOR_ID_BLUE>; -+ gpios = <&gpio0 0 GPIO_ACTIVE_LOW>; -+ }; -+ -+ led-2ghz { -+ function = "2ghz"; -+ color = <LED_COLOR_ID_BLUE>; -+ gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; -+ }; -+ -+ led-5ghz { -+ function = "5ghz"; -+ color = <LED_COLOR_ID_BLUE>; -+ gpios = <&gpio0 3 GPIO_ACTIVE_LOW>; -+ }; -+ -+ led-wan-amber { -+ function = LED_FUNCTION_WAN; -+ color = <LED_COLOR_ID_AMBER>; -+ gpios = <&gpio0 4 GPIO_ACTIVE_HIGH>; -+ }; -+ -+ led-wan-blue { -+ function = LED_FUNCTION_WAN; -+ color = <LED_COLOR_ID_BLUE>; -+ gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; -+ }; -+ -+ led-lan { -+ function = LED_FUNCTION_LAN; -+ color = <LED_COLOR_ID_BLUE>; -+ gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; -+ }; -+ -+ led-wps { -+ function = LED_FUNCTION_WPS; -+ color = <LED_COLOR_ID_BLUE>; -+ gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; -+ }; -+ -+ led-usb2 { -+ function = "usb2"; -+ color = <LED_COLOR_ID_BLUE>; -+ gpios = <&gpio0 15 GPIO_ACTIVE_LOW>; -+ }; -+ -+ led-usb3 { -+ function = "usbd3"; -+ color = <LED_COLOR_ID_BLUE>; -+ gpios = <&gpio0 17 GPIO_ACTIVE_LOW>; -+ }; -+ -+ led-brightness { -+ function = LED_FUNCTION_BACKLIGHT; -+ color = <LED_COLOR_ID_WHITE>; -+ gpios = <&gpio0 19 GPIO_ACTIVE_LOW>; -+ }; -+ }; -+ -+ gpio-keys-polled { -+ compatible = "gpio-keys-polled"; -+ poll-interval = <100>; -+ -+ brightness { -+ label = "LEDs"; -+ linux,code = <KEY_BRIGHTNESS_ZERO>; -+ gpios = <&gpio0 18 GPIO_ACTIVE_LOW>; -+ }; -+ -+ wps { -+ label = "WPS"; -+ linux,code = <KEY_WPS_BUTTON>; -+ gpios = <&gpio0 21 GPIO_ACTIVE_LOW>; -+ }; -+ -+ wifi { -+ label = "WiFi"; -+ linux,code = <KEY_RFKILL>; -+ gpios = <&gpio0 22 GPIO_ACTIVE_LOW>; -+ }; -+ -+ restart { -+ label = "Reset"; -+ linux,code = <KEY_RESTART>; -+ gpios = <&gpio0 23 GPIO_ACTIVE_LOW>; -+ }; -+ }; -+}; -+ -+&usb_phy { -+ brcm,ioc = <1>; -+ status = "okay"; -+}; -+ -+&ehci { -+ status = "okay"; -+}; -+ -+&ohci { -+ status = "okay"; -+}; -+ -+&xhci { -+ status = "okay"; -+}; -+ -+&ports { -+ port@0 { -+ label = "lan4"; -+ }; -+ -+ port@1 { -+ label = "lan3"; -+ }; -+ -+ port@2 { -+ label = "lan2"; -+ }; -+ -+ port@3 { -+ label = "lan1"; -+ }; -+ -+ port@7 { -+ reg = <7>; -+ phy-mode = "internal"; -+ phy-handle = <&phy12>; -+ label = "wan"; -+ }; -+}; -+ -+&nandcs { -+ nand-ecc-strength = <4>; -+ nand-ecc-step-size = <512>; -+ nand-on-flash-bbt; -+ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ partitions { -+ compatible = "brcm,bcm4908-partitions"; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ -+ partition@0 { -+ label = "cferom"; -+ reg = <0x0 0x100000>; -+ }; -+ -+ partition@100000 { -+ compatible = "brcm,bcm4908-firmware"; -+ reg = <0x100000 0x3900000>; -+ }; -+ -+ partition@5800000 { -+ compatible = "brcm,bcm4908-firmware"; -+ reg = <0x3a00000 0x3900000>; -+ }; -+ }; -+}; diff --git a/target/linux/bcm4908/patches-5.4/032-v5.13-0009-arm64-dts-broadcom-bcm4908-set-Asus-GT-AC5300-port-7.patch b/target/linux/bcm4908/patches-5.4/032-v5.13-0009-arm64-dts-broadcom-bcm4908-set-Asus-GT-AC5300-port-7.patch deleted file mode 100644 index 30def36c39..0000000000 --- a/target/linux/bcm4908/patches-5.4/032-v5.13-0009-arm64-dts-broadcom-bcm4908-set-Asus-GT-AC5300-port-7.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 5ccb9f9cf05bbd729430c6d6d30d40c96a15c56a Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Fri, 12 Mar 2021 12:01:20 +0100 -Subject: [PATCH] arm64: dts: broadcom: bcm4908: set Asus GT-AC5300 port 7 PHY - mode -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Port 7 is connected to the external BCM53134S switch using RGMII. - -Fixes: 527a3ac9bdf8 ("arm64: dts: broadcom: bcm4908: describe internal switch") -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> ---- - arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-asus-gt-ac5300.dts | 1 + - 1 file changed, 1 insertion(+) - ---- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-asus-gt-ac5300.dts -+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-asus-gt-ac5300.dts -@@ -82,6 +82,7 @@ - port@7 { - label = "sw"; - reg = <7>; -+ phy-mode = "rgmii"; - - fixed-link { - speed = <1000>; diff --git a/target/linux/bcm4908/patches-5.4/032-v5.13-0010-arm64-dts-broadcom-bcm4908-add-Ethernet-TX-irq.patch b/target/linux/bcm4908/patches-5.4/032-v5.13-0010-arm64-dts-broadcom-bcm4908-add-Ethernet-TX-irq.patch deleted file mode 100644 index 9ba30b3a14..0000000000 --- a/target/linux/bcm4908/patches-5.4/032-v5.13-0010-arm64-dts-broadcom-bcm4908-add-Ethernet-TX-irq.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 5337af7918bedde9713cd223ce5df74b3d6c7d7a Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Wed, 17 Mar 2021 09:16:31 +0100 -Subject: [PATCH] arm64: dts: broadcom: bcm4908: add Ethernet TX irq -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This hardware supports two interrupts, one per DMA channel (RX and TX). - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> ---- - arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - ---- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi -+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi -@@ -116,8 +116,9 @@ - compatible = "brcm,bcm4908-enet"; - reg = <0x2000 0x1000>; - -- interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>; -- interrupt-names = "rx"; -+ interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>, -+ <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>; -+ interrupt-names = "rx", "tx"; - }; - - usb_phy: usb-phy@c200 { diff --git a/target/linux/bcm4908/patches-5.4/032-v5.13-0011-arm64-dts-broadcom-bcm4908-add-Ethernet-MAC-addr.patch b/target/linux/bcm4908/patches-5.4/032-v5.13-0011-arm64-dts-broadcom-bcm4908-add-Ethernet-MAC-addr.patch deleted file mode 100644 index 67f30c8213..0000000000 --- a/target/linux/bcm4908/patches-5.4/032-v5.13-0011-arm64-dts-broadcom-bcm4908-add-Ethernet-MAC-addr.patch +++ /dev/null @@ -1,82 +0,0 @@ -From 9f01f5cdb548352418b34ce77db02a560fe2913b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Mon, 29 Mar 2021 17:45:14 +0200 -Subject: [PATCH] arm64: dts: broadcom: bcm4908: add Ethernet MAC addr -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -On most BCM4908 devices MAC address can be read from the bootloader -binary section containing device settings. Use NVMEM to describe that. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> ---- - .../broadcom/bcm4908/bcm4906-netgear-r8000p.dts | 14 ++++++++++++++ - .../broadcom/bcm4908/bcm4908-asus-gt-ac5300.dts | 14 ++++++++++++++ - 2 files changed, 28 insertions(+) - ---- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-netgear-r8000p.dts -+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-netgear-r8000p.dts -@@ -74,6 +74,11 @@ - }; - }; - -+&enet { -+ nvmem-cells = <&base_mac_addr>; -+ nvmem-cell-names = "mac-address"; -+}; -+ - &usb_phy { - brcm,ioc = <1>; - status = "okay"; -@@ -130,8 +135,17 @@ - #size-cells = <1>; - - partition@0 { -+ compatible = "nvmem-cells"; - label = "cferom"; - reg = <0x0 0x100000>; -+ -+ #address-cells = <1>; -+ #size-cells = <1>; -+ ranges = <0 0x0 0x100000>; -+ -+ base_mac_addr: mac@106a0 { -+ reg = <0x106a0 0x6>; -+ }; - }; - - partition@100000 { ---- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-asus-gt-ac5300.dts -+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-asus-gt-ac5300.dts -@@ -44,6 +44,11 @@ - }; - }; - -+&enet { -+ nvmem-cells = <&base_mac_addr>; -+ nvmem-cell-names = "mac-address"; -+}; -+ - &usb_phy { - brcm,ioc = <1>; - status = "okay"; -@@ -128,8 +133,17 @@ - #size-cells = <1>; - - partition@0 { -+ compatible = "nvmem-cells"; - label = "cferom"; - reg = <0x0 0x100000>; -+ -+ #address-cells = <1>; -+ #size-cells = <1>; -+ ranges = <0 0x0 0x100000>; -+ -+ base_mac_addr: mac@106a0 { -+ reg = <0x106a0 0x6>; -+ }; - }; - - partition@100000 { diff --git a/target/linux/bcm4908/patches-5.4/033-v5.14-0001-ARM-dts-BCM5301X-Fix-NAND-nodes-names.patch b/target/linux/bcm4908/patches-5.4/033-v5.14-0001-ARM-dts-BCM5301X-Fix-NAND-nodes-names.patch deleted file mode 100644 index 757b2c439d..0000000000 --- a/target/linux/bcm4908/patches-5.4/033-v5.14-0001-ARM-dts-BCM5301X-Fix-NAND-nodes-names.patch +++ /dev/null @@ -1,25 +0,0 @@ -From b660269cba748dfd07eb5551a88ff34d5ea0b86e Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Fri, 16 Apr 2021 15:37:48 +0200 -Subject: [PATCH] ARM: dts: BCM5301X: Fix NAND nodes names -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This matches nand-controller.yaml requirements. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> ---- - ---- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi -+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi -@@ -306,7 +306,7 @@ - interrupt-names = "nand"; - status = "okay"; - -- nandcs: nandcs@0 { -+ nandcs: nand@0 { - compatible = "brcm,nandcs"; - reg = <0>; - }; diff --git a/target/linux/bcm4908/patches-5.4/034-v5.16-0001-arm64-dts-broadcom-bcm4908-Fix-NAND-node-name.patch b/target/linux/bcm4908/patches-5.4/034-v5.16-0001-arm64-dts-broadcom-bcm4908-Fix-NAND-node-name.patch deleted file mode 100644 index 80ce766751..0000000000 --- a/target/linux/bcm4908/patches-5.4/034-v5.16-0001-arm64-dts-broadcom-bcm4908-Fix-NAND-node-name.patch +++ /dev/null @@ -1,27 +0,0 @@ -From d0ae9c944b9472c5691a482297df7a57d7fd1199 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Thu, 19 Aug 2021 14:11:08 +0200 -Subject: [PATCH] arm64: dts: broadcom: bcm4908: Fix NAND node name -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This matches nand-controller.yaml requirements. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> ---- - arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi -+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi -@@ -296,7 +296,7 @@ - status = "okay"; - }; - -- nand@1800 { -+ nand-controller@1800 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "brcm,nand-bcm63138", "brcm,brcmnand-v7.1", "brcm,brcmnand"; diff --git a/target/linux/bcm4908/patches-5.4/034-v5.16-0002-arm64-dts-broadcom-bcm4908-Move-reboot-syscon-out-of.patch b/target/linux/bcm4908/patches-5.4/034-v5.16-0002-arm64-dts-broadcom-bcm4908-Move-reboot-syscon-out-of.patch deleted file mode 100644 index 6ac618a768..0000000000 --- a/target/linux/bcm4908/patches-5.4/034-v5.16-0002-arm64-dts-broadcom-bcm4908-Move-reboot-syscon-out-of.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 6cf9f70255b90b540b9cbde062f18fea29024a75 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Thu, 19 Aug 2021 14:26:06 +0200 -Subject: [PATCH] arm64: dts: broadcom: bcm4908: Move reboot syscon out of bus -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This fixes following error for every bcm4908 DTS file: -bus@ff800000: reboot: {'type': 'object'} is not allowed for {'compatible': ['syscon-reboot'], 'regmap': [[15]], 'offset': [[52]], 'mask': [[1]]} - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> ---- - arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - ---- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi -+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi -@@ -326,12 +326,12 @@ - #reset-cells = <1>; - }; - }; -+ }; - -- reboot { -- compatible = "syscon-reboot"; -- regmap = <&timer>; -- offset = <0x34>; -- mask = <1>; -- }; -+ reboot { -+ compatible = "syscon-reboot"; -+ regmap = <&timer>; -+ offset = <0x34>; -+ mask = <1>; - }; - }; diff --git a/target/linux/bcm4908/patches-5.4/034-v5.16-0003-arm64-dts-broadcom-bcm4908-Fix-UART-clock-name.patch b/target/linux/bcm4908/patches-5.4/034-v5.16-0003-arm64-dts-broadcom-bcm4908-Fix-UART-clock-name.patch deleted file mode 100644 index af9441875c..0000000000 --- a/target/linux/bcm4908/patches-5.4/034-v5.16-0003-arm64-dts-broadcom-bcm4908-Fix-UART-clock-name.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 6c38c39ab2141f53786d73e706675e8819a3f2cb Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Thu, 19 Aug 2021 17:37:02 +0200 -Subject: [PATCH] arm64: dts: broadcom: bcm4908: Fix UART clock name -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -According to the binding the correct clock name is "refclk". - -Fixes: 2961f69f151c ("arm64: dts: broadcom: add BCM4908 and Asus GT-AC5300 early DTS files") -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> ---- - arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi -+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi -@@ -292,7 +292,7 @@ - reg = <0x640 0x18>; - interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&periph_clk>; -- clock-names = "periph"; -+ clock-names = "refclk"; - status = "okay"; - }; - diff --git a/target/linux/bcm4908/patches-5.4/035-v5.17-0001-dt-bindings-arm-bcm-document-Netgear-RAXE500-binding.patch b/target/linux/bcm4908/patches-5.4/035-v5.17-0001-dt-bindings-arm-bcm-document-Netgear-RAXE500-binding.patch deleted file mode 100644 index 4d5ffcb9e3..0000000000 --- a/target/linux/bcm4908/patches-5.4/035-v5.17-0001-dt-bindings-arm-bcm-document-Netgear-RAXE500-binding.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 7b0c9ca7f18e8d2e2cf3c342d91f037d436777bf Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Fri, 5 Nov 2021 11:14:12 +0100 -Subject: [PATCH] dt-bindings: arm: bcm: document Netgear RAXE500 binding -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -One more BCM4908 based device. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Acked-by: Rob Herring <robh@kernel.org> -Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> ---- - Documentation/devicetree/bindings/arm/bcm/brcm,bcm4908.yaml | 1 + - 1 file changed, 1 insertion(+) - ---- a/Documentation/devicetree/bindings/arm/bcm/brcm,bcm4908.yaml -+++ b/Documentation/devicetree/bindings/arm/bcm/brcm,bcm4908.yaml -@@ -29,6 +29,7 @@ properties: - items: - - enum: - - asus,gt-ac5300 -+ - netgear,raxe500 - - const: brcm,bcm4908 - - - description: BCM49408 based boards diff --git a/target/linux/bcm4908/patches-5.4/035-v5.17-0002-arm64-dts-broadcom-bcm4908-add-DT-for-Netgear-RAXE50.patch b/target/linux/bcm4908/patches-5.4/035-v5.17-0002-arm64-dts-broadcom-bcm4908-add-DT-for-Netgear-RAXE50.patch deleted file mode 100644 index 9e0236ad0f..0000000000 --- a/target/linux/bcm4908/patches-5.4/035-v5.17-0002-arm64-dts-broadcom-bcm4908-add-DT-for-Netgear-RAXE50.patch +++ /dev/null @@ -1,81 +0,0 @@ -From d0e68d354f345873e15876a7b35be1baaf5e3ec9 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Fri, 5 Nov 2021 11:14:13 +0100 -Subject: [PATCH] arm64: dts: broadcom: bcm4908: add DT for Netgear RAXE500 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -It's a home router based on BCM4908 SoC. It has: 1 GiB of RAM, 512 MiB -NAND flash, 6 Ethernet ports and 3 x BCM43684 (WiFi). One of Ethernet -ports is "2.5 G Multi-Gig port" that isn't described yet (it isn't known -how it's wired up). - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> ---- - arch/arm64/boot/dts/broadcom/bcm4908/Makefile | 1 + - .../bcm4908/bcm4908-netgear-raxe500.dts | 50 +++++++++++++++++++ - 2 files changed, 51 insertions(+) - create mode 100644 arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-netgear-raxe500.dts - ---- a/arch/arm64/boot/dts/broadcom/bcm4908/Makefile -+++ b/arch/arm64/boot/dts/broadcom/bcm4908/Makefile -@@ -2,3 +2,4 @@ - dtb-$(CONFIG_ARCH_BCM4908) += bcm4906-netgear-r8000p.dtb - dtb-$(CONFIG_ARCH_BCM4908) += bcm4906-tplink-archer-c2300-v1.dtb - dtb-$(CONFIG_ARCH_BCM4908) += bcm4908-asus-gt-ac5300.dtb -+dtb-$(CONFIG_ARCH_BCM4908) += bcm4908-netgear-raxe500.dtb ---- /dev/null -+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-netgear-raxe500.dts -@@ -0,0 +1,50 @@ -+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -+ -+#include "bcm4908.dtsi" -+ -+/ { -+ compatible = "netgear,raxe500", "brcm,bcm4908"; -+ model = "Netgear RAXE500"; -+ -+ memory@0 { -+ device_type = "memory"; -+ reg = <0x00 0x00 0x00 0x40000000>; -+ }; -+}; -+ -+&ehci { -+ status = "okay"; -+}; -+ -+&ohci { -+ status = "okay"; -+}; -+ -+&xhci { -+ status = "okay"; -+}; -+ -+&ports { -+ port@0 { -+ label = "lan4"; -+ }; -+ -+ port@1 { -+ label = "lan3"; -+ }; -+ -+ port@2 { -+ label = "lan2"; -+ }; -+ -+ port@3 { -+ label = "lan1"; -+ }; -+ -+ port@7 { -+ reg = <7>; -+ phy-mode = "internal"; -+ phy-handle = <&phy12>; -+ label = "wan"; -+ }; -+}; diff --git a/target/linux/bcm4908/patches-5.4/036-v5.18-0001-arm64-dts-broadcom-bcm4908-use-proper-TWD-binding.patch b/target/linux/bcm4908/patches-5.4/036-v5.18-0001-arm64-dts-broadcom-bcm4908-use-proper-TWD-binding.patch deleted file mode 100644 index 420f790fdd..0000000000 --- a/target/linux/bcm4908/patches-5.4/036-v5.18-0001-arm64-dts-broadcom-bcm4908-use-proper-TWD-binding.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 33826e9c6ba76b265d4e26cb95493fa27ed78974 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Wed, 29 Dec 2021 11:23:14 +0100 -Subject: [PATCH] arm64: dts: broadcom: bcm4908: use proper TWD binding -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Block at <ff800400 0x4c> is a TWD that contains timers, watchdog and -reset. Actual timers happen to be at block beginning but they only span -across the first 0x28 registers. It means the old block description was -incorrect (size 0x3c). - -Drop timers binding for now and use documented TWD binding. Timers -should be properly documented and defined as TWD subnode. - -Fixes: 2961f69f151c ("arm64: dts: broadcom: add BCM4908 and Asus GT-AC5300 early DTS files") -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> ---- - arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - ---- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi -+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi -@@ -273,9 +273,9 @@ - #size-cells = <1>; - ranges = <0x00 0x00 0xff800000 0x3000>; - -- timer: timer@400 { -- compatible = "brcm,bcm6328-timer", "syscon"; -- reg = <0x400 0x3c>; -+ twd: timer-mfd@400 { -+ compatible = "brcm,bcm4908-twd", "simple-mfd", "syscon"; -+ reg = <0x400 0x4c>; - }; - - gpio0: gpio-controller@500 { -@@ -330,7 +330,7 @@ - - reboot { - compatible = "syscon-reboot"; -- regmap = <&timer>; -+ regmap = <&twd>; - offset = <0x34>; - mask = <1>; - }; diff --git a/target/linux/bcm4908/patches-5.4/036-v5.18-0002-arm64-dts-broadcom-bcm4908-add-pinctrl-binding.patch b/target/linux/bcm4908/patches-5.4/036-v5.18-0002-arm64-dts-broadcom-bcm4908-add-pinctrl-binding.patch deleted file mode 100644 index 2f4baf80c6..0000000000 --- a/target/linux/bcm4908/patches-5.4/036-v5.18-0002-arm64-dts-broadcom-bcm4908-add-pinctrl-binding.patch +++ /dev/null @@ -1,160 +0,0 @@ -From 72b1c5da796ec5266f2012c36470e226cb4f09c9 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Thu, 30 Dec 2021 12:05:35 +0100 -Subject: [PATCH] arm64: dts: broadcom: bcm4908: add pinctrl binding -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Describe pinmux block with its maps. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> ---- - .../boot/dts/broadcom/bcm4908/bcm4908.dtsi | 135 ++++++++++++++++++ - 1 file changed, 135 insertions(+) - ---- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi -+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi -@@ -287,6 +287,141 @@ - gpio-controller; - }; - -+ pinctrl@560 { -+ compatible = "brcm,bcm4908-pinctrl"; -+ reg = <0x560 0x10>; -+ -+ pins_led_0_a: led_0-a-pins { -+ function = "led_0"; -+ groups = "led_0_grp_a"; -+ }; -+ -+ pins_led_1_a: led_1-a-pins { -+ function = "led_1"; -+ groups = "led_1_grp_a"; -+ }; -+ -+ pins_led_2_a: led_2-a-pins { -+ function = "led_2"; -+ groups = "led_2_grp_a"; -+ }; -+ -+ pins_led_3_a: led_3-a-pins { -+ function = "led_3"; -+ groups = "led_3_grp_a"; -+ }; -+ -+ pins_led_4_a: led_4-a-pins { -+ function = "led_4"; -+ groups = "led_4_grp_a"; -+ }; -+ -+ pins_led_5_a: led_5-a-pins { -+ function = "led_5"; -+ groups = "led_5_grp_a"; -+ }; -+ -+ pins_led_6_a: led_6-a-pins { -+ function = "led_6"; -+ groups = "led_6_grp_a"; -+ }; -+ -+ pins_led_7_a: led_7-a-pins { -+ function = "led_7"; -+ groups = "led_7_grp_a"; -+ }; -+ -+ pins_led_8_a: led_8-a-pins { -+ function = "led_8"; -+ groups = "led_8_grp_a"; -+ }; -+ -+ pins_led_9_a: led_9-a-pins { -+ function = "led_9"; -+ groups = "led_9_grp_a"; -+ }; -+ -+ pins_led_21_a: led_21-a-pins { -+ function = "led_21"; -+ groups = "led_21_grp_a"; -+ }; -+ -+ pins_led_22_a: led_22-a-pins { -+ function = "led_22"; -+ groups = "led_22_grp_a"; -+ }; -+ -+ pins_led_26_a: led_26-a-pins { -+ function = "led_26"; -+ groups = "led_26_grp_a"; -+ }; -+ -+ pins_led_27_a: led_27-a-pins { -+ function = "led_27"; -+ groups = "led_27_grp_a"; -+ }; -+ -+ pins_led_28_a: led_28-a-pins { -+ function = "led_28"; -+ groups = "led_28_grp_a"; -+ }; -+ -+ pins_led_29_a: led_29-a-pins { -+ function = "led_29"; -+ groups = "led_29_grp_a"; -+ }; -+ -+ pins_led_30_a: led_30-a-pins { -+ function = "led_30"; -+ groups = "led_30_grp_a"; -+ }; -+ -+ pins_hs_uart: hs_uart-pins { -+ function = "hs_uart"; -+ groups = "hs_uart_grp"; -+ }; -+ -+ pins_i2c_a: i2c-a-pins { -+ function = "i2c"; -+ groups = "i2c_grp_a"; -+ }; -+ -+ pins_i2c_b: i2c-b-pins { -+ function = "i2c"; -+ groups = "i2c_grp_b"; -+ }; -+ -+ pins_i2s: i2s-pins { -+ function = "i2s"; -+ groups = "i2s_grp"; -+ }; -+ -+ pins_nand_ctrl: nand_ctrl-pins { -+ function = "nand_ctrl"; -+ groups = "nand_ctrl_grp"; -+ }; -+ -+ pins_nand_data: nand_data-pins { -+ function = "nand_data"; -+ groups = "nand_data_grp"; -+ }; -+ -+ pins_emmc_ctrl: emmc_ctrl-pins { -+ function = "emmc_ctrl"; -+ groups = "emmc_ctrl_grp"; -+ }; -+ -+ pins_usb0_pwr: usb0_pwr-pins { -+ function = "usb0_pwr"; -+ groups = "usb0_pwr_grp"; -+ }; -+ -+ pins_usb1_pwr: usb1_pwr-pins { -+ function = "usb1_pwr"; -+ groups = "usb1_pwr_grp"; -+ }; -+ }; -+ - uart0: serial@640 { - compatible = "brcm,bcm6345-uart"; - reg = <0x640 0x18>; diff --git a/target/linux/bcm4908/patches-5.4/036-v5.18-0003-arm64-dts-broadcom-bcm4908-add-watchdog-block.patch b/target/linux/bcm4908/patches-5.4/036-v5.18-0003-arm64-dts-broadcom-bcm4908-add-watchdog-block.patch deleted file mode 100644 index 3ca778dcd8..0000000000 --- a/target/linux/bcm4908/patches-5.4/036-v5.18-0003-arm64-dts-broadcom-bcm4908-add-watchdog-block.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 47513f6dd93b5b7d91143219c2c1fb883664ed13 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Wed, 9 Feb 2022 21:14:17 +0100 -Subject: [PATCH] arm64: dts: broadcom: bcm4908: add watchdog block -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -BCM4908 has the same watchdog as BCM63xx devices. Use "brcm,bcm6345-wdt" -binding which matches the first SoC with that block. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> ---- - arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi | 9 +++++++++ - 1 file changed, 9 insertions(+) - ---- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi -+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi -@@ -276,6 +276,15 @@ - twd: timer-mfd@400 { - compatible = "brcm,bcm4908-twd", "simple-mfd", "syscon"; - reg = <0x400 0x4c>; -+ ranges = <0x0 0x400 0x4c>; -+ -+ #address-cells = <1>; -+ #size-cells = <1>; -+ -+ watchdog@28 { -+ compatible = "brcm,bcm6345-wdt"; -+ reg = <0x28 0x8>; -+ }; - }; - - gpio0: gpio-controller@500 { diff --git a/target/linux/bcm4908/patches-5.4/036-v5.18-0004-arm64-dts-broadcom-bcm4908-add-I2C-block.patch b/target/linux/bcm4908/patches-5.4/036-v5.18-0004-arm64-dts-broadcom-bcm4908-add-I2C-block.patch deleted file mode 100644 index ab00f44b14..0000000000 --- a/target/linux/bcm4908/patches-5.4/036-v5.18-0004-arm64-dts-broadcom-bcm4908-add-I2C-block.patch +++ /dev/null @@ -1,34 +0,0 @@ -From ba5dfa2fd8d0aed4e4b6f650ba9e8ea7cdd6ead1 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Tue, 15 Feb 2022 07:36:39 +0100 -Subject: [PATCH] arm64: dts: broadcom: bcm4908: add I2C block -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -BCM4908 uses the same I2C hw as BCM63xx / BCM67xx / BCM68xx SoCs. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> ---- - arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi | 9 +++++++++ - 1 file changed, 9 insertions(+) - ---- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi -+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi -@@ -456,6 +456,15 @@ - }; - }; - -+ i2c@2100 { -+ compatible = "brcm,brcmper-i2c"; -+ reg = <0x2100 0x58>; -+ clock-frequency = <97500>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pins_i2c_a>; -+ status = "disabled"; -+ }; -+ - misc@2600 { - compatible = "brcm,misc", "simple-mfd"; - reg = <0x2600 0xe4>; diff --git a/target/linux/bcm4908/patches-5.4/070-v5.10-0001-net-dsa-b53-Use-dev_-err-info-instead-of-pr_.patch b/target/linux/bcm4908/patches-5.4/070-v5.10-0001-net-dsa-b53-Use-dev_-err-info-instead-of-pr_.patch deleted file mode 100644 index be09ab9e7d..0000000000 --- a/target/linux/bcm4908/patches-5.4/070-v5.10-0001-net-dsa-b53-Use-dev_-err-info-instead-of-pr_.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 3b33438c52def0de4a5577ad541e50923bcc2596 Mon Sep 17 00:00:00 2001 -From: Paul Barker <pbarker@konsulko.com> -Date: Thu, 3 Sep 2020 12:26:20 +0100 -Subject: [PATCH] net: dsa: b53: Use dev_{err,info} instead of pr_* - -This change allows us to see which device the err or info messages are -referring to if we have multiple b53 compatible devices on a board. - -As this removes the only pr_*() calls in this file we can drop the -definition of pr_fmt(). - -Signed-off-by: Paul Barker <pbarker@konsulko.com> -Signed-off-by: David S. Miller <davem@davemloft.net> ---- - drivers/net/dsa/b53/b53_common.c | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - ---- a/drivers/net/dsa/b53/b53_common.c -+++ b/drivers/net/dsa/b53/b53_common.c -@@ -17,8 +17,6 @@ - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - --#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt -- - #include <linux/delay.h> - #include <linux/export.h> - #include <linux/gpio.h> -@@ -2475,8 +2473,9 @@ int b53_switch_detect(struct b53_device - dev->chip_id = id32; - break; - default: -- pr_err("unsupported switch detected (BCM53%02x/BCM%x)\n", -- id8, id32); -+ dev_err(dev->dev, -+ "unsupported switch detected (BCM53%02x/BCM%x)\n", -+ id8, id32); - return -ENODEV; - } - } -@@ -2506,7 +2505,8 @@ int b53_switch_register(struct b53_devic - if (ret) - return ret; - -- pr_info("found switch: %s, rev %i\n", dev->name, dev->core_rev); -+ dev_info(dev->dev, "found switch: %s, rev %i\n", -+ dev->name, dev->core_rev); - - return dsa_register_switch(dev->ds); - } diff --git a/target/linux/bcm4908/patches-5.4/070-v5.10-0002-net-dsa-b53-Print-err-message-on-SW_RST-timeout.patch b/target/linux/bcm4908/patches-5.4/070-v5.10-0002-net-dsa-b53-Print-err-message-on-SW_RST-timeout.patch deleted file mode 100644 index 2661b0918e..0000000000 --- a/target/linux/bcm4908/patches-5.4/070-v5.10-0002-net-dsa-b53-Print-err-message-on-SW_RST-timeout.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 434d2312cd8057aa6972f2b39aa0b359d02af9f4 Mon Sep 17 00:00:00 2001 -From: Paul Barker <pbarker@konsulko.com> -Date: Thu, 3 Sep 2020 12:26:21 +0100 -Subject: [PATCH] net: dsa: b53: Print err message on SW_RST timeout - -This allows us to differentiate between the possible failure modes of -b53_switch_reset() by looking at the dmesg output. - -Signed-off-by: Paul Barker <pbarker@konsulko.com> -Acked-by: Florian Fainelli <f.fainelli@gmail.com> -Signed-off-by: David S. Miller <davem@davemloft.net> ---- - drivers/net/dsa/b53/b53_common.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - ---- a/drivers/net/dsa/b53/b53_common.c -+++ b/drivers/net/dsa/b53/b53_common.c -@@ -755,8 +755,11 @@ static int b53_switch_reset(struct b53_d - usleep_range(1000, 2000); - } while (timeout-- > 0); - -- if (timeout == 0) -+ if (timeout == 0) { -+ dev_err(dev->dev, -+ "Timeout waiting for SW_RST to clear!\n"); - return -ETIMEDOUT; -+ } - } - - b53_read8(dev, B53_CTRL_PAGE, B53_SWITCH_MODE, &mgmt); diff --git a/target/linux/bcm4908/patches-5.4/071-v5.12-0001-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch b/target/linux/bcm4908/patches-5.4/071-v5.12-0001-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch deleted file mode 100644 index a75898bf0c..0000000000 --- a/target/linux/bcm4908/patches-5.4/071-v5.12-0001-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch +++ /dev/null @@ -1,131 +0,0 @@ -From 73b7a6047971aa6ce4a70fc4901964d14f077171 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Wed, 6 Jan 2021 22:32:02 +0100 -Subject: [PATCH] net: dsa: bcm_sf2: support BCM4908's integrated switch -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -BCM4908 family SoCs come with integrated Starfighter 2 switch. Its -registers layout it a mix of BCM7278 and BCM7445. It has 5 integrated -PHYs and 8 ports. It also supports RGMII and SerDes. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Acked-by: Florian Fainelli <f.fainelli@gmail.com> -Link: https://lore.kernel.org/r/20210106213202.17459-3-zajec5@gmail.com -Signed-off-by: Jakub Kicinski <kuba@kernel.org> ---- - drivers/net/dsa/b53/b53_common.c | 14 +++++++++++++ - drivers/net/dsa/b53/b53_priv.h | 1 + - drivers/net/dsa/bcm_sf2.c | 36 +++++++++++++++++++++++++++++--- - drivers/net/dsa/bcm_sf2_regs.h | 1 + - 4 files changed, 49 insertions(+), 3 deletions(-) - ---- a/drivers/net/dsa/b53/b53_common.c -+++ b/drivers/net/dsa/b53/b53_common.c -@@ -2271,6 +2271,22 @@ static const struct b53_chip_data b53_sw - .jumbo_pm_reg = B53_JUMBO_PORT_MASK, - .jumbo_size_reg = B53_JUMBO_MAX_SIZE, - }, -+ /* Starfighter 2 */ -+ { -+ .chip_id = BCM4908_DEVICE_ID, -+ .dev_name = "BCM4908", -+ .vlans = 4096, -+ .enabled_ports = 0x1bf, -+#if 0 -+ .arl_bins = 4, -+ .arl_buckets = 256, -+#endif -+ .cpu_port = 8, /* TODO: ports 4, 5, 8 */ -+ .vta_regs = B53_VTA_REGS, -+ .duplex_reg = B53_DUPLEX_STAT_GE, -+ .jumbo_pm_reg = B53_JUMBO_PORT_MASK, -+ .jumbo_size_reg = B53_JUMBO_MAX_SIZE, -+ }, - { - .chip_id = BCM7445_DEVICE_ID, - .dev_name = "BCM7445", ---- a/drivers/net/dsa/b53/b53_priv.h -+++ b/drivers/net/dsa/b53/b53_priv.h -@@ -64,6 +64,7 @@ struct b53_io_ops { - #define B53_INVALID_LANE 0xff - - enum { -+ BCM4908_DEVICE_ID = 0x4908, - BCM5325_DEVICE_ID = 0x25, - BCM5365_DEVICE_ID = 0x65, - BCM5389_DEVICE_ID = 0x89, ---- a/drivers/net/dsa/bcm_sf2.c -+++ b/drivers/net/dsa/bcm_sf2.c -@@ -61,7 +61,8 @@ static void bcm_sf2_imp_setup(struct dsa - b53_brcm_hdr_setup(ds, port); - - if (port == 8) { -- if (priv->type == BCM7445_DEVICE_ID) -+ if (priv->type == BCM4908_DEVICE_ID || -+ priv->type == BCM7445_DEVICE_ID) - offset = CORE_STS_OVERRIDE_IMP; - else - offset = CORE_STS_OVERRIDE_IMP2; -@@ -543,7 +544,8 @@ static void bcm_sf2_sw_mac_config(struct - if (port == core_readl(priv, CORE_IMP0_PRT_ID)) - return; - -- if (priv->type == BCM7445_DEVICE_ID) -+ if (priv->type == BCM4908_DEVICE_ID || -+ priv->type == BCM7445_DEVICE_ID) - offset = CORE_STS_OVERRIDE_GMIIP_PORT(port); - else - offset = CORE_STS_OVERRIDE_GMIIP2_PORT(port); -@@ -985,6 +987,30 @@ struct bcm_sf2_of_data { - unsigned int num_cfp_rules; - }; - -+static const u16 bcm_sf2_4908_reg_offsets[] = { -+ [REG_SWITCH_CNTRL] = 0x00, -+ [REG_SWITCH_STATUS] = 0x04, -+ [REG_DIR_DATA_WRITE] = 0x08, -+ [REG_DIR_DATA_READ] = 0x0c, -+ [REG_SWITCH_REVISION] = 0x10, -+ [REG_PHY_REVISION] = 0x14, -+ [REG_SPHY_CNTRL] = 0x24, -+ [REG_CROSSBAR] = 0xc8, -+ [REG_RGMII_0_CNTRL] = 0xe0, -+ [REG_RGMII_1_CNTRL] = 0xec, -+ [REG_RGMII_2_CNTRL] = 0xf8, -+ [REG_LED_0_CNTRL] = 0x40, -+ [REG_LED_1_CNTRL] = 0x4c, -+ [REG_LED_2_CNTRL] = 0x58, -+}; -+ -+static const struct bcm_sf2_of_data bcm_sf2_4908_data = { -+ .type = BCM4908_DEVICE_ID, -+ .core_reg_align = 0, -+ .reg_offsets = bcm_sf2_4908_reg_offsets, -+ .num_cfp_rules = 0, /* FIXME */ -+}; -+ - /* Register offsets for the SWITCH_REG_* block */ - static const u16 bcm_sf2_7445_reg_offsets[] = { - [REG_SWITCH_CNTRL] = 0x00, -@@ -1033,6 +1059,9 @@ static const struct bcm_sf2_of_data bcm_ - }; - - static const struct of_device_id bcm_sf2_of_match[] = { -+ { .compatible = "brcm,bcm4908-switch", -+ .data = &bcm_sf2_4908_data -+ }, - { .compatible = "brcm,bcm7445-switch-v4.0", - .data = &bcm_sf2_7445_data - }, ---- a/drivers/net/dsa/bcm_sf2_regs.h -+++ b/drivers/net/dsa/bcm_sf2_regs.h -@@ -17,6 +17,7 @@ enum bcm_sf2_reg_offs { - REG_SWITCH_REVISION, - REG_PHY_REVISION, - REG_SPHY_CNTRL, -+ REG_CROSSBAR, - REG_RGMII_0_CNTRL, - REG_RGMII_1_CNTRL, - REG_RGMII_2_CNTRL, diff --git a/target/linux/bcm4908/patches-5.4/071-v5.12-0002-net-dsa-bcm_sf2-use-2-Gbps-IMP-port-link-on-BCM4908.patch b/target/linux/bcm4908/patches-5.4/071-v5.12-0002-net-dsa-bcm_sf2-use-2-Gbps-IMP-port-link-on-BCM4908.patch deleted file mode 100644 index 2ab34c1261..0000000000 --- a/target/linux/bcm4908/patches-5.4/071-v5.12-0002-net-dsa-bcm_sf2-use-2-Gbps-IMP-port-link-on-BCM4908.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 8373a0fe9c7160a55482effa8a3f725efd3f8434 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Wed, 10 Mar 2021 13:51:59 +0100 -Subject: [PATCH] net: dsa: bcm_sf2: use 2 Gbps IMP port link on BCM4908 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -BCM4908 uses 2 Gbps link between switch and the Ethernet interface. -Without this BCM4908 devices were able to achieve only 2 x ~895 Mb/s. -This allows handling e.g. NAT traffic with 940 Mb/s. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Acked-by: Florian Fainelli <f.fainelli@gmail.com> -Signed-off-by: David S. Miller <davem@davemloft.net> ---- - drivers/net/dsa/bcm_sf2.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - ---- a/drivers/net/dsa/bcm_sf2.c -+++ b/drivers/net/dsa/bcm_sf2.c -@@ -70,7 +70,10 @@ static void bcm_sf2_imp_setup(struct dsa - /* Force link status for IMP port */ - reg = core_readl(priv, offset); - reg |= (MII_SW_OR | LINK_STS); -- reg &= ~GMII_SPEED_UP_2G; -+ if (priv->type == BCM4908_DEVICE_ID) -+ reg |= GMII_SPEED_UP_2G; -+ else -+ reg &= ~GMII_SPEED_UP_2G; - core_writel(priv, reg, offset); - - /* Enable Broadcast, Multicast, Unicast forwarding to IMP port */ diff --git a/target/linux/bcm4908/patches-5.4/072-v5.12-0001-dt-bindings-net-document-BCM4908-Ethernet-controller.patch b/target/linux/bcm4908/patches-5.4/072-v5.12-0001-dt-bindings-net-document-BCM4908-Ethernet-controller.patch deleted file mode 100644 index 8c60b9706e..0000000000 --- a/target/linux/bcm4908/patches-5.4/072-v5.12-0001-dt-bindings-net-document-BCM4908-Ethernet-controller.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 387d1c1819790aa8398c7cffab587f9a050a0d1a Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Sun, 7 Feb 2021 23:26:31 +0100 -Subject: [PATCH] dt-bindings: net: document BCM4908 Ethernet controller -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -BCM4908 is a family of SoCs with integrated Ethernet controller. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Signed-off-by: David S. Miller <davem@davemloft.net> ---- - .../bindings/net/brcm,bcm4908enet.yaml | 45 +++++++++++++++++++ - 1 file changed, 45 insertions(+) - create mode 100644 Documentation/devicetree/bindings/net/brcm,bcm4908enet.yaml - ---- /dev/null -+++ b/Documentation/devicetree/bindings/net/brcm,bcm4908enet.yaml -@@ -0,0 +1,45 @@ -+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause -+%YAML 1.2 -+--- -+$id: http://devicetree.org/schemas/net/brcm,bcm4908enet.yaml# -+$schema: http://devicetree.org/meta-schemas/core.yaml# -+ -+title: Broadcom BCM4908 Ethernet controller -+ -+description: Broadcom's Ethernet controller integrated into BCM4908 family SoCs -+ -+maintainers: -+ - Rafał Miłecki <rafal@milecki.pl> -+ -+properties: -+ compatible: -+ const: brcm,bcm4908enet -+ -+ reg: -+ maxItems: 1 -+ -+ interrupts: -+ description: RX interrupt -+ -+ interrupt-names: -+ const: rx -+ -+required: -+ - reg -+ - interrupts -+ - interrupt-names -+ -+additionalProperties: false -+ -+examples: -+ - | -+ #include <dt-bindings/interrupt-controller/irq.h> -+ #include <dt-bindings/interrupt-controller/arm-gic.h> -+ -+ ethernet@80002000 { -+ compatible = "brcm,bcm4908enet"; -+ reg = <0x80002000 0x1000>; -+ -+ interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>; -+ interrupt-names = "rx"; -+ }; diff --git a/target/linux/bcm4908/patches-5.4/072-v5.12-0002-net-broadcom-bcm4908enet-add-BCM4908-controller-driv.patch b/target/linux/bcm4908/patches-5.4/072-v5.12-0002-net-broadcom-bcm4908enet-add-BCM4908-controller-driv.patch deleted file mode 100644 index 3f6444e6b3..0000000000 --- a/target/linux/bcm4908/patches-5.4/072-v5.12-0002-net-broadcom-bcm4908enet-add-BCM4908-controller-driv.patch +++ /dev/null @@ -1,847 +0,0 @@ -From 4feffeadbcb2e5b11cbbf191a33c245b74a5837b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Sun, 7 Feb 2021 23:26:32 +0100 -Subject: [PATCH] net: broadcom: bcm4908enet: add BCM4908 controller driver -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -BCM4908 SoCs family uses Ethernel controller that includes UniMAC but -uses different DMA engine (than other controllers) and requires -different programming. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Signed-off-by: David S. Miller <davem@davemloft.net> ---- - MAINTAINERS | 9 + - drivers/net/ethernet/broadcom/Kconfig | 8 + - drivers/net/ethernet/broadcom/Makefile | 1 + - drivers/net/ethernet/broadcom/bcm4908enet.c | 676 ++++++++++++++++++++ - drivers/net/ethernet/broadcom/bcm4908enet.h | 96 +++ - 5 files changed, 790 insertions(+) - create mode 100644 drivers/net/ethernet/broadcom/bcm4908enet.c - create mode 100644 drivers/net/ethernet/broadcom/bcm4908enet.h - ---- a/MAINTAINERS -+++ b/MAINTAINERS -@@ -3208,6 +3208,15 @@ F: Documentation/devicetree/bindings/mip - F: arch/mips/bcm47xx/* - F: arch/mips/include/asm/mach-bcm47xx/* - -+BROADCOM BCM4908 ETHERNET DRIVER -+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: drivers/net/ethernet/broadcom/bcm4908enet.* -+F: drivers/net/ethernet/broadcom/unimac.h -+ - BROADCOM BCM5301X ARM ARCHITECTURE - M: Hauke Mehrtens <hauke@hauke-m.de> - M: Rafał Miłecki <zajec5@gmail.com> ---- a/drivers/net/ethernet/broadcom/Kconfig -+++ b/drivers/net/ethernet/broadcom/Kconfig -@@ -51,6 +51,14 @@ config B44_PCI - depends on B44_PCI_AUTOSELECT && B44_PCICORE_AUTOSELECT - default y - -+config BCM4908ENET -+ tristate "Broadcom BCM4908 internal mac support" -+ depends on ARCH_BCM4908 || COMPILE_TEST -+ default y -+ help -+ This driver supports Ethernet controller integrated into Broadcom -+ BCM4908 family SoCs. -+ - config BCM63XX_ENET - tristate "Broadcom 63xx internal mac support" - depends on BCM63XX ---- a/drivers/net/ethernet/broadcom/Makefile -+++ b/drivers/net/ethernet/broadcom/Makefile -@@ -4,6 +4,7 @@ - # - - obj-$(CONFIG_B44) += b44.o -+obj-$(CONFIG_BCM4908ENET) += bcm4908enet.o - obj-$(CONFIG_BCM63XX_ENET) += bcm63xx_enet.o - obj-$(CONFIG_BCMGENET) += genet/ - obj-$(CONFIG_BNX2) += bnx2.o ---- /dev/null -+++ b/drivers/net/ethernet/broadcom/bcm4908enet.c -@@ -0,0 +1,676 @@ -+// SPDX-License-Identifier: GPL-2.0-only -+/* -+ * Copyright (C) 2021 Rafał Miłecki <rafal@milecki.pl> -+ */ -+ -+#include <linux/delay.h> -+#include <linux/etherdevice.h> -+#include <linux/interrupt.h> -+#include <linux/module.h> -+#include <linux/of.h> -+#include <linux/platform_device.h> -+#include <linux/slab.h> -+#include <linux/string.h> -+ -+#include "bcm4908enet.h" -+#include "unimac.h" -+ -+#define ENET_DMA_CH_RX_CFG ENET_DMA_CH0_CFG -+#define ENET_DMA_CH_TX_CFG ENET_DMA_CH1_CFG -+#define ENET_DMA_CH_RX_STATE_RAM ENET_DMA_CH0_STATE_RAM -+#define ENET_DMA_CH_TX_STATE_RAM ENET_DMA_CH1_STATE_RAM -+ -+#define ENET_TX_BDS_NUM 200 -+#define ENET_RX_BDS_NUM 200 -+#define ENET_RX_BDS_NUM_MAX 8192 -+ -+#define ENET_DMA_INT_DEFAULTS (ENET_DMA_CH_CFG_INT_DONE | \ -+ ENET_DMA_CH_CFG_INT_NO_DESC | \ -+ ENET_DMA_CH_CFG_INT_BUFF_DONE) -+#define ENET_DMA_MAX_BURST_LEN 8 /* in 64 bit words */ -+ -+#define ENET_MTU_MIN 60 -+#define ENET_MTU_MAX 1500 /* Is it possible to support 2044? */ -+#define ENET_MTU_MAX_EXTRA_SIZE 32 /* L2 */ -+ -+struct bcm4908enet_dma_ring_bd { -+ __le32 ctl; -+ __le32 addr; -+} __packed; -+ -+struct bcm4908enet_dma_ring_slot { -+ struct sk_buff *skb; -+ unsigned int len; -+ dma_addr_t dma_addr; -+}; -+ -+struct bcm4908enet_dma_ring { -+ int is_tx; -+ int read_idx; -+ int write_idx; -+ int length; -+ u16 cfg_block; -+ u16 st_ram_block; -+ -+ union { -+ void *cpu_addr; -+ struct bcm4908enet_dma_ring_bd *buf_desc; -+ }; -+ dma_addr_t dma_addr; -+ -+ struct bcm4908enet_dma_ring_slot *slots; -+}; -+ -+struct bcm4908enet { -+ 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; -+}; -+ -+/*** -+ * R/W ops -+ */ -+ -+static inline u32 enet_read(struct bcm4908enet *enet, u16 offset) -+{ -+ return readl(enet->base + offset); -+} -+ -+static inline void enet_write(struct bcm4908enet *enet, u16 offset, u32 value) -+{ -+ writel(value, enet->base + offset); -+} -+ -+static inline void enet_maskset(struct bcm4908enet *enet, u16 offset, u32 mask, u32 set) -+{ -+ u32 val; -+ -+ WARN_ON(set & ~mask); -+ -+ val = enet_read(enet, offset); -+ val = (val & ~mask) | (set & mask); -+ enet_write(enet, offset, val); -+} -+ -+static inline void enet_set(struct bcm4908enet *enet, u16 offset, u32 set) -+{ -+ enet_maskset(enet, offset, set, set); -+} -+ -+static inline u32 enet_umac_read(struct bcm4908enet *enet, u16 offset) -+{ -+ return enet_read(enet, ENET_UNIMAC + offset); -+} -+ -+static inline void enet_umac_write(struct bcm4908enet *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) -+{ -+ 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); -+} -+ -+/*** -+ * Helpers -+ */ -+ -+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); -+} -+ -+static void bcm4908enet_intrs_off(struct bcm4908enet *enet) -+{ -+ enet_write(enet, ENET_DMA_CH_RX_CFG + ENET_DMA_CH_CFG_INT_MASK, 0); -+} -+ -+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); -+} -+ -+/*** -+ * DMA -+ */ -+ -+static int bcm4908_dma_alloc_buf_descs(struct bcm4908enet *enet, struct bcm4908enet_dma_ring *ring) -+{ -+ int size = ring->length * sizeof(struct bcm4908enet_dma_ring_bd); -+ struct device *dev = enet->dev; -+ -+ ring->cpu_addr = dma_alloc_coherent(dev, size, &ring->dma_addr, GFP_KERNEL); -+ if (!ring->cpu_addr) -+ return -ENOMEM; -+ -+ if (((uintptr_t)ring->cpu_addr) & (0x40 - 1)) { -+ dev_err(dev, "Invalid DMA ring alignment\n"); -+ goto err_free_buf_descs; -+ } -+ -+ ring->slots = kzalloc(ring->length * sizeof(*ring->slots), GFP_KERNEL); -+ if (!ring->slots) -+ goto err_free_buf_descs; -+ -+ memset(ring->cpu_addr, 0, size); -+ -+ ring->read_idx = 0; -+ ring->write_idx = 0; -+ -+ return 0; -+ -+err_free_buf_descs: -+ dma_free_coherent(dev, size, ring->cpu_addr, ring->dma_addr); -+ return -ENOMEM; -+} -+ -+static void bcm4908enet_dma_free(struct bcm4908enet *enet) -+{ -+ struct bcm4908enet_dma_ring *tx_ring = &enet->tx_ring; -+ struct bcm4908enet_dma_ring *rx_ring = &enet->rx_ring; -+ struct device *dev = enet->dev; -+ int size; -+ -+ size = rx_ring->length * sizeof(struct bcm4908enet_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); -+ 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) -+{ -+ struct bcm4908enet_dma_ring *tx_ring = &enet->tx_ring; -+ struct bcm4908enet_dma_ring *rx_ring = &enet->rx_ring; -+ struct device *dev = enet->dev; -+ int err; -+ -+ tx_ring->length = ENET_TX_BDS_NUM; -+ tx_ring->is_tx = 1; -+ tx_ring->cfg_block = ENET_DMA_CH_TX_CFG; -+ tx_ring->st_ram_block = ENET_DMA_CH_TX_STATE_RAM; -+ err = bcm4908_dma_alloc_buf_descs(enet, tx_ring); -+ if (err) { -+ dev_err(dev, "Failed to alloc TX buf descriptors: %d\n", err); -+ return err; -+ } -+ -+ rx_ring->length = ENET_RX_BDS_NUM; -+ rx_ring->is_tx = 0; -+ rx_ring->cfg_block = ENET_DMA_CH_RX_CFG; -+ rx_ring->st_ram_block = ENET_DMA_CH_RX_STATE_RAM; -+ 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); -+ return err; -+ } -+ -+ return 0; -+} -+ -+static void bcm4908enet_dma_reset(struct bcm4908enet *enet) -+{ -+ struct bcm4908enet_dma_ring *rings[] = { &enet->rx_ring, &enet->tx_ring }; -+ int i; -+ -+ /* Disable the DMA controller and channel */ -+ for (i = 0; i < ARRAY_SIZE(rings); i++) -+ enet_write(enet, rings[i]->cfg_block + ENET_DMA_CH_CFG, 0); -+ enet_maskset(enet, ENET_DMA_CONTROLLER_CFG, ENET_DMA_CTRL_CFG_MASTER_EN, 0); -+ -+ /* Reset channels state */ -+ for (i = 0; i < ARRAY_SIZE(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_STATE_DATA, 0); -+ enet_write(enet, ring->st_ram_block + ENET_DMA_CH_STATE_RAM_DESC_LEN_STATUS, 0); -+ enet_write(enet, ring->st_ram_block + ENET_DMA_CH_STATE_RAM_DESC_BASE_BUFPTR, 0); -+ } -+} -+ -+static int bcm4908enet_dma_alloc_rx_buf(struct bcm4908enet *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 device *dev = enet->dev; -+ u32 tmp; -+ int err; -+ -+ slot->len = ENET_MTU_MAX + ENET_MTU_MAX_EXTRA_SIZE; -+ -+ slot->skb = netdev_alloc_skb(enet->netdev, slot->len); -+ if (!slot->skb) -+ return -ENOMEM; -+ -+ slot->dma_addr = dma_map_single(dev, slot->skb->data, slot->len, DMA_FROM_DEVICE); -+ err = dma_mapping_error(dev, slot->dma_addr); -+ if (err) { -+ dev_err(dev, "Failed to map DMA buffer: %d\n", err); -+ kfree_skb(slot->skb); -+ slot->skb = NULL; -+ return err; -+ } -+ -+ tmp = slot->len << DMA_CTL_LEN_DESC_BUFLENGTH_SHIFT; -+ tmp |= DMA_CTL_STATUS_OWN; -+ if (idx == enet->rx_ring.length - 1) -+ tmp |= DMA_CTL_STATUS_WRAP; -+ buf_desc->ctl = cpu_to_le32(tmp); -+ buf_desc->addr = cpu_to_le32(slot->dma_addr); -+ -+ return 0; -+} -+ -+static void bcm4908enet_dma_ring_init(struct bcm4908enet *enet, -+ struct bcm4908enet_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; -+ -+ /* Reset the DMA channel */ -+ enet_write(enet, ENET_DMA_CTRL_CHANNEL_RESET, BIT(reset_channel * 2 + reset_subch)); -+ enet_write(enet, ENET_DMA_CTRL_CHANNEL_RESET, 0); -+ -+ enet_write(enet, ring->cfg_block + ENET_DMA_CH_CFG, 0); -+ enet_write(enet, ring->cfg_block + ENET_DMA_CH_CFG_MAX_BURST, ENET_DMA_MAX_BURST_LEN); -+ enet_write(enet, ring->cfg_block + ENET_DMA_CH_CFG_INT_MASK, 0); -+ -+ enet_write(enet, ring->st_ram_block + ENET_DMA_CH_STATE_RAM_BASE_DESC_PTR, -+ (uint32_t)ring->dma_addr); -+} -+ -+static void bcm4908enet_dma_uninit(struct bcm4908enet *enet) -+{ -+ struct bcm4908enet_dma_ring *rx_ring = &enet->rx_ring; -+ struct bcm4908enet_dma_ring_slot *slot; -+ struct device *dev = enet->dev; -+ int i; -+ -+ for (i = rx_ring->length - 1; i >= 0; i--) { -+ slot = &rx_ring->slots[i]; -+ if (!slot->skb) -+ continue; -+ dma_unmap_single(dev, slot->dma_addr, slot->len, DMA_FROM_DEVICE); -+ kfree_skb(slot->skb); -+ slot->skb = NULL; -+ } -+} -+ -+static int bcm4908enet_dma_init(struct bcm4908enet *enet) -+{ -+ struct bcm4908enet_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); -+ if (err) { -+ dev_err(dev, "Failed to alloc RX buffer: %d\n", err); -+ bcm4908enet_dma_uninit(enet); -+ return err; -+ } -+ } -+ -+ bcm4908enet_dma_ring_init(enet, &enet->tx_ring); -+ bcm4908enet_dma_ring_init(enet, &enet->rx_ring); -+ -+ return 0; -+} -+ -+static void bcm4908enet_dma_tx_ring_ensable(struct bcm4908enet *enet, -+ struct bcm4908enet_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) -+{ -+ 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) -+{ -+ 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) -+{ -+ unsigned long deadline; -+ u32 tmp; -+ -+ enet_maskset(enet, ring->cfg_block + ENET_DMA_CH_CFG, ENET_DMA_CH_CFG_ENABLE, 0); -+ -+ deadline = jiffies + usecs_to_jiffies(2000); -+ do { -+ tmp = enet_read(enet, ring->cfg_block + ENET_DMA_CH_CFG); -+ if (!(tmp & ENET_DMA_CH_CFG_ENABLE)) -+ return; -+ enet_maskset(enet, ring->cfg_block + ENET_DMA_CH_CFG, ENET_DMA_CH_CFG_ENABLE, 0); -+ usleep_range(10, 30); -+ } while (!time_after_eq(jiffies, deadline)); -+ -+ dev_warn(enet->dev, "Timeout waiting for DMA TX stop\n"); -+} -+ -+/*** -+ * Ethernet driver -+ */ -+ -+static void bcm4908enet_gmac_init(struct bcm4908enet *enet) -+{ -+ u32 cmd; -+ -+ cmd = enet_umac_read(enet, UMAC_CMD); -+ enet_umac_write(enet, UMAC_CMD, cmd | CMD_SW_RESET); -+ enet_umac_write(enet, UMAC_CMD, cmd & ~CMD_SW_RESET); -+ -+ enet_set(enet, ENET_FLUSH, ENET_FLUSH_RXFIFO_FLUSH | ENET_FLUSH_TXFIFO_FLUSH); -+ enet_maskset(enet, ENET_FLUSH, ENET_FLUSH_RXFIFO_FLUSH | ENET_FLUSH_TXFIFO_FLUSH, 0); -+ -+ enet_set(enet, ENET_MIB_CTRL, ENET_MIB_CTRL_CLR_MIB); -+ enet_maskset(enet, ENET_MIB_CTRL, ENET_MIB_CTRL_CLR_MIB, 0); -+ -+ cmd = enet_umac_read(enet, UMAC_CMD); -+ cmd &= ~(CMD_SPEED_MASK << CMD_SPEED_SHIFT); -+ cmd &= ~CMD_TX_EN; -+ cmd &= ~CMD_RX_EN; -+ cmd |= CMD_SPEED_1000 << CMD_SPEED_SHIFT; -+ enet_umac_write(enet, UMAC_CMD, cmd); -+ -+ enet_maskset(enet, ENET_GMAC_STATUS, -+ ENET_GMAC_STATUS_ETH_SPEED_MASK | -+ ENET_GMAC_STATUS_HD | -+ ENET_GMAC_STATUS_AUTO_CFG_EN | -+ ENET_GMAC_STATUS_LINK_UP, -+ ENET_GMAC_STATUS_ETH_SPEED_1000 | -+ ENET_GMAC_STATUS_AUTO_CFG_EN | -+ ENET_GMAC_STATUS_LINK_UP); -+} -+ -+static irqreturn_t bcm4908enet_irq_handler(int irq, void *dev_id) -+{ -+ struct bcm4908enet *enet = dev_id; -+ -+ bcm4908enet_intrs_off(enet); -+ bcm4908enet_intrs_ack(enet); -+ -+ napi_schedule(&enet->napi); -+ -+ return IRQ_HANDLED; -+} -+ -+static int bcm4908enet_open(struct net_device *netdev) -+{ -+ struct bcm4908enet *enet = netdev_priv(netdev); -+ struct device *dev = enet->dev; -+ int err; -+ -+ err = request_irq(netdev->irq, bcm4908enet_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); -+ -+ 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); -+ -+ napi_enable(&enet->napi); -+ netif_carrier_on(netdev); -+ netif_start_queue(netdev); -+ -+ bcm4908enet_intrs_ack(enet); -+ bcm4908enet_intrs_on(enet); -+ -+ return 0; -+} -+ -+static int bcm4908enet_stop(struct net_device *netdev) -+{ -+ struct bcm4908enet *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); -+ -+ bcm4908enet_dma_uninit(enet); -+ -+ free_irq(enet->netdev->irq, enet); -+ -+ return 0; -+} -+ -+static int bcm4908enet_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 device *dev = enet->dev; -+ struct bcm4908enet_dma_ring_bd *buf_desc; -+ int free_buf_descs; -+ u32 tmp; -+ -+ /* 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) -+ break; -+ slot = &ring->slots[ring->read_idx]; -+ -+ dma_unmap_single(dev, slot->dma_addr, slot->len, DMA_TO_DEVICE); -+ dev_kfree_skb(slot->skb); -+ if (++ring->read_idx == ring->length) -+ ring->read_idx = 0; -+ } -+ -+ /* Don't use the last empty buf descriptor */ -+ if (ring->read_idx <= ring->write_idx) -+ free_buf_descs = ring->read_idx - ring->write_idx + ring->length; -+ else -+ free_buf_descs = ring->read_idx - ring->write_idx; -+ if (free_buf_descs < 2) -+ return NETDEV_TX_BUSY; -+ -+ /* Hardware removes OWN bit after sending data */ -+ buf_desc = &ring->buf_desc[ring->write_idx]; -+ if (unlikely(le32_to_cpu(buf_desc->ctl) & DMA_CTL_STATUS_OWN)) { -+ netif_stop_queue(netdev); -+ return NETDEV_TX_BUSY; -+ } -+ -+ slot = &ring->slots[ring->write_idx]; -+ slot->skb = skb; -+ slot->len = skb->len; -+ slot->dma_addr = dma_map_single(dev, skb->data, skb->len, DMA_TO_DEVICE); -+ if (unlikely(dma_mapping_error(dev, slot->dma_addr))) -+ return NETDEV_TX_BUSY; -+ -+ tmp = skb->len << DMA_CTL_LEN_DESC_BUFLENGTH_SHIFT; -+ tmp |= DMA_CTL_STATUS_OWN; -+ tmp |= DMA_CTL_STATUS_SOP; -+ tmp |= DMA_CTL_STATUS_EOP; -+ tmp |= DMA_CTL_STATUS_APPEND_CRC; -+ if (ring->write_idx + 1 == ring->length - 1) -+ tmp |= DMA_CTL_STATUS_WRAP; -+ -+ 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); -+ -+ if (++ring->write_idx == ring->length - 1) -+ ring->write_idx = 0; -+ enet->netdev->stats.tx_bytes += skb->len; -+ enet->netdev->stats.tx_packets++; -+ -+ return NETDEV_TX_OK; -+} -+ -+static int bcm4908enet_poll(struct napi_struct *napi, int weight) -+{ -+ struct bcm4908enet *enet = container_of(napi, struct bcm4908enet, 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; -+ u32 ctl; -+ int len; -+ int err; -+ -+ buf_desc = &enet->rx_ring.buf_desc[enet->rx_ring.read_idx]; -+ ctl = le32_to_cpu(buf_desc->ctl); -+ if (ctl & DMA_CTL_STATUS_OWN) -+ break; -+ -+ 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); -+ if (err) -+ break; -+ -+ if (++enet->rx_ring.read_idx == enet->rx_ring.length) -+ enet->rx_ring.read_idx = 0; -+ -+ len = (ctl & DMA_CTL_LEN_DESC_BUFLENGTH) >> DMA_CTL_LEN_DESC_BUFLENGTH_SHIFT; -+ -+ if (len < ENET_MTU_MIN || -+ (ctl & (DMA_CTL_STATUS_SOP | DMA_CTL_STATUS_EOP)) != (DMA_CTL_STATUS_SOP | DMA_CTL_STATUS_EOP)) { -+ enet->netdev->stats.rx_dropped++; -+ break; -+ } -+ -+ dma_unmap_single(dev, slot.dma_addr, slot.len, DMA_FROM_DEVICE); -+ -+ skb_put(slot.skb, len - 4 + 2); -+ slot.skb->protocol = eth_type_trans(slot.skb, enet->netdev); -+ netif_receive_skb(slot.skb); -+ -+ enet->netdev->stats.rx_packets++; -+ enet->netdev->stats.rx_bytes += len; -+ } -+ -+ if (handled < weight) { -+ napi_complete_done(napi, handled); -+ bcm4908enet_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_set_mac_address = eth_mac_addr, -+}; -+ -+static int bcm4908enet_probe(struct platform_device *pdev) -+{ -+ struct device *dev = &pdev->dev; -+ struct net_device *netdev; -+ struct bcm4908enet *enet; -+ int err; -+ -+ netdev = devm_alloc_etherdev(dev, sizeof(*enet)); -+ if (!netdev) -+ return -ENOMEM; -+ -+ enet = netdev_priv(netdev); -+ enet->dev = dev; -+ enet->netdev = netdev; -+ -+ enet->base = devm_platform_ioremap_resource(pdev, 0); -+ if (IS_ERR(enet->base)) { -+ dev_err(dev, "Failed to map registers: %ld\n", PTR_ERR(enet->base)); -+ return PTR_ERR(enet->base); -+ } -+ -+ netdev->irq = platform_get_irq_byname(pdev, "rx"); -+ if (netdev->irq < 0) -+ return netdev->irq; -+ -+ dma_set_coherent_mask(dev, DMA_BIT_MASK(32)); -+ -+ err = bcm4908enet_dma_alloc(enet); -+ if (err) -+ return err; -+ -+ SET_NETDEV_DEV(netdev, &pdev->dev); -+ eth_hw_addr_random(netdev); -+ netdev->netdev_ops = &bcm96xx_netdev_ops; -+ 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); -+ -+ err = register_netdev(netdev); -+ if (err) { -+ bcm4908enet_dma_free(enet); -+ return err; -+ } -+ -+ platform_set_drvdata(pdev, enet); -+ -+ return 0; -+} -+ -+static int bcm4908enet_remove(struct platform_device *pdev) -+{ -+ struct bcm4908enet *enet = platform_get_drvdata(pdev); -+ -+ unregister_netdev(enet->netdev); -+ netif_napi_del(&enet->napi); -+ bcm4908enet_dma_free(enet); -+ -+ return 0; -+} -+ -+static const struct of_device_id bcm4908enet_of_match[] = { -+ { .compatible = "brcm,bcm4908enet"}, -+ {}, -+}; -+ -+static struct platform_driver bcm4908enet_driver = { -+ .driver = { -+ .name = "bcm4908enet", -+ .of_match_table = bcm4908enet_of_match, -+ }, -+ .probe = bcm4908enet_probe, -+ .remove = bcm4908enet_remove, -+}; -+module_platform_driver(bcm4908enet_driver); -+ -+MODULE_LICENSE("GPL v2"); -+MODULE_DEVICE_TABLE(of, bcm4908enet_of_match); ---- /dev/null -+++ b/drivers/net/ethernet/broadcom/bcm4908enet.h -@@ -0,0 +1,96 @@ -+/* SPDX-License-Identifier: GPL-2.0-only */ -+#ifndef __BCM4908ENET_H -+#define __BCM4908ENET_H -+ -+#define ENET_CONTROL 0x000 -+#define ENET_MIB_CTRL 0x004 -+#define ENET_MIB_CTRL_CLR_MIB 0x00000001 -+#define ENET_RX_ERR_MASK 0x008 -+#define ENET_MIB_MAX_PKT_SIZE 0x00C -+#define ENET_MIB_MAX_PKT_SIZE_VAL 0x00003fff -+#define ENET_DIAG_OUT 0x01c -+#define ENET_ENABLE_DROP_PKT 0x020 -+#define ENET_IRQ_ENABLE 0x024 -+#define ENET_IRQ_ENABLE_OVFL 0x00000001 -+#define ENET_GMAC_STATUS 0x028 -+#define ENET_GMAC_STATUS_ETH_SPEED_MASK 0x00000003 -+#define ENET_GMAC_STATUS_ETH_SPEED_10 0x00000000 -+#define ENET_GMAC_STATUS_ETH_SPEED_100 0x00000001 -+#define ENET_GMAC_STATUS_ETH_SPEED_1000 0x00000002 -+#define ENET_GMAC_STATUS_HD 0x00000004 -+#define ENET_GMAC_STATUS_AUTO_CFG_EN 0x00000008 -+#define ENET_GMAC_STATUS_LINK_UP 0x00000010 -+#define ENET_IRQ_STATUS 0x02c -+#define ENET_IRQ_STATUS_OVFL 0x00000001 -+#define ENET_OVERFLOW_COUNTER 0x030 -+#define ENET_FLUSH 0x034 -+#define ENET_FLUSH_RXFIFO_FLUSH 0x00000001 -+#define ENET_FLUSH_TXFIFO_FLUSH 0x00000002 -+#define ENET_RSV_SELECT 0x038 -+#define ENET_BP_FORCE 0x03c -+#define ENET_BP_FORCE_FORCE 0x00000001 -+#define ENET_DMA_RX_OK_TO_SEND_COUNT 0x040 -+#define ENET_DMA_RX_OK_TO_SEND_COUNT_VAL 0x0000000f -+#define ENET_TX_CRC_CTRL 0x044 -+#define ENET_MIB 0x200 -+#define ENET_UNIMAC 0x400 -+#define ENET_DMA 0x800 -+#define ENET_DMA_CONTROLLER_CFG 0x800 -+#define ENET_DMA_CTRL_CFG_MASTER_EN 0x00000001 -+#define ENET_DMA_CTRL_CFG_FLOWC_CH1_EN 0x00000002 -+#define ENET_DMA_CTRL_CFG_FLOWC_CH3_EN 0x00000004 -+#define ENET_DMA_FLOWCTL_CH1_THRESH_LO 0x804 -+#define ENET_DMA_FLOWCTL_CH1_THRESH_HI 0x808 -+#define ENET_DMA_FLOWCTL_CH1_ALLOC 0x80c -+#define ENET_DMA_FLOWCTL_CH1_ALLOC_FORCE 0x80000000 -+#define ENET_DMA_FLOWCTL_CH3_THRESH_LO 0x810 -+#define ENET_DMA_FLOWCTL_CH3_THRESH_HI 0x814 -+#define ENET_DMA_FLOWCTL_CH3_ALLOC 0x818 -+#define ENET_DMA_FLOWCTL_CH5_THRESH_LO 0x81C -+#define ENET_DMA_FLOWCTL_CH5_THRESH_HI 0x820 -+#define ENET_DMA_FLOWCTL_CH5_ALLOC 0x824 -+#define ENET_DMA_FLOWCTL_CH7_THRESH_LO 0x828 -+#define ENET_DMA_FLOWCTL_CH7_THRESH_HI 0x82C -+#define ENET_DMA_FLOWCTL_CH7_ALLOC 0x830 -+#define ENET_DMA_CTRL_CHANNEL_RESET 0x834 -+#define ENET_DMA_CTRL_CHANNEL_DEBUG 0x838 -+#define ENET_DMA_CTRL_GLOBAL_INTERRUPT_STATUS 0x840 -+#define ENET_DMA_CTRL_GLOBAL_INTERRUPT_MASK 0x844 -+#define ENET_DMA_CH0_CFG 0xa00 /* RX */ -+#define ENET_DMA_CH1_CFG 0xa10 /* TX */ -+#define ENET_DMA_CH0_STATE_RAM 0xc00 /* RX */ -+#define ENET_DMA_CH1_STATE_RAM 0xc10 /* TX */ -+ -+#define ENET_DMA_CH_CFG 0x00 /* assorted configuration */ -+#define ENET_DMA_CH_CFG_ENABLE 0x00000001 /* set to enable channel */ -+#define ENET_DMA_CH_CFG_PKT_HALT 0x00000002 /* idle after an EOP flag is detected */ -+#define ENET_DMA_CH_CFG_BURST_HALT 0x00000004 /* idle after finish current memory burst */ -+#define ENET_DMA_CH_CFG_INT_STAT 0x04 /* interrupts control and status */ -+#define ENET_DMA_CH_CFG_INT_MASK 0x08 /* interrupts mask */ -+#define ENET_DMA_CH_CFG_INT_BUFF_DONE 0x00000001 /* buffer done */ -+#define ENET_DMA_CH_CFG_INT_DONE 0x00000002 /* packet xfer complete */ -+#define ENET_DMA_CH_CFG_INT_NO_DESC 0x00000004 /* no valid descriptors */ -+#define ENET_DMA_CH_CFG_INT_RX_ERROR 0x00000008 /* rxdma detect client protocol error */ -+#define ENET_DMA_CH_CFG_MAX_BURST 0x0c /* max burst length permitted */ -+#define ENET_DMA_CH_CFG_MAX_BURST_DESCSIZE_SEL 0x00040000 /* DMA Descriptor Size Selection */ -+#define ENET_DMA_CH_CFG_SIZE 0x10 -+ -+#define ENET_DMA_CH_STATE_RAM_BASE_DESC_PTR 0x00 /* descriptor ring start address */ -+#define ENET_DMA_CH_STATE_RAM_STATE_DATA 0x04 /* state/bytes done/ring offset */ -+#define ENET_DMA_CH_STATE_RAM_DESC_LEN_STATUS 0x08 /* buffer descriptor status and len */ -+#define ENET_DMA_CH_STATE_RAM_DESC_BASE_BUFPTR 0x0c /* buffer descrpitor current processing */ -+#define ENET_DMA_CH_STATE_RAM_SIZE 0x10 -+ -+#define DMA_CTL_STATUS_APPEND_CRC 0x00000100 -+#define DMA_CTL_STATUS_APPEND_BRCM_TAG 0x00000200 -+#define DMA_CTL_STATUS_PRIO 0x00000C00 /* Prio for Tx */ -+#define DMA_CTL_STATUS_WRAP 0x00001000 /* */ -+#define DMA_CTL_STATUS_SOP 0x00002000 /* first buffer in packet */ -+#define DMA_CTL_STATUS_EOP 0x00004000 /* last buffer in packet */ -+#define DMA_CTL_STATUS_OWN 0x00008000 /* cleared by DMA, set by SW */ -+#define DMA_CTL_LEN_DESC_BUFLENGTH 0x0fff0000 -+#define DMA_CTL_LEN_DESC_BUFLENGTH_SHIFT 16 -+#define DMA_CTL_LEN_DESC_MULTICAST 0x40000000 -+#define DMA_CTL_LEN_DESC_USEFPM 0x80000000 -+ -+#endif diff --git a/target/linux/bcm4908/patches-5.4/073-v5.12-0001-dt-bindings-net-rename-BCM4908-Ethernet-binding.patch b/target/linux/bcm4908/patches-5.4/073-v5.12-0001-dt-bindings-net-rename-BCM4908-Ethernet-binding.patch deleted file mode 100644 index 563cb3ba91..0000000000 --- a/target/linux/bcm4908/patches-5.4/073-v5.12-0001-dt-bindings-net-rename-BCM4908-Ethernet-binding.patch +++ /dev/null @@ -1,128 +0,0 @@ -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%) - ---- a/Documentation/devicetree/bindings/net/brcm,bcm4908enet.yaml -+++ /dev/null -@@ -1,45 +0,0 @@ --# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause --%YAML 1.2 ----- --$id: http://devicetree.org/schemas/net/brcm,bcm4908enet.yaml# --$schema: http://devicetree.org/meta-schemas/core.yaml# -- --title: Broadcom BCM4908 Ethernet controller -- --description: Broadcom's Ethernet controller integrated into BCM4908 family SoCs -- --maintainers: -- - Rafał Miłecki <rafal@milecki.pl> -- --properties: -- compatible: -- const: brcm,bcm4908enet -- -- reg: -- maxItems: 1 -- -- interrupts: -- description: RX interrupt -- -- interrupt-names: -- const: rx -- --required: -- - reg -- - interrupts -- - interrupt-names -- --additionalProperties: false -- --examples: -- - | -- #include <dt-bindings/interrupt-controller/irq.h> -- #include <dt-bindings/interrupt-controller/arm-gic.h> -- -- ethernet@80002000 { -- compatible = "brcm,bcm4908enet"; -- reg = <0x80002000 0x1000>; -- -- interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>; -- interrupt-names = "rx"; -- }; ---- /dev/null -+++ b/Documentation/devicetree/bindings/net/brcm,bcm4908-enet.yaml -@@ -0,0 +1,45 @@ -+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause -+%YAML 1.2 -+--- -+$id: http://devicetree.org/schemas/net/brcm,bcm4908-enet.yaml# -+$schema: http://devicetree.org/meta-schemas/core.yaml# -+ -+title: Broadcom BCM4908 Ethernet controller -+ -+description: Broadcom's Ethernet controller integrated into BCM4908 family SoCs -+ -+maintainers: -+ - Rafał Miłecki <rafal@milecki.pl> -+ -+properties: -+ compatible: -+ const: brcm,bcm4908-enet -+ -+ reg: -+ maxItems: 1 -+ -+ interrupts: -+ description: RX interrupt -+ -+ interrupt-names: -+ const: rx -+ -+required: -+ - reg -+ - interrupts -+ - interrupt-names -+ -+additionalProperties: false -+ -+examples: -+ - | -+ #include <dt-bindings/interrupt-controller/irq.h> -+ #include <dt-bindings/interrupt-controller/arm-gic.h> -+ -+ ethernet@80002000 { -+ compatible = "brcm,bcm4908-enet"; -+ reg = <0x80002000 0x1000>; -+ -+ interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>; -+ interrupt-names = "rx"; -+ }; ---- a/MAINTAINERS -+++ b/MAINTAINERS -@@ -3213,7 +3213,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 - diff --git a/target/linux/bcm4908/patches-5.4/073-v5.12-0002-dt-bindings-net-bcm4908-enet-include-ethernet-contro.patch b/target/linux/bcm4908/patches-5.4/073-v5.12-0002-dt-bindings-net-bcm4908-enet-include-ethernet-contro.patch deleted file mode 100644 index a4409a818a..0000000000 --- a/target/linux/bcm4908/patches-5.4/073-v5.12-0002-dt-bindings-net-bcm4908-enet-include-ethernet-contro.patch +++ /dev/null @@ -1,32 +0,0 @@ -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 diff --git a/target/linux/bcm4908/patches-5.4/073-v5.12-0003-net-broadcom-rename-BCM4908-driver-update-DT-binding.patch b/target/linux/bcm4908/patches-5.4/073-v5.12-0003-net-broadcom-rename-BCM4908-driver-update-DT-binding.patch deleted file mode 100644 index 66681963c1..0000000000 --- a/target/linux/bcm4908/patches-5.4/073-v5.12-0003-net-broadcom-rename-BCM4908-driver-update-DT-binding.patch +++ /dev/null @@ -1,1614 +0,0 @@ -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%) - ---- a/MAINTAINERS -+++ b/MAINTAINERS -@@ -3214,7 +3214,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 ---- 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 ---- 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 ---- a/drivers/net/ethernet/broadcom/bcm4908enet.c -+++ /dev/null -@@ -1,676 +0,0 @@ --// SPDX-License-Identifier: GPL-2.0-only --/* -- * Copyright (C) 2021 Rafał Miłecki <rafal@milecki.pl> -- */ -- --#include <linux/delay.h> --#include <linux/etherdevice.h> --#include <linux/interrupt.h> --#include <linux/module.h> --#include <linux/of.h> --#include <linux/platform_device.h> --#include <linux/slab.h> --#include <linux/string.h> -- --#include "bcm4908enet.h" --#include "unimac.h" -- --#define ENET_DMA_CH_RX_CFG ENET_DMA_CH0_CFG --#define ENET_DMA_CH_TX_CFG ENET_DMA_CH1_CFG --#define ENET_DMA_CH_RX_STATE_RAM ENET_DMA_CH0_STATE_RAM --#define ENET_DMA_CH_TX_STATE_RAM ENET_DMA_CH1_STATE_RAM -- --#define ENET_TX_BDS_NUM 200 --#define ENET_RX_BDS_NUM 200 --#define ENET_RX_BDS_NUM_MAX 8192 -- --#define ENET_DMA_INT_DEFAULTS (ENET_DMA_CH_CFG_INT_DONE | \ -- ENET_DMA_CH_CFG_INT_NO_DESC | \ -- ENET_DMA_CH_CFG_INT_BUFF_DONE) --#define ENET_DMA_MAX_BURST_LEN 8 /* in 64 bit words */ -- --#define ENET_MTU_MIN 60 --#define ENET_MTU_MAX 1500 /* Is it possible to support 2044? */ --#define ENET_MTU_MAX_EXTRA_SIZE 32 /* L2 */ -- --struct bcm4908enet_dma_ring_bd { -- __le32 ctl; -- __le32 addr; --} __packed; -- --struct bcm4908enet_dma_ring_slot { -- struct sk_buff *skb; -- unsigned int len; -- dma_addr_t dma_addr; --}; -- --struct bcm4908enet_dma_ring { -- int is_tx; -- int read_idx; -- int write_idx; -- int length; -- u16 cfg_block; -- u16 st_ram_block; -- -- union { -- void *cpu_addr; -- struct bcm4908enet_dma_ring_bd *buf_desc; -- }; -- dma_addr_t dma_addr; -- -- struct bcm4908enet_dma_ring_slot *slots; --}; -- --struct bcm4908enet { -- 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; --}; -- --/*** -- * R/W ops -- */ -- --static inline u32 enet_read(struct bcm4908enet *enet, u16 offset) --{ -- return readl(enet->base + offset); --} -- --static inline void enet_write(struct bcm4908enet *enet, u16 offset, u32 value) --{ -- writel(value, enet->base + offset); --} -- --static inline void enet_maskset(struct bcm4908enet *enet, u16 offset, u32 mask, u32 set) --{ -- u32 val; -- -- WARN_ON(set & ~mask); -- -- val = enet_read(enet, offset); -- val = (val & ~mask) | (set & mask); -- enet_write(enet, offset, val); --} -- --static inline void enet_set(struct bcm4908enet *enet, u16 offset, u32 set) --{ -- enet_maskset(enet, offset, set, set); --} -- --static inline u32 enet_umac_read(struct bcm4908enet *enet, u16 offset) --{ -- return enet_read(enet, ENET_UNIMAC + offset); --} -- --static inline void enet_umac_write(struct bcm4908enet *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) --{ -- 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); --} -- --/*** -- * Helpers -- */ -- --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); --} -- --static void bcm4908enet_intrs_off(struct bcm4908enet *enet) --{ -- enet_write(enet, ENET_DMA_CH_RX_CFG + ENET_DMA_CH_CFG_INT_MASK, 0); --} -- --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); --} -- --/*** -- * DMA -- */ -- --static int bcm4908_dma_alloc_buf_descs(struct bcm4908enet *enet, struct bcm4908enet_dma_ring *ring) --{ -- int size = ring->length * sizeof(struct bcm4908enet_dma_ring_bd); -- struct device *dev = enet->dev; -- -- ring->cpu_addr = dma_alloc_coherent(dev, size, &ring->dma_addr, GFP_KERNEL); -- if (!ring->cpu_addr) -- return -ENOMEM; -- -- if (((uintptr_t)ring->cpu_addr) & (0x40 - 1)) { -- dev_err(dev, "Invalid DMA ring alignment\n"); -- goto err_free_buf_descs; -- } -- -- ring->slots = kzalloc(ring->length * sizeof(*ring->slots), GFP_KERNEL); -- if (!ring->slots) -- goto err_free_buf_descs; -- -- memset(ring->cpu_addr, 0, size); -- -- ring->read_idx = 0; -- ring->write_idx = 0; -- -- return 0; -- --err_free_buf_descs: -- dma_free_coherent(dev, size, ring->cpu_addr, ring->dma_addr); -- return -ENOMEM; --} -- --static void bcm4908enet_dma_free(struct bcm4908enet *enet) --{ -- struct bcm4908enet_dma_ring *tx_ring = &enet->tx_ring; -- struct bcm4908enet_dma_ring *rx_ring = &enet->rx_ring; -- struct device *dev = enet->dev; -- int size; -- -- size = rx_ring->length * sizeof(struct bcm4908enet_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); -- 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) --{ -- struct bcm4908enet_dma_ring *tx_ring = &enet->tx_ring; -- struct bcm4908enet_dma_ring *rx_ring = &enet->rx_ring; -- struct device *dev = enet->dev; -- int err; -- -- tx_ring->length = ENET_TX_BDS_NUM; -- tx_ring->is_tx = 1; -- tx_ring->cfg_block = ENET_DMA_CH_TX_CFG; -- tx_ring->st_ram_block = ENET_DMA_CH_TX_STATE_RAM; -- err = bcm4908_dma_alloc_buf_descs(enet, tx_ring); -- if (err) { -- dev_err(dev, "Failed to alloc TX buf descriptors: %d\n", err); -- return err; -- } -- -- rx_ring->length = ENET_RX_BDS_NUM; -- rx_ring->is_tx = 0; -- rx_ring->cfg_block = ENET_DMA_CH_RX_CFG; -- rx_ring->st_ram_block = ENET_DMA_CH_RX_STATE_RAM; -- 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); -- return err; -- } -- -- return 0; --} -- --static void bcm4908enet_dma_reset(struct bcm4908enet *enet) --{ -- struct bcm4908enet_dma_ring *rings[] = { &enet->rx_ring, &enet->tx_ring }; -- int i; -- -- /* Disable the DMA controller and channel */ -- for (i = 0; i < ARRAY_SIZE(rings); i++) -- enet_write(enet, rings[i]->cfg_block + ENET_DMA_CH_CFG, 0); -- enet_maskset(enet, ENET_DMA_CONTROLLER_CFG, ENET_DMA_CTRL_CFG_MASTER_EN, 0); -- -- /* Reset channels state */ -- for (i = 0; i < ARRAY_SIZE(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_STATE_DATA, 0); -- enet_write(enet, ring->st_ram_block + ENET_DMA_CH_STATE_RAM_DESC_LEN_STATUS, 0); -- enet_write(enet, ring->st_ram_block + ENET_DMA_CH_STATE_RAM_DESC_BASE_BUFPTR, 0); -- } --} -- --static int bcm4908enet_dma_alloc_rx_buf(struct bcm4908enet *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 device *dev = enet->dev; -- u32 tmp; -- int err; -- -- slot->len = ENET_MTU_MAX + ENET_MTU_MAX_EXTRA_SIZE; -- -- slot->skb = netdev_alloc_skb(enet->netdev, slot->len); -- if (!slot->skb) -- return -ENOMEM; -- -- slot->dma_addr = dma_map_single(dev, slot->skb->data, slot->len, DMA_FROM_DEVICE); -- err = dma_mapping_error(dev, slot->dma_addr); -- if (err) { -- dev_err(dev, "Failed to map DMA buffer: %d\n", err); -- kfree_skb(slot->skb); -- slot->skb = NULL; -- return err; -- } -- -- tmp = slot->len << DMA_CTL_LEN_DESC_BUFLENGTH_SHIFT; -- tmp |= DMA_CTL_STATUS_OWN; -- if (idx == enet->rx_ring.length - 1) -- tmp |= DMA_CTL_STATUS_WRAP; -- buf_desc->ctl = cpu_to_le32(tmp); -- buf_desc->addr = cpu_to_le32(slot->dma_addr); -- -- return 0; --} -- --static void bcm4908enet_dma_ring_init(struct bcm4908enet *enet, -- struct bcm4908enet_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; -- -- /* Reset the DMA channel */ -- enet_write(enet, ENET_DMA_CTRL_CHANNEL_RESET, BIT(reset_channel * 2 + reset_subch)); -- enet_write(enet, ENET_DMA_CTRL_CHANNEL_RESET, 0); -- -- enet_write(enet, ring->cfg_block + ENET_DMA_CH_CFG, 0); -- enet_write(enet, ring->cfg_block + ENET_DMA_CH_CFG_MAX_BURST, ENET_DMA_MAX_BURST_LEN); -- enet_write(enet, ring->cfg_block + ENET_DMA_CH_CFG_INT_MASK, 0); -- -- enet_write(enet, ring->st_ram_block + ENET_DMA_CH_STATE_RAM_BASE_DESC_PTR, -- (uint32_t)ring->dma_addr); --} -- --static void bcm4908enet_dma_uninit(struct bcm4908enet *enet) --{ -- struct bcm4908enet_dma_ring *rx_ring = &enet->rx_ring; -- struct bcm4908enet_dma_ring_slot *slot; -- struct device *dev = enet->dev; -- int i; -- -- for (i = rx_ring->length - 1; i >= 0; i--) { -- slot = &rx_ring->slots[i]; -- if (!slot->skb) -- continue; -- dma_unmap_single(dev, slot->dma_addr, slot->len, DMA_FROM_DEVICE); -- kfree_skb(slot->skb); -- slot->skb = NULL; -- } --} -- --static int bcm4908enet_dma_init(struct bcm4908enet *enet) --{ -- struct bcm4908enet_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); -- if (err) { -- dev_err(dev, "Failed to alloc RX buffer: %d\n", err); -- bcm4908enet_dma_uninit(enet); -- return err; -- } -- } -- -- bcm4908enet_dma_ring_init(enet, &enet->tx_ring); -- bcm4908enet_dma_ring_init(enet, &enet->rx_ring); -- -- return 0; --} -- --static void bcm4908enet_dma_tx_ring_ensable(struct bcm4908enet *enet, -- struct bcm4908enet_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) --{ -- 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) --{ -- 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) --{ -- unsigned long deadline; -- u32 tmp; -- -- enet_maskset(enet, ring->cfg_block + ENET_DMA_CH_CFG, ENET_DMA_CH_CFG_ENABLE, 0); -- -- deadline = jiffies + usecs_to_jiffies(2000); -- do { -- tmp = enet_read(enet, ring->cfg_block + ENET_DMA_CH_CFG); -- if (!(tmp & ENET_DMA_CH_CFG_ENABLE)) -- return; -- enet_maskset(enet, ring->cfg_block + ENET_DMA_CH_CFG, ENET_DMA_CH_CFG_ENABLE, 0); -- usleep_range(10, 30); -- } while (!time_after_eq(jiffies, deadline)); -- -- dev_warn(enet->dev, "Timeout waiting for DMA TX stop\n"); --} -- --/*** -- * Ethernet driver -- */ -- --static void bcm4908enet_gmac_init(struct bcm4908enet *enet) --{ -- u32 cmd; -- -- cmd = enet_umac_read(enet, UMAC_CMD); -- enet_umac_write(enet, UMAC_CMD, cmd | CMD_SW_RESET); -- enet_umac_write(enet, UMAC_CMD, cmd & ~CMD_SW_RESET); -- -- enet_set(enet, ENET_FLUSH, ENET_FLUSH_RXFIFO_FLUSH | ENET_FLUSH_TXFIFO_FLUSH); -- enet_maskset(enet, ENET_FLUSH, ENET_FLUSH_RXFIFO_FLUSH | ENET_FLUSH_TXFIFO_FLUSH, 0); -- -- enet_set(enet, ENET_MIB_CTRL, ENET_MIB_CTRL_CLR_MIB); -- enet_maskset(enet, ENET_MIB_CTRL, ENET_MIB_CTRL_CLR_MIB, 0); -- -- cmd = enet_umac_read(enet, UMAC_CMD); -- cmd &= ~(CMD_SPEED_MASK << CMD_SPEED_SHIFT); -- cmd &= ~CMD_TX_EN; -- cmd &= ~CMD_RX_EN; -- cmd |= CMD_SPEED_1000 << CMD_SPEED_SHIFT; -- enet_umac_write(enet, UMAC_CMD, cmd); -- -- enet_maskset(enet, ENET_GMAC_STATUS, -- ENET_GMAC_STATUS_ETH_SPEED_MASK | -- ENET_GMAC_STATUS_HD | -- ENET_GMAC_STATUS_AUTO_CFG_EN | -- ENET_GMAC_STATUS_LINK_UP, -- ENET_GMAC_STATUS_ETH_SPEED_1000 | -- ENET_GMAC_STATUS_AUTO_CFG_EN | -- ENET_GMAC_STATUS_LINK_UP); --} -- --static irqreturn_t bcm4908enet_irq_handler(int irq, void *dev_id) --{ -- struct bcm4908enet *enet = dev_id; -- -- bcm4908enet_intrs_off(enet); -- bcm4908enet_intrs_ack(enet); -- -- napi_schedule(&enet->napi); -- -- return IRQ_HANDLED; --} -- --static int bcm4908enet_open(struct net_device *netdev) --{ -- struct bcm4908enet *enet = netdev_priv(netdev); -- struct device *dev = enet->dev; -- int err; -- -- err = request_irq(netdev->irq, bcm4908enet_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); -- -- 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); -- -- napi_enable(&enet->napi); -- netif_carrier_on(netdev); -- netif_start_queue(netdev); -- -- bcm4908enet_intrs_ack(enet); -- bcm4908enet_intrs_on(enet); -- -- return 0; --} -- --static int bcm4908enet_stop(struct net_device *netdev) --{ -- struct bcm4908enet *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); -- -- bcm4908enet_dma_uninit(enet); -- -- free_irq(enet->netdev->irq, enet); -- -- return 0; --} -- --static int bcm4908enet_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 device *dev = enet->dev; -- struct bcm4908enet_dma_ring_bd *buf_desc; -- int free_buf_descs; -- u32 tmp; -- -- /* 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) -- break; -- slot = &ring->slots[ring->read_idx]; -- -- dma_unmap_single(dev, slot->dma_addr, slot->len, DMA_TO_DEVICE); -- dev_kfree_skb(slot->skb); -- if (++ring->read_idx == ring->length) -- ring->read_idx = 0; -- } -- -- /* Don't use the last empty buf descriptor */ -- if (ring->read_idx <= ring->write_idx) -- free_buf_descs = ring->read_idx - ring->write_idx + ring->length; -- else -- free_buf_descs = ring->read_idx - ring->write_idx; -- if (free_buf_descs < 2) -- return NETDEV_TX_BUSY; -- -- /* Hardware removes OWN bit after sending data */ -- buf_desc = &ring->buf_desc[ring->write_idx]; -- if (unlikely(le32_to_cpu(buf_desc->ctl) & DMA_CTL_STATUS_OWN)) { -- netif_stop_queue(netdev); -- return NETDEV_TX_BUSY; -- } -- -- slot = &ring->slots[ring->write_idx]; -- slot->skb = skb; -- slot->len = skb->len; -- slot->dma_addr = dma_map_single(dev, skb->data, skb->len, DMA_TO_DEVICE); -- if (unlikely(dma_mapping_error(dev, slot->dma_addr))) -- return NETDEV_TX_BUSY; -- -- tmp = skb->len << DMA_CTL_LEN_DESC_BUFLENGTH_SHIFT; -- tmp |= DMA_CTL_STATUS_OWN; -- tmp |= DMA_CTL_STATUS_SOP; -- tmp |= DMA_CTL_STATUS_EOP; -- tmp |= DMA_CTL_STATUS_APPEND_CRC; -- if (ring->write_idx + 1 == ring->length - 1) -- tmp |= DMA_CTL_STATUS_WRAP; -- -- 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); -- -- if (++ring->write_idx == ring->length - 1) -- ring->write_idx = 0; -- enet->netdev->stats.tx_bytes += skb->len; -- enet->netdev->stats.tx_packets++; -- -- return NETDEV_TX_OK; --} -- --static int bcm4908enet_poll(struct napi_struct *napi, int weight) --{ -- struct bcm4908enet *enet = container_of(napi, struct bcm4908enet, 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; -- u32 ctl; -- int len; -- int err; -- -- buf_desc = &enet->rx_ring.buf_desc[enet->rx_ring.read_idx]; -- ctl = le32_to_cpu(buf_desc->ctl); -- if (ctl & DMA_CTL_STATUS_OWN) -- break; -- -- 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); -- if (err) -- break; -- -- if (++enet->rx_ring.read_idx == enet->rx_ring.length) -- enet->rx_ring.read_idx = 0; -- -- len = (ctl & DMA_CTL_LEN_DESC_BUFLENGTH) >> DMA_CTL_LEN_DESC_BUFLENGTH_SHIFT; -- -- if (len < ENET_MTU_MIN || -- (ctl & (DMA_CTL_STATUS_SOP | DMA_CTL_STATUS_EOP)) != (DMA_CTL_STATUS_SOP | DMA_CTL_STATUS_EOP)) { -- enet->netdev->stats.rx_dropped++; -- break; -- } -- -- dma_unmap_single(dev, slot.dma_addr, slot.len, DMA_FROM_DEVICE); -- -- skb_put(slot.skb, len - 4 + 2); -- slot.skb->protocol = eth_type_trans(slot.skb, enet->netdev); -- netif_receive_skb(slot.skb); -- -- enet->netdev->stats.rx_packets++; -- enet->netdev->stats.rx_bytes += len; -- } -- -- if (handled < weight) { -- napi_complete_done(napi, handled); -- bcm4908enet_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_set_mac_address = eth_mac_addr, --}; -- --static int bcm4908enet_probe(struct platform_device *pdev) --{ -- struct device *dev = &pdev->dev; -- struct net_device *netdev; -- struct bcm4908enet *enet; -- int err; -- -- netdev = devm_alloc_etherdev(dev, sizeof(*enet)); -- if (!netdev) -- return -ENOMEM; -- -- enet = netdev_priv(netdev); -- enet->dev = dev; -- enet->netdev = netdev; -- -- enet->base = devm_platform_ioremap_resource(pdev, 0); -- if (IS_ERR(enet->base)) { -- dev_err(dev, "Failed to map registers: %ld\n", PTR_ERR(enet->base)); -- return PTR_ERR(enet->base); -- } -- -- netdev->irq = platform_get_irq_byname(pdev, "rx"); -- if (netdev->irq < 0) -- return netdev->irq; -- -- dma_set_coherent_mask(dev, DMA_BIT_MASK(32)); -- -- err = bcm4908enet_dma_alloc(enet); -- if (err) -- return err; -- -- SET_NETDEV_DEV(netdev, &pdev->dev); -- eth_hw_addr_random(netdev); -- netdev->netdev_ops = &bcm96xx_netdev_ops; -- 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); -- -- err = register_netdev(netdev); -- if (err) { -- bcm4908enet_dma_free(enet); -- return err; -- } -- -- platform_set_drvdata(pdev, enet); -- -- return 0; --} -- --static int bcm4908enet_remove(struct platform_device *pdev) --{ -- struct bcm4908enet *enet = platform_get_drvdata(pdev); -- -- unregister_netdev(enet->netdev); -- netif_napi_del(&enet->napi); -- bcm4908enet_dma_free(enet); -- -- return 0; --} -- --static const struct of_device_id bcm4908enet_of_match[] = { -- { .compatible = "brcm,bcm4908enet"}, -- {}, --}; -- --static struct platform_driver bcm4908enet_driver = { -- .driver = { -- .name = "bcm4908enet", -- .of_match_table = bcm4908enet_of_match, -- }, -- .probe = bcm4908enet_probe, -- .remove = bcm4908enet_remove, --}; --module_platform_driver(bcm4908enet_driver); -- --MODULE_LICENSE("GPL v2"); --MODULE_DEVICE_TABLE(of, bcm4908enet_of_match); ---- /dev/null -+++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c -@@ -0,0 +1,677 @@ -+// SPDX-License-Identifier: GPL-2.0-only -+/* -+ * Copyright (C) 2021 Rafał Miłecki <rafal@milecki.pl> -+ */ -+ -+#include <linux/delay.h> -+#include <linux/etherdevice.h> -+#include <linux/interrupt.h> -+#include <linux/module.h> -+#include <linux/of.h> -+#include <linux/platform_device.h> -+#include <linux/slab.h> -+#include <linux/string.h> -+ -+#include "bcm4908_enet.h" -+#include "unimac.h" -+ -+#define ENET_DMA_CH_RX_CFG ENET_DMA_CH0_CFG -+#define ENET_DMA_CH_TX_CFG ENET_DMA_CH1_CFG -+#define ENET_DMA_CH_RX_STATE_RAM ENET_DMA_CH0_STATE_RAM -+#define ENET_DMA_CH_TX_STATE_RAM ENET_DMA_CH1_STATE_RAM -+ -+#define ENET_TX_BDS_NUM 200 -+#define ENET_RX_BDS_NUM 200 -+#define ENET_RX_BDS_NUM_MAX 8192 -+ -+#define ENET_DMA_INT_DEFAULTS (ENET_DMA_CH_CFG_INT_DONE | \ -+ ENET_DMA_CH_CFG_INT_NO_DESC | \ -+ ENET_DMA_CH_CFG_INT_BUFF_DONE) -+#define ENET_DMA_MAX_BURST_LEN 8 /* in 64 bit words */ -+ -+#define ENET_MTU_MIN 60 -+#define ENET_MTU_MAX 1500 /* Is it possible to support 2044? */ -+#define ENET_MTU_MAX_EXTRA_SIZE 32 /* L2 */ -+ -+struct bcm4908_enet_dma_ring_bd { -+ __le32 ctl; -+ __le32 addr; -+} __packed; -+ -+struct bcm4908_enet_dma_ring_slot { -+ struct sk_buff *skb; -+ unsigned int len; -+ dma_addr_t dma_addr; -+}; -+ -+struct bcm4908_enet_dma_ring { -+ int is_tx; -+ int read_idx; -+ int write_idx; -+ int length; -+ u16 cfg_block; -+ u16 st_ram_block; -+ -+ union { -+ void *cpu_addr; -+ struct bcm4908_enet_dma_ring_bd *buf_desc; -+ }; -+ dma_addr_t dma_addr; -+ -+ struct bcm4908_enet_dma_ring_slot *slots; -+}; -+ -+struct bcm4908_enet { -+ struct device *dev; -+ struct net_device *netdev; -+ struct napi_struct napi; -+ void __iomem *base; -+ -+ struct bcm4908_enet_dma_ring tx_ring; -+ struct bcm4908_enet_dma_ring rx_ring; -+}; -+ -+/*** -+ * R/W ops -+ */ -+ -+static inline 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) -+{ -+ writel(value, enet->base + offset); -+} -+ -+static inline void enet_maskset(struct bcm4908_enet *enet, u16 offset, u32 mask, u32 set) -+{ -+ u32 val; -+ -+ WARN_ON(set & ~mask); -+ -+ val = enet_read(enet, offset); -+ val = (val & ~mask) | (set & mask); -+ enet_write(enet, offset, val); -+} -+ -+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 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) -+{ -+ 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) -+{ -+ enet_set(enet, ENET_UNIMAC + offset, set); -+} -+ -+/*** -+ * Helpers -+ */ -+ -+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 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 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); -+} -+ -+/*** -+ * DMA -+ */ -+ -+static int bcm4908_dma_alloc_buf_descs(struct bcm4908_enet *enet, -+ struct bcm4908_enet_dma_ring *ring) -+{ -+ 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); -+ if (!ring->cpu_addr) -+ return -ENOMEM; -+ -+ if (((uintptr_t)ring->cpu_addr) & (0x40 - 1)) { -+ dev_err(dev, "Invalid DMA ring alignment\n"); -+ goto err_free_buf_descs; -+ } -+ -+ ring->slots = kzalloc(ring->length * sizeof(*ring->slots), GFP_KERNEL); -+ if (!ring->slots) -+ goto err_free_buf_descs; -+ -+ memset(ring->cpu_addr, 0, size); -+ -+ ring->read_idx = 0; -+ ring->write_idx = 0; -+ -+ return 0; -+ -+err_free_buf_descs: -+ dma_free_coherent(dev, size, ring->cpu_addr, ring->dma_addr); -+ return -ENOMEM; -+} -+ -+static void bcm4908_enet_dma_free(struct bcm4908_enet *enet) -+{ -+ 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 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 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 bcm4908_enet_dma_alloc(struct bcm4908_enet *enet) -+{ -+ 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; -+ -+ tx_ring->length = ENET_TX_BDS_NUM; -+ tx_ring->is_tx = 1; -+ tx_ring->cfg_block = ENET_DMA_CH_TX_CFG; -+ tx_ring->st_ram_block = ENET_DMA_CH_TX_STATE_RAM; -+ err = bcm4908_dma_alloc_buf_descs(enet, tx_ring); -+ if (err) { -+ dev_err(dev, "Failed to alloc TX buf descriptors: %d\n", err); -+ return err; -+ } -+ -+ rx_ring->length = ENET_RX_BDS_NUM; -+ rx_ring->is_tx = 0; -+ rx_ring->cfg_block = ENET_DMA_CH_RX_CFG; -+ rx_ring->st_ram_block = ENET_DMA_CH_RX_STATE_RAM; -+ err = bcm4908_dma_alloc_buf_descs(enet, rx_ring); -+ if (err) { -+ dev_err(dev, "Failed to alloc RX buf descriptors: %d\n", err); -+ bcm4908_enet_dma_free(enet); -+ return err; -+ } -+ -+ return 0; -+} -+ -+static void bcm4908_enet_dma_reset(struct bcm4908_enet *enet) -+{ -+ struct bcm4908_enet_dma_ring *rings[] = { &enet->rx_ring, &enet->tx_ring }; -+ int i; -+ -+ /* Disable the DMA controller and channel */ -+ for (i = 0; i < ARRAY_SIZE(rings); i++) -+ enet_write(enet, rings[i]->cfg_block + ENET_DMA_CH_CFG, 0); -+ enet_maskset(enet, ENET_DMA_CONTROLLER_CFG, ENET_DMA_CTRL_CFG_MASTER_EN, 0); -+ -+ /* Reset channels state */ -+ for (i = 0; i < ARRAY_SIZE(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); -+ enet_write(enet, ring->st_ram_block + ENET_DMA_CH_STATE_RAM_DESC_LEN_STATUS, 0); -+ enet_write(enet, ring->st_ram_block + ENET_DMA_CH_STATE_RAM_DESC_BASE_BUFPTR, 0); -+ } -+} -+ -+static int bcm4908_enet_dma_alloc_rx_buf(struct bcm4908_enet *enet, unsigned int 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; -+ -+ slot->len = ENET_MTU_MAX + ENET_MTU_MAX_EXTRA_SIZE; -+ -+ slot->skb = netdev_alloc_skb(enet->netdev, slot->len); -+ if (!slot->skb) -+ return -ENOMEM; -+ -+ slot->dma_addr = dma_map_single(dev, slot->skb->data, slot->len, DMA_FROM_DEVICE); -+ err = dma_mapping_error(dev, slot->dma_addr); -+ if (err) { -+ dev_err(dev, "Failed to map DMA buffer: %d\n", err); -+ kfree_skb(slot->skb); -+ slot->skb = NULL; -+ return err; -+ } -+ -+ tmp = slot->len << DMA_CTL_LEN_DESC_BUFLENGTH_SHIFT; -+ tmp |= DMA_CTL_STATUS_OWN; -+ if (idx == enet->rx_ring.length - 1) -+ tmp |= DMA_CTL_STATUS_WRAP; -+ buf_desc->ctl = cpu_to_le32(tmp); -+ buf_desc->addr = cpu_to_le32(slot->dma_addr); -+ -+ return 0; -+} -+ -+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; -+ -+ /* Reset the DMA channel */ -+ enet_write(enet, ENET_DMA_CTRL_CHANNEL_RESET, BIT(reset_channel * 2 + reset_subch)); -+ enet_write(enet, ENET_DMA_CTRL_CHANNEL_RESET, 0); -+ -+ enet_write(enet, ring->cfg_block + ENET_DMA_CH_CFG, 0); -+ enet_write(enet, ring->cfg_block + ENET_DMA_CH_CFG_MAX_BURST, ENET_DMA_MAX_BURST_LEN); -+ enet_write(enet, ring->cfg_block + ENET_DMA_CH_CFG_INT_MASK, 0); -+ -+ enet_write(enet, ring->st_ram_block + ENET_DMA_CH_STATE_RAM_BASE_DESC_PTR, -+ (uint32_t)ring->dma_addr); -+} -+ -+static void bcm4908_enet_dma_uninit(struct bcm4908_enet *enet) -+{ -+ struct bcm4908_enet_dma_ring *rx_ring = &enet->rx_ring; -+ struct bcm4908_enet_dma_ring_slot *slot; -+ struct device *dev = enet->dev; -+ int i; -+ -+ for (i = rx_ring->length - 1; i >= 0; i--) { -+ slot = &rx_ring->slots[i]; -+ if (!slot->skb) -+ continue; -+ dma_unmap_single(dev, slot->dma_addr, slot->len, DMA_FROM_DEVICE); -+ kfree_skb(slot->skb); -+ slot->skb = NULL; -+ } -+} -+ -+static int bcm4908_enet_dma_init(struct bcm4908_enet *enet) -+{ -+ 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 = bcm4908_enet_dma_alloc_rx_buf(enet, i); -+ if (err) { -+ dev_err(dev, "Failed to alloc RX buffer: %d\n", err); -+ bcm4908_enet_dma_uninit(enet); -+ return err; -+ } -+ } -+ -+ bcm4908_enet_dma_ring_init(enet, &enet->tx_ring); -+ bcm4908_enet_dma_ring_init(enet, &enet->rx_ring); -+ -+ return 0; -+} -+ -+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 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 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 bcm4908_enet_dma_rx_ring_disable(struct bcm4908_enet *enet, -+ struct bcm4908_enet_dma_ring *ring) -+{ -+ unsigned long deadline; -+ u32 tmp; -+ -+ enet_maskset(enet, ring->cfg_block + ENET_DMA_CH_CFG, ENET_DMA_CH_CFG_ENABLE, 0); -+ -+ deadline = jiffies + usecs_to_jiffies(2000); -+ do { -+ tmp = enet_read(enet, ring->cfg_block + ENET_DMA_CH_CFG); -+ if (!(tmp & ENET_DMA_CH_CFG_ENABLE)) -+ return; -+ enet_maskset(enet, ring->cfg_block + ENET_DMA_CH_CFG, ENET_DMA_CH_CFG_ENABLE, 0); -+ usleep_range(10, 30); -+ } while (!time_after_eq(jiffies, deadline)); -+ -+ dev_warn(enet->dev, "Timeout waiting for DMA TX stop\n"); -+} -+ -+/*** -+ * Ethernet driver -+ */ -+ -+static void bcm4908_enet_gmac_init(struct bcm4908_enet *enet) -+{ -+ u32 cmd; -+ -+ cmd = enet_umac_read(enet, UMAC_CMD); -+ enet_umac_write(enet, UMAC_CMD, cmd | CMD_SW_RESET); -+ enet_umac_write(enet, UMAC_CMD, cmd & ~CMD_SW_RESET); -+ -+ enet_set(enet, ENET_FLUSH, ENET_FLUSH_RXFIFO_FLUSH | ENET_FLUSH_TXFIFO_FLUSH); -+ enet_maskset(enet, ENET_FLUSH, ENET_FLUSH_RXFIFO_FLUSH | ENET_FLUSH_TXFIFO_FLUSH, 0); -+ -+ enet_set(enet, ENET_MIB_CTRL, ENET_MIB_CTRL_CLR_MIB); -+ enet_maskset(enet, ENET_MIB_CTRL, ENET_MIB_CTRL_CLR_MIB, 0); -+ -+ cmd = enet_umac_read(enet, UMAC_CMD); -+ cmd &= ~(CMD_SPEED_MASK << CMD_SPEED_SHIFT); -+ cmd &= ~CMD_TX_EN; -+ cmd &= ~CMD_RX_EN; -+ cmd |= CMD_SPEED_1000 << CMD_SPEED_SHIFT; -+ enet_umac_write(enet, UMAC_CMD, cmd); -+ -+ enet_maskset(enet, ENET_GMAC_STATUS, -+ ENET_GMAC_STATUS_ETH_SPEED_MASK | -+ ENET_GMAC_STATUS_HD | -+ ENET_GMAC_STATUS_AUTO_CFG_EN | -+ ENET_GMAC_STATUS_LINK_UP, -+ ENET_GMAC_STATUS_ETH_SPEED_1000 | -+ ENET_GMAC_STATUS_AUTO_CFG_EN | -+ ENET_GMAC_STATUS_LINK_UP); -+} -+ -+static irqreturn_t bcm4908_enet_irq_handler(int irq, void *dev_id) -+{ -+ struct bcm4908_enet *enet = dev_id; -+ -+ bcm4908_enet_intrs_off(enet); -+ bcm4908_enet_intrs_ack(enet); -+ -+ napi_schedule(&enet->napi); -+ -+ return IRQ_HANDLED; -+} -+ -+static int bcm4908_enet_open(struct net_device *netdev) -+{ -+ struct bcm4908_enet *enet = netdev_priv(netdev); -+ struct device *dev = enet->dev; -+ int err; -+ -+ 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; -+ } -+ -+ 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); -+ bcm4908_enet_dma_rx_ring_enable(enet, &enet->rx_ring); -+ -+ napi_enable(&enet->napi); -+ netif_carrier_on(netdev); -+ netif_start_queue(netdev); -+ -+ bcm4908_enet_intrs_ack(enet); -+ bcm4908_enet_intrs_on(enet); -+ -+ return 0; -+} -+ -+static int bcm4908_enet_stop(struct net_device *netdev) -+{ -+ struct bcm4908_enet *enet = netdev_priv(netdev); -+ -+ netif_stop_queue(netdev); -+ netif_carrier_off(netdev); -+ napi_disable(&enet->napi); -+ -+ bcm4908_enet_dma_rx_ring_disable(enet, &enet->rx_ring); -+ bcm4908_enet_dma_tx_ring_disable(enet, &enet->tx_ring); -+ -+ bcm4908_enet_dma_uninit(enet); -+ -+ free_irq(enet->netdev->irq, enet); -+ -+ return 0; -+} -+ -+static int bcm4908_enet_start_xmit(struct sk_buff *skb, struct net_device *netdev) -+{ -+ 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 bcm4908_enet_dma_ring_bd *buf_desc; -+ int free_buf_descs; -+ u32 tmp; -+ -+ /* 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) -+ break; -+ slot = &ring->slots[ring->read_idx]; -+ -+ dma_unmap_single(dev, slot->dma_addr, slot->len, DMA_TO_DEVICE); -+ dev_kfree_skb(slot->skb); -+ if (++ring->read_idx == ring->length) -+ ring->read_idx = 0; -+ } -+ -+ /* Don't use the last empty buf descriptor */ -+ if (ring->read_idx <= ring->write_idx) -+ free_buf_descs = ring->read_idx - ring->write_idx + ring->length; -+ else -+ free_buf_descs = ring->read_idx - ring->write_idx; -+ if (free_buf_descs < 2) -+ return NETDEV_TX_BUSY; -+ -+ /* Hardware removes OWN bit after sending data */ -+ buf_desc = &ring->buf_desc[ring->write_idx]; -+ if (unlikely(le32_to_cpu(buf_desc->ctl) & DMA_CTL_STATUS_OWN)) { -+ netif_stop_queue(netdev); -+ return NETDEV_TX_BUSY; -+ } -+ -+ slot = &ring->slots[ring->write_idx]; -+ slot->skb = skb; -+ slot->len = skb->len; -+ slot->dma_addr = dma_map_single(dev, skb->data, skb->len, DMA_TO_DEVICE); -+ if (unlikely(dma_mapping_error(dev, slot->dma_addr))) -+ return NETDEV_TX_BUSY; -+ -+ tmp = skb->len << DMA_CTL_LEN_DESC_BUFLENGTH_SHIFT; -+ tmp |= DMA_CTL_STATUS_OWN; -+ tmp |= DMA_CTL_STATUS_SOP; -+ tmp |= DMA_CTL_STATUS_EOP; -+ tmp |= DMA_CTL_STATUS_APPEND_CRC; -+ if (ring->write_idx + 1 == ring->length - 1) -+ tmp |= DMA_CTL_STATUS_WRAP; -+ -+ 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); -+ -+ if (++ring->write_idx == ring->length - 1) -+ ring->write_idx = 0; -+ enet->netdev->stats.tx_bytes += skb->len; -+ enet->netdev->stats.tx_packets++; -+ -+ return NETDEV_TX_OK; -+} -+ -+static int bcm4908_enet_poll(struct napi_struct *napi, int weight) -+{ -+ struct bcm4908_enet *enet = container_of(napi, struct bcm4908_enet, napi); -+ struct device *dev = enet->dev; -+ int handled = 0; -+ -+ while (handled < weight) { -+ struct bcm4908_enet_dma_ring_bd *buf_desc; -+ struct bcm4908_enet_dma_ring_slot slot; -+ u32 ctl; -+ int len; -+ int err; -+ -+ buf_desc = &enet->rx_ring.buf_desc[enet->rx_ring.read_idx]; -+ ctl = le32_to_cpu(buf_desc->ctl); -+ if (ctl & DMA_CTL_STATUS_OWN) -+ break; -+ -+ slot = enet->rx_ring.slots[enet->rx_ring.read_idx]; -+ -+ /* Provide new buffer before unpinning the old one */ -+ err = bcm4908_enet_dma_alloc_rx_buf(enet, enet->rx_ring.read_idx); -+ if (err) -+ break; -+ -+ if (++enet->rx_ring.read_idx == enet->rx_ring.length) -+ enet->rx_ring.read_idx = 0; -+ -+ len = (ctl & DMA_CTL_LEN_DESC_BUFLENGTH) >> DMA_CTL_LEN_DESC_BUFLENGTH_SHIFT; -+ -+ if (len < ENET_MTU_MIN || -+ (ctl & (DMA_CTL_STATUS_SOP | DMA_CTL_STATUS_EOP)) != (DMA_CTL_STATUS_SOP | DMA_CTL_STATUS_EOP)) { -+ enet->netdev->stats.rx_dropped++; -+ break; -+ } -+ -+ dma_unmap_single(dev, slot.dma_addr, slot.len, DMA_FROM_DEVICE); -+ -+ skb_put(slot.skb, len - 4 + 2); -+ slot.skb->protocol = eth_type_trans(slot.skb, enet->netdev); -+ netif_receive_skb(slot.skb); -+ -+ enet->netdev->stats.rx_packets++; -+ enet->netdev->stats.rx_bytes += len; -+ } -+ -+ if (handled < weight) { -+ napi_complete_done(napi, handled); -+ bcm4908_enet_intrs_on(enet); -+ } -+ -+ return handled; -+} -+ -+static const struct net_device_ops bcm96xx_netdev_ops = { -+ .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 bcm4908_enet_probe(struct platform_device *pdev) -+{ -+ struct device *dev = &pdev->dev; -+ struct net_device *netdev; -+ struct bcm4908_enet *enet; -+ int err; -+ -+ netdev = devm_alloc_etherdev(dev, sizeof(*enet)); -+ if (!netdev) -+ return -ENOMEM; -+ -+ enet = netdev_priv(netdev); -+ enet->dev = dev; -+ enet->netdev = netdev; -+ -+ enet->base = devm_platform_ioremap_resource(pdev, 0); -+ if (IS_ERR(enet->base)) { -+ dev_err(dev, "Failed to map registers: %ld\n", PTR_ERR(enet->base)); -+ return PTR_ERR(enet->base); -+ } -+ -+ netdev->irq = platform_get_irq_byname(pdev, "rx"); -+ if (netdev->irq < 0) -+ return netdev->irq; -+ -+ dma_set_coherent_mask(dev, DMA_BIT_MASK(32)); -+ -+ err = bcm4908_enet_dma_alloc(enet); -+ if (err) -+ return err; -+ -+ SET_NETDEV_DEV(netdev, &pdev->dev); -+ eth_hw_addr_random(netdev); -+ netdev->netdev_ops = &bcm96xx_netdev_ops; -+ netdev->min_mtu = ETH_ZLEN; -+ netdev->mtu = ENET_MTU_MAX; -+ netdev->max_mtu = ENET_MTU_MAX; -+ netif_napi_add(netdev, &enet->napi, bcm4908_enet_poll, 64); -+ -+ err = register_netdev(netdev); -+ if (err) { -+ bcm4908_enet_dma_free(enet); -+ return err; -+ } -+ -+ platform_set_drvdata(pdev, enet); -+ -+ return 0; -+} -+ -+static int bcm4908_enet_remove(struct platform_device *pdev) -+{ -+ struct bcm4908_enet *enet = platform_get_drvdata(pdev); -+ -+ unregister_netdev(enet->netdev); -+ netif_napi_del(&enet->napi); -+ bcm4908_enet_dma_free(enet); -+ -+ return 0; -+} -+ -+static const struct of_device_id bcm4908_enet_of_match[] = { -+ { .compatible = "brcm,bcm4908-enet"}, -+ {}, -+}; -+ -+static struct platform_driver bcm4908_enet_driver = { -+ .driver = { -+ .name = "bcm4908_enet", -+ .of_match_table = bcm4908_enet_of_match, -+ }, -+ .probe = bcm4908_enet_probe, -+ .remove = bcm4908_enet_remove, -+}; -+module_platform_driver(bcm4908_enet_driver); -+ -+MODULE_LICENSE("GPL v2"); -+MODULE_DEVICE_TABLE(of, bcm4908_enet_of_match); ---- a/drivers/net/ethernet/broadcom/bcm4908enet.h -+++ /dev/null -@@ -1,96 +0,0 @@ --/* SPDX-License-Identifier: GPL-2.0-only */ --#ifndef __BCM4908ENET_H --#define __BCM4908ENET_H -- --#define ENET_CONTROL 0x000 --#define ENET_MIB_CTRL 0x004 --#define ENET_MIB_CTRL_CLR_MIB 0x00000001 --#define ENET_RX_ERR_MASK 0x008 --#define ENET_MIB_MAX_PKT_SIZE 0x00C --#define ENET_MIB_MAX_PKT_SIZE_VAL 0x00003fff --#define ENET_DIAG_OUT 0x01c --#define ENET_ENABLE_DROP_PKT 0x020 --#define ENET_IRQ_ENABLE 0x024 --#define ENET_IRQ_ENABLE_OVFL 0x00000001 --#define ENET_GMAC_STATUS 0x028 --#define ENET_GMAC_STATUS_ETH_SPEED_MASK 0x00000003 --#define ENET_GMAC_STATUS_ETH_SPEED_10 0x00000000 --#define ENET_GMAC_STATUS_ETH_SPEED_100 0x00000001 --#define ENET_GMAC_STATUS_ETH_SPEED_1000 0x00000002 --#define ENET_GMAC_STATUS_HD 0x00000004 --#define ENET_GMAC_STATUS_AUTO_CFG_EN 0x00000008 --#define ENET_GMAC_STATUS_LINK_UP 0x00000010 --#define ENET_IRQ_STATUS 0x02c --#define ENET_IRQ_STATUS_OVFL 0x00000001 --#define ENET_OVERFLOW_COUNTER 0x030 --#define ENET_FLUSH 0x034 --#define ENET_FLUSH_RXFIFO_FLUSH 0x00000001 --#define ENET_FLUSH_TXFIFO_FLUSH 0x00000002 --#define ENET_RSV_SELECT 0x038 --#define ENET_BP_FORCE 0x03c --#define ENET_BP_FORCE_FORCE 0x00000001 --#define ENET_DMA_RX_OK_TO_SEND_COUNT 0x040 --#define ENET_DMA_RX_OK_TO_SEND_COUNT_VAL 0x0000000f --#define ENET_TX_CRC_CTRL 0x044 --#define ENET_MIB 0x200 --#define ENET_UNIMAC 0x400 --#define ENET_DMA 0x800 --#define ENET_DMA_CONTROLLER_CFG 0x800 --#define ENET_DMA_CTRL_CFG_MASTER_EN 0x00000001 --#define ENET_DMA_CTRL_CFG_FLOWC_CH1_EN 0x00000002 --#define ENET_DMA_CTRL_CFG_FLOWC_CH3_EN 0x00000004 --#define ENET_DMA_FLOWCTL_CH1_THRESH_LO 0x804 --#define ENET_DMA_FLOWCTL_CH1_THRESH_HI 0x808 --#define ENET_DMA_FLOWCTL_CH1_ALLOC 0x80c --#define ENET_DMA_FLOWCTL_CH1_ALLOC_FORCE 0x80000000 --#define ENET_DMA_FLOWCTL_CH3_THRESH_LO 0x810 --#define ENET_DMA_FLOWCTL_CH3_THRESH_HI 0x814 --#define ENET_DMA_FLOWCTL_CH3_ALLOC 0x818 --#define ENET_DMA_FLOWCTL_CH5_THRESH_LO 0x81C --#define ENET_DMA_FLOWCTL_CH5_THRESH_HI 0x820 --#define ENET_DMA_FLOWCTL_CH5_ALLOC 0x824 --#define ENET_DMA_FLOWCTL_CH7_THRESH_LO 0x828 --#define ENET_DMA_FLOWCTL_CH7_THRESH_HI 0x82C --#define ENET_DMA_FLOWCTL_CH7_ALLOC 0x830 --#define ENET_DMA_CTRL_CHANNEL_RESET 0x834 --#define ENET_DMA_CTRL_CHANNEL_DEBUG 0x838 --#define ENET_DMA_CTRL_GLOBAL_INTERRUPT_STATUS 0x840 --#define ENET_DMA_CTRL_GLOBAL_INTERRUPT_MASK 0x844 --#define ENET_DMA_CH0_CFG 0xa00 /* RX */ --#define ENET_DMA_CH1_CFG 0xa10 /* TX */ --#define ENET_DMA_CH0_STATE_RAM 0xc00 /* RX */ --#define ENET_DMA_CH1_STATE_RAM 0xc10 /* TX */ -- --#define ENET_DMA_CH_CFG 0x00 /* assorted configuration */ --#define ENET_DMA_CH_CFG_ENABLE 0x00000001 /* set to enable channel */ --#define ENET_DMA_CH_CFG_PKT_HALT 0x00000002 /* idle after an EOP flag is detected */ --#define ENET_DMA_CH_CFG_BURST_HALT 0x00000004 /* idle after finish current memory burst */ --#define ENET_DMA_CH_CFG_INT_STAT 0x04 /* interrupts control and status */ --#define ENET_DMA_CH_CFG_INT_MASK 0x08 /* interrupts mask */ --#define ENET_DMA_CH_CFG_INT_BUFF_DONE 0x00000001 /* buffer done */ --#define ENET_DMA_CH_CFG_INT_DONE 0x00000002 /* packet xfer complete */ --#define ENET_DMA_CH_CFG_INT_NO_DESC 0x00000004 /* no valid descriptors */ --#define ENET_DMA_CH_CFG_INT_RX_ERROR 0x00000008 /* rxdma detect client protocol error */ --#define ENET_DMA_CH_CFG_MAX_BURST 0x0c /* max burst length permitted */ --#define ENET_DMA_CH_CFG_MAX_BURST_DESCSIZE_SEL 0x00040000 /* DMA Descriptor Size Selection */ --#define ENET_DMA_CH_CFG_SIZE 0x10 -- --#define ENET_DMA_CH_STATE_RAM_BASE_DESC_PTR 0x00 /* descriptor ring start address */ --#define ENET_DMA_CH_STATE_RAM_STATE_DATA 0x04 /* state/bytes done/ring offset */ --#define ENET_DMA_CH_STATE_RAM_DESC_LEN_STATUS 0x08 /* buffer descriptor status and len */ --#define ENET_DMA_CH_STATE_RAM_DESC_BASE_BUFPTR 0x0c /* buffer descrpitor current processing */ --#define ENET_DMA_CH_STATE_RAM_SIZE 0x10 -- --#define DMA_CTL_STATUS_APPEND_CRC 0x00000100 --#define DMA_CTL_STATUS_APPEND_BRCM_TAG 0x00000200 --#define DMA_CTL_STATUS_PRIO 0x00000C00 /* Prio for Tx */ --#define DMA_CTL_STATUS_WRAP 0x00001000 /* */ --#define DMA_CTL_STATUS_SOP 0x00002000 /* first buffer in packet */ --#define DMA_CTL_STATUS_EOP 0x00004000 /* last buffer in packet */ --#define DMA_CTL_STATUS_OWN 0x00008000 /* cleared by DMA, set by SW */ --#define DMA_CTL_LEN_DESC_BUFLENGTH 0x0fff0000 --#define DMA_CTL_LEN_DESC_BUFLENGTH_SHIFT 16 --#define DMA_CTL_LEN_DESC_MULTICAST 0x40000000 --#define DMA_CTL_LEN_DESC_USEFPM 0x80000000 -- --#endif ---- /dev/null -+++ b/drivers/net/ethernet/broadcom/bcm4908_enet.h -@@ -0,0 +1,96 @@ -+/* SPDX-License-Identifier: GPL-2.0-only */ -+#ifndef __BCM4908_ENET_H -+#define __BCM4908_ENET_H -+ -+#define ENET_CONTROL 0x000 -+#define ENET_MIB_CTRL 0x004 -+#define ENET_MIB_CTRL_CLR_MIB 0x00000001 -+#define ENET_RX_ERR_MASK 0x008 -+#define ENET_MIB_MAX_PKT_SIZE 0x00C -+#define ENET_MIB_MAX_PKT_SIZE_VAL 0x00003fff -+#define ENET_DIAG_OUT 0x01c -+#define ENET_ENABLE_DROP_PKT 0x020 -+#define ENET_IRQ_ENABLE 0x024 -+#define ENET_IRQ_ENABLE_OVFL 0x00000001 -+#define ENET_GMAC_STATUS 0x028 -+#define ENET_GMAC_STATUS_ETH_SPEED_MASK 0x00000003 -+#define ENET_GMAC_STATUS_ETH_SPEED_10 0x00000000 -+#define ENET_GMAC_STATUS_ETH_SPEED_100 0x00000001 -+#define ENET_GMAC_STATUS_ETH_SPEED_1000 0x00000002 -+#define ENET_GMAC_STATUS_HD 0x00000004 -+#define ENET_GMAC_STATUS_AUTO_CFG_EN 0x00000008 -+#define ENET_GMAC_STATUS_LINK_UP 0x00000010 -+#define ENET_IRQ_STATUS 0x02c -+#define ENET_IRQ_STATUS_OVFL 0x00000001 -+#define ENET_OVERFLOW_COUNTER 0x030 -+#define ENET_FLUSH 0x034 -+#define ENET_FLUSH_RXFIFO_FLUSH 0x00000001 -+#define ENET_FLUSH_TXFIFO_FLUSH 0x00000002 -+#define ENET_RSV_SELECT 0x038 -+#define ENET_BP_FORCE 0x03c -+#define ENET_BP_FORCE_FORCE 0x00000001 -+#define ENET_DMA_RX_OK_TO_SEND_COUNT 0x040 -+#define ENET_DMA_RX_OK_TO_SEND_COUNT_VAL 0x0000000f -+#define ENET_TX_CRC_CTRL 0x044 -+#define ENET_MIB 0x200 -+#define ENET_UNIMAC 0x400 -+#define ENET_DMA 0x800 -+#define ENET_DMA_CONTROLLER_CFG 0x800 -+#define ENET_DMA_CTRL_CFG_MASTER_EN 0x00000001 -+#define ENET_DMA_CTRL_CFG_FLOWC_CH1_EN 0x00000002 -+#define ENET_DMA_CTRL_CFG_FLOWC_CH3_EN 0x00000004 -+#define ENET_DMA_FLOWCTL_CH1_THRESH_LO 0x804 -+#define ENET_DMA_FLOWCTL_CH1_THRESH_HI 0x808 -+#define ENET_DMA_FLOWCTL_CH1_ALLOC 0x80c -+#define ENET_DMA_FLOWCTL_CH1_ALLOC_FORCE 0x80000000 -+#define ENET_DMA_FLOWCTL_CH3_THRESH_LO 0x810 -+#define ENET_DMA_FLOWCTL_CH3_THRESH_HI 0x814 -+#define ENET_DMA_FLOWCTL_CH3_ALLOC 0x818 -+#define ENET_DMA_FLOWCTL_CH5_THRESH_LO 0x81C -+#define ENET_DMA_FLOWCTL_CH5_THRESH_HI 0x820 -+#define ENET_DMA_FLOWCTL_CH5_ALLOC 0x824 -+#define ENET_DMA_FLOWCTL_CH7_THRESH_LO 0x828 -+#define ENET_DMA_FLOWCTL_CH7_THRESH_HI 0x82C -+#define ENET_DMA_FLOWCTL_CH7_ALLOC 0x830 -+#define ENET_DMA_CTRL_CHANNEL_RESET 0x834 -+#define ENET_DMA_CTRL_CHANNEL_DEBUG 0x838 -+#define ENET_DMA_CTRL_GLOBAL_INTERRUPT_STATUS 0x840 -+#define ENET_DMA_CTRL_GLOBAL_INTERRUPT_MASK 0x844 -+#define ENET_DMA_CH0_CFG 0xa00 /* RX */ -+#define ENET_DMA_CH1_CFG 0xa10 /* TX */ -+#define ENET_DMA_CH0_STATE_RAM 0xc00 /* RX */ -+#define ENET_DMA_CH1_STATE_RAM 0xc10 /* TX */ -+ -+#define ENET_DMA_CH_CFG 0x00 /* assorted configuration */ -+#define ENET_DMA_CH_CFG_ENABLE 0x00000001 /* set to enable channel */ -+#define ENET_DMA_CH_CFG_PKT_HALT 0x00000002 /* idle after an EOP flag is detected */ -+#define ENET_DMA_CH_CFG_BURST_HALT 0x00000004 /* idle after finish current memory burst */ -+#define ENET_DMA_CH_CFG_INT_STAT 0x04 /* interrupts control and status */ -+#define ENET_DMA_CH_CFG_INT_MASK 0x08 /* interrupts mask */ -+#define ENET_DMA_CH_CFG_INT_BUFF_DONE 0x00000001 /* buffer done */ -+#define ENET_DMA_CH_CFG_INT_DONE 0x00000002 /* packet xfer complete */ -+#define ENET_DMA_CH_CFG_INT_NO_DESC 0x00000004 /* no valid descriptors */ -+#define ENET_DMA_CH_CFG_INT_RX_ERROR 0x00000008 /* rxdma detect client protocol error */ -+#define ENET_DMA_CH_CFG_MAX_BURST 0x0c /* max burst length permitted */ -+#define ENET_DMA_CH_CFG_MAX_BURST_DESCSIZE_SEL 0x00040000 /* DMA Descriptor Size Selection */ -+#define ENET_DMA_CH_CFG_SIZE 0x10 -+ -+#define ENET_DMA_CH_STATE_RAM_BASE_DESC_PTR 0x00 /* descriptor ring start address */ -+#define ENET_DMA_CH_STATE_RAM_STATE_DATA 0x04 /* state/bytes done/ring offset */ -+#define ENET_DMA_CH_STATE_RAM_DESC_LEN_STATUS 0x08 /* buffer descriptor status and len */ -+#define ENET_DMA_CH_STATE_RAM_DESC_BASE_BUFPTR 0x0c /* buffer descrpitor current processing */ -+#define ENET_DMA_CH_STATE_RAM_SIZE 0x10 -+ -+#define DMA_CTL_STATUS_APPEND_CRC 0x00000100 -+#define DMA_CTL_STATUS_APPEND_BRCM_TAG 0x00000200 -+#define DMA_CTL_STATUS_PRIO 0x00000C00 /* Prio for Tx */ -+#define DMA_CTL_STATUS_WRAP 0x00001000 /* */ -+#define DMA_CTL_STATUS_SOP 0x00002000 /* first buffer in packet */ -+#define DMA_CTL_STATUS_EOP 0x00004000 /* last buffer in packet */ -+#define DMA_CTL_STATUS_OWN 0x00008000 /* cleared by DMA, set by SW */ -+#define DMA_CTL_LEN_DESC_BUFLENGTH 0x0fff0000 -+#define DMA_CTL_LEN_DESC_BUFLENGTH_SHIFT 16 -+#define DMA_CTL_LEN_DESC_MULTICAST 0x40000000 -+#define DMA_CTL_LEN_DESC_USEFPM 0x80000000 -+ -+#endif diff --git a/target/linux/bcm4908/patches-5.4/073-v5.12-0004-net-broadcom-bcm4908_enet-drop-unneeded-memset.patch b/target/linux/bcm4908/patches-5.4/073-v5.12-0004-net-broadcom-bcm4908_enet-drop-unneeded-memset.patch deleted file mode 100644 index 561f045b75..0000000000 --- a/target/linux/bcm4908/patches-5.4/073-v5.12-0004-net-broadcom-bcm4908_enet-drop-unneeded-memset.patch +++ /dev/null @@ -1,30 +0,0 @@ -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; - diff --git a/target/linux/bcm4908/patches-5.4/073-v5.12-0005-net-broadcom-bcm4908_enet-drop-inline-from-C-functio.patch b/target/linux/bcm4908/patches-5.4/073-v5.12-0005-net-broadcom-bcm4908_enet-drop-inline-from-C-functio.patch deleted file mode 100644 index a8c188f30d..0000000000 --- a/target/linux/bcm4908/patches-5.4/073-v5.12-0005-net-broadcom-bcm4908_enet-drop-inline-from-C-functio.patch +++ /dev/null @@ -1,75 +0,0 @@ -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); - } diff --git a/target/linux/bcm4908/patches-5.4/073-v5.12-0006-net-broadcom-bcm4908_enet-fix-minor-typos.patch b/target/linux/bcm4908/patches-5.4/073-v5.12-0006-net-broadcom-bcm4908_enet-fix-minor-typos.patch deleted file mode 100644 index 1aacb1c8cf..0000000000 --- a/target/linux/bcm4908/patches-5.4/073-v5.12-0006-net-broadcom-bcm4908_enet-fix-minor-typos.patch +++ /dev/null @@ -1,60 +0,0 @@ -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; diff --git a/target/linux/bcm4908/patches-5.4/073-v5.12-0007-net-broadcom-bcm4908_enet-fix-received-skb-length.patch b/target/linux/bcm4908/patches-5.4/073-v5.12-0007-net-broadcom-bcm4908_enet-fix-received-skb-length.patch deleted file mode 100644 index 1b51979d71..0000000000 --- a/target/linux/bcm4908/patches-5.4/073-v5.12-0007-net-broadcom-bcm4908_enet-fix-received-skb-length.patch +++ /dev/null @@ -1,28 +0,0 @@ -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); - diff --git a/target/linux/bcm4908/patches-5.4/073-v5.12-0008-net-broadcom-bcm4908_enet-fix-endianness-in-xmit-cod.patch b/target/linux/bcm4908/patches-5.4/073-v5.12-0008-net-broadcom-bcm4908_enet-fix-endianness-in-xmit-cod.patch deleted file mode 100644 index eda0bf482e..0000000000 --- a/target/linux/bcm4908/patches-5.4/073-v5.12-0008-net-broadcom-bcm4908_enet-fix-endianness-in-xmit-cod.patch +++ /dev/null @@ -1,28 +0,0 @@ -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]; - diff --git a/target/linux/bcm4908/patches-5.4/073-v5.12-0009-net-broadcom-bcm4908_enet-set-MTU-on-open-on-request.patch b/target/linux/bcm4908/patches-5.4/073-v5.12-0009-net-broadcom-bcm4908_enet-set-MTU-on-open-on-request.patch deleted file mode 100644 index 0201bfeda3..0000000000 --- a/target/linux/bcm4908/patches-5.4/073-v5.12-0009-net-broadcom-bcm4908_enet-set-MTU-on-open-on-request.patch +++ /dev/null @@ -1,119 +0,0 @@ -From 14b3b46a67f78ade99eafcbf320105615e948569 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Fri, 12 Feb 2021 16:21:35 +0100 -Subject: [PATCH] net: broadcom: bcm4908_enet: set MTU on open & on request -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Hardware comes up with default max frame size set to 1518. When using it -with switch it results in actual Ethernet MTU 1492: -1518 - 14 (Ethernet header) - 4 (Broadcom's tag) - 4 (802.1q) - 4 (FCS) - -Above means hardware in its default state can't handle standard Ethernet -traffic (MTU 1500). - -Define maximum possible Ethernet overhead and always set MAC max frame -length accordingly. This change fixes handling Ethernet frames of length -1506 - 1514. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Signed-off-by: David S. Miller <davem@davemloft.net> ---- - drivers/net/ethernet/broadcom/bcm4908_enet.c | 31 ++++++++++++++++---- - 1 file changed, 25 insertions(+), 6 deletions(-) - ---- a/drivers/net/ethernet/broadcom/bcm4908_enet.c -+++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c -@@ -5,6 +5,7 @@ - - #include <linux/delay.h> - #include <linux/etherdevice.h> -+#include <linux/if_vlan.h> - #include <linux/interrupt.h> - #include <linux/module.h> - #include <linux/of.h> -@@ -29,9 +30,10 @@ - ENET_DMA_CH_CFG_INT_BUFF_DONE) - #define ENET_DMA_MAX_BURST_LEN 8 /* in 64 bit words */ - --#define ENET_MTU_MIN 60 --#define ENET_MTU_MAX 1500 /* Is it possible to support 2044? */ --#define ENET_MTU_MAX_EXTRA_SIZE 32 /* L2 */ -+#define ENET_MTU_MAX ETH_DATA_LEN /* Is it possible to support 2044? */ -+#define BRCM_MAX_TAG_LEN 6 -+#define ENET_MAX_ETH_OVERHEAD (ETH_HLEN + BRCM_MAX_TAG_LEN + VLAN_HLEN + \ -+ ETH_FCS_LEN + 4) /* 32 */ - - struct bcm4908_enet_dma_ring_bd { - __le32 ctl; -@@ -135,6 +137,11 @@ static void bcm4908_enet_intrs_ack(struc - enet_write(enet, ENET_DMA_CH_RX_CFG + ENET_DMA_CH_CFG_INT_STAT, ENET_DMA_INT_DEFAULTS); - } - -+static void bcm4908_enet_set_mtu(struct bcm4908_enet *enet, int mtu) -+{ -+ enet_umac_write(enet, UMAC_MAX_FRAME_LEN, mtu + ENET_MAX_ETH_OVERHEAD); -+} -+ - /*** - * DMA - */ -@@ -246,7 +253,7 @@ static int bcm4908_enet_dma_alloc_rx_buf - u32 tmp; - int err; - -- slot->len = ENET_MTU_MAX + ENET_MTU_MAX_EXTRA_SIZE; -+ slot->len = ENET_MTU_MAX + ENET_MAX_ETH_OVERHEAD; - - slot->skb = netdev_alloc_skb(enet->netdev, slot->len); - if (!slot->skb) -@@ -374,6 +381,8 @@ static void bcm4908_enet_gmac_init(struc - { - u32 cmd; - -+ bcm4908_enet_set_mtu(enet, enet->netdev->mtu); -+ - cmd = enet_umac_read(enet, UMAC_CMD); - enet_umac_write(enet, UMAC_CMD, cmd | CMD_SW_RESET); - enet_umac_write(enet, UMAC_CMD, cmd & ~CMD_SW_RESET); -@@ -559,7 +568,7 @@ static int bcm4908_enet_poll(struct napi - - len = (ctl & DMA_CTL_LEN_DESC_BUFLENGTH) >> DMA_CTL_LEN_DESC_BUFLENGTH_SHIFT; - -- if (len < ENET_MTU_MIN || -+ if (len < ETH_ZLEN || - (ctl & (DMA_CTL_STATUS_SOP | DMA_CTL_STATUS_EOP)) != (DMA_CTL_STATUS_SOP | DMA_CTL_STATUS_EOP)) { - enet->netdev->stats.rx_dropped++; - break; -@@ -583,11 +592,21 @@ static int bcm4908_enet_poll(struct napi - return handled; - } - -+static int bcm4908_enet_change_mtu(struct net_device *netdev, int new_mtu) -+{ -+ struct bcm4908_enet *enet = netdev_priv(netdev); -+ -+ bcm4908_enet_set_mtu(enet, new_mtu); -+ -+ return 0; -+} -+ - 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, - .ndo_set_mac_address = eth_mac_addr, -+ .ndo_change_mtu = bcm4908_enet_change_mtu, - }; - - static int bcm4908_enet_probe(struct platform_device *pdev) -@@ -625,7 +644,7 @@ static int bcm4908_enet_probe(struct pla - eth_hw_addr_random(netdev); - netdev->netdev_ops = &bcm4908_enet_netdev_ops; - netdev->min_mtu = ETH_ZLEN; -- netdev->mtu = ENET_MTU_MAX; -+ netdev->mtu = ETH_DATA_LEN; - netdev->max_mtu = ENET_MTU_MAX; - netif_napi_add(netdev, &enet->napi, bcm4908_enet_poll, 64); - diff --git a/target/linux/bcm4908/patches-5.4/073-v5.12-0010-net-broadcom-bcm4908_enet-fix-RX-path-possible-mem-l.patch b/target/linux/bcm4908/patches-5.4/073-v5.12-0010-net-broadcom-bcm4908_enet-fix-RX-path-possible-mem-l.patch deleted file mode 100644 index 8a24324122..0000000000 --- a/target/linux/bcm4908/patches-5.4/073-v5.12-0010-net-broadcom-bcm4908_enet-fix-RX-path-possible-mem-l.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 4dc7f09b8becfa35a55430a49d95acf19f996e6b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Wed, 24 Feb 2021 16:18:41 +0100 -Subject: [PATCH] net: broadcom: bcm4908_enet: fix RX path possible mem leak -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -After filling RX ring slot with new skb it's required to free old skb. -Immediately on error or later in the net subsystem. - -Fixes: 4feffeadbcb2 ("net: broadcom: bcm4908enet: add BCM4908 controller driver") -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Acked-by: Florian Fainelli <f.fainelli@gmail.com> -Link: https://lore.kernel.org/r/20210224151842.2419-1-zajec5@gmail.com -Signed-off-by: Jakub Kicinski <kuba@kernel.org> ---- - drivers/net/ethernet/broadcom/bcm4908_enet.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/net/ethernet/broadcom/bcm4908_enet.c -+++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c -@@ -570,6 +570,7 @@ static int bcm4908_enet_poll(struct napi - - if (len < ETH_ZLEN || - (ctl & (DMA_CTL_STATUS_SOP | DMA_CTL_STATUS_EOP)) != (DMA_CTL_STATUS_SOP | DMA_CTL_STATUS_EOP)) { -+ kfree_skb(slot.skb); - enet->netdev->stats.rx_dropped++; - break; - } diff --git a/target/linux/bcm4908/patches-5.4/073-v5.12-0011-net-broadcom-bcm4908_enet-fix-NAPI-poll-returned-val.patch b/target/linux/bcm4908/patches-5.4/073-v5.12-0011-net-broadcom-bcm4908_enet-fix-NAPI-poll-returned-val.patch deleted file mode 100644 index d4cf84e4b6..0000000000 --- a/target/linux/bcm4908/patches-5.4/073-v5.12-0011-net-broadcom-bcm4908_enet-fix-NAPI-poll-returned-val.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 4d9274cee40b6a20dd6148c6c81c6733c2678cbc Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Wed, 24 Feb 2021 16:18:42 +0100 -Subject: [PATCH] net: broadcom: bcm4908_enet: fix NAPI poll returned value -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Missing increment was resulting in poll function always returning 0 -instead of amount of processed packets. - -Fixes: 4feffeadbcb2 ("net: broadcom: bcm4908enet: add BCM4908 controller driver") -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Acked-by: Florian Fainelli <f.fainelli@gmail.com> -Link: https://lore.kernel.org/r/20210224151842.2419-2-zajec5@gmail.com -Signed-off-by: Jakub Kicinski <kuba@kernel.org> ---- - drivers/net/ethernet/broadcom/bcm4908_enet.c | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/drivers/net/ethernet/broadcom/bcm4908_enet.c -+++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c -@@ -583,6 +583,8 @@ static int bcm4908_enet_poll(struct napi - - enet->netdev->stats.rx_packets++; - enet->netdev->stats.rx_bytes += len; -+ -+ handled++; - } - - if (handled < weight) { diff --git a/target/linux/bcm4908/patches-5.4/073-v5.12-0012-net-broadcom-bcm4908_enet-enable-RX-after-processing.patch b/target/linux/bcm4908/patches-5.4/073-v5.12-0012-net-broadcom-bcm4908_enet-enable-RX-after-processing.patch deleted file mode 100644 index ad1bebf3ec..0000000000 --- a/target/linux/bcm4908/patches-5.4/073-v5.12-0012-net-broadcom-bcm4908_enet-enable-RX-after-processing.patch +++ /dev/null @@ -1,34 +0,0 @@ -From d313d16bbaea0f11a2e98f04a6c678b43c208915 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Fri, 26 Feb 2021 14:20:38 +0100 -Subject: [PATCH] net: broadcom: bcm4908_enet: enable RX after processing - packets -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -When receiving a lot of packets hardware may run out of free -descriptiors and stop RX ring. Enable it every time after handling -received packets. - -Fixes: 4feffeadbcb2 ("net: broadcom: bcm4908enet: add BCM4908 controller driver") -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Acked-by: Florian Fainelli <f.fainelli@gmail.com> -Link: https://lore.kernel.org/r/20210226132038.29849-1-zajec5@gmail.com -Signed-off-by: Jakub Kicinski <kuba@kernel.org> ---- - drivers/net/ethernet/broadcom/bcm4908_enet.c | 3 +++ - 1 file changed, 3 insertions(+) - ---- a/drivers/net/ethernet/broadcom/bcm4908_enet.c -+++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c -@@ -592,6 +592,9 @@ static int bcm4908_enet_poll(struct napi - bcm4908_enet_intrs_on(enet); - } - -+ /* Hardware could disable ring if it run out of descriptors */ -+ bcm4908_enet_dma_rx_ring_enable(enet, &enet->rx_ring); -+ - return handled; - } - diff --git a/target/linux/bcm4908/patches-5.4/073-v5.12-0013-net-broadcom-BCM4908_ENET-should-not-default-to-y-un.patch b/target/linux/bcm4908/patches-5.4/073-v5.12-0013-net-broadcom-BCM4908_ENET-should-not-default-to-y-un.patch deleted file mode 100644 index 43e5ee01bf..0000000000 --- a/target/linux/bcm4908/patches-5.4/073-v5.12-0013-net-broadcom-BCM4908_ENET-should-not-default-to-y-un.patch +++ /dev/null @@ -1,33 +0,0 @@ -From a3bc483216650a7232559bf0a1debfbabff3e12c Mon Sep 17 00:00:00 2001 -From: Geert Uytterhoeven <geert+renesas@glider.be> -Date: Tue, 16 Mar 2021 15:03:41 +0100 -Subject: [PATCH] net: broadcom: BCM4908_ENET should not default to y, - unconditionally -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Merely enabling compile-testing should not enable additional code. -To fix this, restrict the automatic enabling of BCM4908_ENET to -ARCH_BCM4908. - -Fixes: 4feffeadbcb2e5b1 ("net: broadcom: bcm4908enet: add BCM4908 controller driver") -Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> -Acked-by: Florian Fainelli <f.fainelli@gmail.com> -Acked-by: Rafał Miłecki <rafal@milecki.pl> -Signed-off-by: David S. Miller <davem@davemloft.net> ---- - drivers/net/ethernet/broadcom/Kconfig | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/ethernet/broadcom/Kconfig -+++ b/drivers/net/ethernet/broadcom/Kconfig -@@ -54,7 +54,7 @@ config B44_PCI - config BCM4908_ENET - tristate "Broadcom BCM4908 internal mac support" - depends on ARCH_BCM4908 || COMPILE_TEST -- default y -+ default y if ARCH_BCM4908 - help - This driver supports Ethernet controller integrated into Broadcom - BCM4908 family SoCs. diff --git a/target/linux/bcm4908/patches-5.4/074-v5.13-0001-net-broadcom-bcm4908_enet-read-MAC-from-OF.patch b/target/linux/bcm4908/patches-5.4/074-v5.13-0001-net-broadcom-bcm4908_enet-read-MAC-from-OF.patch deleted file mode 100644 index c4f336e671..0000000000 --- a/target/linux/bcm4908/patches-5.4/074-v5.13-0001-net-broadcom-bcm4908_enet-read-MAC-from-OF.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 3559c1ea4336636c886002996d50805365d3055c Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Wed, 10 Mar 2021 09:48:13 +0100 -Subject: [PATCH] net: broadcom: bcm4908_enet: read MAC from OF -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -BCM4908 devices have MAC address accessible using NVMEM so it's needed -to use OF helper for reading it. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Signed-off-by: David S. Miller <davem@davemloft.net> ---- - drivers/net/ethernet/broadcom/bcm4908_enet.c | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - ---- a/drivers/net/ethernet/broadcom/bcm4908_enet.c -+++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c -@@ -9,6 +9,7 @@ - #include <linux/interrupt.h> - #include <linux/module.h> - #include <linux/of.h> -+#include <linux/of_net.h> - #include <linux/platform_device.h> - #include <linux/slab.h> - #include <linux/string.h> -@@ -647,7 +648,9 @@ static int bcm4908_enet_probe(struct pla - return err; - - SET_NETDEV_DEV(netdev, &pdev->dev); -- eth_hw_addr_random(netdev); -+ of_get_mac_address(dev->of_node, netdev->dev_addr); -+ if (!is_valid_ether_addr(netdev->dev_addr)) -+ eth_hw_addr_random(netdev); - netdev->netdev_ops = &bcm4908_enet_netdev_ops; - netdev->min_mtu = ETH_ZLEN; - netdev->mtu = ETH_DATA_LEN; diff --git a/target/linux/bcm4908/patches-5.4/074-v5.13-0002-dt-bindings-net-bcm4908-enet-add-optional-TX-interru.patch b/target/linux/bcm4908/patches-5.4/074-v5.13-0002-dt-bindings-net-bcm4908-enet-add-optional-TX-interru.patch deleted file mode 100644 index b61437a2de..0000000000 --- a/target/linux/bcm4908/patches-5.4/074-v5.13-0002-dt-bindings-net-bcm4908-enet-add-optional-TX-interru.patch +++ /dev/null @@ -1,50 +0,0 @@ -From ab4dda7a8cb7e55ea3d92fd5e249cf6f5396028c Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Thu, 11 Mar 2021 13:35:20 +0100 -Subject: [PATCH] dt-bindings: net: bcm4908-enet: add optional TX interrupt -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -I discovered that hardware actually supports two interrupts, one per DMA -channel (RX and TX). - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Signed-off-by: David S. Miller <davem@davemloft.net> ---- - .../bindings/net/brcm,bcm4908-enet.yaml | 17 +++++++++++++---- - 1 file changed, 13 insertions(+), 4 deletions(-) - ---- a/Documentation/devicetree/bindings/net/brcm,bcm4908-enet.yaml -+++ b/Documentation/devicetree/bindings/net/brcm,bcm4908-enet.yaml -@@ -22,10 +22,18 @@ properties: - maxItems: 1 - - interrupts: -- description: RX interrupt -+ minItems: 1 -+ maxItems: 2 -+ items: -+ - description: RX interrupt -+ - description: TX interrupt - - interrupt-names: -- const: rx -+ minItems: 1 -+ maxItems: 2 -+ items: -+ - const: rx -+ - const: tx - - required: - - reg -@@ -43,6 +51,7 @@ examples: - compatible = "brcm,bcm4908-enet"; - reg = <0x80002000 0x1000>; - -- interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>; -- interrupt-names = "rx"; -+ interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>, -+ <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>; -+ interrupt-names = "rx", "tx"; - }; diff --git a/target/linux/bcm4908/patches-5.4/074-v5.13-0003-net-broadcom-bcm4908_enet-support-TX-interrupt.patch b/target/linux/bcm4908/patches-5.4/074-v5.13-0003-net-broadcom-bcm4908_enet-support-TX-interrupt.patch deleted file mode 100644 index 03ac4b07bf..0000000000 --- a/target/linux/bcm4908/patches-5.4/074-v5.13-0003-net-broadcom-bcm4908_enet-support-TX-interrupt.patch +++ /dev/null @@ -1,300 +0,0 @@ -From 12bb508bfe5a564c36864b12253db23cac83bfa1 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Thu, 11 Mar 2021 13:35:21 +0100 -Subject: [PATCH] net: broadcom: bcm4908_enet: support TX interrupt -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -It appears that each DMA channel has its own interrupt and both rings -can be configured (the same way) to handle interrupts. - -1. Make ring interrupts code generic (make it operate on given ring) -2. Move napi to ring (so each has its own) -3. Make IRQ handler generic (match ring against received IRQ number) -4. Add (optional) support for TX interrupt - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Signed-off-by: David S. Miller <davem@davemloft.net> ---- - drivers/net/ethernet/broadcom/bcm4908_enet.c | 138 ++++++++++++++----- - 1 file changed, 103 insertions(+), 35 deletions(-) - ---- a/drivers/net/ethernet/broadcom/bcm4908_enet.c -+++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c -@@ -54,6 +54,7 @@ struct bcm4908_enet_dma_ring { - int length; - u16 cfg_block; - u16 st_ram_block; -+ struct napi_struct napi; - - union { - void *cpu_addr; -@@ -67,8 +68,8 @@ struct bcm4908_enet_dma_ring { - struct bcm4908_enet { - struct device *dev; - struct net_device *netdev; -- struct napi_struct napi; - void __iomem *base; -+ int irq_tx; - - struct bcm4908_enet_dma_ring tx_ring; - struct bcm4908_enet_dma_ring rx_ring; -@@ -123,24 +124,31 @@ static void enet_umac_set(struct bcm4908 - * Helpers - */ - --static void bcm4908_enet_intrs_on(struct bcm4908_enet *enet) -+static void bcm4908_enet_set_mtu(struct bcm4908_enet *enet, int mtu) - { -- enet_write(enet, ENET_DMA_CH_RX_CFG + ENET_DMA_CH_CFG_INT_MASK, ENET_DMA_INT_DEFAULTS); -+ enet_umac_write(enet, UMAC_MAX_FRAME_LEN, mtu + ENET_MAX_ETH_OVERHEAD); - } - --static void bcm4908_enet_intrs_off(struct bcm4908_enet *enet) -+/*** -+ * DMA ring ops -+ */ -+ -+static void bcm4908_enet_dma_ring_intrs_on(struct bcm4908_enet *enet, -+ struct bcm4908_enet_dma_ring *ring) - { -- enet_write(enet, ENET_DMA_CH_RX_CFG + ENET_DMA_CH_CFG_INT_MASK, 0); -+ enet_write(enet, ring->cfg_block + ENET_DMA_CH_CFG_INT_MASK, ENET_DMA_INT_DEFAULTS); - } - --static void bcm4908_enet_intrs_ack(struct bcm4908_enet *enet) -+static void bcm4908_enet_dma_ring_intrs_off(struct bcm4908_enet *enet, -+ struct bcm4908_enet_dma_ring *ring) - { -- enet_write(enet, ENET_DMA_CH_RX_CFG + ENET_DMA_CH_CFG_INT_STAT, ENET_DMA_INT_DEFAULTS); -+ enet_write(enet, ring->cfg_block + ENET_DMA_CH_CFG_INT_MASK, 0); - } - --static void bcm4908_enet_set_mtu(struct bcm4908_enet *enet, int mtu) -+static void bcm4908_enet_dma_ring_intrs_ack(struct bcm4908_enet *enet, -+ struct bcm4908_enet_dma_ring *ring) - { -- enet_umac_write(enet, UMAC_MAX_FRAME_LEN, mtu + ENET_MAX_ETH_OVERHEAD); -+ enet_write(enet, ring->cfg_block + ENET_DMA_CH_CFG_INT_STAT, ENET_DMA_INT_DEFAULTS); - } - - /*** -@@ -414,11 +422,14 @@ static void bcm4908_enet_gmac_init(struc - static irqreturn_t bcm4908_enet_irq_handler(int irq, void *dev_id) - { - struct bcm4908_enet *enet = dev_id; -+ struct bcm4908_enet_dma_ring *ring; - -- bcm4908_enet_intrs_off(enet); -- bcm4908_enet_intrs_ack(enet); -+ ring = (irq == enet->irq_tx) ? &enet->tx_ring : &enet->rx_ring; - -- napi_schedule(&enet->napi); -+ bcm4908_enet_dma_ring_intrs_off(enet, ring); -+ bcm4908_enet_dma_ring_intrs_ack(enet, ring); -+ -+ napi_schedule(&ring->napi); - - return IRQ_HANDLED; - } -@@ -426,6 +437,8 @@ static irqreturn_t bcm4908_enet_irq_hand - static int bcm4908_enet_open(struct net_device *netdev) - { - struct bcm4908_enet *enet = netdev_priv(netdev); -+ 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; - -@@ -435,6 +448,17 @@ static int bcm4908_enet_open(struct net_ - return err; - } - -+ if (enet->irq_tx > 0) { -+ err = request_irq(enet->irq_tx, bcm4908_enet_irq_handler, 0, -+ "tx", enet); -+ if (err) { -+ dev_err(dev, "Failed to request IRQ %d: %d\n", -+ enet->irq_tx, err); -+ free_irq(netdev->irq, enet); -+ return err; -+ } -+ } -+ - bcm4908_enet_gmac_init(enet); - bcm4908_enet_dma_reset(enet); - bcm4908_enet_dma_init(enet); -@@ -443,14 +467,19 @@ static int bcm4908_enet_open(struct net_ - - 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); -- bcm4908_enet_dma_rx_ring_enable(enet, &enet->rx_ring); - -- napi_enable(&enet->napi); -+ if (enet->irq_tx > 0) { -+ napi_enable(&tx_ring->napi); -+ bcm4908_enet_dma_ring_intrs_ack(enet, tx_ring); -+ bcm4908_enet_dma_ring_intrs_on(enet, tx_ring); -+ } -+ -+ bcm4908_enet_dma_rx_ring_enable(enet, rx_ring); -+ napi_enable(&rx_ring->napi); - netif_carrier_on(netdev); - netif_start_queue(netdev); -- -- bcm4908_enet_intrs_ack(enet); -- bcm4908_enet_intrs_on(enet); -+ bcm4908_enet_dma_ring_intrs_ack(enet, rx_ring); -+ bcm4908_enet_dma_ring_intrs_on(enet, rx_ring); - - return 0; - } -@@ -458,16 +487,20 @@ static int bcm4908_enet_open(struct net_ - static int bcm4908_enet_stop(struct net_device *netdev) - { - struct bcm4908_enet *enet = netdev_priv(netdev); -+ struct bcm4908_enet_dma_ring *tx_ring = &enet->tx_ring; -+ struct bcm4908_enet_dma_ring *rx_ring = &enet->rx_ring; - - netif_stop_queue(netdev); - netif_carrier_off(netdev); -- napi_disable(&enet->napi); -+ napi_disable(&rx_ring->napi); -+ napi_disable(&tx_ring->napi); - - bcm4908_enet_dma_rx_ring_disable(enet, &enet->rx_ring); - bcm4908_enet_dma_tx_ring_disable(enet, &enet->tx_ring); - - bcm4908_enet_dma_uninit(enet); - -+ free_irq(enet->irq_tx, enet); - free_irq(enet->netdev->irq, enet); - - return 0; -@@ -484,25 +517,19 @@ static int bcm4908_enet_start_xmit(struc - u32 tmp; - - /* Free transmitted skbs */ -- while (ring->read_idx != ring->write_idx) { -- buf_desc = &ring->buf_desc[ring->read_idx]; -- if (le32_to_cpu(buf_desc->ctl) & DMA_CTL_STATUS_OWN) -- break; -- slot = &ring->slots[ring->read_idx]; -- -- dma_unmap_single(dev, slot->dma_addr, slot->len, DMA_TO_DEVICE); -- dev_kfree_skb(slot->skb); -- if (++ring->read_idx == ring->length) -- ring->read_idx = 0; -- } -+ if (enet->irq_tx < 0 && -+ !(le32_to_cpu(ring->buf_desc[ring->read_idx].ctl) & DMA_CTL_STATUS_OWN)) -+ napi_schedule(&enet->tx_ring.napi); - - /* Don't use the last empty buf descriptor */ - if (ring->read_idx <= ring->write_idx) - free_buf_descs = ring->read_idx - ring->write_idx + ring->length; - else - free_buf_descs = ring->read_idx - ring->write_idx; -- if (free_buf_descs < 2) -+ if (free_buf_descs < 2) { -+ netif_stop_queue(netdev); - return NETDEV_TX_BUSY; -+ } - - /* Hardware removes OWN bit after sending data */ - buf_desc = &ring->buf_desc[ring->write_idx]; -@@ -539,9 +566,10 @@ static int bcm4908_enet_start_xmit(struc - return NETDEV_TX_OK; - } - --static int bcm4908_enet_poll(struct napi_struct *napi, int weight) -+static int bcm4908_enet_poll_rx(struct napi_struct *napi, int weight) - { -- struct bcm4908_enet *enet = container_of(napi, struct bcm4908_enet, napi); -+ struct bcm4908_enet_dma_ring *rx_ring = container_of(napi, struct bcm4908_enet_dma_ring, napi); -+ struct bcm4908_enet *enet = container_of(rx_ring, struct bcm4908_enet, rx_ring); - struct device *dev = enet->dev; - int handled = 0; - -@@ -590,7 +618,7 @@ static int bcm4908_enet_poll(struct napi - - if (handled < weight) { - napi_complete_done(napi, handled); -- bcm4908_enet_intrs_on(enet); -+ bcm4908_enet_dma_ring_intrs_on(enet, rx_ring); - } - - /* Hardware could disable ring if it run out of descriptors */ -@@ -599,6 +627,42 @@ static int bcm4908_enet_poll(struct napi - return handled; - } - -+static int bcm4908_enet_poll_tx(struct napi_struct *napi, int weight) -+{ -+ struct bcm4908_enet_dma_ring *tx_ring = container_of(napi, struct bcm4908_enet_dma_ring, napi); -+ struct bcm4908_enet *enet = container_of(tx_ring, struct bcm4908_enet, tx_ring); -+ struct bcm4908_enet_dma_ring_bd *buf_desc; -+ struct bcm4908_enet_dma_ring_slot *slot; -+ struct device *dev = enet->dev; -+ unsigned int bytes = 0; -+ int handled = 0; -+ -+ while (handled < weight && tx_ring->read_idx != tx_ring->write_idx) { -+ buf_desc = &tx_ring->buf_desc[tx_ring->read_idx]; -+ if (le32_to_cpu(buf_desc->ctl) & DMA_CTL_STATUS_OWN) -+ break; -+ slot = &tx_ring->slots[tx_ring->read_idx]; -+ -+ dma_unmap_single(dev, slot->dma_addr, slot->len, DMA_TO_DEVICE); -+ dev_kfree_skb(slot->skb); -+ bytes += slot->len; -+ if (++tx_ring->read_idx == tx_ring->length) -+ tx_ring->read_idx = 0; -+ -+ handled++; -+ } -+ -+ if (handled < weight) { -+ napi_complete_done(napi, handled); -+ bcm4908_enet_dma_ring_intrs_on(enet, tx_ring); -+ } -+ -+ if (netif_queue_stopped(enet->netdev)) -+ netif_wake_queue(enet->netdev); -+ -+ return handled; -+} -+ - static int bcm4908_enet_change_mtu(struct net_device *netdev, int new_mtu) - { - struct bcm4908_enet *enet = netdev_priv(netdev); -@@ -641,6 +705,8 @@ static int bcm4908_enet_probe(struct pla - if (netdev->irq < 0) - return netdev->irq; - -+ enet->irq_tx = platform_get_irq_byname(pdev, "tx"); -+ - dma_set_coherent_mask(dev, DMA_BIT_MASK(32)); - - err = bcm4908_enet_dma_alloc(enet); -@@ -655,7 +721,8 @@ static int bcm4908_enet_probe(struct pla - netdev->min_mtu = ETH_ZLEN; - netdev->mtu = ETH_DATA_LEN; - netdev->max_mtu = ENET_MTU_MAX; -- netif_napi_add(netdev, &enet->napi, bcm4908_enet_poll, 64); -+ netif_tx_napi_add(netdev, &enet->tx_ring.napi, bcm4908_enet_poll_tx, NAPI_POLL_WEIGHT); -+ netif_napi_add(netdev, &enet->rx_ring.napi, bcm4908_enet_poll_rx, NAPI_POLL_WEIGHT); - - err = register_netdev(netdev); - if (err) { -@@ -673,7 +740,8 @@ static int bcm4908_enet_remove(struct pl - struct bcm4908_enet *enet = platform_get_drvdata(pdev); - - unregister_netdev(enet->netdev); -- netif_napi_del(&enet->napi); -+ netif_napi_del(&enet->rx_ring.napi); -+ netif_napi_del(&enet->tx_ring.napi); - bcm4908_enet_dma_free(enet); - - return 0; diff --git a/target/linux/bcm4908/patches-5.4/075-v5.13-0001-net-dsa-bcm_sf2-store-PHY-interface-mode-in-port-str.patch b/target/linux/bcm4908/patches-5.4/075-v5.13-0001-net-dsa-bcm_sf2-store-PHY-interface-mode-in-port-str.patch deleted file mode 100644 index 69bf2d0d2f..0000000000 --- a/target/linux/bcm4908/patches-5.4/075-v5.13-0001-net-dsa-bcm_sf2-store-PHY-interface-mode-in-port-str.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 01488a0ccd9abe15565bed50a45afcddbb0fe199 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Fri, 12 Mar 2021 11:41:07 +0100 -Subject: [PATCH] net: dsa: bcm_sf2: store PHY interface/mode in port structure -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -It's needed later for proper switch / crossbar setup. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Acked-by: Florian Fainelli <f.fainelli@gmail.com> -Signed-off-by: David S. Miller <davem@davemloft.net> ---- - drivers/net/dsa/bcm_sf2.c | 16 ++++++++++++---- - drivers/net/dsa/bcm_sf2.h | 1 + - 2 files changed, 13 insertions(+), 4 deletions(-) - ---- a/drivers/net/dsa/bcm_sf2.c -+++ b/drivers/net/dsa/bcm_sf2.c -@@ -380,8 +380,9 @@ static void bcm_sf2_intr_disable(struct - static void bcm_sf2_identify_ports(struct bcm_sf2_priv *priv, - struct device_node *dn) - { -+ struct device *dev = priv->dev->ds->dev; -+ struct bcm_sf2_port_status *port_st; - struct device_node *port; -- int mode; - unsigned int port_num; - - priv->moca_port = -1; -@@ -390,19 +391,26 @@ static void bcm_sf2_identify_ports(struc - if (of_property_read_u32(port, "reg", &port_num)) - continue; - -+ if (port_num >= DSA_MAX_PORTS) { -+ dev_err(dev, "Invalid port number %d\n", port_num); -+ continue; -+ } -+ -+ port_st = &priv->port_sts[port_num]; -+ - /* Internal PHYs get assigned a specific 'phy-mode' property - * value: "internal" to help flag them before MDIO probing - * has completed, since they might be turned off at that - * time - */ -- mode = of_get_phy_mode(port); -- if (mode < 0) -+ port_st->mode = of_get_phy_mode(port); -+ if (port_st->mode < 0) - continue; - -- if (mode == PHY_INTERFACE_MODE_INTERNAL) -+ if (port_st->mode == PHY_INTERFACE_MODE_INTERNAL) - priv->int_phy_mask |= 1 << port_num; - -- if (mode == PHY_INTERFACE_MODE_MOCA) -+ if (port_st->mode == PHY_INTERFACE_MODE_MOCA) - priv->moca_port = port_num; - - if (of_property_read_bool(port, "brcm,use-bcm-hdr")) ---- a/drivers/net/dsa/bcm_sf2.h -+++ b/drivers/net/dsa/bcm_sf2.h -@@ -43,6 +43,7 @@ struct bcm_sf2_hw_params { - #define BCM_SF2_REGS_NUM 6 - - struct bcm_sf2_port_status { -+ int mode; - unsigned int link; - }; - diff --git a/target/linux/bcm4908/patches-5.4/075-v5.13-0002-net-dsa-bcm_sf2-setup-BCM4908-internal-crossbar.patch b/target/linux/bcm4908/patches-5.4/075-v5.13-0002-net-dsa-bcm_sf2-setup-BCM4908-internal-crossbar.patch deleted file mode 100644 index b0626ba71e..0000000000 --- a/target/linux/bcm4908/patches-5.4/075-v5.13-0002-net-dsa-bcm_sf2-setup-BCM4908-internal-crossbar.patch +++ /dev/null @@ -1,152 +0,0 @@ -From a9349f08ec6c1251d41ef167d27a15cc39bc5b97 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Fri, 12 Mar 2021 11:41:08 +0100 -Subject: [PATCH] net: dsa: bcm_sf2: setup BCM4908 internal crossbar -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -On some SoCs (e.g. BCM4908, BCM631[345]8) SF2 has an integrated -crossbar. It allows connecting its selected external ports to internal -ports. It's used by vendors to handle custom Ethernet setups. - -BCM4908 has following 3x2 crossbar. On Asus GT-AC5300 rgmii is used for -connecting external BCM53134S switch. GPHY4 is usually used for WAN -port. More fancy devices use SerDes for 2.5 Gbps Ethernet. - - ┌──────────┐ -SerDes ─── 0 ─┤ │ - │ 3x2 ├─ 0 ─── switch port 7 - GPHY4 ─── 1 ─┤ │ - │ crossbar ├─ 1 ─── runner (accelerator) - rgmii ─── 2 ─┤ │ - └──────────┘ - -Use setup data based on DT info to configure BCM4908's switch port 7. -Right now only GPHY and rgmii variants are supported. Handling SerDes -can be implemented later. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Acked-by: Florian Fainelli <f.fainelli@gmail.com> -Signed-off-by: David S. Miller <davem@davemloft.net> ---- - drivers/net/dsa/bcm_sf2.c | 45 ++++++++++++++++++++++++++++++++++ - drivers/net/dsa/bcm_sf2.h | 1 + - drivers/net/dsa/bcm_sf2_regs.h | 7 ++++++ - 3 files changed, 53 insertions(+) - ---- a/drivers/net/dsa/bcm_sf2.c -+++ b/drivers/net/dsa/bcm_sf2.c -@@ -369,6 +369,44 @@ static int bcm_sf2_sw_rst(struct bcm_sf2 - return 0; - } - -+static void bcm_sf2_crossbar_setup(struct bcm_sf2_priv *priv) -+{ -+ struct device *dev = priv->dev->ds->dev; -+ int shift; -+ u32 mask; -+ u32 reg; -+ int i; -+ -+ mask = BIT(priv->num_crossbar_int_ports) - 1; -+ -+ reg = reg_readl(priv, REG_CROSSBAR); -+ switch (priv->type) { -+ case BCM4908_DEVICE_ID: -+ shift = CROSSBAR_BCM4908_INT_P7 * priv->num_crossbar_int_ports; -+ reg &= ~(mask << shift); -+ if (0) /* FIXME */ -+ reg |= CROSSBAR_BCM4908_EXT_SERDES << shift; -+ else if (priv->int_phy_mask & BIT(7)) -+ reg |= CROSSBAR_BCM4908_EXT_GPHY4 << shift; -+ else if (phy_interface_mode_is_rgmii(priv->port_sts[7].mode)) -+ reg |= CROSSBAR_BCM4908_EXT_RGMII << shift; -+ else if (WARN(1, "Invalid port mode\n")) -+ return; -+ break; -+ default: -+ return; -+ } -+ reg_writel(priv, reg, REG_CROSSBAR); -+ -+ reg = reg_readl(priv, REG_CROSSBAR); -+ for (i = 0; i < priv->num_crossbar_int_ports; i++) { -+ shift = i * priv->num_crossbar_int_ports; -+ -+ dev_dbg(dev, "crossbar int port #%d - ext port #%d\n", i, -+ (reg >> shift) & mask); -+ } -+} -+ - static void bcm_sf2_intr_disable(struct bcm_sf2_priv *priv) - { - intrl2_0_mask_set(priv, 0xffffffff); -@@ -734,6 +772,8 @@ static int bcm_sf2_sw_resume(struct dsa_ - return ret; - } - -+ bcm_sf2_crossbar_setup(priv); -+ - ret = bcm_sf2_cfp_resume(ds); - if (ret) - return ret; -@@ -996,6 +1036,7 @@ struct bcm_sf2_of_data { - const u16 *reg_offsets; - unsigned int core_reg_align; - unsigned int num_cfp_rules; -+ unsigned int num_crossbar_int_ports; - }; - - static const u16 bcm_sf2_4908_reg_offsets[] = { -@@ -1020,6 +1061,7 @@ static const struct bcm_sf2_of_data bcm_ - .core_reg_align = 0, - .reg_offsets = bcm_sf2_4908_reg_offsets, - .num_cfp_rules = 0, /* FIXME */ -+ .num_crossbar_int_ports = 2, - }; - - /* Register offsets for the SWITCH_REG_* block */ -@@ -1130,6 +1172,7 @@ static int bcm_sf2_sw_probe(struct platf - priv->reg_offsets = data->reg_offsets; - priv->core_reg_align = data->core_reg_align; - priv->num_cfp_rules = data->num_cfp_rules; -+ priv->num_crossbar_int_ports = data->num_crossbar_int_ports; - - /* Auto-detection using standard registers will not work, so - * provide an indication of what kind of device we are for -@@ -1184,6 +1227,8 @@ static int bcm_sf2_sw_probe(struct platf - return ret; - } - -+ bcm_sf2_crossbar_setup(priv); -+ - bcm_sf2_gphy_enable_set(priv->dev->ds, true); - - ret = bcm_sf2_mdio_register(ds); ---- a/drivers/net/dsa/bcm_sf2.h -+++ b/drivers/net/dsa/bcm_sf2.h -@@ -70,6 +70,7 @@ struct bcm_sf2_priv { - const u16 *reg_offsets; - unsigned int core_reg_align; - unsigned int num_cfp_rules; -+ unsigned int num_crossbar_int_ports; - - /* spinlock protecting access to the indirect registers */ - spinlock_t indir_lock; ---- a/drivers/net/dsa/bcm_sf2_regs.h -+++ b/drivers/net/dsa/bcm_sf2_regs.h -@@ -48,6 +48,13 @@ enum bcm_sf2_reg_offs { - #define PHY_PHYAD_SHIFT 8 - #define PHY_PHYAD_MASK 0x1F - -+/* Relative to REG_CROSSBAR */ -+#define CROSSBAR_BCM4908_INT_P7 0 -+#define CROSSBAR_BCM4908_INT_RUNNER 1 -+#define CROSSBAR_BCM4908_EXT_SERDES 0 -+#define CROSSBAR_BCM4908_EXT_GPHY4 1 -+#define CROSSBAR_BCM4908_EXT_RGMII 2 -+ - #define REG_RGMII_CNTRL_P(x) (REG_RGMII_0_CNTRL + (x)) - - /* Relative to REG_RGMII_CNTRL */ diff --git a/target/linux/bcm4908/patches-5.4/075-v5.13-0003-net-dsa-bcm_sf2-Fill-in-BCM4908-CFP-entries.patch b/target/linux/bcm4908/patches-5.4/075-v5.13-0003-net-dsa-bcm_sf2-Fill-in-BCM4908-CFP-entries.patch deleted file mode 100644 index 06d631f691..0000000000 --- a/target/linux/bcm4908/patches-5.4/075-v5.13-0003-net-dsa-bcm_sf2-Fill-in-BCM4908-CFP-entries.patch +++ /dev/null @@ -1,25 +0,0 @@ -From f4e6d7cdbfae502788bc468295b232dec76ee57e Mon Sep 17 00:00:00 2001 -From: Florian Fainelli <f.fainelli@gmail.com> -Date: Fri, 12 Mar 2021 13:11:01 -0800 -Subject: [PATCH] net: dsa: bcm_sf2: Fill in BCM4908 CFP entries - -The BCM4908 switch has 256 CFP entrie, update that setting so CFP can be -used. - -Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> -Signed-off-by: David S. Miller <davem@davemloft.net> ---- - drivers/net/dsa/bcm_sf2.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/dsa/bcm_sf2.c -+++ b/drivers/net/dsa/bcm_sf2.c -@@ -1060,7 +1060,7 @@ static const struct bcm_sf2_of_data bcm_ - .type = BCM4908_DEVICE_ID, - .core_reg_align = 0, - .reg_offsets = bcm_sf2_4908_reg_offsets, -- .num_cfp_rules = 0, /* FIXME */ -+ .num_cfp_rules = 256, - .num_crossbar_int_ports = 2, - }; - diff --git a/target/linux/bcm4908/patches-5.4/075-v5.13-0004-net-dsa-bcm_sf2-add-function-finding-RGMII-register.patch b/target/linux/bcm4908/patches-5.4/075-v5.13-0004-net-dsa-bcm_sf2-add-function-finding-RGMII-register.patch deleted file mode 100644 index c46fd1d3b5..0000000000 --- a/target/linux/bcm4908/patches-5.4/075-v5.13-0004-net-dsa-bcm_sf2-add-function-finding-RGMII-register.patch +++ /dev/null @@ -1,127 +0,0 @@ -From 55cfeb396965c3906a84d09a9c487d065e37773b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Thu, 18 Mar 2021 09:01:42 +0100 -Subject: [PATCH 1/2] net: dsa: bcm_sf2: add function finding RGMII register -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Simple macro like REG_RGMII_CNTRL_P() is insufficient as: -1. It doesn't validate port argument -2. It doesn't support chipsets with non-lineral RGMII regs layout - -Missing port validation could result in getting register offset from out -of array. Random memory -> random offset -> random reads/writes. It -affected e.g. BCM4908 for REG_RGMII_CNTRL_P(7). - -Fixes: a78e86ed586d ("net: dsa: bcm_sf2: Prepare for different register layouts") -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Acked-by: Florian Fainelli <f.fainelli@gmail.com> -Signed-off-by: David S. Miller <davem@davemloft.net> ---- - drivers/net/dsa/bcm_sf2.c | 49 +++++++++++++++++++++++++++++----- - drivers/net/dsa/bcm_sf2_regs.h | 2 -- - 2 files changed, 42 insertions(+), 9 deletions(-) - ---- a/drivers/net/dsa/bcm_sf2.c -+++ b/drivers/net/dsa/bcm_sf2.c -@@ -31,6 +31,31 @@ - #include "b53/b53_priv.h" - #include "b53/b53_regs.h" - -+static u16 bcm_sf2_reg_rgmii_cntrl(struct bcm_sf2_priv *priv, int port) -+{ -+ switch (priv->type) { -+ case BCM4908_DEVICE_ID: -+ /* TODO */ -+ break; -+ default: -+ switch (port) { -+ case 0: -+ return REG_RGMII_0_CNTRL; -+ case 1: -+ return REG_RGMII_1_CNTRL; -+ case 2: -+ return REG_RGMII_2_CNTRL; -+ default: -+ break; -+ } -+ } -+ -+ WARN_ONCE(1, "Unsupported port %d\n", port); -+ -+ /* RO fallback reg */ -+ return REG_SWITCH_STATUS; -+} -+ - static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port) - { - struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); -@@ -588,6 +613,7 @@ static void bcm_sf2_sw_mac_config(struct - { - struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); - u32 id_mode_dis = 0, port_mode; -+ u32 reg_rgmii_ctrl; - u32 reg, offset; - - if (port == core_readl(priv, CORE_IMP0_PRT_ID)) -@@ -617,10 +643,12 @@ static void bcm_sf2_sw_mac_config(struct - goto force_link; - } - -+ reg_rgmii_ctrl = bcm_sf2_reg_rgmii_cntrl(priv, port); -+ - /* Clear id_mode_dis bit, and the existing port mode, let - * RGMII_MODE_EN bet set by mac_link_{up,down} - */ -- reg = reg_readl(priv, REG_RGMII_CNTRL_P(port)); -+ reg = reg_readl(priv, reg_rgmii_ctrl); - reg &= ~ID_MODE_DIS; - reg &= ~(PORT_MODE_MASK << PORT_MODE_SHIFT); - reg &= ~(RX_PAUSE_EN | TX_PAUSE_EN); -@@ -635,7 +663,7 @@ static void bcm_sf2_sw_mac_config(struct - reg |= RX_PAUSE_EN; - } - -- reg_writel(priv, reg, REG_RGMII_CNTRL_P(port)); -+ reg_writel(priv, reg, reg_rgmii_ctrl); - - force_link: - /* Force link settings detected from the PHY */ -@@ -661,6 +689,7 @@ static void bcm_sf2_sw_mac_link_set(stru - phy_interface_t interface, bool link) - { - struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); -+ u32 reg_rgmii_ctrl; - u32 reg; - - if (!phy_interface_mode_is_rgmii(interface) && -@@ -668,13 +697,15 @@ static void bcm_sf2_sw_mac_link_set(stru - interface != PHY_INTERFACE_MODE_REVMII) - return; - -+ reg_rgmii_ctrl = bcm_sf2_reg_rgmii_cntrl(priv, port); -+ - /* If the link is down, just disable the interface to conserve power */ -- reg = reg_readl(priv, REG_RGMII_CNTRL_P(port)); -+ reg = reg_readl(priv, reg_rgmii_ctrl); - if (link) - reg |= RGMII_MODE_EN; - else - reg &= ~RGMII_MODE_EN; -- reg_writel(priv, reg, REG_RGMII_CNTRL_P(port)); -+ reg_writel(priv, reg, reg_rgmii_ctrl); - } - - static void bcm_sf2_sw_mac_link_down(struct dsa_switch *ds, int port, ---- a/drivers/net/dsa/bcm_sf2_regs.h -+++ b/drivers/net/dsa/bcm_sf2_regs.h -@@ -55,8 +55,6 @@ enum bcm_sf2_reg_offs { - #define CROSSBAR_BCM4908_EXT_GPHY4 1 - #define CROSSBAR_BCM4908_EXT_RGMII 2 - --#define REG_RGMII_CNTRL_P(x) (REG_RGMII_0_CNTRL + (x)) -- - /* Relative to REG_RGMII_CNTRL */ - #define RGMII_MODE_EN (1 << 0) - #define ID_MODE_DIS (1 << 1) diff --git a/target/linux/bcm4908/patches-5.4/075-v5.13-0005-net-dsa-bcm_sf2-fix-BCM4908-RGMII-reg-s.patch b/target/linux/bcm4908/patches-5.4/075-v5.13-0005-net-dsa-bcm_sf2-fix-BCM4908-RGMII-reg-s.patch deleted file mode 100644 index d0783ea5e7..0000000000 --- a/target/linux/bcm4908/patches-5.4/075-v5.13-0005-net-dsa-bcm_sf2-fix-BCM4908-RGMII-reg-s.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 6859d91549341c2ad769d482de58129f080c0f04 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Thu, 18 Mar 2021 09:01:43 +0100 -Subject: [PATCH 2/2] net: dsa: bcm_sf2: fix BCM4908 RGMII reg(s) -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -BCM4908 has only 1 RGMII reg for controlling port 7. - -Fixes: 73b7a6047971 ("net: dsa: bcm_sf2: support BCM4908's integrated switch") -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Acked-by: Florian Fainelli <f.fainelli@gmail.com> -Signed-off-by: David S. Miller <davem@davemloft.net> ---- - drivers/net/dsa/bcm_sf2.c | 11 +++++++---- - drivers/net/dsa/bcm_sf2_regs.h | 1 + - 2 files changed, 8 insertions(+), 4 deletions(-) - ---- a/drivers/net/dsa/bcm_sf2.c -+++ b/drivers/net/dsa/bcm_sf2.c -@@ -35,7 +35,12 @@ static u16 bcm_sf2_reg_rgmii_cntrl(struc - { - switch (priv->type) { - case BCM4908_DEVICE_ID: -- /* TODO */ -+ switch (port) { -+ case 7: -+ return REG_RGMII_11_CNTRL; -+ default: -+ break; -+ } - break; - default: - switch (port) { -@@ -1079,9 +1084,7 @@ static const u16 bcm_sf2_4908_reg_offset - [REG_PHY_REVISION] = 0x14, - [REG_SPHY_CNTRL] = 0x24, - [REG_CROSSBAR] = 0xc8, -- [REG_RGMII_0_CNTRL] = 0xe0, -- [REG_RGMII_1_CNTRL] = 0xec, -- [REG_RGMII_2_CNTRL] = 0xf8, -+ [REG_RGMII_11_CNTRL] = 0x014c, - [REG_LED_0_CNTRL] = 0x40, - [REG_LED_1_CNTRL] = 0x4c, - [REG_LED_2_CNTRL] = 0x58, ---- a/drivers/net/dsa/bcm_sf2_regs.h -+++ b/drivers/net/dsa/bcm_sf2_regs.h -@@ -21,6 +21,7 @@ enum bcm_sf2_reg_offs { - REG_RGMII_0_CNTRL, - REG_RGMII_1_CNTRL, - REG_RGMII_2_CNTRL, -+ REG_RGMII_11_CNTRL, - REG_LED_0_CNTRL, - REG_LED_1_CNTRL, - REG_LED_2_CNTRL, diff --git a/target/linux/bcm4908/patches-5.4/076-v5.17-net-dsa-bcm_sf2-refactor-LED-regs-access.patch b/target/linux/bcm4908/patches-5.4/076-v5.17-net-dsa-bcm_sf2-refactor-LED-regs-access.patch deleted file mode 100644 index 88f2c3c0cd..0000000000 --- a/target/linux/bcm4908/patches-5.4/076-v5.17-net-dsa-bcm_sf2-refactor-LED-regs-access.patch +++ /dev/null @@ -1,209 +0,0 @@ -From af30f8eaa8fe4ff1987280f716309711997bd979 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Wed, 29 Dec 2021 18:16:42 +0100 -Subject: [PATCH] net: dsa: bcm_sf2: refactor LED regs access -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -1. Define more regs. Some switches (e.g. BCM4908) have up to 6 regs. -2. Add helper for handling non-lineral port <-> reg mappings. -3. Add support for 12 B LED reg blocks on BCM4908 (different layout) - -Complete support for LEDs setup will be implemented once Linux receives -a proper design & implementation for "hardware" LEDs. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Acked-by: Florian Fainelli <f.fainelli@gmail.com> -Link: https://lore.kernel.org/r/20211229171642.22942-1-zajec5@gmail.com -Signed-off-by: Jakub Kicinski <kuba@kernel.org> ---- - drivers/net/dsa/bcm_sf2.c | 54 ++++++++++++++++++++++++---- - drivers/net/dsa/bcm_sf2.h | 10 ++++++ - drivers/net/dsa/bcm_sf2_regs.h | 65 +++++++++++++++++++++++++++++++--- - 3 files changed, 119 insertions(+), 10 deletions(-) - ---- a/drivers/net/dsa/bcm_sf2.c -+++ b/drivers/net/dsa/bcm_sf2.c -@@ -31,6 +31,38 @@ - #include "b53/b53_priv.h" - #include "b53/b53_regs.h" - -+static u16 bcm_sf2_reg_led_base(struct bcm_sf2_priv *priv, int port) -+{ -+ switch (port) { -+ case 0: -+ return REG_LED_0_CNTRL; -+ case 1: -+ return REG_LED_1_CNTRL; -+ case 2: -+ return REG_LED_2_CNTRL; -+ } -+ -+ switch (priv->type) { -+ case BCM4908_DEVICE_ID: -+ switch (port) { -+ case 3: -+ return REG_LED_3_CNTRL; -+ case 7: -+ return REG_LED_4_CNTRL; -+ default: -+ break; -+ } -+ break; -+ default: -+ break; -+ } -+ -+ WARN_ONCE(1, "Unsupported port %d\n", port); -+ -+ /* RO fallback reg */ -+ return REG_SWITCH_STATUS; -+} -+ - static u16 bcm_sf2_reg_rgmii_cntrl(struct bcm_sf2_priv *priv, int port) - { - switch (priv->type) { -@@ -141,9 +173,14 @@ static void bcm_sf2_gphy_enable_set(stru - - /* Use PHY-driven LED signaling */ - if (!enable) { -- reg = reg_readl(priv, REG_LED_CNTRL(0)); -- reg |= SPDLNK_SRC_SEL; -- reg_writel(priv, reg, REG_LED_CNTRL(0)); -+ u16 led_ctrl = bcm_sf2_reg_led_base(priv, 0); -+ -+ if (priv->type == BCM7278_DEVICE_ID || -+ priv->type == BCM7445_DEVICE_ID) { -+ reg = reg_led_readl(priv, led_ctrl, 0); -+ reg |= LED_CNTRL_SPDLNK_SRC_SEL; -+ reg_led_writel(priv, reg, led_ctrl, 0); -+ } - } - } - -@@ -1085,9 +1122,14 @@ static const u16 bcm_sf2_4908_reg_offset - [REG_SPHY_CNTRL] = 0x24, - [REG_CROSSBAR] = 0xc8, - [REG_RGMII_11_CNTRL] = 0x014c, -- [REG_LED_0_CNTRL] = 0x40, -- [REG_LED_1_CNTRL] = 0x4c, -- [REG_LED_2_CNTRL] = 0x58, -+ [REG_LED_0_CNTRL] = 0x40, -+ [REG_LED_1_CNTRL] = 0x4c, -+ [REG_LED_2_CNTRL] = 0x58, -+ [REG_LED_3_CNTRL] = 0x64, -+ [REG_LED_4_CNTRL] = 0x88, -+ [REG_LED_5_CNTRL] = 0xa0, -+ [REG_LED_AGGREGATE_CTRL] = 0xb8, -+ - }; - - static const struct bcm_sf2_of_data bcm_sf2_4908_data = { ---- a/drivers/net/dsa/bcm_sf2.h -+++ b/drivers/net/dsa/bcm_sf2.h -@@ -203,6 +203,16 @@ SF2_IO_MACRO(acb); - SWITCH_INTR_L2(0); - SWITCH_INTR_L2(1); - -+static inline u32 reg_led_readl(struct bcm_sf2_priv *priv, u16 off, u16 reg) -+{ -+ return readl_relaxed(priv->reg + priv->reg_offsets[off] + reg); -+} -+ -+static inline void reg_led_writel(struct bcm_sf2_priv *priv, u32 val, u16 off, u16 reg) -+{ -+ writel_relaxed(val, priv->reg + priv->reg_offsets[off] + reg); -+} -+ - /* RXNFC */ - int bcm_sf2_get_rxnfc(struct dsa_switch *ds, int port, - struct ethtool_rxnfc *nfc, u32 *rule_locs); ---- a/drivers/net/dsa/bcm_sf2_regs.h -+++ b/drivers/net/dsa/bcm_sf2_regs.h -@@ -25,6 +25,10 @@ enum bcm_sf2_reg_offs { - REG_LED_0_CNTRL, - REG_LED_1_CNTRL, - REG_LED_2_CNTRL, -+ REG_LED_3_CNTRL, -+ REG_LED_4_CNTRL, -+ REG_LED_5_CNTRL, -+ REG_LED_AGGREGATE_CTRL, - REG_SWITCH_REG_MAX, - }; - -@@ -56,6 +60,63 @@ enum bcm_sf2_reg_offs { - #define CROSSBAR_BCM4908_EXT_GPHY4 1 - #define CROSSBAR_BCM4908_EXT_RGMII 2 - -+/* Relative to REG_LED_*_CNTRL (BCM7278, BCM7445) */ -+#define LED_CNTRL_NO_LINK_ENCODE_SHIFT 0 -+#define LED_CNTRL_M10_ENCODE_SHIFT 2 -+#define LED_CNTRL_M100_ENCODE_SHIFT 4 -+#define LED_CNTRL_M1000_ENCODE_SHIFT 6 -+#define LED_CNTRL_SEL_NO_LINK_ENCODE_SHIFT 8 -+#define LED_CNTRL_SEL_10M_ENCODE_SHIFT 10 -+#define LED_CNTRL_SEL_100M_ENCODE_SHIFT 12 -+#define LED_CNTRL_SEL_1000M_ENCODE_SHIFT 14 -+#define LED_CNTRL_RX_DV_EN (1 << 16) -+#define LED_CNTRL_TX_EN_EN (1 << 17) -+#define LED_CNTRL_SPDLNK_LED0_ACT_SEL_SHIFT 18 -+#define LED_CNTRL_SPDLNK_LED1_ACT_SEL_SHIFT 20 -+#define LED_CNTRL_ACT_LED_ACT_SEL_SHIFT 22 -+#define LED_CNTRL_SPDLNK_SRC_SEL (1 << 24) -+#define LED_CNTRL_SPDLNK_LED0_ACT_POL_SEL (1 << 25) -+#define LED_CNTRL_SPDLNK_LED1_ACT_POL_SEL (1 << 26) -+#define LED_CNTRL_ACT_LED_POL_SEL (1 << 27) -+#define LED_CNTRL_MASK 0x3 -+ -+/* Register relative to REG_LED_*_CNTRL (BCM4908) */ -+#define REG_LED_CTRL 0x0 -+#define LED_CTRL_RX_ACT_EN 0x00000001 -+#define LED_CTRL_TX_ACT_EN 0x00000002 -+#define LED_CTRL_SPDLNK_LED0_ACT_SEL 0x00000004 -+#define LED_CTRL_SPDLNK_LED1_ACT_SEL 0x00000008 -+#define LED_CTRL_SPDLNK_LED2_ACT_SEL 0x00000010 -+#define LED_CTRL_ACT_LED_ACT_SEL 0x00000020 -+#define LED_CTRL_SPDLNK_LED0_ACT_POL_SEL 0x00000040 -+#define LED_CTRL_SPDLNK_LED1_ACT_POL_SEL 0x00000080 -+#define LED_CTRL_SPDLNK_LED2_ACT_POL_SEL 0x00000100 -+#define LED_CTRL_ACT_LED_POL_SEL 0x00000200 -+#define LED_CTRL_LED_SPD_OVRD 0x00001c00 -+#define LED_CTRL_LNK_STATUS_OVRD 0x00002000 -+#define LED_CTRL_SPD_OVRD_EN 0x00004000 -+#define LED_CTRL_LNK_OVRD_EN 0x00008000 -+ -+/* Register relative to REG_LED_*_CNTRL (BCM4908) */ -+#define REG_LED_LINK_SPEED_ENC_SEL 0x4 -+#define LED_LINK_SPEED_ENC_SEL_NO_LINK_SHIFT 0 -+#define LED_LINK_SPEED_ENC_SEL_10M_SHIFT 3 -+#define LED_LINK_SPEED_ENC_SEL_100M_SHIFT 6 -+#define LED_LINK_SPEED_ENC_SEL_1000M_SHIFT 9 -+#define LED_LINK_SPEED_ENC_SEL_2500M_SHIFT 12 -+#define LED_LINK_SPEED_ENC_SEL_10G_SHIFT 15 -+#define LED_LINK_SPEED_ENC_SEL_MASK 0x7 -+ -+/* Register relative to REG_LED_*_CNTRL (BCM4908) */ -+#define REG_LED_LINK_SPEED_ENC 0x8 -+#define LED_LINK_SPEED_ENC_NO_LINK_SHIFT 0 -+#define LED_LINK_SPEED_ENC_M10_SHIFT 3 -+#define LED_LINK_SPEED_ENC_M100_SHIFT 6 -+#define LED_LINK_SPEED_ENC_M1000_SHIFT 9 -+#define LED_LINK_SPEED_ENC_M2500_SHIFT 12 -+#define LED_LINK_SPEED_ENC_M10G_SHIFT 15 -+#define LED_LINK_SPEED_ENC_MASK 0x7 -+ - /* Relative to REG_RGMII_CNTRL */ - #define RGMII_MODE_EN (1 << 0) - #define ID_MODE_DIS (1 << 1) -@@ -73,10 +134,6 @@ enum bcm_sf2_reg_offs { - #define LPI_COUNT_SHIFT 9 - #define LPI_COUNT_MASK 0x3F - --#define REG_LED_CNTRL(x) (REG_LED_0_CNTRL + (x)) -- --#define SPDLNK_SRC_SEL (1 << 24) -- - /* Register set relative to 'INTRL2_0' and 'INTRL2_1' */ - #define INTRL2_CPU_STATUS 0x00 - #define INTRL2_CPU_SET 0x04 diff --git a/target/linux/bcm4908/patches-5.4/080-v5.11-tty-serial-bcm63xx-lower-driver-dependencies.patch b/target/linux/bcm4908/patches-5.4/080-v5.11-tty-serial-bcm63xx-lower-driver-dependencies.patch deleted file mode 100644 index 8da2fe8cf2..0000000000 --- a/target/linux/bcm4908/patches-5.4/080-v5.11-tty-serial-bcm63xx-lower-driver-dependencies.patch +++ /dev/null @@ -1,31 +0,0 @@ -From f35a07f92616700733636c06dd6e5b6cdc807fe4 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Wed, 25 Nov 2020 10:06:08 +0100 -Subject: [PATCH] tty: serial: bcm63xx: lower driver dependencies -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Hardware supported by bcm63xx is also used by BCM4908 SoCs family that -is ARM64. In future more architectures may need it as well. There is -nothing arch specific breaking compilation so just stick to requiring -COMMON_CLK. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Link: https://lore.kernel.org/r/20201125090608.28442-1-zajec5@gmail.com -Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> ---- - drivers/tty/serial/Kconfig | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/tty/serial/Kconfig -+++ b/drivers/tty/serial/Kconfig -@@ -1125,7 +1125,7 @@ config SERIAL_TIMBERDALE - config SERIAL_BCM63XX - tristate "Broadcom BCM63xx/BCM33xx UART support" - select SERIAL_CORE -- depends on MIPS || ARM || COMPILE_TEST -+ depends on COMMON_CLK - help - This enables the driver for the onchip UART core found on - the following chipsets: diff --git a/target/linux/bcm4908/patches-5.4/081-v5.12-reset-simple-add-BCM4908-MISC-PCIe-reset-controller-.patch b/target/linux/bcm4908/patches-5.4/081-v5.12-reset-simple-add-BCM4908-MISC-PCIe-reset-controller-.patch deleted file mode 100644 index 8ccd876619..0000000000 --- a/target/linux/bcm4908/patches-5.4/081-v5.12-reset-simple-add-BCM4908-MISC-PCIe-reset-controller-.patch +++ /dev/null @@ -1,40 +0,0 @@ -From def26913b66fd94e431afecf28e09c08e8c02a35 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Fri, 27 Nov 2020 12:14:42 +0100 -Subject: [PATCH] reset: simple: add BCM4908 MISC PCIe reset controller support -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -It's a trivial reset controller. One register with bit per PCIe core. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Acked-by: Florian Fainelli <f.fainelli@gmail.com> -Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> ---- - drivers/reset/Kconfig | 2 +- - drivers/reset/reset-simple.c | 2 ++ - 2 files changed, 3 insertions(+), 1 deletion(-) - ---- a/drivers/reset/Kconfig -+++ b/drivers/reset/Kconfig -@@ -129,7 +129,7 @@ config RESET_SCMI - - config RESET_SIMPLE - bool "Simple Reset Controller Driver" if COMPILE_TEST -- default ARCH_STM32 || ARCH_STRATIX10 || ARCH_SUNXI || ARCH_ZX || ARCH_ASPEED || ARCH_BITMAIN || ARC -+ default ARCH_BCM4908 || ARCH_STM32 || ARCH_STRATIX10 || ARCH_SUNXI || ARCH_ZX || ARCH_ASPEED || ARCH_BITMAIN || ARC - help - This enables a simple reset controller driver for reset lines that - that can be asserted and deasserted by toggling bits in a contiguous, ---- a/drivers/reset/reset-simple.c -+++ b/drivers/reset/reset-simple.c -@@ -127,6 +127,8 @@ static const struct of_device_id reset_s - { .compatible = "aspeed,ast2500-lpc-reset" }, - { .compatible = "bitmain,bm1880-reset", - .data = &reset_simple_active_low }, -+ { .compatible = "brcm,bcm4908-misc-pcie-reset", -+ .data = &reset_simple_active_low }, - { .compatible = "snps,dw-high-reset" }, - { .compatible = "snps,dw-low-reset", - .data = &reset_simple_active_low }, diff --git a/target/linux/bcm4908/patches-5.4/082-v5.12-0001-dt-bindings-power-document-Broadcom-s-PMB-binding.patch b/target/linux/bcm4908/patches-5.4/082-v5.12-0001-dt-bindings-power-document-Broadcom-s-PMB-binding.patch deleted file mode 100644 index c5c1a5dc7e..0000000000 --- a/target/linux/bcm4908/patches-5.4/082-v5.12-0001-dt-bindings-power-document-Broadcom-s-PMB-binding.patch +++ /dev/null @@ -1,90 +0,0 @@ -From 82853543057f78d8a331272b70bc3f1e8cb0cbf4 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Mon, 14 Dec 2020 19:07:42 +0100 -Subject: [PATCH] dt-bindings: power: document Broadcom's PMB binding -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Broadcom's PMB is power controller used for disabling and enabling SoC -devices. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Reviewed-by: Rob Herring <robh@kernel.org> -Acked-by: Florian Fainelli <f.fainelli@gmail.com> -Acked-by: Ulf Hansson <ulf.hansson@linaro.org> -Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> ---- - .../bindings/power/brcm,bcm-pmb.yaml | 50 +++++++++++++++++++ - include/dt-bindings/soc/bcm-pmb.h | 11 ++++ - 2 files changed, 61 insertions(+) - create mode 100644 Documentation/devicetree/bindings/power/brcm,bcm-pmb.yaml - create mode 100644 include/dt-bindings/soc/bcm-pmb.h - ---- /dev/null -+++ b/Documentation/devicetree/bindings/power/brcm,bcm-pmb.yaml -@@ -0,0 +1,50 @@ -+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause -+%YAML 1.2 -+--- -+$id: http://devicetree.org/schemas/power/brcm,bcm-pmb.yaml# -+$schema: http://devicetree.org/meta-schemas/core.yaml# -+ -+title: Broadcom PMB (Power Management Bus) controller -+ -+description: This document describes Broadcom's PMB controller. It supports -+ powering various types of connected devices (e.g. PCIe, USB, SATA). -+ -+maintainers: -+ - Rafał Miłecki <rafal@milecki.pl> -+ -+properties: -+ compatible: -+ enum: -+ - brcm,bcm4908-pmb -+ -+ reg: -+ description: register space of one or more buses -+ maxItems: 1 -+ -+ big-endian: -+ $ref: /schemas/types.yaml#/definitions/flag -+ description: Flag to use for block working in big endian mode. -+ -+ "#power-domain-cells": -+ description: cell specifies device ID (see bcm-pmb.h) -+ const: 1 -+ -+required: -+ - reg -+ - "#power-domain-cells" -+ -+additionalProperties: false -+ -+examples: -+ - | -+ #include <dt-bindings/soc/bcm-pmb.h> -+ -+ pmb: power-controller@802800e0 { -+ compatible = "brcm,bcm4908-pmb"; -+ reg = <0x802800e0 0x40>; -+ #power-domain-cells = <1>; -+ }; -+ -+ foo { -+ power-domains = <&pmb BCM_PMB_PCIE0>; -+ }; ---- /dev/null -+++ b/include/dt-bindings/soc/bcm-pmb.h -@@ -0,0 +1,11 @@ -+/* SPDX-License-Identifier: GPL-2.0-or-later OR MIT */ -+ -+#ifndef __DT_BINDINGS_SOC_BCM_PMB_H -+#define __DT_BINDINGS_SOC_BCM_PMB_H -+ -+#define BCM_PMB_PCIE0 0x01 -+#define BCM_PMB_PCIE1 0x02 -+#define BCM_PMB_PCIE2 0x03 -+#define BCM_PMB_HOST_USB 0x04 -+ -+#endif diff --git a/target/linux/bcm4908/patches-5.4/082-v5.12-0002-soc-bcm-add-PM-driver-for-Broadcom-s-PMB.patch b/target/linux/bcm4908/patches-5.4/082-v5.12-0002-soc-bcm-add-PM-driver-for-Broadcom-s-PMB.patch deleted file mode 100644 index 40126a968b..0000000000 --- a/target/linux/bcm4908/patches-5.4/082-v5.12-0002-soc-bcm-add-PM-driver-for-Broadcom-s-PMB.patch +++ /dev/null @@ -1,414 +0,0 @@ -From 8bcac4011ebe0dbdd46fd55b036ee855c95702d3 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Mon, 14 Dec 2020 19:07:43 +0100 -Subject: [PATCH] soc: bcm: add PM driver for Broadcom's PMB -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -PMB originally comes from BCM63138 but can be also found on many other -chipsets (e.g. BCM4908). It's needed to power on and off SoC blocks like -PCIe, SATA, USB. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Acked-by: Ulf Hansson <ulf.hansson@linaro.org> -Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> ---- - MAINTAINERS | 10 + - drivers/soc/bcm/Makefile | 2 +- - drivers/soc/bcm/bcm63xx/Kconfig | 9 + - drivers/soc/bcm/bcm63xx/Makefile | 1 + - drivers/soc/bcm/bcm63xx/bcm-pmb.c | 333 ++++++++++++++++++++++++++++++ - 5 files changed, 354 insertions(+), 1 deletion(-) - create mode 100644 drivers/soc/bcm/bcm63xx/bcm-pmb.c - ---- a/MAINTAINERS -+++ b/MAINTAINERS -@@ -3415,6 +3415,16 @@ L: linux-mips@vger.kernel.org - S: Maintained - F: drivers/firmware/broadcom/* - -+BROADCOM PMB (POWER MANAGEMENT BUS) DRIVER -+M: Rafał Miłecki <rafal@milecki.pl> -+M: Florian Fainelli <f.fainelli@gmail.com> -+M: bcm-kernel-feedback-list@broadcom.com -+L: linux-pm@vger.kernel.org -+S: Maintained -+T: git git://github.com/broadcom/stblinux.git -+F: drivers/soc/bcm/bcm-pmb.c -+F: include/dt-bindings/soc/bcm-pmb.h -+ - BROADCOM SPECIFIC AMBA DRIVER (BCMA) - M: Rafał Miłecki <zajec5@gmail.com> - L: linux-wireless@vger.kernel.org ---- /dev/null -+++ b/drivers/soc/bcm/bcm63xx/Kconfig -@@ -0,0 +1,9 @@ -+# SPDX-License-Identifier: GPL-2.0-only -+config BCM_PMB -+ bool "Broadcom PMB (Power Management Bus) driver" -+ depends on ARCH_BCM4908 || (COMPILE_TEST && OF) -+ default ARCH_BCM4908 -+ select PM_GENERIC_DOMAINS if PM -+ help -+ This enables support for the Broadcom's PMB (Power Management Bus) that -+ is used for disabling and enabling SoC devices. ---- /dev/null -+++ b/drivers/soc/bcm/bcm63xx/Makefile -@@ -0,0 +1,2 @@ -+# SPDX-License-Identifier: GPL-2.0-only -+obj-$(CONFIG_BCM_PMB) += bcm-pmb.o ---- /dev/null -+++ b/drivers/soc/bcm/bcm63xx/bcm-pmb.c -@@ -0,0 +1,333 @@ -+// SPDX-License-Identifier: GPL-2.0-or-later -+/* -+ * Copyright (c) 2013 Broadcom -+ * Copyright (C) 2020 Rafał Miłecki <rafal@milecki.pl> -+ */ -+ -+#include <dt-bindings/soc/bcm-pmb.h> -+#include <linux/io.h> -+#include <linux/module.h> -+#include <linux/of.h> -+#include <linux/of_device.h> -+#include <linux/platform_device.h> -+#include <linux/pm_domain.h> -+#include <linux/reset/bcm63xx_pmb.h> -+ -+#define BPCM_ID_REG 0x00 -+#define BPCM_CAPABILITIES 0x04 -+#define BPCM_CAP_NUM_ZONES 0x000000ff -+#define BPCM_CAP_SR_REG_BITS 0x0000ff00 -+#define BPCM_CAP_PLLTYPE 0x00030000 -+#define BPCM_CAP_UBUS 0x00080000 -+#define BPCM_CONTROL 0x08 -+#define BPCM_STATUS 0x0c -+#define BPCM_ROSC_CONTROL 0x10 -+#define BPCM_ROSC_THRESH_H 0x14 -+#define BPCM_ROSC_THRESHOLD_BCM6838 0x14 -+#define BPCM_ROSC_THRESH_S 0x18 -+#define BPCM_ROSC_COUNT_BCM6838 0x18 -+#define BPCM_ROSC_COUNT 0x1c -+#define BPCM_PWD_CONTROL_BCM6838 0x1c -+#define BPCM_PWD_CONTROL 0x20 -+#define BPCM_SR_CONTROL_BCM6838 0x20 -+#define BPCM_PWD_ACCUM_CONTROL 0x24 -+#define BPCM_SR_CONTROL 0x28 -+#define BPCM_GLOBAL_CONTROL 0x2c -+#define BPCM_MISC_CONTROL 0x30 -+#define BPCM_MISC_CONTROL2 0x34 -+#define BPCM_SGPHY_CNTL 0x38 -+#define BPCM_SGPHY_STATUS 0x3c -+#define BPCM_ZONE0 0x40 -+#define BPCM_ZONE_CONTROL 0x00 -+#define BPCM_ZONE_CONTROL_MANUAL_CLK_EN 0x00000001 -+#define BPCM_ZONE_CONTROL_MANUAL_RESET_CTL 0x00000002 -+#define BPCM_ZONE_CONTROL_FREQ_SCALE_USED 0x00000004 /* R/O */ -+#define BPCM_ZONE_CONTROL_DPG_CAPABLE 0x00000008 /* R/O */ -+#define BPCM_ZONE_CONTROL_MANUAL_MEM_PWR 0x00000030 -+#define BPCM_ZONE_CONTROL_MANUAL_ISO_CTL 0x00000040 -+#define BPCM_ZONE_CONTROL_MANUAL_CTL 0x00000080 -+#define BPCM_ZONE_CONTROL_DPG_CTL_EN 0x00000100 -+#define BPCM_ZONE_CONTROL_PWR_DN_REQ 0x00000200 -+#define BPCM_ZONE_CONTROL_PWR_UP_REQ 0x00000400 -+#define BPCM_ZONE_CONTROL_MEM_PWR_CTL_EN 0x00000800 -+#define BPCM_ZONE_CONTROL_BLK_RESET_ASSERT 0x00001000 -+#define BPCM_ZONE_CONTROL_MEM_STBY 0x00002000 -+#define BPCM_ZONE_CONTROL_RESERVED 0x0007c000 -+#define BPCM_ZONE_CONTROL_PWR_CNTL_STATE 0x00f80000 -+#define BPCM_ZONE_CONTROL_FREQ_SCALAR_DYN_SEL 0x01000000 /* R/O */ -+#define BPCM_ZONE_CONTROL_PWR_OFF_STATE 0x02000000 /* R/O */ -+#define BPCM_ZONE_CONTROL_PWR_ON_STATE 0x04000000 /* R/O */ -+#define BPCM_ZONE_CONTROL_PWR_GOOD 0x08000000 /* R/O */ -+#define BPCM_ZONE_CONTROL_DPG_PWR_STATE 0x10000000 /* R/O */ -+#define BPCM_ZONE_CONTROL_MEM_PWR_STATE 0x20000000 /* R/O */ -+#define BPCM_ZONE_CONTROL_ISO_STATE 0x40000000 /* R/O */ -+#define BPCM_ZONE_CONTROL_RESET_STATE 0x80000000 /* R/O */ -+#define BPCM_ZONE_CONFIG1 0x04 -+#define BPCM_ZONE_CONFIG2 0x08 -+#define BPCM_ZONE_FREQ_SCALAR_CONTROL 0x0c -+#define BPCM_ZONE_SIZE 0x10 -+ -+struct bcm_pmb { -+ struct device *dev; -+ void __iomem *base; -+ spinlock_t lock; -+ bool little_endian; -+ struct genpd_onecell_data genpd_onecell_data; -+}; -+ -+struct bcm_pmb_pd_data { -+ const char * const name; -+ int id; -+ u8 bus; -+ u8 device; -+}; -+ -+struct bcm_pmb_pm_domain { -+ struct bcm_pmb *pmb; -+ const struct bcm_pmb_pd_data *data; -+ struct generic_pm_domain genpd; -+}; -+ -+static int bcm_pmb_bpcm_read(struct bcm_pmb *pmb, int bus, u8 device, -+ int offset, u32 *val) -+{ -+ void __iomem *base = pmb->base + bus * 0x20; -+ unsigned long flags; -+ int err; -+ -+ spin_lock_irqsave(&pmb->lock, flags); -+ err = bpcm_rd(base, device, offset, val); -+ spin_unlock_irqrestore(&pmb->lock, flags); -+ -+ if (!err) -+ *val = pmb->little_endian ? le32_to_cpu(*val) : be32_to_cpu(*val); -+ -+ return err; -+} -+ -+static int bcm_pmb_bpcm_write(struct bcm_pmb *pmb, int bus, u8 device, -+ int offset, u32 val) -+{ -+ void __iomem *base = pmb->base + bus * 0x20; -+ unsigned long flags; -+ int err; -+ -+ val = pmb->little_endian ? cpu_to_le32(val) : cpu_to_be32(val); -+ -+ spin_lock_irqsave(&pmb->lock, flags); -+ err = bpcm_wr(base, device, offset, val); -+ spin_unlock_irqrestore(&pmb->lock, flags); -+ -+ return err; -+} -+ -+static int bcm_pmb_power_off_zone(struct bcm_pmb *pmb, int bus, u8 device, -+ int zone) -+{ -+ int offset; -+ u32 val; -+ int err; -+ -+ offset = BPCM_ZONE0 + zone * BPCM_ZONE_SIZE + BPCM_ZONE_CONTROL; -+ -+ err = bcm_pmb_bpcm_read(pmb, bus, device, offset, &val); -+ if (err) -+ return err; -+ -+ val |= BPCM_ZONE_CONTROL_PWR_DN_REQ; -+ val &= ~BPCM_ZONE_CONTROL_PWR_UP_REQ; -+ -+ err = bcm_pmb_bpcm_write(pmb, bus, device, offset, val); -+ -+ return err; -+} -+ -+static int bcm_pmb_power_on_zone(struct bcm_pmb *pmb, int bus, u8 device, -+ int zone) -+{ -+ int offset; -+ u32 val; -+ int err; -+ -+ offset = BPCM_ZONE0 + zone * BPCM_ZONE_SIZE + BPCM_ZONE_CONTROL; -+ -+ err = bcm_pmb_bpcm_read(pmb, bus, device, offset, &val); -+ if (err) -+ return err; -+ -+ if (!(val & BPCM_ZONE_CONTROL_PWR_ON_STATE)) { -+ val &= ~BPCM_ZONE_CONTROL_PWR_DN_REQ; -+ val |= BPCM_ZONE_CONTROL_DPG_CTL_EN; -+ val |= BPCM_ZONE_CONTROL_PWR_UP_REQ; -+ val |= BPCM_ZONE_CONTROL_MEM_PWR_CTL_EN; -+ val |= BPCM_ZONE_CONTROL_BLK_RESET_ASSERT; -+ -+ err = bcm_pmb_bpcm_write(pmb, bus, device, offset, val); -+ } -+ -+ return err; -+} -+ -+static int bcm_pmb_power_off_device(struct bcm_pmb *pmb, int bus, u8 device) -+{ -+ int offset; -+ u32 val; -+ int err; -+ -+ /* Entire device can be powered off by powering off the 0th zone */ -+ offset = BPCM_ZONE0 + BPCM_ZONE_CONTROL; -+ -+ err = bcm_pmb_bpcm_read(pmb, bus, device, offset, &val); -+ if (err) -+ return err; -+ -+ if (!(val & BPCM_ZONE_CONTROL_PWR_OFF_STATE)) { -+ val = BPCM_ZONE_CONTROL_PWR_DN_REQ; -+ -+ err = bcm_pmb_bpcm_write(pmb, bus, device, offset, val); -+ } -+ -+ return err; -+} -+ -+static int bcm_pmb_power_on_device(struct bcm_pmb *pmb, int bus, u8 device) -+{ -+ u32 val; -+ int err; -+ int i; -+ -+ err = bcm_pmb_bpcm_read(pmb, bus, device, BPCM_CAPABILITIES, &val); -+ if (err) -+ return err; -+ -+ for (i = 0; i < (val & BPCM_CAP_NUM_ZONES); i++) { -+ err = bcm_pmb_power_on_zone(pmb, bus, device, i); -+ if (err) -+ return err; -+ } -+ -+ return err; -+} -+ -+static int bcm_pmb_power_on(struct generic_pm_domain *genpd) -+{ -+ struct bcm_pmb_pm_domain *pd = container_of(genpd, struct bcm_pmb_pm_domain, genpd); -+ const struct bcm_pmb_pd_data *data = pd->data; -+ struct bcm_pmb *pmb = pd->pmb; -+ -+ switch (data->id) { -+ case BCM_PMB_PCIE0: -+ case BCM_PMB_PCIE1: -+ case BCM_PMB_PCIE2: -+ return bcm_pmb_power_on_zone(pmb, data->bus, data->device, 0); -+ case BCM_PMB_HOST_USB: -+ return bcm_pmb_power_on_device(pmb, data->bus, data->device); -+ default: -+ dev_err(pmb->dev, "unsupported device id: %d\n", data->id); -+ return -EINVAL; -+ } -+} -+ -+static int bcm_pmb_power_off(struct generic_pm_domain *genpd) -+{ -+ struct bcm_pmb_pm_domain *pd = container_of(genpd, struct bcm_pmb_pm_domain, genpd); -+ const struct bcm_pmb_pd_data *data = pd->data; -+ struct bcm_pmb *pmb = pd->pmb; -+ -+ switch (data->id) { -+ case BCM_PMB_PCIE0: -+ case BCM_PMB_PCIE1: -+ case BCM_PMB_PCIE2: -+ return bcm_pmb_power_off_zone(pmb, data->bus, data->device, 0); -+ case BCM_PMB_HOST_USB: -+ return bcm_pmb_power_off_device(pmb, data->bus, data->device); -+ default: -+ dev_err(pmb->dev, "unsupported device id: %d\n", data->id); -+ return -EINVAL; -+ } -+} -+ -+static int bcm_pmb_probe(struct platform_device *pdev) -+{ -+ struct device *dev = &pdev->dev; -+ const struct bcm_pmb_pd_data *table; -+ const struct bcm_pmb_pd_data *e; -+ struct resource *res; -+ struct bcm_pmb *pmb; -+ int max_id; -+ int err; -+ -+ pmb = devm_kzalloc(dev, sizeof(*pmb), GFP_KERNEL); -+ if (!pmb) -+ return -ENOMEM; -+ -+ pmb->dev = dev; -+ -+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ pmb->base = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(pmb->base)) -+ return PTR_ERR(pmb->base); -+ -+ spin_lock_init(&pmb->lock); -+ -+ pmb->little_endian = !of_device_is_big_endian(dev->of_node); -+ -+ table = of_device_get_match_data(dev); -+ if (!table) -+ return -EINVAL; -+ -+ max_id = 0; -+ for (e = table; e->name; e++) -+ max_id = max(max_id, e->id); -+ -+ pmb->genpd_onecell_data.num_domains = max_id + 1; -+ pmb->genpd_onecell_data.domains = -+ devm_kcalloc(dev, pmb->genpd_onecell_data.num_domains, -+ sizeof(struct generic_pm_domain *), GFP_KERNEL); -+ if (!pmb->genpd_onecell_data.domains) -+ return -ENOMEM; -+ -+ for (e = table; e->name; e++) { -+ struct bcm_pmb_pm_domain *pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL); -+ -+ pd->pmb = pmb; -+ pd->data = e; -+ pd->genpd.name = e->name; -+ pd->genpd.power_on = bcm_pmb_power_on; -+ pd->genpd.power_off = bcm_pmb_power_off; -+ -+ pm_genpd_init(&pd->genpd, NULL, true); -+ pmb->genpd_onecell_data.domains[e->id] = &pd->genpd; -+ } -+ -+ err = of_genpd_add_provider_onecell(dev->of_node, &pmb->genpd_onecell_data); -+ if (err) { -+ dev_err(dev, "failed to add genpd provider: %d\n", err); -+ return err; -+ } -+ -+ return 0; -+} -+ -+static const struct bcm_pmb_pd_data bcm_pmb_bcm4908_data[] = { -+ { .name = "pcie2", .id = BCM_PMB_PCIE2, .bus = 0, .device = 2, }, -+ { .name = "pcie0", .id = BCM_PMB_PCIE0, .bus = 1, .device = 14, }, -+ { .name = "pcie1", .id = BCM_PMB_PCIE1, .bus = 1, .device = 15, }, -+ { .name = "usb", .id = BCM_PMB_HOST_USB, .bus = 1, .device = 17, }, -+ { }, -+}; -+ -+static const struct of_device_id bcm_pmb_of_match[] = { -+ { .compatible = "brcm,bcm4908-pmb", .data = &bcm_pmb_bcm4908_data, }, -+ { }, -+}; -+ -+static struct platform_driver bcm_pmb_driver = { -+ .driver = { -+ .name = "bcm-pmb", -+ .of_match_table = bcm_pmb_of_match, -+ }, -+ .probe = bcm_pmb_probe, -+}; -+ -+builtin_platform_driver(bcm_pmb_driver); ---- a/drivers/soc/bcm/Kconfig -+++ b/drivers/soc/bcm/Kconfig -@@ -33,6 +33,7 @@ config SOC_BRCMSTB - - If unsure, say N. - -+source "drivers/soc/bcm/bcm63xx/Kconfig" - source "drivers/soc/bcm/brcmstb/Kconfig" - - endmenu ---- a/drivers/soc/bcm/Makefile -+++ b/drivers/soc/bcm/Makefile -@@ -1,4 +1,5 @@ - # SPDX-License-Identifier: GPL-2.0-only - obj-$(CONFIG_BCM2835_POWER) += bcm2835-power.o - obj-$(CONFIG_RASPBERRYPI_POWER) += raspberrypi-power.o -+obj-y += bcm63xx/ - obj-$(CONFIG_SOC_BRCMSTB) += brcmstb/ diff --git a/target/linux/bcm4908/patches-5.4/082-v5.12-0003-soc-bcm-brcmstb-add-stubs-for-getting-platform-IDs.patch b/target/linux/bcm4908/patches-5.4/082-v5.12-0003-soc-bcm-brcmstb-add-stubs-for-getting-platform-IDs.patch deleted file mode 100644 index aab65925b4..0000000000 --- a/target/linux/bcm4908/patches-5.4/082-v5.12-0003-soc-bcm-brcmstb-add-stubs-for-getting-platform-IDs.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 149ae80b1d50e7db5ac7df1cdf0820017b70e716 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Thu, 14 Jan 2021 11:53:18 +0100 -Subject: [PATCH] soc: bcm: brcmstb: add stubs for getting platform IDs -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Some brcmstb drivers may be shared with other SoC families. E.g. the -same USB PHY block is shared by brcmstb and BCM4908. - -To avoid building brcmstb common code on non-brcmstb platforms we need -stubs for: -1. brcmstb_get_family_id() -2. brcmstb_get_product_id() -(to avoid "undefined reference to" errors). - -With this change PHY_BRCM_USB will not have to unconditionally select -SOC_BRCMSTB anymore. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> ---- - include/linux/soc/brcmstb/brcmstb.h | 16 ++++++++++++++++ - 1 file changed, 16 insertions(+) - ---- a/include/linux/soc/brcmstb/brcmstb.h -+++ b/include/linux/soc/brcmstb/brcmstb.h -@@ -2,6 +2,8 @@ - #ifndef __BRCMSTB_SOC_H - #define __BRCMSTB_SOC_H - -+#include <linux/kconfig.h> -+ - static inline u32 BRCM_ID(u32 reg) - { - return reg >> 28 ? reg >> 16 : reg >> 8; -@@ -12,6 +14,8 @@ static inline u32 BRCM_REV(u32 reg) - return reg & 0xff; - } - -+#if IS_ENABLED(CONFIG_SOC_BRCMSTB) -+ - /* - * Helper functions for getting family or product id from the - * SoC driver. -@@ -19,4 +23,16 @@ static inline u32 BRCM_REV(u32 reg) - u32 brcmstb_get_family_id(void); - u32 brcmstb_get_product_id(void); - -+#else -+static inline u32 brcmstb_get_family_id(void) -+{ -+ return 0; -+} -+ -+static inline u32 brcmstb_get_product_id(void) -+{ -+ return 0; -+} -+#endif -+ - #endif /* __BRCMSTB_SOC_H */ diff --git a/target/linux/bcm4908/patches-5.4/083-v5.5-0001-phy-phy-brcm-usb-init-fix-__iomem-annotations.patch b/target/linux/bcm4908/patches-5.4/083-v5.5-0001-phy-phy-brcm-usb-init-fix-__iomem-annotations.patch deleted file mode 100644 index 90f6224386..0000000000 --- a/target/linux/bcm4908/patches-5.4/083-v5.5-0001-phy-phy-brcm-usb-init-fix-__iomem-annotations.patch +++ /dev/null @@ -1,286 +0,0 @@ -From e4b957d3a7c74749e2ccfb3dedb63b81e84b292c Mon Sep 17 00:00:00 2001 -From: Ben Dooks <ben.dooks@codethink.co.uk> -Date: Tue, 15 Oct 2019 17:03:31 +0100 -Subject: [PATCH] phy: phy-brcm-usb-init: fix __iomem annotations - -The register address should have __iomem attributes -so fix this to remove the following sparse warnings: - -drivers/phy/broadcom/phy-brcm-usb-init.c:459:30: warning: cast removes address space '<asn:2>' of expression -drivers/phy/broadcom/phy-brcm-usb-init.c:459:30: warning: incorrect type in argument 2 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:459:30: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:459:30: got void * -drivers/phy/broadcom/phy-brcm-usb-init.c:461:30: warning: cast removes address space '<asn:2>' of expression -drivers/phy/broadcom/phy-brcm-usb-init.c:461:30: warning: incorrect type in argument 2 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:461:30: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:461:30: got void * -drivers/phy/broadcom/phy-brcm-usb-init.c:465:30: warning: cast removes address space '<asn:2>' of expression -drivers/phy/broadcom/phy-brcm-usb-init.c:465:30: warning: incorrect type in argument 2 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:465:30: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:465:30: got void * -drivers/phy/broadcom/phy-brcm-usb-init.c:469:30: warning: cast removes address space '<asn:2>' of expression -drivers/phy/broadcom/phy-brcm-usb-init.c:469:30: warning: incorrect type in argument 1 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:469:30: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:469:30: got void * -drivers/phy/broadcom/phy-brcm-usb-init.c:478:30: warning: cast removes address space '<asn:2>' of expression -drivers/phy/broadcom/phy-brcm-usb-init.c:478:30: warning: incorrect type in argument 2 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:478:30: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:478:30: got void * -drivers/phy/broadcom/phy-brcm-usb-init.c:480:30: warning: cast removes address space '<asn:2>' of expression -drivers/phy/broadcom/phy-brcm-usb-init.c:480:30: warning: incorrect type in argument 2 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:480:30: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:480:30: got void * -drivers/phy/broadcom/phy-brcm-usb-init.c:485:30: warning: cast removes address space '<asn:2>' of expression -drivers/phy/broadcom/phy-brcm-usb-init.c:485:30: warning: incorrect type in argument 2 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:485:30: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:485:30: got void * -drivers/phy/broadcom/phy-brcm-usb-init.c:494:9: warning: cast removes address space '<asn:2>' of expression -drivers/phy/broadcom/phy-brcm-usb-init.c:494:9: warning: incorrect type in argument 1 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:494:9: expected void [noderef] <asn:2> *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:494:9: got void * -drivers/phy/broadcom/phy-brcm-usb-init.c:495:9: warning: cast removes address space '<asn:2>' of expression -drivers/phy/broadcom/phy-brcm-usb-init.c:495:9: warning: incorrect type in argument 1 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:495:9: expected void [noderef] <asn:2> *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:495:9: got void * -drivers/phy/broadcom/phy-brcm-usb-init.c:498:9: warning: cast removes address space '<asn:2>' of expression -drivers/phy/broadcom/phy-brcm-usb-init.c:498:9: warning: incorrect type in argument 1 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:498:9: expected void [noderef] <asn:2> *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:498:9: got void * -drivers/phy/broadcom/phy-brcm-usb-init.c:501:9: warning: cast removes address space '<asn:2>' of expression -drivers/phy/broadcom/phy-brcm-usb-init.c:501:9: warning: incorrect type in argument 1 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:501:9: expected void [noderef] <asn:2> *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:501:9: got void * -drivers/phy/broadcom/phy-brcm-usb-init.c:613:9: warning: cast removes address space '<asn:2>' of expression -drivers/phy/broadcom/phy-brcm-usb-init.c:613:9: warning: incorrect type in argument 1 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:613:9: expected void [noderef] <asn:2> *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:613:9: got void * -drivers/phy/broadcom/phy-brcm-usb-init.c:640:9: warning: cast removes address space '<asn:2>' of expression -drivers/phy/broadcom/phy-brcm-usb-init.c:640:9: warning: incorrect type in argument 1 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:640:9: expected void [noderef] <asn:2> *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:640:9: got void * -drivers/phy/broadcom/phy-brcm-usb-init.c:422:13: warning: incorrect type in assignment (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:422:13: expected void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:422:13: got void [noderef] <asn:2> * -drivers/phy/broadcom/phy-brcm-usb-init.c:423:38: warning: incorrect type in argument 1 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:423:38: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:423:38: got void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:423:52: warning: incorrect type in argument 2 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:423:52: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:423:52: got void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:710:64: warning: Using plain integer as NULL pointer -drivers/phy/broadcom/phy-brcm-usb-init.c:712:32: warning: cast removes address space '<asn:2>' of expression -drivers/phy/broadcom/phy-brcm-usb-init.c:712:32: warning: incorrect type in argument 2 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:712:32: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:712:32: got void * -drivers/phy/broadcom/phy-brcm-usb-init.c:713:29: warning: cast removes address space '<asn:2>' of expression -drivers/phy/broadcom/phy-brcm-usb-init.c:713:29: warning: incorrect type in argument 1 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:713:29: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:713:29: got void * -drivers/phy/broadcom/phy-brcm-usb-init.c:717:29: warning: cast removes address space '<asn:2>' of expression -drivers/phy/broadcom/phy-brcm-usb-init.c:717:29: warning: incorrect type in argument 2 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:717:29: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:717:29: got void * -drivers/phy/broadcom/phy-brcm-usb-init.c:720:9: warning: cast removes address space '<asn:2>' of expression -drivers/phy/broadcom/phy-brcm-usb-init.c:720:9: warning: incorrect type in argument 1 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:720:9: expected void [noderef] <asn:2> *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:720:9: got void * -drivers/phy/broadcom/phy-brcm-usb-init.c:721:9: warning: cast removes address space '<asn:2>' of expression -drivers/phy/broadcom/phy-brcm-usb-init.c:721:9: warning: incorrect type in argument 1 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:721:9: expected void [noderef] <asn:2> *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:721:9: got void * -drivers/phy/broadcom/phy-brcm-usb-init.c:422:13: warning: incorrect type in assignment (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:422:13: expected void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:422:13: got void [noderef] <asn:2> * -drivers/phy/broadcom/phy-brcm-usb-init.c:423:38: warning: incorrect type in argument 1 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:423:38: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:423:38: got void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:423:52: warning: incorrect type in argument 2 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:423:52: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:423:52: got void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:422:13: warning: incorrect type in assignment (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:422:13: expected void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:422:13: got void [noderef] <asn:2> * -drivers/phy/broadcom/phy-brcm-usb-init.c:423:38: warning: incorrect type in argument 1 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:423:38: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:423:38: got void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:423:52: warning: incorrect type in argument 2 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:423:52: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:423:52: got void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:434:13: warning: incorrect type in assignment (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:434:13: expected void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:434:13: got void [noderef] <asn:2> * -drivers/phy/broadcom/phy-brcm-usb-init.c:435:38: warning: incorrect type in argument 1 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:435:38: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:435:38: got void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:435:51: warning: incorrect type in argument 2 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:435:51: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:435:51: got void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:434:13: warning: incorrect type in assignment (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:434:13: expected void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:434:13: got void [noderef] <asn:2> * -drivers/phy/broadcom/phy-brcm-usb-init.c:435:38: warning: incorrect type in argument 1 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:435:38: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:435:38: got void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:435:51: warning: incorrect type in argument 2 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:435:51: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:435:51: got void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:434:13: warning: incorrect type in assignment (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:434:13: expected void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:434:13: got void [noderef] <asn:2> * -drivers/phy/broadcom/phy-brcm-usb-init.c:435:38: warning: incorrect type in argument 1 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:435:38: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:435:38: got void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:435:51: warning: incorrect type in argument 2 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:435:51: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:435:51: got void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:434:13: warning: incorrect type in assignment (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:434:13: expected void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:434:13: got void [noderef] <asn:2> * -drivers/phy/broadcom/phy-brcm-usb-init.c:435:38: warning: incorrect type in argument 1 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:435:38: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:435:38: got void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:435:51: warning: incorrect type in argument 2 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:435:51: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:435:51: got void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:794:29: warning: cast removes address space '<asn:2>' of expression -drivers/phy/broadcom/phy-brcm-usb-init.c:794:29: warning: incorrect type in argument 1 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:794:29: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:794:29: got void * -drivers/phy/broadcom/phy-brcm-usb-init.c:813:29: warning: cast removes address space '<asn:2>' of expression -drivers/phy/broadcom/phy-brcm-usb-init.c:813:29: warning: incorrect type in argument 2 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:813:29: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:813:29: got void * -drivers/phy/broadcom/phy-brcm-usb-init.c:829:37: warning: cast removes address space '<asn:2>' of expression -drivers/phy/broadcom/phy-brcm-usb-init.c:829:37: warning: incorrect type in argument 1 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:829:37: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:829:37: got void * -drivers/phy/broadcom/phy-brcm-usb-init.c:843:37: warning: cast removes address space '<asn:2>' of expression -drivers/phy/broadcom/phy-brcm-usb-init.c:843:37: warning: incorrect type in argument 1 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:843:37: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:843:37: got void * -drivers/phy/broadcom/phy-brcm-usb-init.c:847:37: warning: cast removes address space '<asn:2>' of expression -drivers/phy/broadcom/phy-brcm-usb-init.c:847:37: warning: incorrect type in argument 2 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:847:37: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:847:37: got void * -drivers/phy/broadcom/phy-brcm-usb-init.c:422:13: warning: incorrect type in assignment (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:422:13: expected void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:422:13: got void [noderef] <asn:2> * -drivers/phy/broadcom/phy-brcm-usb-init.c:423:38: warning: incorrect type in argument 1 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:423:38: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:423:38: got void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:423:52: warning: incorrect type in argument 2 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:423:52: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:423:52: got void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:422:13: warning: incorrect type in assignment (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:422:13: expected void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:422:13: got void [noderef] <asn:2> * -drivers/phy/broadcom/phy-brcm-usb-init.c:423:38: warning: incorrect type in argument 1 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:423:38: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:423:38: got void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:423:52: warning: incorrect type in argument 2 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:423:52: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:423:52: got void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:434:13: warning: incorrect type in assignment (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:434:13: expected void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:434:13: got void [noderef] <asn:2> * -drivers/phy/broadcom/phy-brcm-usb-init.c:435:38: warning: incorrect type in argument 1 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:435:38: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:435:38: got void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:435:51: warning: incorrect type in argument 2 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:435:51: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:435:51: got void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:878:9: warning: cast removes address space '<asn:2>' of expression -drivers/phy/broadcom/phy-brcm-usb-init.c:878:9: warning: incorrect type in argument 1 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:878:9: expected void [noderef] <asn:2> *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:878:9: got void * -drivers/phy/broadcom/phy-brcm-usb-init.c:880:29: warning: cast removes address space '<asn:2>' of expression -drivers/phy/broadcom/phy-brcm-usb-init.c:880:29: warning: incorrect type in argument 1 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:880:29: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:880:29: got void * -drivers/phy/broadcom/phy-brcm-usb-init.c:896:29: warning: cast removes address space '<asn:2>' of expression -drivers/phy/broadcom/phy-brcm-usb-init.c:896:29: warning: incorrect type in argument 2 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:896:29: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:896:29: got void * -drivers/phy/broadcom/phy-brcm-usb-init.c:901:37: warning: cast removes address space '<asn:2>' of expression -drivers/phy/broadcom/phy-brcm-usb-init.c:901:37: warning: incorrect type in argument 1 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:901:37: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:901:37: got void * -drivers/phy/broadcom/phy-brcm-usb-init.c:905:37: warning: cast removes address space '<asn:2>' of expression -drivers/phy/broadcom/phy-brcm-usb-init.c:905:37: warning: incorrect type in argument 2 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:905:37: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:905:37: got void * -drivers/phy/broadcom/phy-brcm-usb-init.c:422:13: warning: incorrect type in assignment (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:422:13: expected void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:422:13: got void [noderef] <asn:2> * -drivers/phy/broadcom/phy-brcm-usb-init.c:423:38: warning: incorrect type in argument 1 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:423:38: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:423:38: got void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:423:52: warning: incorrect type in argument 2 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:423:52: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:423:52: got void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:422:13: warning: incorrect type in assignment (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:422:13: expected void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:422:13: got void [noderef] <asn:2> * -drivers/phy/broadcom/phy-brcm-usb-init.c:423:38: warning: incorrect type in argument 1 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:423:38: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:423:38: got void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:423:52: warning: incorrect type in argument 2 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:423:52: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:423:52: got void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:434:13: warning: incorrect type in assignment (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:434:13: expected void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:434:13: got void [noderef] <asn:2> * -drivers/phy/broadcom/phy-brcm-usb-init.c:435:38: warning: incorrect type in argument 1 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:435:38: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:435:38: got void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:435:51: warning: incorrect type in argument 2 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:435:51: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:435:51: got void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:434:13: warning: incorrect type in assignment (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:434:13: expected void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:434:13: got void [noderef] <asn:2> * -drivers/phy/broadcom/phy-brcm-usb-init.c:435:38: warning: incorrect type in argument 1 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:435:38: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:435:38: got void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:435:51: warning: incorrect type in argument 2 (different address spaces) -drivers/phy/broadcom/phy-brcm-usb-init.c:435:51: expected void [noderef] <asn:2> *addr -drivers/phy/broadcom/phy-brcm-usb-init.c:435:51: got void *reg -drivers/phy/broadcom/phy-brcm-usb-init.c:422:13: warning: too many warnings - -Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> -Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> ---- - drivers/phy/broadcom/phy-brcm-usb-init.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - ---- a/drivers/phy/broadcom/phy-brcm-usb-init.c -+++ b/drivers/phy/broadcom/phy-brcm-usb-init.c -@@ -126,8 +126,8 @@ enum { - USB_CTRL_SELECTOR_COUNT, - }; - --#define USB_CTRL_REG(base, reg) ((void *)base + USB_CTRL_##reg) --#define USB_XHCI_EC_REG(base, reg) ((void *)base + USB_XHCI_EC_##reg) -+#define USB_CTRL_REG(base, reg) ((void __iomem *)base + USB_CTRL_##reg) -+#define USB_XHCI_EC_REG(base, reg) ((void __iomem *)base + USB_XHCI_EC_##reg) - #define USB_CTRL_MASK(reg, field) \ - USB_CTRL_##reg##_##field##_MASK - #define USB_CTRL_MASK_FAMILY(params, reg, field) \ -@@ -416,7 +416,7 @@ void usb_ctrl_unset_family(struct brcm_u - u32 reg_offset, u32 field) - { - u32 mask; -- void *reg; -+ void __iomem *reg; - - mask = params->usb_reg_bits_map[field]; - reg = params->ctrl_regs + reg_offset; -@@ -428,7 +428,7 @@ void usb_ctrl_set_family(struct brcm_usb - u32 reg_offset, u32 field) - { - u32 mask; -- void *reg; -+ void __iomem *reg; - - mask = params->usb_reg_bits_map[field]; - reg = params->ctrl_regs + reg_offset; diff --git a/target/linux/bcm4908/patches-5.4/083-v5.5-0002-phy-phy-brcm-usb-init-fix-use-of-integer-as-pointer.patch b/target/linux/bcm4908/patches-5.4/083-v5.5-0002-phy-phy-brcm-usb-init-fix-use-of-integer-as-pointer.patch deleted file mode 100644 index 9252c35fb9..0000000000 --- a/target/linux/bcm4908/patches-5.4/083-v5.5-0002-phy-phy-brcm-usb-init-fix-use-of-integer-as-pointer.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 1025cb924bd517f3c458f36973582d4c2adedd6a Mon Sep 17 00:00:00 2001 -From: Ben Dooks <ben.dooks@codethink.co.uk> -Date: Tue, 15 Oct 2019 17:03:32 +0100 -Subject: [PATCH] phy: phy-brcm-usb-init: fix use of integer as pointer - -The xhci_ec_base variable is a pointer, so don't compare -it with an integer. - -Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> -Reviewed-by: Andrew Murray <andrew.murray@arm.com> -Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> ---- - drivers/phy/broadcom/phy-brcm-usb-init.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/phy/broadcom/phy-brcm-usb-init.c -+++ b/drivers/phy/broadcom/phy-brcm-usb-init.c -@@ -707,7 +707,7 @@ static void brcmusb_usb3_otp_fix(struct - void __iomem *xhci_ec_base = params->xhci_ec_regs; - u32 val; - -- if (params->family_id != 0x74371000 || xhci_ec_base == 0) -+ if (params->family_id != 0x74371000 || !xhci_ec_base) - return; - brcmusb_writel(0xa20c, USB_XHCI_EC_REG(xhci_ec_base, IRAADR)); - val = brcmusb_readl(USB_XHCI_EC_REG(xhci_ec_base, IRADAT)); diff --git a/target/linux/bcm4908/patches-5.4/084-v5.6-0001-phy-usb-EHCI-DMA-may-lose-a-burst-of-DMA-data-for-72.patch b/target/linux/bcm4908/patches-5.4/084-v5.6-0001-phy-usb-EHCI-DMA-may-lose-a-burst-of-DMA-data-for-72.patch deleted file mode 100644 index ac368d5dd1..0000000000 --- a/target/linux/bcm4908/patches-5.4/084-v5.6-0001-phy-usb-EHCI-DMA-may-lose-a-burst-of-DMA-data-for-72.patch +++ /dev/null @@ -1,61 +0,0 @@ -From dc9aa43c43668481089c48135707ec3f8f5b2e19 Mon Sep 17 00:00:00 2001 -From: Al Cooper <alcooperx@gmail.com> -Date: Fri, 3 Jan 2020 13:17:59 -0500 -Subject: [PATCH] phy: usb: EHCI DMA may lose a burst of DMA data for 7255xA0 - family - -When the EHCI controller received a 512 byte USB packet that -had to be broken into 2 256 byte bursts across the SCB bus AND -there was a following 512 byte USB packet, the second burst of -data from the first packet was sometimes being lost. If the -burst size was changed to 128 bytes via the EBR_SCB_SIZE field -in the USB_CTRL_EBRIDGE register we'd see the 4th 128 byte burst -of the first packet being lost. This problem became much worse -if other threads were running that accessed memory, like a memcpy -test. Setting the EBR_SCB_SIZE to 512, which prevents breaking -the EHCI USB packet (max size of 512 bytes) into bursts, fixed -the problem. - -Signed-off-by: Al Cooper <alcooperx@gmail.com> -Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> -Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> ---- - drivers/phy/broadcom/phy-brcm-usb-init.c | 13 +++++++++++++ - 1 file changed, 13 insertions(+) - ---- a/drivers/phy/broadcom/phy-brcm-usb-init.c -+++ b/drivers/phy/broadcom/phy-brcm-usb-init.c -@@ -42,6 +42,7 @@ - #define USB_CTRL_PLL_CTL_PLL_IDDQ_PWRDN_MASK 0x80000000 /* option */ - #define USB_CTRL_EBRIDGE 0x0c - #define USB_CTRL_EBRIDGE_ESTOP_SCB_REQ_MASK 0x00020000 /* option */ -+#define USB_CTRL_EBRIDGE_EBR_SCB_SIZE_MASK 0x00000f80 /* option */ - #define USB_CTRL_OBRIDGE 0x10 - #define USB_CTRL_OBRIDGE_LS_KEEP_ALIVE_MASK 0x08000000 - #define USB_CTRL_MDIO 0x14 -@@ -176,6 +177,7 @@ static const struct id_to_type id_to_typ - { 0x33900000, BRCM_FAMILY_3390A0 }, - { 0x72500010, BRCM_FAMILY_7250B0 }, - { 0x72600000, BRCM_FAMILY_7260A0 }, -+ { 0x72550000, BRCM_FAMILY_7260A0 }, - { 0x72680000, BRCM_FAMILY_7271A0 }, - { 0x72710000, BRCM_FAMILY_7271A0 }, - { 0x73640000, BRCM_FAMILY_7364A0 }, -@@ -948,6 +950,17 @@ void brcm_usb_init_eohci(struct brcm_usb - if (params->selected_family == BRCM_FAMILY_7271A0) - /* Enable LS keep alive fix for certain keyboards */ - USB_CTRL_SET(ctrl, OBRIDGE, LS_KEEP_ALIVE); -+ -+ if (params->family_id == 0x72550000) { -+ /* -+ * Make the burst size 512 bytes to fix a hardware bug -+ * on the 7255a0. See HW7255-24. -+ */ -+ reg = brcmusb_readl(USB_CTRL_REG(ctrl, EBRIDGE)); -+ reg &= ~USB_CTRL_MASK(EBRIDGE, EBR_SCB_SIZE); -+ reg |= 0x800; -+ brcmusb_writel(reg, USB_CTRL_REG(ctrl, EBRIDGE)); -+ } - } - - void brcm_usb_init_xhci(struct brcm_usb_init_params *params) diff --git a/target/linux/bcm4908/patches-5.4/084-v5.6-0002-phy-usb-Get-all-drivers-that-use-USB-clks-using-corr.patch b/target/linux/bcm4908/patches-5.4/084-v5.6-0002-phy-usb-Get-all-drivers-that-use-USB-clks-using-corr.patch deleted file mode 100644 index e269f80cf4..0000000000 --- a/target/linux/bcm4908/patches-5.4/084-v5.6-0002-phy-usb-Get-all-drivers-that-use-USB-clks-using-corr.patch +++ /dev/null @@ -1,102 +0,0 @@ -From ece5ffd9e15e9c8471e58b581a098032a679d34e Mon Sep 17 00:00:00 2001 -From: Al Cooper <alcooperx@gmail.com> -Date: Fri, 3 Jan 2020 13:18:00 -0500 -Subject: [PATCH] phy: usb: Get all drivers that use USB clks using correct - enable/disable - -The BRCM USB Phy, ohci, ehci and xhci drivers all use the USB clocks -but not all drivers use the clk_prepare_enable/clk_disable_unprepare -versions to enable/disable the clocks. This change gets all drivers -using the prepare version. - -Signed-off-by: Al Cooper <alcooperx@gmail.com> -Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> -Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> ---- - drivers/phy/broadcom/phy-brcm-usb.c | 28 ++++++++++++++-------------- - 1 file changed, 14 insertions(+), 14 deletions(-) - ---- a/drivers/phy/broadcom/phy-brcm-usb.c -+++ b/drivers/phy/broadcom/phy-brcm-usb.c -@@ -74,8 +74,8 @@ static int brcm_usb_phy_init(struct phy - */ - mutex_lock(&priv->mutex); - if (priv->init_count++ == 0) { -- clk_enable(priv->usb_20_clk); -- clk_enable(priv->usb_30_clk); -+ clk_prepare_enable(priv->usb_20_clk); -+ clk_prepare_enable(priv->usb_30_clk); - brcm_usb_init_common(&priv->ini); - } - mutex_unlock(&priv->mutex); -@@ -106,8 +106,8 @@ static int brcm_usb_phy_exit(struct phy - mutex_lock(&priv->mutex); - if (--priv->init_count == 0) { - brcm_usb_uninit_common(&priv->ini); -- clk_disable(priv->usb_20_clk); -- clk_disable(priv->usb_30_clk); -+ clk_disable_unprepare(priv->usb_20_clk); -+ clk_disable_unprepare(priv->usb_30_clk); - } - mutex_unlock(&priv->mutex); - phy->inited = false; -@@ -360,8 +360,8 @@ static int brcm_usb_phy_probe(struct pla - if (priv->has_eohci) - brcm_usb_uninit_eohci(&priv->ini); - brcm_usb_uninit_common(&priv->ini); -- clk_disable(priv->usb_20_clk); -- clk_disable(priv->usb_30_clk); -+ clk_disable_unprepare(priv->usb_20_clk); -+ clk_disable_unprepare(priv->usb_30_clk); - - phy_provider = devm_of_phy_provider_register(dev, brcm_usb_phy_xlate); - -@@ -381,8 +381,8 @@ static int brcm_usb_phy_suspend(struct d - struct brcm_usb_phy_data *priv = dev_get_drvdata(dev); - - if (priv->init_count) { -- clk_disable(priv->usb_20_clk); -- clk_disable(priv->usb_30_clk); -+ clk_disable_unprepare(priv->usb_20_clk); -+ clk_disable_unprepare(priv->usb_30_clk); - } - return 0; - } -@@ -391,8 +391,8 @@ static int brcm_usb_phy_resume(struct de - { - struct brcm_usb_phy_data *priv = dev_get_drvdata(dev); - -- clk_enable(priv->usb_20_clk); -- clk_enable(priv->usb_30_clk); -+ clk_prepare_enable(priv->usb_20_clk); -+ clk_prepare_enable(priv->usb_30_clk); - brcm_usb_init_ipp(&priv->ini); - - /* -@@ -405,13 +405,13 @@ static int brcm_usb_phy_resume(struct de - brcm_usb_init_eohci(&priv->ini); - } else if (priv->has_eohci) { - brcm_usb_uninit_eohci(&priv->ini); -- clk_disable(priv->usb_20_clk); -+ clk_disable_unprepare(priv->usb_20_clk); - } - if (priv->phys[BRCM_USB_PHY_3_0].inited) { - brcm_usb_init_xhci(&priv->ini); - } else if (priv->has_xhci) { - brcm_usb_uninit_xhci(&priv->ini); -- clk_disable(priv->usb_30_clk); -+ clk_disable_unprepare(priv->usb_30_clk); - } - } else { - if (priv->has_xhci) -@@ -419,8 +419,8 @@ static int brcm_usb_phy_resume(struct de - if (priv->has_eohci) - brcm_usb_uninit_eohci(&priv->ini); - brcm_usb_uninit_common(&priv->ini); -- clk_disable(priv->usb_20_clk); -- clk_disable(priv->usb_30_clk); -+ clk_disable_unprepare(priv->usb_20_clk); -+ clk_disable_unprepare(priv->usb_30_clk); - } - - return 0; diff --git a/target/linux/bcm4908/patches-5.4/084-v5.6-0003-phy-usb-Put-USB-phys-into-IDDQ-on-suspend-to-save-po.patch b/target/linux/bcm4908/patches-5.4/084-v5.6-0003-phy-usb-Put-USB-phys-into-IDDQ-on-suspend-to-save-po.patch deleted file mode 100644 index 356e305460..0000000000 --- a/target/linux/bcm4908/patches-5.4/084-v5.6-0003-phy-usb-Put-USB-phys-into-IDDQ-on-suspend-to-save-po.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 6597af4e4835ec0709638d48f73c11b5c624790f Mon Sep 17 00:00:00 2001 -From: Al Cooper <alcooperx@gmail.com> -Date: Fri, 3 Jan 2020 13:18:01 -0500 -Subject: [PATCH] phy: usb: Put USB phys into IDDQ on suspend to save power in - S2 mode - -Currently the Phy driver will put the USB phys into the max -power saving mode (IDDQ) when there is no corresponding XHCI, EHCI -or OHCI client (through rmmod, unbind or if the driver is not -builtin). This change will also put the Phys into IDDQ mode -on suspend so that S2 will get the additional power savings. - -Signed-off-by: Al Cooper <alcooperx@gmail.com> -Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> -Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> ---- - drivers/phy/broadcom/phy-brcm-usb-init.c | 2 -- - drivers/phy/broadcom/phy-brcm-usb.c | 11 +++++++++-- - 2 files changed, 9 insertions(+), 4 deletions(-) - ---- a/drivers/phy/broadcom/phy-brcm-usb-init.c -+++ b/drivers/phy/broadcom/phy-brcm-usb-init.c -@@ -1002,8 +1002,6 @@ void brcm_usb_uninit_common(struct brcm_ - - void brcm_usb_uninit_eohci(struct brcm_usb_init_params *params) - { -- if (USB_CTRL_MASK_FAMILY(params, USB_PM, USB20_HC_RESETB)) -- USB_CTRL_UNSET_FAMILY(params, USB_PM, USB20_HC_RESETB); - } - - void brcm_usb_uninit_xhci(struct brcm_usb_init_params *params) ---- a/drivers/phy/broadcom/phy-brcm-usb.c -+++ b/drivers/phy/broadcom/phy-brcm-usb.c -@@ -381,8 +381,15 @@ static int brcm_usb_phy_suspend(struct d - struct brcm_usb_phy_data *priv = dev_get_drvdata(dev); - - if (priv->init_count) { -- clk_disable_unprepare(priv->usb_20_clk); -- clk_disable_unprepare(priv->usb_30_clk); -+ if (priv->phys[BRCM_USB_PHY_3_0].inited) -+ brcm_usb_uninit_xhci(&priv->ini); -+ if (priv->phys[BRCM_USB_PHY_2_0].inited) -+ brcm_usb_uninit_eohci(&priv->ini); -+ brcm_usb_uninit_common(&priv->ini); -+ if (priv->phys[BRCM_USB_PHY_3_0].inited) -+ clk_disable_unprepare(priv->usb_30_clk); -+ if (priv->phys[BRCM_USB_PHY_2_0].inited) -+ clk_disable_unprepare(priv->usb_20_clk); - } - return 0; - } diff --git a/target/linux/bcm4908/patches-5.4/084-v5.6-0004-phy-usb-Add-wake-on-functionality.patch b/target/linux/bcm4908/patches-5.4/084-v5.6-0004-phy-usb-Add-wake-on-functionality.patch deleted file mode 100644 index d52edfef77..0000000000 --- a/target/linux/bcm4908/patches-5.4/084-v5.6-0004-phy-usb-Add-wake-on-functionality.patch +++ /dev/null @@ -1,205 +0,0 @@ -From f1c0db40a3ade1f1a39e5794d728f2953d817322 Mon Sep 17 00:00:00 2001 -From: Al Cooper <alcooperx@gmail.com> -Date: Fri, 3 Jan 2020 13:18:02 -0500 -Subject: [PATCH] phy: usb: Add "wake on" functionality - -Add the ability to handle USB wake events from USB devices when -in S2 mode. Typically there is some additional configuration -needed to tell the USB device to generate the wake event when -suspended but this varies with the different USB device classes. -For example, on USB Ethernet dongles, ethtool should be used to -enable the magic packet wake functionality in the dongle. -NOTE: This requires that the "power/wakeup" sysfs entry for -the USB device generating the wakeup be set to "enabled". - -This functionality requires a special hardware sideband path that -will trigger the AON_PM_L2 interrupt needed to wake the system from -S2 even though the USB host controllers are in IDDQ (low power state) -and most USB related clocks are shut off. For the sideband signaling -to work we need to leave the usbx_freerun clock running, but this -clock consumes very little power by design. There's a bug in the -XHCI wake hardware so only EHCI/OHCI wake is currently supported. - -Signed-off-by: Al Cooper <alcooperx@gmail.com> -Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> -Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> ---- - drivers/phy/broadcom/phy-brcm-usb-init.c | 17 +++++++++ - drivers/phy/broadcom/phy-brcm-usb-init.h | 1 + - drivers/phy/broadcom/phy-brcm-usb.c | 48 ++++++++++++++++++++++-- - 3 files changed, 63 insertions(+), 3 deletions(-) - ---- a/drivers/phy/broadcom/phy-brcm-usb-init.c -+++ b/drivers/phy/broadcom/phy-brcm-usb-init.c -@@ -58,6 +58,8 @@ - #define USB_CTRL_USB_PM_SOFT_RESET_MASK 0x40000000 /* option */ - #define USB_CTRL_USB_PM_USB20_HC_RESETB_MASK 0x30000000 /* option */ - #define USB_CTRL_USB_PM_USB20_HC_RESETB_VAR_MASK 0x00300000 /* option */ -+#define USB_CTRL_USB_PM_RMTWKUP_EN_MASK 0x00000001 -+#define USB_CTRL_USB_PM_STATUS 0x38 - #define USB_CTRL_USB30_CTL1 0x60 - #define USB_CTRL_USB30_CTL1_PHY3_PLL_SEQ_START_MASK 0x00000010 - #define USB_CTRL_USB30_CTL1_PHY3_RESETB_MASK 0x00010000 -@@ -855,6 +857,10 @@ void brcm_usb_init_common(struct brcm_us - u32 reg; - void __iomem *ctrl = params->ctrl_regs; - -+ /* Clear any pending wake conditions */ -+ reg = brcmusb_readl(USB_CTRL_REG(ctrl, USB_PM_STATUS)); -+ brcmusb_writel(reg, USB_CTRL_REG(ctrl, USB_PM_STATUS)); -+ - /* Take USB out of power down */ - if (USB_CTRL_MASK_FAMILY(params, PLL_CTL, PLL_IDDQ_PWRDN)) { - USB_CTRL_UNSET_FAMILY(params, PLL_CTL, PLL_IDDQ_PWRDN); -@@ -1010,6 +1016,17 @@ void brcm_usb_uninit_xhci(struct brcm_us - USB_CTRL_SET(params->ctrl_regs, USB30_PCTL, PHY3_IDDQ_OVERRIDE); - } - -+void brcm_usb_wake_enable(struct brcm_usb_init_params *params, -+ int enable) -+{ -+ void __iomem *ctrl = params->ctrl_regs; -+ -+ if (enable) -+ USB_CTRL_SET(ctrl, USB_PM, RMTWKUP_EN); -+ else -+ USB_CTRL_UNSET(ctrl, USB_PM, RMTWKUP_EN); -+} -+ - void brcm_usb_set_family_map(struct brcm_usb_init_params *params) - { - int fam; ---- a/drivers/phy/broadcom/phy-brcm-usb-init.h -+++ b/drivers/phy/broadcom/phy-brcm-usb-init.h -@@ -38,5 +38,6 @@ void brcm_usb_init_xhci(struct brcm_usb_ - void brcm_usb_uninit_common(struct brcm_usb_init_params *ini); - void brcm_usb_uninit_eohci(struct brcm_usb_init_params *ini); - void brcm_usb_uninit_xhci(struct brcm_usb_init_params *ini); -+void brcm_usb_wake_enable(struct brcm_usb_init_params *params, int enable); - - #endif /* _USB_BRCM_COMMON_INIT_H */ ---- a/drivers/phy/broadcom/phy-brcm-usb.c -+++ b/drivers/phy/broadcom/phy-brcm-usb.c -@@ -57,11 +57,22 @@ struct brcm_usb_phy_data { - bool has_xhci; - struct clk *usb_20_clk; - struct clk *usb_30_clk; -+ struct clk *suspend_clk; - struct mutex mutex; /* serialize phy init */ - int init_count; -+ int wake_irq; - struct brcm_usb_phy phys[BRCM_USB_PHY_ID_MAX]; - }; - -+static irqreturn_t brcm_usb_phy_wake_isr(int irq, void *dev_id) -+{ -+ struct phy *gphy = dev_id; -+ -+ pm_wakeup_event(&gphy->dev, 0); -+ -+ return IRQ_HANDLED; -+} -+ - static int brcm_usb_phy_init(struct phy *gphy) - { - struct brcm_usb_phy *phy = phy_get_drvdata(gphy); -@@ -76,6 +87,7 @@ static int brcm_usb_phy_init(struct phy - if (priv->init_count++ == 0) { - clk_prepare_enable(priv->usb_20_clk); - clk_prepare_enable(priv->usb_30_clk); -+ clk_prepare_enable(priv->suspend_clk); - brcm_usb_init_common(&priv->ini); - } - mutex_unlock(&priv->mutex); -@@ -108,6 +120,7 @@ static int brcm_usb_phy_exit(struct phy - brcm_usb_uninit_common(&priv->ini); - clk_disable_unprepare(priv->usb_20_clk); - clk_disable_unprepare(priv->usb_30_clk); -+ clk_disable_unprepare(priv->suspend_clk); - } - mutex_unlock(&priv->mutex); - phy->inited = false; -@@ -228,11 +241,12 @@ static const struct attribute_group brcm - .attrs = brcm_usb_phy_attrs, - }; - --static int brcm_usb_phy_dvr_init(struct device *dev, -+static int brcm_usb_phy_dvr_init(struct platform_device *pdev, - struct brcm_usb_phy_data *priv, - struct device_node *dn) - { -- struct phy *gphy; -+ struct device *dev = &pdev->dev; -+ struct phy *gphy = NULL; - int err; - - priv->usb_20_clk = of_clk_get_by_name(dn, "sw_usb"); -@@ -275,6 +289,28 @@ static int brcm_usb_phy_dvr_init(struct - if (err) - return err; - } -+ -+ priv->suspend_clk = clk_get(dev, "usb0_freerun"); -+ if (IS_ERR(priv->suspend_clk)) { -+ dev_err(dev, "Suspend Clock not found in Device Tree\n"); -+ priv->suspend_clk = NULL; -+ } -+ -+ priv->wake_irq = platform_get_irq_byname(pdev, "wake"); -+ if (priv->wake_irq < 0) -+ priv->wake_irq = platform_get_irq_byname(pdev, "wakeup"); -+ if (priv->wake_irq >= 0) { -+ err = devm_request_irq(dev, priv->wake_irq, -+ brcm_usb_phy_wake_isr, 0, -+ dev_name(dev), gphy); -+ if (err < 0) -+ return err; -+ device_set_wakeup_capable(dev, 1); -+ } else { -+ dev_info(dev, -+ "Wake interrupt missing, system wake not supported\n"); -+ } -+ - return 0; - } - -@@ -335,7 +371,7 @@ static int brcm_usb_phy_probe(struct pla - if (of_property_read_bool(dn, "brcm,has-eohci")) - priv->has_eohci = true; - -- err = brcm_usb_phy_dvr_init(dev, priv, dn); -+ err = brcm_usb_phy_dvr_init(pdev, priv, dn); - if (err) - return err; - -@@ -386,10 +422,13 @@ static int brcm_usb_phy_suspend(struct d - if (priv->phys[BRCM_USB_PHY_2_0].inited) - brcm_usb_uninit_eohci(&priv->ini); - brcm_usb_uninit_common(&priv->ini); -+ brcm_usb_wake_enable(&priv->ini, true); - if (priv->phys[BRCM_USB_PHY_3_0].inited) - clk_disable_unprepare(priv->usb_30_clk); - if (priv->phys[BRCM_USB_PHY_2_0].inited) - clk_disable_unprepare(priv->usb_20_clk); -+ if (priv->wake_irq >= 0) -+ enable_irq_wake(priv->wake_irq); - } - return 0; - } -@@ -400,6 +439,7 @@ static int brcm_usb_phy_resume(struct de - - clk_prepare_enable(priv->usb_20_clk); - clk_prepare_enable(priv->usb_30_clk); -+ brcm_usb_wake_enable(&priv->ini, false); - brcm_usb_init_ipp(&priv->ini); - - /* -@@ -407,6 +447,8 @@ static int brcm_usb_phy_resume(struct de - * Uninitialize anything that wasn't previously initialized. - */ - if (priv->init_count) { -+ if (priv->wake_irq >= 0) -+ disable_irq_wake(priv->wake_irq); - brcm_usb_init_common(&priv->ini); - if (priv->phys[BRCM_USB_PHY_2_0].inited) { - brcm_usb_init_eohci(&priv->ini); diff --git a/target/linux/bcm4908/patches-5.4/084-v5.6-0005-phy-usb-Restructure-in-preparation-for-adding-7216-U.patch b/target/linux/bcm4908/patches-5.4/084-v5.6-0005-phy-usb-Restructure-in-preparation-for-adding-7216-U.patch deleted file mode 100644 index 2a63556122..0000000000 --- a/target/linux/bcm4908/patches-5.4/084-v5.6-0005-phy-usb-Restructure-in-preparation-for-adding-7216-U.patch +++ /dev/null @@ -1,611 +0,0 @@ -From 94583a41047eb9489f576344b8ba9370cf4cbfb7 Mon Sep 17 00:00:00 2001 -From: Al Cooper <alcooperx@gmail.com> -Date: Fri, 3 Jan 2020 13:18:03 -0500 -Subject: [PATCH] phy: usb: Restructure in preparation for adding 7216 USB - support - -The driver is being restructured in preparation for adding support -for the new Synopsys USB conroller on the 7216. Since all the bugs -and work-arounds in previous STB chips are supposed to be fixed, -most of the code in phy-brcm-usb-init.c is not needed. Instead of -adding more complexity to the already complicated phy-brcm-usb-init.c -module, the driver will be restructured to use a vector table to -dispatch into different C modules for the different controllers. - -There was also some general cleanup done including some ipp setup -code that was incorrect. - -Signed-off-by: Al Cooper <alcooperx@gmail.com> -Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> -Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> ---- - drivers/phy/broadcom/phy-brcm-usb-init.c | 191 ++++++++++------------- - drivers/phy/broadcom/phy-brcm-usb-init.h | 140 +++++++++++++++-- - drivers/phy/broadcom/phy-brcm-usb.c | 6 +- - 3 files changed, 214 insertions(+), 123 deletions(-) - ---- a/drivers/phy/broadcom/phy-brcm-usb-init.c -+++ b/drivers/phy/broadcom/phy-brcm-usb-init.c -@@ -129,10 +129,6 @@ enum { - USB_CTRL_SELECTOR_COUNT, - }; - --#define USB_CTRL_REG(base, reg) ((void __iomem *)base + USB_CTRL_##reg) --#define USB_XHCI_EC_REG(base, reg) ((void __iomem *)base + USB_XHCI_EC_##reg) --#define USB_CTRL_MASK(reg, field) \ -- USB_CTRL_##reg##_##field##_MASK - #define USB_CTRL_MASK_FAMILY(params, reg, field) \ - (params->usb_reg_bits_map[USB_CTRL_##reg##_##field##_SELECTOR]) - -@@ -143,13 +139,6 @@ enum { - usb_ctrl_unset_family(params, USB_CTRL_##reg, \ - USB_CTRL_##reg##_##field##_SELECTOR) - --#define USB_CTRL_SET(base, reg, field) \ -- usb_ctrl_set(USB_CTRL_REG(base, reg), \ -- USB_CTRL_##reg##_##field##_MASK) --#define USB_CTRL_UNSET(base, reg, field) \ -- usb_ctrl_unset(USB_CTRL_REG(base, reg), \ -- USB_CTRL_##reg##_##field##_MASK) -- - #define MDIO_USB2 0 - #define MDIO_USB3 BIT(31) - -@@ -405,26 +394,14 @@ usb_reg_bits_map_table[BRCM_FAMILY_COUNT - }, - }; - --static inline u32 brcmusb_readl(void __iomem *addr) --{ -- return readl(addr); --} -- --static inline void brcmusb_writel(u32 val, void __iomem *addr) --{ -- writel(val, addr); --} -- - static inline - void usb_ctrl_unset_family(struct brcm_usb_init_params *params, - u32 reg_offset, u32 field) - { - u32 mask; -- void __iomem *reg; - - mask = params->usb_reg_bits_map[field]; -- reg = params->ctrl_regs + reg_offset; -- brcmusb_writel(brcmusb_readl(reg) & ~mask, reg); -+ brcm_usb_ctrl_unset(params->ctrl_regs + reg_offset, mask); - }; - - static inline -@@ -432,45 +409,27 @@ void usb_ctrl_set_family(struct brcm_usb - u32 reg_offset, u32 field) - { - u32 mask; -- void __iomem *reg; - - mask = params->usb_reg_bits_map[field]; -- reg = params->ctrl_regs + reg_offset; -- brcmusb_writel(brcmusb_readl(reg) | mask, reg); -+ brcm_usb_ctrl_set(params->ctrl_regs + reg_offset, mask); - }; - --static inline void usb_ctrl_set(void __iomem *reg, u32 field) --{ -- u32 value; -- -- value = brcmusb_readl(reg); -- brcmusb_writel(value | field, reg); --} -- --static inline void usb_ctrl_unset(void __iomem *reg, u32 field) --{ -- u32 value; -- -- value = brcmusb_readl(reg); -- brcmusb_writel(value & ~field, reg); --} -- - static u32 brcmusb_usb_mdio_read(void __iomem *ctrl_base, u32 reg, int mode) - { - u32 data; - - data = (reg << 16) | mode; -- brcmusb_writel(data, USB_CTRL_REG(ctrl_base, MDIO)); -+ brcm_usb_writel(data, USB_CTRL_REG(ctrl_base, MDIO)); - data |= (1 << 24); -- brcmusb_writel(data, USB_CTRL_REG(ctrl_base, MDIO)); -+ brcm_usb_writel(data, USB_CTRL_REG(ctrl_base, MDIO)); - data &= ~(1 << 24); - /* wait for the 60MHz parallel to serial shifter */ - usleep_range(10, 20); -- brcmusb_writel(data, USB_CTRL_REG(ctrl_base, MDIO)); -+ brcm_usb_writel(data, USB_CTRL_REG(ctrl_base, MDIO)); - /* wait for the 60MHz parallel to serial shifter */ - usleep_range(10, 20); - -- return brcmusb_readl(USB_CTRL_REG(ctrl_base, MDIO2)) & 0xffff; -+ return brcm_usb_readl(USB_CTRL_REG(ctrl_base, MDIO2)) & 0xffff; - } - - static void brcmusb_usb_mdio_write(void __iomem *ctrl_base, u32 reg, -@@ -479,14 +438,14 @@ static void brcmusb_usb_mdio_write(void - u32 data; - - data = (reg << 16) | val | mode; -- brcmusb_writel(data, USB_CTRL_REG(ctrl_base, MDIO)); -+ brcm_usb_writel(data, USB_CTRL_REG(ctrl_base, MDIO)); - data |= (1 << 25); -- brcmusb_writel(data, USB_CTRL_REG(ctrl_base, MDIO)); -+ brcm_usb_writel(data, USB_CTRL_REG(ctrl_base, MDIO)); - data &= ~(1 << 25); - - /* wait for the 60MHz parallel to serial shifter */ - usleep_range(10, 20); -- brcmusb_writel(data, USB_CTRL_REG(ctrl_base, MDIO)); -+ brcm_usb_writel(data, USB_CTRL_REG(ctrl_base, MDIO)); - /* wait for the 60MHz parallel to serial shifter */ - usleep_range(10, 20); - } -@@ -713,12 +672,12 @@ static void brcmusb_usb3_otp_fix(struct - - if (params->family_id != 0x74371000 || !xhci_ec_base) - return; -- brcmusb_writel(0xa20c, USB_XHCI_EC_REG(xhci_ec_base, IRAADR)); -- val = brcmusb_readl(USB_XHCI_EC_REG(xhci_ec_base, IRADAT)); -+ brcm_usb_writel(0xa20c, USB_XHCI_EC_REG(xhci_ec_base, IRAADR)); -+ val = brcm_usb_readl(USB_XHCI_EC_REG(xhci_ec_base, IRADAT)); - - /* set cfg_pick_ss_lock */ - val |= (1 << 27); -- brcmusb_writel(val, USB_XHCI_EC_REG(xhci_ec_base, IRADAT)); -+ brcm_usb_writel(val, USB_XHCI_EC_REG(xhci_ec_base, IRADAT)); - - /* Reset USB 3.0 PHY for workaround to take effect */ - USB_CTRL_UNSET(params->ctrl_regs, USB30_CTL1, PHY3_RESETB); -@@ -751,7 +710,7 @@ static void brcmusb_xhci_soft_reset(stru - * - default chip/rev. - * NOTE: The minor rev is always ignored. - */ --static enum brcm_family_type brcmusb_get_family_type( -+static enum brcm_family_type get_family_type( - struct brcm_usb_init_params *params) - { - int last_type = -1; -@@ -779,7 +738,7 @@ static enum brcm_family_type brcmusb_get - return last_type; - } - --void brcm_usb_init_ipp(struct brcm_usb_init_params *params) -+static void usb_init_ipp(struct brcm_usb_init_params *params) - { - void __iomem *ctrl = params->ctrl_regs; - u32 reg; -@@ -795,7 +754,7 @@ void brcm_usb_init_ipp(struct brcm_usb_i - USB_CTRL_SET_FAMILY(params, USB30_CTL1, USB3_IPP); - } - -- reg = brcmusb_readl(USB_CTRL_REG(ctrl, SETUP)); -+ reg = brcm_usb_readl(USB_CTRL_REG(ctrl, SETUP)); - orig_reg = reg; - if (USB_CTRL_MASK_FAMILY(params, SETUP, STRAP_CC_DRD_MODE_ENABLE_SEL)) - /* Never use the strap, it's going away. */ -@@ -803,8 +762,8 @@ void brcm_usb_init_ipp(struct brcm_usb_i - SETUP, - STRAP_CC_DRD_MODE_ENABLE_SEL)); - if (USB_CTRL_MASK_FAMILY(params, SETUP, STRAP_IPP_SEL)) -+ /* override ipp strap pin (if it exits) */ - if (params->ipp != 2) -- /* override ipp strap pin (if it exits) */ - reg &= ~(USB_CTRL_MASK_FAMILY(params, SETUP, - STRAP_IPP_SEL)); - -@@ -812,54 +771,26 @@ void brcm_usb_init_ipp(struct brcm_usb_i - reg &= ~(USB_CTRL_MASK(SETUP, IPP) | USB_CTRL_MASK(SETUP, IOC)); - if (params->ioc) - reg |= USB_CTRL_MASK(SETUP, IOC); -- if (params->ipp == 1 && ((reg & USB_CTRL_MASK(SETUP, IPP)) == 0)) -+ if (params->ipp == 1) - reg |= USB_CTRL_MASK(SETUP, IPP); -- brcmusb_writel(reg, USB_CTRL_REG(ctrl, SETUP)); -+ brcm_usb_writel(reg, USB_CTRL_REG(ctrl, SETUP)); - - /* - * If we're changing IPP, make sure power is off long enough - * to turn off any connected devices. - */ -- if (reg != orig_reg) -+ if ((reg ^ orig_reg) & USB_CTRL_MASK(SETUP, IPP)) - msleep(50); - } - --int brcm_usb_init_get_dual_select(struct brcm_usb_init_params *params) --{ -- void __iomem *ctrl = params->ctrl_regs; -- u32 reg = 0; -- -- if (USB_CTRL_MASK_FAMILY(params, USB_DEVICE_CTL1, PORT_MODE)) { -- reg = brcmusb_readl(USB_CTRL_REG(ctrl, USB_DEVICE_CTL1)); -- reg &= USB_CTRL_MASK_FAMILY(params, USB_DEVICE_CTL1, -- PORT_MODE); -- } -- return reg; --} -- --void brcm_usb_init_set_dual_select(struct brcm_usb_init_params *params, -- int mode) --{ -- void __iomem *ctrl = params->ctrl_regs; -- u32 reg; -- -- if (USB_CTRL_MASK_FAMILY(params, USB_DEVICE_CTL1, PORT_MODE)) { -- reg = brcmusb_readl(USB_CTRL_REG(ctrl, USB_DEVICE_CTL1)); -- reg &= ~USB_CTRL_MASK_FAMILY(params, USB_DEVICE_CTL1, -- PORT_MODE); -- reg |= mode; -- brcmusb_writel(reg, USB_CTRL_REG(ctrl, USB_DEVICE_CTL1)); -- } --} -- --void brcm_usb_init_common(struct brcm_usb_init_params *params) -+static void usb_init_common(struct brcm_usb_init_params *params) - { - u32 reg; - void __iomem *ctrl = params->ctrl_regs; - - /* Clear any pending wake conditions */ -- reg = brcmusb_readl(USB_CTRL_REG(ctrl, USB_PM_STATUS)); -- brcmusb_writel(reg, USB_CTRL_REG(ctrl, USB_PM_STATUS)); -+ reg = brcm_usb_readl(USB_CTRL_REG(ctrl, USB_PM_STATUS)); -+ brcm_usb_writel(reg, USB_CTRL_REG(ctrl, USB_PM_STATUS)); - - /* Take USB out of power down */ - if (USB_CTRL_MASK_FAMILY(params, PLL_CTL, PLL_IDDQ_PWRDN)) { -@@ -885,7 +816,7 @@ void brcm_usb_init_common(struct brcm_us - /* Block auto PLL suspend by USB2 PHY (Sasi) */ - USB_CTRL_SET(ctrl, PLL_CTL, PLL_SUSPEND_EN); - -- reg = brcmusb_readl(USB_CTRL_REG(ctrl, SETUP)); -+ reg = brcm_usb_readl(USB_CTRL_REG(ctrl, SETUP)); - if (params->selected_family == BRCM_FAMILY_7364A0) - /* Suppress overcurrent indication from USB30 ports for A0 */ - reg |= USB_CTRL_MASK_FAMILY(params, SETUP, OC3_DISABLE); -@@ -901,16 +832,16 @@ void brcm_usb_init_common(struct brcm_us - reg |= USB_CTRL_MASK_FAMILY(params, SETUP, SCB1_EN); - if (USB_CTRL_MASK_FAMILY(params, SETUP, SCB2_EN)) - reg |= USB_CTRL_MASK_FAMILY(params, SETUP, SCB2_EN); -- brcmusb_writel(reg, USB_CTRL_REG(ctrl, SETUP)); -+ brcm_usb_writel(reg, USB_CTRL_REG(ctrl, SETUP)); - - brcmusb_memc_fix(params); - - if (USB_CTRL_MASK_FAMILY(params, USB_DEVICE_CTL1, PORT_MODE)) { -- reg = brcmusb_readl(USB_CTRL_REG(ctrl, USB_DEVICE_CTL1)); -+ reg = brcm_usb_readl(USB_CTRL_REG(ctrl, USB_DEVICE_CTL1)); - reg &= ~USB_CTRL_MASK_FAMILY(params, USB_DEVICE_CTL1, - PORT_MODE); - reg |= params->mode; -- brcmusb_writel(reg, USB_CTRL_REG(ctrl, USB_DEVICE_CTL1)); -+ brcm_usb_writel(reg, USB_CTRL_REG(ctrl, USB_DEVICE_CTL1)); - } - if (USB_CTRL_MASK_FAMILY(params, USB_PM, BDC_SOFT_RESETB)) { - switch (params->mode) { -@@ -932,7 +863,7 @@ void brcm_usb_init_common(struct brcm_us - } - } - --void brcm_usb_init_eohci(struct brcm_usb_init_params *params) -+static void usb_init_eohci(struct brcm_usb_init_params *params) - { - u32 reg; - void __iomem *ctrl = params->ctrl_regs; -@@ -948,10 +879,10 @@ void brcm_usb_init_eohci(struct brcm_usb - USB_CTRL_SET(ctrl, EBRIDGE, ESTOP_SCB_REQ); - - /* Setup the endian bits */ -- reg = brcmusb_readl(USB_CTRL_REG(ctrl, SETUP)); -+ reg = brcm_usb_readl(USB_CTRL_REG(ctrl, SETUP)); - reg &= ~USB_CTRL_SETUP_ENDIAN_BITS; - reg |= USB_CTRL_MASK_FAMILY(params, SETUP, ENDIAN); -- brcmusb_writel(reg, USB_CTRL_REG(ctrl, SETUP)); -+ brcm_usb_writel(reg, USB_CTRL_REG(ctrl, SETUP)); - - if (params->selected_family == BRCM_FAMILY_7271A0) - /* Enable LS keep alive fix for certain keyboards */ -@@ -962,14 +893,14 @@ void brcm_usb_init_eohci(struct brcm_usb - * Make the burst size 512 bytes to fix a hardware bug - * on the 7255a0. See HW7255-24. - */ -- reg = brcmusb_readl(USB_CTRL_REG(ctrl, EBRIDGE)); -+ reg = brcm_usb_readl(USB_CTRL_REG(ctrl, EBRIDGE)); - reg &= ~USB_CTRL_MASK(EBRIDGE, EBR_SCB_SIZE); - reg |= 0x800; -- brcmusb_writel(reg, USB_CTRL_REG(ctrl, EBRIDGE)); -+ brcm_usb_writel(reg, USB_CTRL_REG(ctrl, EBRIDGE)); - } - } - --void brcm_usb_init_xhci(struct brcm_usb_init_params *params) -+static void usb_init_xhci(struct brcm_usb_init_params *params) - { - void __iomem *ctrl = params->ctrl_regs; - -@@ -997,7 +928,7 @@ void brcm_usb_init_xhci(struct brcm_usb_ - brcmusb_usb3_otp_fix(params); - } - --void brcm_usb_uninit_common(struct brcm_usb_init_params *params) -+static void usb_uninit_common(struct brcm_usb_init_params *params) - { - if (USB_CTRL_MASK_FAMILY(params, USB_PM, USB_PWRDN)) - USB_CTRL_SET_FAMILY(params, USB_PM, USB_PWRDN); -@@ -1006,17 +937,47 @@ void brcm_usb_uninit_common(struct brcm_ - USB_CTRL_SET_FAMILY(params, PLL_CTL, PLL_IDDQ_PWRDN); - } - --void brcm_usb_uninit_eohci(struct brcm_usb_init_params *params) -+static void usb_uninit_eohci(struct brcm_usb_init_params *params) - { - } - --void brcm_usb_uninit_xhci(struct brcm_usb_init_params *params) -+static void usb_uninit_xhci(struct brcm_usb_init_params *params) - { - brcmusb_xhci_soft_reset(params, 1); - USB_CTRL_SET(params->ctrl_regs, USB30_PCTL, PHY3_IDDQ_OVERRIDE); - } - --void brcm_usb_wake_enable(struct brcm_usb_init_params *params, -+static int usb_get_dual_select(struct brcm_usb_init_params *params) -+{ -+ void __iomem *ctrl = params->ctrl_regs; -+ u32 reg = 0; -+ -+ pr_debug("%s\n", __func__); -+ if (USB_CTRL_MASK_FAMILY(params, USB_DEVICE_CTL1, PORT_MODE)) { -+ reg = brcm_usb_readl(USB_CTRL_REG(ctrl, USB_DEVICE_CTL1)); -+ reg &= USB_CTRL_MASK_FAMILY(params, USB_DEVICE_CTL1, -+ PORT_MODE); -+ } -+ return reg; -+} -+ -+static void usb_set_dual_select(struct brcm_usb_init_params *params, int mode) -+{ -+ void __iomem *ctrl = params->ctrl_regs; -+ u32 reg; -+ -+ pr_debug("%s\n", __func__); -+ -+ if (USB_CTRL_MASK_FAMILY(params, USB_DEVICE_CTL1, PORT_MODE)) { -+ reg = brcm_usb_readl(USB_CTRL_REG(ctrl, USB_DEVICE_CTL1)); -+ reg &= ~USB_CTRL_MASK_FAMILY(params, USB_DEVICE_CTL1, -+ PORT_MODE); -+ reg |= mode; -+ brcm_usb_writel(reg, USB_CTRL_REG(ctrl, USB_DEVICE_CTL1)); -+ } -+} -+ -+static void usb_wake_enable(struct brcm_usb_init_params *params, - int enable) - { - void __iomem *ctrl = params->ctrl_regs; -@@ -1027,13 +988,29 @@ void brcm_usb_wake_enable(struct brcm_us - USB_CTRL_UNSET(ctrl, USB_PM, RMTWKUP_EN); - } - --void brcm_usb_set_family_map(struct brcm_usb_init_params *params) -+static const struct brcm_usb_init_ops bcm7445_ops = { -+ .init_ipp = usb_init_ipp, -+ .init_common = usb_init_common, -+ .init_eohci = usb_init_eohci, -+ .init_xhci = usb_init_xhci, -+ .uninit_common = usb_uninit_common, -+ .uninit_eohci = usb_uninit_eohci, -+ .uninit_xhci = usb_uninit_xhci, -+ .get_dual_select = usb_get_dual_select, -+ .set_dual_select = usb_set_dual_select, -+ .wake_enable = usb_wake_enable, -+}; -+ -+void brcm_usb_dvr_init_7445(struct brcm_usb_init_params *params) - { - int fam; - -- fam = brcmusb_get_family_type(params); -+ pr_debug("%s\n", __func__); -+ -+ fam = get_family_type(params); - params->selected_family = fam; - params->usb_reg_bits_map = - &usb_reg_bits_map_table[fam][0]; - params->family_name = family_names[fam]; -+ params->ops = &bcm7445_ops; - } ---- a/drivers/phy/broadcom/phy-brcm-usb-init.h -+++ b/drivers/phy/broadcom/phy-brcm-usb-init.h -@@ -13,6 +13,33 @@ - - struct brcm_usb_init_params; - -+#define USB_CTRL_REG(base, reg) ((void __iomem *)base + USB_CTRL_##reg) -+#define USB_XHCI_EC_REG(base, reg) ((void __iomem *)base + USB_XHCI_EC_##reg) -+#define USB_CTRL_MASK(reg, field) \ -+ USB_CTRL_##reg##_##field##_MASK -+#define USB_CTRL_SET(base, reg, field) \ -+ brcm_usb_ctrl_set(USB_CTRL_REG(base, reg), \ -+ USB_CTRL_##reg##_##field##_MASK) -+#define USB_CTRL_UNSET(base, reg, field) \ -+ brcm_usb_ctrl_unset(USB_CTRL_REG(base, reg), \ -+ USB_CTRL_##reg##_##field##_MASK) -+ -+struct brcm_usb_init_params; -+ -+struct brcm_usb_init_ops { -+ void (*init_ipp)(struct brcm_usb_init_params *params); -+ void (*init_common)(struct brcm_usb_init_params *params); -+ void (*init_eohci)(struct brcm_usb_init_params *params); -+ void (*init_xhci)(struct brcm_usb_init_params *params); -+ void (*uninit_common)(struct brcm_usb_init_params *params); -+ void (*uninit_eohci)(struct brcm_usb_init_params *params); -+ void (*uninit_xhci)(struct brcm_usb_init_params *params); -+ int (*get_dual_select)(struct brcm_usb_init_params *params); -+ void (*set_dual_select)(struct brcm_usb_init_params *params, int mode); -+ void (*wake_enable)(struct brcm_usb_init_params *params, -+ int enable); -+}; -+ - struct brcm_usb_init_params { - void __iomem *ctrl_regs; - void __iomem *xhci_ec_regs; -@@ -24,20 +51,107 @@ struct brcm_usb_init_params { - int selected_family; - const char *family_name; - const u32 *usb_reg_bits_map; -+ const struct brcm_usb_init_ops *ops; - }; - --void brcm_usb_set_family_map(struct brcm_usb_init_params *params); --int brcm_usb_init_get_dual_select(struct brcm_usb_init_params *params); --void brcm_usb_init_set_dual_select(struct brcm_usb_init_params *params, -- int mode); -- --void brcm_usb_init_ipp(struct brcm_usb_init_params *ini); --void brcm_usb_init_common(struct brcm_usb_init_params *ini); --void brcm_usb_init_eohci(struct brcm_usb_init_params *ini); --void brcm_usb_init_xhci(struct brcm_usb_init_params *ini); --void brcm_usb_uninit_common(struct brcm_usb_init_params *ini); --void brcm_usb_uninit_eohci(struct brcm_usb_init_params *ini); --void brcm_usb_uninit_xhci(struct brcm_usb_init_params *ini); --void brcm_usb_wake_enable(struct brcm_usb_init_params *params, int enable); -+void brcm_usb_dvr_init_7445(struct brcm_usb_init_params *params); -+ -+static inline u32 brcm_usb_readl(void __iomem *addr) -+{ -+ /* -+ * MIPS endianness is configured by boot strap, which also reverses all -+ * bus endianness (i.e., big-endian CPU + big endian bus ==> native -+ * endian I/O). -+ * -+ * Other architectures (e.g., ARM) either do not support big endian, or -+ * else leave I/O in little endian mode. -+ */ -+ if (IS_ENABLED(CONFIG_MIPS) && IS_ENABLED(__BIG_ENDIAN)) -+ return __raw_readl(addr); -+ else -+ return readl_relaxed(addr); -+} -+ -+static inline void brcm_usb_writel(u32 val, void __iomem *addr) -+{ -+ /* See brcmnand_readl() comments */ -+ if (IS_ENABLED(CONFIG_MIPS) && IS_ENABLED(__BIG_ENDIAN)) -+ __raw_writel(val, addr); -+ else -+ writel_relaxed(val, addr); -+} -+ -+static inline void brcm_usb_ctrl_unset(void __iomem *reg, u32 mask) -+{ -+ brcm_usb_writel(brcm_usb_readl(reg) & ~(mask), reg); -+}; -+ -+static inline void brcm_usb_ctrl_set(void __iomem *reg, u32 mask) -+{ -+ brcm_usb_writel(brcm_usb_readl(reg) | (mask), reg); -+}; -+ -+static inline void brcm_usb_init_ipp(struct brcm_usb_init_params *ini) -+{ -+ if (ini->ops->init_ipp) -+ ini->ops->init_ipp(ini); -+} -+ -+static inline void brcm_usb_init_common(struct brcm_usb_init_params *ini) -+{ -+ if (ini->ops->init_common) -+ ini->ops->init_common(ini); -+} -+ -+static inline void brcm_usb_init_eohci(struct brcm_usb_init_params *ini) -+{ -+ if (ini->ops->init_eohci) -+ ini->ops->init_eohci(ini); -+} -+ -+static inline void brcm_usb_init_xhci(struct brcm_usb_init_params *ini) -+{ -+ if (ini->ops->init_xhci) -+ ini->ops->init_xhci(ini); -+} -+ -+static inline void brcm_usb_uninit_common(struct brcm_usb_init_params *ini) -+{ -+ if (ini->ops->uninit_common) -+ ini->ops->uninit_common(ini); -+} -+ -+static inline void brcm_usb_uninit_eohci(struct brcm_usb_init_params *ini) -+{ -+ if (ini->ops->uninit_eohci) -+ ini->ops->uninit_eohci(ini); -+} -+ -+static inline void brcm_usb_uninit_xhci(struct brcm_usb_init_params *ini) -+{ -+ if (ini->ops->uninit_xhci) -+ ini->ops->uninit_xhci(ini); -+} -+ -+static inline void brcm_usb_wake_enable(struct brcm_usb_init_params *ini, -+ int enable) -+{ -+ if (ini->ops->wake_enable) -+ ini->ops->wake_enable(ini, enable); -+} -+ -+static inline int brcm_usb_get_dual_select(struct brcm_usb_init_params *ini) -+{ -+ if (ini->ops->get_dual_select) -+ return ini->ops->get_dual_select(ini); -+ return 0; -+} -+ -+static inline void brcm_usb_set_dual_select(struct brcm_usb_init_params *ini, -+ int mode) -+{ -+ if (ini->ops->set_dual_select) -+ ini->ops->set_dual_select(ini, mode); -+} - - #endif /* _USB_BRCM_COMMON_INIT_H */ ---- a/drivers/phy/broadcom/phy-brcm-usb.c -+++ b/drivers/phy/broadcom/phy-brcm-usb.c -@@ -207,7 +207,7 @@ static ssize_t dual_select_store(struct - res = name_to_value(&brcm_dual_mode_to_name[0], - ARRAY_SIZE(brcm_dual_mode_to_name), buf, &value); - if (!res) { -- brcm_usb_init_set_dual_select(&priv->ini, value); -+ brcm_usb_set_dual_select(&priv->ini, value); - res = len; - } - mutex_unlock(&sysfs_lock); -@@ -222,7 +222,7 @@ static ssize_t dual_select_show(struct d - int value; - - mutex_lock(&sysfs_lock); -- value = brcm_usb_init_get_dual_select(&priv->ini); -+ value = brcm_usb_get_dual_select(&priv->ini); - mutex_unlock(&sysfs_lock); - return sprintf(buf, "%s\n", - value_to_name(&brcm_dual_mode_to_name[0], -@@ -331,7 +331,7 @@ static int brcm_usb_phy_probe(struct pla - - priv->ini.family_id = brcmstb_get_family_id(); - priv->ini.product_id = brcmstb_get_product_id(); -- brcm_usb_set_family_map(&priv->ini); -+ brcm_usb_dvr_init_7445(&priv->ini); - dev_dbg(dev, "Best mapping table is for %s\n", - priv->ini.family_name); - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); diff --git a/target/linux/bcm4908/patches-5.4/084-v5.6-0006-dt-bindings-Add-Broadcom-STB-USB-PHY-binding-documen.patch b/target/linux/bcm4908/patches-5.4/084-v5.6-0006-dt-bindings-Add-Broadcom-STB-USB-PHY-binding-documen.patch deleted file mode 100644 index 2a57d1dc80..0000000000 --- a/target/linux/bcm4908/patches-5.4/084-v5.6-0006-dt-bindings-Add-Broadcom-STB-USB-PHY-binding-documen.patch +++ /dev/null @@ -1,108 +0,0 @@ -From b11df0c9efbbe2b52c5133ca15030f01b43ec6ef Mon Sep 17 00:00:00 2001 -From: Al Cooper <alcooperx@gmail.com> -Date: Fri, 3 Jan 2020 13:18:04 -0500 -Subject: [PATCH] dt-bindings: Add Broadcom STB USB PHY binding document - -Add support for bcm7216 and bcm7211 - -Signed-off-by: Al Cooper <alcooperx@gmail.com> -Reviewed-by: Rob Herring <robh@kernel.org> -Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> -Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> ---- - .../bindings/phy/brcm,brcmstb-usb-phy.txt | 69 +++++++++++++++---- - 1 file changed, 56 insertions(+), 13 deletions(-) - ---- a/Documentation/devicetree/bindings/phy/brcm,brcmstb-usb-phy.txt -+++ b/Documentation/devicetree/bindings/phy/brcm,brcmstb-usb-phy.txt -@@ -1,30 +1,49 @@ - Broadcom STB USB PHY - - Required properties: -- - compatible: brcm,brcmstb-usb-phy -- - reg: two offset and length pairs. -- The first pair specifies a manditory set of memory mapped -- registers used for general control of the PHY. -- The second pair specifies optional registers used by some of -- the SoCs that support USB 3.x -- - #phy-cells: Shall be 1 as it expects one argument for setting -- the type of the PHY. Possible values are: -- - PHY_TYPE_USB2 for USB1.1/2.0 PHY -- - PHY_TYPE_USB3 for USB3.x PHY -+- compatible: should be one of -+ "brcm,brcmstb-usb-phy" -+ "brcm,bcm7216-usb-phy" -+ "brcm,bcm7211-usb-phy" -+ -+- reg and reg-names properties requirements are specific to the -+ compatible string. -+ "brcm,brcmstb-usb-phy": -+ - reg: 1 or 2 offset and length pairs. One for the base CTRL registers -+ and an optional pair for systems with USB 3.x support -+ - reg-names: not specified -+ "brcm,bcm7216-usb-phy": -+ - reg: 3 offset and length pairs for CTRL, XHCI_EC and XHCI_GBL -+ registers -+ - reg-names: "ctrl", "xhci_ec", "xhci_gbl" -+ "brcm,bcm7211-usb-phy": -+ - reg: 5 offset and length pairs for CTRL, XHCI_EC, XHCI_GBL, -+ USB_PHY and USB_MDIO registers and an optional pair -+ for the BDC registers -+ - reg-names: "ctrl", "xhci_ec", "xhci_gbl", "usb_phy", "usb_mdio", "bdc_ec" -+ -+- #phy-cells: Shall be 1 as it expects one argument for setting -+ the type of the PHY. Possible values are: -+ - PHY_TYPE_USB2 for USB1.1/2.0 PHY -+ - PHY_TYPE_USB3 for USB3.x PHY - - Optional Properties: - - clocks : clock phandles. - - clock-names: String, clock name. -+- interrupts: wakeup interrupt -+- interrupt-names: "wakeup" - - brcm,ipp: Boolean, Invert Port Power. - Possible values are: 0 (Don't invert), 1 (Invert) - - brcm,ioc: Boolean, Invert Over Current detection. - Possible values are: 0 (Don't invert), 1 (Invert) --NOTE: one or both of the following two properties must be set --- brcm,has-xhci: Boolean indicating the phy has an XHCI phy. --- brcm,has-eohci: Boolean indicating the phy has an EHCI/OHCI phy. - - dr_mode: String, PHY Device mode. - Possible values are: "host", "peripheral ", "drd" or "typec-pd" - If this property is not defined, the phy will default to "host" mode. -+- brcm,syscon-piarbctl: phandle to syscon for handling config registers -+NOTE: one or both of the following two properties must be set -+- brcm,has-xhci: Boolean indicating the phy has an XHCI phy. -+- brcm,has-eohci: Boolean indicating the phy has an EHCI/OHCI phy. -+ - - Example: - -@@ -41,3 +60,27 @@ usbphy_0: usb-phy@f0470200 { - clocks = <&usb20>, <&usb30>; - clock-names = "sw_usb", "sw_usb3"; - }; -+ -+usb-phy@29f0200 { -+ reg = <0x29f0200 0x200>, -+ <0x29c0880 0x30>, -+ <0x29cc100 0x534>, -+ <0x2808000 0x24>, -+ <0x2980080 0x8>; -+ reg-names = "ctrl", -+ "xhci_ec", -+ "xhci_gbl", -+ "usb_phy", -+ "usb_mdio"; -+ brcm,ioc = <0x0>; -+ brcm,ipp = <0x0>; -+ compatible = "brcm,bcm7211-usb-phy"; -+ interrupts = <0x30>; -+ interrupt-parent = <&vpu_intr1_nosec_intc>; -+ interrupt-names = "wake"; -+ #phy-cells = <0x1>; -+ brcm,has-xhci; -+ syscon-piarbctl = <&syscon_piarbctl>; -+ clocks = <&scmi_clk 256>; -+ clock-names = "sw_usb"; -+}; diff --git a/target/linux/bcm4908/patches-5.4/084-v5.6-0007-phy-usb-Add-support-for-new-Synopsys-USB-controller-.patch b/target/linux/bcm4908/patches-5.4/084-v5.6-0007-phy-usb-Add-support-for-new-Synopsys-USB-controller-.patch deleted file mode 100644 index 11cc080c23..0000000000 --- a/target/linux/bcm4908/patches-5.4/084-v5.6-0007-phy-usb-Add-support-for-new-Synopsys-USB-controller-.patch +++ /dev/null @@ -1,358 +0,0 @@ -From 4e5b9c9a73b32d28759225a40d30848393a8f1fd Mon Sep 17 00:00:00 2001 -From: Al Cooper <alcooperx@gmail.com> -Date: Fri, 3 Jan 2020 13:18:05 -0500 -Subject: [PATCH] phy: usb: Add support for new Synopsys USB controller on the - 7216 - -The 7216 has the new USB XHCI controller from Synopsys. While -this new controller and the PHY are similar to the STB versions, -the major differences are: - -- Many of the registers and fields in the CTRL block have been - removed or changed. -- A new set of Synopsys control registers, BCHP_USB_XHCI_GBL, were - added. -- MDIO functionality has been replaced with direct access registers - in the BCHP_USB_XHCI_GBL block. -- Power up PHY defaults that had to be changed by MDIO in previous - chips will now power up with the correct defaults. - -A new init module was created for this new Synopsys USB controller. -A new compatible string was added and the driver will dispatch -into one of two init modules based on it. A "reg-names" field was -added so the driver can more easily get optional registers. -A DT bindings document was also added for this driver. - -Signed-off-by: Al Cooper <alcooperx@gmail.com> -Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> -Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> ---- - drivers/phy/broadcom/Makefile | 2 +- - .../phy/broadcom/phy-brcm-usb-init-synopsys.c | 171 ++++++++++++++++++ - drivers/phy/broadcom/phy-brcm-usb-init.h | 2 + - drivers/phy/broadcom/phy-brcm-usb.c | 70 +++++-- - 4 files changed, 227 insertions(+), 18 deletions(-) - create mode 100644 drivers/phy/broadcom/phy-brcm-usb-init-synopsys.c - ---- a/drivers/phy/broadcom/Makefile -+++ b/drivers/phy/broadcom/Makefile -@@ -8,7 +8,7 @@ obj-$(CONFIG_PHY_NS2_USB_DRD) += phy-bc - obj-$(CONFIG_PHY_BRCM_SATA) += phy-brcm-sata.o - obj-$(CONFIG_PHY_BRCM_USB) += phy-brcm-usb-dvr.o - --phy-brcm-usb-dvr-objs := phy-brcm-usb.o phy-brcm-usb-init.o -+phy-brcm-usb-dvr-objs := phy-brcm-usb.o phy-brcm-usb-init.o phy-brcm-usb-init-synopsys.o - - obj-$(CONFIG_PHY_BCM_SR_PCIE) += phy-bcm-sr-pcie.o - obj-$(CONFIG_PHY_BCM_SR_USB) += phy-bcm-sr-usb.o ---- /dev/null -+++ b/drivers/phy/broadcom/phy-brcm-usb-init-synopsys.c -@@ -0,0 +1,171 @@ -+// SPDX-License-Identifier: GPL-2.0 -+/* Copyright (c) 2018, Broadcom */ -+ -+/* -+ * This module contains USB PHY initialization for power up and S3 resume -+ * for newer Synopsys based USB hardware first used on the bcm7216. -+ */ -+ -+#include <linux/delay.h> -+#include <linux/io.h> -+ -+#include <linux/soc/brcmstb/brcmstb.h> -+#include "phy-brcm-usb-init.h" -+ -+/* Register definitions for the USB CTRL block */ -+#define USB_CTRL_SETUP 0x00 -+#define USB_CTRL_SETUP_STRAP_IPP_SEL_MASK 0x02000000 -+#define USB_CTRL_SETUP_SCB2_EN_MASK 0x00008000 -+#define USB_CTRL_SETUP_SCB1_EN_MASK 0x00004000 -+#define USB_CTRL_SETUP_SOFT_SHUTDOWN_MASK 0x00000200 -+#define USB_CTRL_SETUP_IPP_MASK 0x00000020 -+#define USB_CTRL_SETUP_IOC_MASK 0x00000010 -+#define USB_CTRL_USB_PM 0x04 -+#define USB_CTRL_USB_PM_USB_PWRDN_MASK 0x80000000 -+#define USB_CTRL_USB_PM_SOFT_RESET_MASK 0x40000000 -+#define USB_CTRL_USB_PM_BDC_SOFT_RESETB_MASK 0x00800000 -+#define USB_CTRL_USB_PM_XHC_SOFT_RESETB_MASK 0x00400000 -+#define USB_CTRL_USB_PM_STATUS 0x08 -+#define USB_CTRL_USB_DEVICE_CTL1 0x10 -+#define USB_CTRL_USB_DEVICE_CTL1_PORT_MODE_MASK 0x00000003 -+ -+ -+static void xhci_soft_reset(struct brcm_usb_init_params *params, -+ int on_off) -+{ -+ void __iomem *ctrl = params->ctrl_regs; -+ -+ /* Assert reset */ -+ if (on_off) -+ USB_CTRL_UNSET(ctrl, USB_PM, XHC_SOFT_RESETB); -+ /* De-assert reset */ -+ else -+ USB_CTRL_SET(ctrl, USB_PM, XHC_SOFT_RESETB); -+} -+ -+static void usb_init_ipp(struct brcm_usb_init_params *params) -+{ -+ void __iomem *ctrl = params->ctrl_regs; -+ u32 reg; -+ u32 orig_reg; -+ -+ pr_debug("%s\n", __func__); -+ -+ orig_reg = reg = brcm_usb_readl(USB_CTRL_REG(ctrl, SETUP)); -+ if (params->ipp != 2) -+ /* override ipp strap pin (if it exits) */ -+ reg &= ~(USB_CTRL_MASK(SETUP, STRAP_IPP_SEL)); -+ -+ /* Override the default OC and PP polarity */ -+ reg &= ~(USB_CTRL_MASK(SETUP, IPP) | USB_CTRL_MASK(SETUP, IOC)); -+ if (params->ioc) -+ reg |= USB_CTRL_MASK(SETUP, IOC); -+ if (params->ipp == 1) -+ reg |= USB_CTRL_MASK(SETUP, IPP); -+ brcm_usb_writel(reg, USB_CTRL_REG(ctrl, SETUP)); -+ -+ /* -+ * If we're changing IPP, make sure power is off long enough -+ * to turn off any connected devices. -+ */ -+ if ((reg ^ orig_reg) & USB_CTRL_MASK(SETUP, IPP)) -+ msleep(50); -+} -+ -+static void usb_init_common(struct brcm_usb_init_params *params) -+{ -+ u32 reg; -+ void __iomem *ctrl = params->ctrl_regs; -+ -+ pr_debug("%s\n", __func__); -+ -+ USB_CTRL_UNSET(ctrl, USB_PM, USB_PWRDN); -+ /* 1 millisecond - for USB clocks to settle down */ -+ usleep_range(1000, 2000); -+ -+ if (USB_CTRL_MASK(USB_DEVICE_CTL1, PORT_MODE)) { -+ reg = brcm_usb_readl(USB_CTRL_REG(ctrl, USB_DEVICE_CTL1)); -+ reg &= ~USB_CTRL_MASK(USB_DEVICE_CTL1, PORT_MODE); -+ reg |= params->mode; -+ brcm_usb_writel(reg, USB_CTRL_REG(ctrl, USB_DEVICE_CTL1)); -+ } -+ switch (params->mode) { -+ case USB_CTLR_MODE_HOST: -+ USB_CTRL_UNSET(ctrl, USB_PM, BDC_SOFT_RESETB); -+ break; -+ default: -+ USB_CTRL_UNSET(ctrl, USB_PM, BDC_SOFT_RESETB); -+ USB_CTRL_SET(ctrl, USB_PM, BDC_SOFT_RESETB); -+ break; -+ } -+} -+ -+static void usb_init_xhci(struct brcm_usb_init_params *params) -+{ -+ pr_debug("%s\n", __func__); -+ -+ xhci_soft_reset(params, 0); -+} -+ -+static void usb_uninit_common(struct brcm_usb_init_params *params) -+{ -+ void __iomem *ctrl = params->ctrl_regs; -+ -+ pr_debug("%s\n", __func__); -+ -+ USB_CTRL_SET(ctrl, USB_PM, USB_PWRDN); -+ -+} -+ -+static void usb_uninit_xhci(struct brcm_usb_init_params *params) -+{ -+ -+ pr_debug("%s\n", __func__); -+ -+ xhci_soft_reset(params, 1); -+} -+ -+static int usb_get_dual_select(struct brcm_usb_init_params *params) -+{ -+ void __iomem *ctrl = params->ctrl_regs; -+ u32 reg = 0; -+ -+ pr_debug("%s\n", __func__); -+ -+ reg = brcm_usb_readl(USB_CTRL_REG(ctrl, USB_DEVICE_CTL1)); -+ reg &= USB_CTRL_MASK(USB_DEVICE_CTL1, PORT_MODE); -+ return reg; -+} -+ -+static void usb_set_dual_select(struct brcm_usb_init_params *params, int mode) -+{ -+ void __iomem *ctrl = params->ctrl_regs; -+ u32 reg; -+ -+ pr_debug("%s\n", __func__); -+ -+ reg = brcm_usb_readl(USB_CTRL_REG(ctrl, USB_DEVICE_CTL1)); -+ reg &= ~USB_CTRL_MASK(USB_DEVICE_CTL1, PORT_MODE); -+ reg |= mode; -+ brcm_usb_writel(reg, USB_CTRL_REG(ctrl, USB_DEVICE_CTL1)); -+} -+ -+ -+static const struct brcm_usb_init_ops bcm7216_ops = { -+ .init_ipp = usb_init_ipp, -+ .init_common = usb_init_common, -+ .init_xhci = usb_init_xhci, -+ .uninit_common = usb_uninit_common, -+ .uninit_xhci = usb_uninit_xhci, -+ .get_dual_select = usb_get_dual_select, -+ .set_dual_select = usb_set_dual_select, -+}; -+ -+void brcm_usb_dvr_init_7216(struct brcm_usb_init_params *params) -+{ -+ -+ pr_debug("%s\n", __func__); -+ -+ params->family_name = "7216"; -+ params->ops = &bcm7216_ops; -+} ---- a/drivers/phy/broadcom/phy-brcm-usb-init.h -+++ b/drivers/phy/broadcom/phy-brcm-usb-init.h -@@ -43,6 +43,7 @@ struct brcm_usb_init_ops { - struct brcm_usb_init_params { - void __iomem *ctrl_regs; - void __iomem *xhci_ec_regs; -+ void __iomem *xhci_gbl_regs; - int ioc; - int ipp; - int mode; -@@ -55,6 +56,7 @@ struct brcm_usb_init_params { - }; - - void brcm_usb_dvr_init_7445(struct brcm_usb_init_params *params); -+void brcm_usb_dvr_init_7216(struct brcm_usb_init_params *params); - - static inline u32 brcm_usb_readl(void __iomem *addr) - { ---- a/drivers/phy/broadcom/phy-brcm-usb.c -+++ b/drivers/phy/broadcom/phy-brcm-usb.c -@@ -241,6 +241,15 @@ static const struct attribute_group brcm - .attrs = brcm_usb_phy_attrs, - }; - -+static const struct of_device_id brcm_usb_dt_ids[] = { -+ { -+ .compatible = "brcm,bcm7216-usb-phy", -+ .data = &brcm_usb_dvr_init_7216, -+ }, -+ { .compatible = "brcm,brcmstb-usb-phy" }, -+ { /* sentinel */ } -+}; -+ - static int brcm_usb_phy_dvr_init(struct platform_device *pdev, - struct brcm_usb_phy_data *priv, - struct device_node *dn) -@@ -316,13 +325,16 @@ static int brcm_usb_phy_dvr_init(struct - - static int brcm_usb_phy_probe(struct platform_device *pdev) - { -- struct resource *res; -+ struct resource *res_ctrl; -+ struct resource *res_xhciec = NULL; -+ struct resource *res_xhcigbl = NULL; - struct device *dev = &pdev->dev; - struct brcm_usb_phy_data *priv; - struct phy_provider *phy_provider; - struct device_node *dn = pdev->dev.of_node; - int err; - const char *mode; -+ const struct of_device_id *match; - - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); - if (!priv) -@@ -331,30 +343,59 @@ static int brcm_usb_phy_probe(struct pla - - priv->ini.family_id = brcmstb_get_family_id(); - priv->ini.product_id = brcmstb_get_product_id(); -- brcm_usb_dvr_init_7445(&priv->ini); -+ -+ match = of_match_node(brcm_usb_dt_ids, dev->of_node); -+ if (match && match->data) { -+ void (*dvr_init)(struct brcm_usb_init_params *params); -+ -+ dvr_init = match->data; -+ (*dvr_init)(&priv->ini); -+ } else { -+ brcm_usb_dvr_init_7445(&priv->ini); -+ } -+ - dev_dbg(dev, "Best mapping table is for %s\n", - priv->ini.family_name); -- res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -- if (!res) { -- dev_err(dev, "can't get USB_CTRL base address\n"); -- return -EINVAL; -+ -+ /* Newer DT node has reg-names. xhci_ec and xhci_gbl are optional. */ -+ res_ctrl = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ctrl"); -+ if (res_ctrl != NULL) { -+ res_xhciec = platform_get_resource_byname(pdev, -+ IORESOURCE_MEM, -+ "xhci_ec"); -+ res_xhcigbl = platform_get_resource_byname(pdev, -+ IORESOURCE_MEM, -+ "xhci_gbl"); -+ } else { -+ /* Older DT node without reg-names, use index */ -+ res_ctrl = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ if (res_ctrl == NULL) { -+ dev_err(dev, "can't get CTRL base address\n"); -+ return -EINVAL; -+ } -+ res_xhciec = platform_get_resource(pdev, IORESOURCE_MEM, 1); - } -- priv->ini.ctrl_regs = devm_ioremap_resource(dev, res); -+ priv->ini.ctrl_regs = devm_ioremap_resource(dev, res_ctrl); - if (IS_ERR(priv->ini.ctrl_regs)) { - dev_err(dev, "can't map CTRL register space\n"); - return -EINVAL; - } -- -- /* The XHCI EC registers are optional */ -- res = platform_get_resource(pdev, IORESOURCE_MEM, 1); -- if (res) { -+ if (res_xhciec) { - priv->ini.xhci_ec_regs = -- devm_ioremap_resource(dev, res); -+ devm_ioremap_resource(dev, res_xhciec); - if (IS_ERR(priv->ini.xhci_ec_regs)) { - dev_err(dev, "can't map XHCI EC register space\n"); - return -EINVAL; - } - } -+ if (res_xhcigbl) { -+ priv->ini.xhci_gbl_regs = -+ devm_ioremap_resource(dev, res_xhcigbl); -+ if (IS_ERR(priv->ini.xhci_gbl_regs)) { -+ dev_err(dev, "can't map XHCI Global register space\n"); -+ return -EINVAL; -+ } -+ } - - of_property_read_u32(dn, "brcm,ipp", &priv->ini.ipp); - of_property_read_u32(dn, "brcm,ioc", &priv->ini.ioc); -@@ -480,11 +521,6 @@ static const struct dev_pm_ops brcm_usb_ - SET_LATE_SYSTEM_SLEEP_PM_OPS(brcm_usb_phy_suspend, brcm_usb_phy_resume) - }; - --static const struct of_device_id brcm_usb_dt_ids[] = { -- { .compatible = "brcm,brcmstb-usb-phy" }, -- { /* sentinel */ } --}; -- - MODULE_DEVICE_TABLE(of, brcm_usb_dt_ids); - - static struct platform_driver brcm_usb_driver = { diff --git a/target/linux/bcm4908/patches-5.4/084-v5.6-0008-phy-usb-Add-support-for-new-Synopsys-USB-controller-.patch b/target/linux/bcm4908/patches-5.4/084-v5.6-0008-phy-usb-Add-support-for-new-Synopsys-USB-controller-.patch deleted file mode 100644 index 008108c589..0000000000 --- a/target/linux/bcm4908/patches-5.4/084-v5.6-0008-phy-usb-Add-support-for-new-Synopsys-USB-controller-.patch +++ /dev/null @@ -1,680 +0,0 @@ -From 9d5f51dcdb646c2ed21649d379fbb703994f1ec9 Mon Sep 17 00:00:00 2001 -From: Al Cooper <alcooperx@gmail.com> -Date: Fri, 3 Jan 2020 13:18:06 -0500 -Subject: [PATCH] phy: usb: Add support for new Synopsys USB controller on the - 7211b0 - -The 7211b0 has added the STB XHCI Synopsys controller and it -will be used instead of the RPi based DWC USB controller. The new -Synopsys XHCI controller core is the same one that is used on the -7216, but because of the way the STB USB PHY is used on both the A0 -and B0, some of the PHY control is different. - -Signed-off-by: Al Cooper <alcooperx@gmail.com> -Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> -Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> ---- - .../phy/broadcom/phy-brcm-usb-init-synopsys.c | 163 +++++++++++++++++- - drivers/phy/broadcom/phy-brcm-usb-init.c | 31 ++-- - drivers/phy/broadcom/phy-brcm-usb-init.h | 17 +- - drivers/phy/broadcom/phy-brcm-usb.c | 162 +++++++++++------ - 4 files changed, 295 insertions(+), 78 deletions(-) - ---- a/drivers/phy/broadcom/phy-brcm-usb-init-synopsys.c -+++ b/drivers/phy/broadcom/phy-brcm-usb-init-synopsys.c -@@ -12,10 +12,33 @@ - #include <linux/soc/brcmstb/brcmstb.h> - #include "phy-brcm-usb-init.h" - -+#define PHY_LOCK_TIMEOUT_MS 200 -+ -+/* Register definitions for syscon piarbctl registers */ -+#define PIARBCTL_CAM 0x00 -+#define PIARBCTL_SPLITTER 0x04 -+#define PIARBCTL_MISC 0x08 -+#define PIARBCTL_MISC_SECURE_MASK 0x80000000 -+#define PIARBCTL_MISC_USB_SELECT_MASK 0x40000000 -+#define PIARBCTL_MISC_USB_4G_SDRAM_MASK 0x20000000 -+#define PIARBCTL_MISC_USB_PRIORITY_MASK 0x000f0000 -+#define PIARBCTL_MISC_USB_MEM_PAGE_MASK 0x0000f000 -+#define PIARBCTL_MISC_CAM1_MEM_PAGE_MASK 0x00000f00 -+#define PIARBCTL_MISC_CAM0_MEM_PAGE_MASK 0x000000f0 -+#define PIARBCTL_MISC_SATA_PRIORITY_MASK 0x0000000f -+#define PIARBCTL_USB_M_ASB_CTRL 0x10 -+ -+#define PIARBCTL_MISC_USB_ONLY_MASK \ -+ (PIARBCTL_MISC_USB_SELECT_MASK | \ -+ PIARBCTL_MISC_USB_4G_SDRAM_MASK | \ -+ PIARBCTL_MISC_USB_PRIORITY_MASK | \ -+ PIARBCTL_MISC_USB_MEM_PAGE_MASK) -+ - /* Register definitions for the USB CTRL block */ - #define USB_CTRL_SETUP 0x00 - #define USB_CTRL_SETUP_STRAP_IPP_SEL_MASK 0x02000000 - #define USB_CTRL_SETUP_SCB2_EN_MASK 0x00008000 -+#define USB_CTRL_SETUP_tca_drv_sel_MASK 0x01000000 - #define USB_CTRL_SETUP_SCB1_EN_MASK 0x00004000 - #define USB_CTRL_SETUP_SOFT_SHUTDOWN_MASK 0x00000200 - #define USB_CTRL_SETUP_IPP_MASK 0x00000020 -@@ -29,11 +52,73 @@ - #define USB_CTRL_USB_DEVICE_CTL1 0x10 - #define USB_CTRL_USB_DEVICE_CTL1_PORT_MODE_MASK 0x00000003 - -+/* Register definitions for the USB_PHY block in 7211b0 */ -+#define USB_PHY_PLL_LDO_CTL 0x08 -+#define USB_PHY_PLL_LDO_CTL_AFE_CORERDY_MASK 0x00000004 -+#define USB_PHY_UTMI_CTL_1 0x04 -+#define USB_PHY_UTMI_CTL_1_PHY_MODE_MASK 0x0000000c -+#define USB_PHY_UTMI_CTL_1_PHY_MODE_SHIFT 2 -+#define USB_PHY_STATUS 0x20 -+#define USB_PHY_STATUS_pll_lock_MASK 0x00000001 -+ -+/* Register definitions for the MDIO registers in the DWC2 block of -+ * the 7211b0. -+ * NOTE: The PHY's MDIO registers are only accessible through the -+ * legacy DesignWare USB controller even though it's not being used. -+ */ -+#define USB_GMDIOCSR 0 -+#define USB_GMDIOGEN 4 -+ -+ -+static void usb_mdio_write_7211b0(struct brcm_usb_init_params *params, -+ uint8_t addr, uint16_t data) -+{ -+ void __iomem *usb_mdio = params->regs[BRCM_REGS_USB_MDIO]; -+ -+ addr &= 0x1f; /* 5-bit address */ -+ brcm_usb_writel(0xffffffff, usb_mdio + USB_GMDIOGEN); -+ while (brcm_usb_readl(usb_mdio + USB_GMDIOCSR) & (1<<31)) -+ ; -+ brcm_usb_writel(0x59020000 | (addr << 18) | data, -+ usb_mdio + USB_GMDIOGEN); -+ while (brcm_usb_readl(usb_mdio + USB_GMDIOCSR) & (1<<31)) -+ ; -+ brcm_usb_writel(0x00000000, usb_mdio + USB_GMDIOGEN); -+ while (brcm_usb_readl(usb_mdio + USB_GMDIOCSR) & (1<<31)) -+ ; -+} -+ -+static uint16_t __maybe_unused usb_mdio_read_7211b0( -+ struct brcm_usb_init_params *params, uint8_t addr) -+{ -+ void __iomem *usb_mdio = params->regs[BRCM_REGS_USB_MDIO]; -+ -+ addr &= 0x1f; /* 5-bit address */ -+ brcm_usb_writel(0xffffffff, usb_mdio + USB_GMDIOGEN); -+ while (brcm_usb_readl(usb_mdio + USB_GMDIOCSR) & (1<<31)) -+ ; -+ brcm_usb_writel(0x69020000 | (addr << 18), usb_mdio + USB_GMDIOGEN); -+ while (brcm_usb_readl(usb_mdio + USB_GMDIOCSR) & (1<<31)) -+ ; -+ brcm_usb_writel(0x00000000, usb_mdio + USB_GMDIOGEN); -+ while (brcm_usb_readl(usb_mdio + USB_GMDIOCSR) & (1<<31)) -+ ; -+ return brcm_usb_readl(usb_mdio + USB_GMDIOCSR) & 0xffff; -+} -+ -+static void usb2_eye_fix_7211b0(struct brcm_usb_init_params *params) -+{ -+ /* select bank */ -+ usb_mdio_write_7211b0(params, 0x1f, 0x80a0); -+ -+ /* Set the eye */ -+ usb_mdio_write_7211b0(params, 0x0a, 0xc6a0); -+} - - static void xhci_soft_reset(struct brcm_usb_init_params *params, - int on_off) - { -- void __iomem *ctrl = params->ctrl_regs; -+ void __iomem *ctrl = params->regs[BRCM_REGS_CTRL]; - - /* Assert reset */ - if (on_off) -@@ -45,7 +130,7 @@ static void xhci_soft_reset(struct brcm_ - - static void usb_init_ipp(struct brcm_usb_init_params *params) - { -- void __iomem *ctrl = params->ctrl_regs; -+ void __iomem *ctrl = params->regs[BRCM_REGS_CTRL]; - u32 reg; - u32 orig_reg; - -@@ -72,10 +157,18 @@ static void usb_init_ipp(struct brcm_usb - msleep(50); - } - -+static void syscon_piarbctl_init(struct regmap *rmap) -+{ -+ /* Switch from legacy USB OTG controller to new STB USB controller */ -+ regmap_update_bits(rmap, PIARBCTL_MISC, PIARBCTL_MISC_USB_ONLY_MASK, -+ PIARBCTL_MISC_USB_SELECT_MASK | -+ PIARBCTL_MISC_USB_4G_SDRAM_MASK); -+} -+ - static void usb_init_common(struct brcm_usb_init_params *params) - { - u32 reg; -- void __iomem *ctrl = params->ctrl_regs; -+ void __iomem *ctrl = params->regs[BRCM_REGS_CTRL]; - - pr_debug("%s\n", __func__); - -@@ -100,6 +193,45 @@ static void usb_init_common(struct brcm_ - } - } - -+static void usb_init_common_7211b0(struct brcm_usb_init_params *params) -+{ -+ void __iomem *ctrl = params->regs[BRCM_REGS_CTRL]; -+ void __iomem *usb_phy = params->regs[BRCM_REGS_USB_PHY]; -+ int timeout_ms = PHY_LOCK_TIMEOUT_MS; -+ u32 reg; -+ -+ if (params->syscon_piarbctl) -+ syscon_piarbctl_init(params->syscon_piarbctl); -+ -+ /* Init the PHY */ -+ reg = brcm_usb_readl(usb_phy + USB_PHY_PLL_LDO_CTL); -+ reg |= USB_PHY_PLL_LDO_CTL_AFE_CORERDY_MASK; -+ brcm_usb_writel(reg, usb_phy + USB_PHY_PLL_LDO_CTL); -+ -+ /* wait for lock */ -+ while (timeout_ms-- > 0) { -+ reg = brcm_usb_readl(usb_phy + USB_PHY_STATUS); -+ if (reg & USB_PHY_STATUS_pll_lock_MASK) -+ break; -+ usleep_range(1000, 2000); -+ } -+ -+ /* Set the PHY_MODE */ -+ reg = brcm_usb_readl(usb_phy + USB_PHY_UTMI_CTL_1); -+ reg &= ~USB_PHY_UTMI_CTL_1_PHY_MODE_MASK; -+ reg |= params->mode << USB_PHY_UTMI_CTL_1_PHY_MODE_SHIFT; -+ brcm_usb_writel(reg, usb_phy + USB_PHY_UTMI_CTL_1); -+ -+ /* Fix the incorrect default */ -+ reg = brcm_usb_readl(ctrl + USB_CTRL_SETUP); -+ reg &= ~USB_CTRL_SETUP_tca_drv_sel_MASK; -+ brcm_usb_writel(reg, ctrl + USB_CTRL_SETUP); -+ -+ usb_init_common(params); -+ -+ usb2_eye_fix_7211b0(params); -+} -+ - static void usb_init_xhci(struct brcm_usb_init_params *params) - { - pr_debug("%s\n", __func__); -@@ -109,7 +241,7 @@ static void usb_init_xhci(struct brcm_us - - static void usb_uninit_common(struct brcm_usb_init_params *params) - { -- void __iomem *ctrl = params->ctrl_regs; -+ void __iomem *ctrl = params->regs[BRCM_REGS_CTRL]; - - pr_debug("%s\n", __func__); - -@@ -127,7 +259,7 @@ static void usb_uninit_xhci(struct brcm_ - - static int usb_get_dual_select(struct brcm_usb_init_params *params) - { -- void __iomem *ctrl = params->ctrl_regs; -+ void __iomem *ctrl = params->regs[BRCM_REGS_CTRL]; - u32 reg = 0; - - pr_debug("%s\n", __func__); -@@ -139,7 +271,7 @@ static int usb_get_dual_select(struct br - - static void usb_set_dual_select(struct brcm_usb_init_params *params, int mode) - { -- void __iomem *ctrl = params->ctrl_regs; -+ void __iomem *ctrl = params->regs[BRCM_REGS_CTRL]; - u32 reg; - - pr_debug("%s\n", __func__); -@@ -161,6 +293,16 @@ static const struct brcm_usb_init_ops bc - .set_dual_select = usb_set_dual_select, - }; - -+static const struct brcm_usb_init_ops bcm7211b0_ops = { -+ .init_ipp = usb_init_ipp, -+ .init_common = usb_init_common_7211b0, -+ .init_xhci = usb_init_xhci, -+ .uninit_common = usb_uninit_common, -+ .uninit_xhci = usb_uninit_xhci, -+ .get_dual_select = usb_get_dual_select, -+ .set_dual_select = usb_set_dual_select, -+}; -+ - void brcm_usb_dvr_init_7216(struct brcm_usb_init_params *params) - { - -@@ -169,3 +311,12 @@ void brcm_usb_dvr_init_7216(struct brcm_ - params->family_name = "7216"; - params->ops = &bcm7216_ops; - } -+ -+void brcm_usb_dvr_init_7211b0(struct brcm_usb_init_params *params) -+{ -+ -+ pr_debug("%s\n", __func__); -+ -+ params->family_name = "7211"; -+ params->ops = &bcm7211b0_ops; -+} ---- a/drivers/phy/broadcom/phy-brcm-usb-init.c -+++ b/drivers/phy/broadcom/phy-brcm-usb-init.c -@@ -401,7 +401,7 @@ void usb_ctrl_unset_family(struct brcm_u - u32 mask; - - mask = params->usb_reg_bits_map[field]; -- brcm_usb_ctrl_unset(params->ctrl_regs + reg_offset, mask); -+ brcm_usb_ctrl_unset(params->regs[BRCM_REGS_CTRL] + reg_offset, mask); - }; - - static inline -@@ -411,7 +411,7 @@ void usb_ctrl_set_family(struct brcm_usb - u32 mask; - - mask = params->usb_reg_bits_map[field]; -- brcm_usb_ctrl_set(params->ctrl_regs + reg_offset, mask); -+ brcm_usb_ctrl_set(params->regs[BRCM_REGS_CTRL] + reg_offset, mask); - }; - - static u32 brcmusb_usb_mdio_read(void __iomem *ctrl_base, u32 reg, int mode) -@@ -544,7 +544,7 @@ static void brcmusb_usb3_pll_54mhz(struc - { - u32 ofs; - int ii; -- void __iomem *ctrl_base = params->ctrl_regs; -+ void __iomem *ctrl_base = params->regs[BRCM_REGS_CTRL]; - - /* - * On newer B53 based SoC's, the reference clock for the -@@ -625,7 +625,7 @@ static void brcmusb_usb3_ssc_enable(void - - static void brcmusb_usb3_phy_workarounds(struct brcm_usb_init_params *params) - { -- void __iomem *ctrl_base = params->ctrl_regs; -+ void __iomem *ctrl_base = params->regs[BRCM_REGS_CTRL]; - - brcmusb_usb3_pll_fix(ctrl_base); - brcmusb_usb3_pll_54mhz(params); -@@ -667,7 +667,7 @@ static void brcmusb_memc_fix(struct brcm - - static void brcmusb_usb3_otp_fix(struct brcm_usb_init_params *params) - { -- void __iomem *xhci_ec_base = params->xhci_ec_regs; -+ void __iomem *xhci_ec_base = params->regs[BRCM_REGS_XHCI_EC]; - u32 val; - - if (params->family_id != 0x74371000 || !xhci_ec_base) -@@ -680,8 +680,8 @@ static void brcmusb_usb3_otp_fix(struct - brcm_usb_writel(val, USB_XHCI_EC_REG(xhci_ec_base, IRADAT)); - - /* Reset USB 3.0 PHY for workaround to take effect */ -- USB_CTRL_UNSET(params->ctrl_regs, USB30_CTL1, PHY3_RESETB); -- USB_CTRL_SET(params->ctrl_regs, USB30_CTL1, PHY3_RESETB); -+ USB_CTRL_UNSET(params->regs[BRCM_REGS_CTRL], USB30_CTL1, PHY3_RESETB); -+ USB_CTRL_SET(params->regs[BRCM_REGS_CTRL], USB30_CTL1, PHY3_RESETB); - } - - static void brcmusb_xhci_soft_reset(struct brcm_usb_init_params *params, -@@ -740,7 +740,7 @@ static enum brcm_family_type get_family_ - - static void usb_init_ipp(struct brcm_usb_init_params *params) - { -- void __iomem *ctrl = params->ctrl_regs; -+ void __iomem *ctrl = params->regs[BRCM_REGS_CTRL]; - u32 reg; - u32 orig_reg; - -@@ -786,7 +786,7 @@ static void usb_init_ipp(struct brcm_usb - static void usb_init_common(struct brcm_usb_init_params *params) - { - u32 reg; -- void __iomem *ctrl = params->ctrl_regs; -+ void __iomem *ctrl = params->regs[BRCM_REGS_CTRL]; - - /* Clear any pending wake conditions */ - reg = brcm_usb_readl(USB_CTRL_REG(ctrl, USB_PM_STATUS)); -@@ -866,7 +866,7 @@ static void usb_init_common(struct brcm_ - static void usb_init_eohci(struct brcm_usb_init_params *params) - { - u32 reg; -- void __iomem *ctrl = params->ctrl_regs; -+ void __iomem *ctrl = params->regs[BRCM_REGS_CTRL]; - - if (USB_CTRL_MASK_FAMILY(params, USB_PM, USB20_HC_RESETB)) - USB_CTRL_SET_FAMILY(params, USB_PM, USB20_HC_RESETB); -@@ -902,7 +902,7 @@ static void usb_init_eohci(struct brcm_u - - static void usb_init_xhci(struct brcm_usb_init_params *params) - { -- void __iomem *ctrl = params->ctrl_regs; -+ void __iomem *ctrl = params->regs[BRCM_REGS_CTRL]; - - USB_CTRL_UNSET(ctrl, USB30_PCTL, PHY3_IDDQ_OVERRIDE); - /* 1 millisecond - for USB clocks to settle down */ -@@ -944,12 +944,13 @@ static void usb_uninit_eohci(struct brcm - static void usb_uninit_xhci(struct brcm_usb_init_params *params) - { - brcmusb_xhci_soft_reset(params, 1); -- USB_CTRL_SET(params->ctrl_regs, USB30_PCTL, PHY3_IDDQ_OVERRIDE); -+ USB_CTRL_SET(params->regs[BRCM_REGS_CTRL], USB30_PCTL, -+ PHY3_IDDQ_OVERRIDE); - } - - static int usb_get_dual_select(struct brcm_usb_init_params *params) - { -- void __iomem *ctrl = params->ctrl_regs; -+ void __iomem *ctrl = params->regs[BRCM_REGS_CTRL]; - u32 reg = 0; - - pr_debug("%s\n", __func__); -@@ -963,7 +964,7 @@ static int usb_get_dual_select(struct br - - static void usb_set_dual_select(struct brcm_usb_init_params *params, int mode) - { -- void __iomem *ctrl = params->ctrl_regs; -+ void __iomem *ctrl = params->regs[BRCM_REGS_CTRL]; - u32 reg; - - pr_debug("%s\n", __func__); -@@ -980,7 +981,7 @@ static void usb_set_dual_select(struct b - static void usb_wake_enable(struct brcm_usb_init_params *params, - int enable) - { -- void __iomem *ctrl = params->ctrl_regs; -+ void __iomem *ctrl = params->regs[BRCM_REGS_CTRL]; - - if (enable) - USB_CTRL_SET(ctrl, USB_PM, RMTWKUP_EN); ---- a/drivers/phy/broadcom/phy-brcm-usb-init.h -+++ b/drivers/phy/broadcom/phy-brcm-usb-init.h -@@ -6,12 +6,21 @@ - #ifndef _USB_BRCM_COMMON_INIT_H - #define _USB_BRCM_COMMON_INIT_H - -+#include <linux/regmap.h> -+ - #define USB_CTLR_MODE_HOST 0 - #define USB_CTLR_MODE_DEVICE 1 - #define USB_CTLR_MODE_DRD 2 - #define USB_CTLR_MODE_TYPEC_PD 3 - --struct brcm_usb_init_params; -+enum brcmusb_reg_sel { -+ BRCM_REGS_CTRL = 0, -+ BRCM_REGS_XHCI_EC, -+ BRCM_REGS_XHCI_GBL, -+ BRCM_REGS_USB_PHY, -+ BRCM_REGS_USB_MDIO, -+ BRCM_REGS_MAX -+}; - - #define USB_CTRL_REG(base, reg) ((void __iomem *)base + USB_CTRL_##reg) - #define USB_XHCI_EC_REG(base, reg) ((void __iomem *)base + USB_XHCI_EC_##reg) -@@ -41,9 +50,7 @@ struct brcm_usb_init_ops { - }; - - struct brcm_usb_init_params { -- void __iomem *ctrl_regs; -- void __iomem *xhci_ec_regs; -- void __iomem *xhci_gbl_regs; -+ void __iomem *regs[BRCM_REGS_MAX]; - int ioc; - int ipp; - int mode; -@@ -53,10 +60,12 @@ struct brcm_usb_init_params { - const char *family_name; - const u32 *usb_reg_bits_map; - const struct brcm_usb_init_ops *ops; -+ struct regmap *syscon_piarbctl; - }; - - void brcm_usb_dvr_init_7445(struct brcm_usb_init_params *params); - void brcm_usb_dvr_init_7216(struct brcm_usb_init_params *params); -+void brcm_usb_dvr_init_7211b0(struct brcm_usb_init_params *params); - - static inline u32 brcm_usb_readl(void __iomem *addr) - { ---- a/drivers/phy/broadcom/phy-brcm-usb.c -+++ b/drivers/phy/broadcom/phy-brcm-usb.c -@@ -16,6 +16,7 @@ - #include <linux/interrupt.h> - #include <linux/soc/brcmstb/brcmstb.h> - #include <dt-bindings/phy/phy.h> -+#include <linux/mfd/syscon.h> - - #include "phy-brcm-usb-init.h" - -@@ -32,6 +33,11 @@ struct value_to_name_map { - const char *name; - }; - -+struct match_chip_info { -+ void *init_func; -+ u8 required_regs[BRCM_REGS_MAX + 1]; -+}; -+ - static struct value_to_name_map brcm_dr_mode_to_name[] = { - { USB_CTLR_MODE_HOST, "host" }, - { USB_CTLR_MODE_DEVICE, "peripheral" }, -@@ -64,6 +70,10 @@ struct brcm_usb_phy_data { - struct brcm_usb_phy phys[BRCM_USB_PHY_ID_MAX]; - }; - -+static s8 *node_reg_names[BRCM_REGS_MAX] = { -+ "crtl", "xhci_ec", "xhci_gbl", "usb_phy", "usb_mdio" -+}; -+ - static irqreturn_t brcm_usb_phy_wake_isr(int irq, void *dev_id) - { - struct phy *gphy = dev_id; -@@ -241,15 +251,86 @@ static const struct attribute_group brcm - .attrs = brcm_usb_phy_attrs, - }; - -+static struct match_chip_info chip_info_7216 = { -+ .init_func = &brcm_usb_dvr_init_7216, -+ .required_regs = { -+ BRCM_REGS_CTRL, -+ BRCM_REGS_XHCI_EC, -+ BRCM_REGS_XHCI_GBL, -+ -1, -+ }, -+}; -+ -+static struct match_chip_info chip_info_7211b0 = { -+ .init_func = &brcm_usb_dvr_init_7211b0, -+ .required_regs = { -+ BRCM_REGS_CTRL, -+ BRCM_REGS_XHCI_EC, -+ BRCM_REGS_XHCI_GBL, -+ BRCM_REGS_USB_PHY, -+ BRCM_REGS_USB_MDIO, -+ -1, -+ }, -+}; -+ -+static struct match_chip_info chip_info_7445 = { -+ .init_func = &brcm_usb_dvr_init_7445, -+ .required_regs = { -+ BRCM_REGS_CTRL, -+ BRCM_REGS_XHCI_EC, -+ -1, -+ }, -+}; -+ - static const struct of_device_id brcm_usb_dt_ids[] = { - { - .compatible = "brcm,bcm7216-usb-phy", -- .data = &brcm_usb_dvr_init_7216, -+ .data = &chip_info_7216, -+ }, -+ { -+ .compatible = "brcm,bcm7211-usb-phy", -+ .data = &chip_info_7211b0, -+ }, -+ { -+ .compatible = "brcm,brcmstb-usb-phy", -+ .data = &chip_info_7445, - }, -- { .compatible = "brcm,brcmstb-usb-phy" }, - { /* sentinel */ } - }; - -+static int brcm_usb_get_regs(struct platform_device *pdev, -+ enum brcmusb_reg_sel regs, -+ struct brcm_usb_init_params *ini) -+{ -+ struct resource *res; -+ -+ /* Older DT nodes have ctrl and optional xhci_ec by index only */ -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, -+ node_reg_names[regs]); -+ if (res == NULL) { -+ if (regs == BRCM_REGS_CTRL) { -+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ } else if (regs == BRCM_REGS_XHCI_EC) { -+ res = platform_get_resource(pdev, IORESOURCE_MEM, 1); -+ /* XHCI_EC registers are optional */ -+ if (res == NULL) -+ return 0; -+ } -+ if (res == NULL) { -+ dev_err(&pdev->dev, "can't get %s base address\n", -+ node_reg_names[regs]); -+ return 1; -+ } -+ } -+ ini->regs[regs] = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(ini->regs[regs])) { -+ dev_err(&pdev->dev, "can't map %s register space\n", -+ node_reg_names[regs]); -+ return 1; -+ } -+ return 0; -+} -+ - static int brcm_usb_phy_dvr_init(struct platform_device *pdev, - struct brcm_usb_phy_data *priv, - struct device_node *dn) -@@ -325,9 +406,6 @@ static int brcm_usb_phy_dvr_init(struct - - static int brcm_usb_phy_probe(struct platform_device *pdev) - { -- struct resource *res_ctrl; -- struct resource *res_xhciec = NULL; -- struct resource *res_xhcigbl = NULL; - struct device *dev = &pdev->dev; - struct brcm_usb_phy_data *priv; - struct phy_provider *phy_provider; -@@ -335,6 +413,10 @@ static int brcm_usb_phy_probe(struct pla - int err; - const char *mode; - const struct of_device_id *match; -+ void (*dvr_init)(struct brcm_usb_init_params *params); -+ const struct match_chip_info *info; -+ struct regmap *rmap; -+ int x; - - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); - if (!priv) -@@ -345,58 +427,13 @@ static int brcm_usb_phy_probe(struct pla - priv->ini.product_id = brcmstb_get_product_id(); - - match = of_match_node(brcm_usb_dt_ids, dev->of_node); -- if (match && match->data) { -- void (*dvr_init)(struct brcm_usb_init_params *params); -- -- dvr_init = match->data; -- (*dvr_init)(&priv->ini); -- } else { -- brcm_usb_dvr_init_7445(&priv->ini); -- } -+ info = match->data; -+ dvr_init = info->init_func; -+ (*dvr_init)(&priv->ini); - - dev_dbg(dev, "Best mapping table is for %s\n", - priv->ini.family_name); - -- /* Newer DT node has reg-names. xhci_ec and xhci_gbl are optional. */ -- res_ctrl = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ctrl"); -- if (res_ctrl != NULL) { -- res_xhciec = platform_get_resource_byname(pdev, -- IORESOURCE_MEM, -- "xhci_ec"); -- res_xhcigbl = platform_get_resource_byname(pdev, -- IORESOURCE_MEM, -- "xhci_gbl"); -- } else { -- /* Older DT node without reg-names, use index */ -- res_ctrl = platform_get_resource(pdev, IORESOURCE_MEM, 0); -- if (res_ctrl == NULL) { -- dev_err(dev, "can't get CTRL base address\n"); -- return -EINVAL; -- } -- res_xhciec = platform_get_resource(pdev, IORESOURCE_MEM, 1); -- } -- priv->ini.ctrl_regs = devm_ioremap_resource(dev, res_ctrl); -- if (IS_ERR(priv->ini.ctrl_regs)) { -- dev_err(dev, "can't map CTRL register space\n"); -- return -EINVAL; -- } -- if (res_xhciec) { -- priv->ini.xhci_ec_regs = -- devm_ioremap_resource(dev, res_xhciec); -- if (IS_ERR(priv->ini.xhci_ec_regs)) { -- dev_err(dev, "can't map XHCI EC register space\n"); -- return -EINVAL; -- } -- } -- if (res_xhcigbl) { -- priv->ini.xhci_gbl_regs = -- devm_ioremap_resource(dev, res_xhcigbl); -- if (IS_ERR(priv->ini.xhci_gbl_regs)) { -- dev_err(dev, "can't map XHCI Global register space\n"); -- return -EINVAL; -- } -- } -- - of_property_read_u32(dn, "brcm,ipp", &priv->ini.ipp); - of_property_read_u32(dn, "brcm,ioc", &priv->ini.ioc); - -@@ -412,6 +449,16 @@ static int brcm_usb_phy_probe(struct pla - if (of_property_read_bool(dn, "brcm,has-eohci")) - priv->has_eohci = true; - -+ for (x = 0; x < BRCM_REGS_MAX; x++) { -+ if (info->required_regs[x] >= BRCM_REGS_MAX) -+ break; -+ -+ err = brcm_usb_get_regs(pdev, info->required_regs[x], -+ &priv->ini); -+ if (err) -+ return -EINVAL; -+ } -+ - err = brcm_usb_phy_dvr_init(pdev, priv, dn); - if (err) - return err; -@@ -431,6 +478,15 @@ static int brcm_usb_phy_probe(struct pla - if (err) - dev_warn(dev, "Error creating sysfs attributes\n"); - -+ /* Get piarbctl syscon if it exists */ -+ rmap = syscon_regmap_lookup_by_phandle(dev->of_node, -+ "syscon-piarbctl"); -+ if (IS_ERR(rmap)) -+ rmap = syscon_regmap_lookup_by_phandle(dev->of_node, -+ "brcm,syscon-piarbctl"); -+ if (!IS_ERR(rmap)) -+ priv->ini.syscon_piarbctl = rmap; -+ - /* start with everything off */ - if (priv->has_xhci) - brcm_usb_uninit_xhci(&priv->ini); diff --git a/target/linux/bcm4908/patches-5.4/084-v5.6-0009-phy-usb-fix-driver-to-defer-on-clk_get-defer.patch b/target/linux/bcm4908/patches-5.4/084-v5.6-0009-phy-usb-fix-driver-to-defer-on-clk_get-defer.patch deleted file mode 100644 index a9e4b60ea6..0000000000 --- a/target/linux/bcm4908/patches-5.4/084-v5.6-0009-phy-usb-fix-driver-to-defer-on-clk_get-defer.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 89927fe0061aaa69b39e95ed793d2c61903b7895 Mon Sep 17 00:00:00 2001 -From: Al Cooper <alcooperx@gmail.com> -Date: Fri, 3 Jan 2020 13:18:07 -0500 -Subject: [PATCH] phy: usb: fix driver to defer on clk_get defer - -Handle defer on clk_get because the new SCMI clock driver comes -up after this driver. - -Signed-off-by: Al Cooper <alcooperx@gmail.com> -Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> -Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> ---- - drivers/phy/broadcom/phy-brcm-usb.c | 6 ++++++ - 1 file changed, 6 insertions(+) - ---- a/drivers/phy/broadcom/phy-brcm-usb.c -+++ b/drivers/phy/broadcom/phy-brcm-usb.c -@@ -341,6 +341,8 @@ static int brcm_usb_phy_dvr_init(struct - - priv->usb_20_clk = of_clk_get_by_name(dn, "sw_usb"); - if (IS_ERR(priv->usb_20_clk)) { -+ if (PTR_ERR(priv->usb_20_clk) == -EPROBE_DEFER) -+ return -EPROBE_DEFER; - dev_info(dev, "Clock not found in Device Tree\n"); - priv->usb_20_clk = NULL; - } -@@ -371,6 +373,8 @@ static int brcm_usb_phy_dvr_init(struct - - priv->usb_30_clk = of_clk_get_by_name(dn, "sw_usb3"); - if (IS_ERR(priv->usb_30_clk)) { -+ if (PTR_ERR(priv->usb_30_clk) == -EPROBE_DEFER) -+ return -EPROBE_DEFER; - dev_info(dev, - "USB3.0 clock not found in Device Tree\n"); - priv->usb_30_clk = NULL; -@@ -382,6 +386,8 @@ static int brcm_usb_phy_dvr_init(struct - - priv->suspend_clk = clk_get(dev, "usb0_freerun"); - if (IS_ERR(priv->suspend_clk)) { -+ if (PTR_ERR(priv->suspend_clk) == -EPROBE_DEFER) -+ return -EPROBE_DEFER; - dev_err(dev, "Suspend Clock not found in Device Tree\n"); - priv->suspend_clk = NULL; - } diff --git a/target/linux/bcm4908/patches-5.4/084-v5.6-0010-phy-usb-PHY-s-MDIO-registers-not-accessible-without-.patch b/target/linux/bcm4908/patches-5.4/084-v5.6-0010-phy-usb-PHY-s-MDIO-registers-not-accessible-without-.patch deleted file mode 100644 index 48f829f799..0000000000 --- a/target/linux/bcm4908/patches-5.4/084-v5.6-0010-phy-usb-PHY-s-MDIO-registers-not-accessible-without-.patch +++ /dev/null @@ -1,44 +0,0 @@ -From fc430aea02068150d053ef24bc424db3dd1357d4 Mon Sep 17 00:00:00 2001 -From: Al Cooper <alcooperx@gmail.com> -Date: Fri, 3 Jan 2020 13:18:08 -0500 -Subject: [PATCH] phy: usb: PHY's MDIO registers not accessible without device - installed - -When there is no device connected and FSM is enabled, the XHCI puts -the PHY into suspend mode. When the PHY is put into suspend mode -the USB LDO powers down the PHY. This causes the MDIO to be -inaccessible and its registers reset to default. The fix is to -disable FSM. - -Signed-off-by: Al Cooper <alcooperx@gmail.com> -Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> -Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> ---- - drivers/phy/broadcom/phy-brcm-usb-init-synopsys.c | 9 +++++++++ - 1 file changed, 9 insertions(+) - ---- a/drivers/phy/broadcom/phy-brcm-usb-init-synopsys.c -+++ b/drivers/phy/broadcom/phy-brcm-usb-init-synopsys.c -@@ -56,6 +56,7 @@ - #define USB_PHY_PLL_LDO_CTL 0x08 - #define USB_PHY_PLL_LDO_CTL_AFE_CORERDY_MASK 0x00000004 - #define USB_PHY_UTMI_CTL_1 0x04 -+#define USB_PHY_UTMI_CTL_1_POWER_UP_FSM_EN_MASK 0x00000800 - #define USB_PHY_UTMI_CTL_1_PHY_MODE_MASK 0x0000000c - #define USB_PHY_UTMI_CTL_1_PHY_MODE_SHIFT 2 - #define USB_PHY_STATUS 0x20 -@@ -229,6 +230,14 @@ static void usb_init_common_7211b0(struc - - usb_init_common(params); - -+ /* -+ * Disable FSM, otherwise the PHY will auto suspend when no -+ * device is connected and will be reset on resume. -+ */ -+ reg = brcm_usb_readl(usb_phy + USB_PHY_UTMI_CTL_1); -+ reg &= ~USB_PHY_UTMI_CTL_1_POWER_UP_FSM_EN_MASK; -+ brcm_usb_writel(reg, usb_phy + USB_PHY_UTMI_CTL_1); -+ - usb2_eye_fix_7211b0(params); - } - diff --git a/target/linux/bcm4908/patches-5.4/084-v5.6-0011-phy-usb-bdc-Fix-occasional-failure-with-BDC-on-7211.patch b/target/linux/bcm4908/patches-5.4/084-v5.6-0011-phy-usb-bdc-Fix-occasional-failure-with-BDC-on-7211.patch deleted file mode 100644 index 80ec141685..0000000000 --- a/target/linux/bcm4908/patches-5.4/084-v5.6-0011-phy-usb-bdc-Fix-occasional-failure-with-BDC-on-7211.patch +++ /dev/null @@ -1,135 +0,0 @@ -From bed63b636fedf47dbab899a5193ec5ec4539f6fc Mon Sep 17 00:00:00 2001 -From: Al Cooper <alcooperx@gmail.com> -Date: Fri, 3 Jan 2020 13:18:09 -0500 -Subject: [PATCH] phy: usb: bdc: Fix occasional failure with BDC on 7211 - -The BDC "Read Transaction Size" needs to be changed from 1024 -bytes to 256 bytes to prevent occasional transaction failures. - -Signed-off-by: Al Cooper <alcooperx@gmail.com> -Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> -Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> ---- - .../phy/broadcom/phy-brcm-usb-init-synopsys.c | 18 +++++++++++++++ - drivers/phy/broadcom/phy-brcm-usb-init.h | 1 + - drivers/phy/broadcom/phy-brcm-usb.c | 23 +++++++++++++++---- - 3 files changed, 38 insertions(+), 4 deletions(-) - ---- a/drivers/phy/broadcom/phy-brcm-usb-init-synopsys.c -+++ b/drivers/phy/broadcom/phy-brcm-usb-init-synopsys.c -@@ -70,6 +70,11 @@ - #define USB_GMDIOCSR 0 - #define USB_GMDIOGEN 4 - -+/* Register definitions for the BDC EC block in 7211b0 */ -+#define BDC_EC_AXIRDA 0x0c -+#define BDC_EC_AXIRDA_RTS_MASK 0xf0000000 -+#define BDC_EC_AXIRDA_RTS_SHIFT 28 -+ - - static void usb_mdio_write_7211b0(struct brcm_usb_init_params *params, - uint8_t addr, uint16_t data) -@@ -198,6 +203,7 @@ static void usb_init_common_7211b0(struc - { - void __iomem *ctrl = params->regs[BRCM_REGS_CTRL]; - void __iomem *usb_phy = params->regs[BRCM_REGS_USB_PHY]; -+ void __iomem *bdc_ec = params->regs[BRCM_REGS_BDC_EC]; - int timeout_ms = PHY_LOCK_TIMEOUT_MS; - u32 reg; - -@@ -231,6 +237,18 @@ static void usb_init_common_7211b0(struc - usb_init_common(params); - - /* -+ * The BDC controller will get occasional failures with -+ * the default "Read Transaction Size" of 6 (1024 bytes). -+ * Set it to 4 (256 bytes). -+ */ -+ if ((params->mode != USB_CTLR_MODE_HOST) && bdc_ec) { -+ reg = brcm_usb_readl(bdc_ec + BDC_EC_AXIRDA); -+ reg &= ~BDC_EC_AXIRDA_RTS_MASK; -+ reg |= (0x4 << BDC_EC_AXIRDA_RTS_SHIFT); -+ brcm_usb_writel(reg, bdc_ec + BDC_EC_AXIRDA); -+ } -+ -+ /* - * Disable FSM, otherwise the PHY will auto suspend when no - * device is connected and will be reset on resume. - */ ---- a/drivers/phy/broadcom/phy-brcm-usb-init.h -+++ b/drivers/phy/broadcom/phy-brcm-usb-init.h -@@ -19,6 +19,7 @@ enum brcmusb_reg_sel { - BRCM_REGS_XHCI_GBL, - BRCM_REGS_USB_PHY, - BRCM_REGS_USB_MDIO, -+ BRCM_REGS_BDC_EC, - BRCM_REGS_MAX - }; - ---- a/drivers/phy/broadcom/phy-brcm-usb.c -+++ b/drivers/phy/broadcom/phy-brcm-usb.c -@@ -36,6 +36,7 @@ struct value_to_name_map { - struct match_chip_info { - void *init_func; - u8 required_regs[BRCM_REGS_MAX + 1]; -+ u8 optional_reg; - }; - - static struct value_to_name_map brcm_dr_mode_to_name[] = { -@@ -71,7 +72,7 @@ struct brcm_usb_phy_data { - }; - - static s8 *node_reg_names[BRCM_REGS_MAX] = { -- "crtl", "xhci_ec", "xhci_gbl", "usb_phy", "usb_mdio" -+ "crtl", "xhci_ec", "xhci_gbl", "usb_phy", "usb_mdio", "bdc_ec" - }; - - static irqreturn_t brcm_usb_phy_wake_isr(int irq, void *dev_id) -@@ -271,6 +272,7 @@ static struct match_chip_info chip_info_ - BRCM_REGS_USB_MDIO, - -1, - }, -+ .optional_reg = BRCM_REGS_BDC_EC, - }; - - static struct match_chip_info chip_info_7445 = { -@@ -300,7 +302,8 @@ static const struct of_device_id brcm_us - - static int brcm_usb_get_regs(struct platform_device *pdev, - enum brcmusb_reg_sel regs, -- struct brcm_usb_init_params *ini) -+ struct brcm_usb_init_params *ini, -+ bool optional) - { - struct resource *res; - -@@ -317,7 +320,13 @@ static int brcm_usb_get_regs(struct plat - return 0; - } - if (res == NULL) { -- dev_err(&pdev->dev, "can't get %s base address\n", -+ if (optional) { -+ dev_dbg(&pdev->dev, -+ "Optional reg %s not found\n", -+ node_reg_names[regs]); -+ return 0; -+ } -+ dev_err(&pdev->dev, "can't get %s base addr\n", - node_reg_names[regs]); - return 1; - } -@@ -460,7 +469,13 @@ static int brcm_usb_phy_probe(struct pla - break; - - err = brcm_usb_get_regs(pdev, info->required_regs[x], -- &priv->ini); -+ &priv->ini, false); -+ if (err) -+ return -EINVAL; -+ } -+ if (info->optional_reg) { -+ err = brcm_usb_get_regs(pdev, info->optional_reg, -+ &priv->ini, true); - if (err) - return -EINVAL; - } diff --git a/target/linux/bcm4908/patches-5.4/084-v5.6-0012-phy-usb-USB-driver-is-crashing-during-S3-resume-on-7.patch b/target/linux/bcm4908/patches-5.4/084-v5.6-0012-phy-usb-USB-driver-is-crashing-during-S3-resume-on-7.patch deleted file mode 100644 index b10f86d0a3..0000000000 --- a/target/linux/bcm4908/patches-5.4/084-v5.6-0012-phy-usb-USB-driver-is-crashing-during-S3-resume-on-7.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 5dfe1cec580829faa49842672a25481b104c26ef Mon Sep 17 00:00:00 2001 -From: Al Cooper <alcooperx@gmail.com> -Date: Fri, 3 Jan 2020 13:18:10 -0500 -Subject: [PATCH] phy: usb: USB driver is crashing during S3 resume on 7216 - -This is a result of the USB 2.0 clocks not being disabled/enabled -during suspend/resume on XHCI only systems. - -Signed-off-by: Al Cooper <alcooperx@gmail.com> -Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> -Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> ---- - drivers/phy/broadcom/phy-brcm-usb.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/phy/broadcom/phy-brcm-usb.c -+++ b/drivers/phy/broadcom/phy-brcm-usb.c -@@ -543,7 +543,7 @@ static int brcm_usb_phy_suspend(struct d - brcm_usb_wake_enable(&priv->ini, true); - if (priv->phys[BRCM_USB_PHY_3_0].inited) - clk_disable_unprepare(priv->usb_30_clk); -- if (priv->phys[BRCM_USB_PHY_2_0].inited) -+ if (priv->phys[BRCM_USB_PHY_2_0].inited || !priv->has_eohci) - clk_disable_unprepare(priv->usb_20_clk); - if (priv->wake_irq >= 0) - enable_irq_wake(priv->wake_irq); diff --git a/target/linux/bcm4908/patches-5.4/084-v5.6-0013-phy-usb-Add-support-for-wake-and-USB-low-power-mode-.patch b/target/linux/bcm4908/patches-5.4/084-v5.6-0013-phy-usb-Add-support-for-wake-and-USB-low-power-mode-.patch deleted file mode 100644 index 5a3a687adb..0000000000 --- a/target/linux/bcm4908/patches-5.4/084-v5.6-0013-phy-usb-Add-support-for-wake-and-USB-low-power-mode-.patch +++ /dev/null @@ -1,328 +0,0 @@ -From b0c0b66c0b432d3f3a1ae5849298ba9c7f1810c5 Mon Sep 17 00:00:00 2001 -From: Al Cooper <alcooperx@gmail.com> -Date: Fri, 3 Jan 2020 13:18:11 -0500 -Subject: [PATCH] phy: usb: Add support for wake and USB low power mode for - 7211 S2/S5 - -Add support for 7211 USB wake. Disable all possible 7211 USB logic -for S2/S5 if USB wake is not enabled. - -On the 7211, the XHCI wake signal was not connected properly and -only goes to the USB1_USB1_CTRL_TP_DIAG1 diagonstic register. -The workaround is to have VPU code running that polls for the -proper bit in the DIAG register and to wake the system when -the bit is asserted. - -Signed-off-by: Al Cooper <alcooperx@gmail.com> -Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> -Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> ---- - .../phy/broadcom/phy-brcm-usb-init-synopsys.c | 77 +++++++++++++++++-- - drivers/phy/broadcom/phy-brcm-usb-init.c | 26 ++++--- - drivers/phy/broadcom/phy-brcm-usb-init.h | 11 +-- - drivers/phy/broadcom/phy-brcm-usb.c | 25 ++++-- - 4 files changed, 105 insertions(+), 34 deletions(-) - ---- a/drivers/phy/broadcom/phy-brcm-usb-init-synopsys.c -+++ b/drivers/phy/broadcom/phy-brcm-usb-init-synopsys.c -@@ -26,7 +26,6 @@ - #define PIARBCTL_MISC_CAM1_MEM_PAGE_MASK 0x00000f00 - #define PIARBCTL_MISC_CAM0_MEM_PAGE_MASK 0x000000f0 - #define PIARBCTL_MISC_SATA_PRIORITY_MASK 0x0000000f --#define PIARBCTL_USB_M_ASB_CTRL 0x10 - - #define PIARBCTL_MISC_USB_ONLY_MASK \ - (PIARBCTL_MISC_USB_SELECT_MASK | \ -@@ -51,14 +50,27 @@ - #define USB_CTRL_USB_PM_STATUS 0x08 - #define USB_CTRL_USB_DEVICE_CTL1 0x10 - #define USB_CTRL_USB_DEVICE_CTL1_PORT_MODE_MASK 0x00000003 -+#define USB_CTRL_TEST_PORT_CTL 0x30 -+#define USB_CTRL_TEST_PORT_CTL_TPOUT_SEL_MASK 0x000000ff -+#define USB_CTRL_TEST_PORT_CTL_TPOUT_SEL_PME_GEN_MASK 0x0000002e -+#define USB_CTRL_TP_DIAG1 0x34 -+#define USB_CTLR_TP_DIAG1_wake_MASK 0x00000002 -+#define USB_CTRL_CTLR_CSHCR 0x50 -+#define USB_CTRL_CTLR_CSHCR_ctl_pme_en_MASK 0x00040000 - - /* Register definitions for the USB_PHY block in 7211b0 */ -+#define USB_PHY_PLL_CTL 0x00 -+#define USB_PHY_PLL_CTL_PLL_RESETB_MASK 0x40000000 - #define USB_PHY_PLL_LDO_CTL 0x08 - #define USB_PHY_PLL_LDO_CTL_AFE_CORERDY_MASK 0x00000004 -+#define USB_PHY_PLL_LDO_CTL_AFE_LDO_PWRDWNB_MASK 0x00000002 -+#define USB_PHY_PLL_LDO_CTL_AFE_BG_PWRDWNB_MASK 0x00000001 - #define USB_PHY_UTMI_CTL_1 0x04 - #define USB_PHY_UTMI_CTL_1_POWER_UP_FSM_EN_MASK 0x00000800 - #define USB_PHY_UTMI_CTL_1_PHY_MODE_MASK 0x0000000c - #define USB_PHY_UTMI_CTL_1_PHY_MODE_SHIFT 2 -+#define USB_PHY_IDDQ 0x1c -+#define USB_PHY_IDDQ_phy_iddq_MASK 0x00000001 - #define USB_PHY_STATUS 0x20 - #define USB_PHY_STATUS_pll_lock_MASK 0x00000001 - -@@ -199,6 +211,17 @@ static void usb_init_common(struct brcm_ - } - } - -+static void usb_wake_enable_7211b0(struct brcm_usb_init_params *params, -+ bool enable) -+{ -+ void __iomem *ctrl = params->regs[BRCM_REGS_CTRL]; -+ -+ if (enable) -+ USB_CTRL_SET(ctrl, CTLR_CSHCR, ctl_pme_en); -+ else -+ USB_CTRL_UNSET(ctrl, CTLR_CSHCR, ctl_pme_en); -+} -+ - static void usb_init_common_7211b0(struct brcm_usb_init_params *params) - { - void __iomem *ctrl = params->regs[BRCM_REGS_CTRL]; -@@ -210,9 +233,27 @@ static void usb_init_common_7211b0(struc - if (params->syscon_piarbctl) - syscon_piarbctl_init(params->syscon_piarbctl); - -+ USB_CTRL_UNSET(ctrl, USB_PM, USB_PWRDN); -+ -+ usb_wake_enable_7211b0(params, false); -+ if (!params->wake_enabled) { -+ -+ /* undo possible suspend settings */ -+ brcm_usb_writel(0, usb_phy + USB_PHY_IDDQ); -+ reg = brcm_usb_readl(usb_phy + USB_PHY_PLL_CTL); -+ reg |= USB_PHY_PLL_CTL_PLL_RESETB_MASK; -+ brcm_usb_writel(reg, usb_phy + USB_PHY_PLL_CTL); -+ -+ /* temporarily enable FSM so PHY comes up properly */ -+ reg = brcm_usb_readl(usb_phy + USB_PHY_UTMI_CTL_1); -+ reg |= USB_PHY_UTMI_CTL_1_POWER_UP_FSM_EN_MASK; -+ brcm_usb_writel(reg, usb_phy + USB_PHY_UTMI_CTL_1); -+ } -+ - /* Init the PHY */ -- reg = brcm_usb_readl(usb_phy + USB_PHY_PLL_LDO_CTL); -- reg |= USB_PHY_PLL_LDO_CTL_AFE_CORERDY_MASK; -+ reg = USB_PHY_PLL_LDO_CTL_AFE_CORERDY_MASK | -+ USB_PHY_PLL_LDO_CTL_AFE_LDO_PWRDWNB_MASK | -+ USB_PHY_PLL_LDO_CTL_AFE_BG_PWRDWNB_MASK; - brcm_usb_writel(reg, usb_phy + USB_PHY_PLL_LDO_CTL); - - /* wait for lock */ -@@ -276,12 +317,36 @@ static void usb_uninit_common(struct brc - - } - -+static void usb_uninit_common_7211b0(struct brcm_usb_init_params *params) -+{ -+ void __iomem *ctrl = params->regs[BRCM_REGS_CTRL]; -+ void __iomem *usb_phy = params->regs[BRCM_REGS_USB_PHY]; -+ u32 reg; -+ -+ pr_debug("%s\n", __func__); -+ -+ if (params->wake_enabled) { -+ USB_CTRL_SET(ctrl, TEST_PORT_CTL, TPOUT_SEL_PME_GEN); -+ usb_wake_enable_7211b0(params, true); -+ } else { -+ USB_CTRL_SET(ctrl, USB_PM, USB_PWRDN); -+ brcm_usb_writel(0, usb_phy + USB_PHY_PLL_LDO_CTL); -+ reg = brcm_usb_readl(usb_phy + USB_PHY_PLL_CTL); -+ reg &= ~USB_PHY_PLL_CTL_PLL_RESETB_MASK; -+ brcm_usb_writel(reg, usb_phy + USB_PHY_PLL_CTL); -+ brcm_usb_writel(USB_PHY_IDDQ_phy_iddq_MASK, -+ usb_phy + USB_PHY_IDDQ); -+ } -+ -+} -+ - static void usb_uninit_xhci(struct brcm_usb_init_params *params) - { - - pr_debug("%s\n", __func__); - -- xhci_soft_reset(params, 1); -+ if (!params->wake_enabled) -+ xhci_soft_reset(params, 1); - } - - static int usb_get_dual_select(struct brcm_usb_init_params *params) -@@ -309,7 +374,6 @@ static void usb_set_dual_select(struct b - brcm_usb_writel(reg, USB_CTRL_REG(ctrl, USB_DEVICE_CTL1)); - } - -- - static const struct brcm_usb_init_ops bcm7216_ops = { - .init_ipp = usb_init_ipp, - .init_common = usb_init_common, -@@ -324,7 +388,7 @@ static const struct brcm_usb_init_ops bc - .init_ipp = usb_init_ipp, - .init_common = usb_init_common_7211b0, - .init_xhci = usb_init_xhci, -- .uninit_common = usb_uninit_common, -+ .uninit_common = usb_uninit_common_7211b0, - .uninit_xhci = usb_uninit_xhci, - .get_dual_select = usb_get_dual_select, - .set_dual_select = usb_set_dual_select, -@@ -346,4 +410,5 @@ void brcm_usb_dvr_init_7211b0(struct brc - - params->family_name = "7211"; - params->ops = &bcm7211b0_ops; -+ params->suspend_with_clocks = true; - } ---- a/drivers/phy/broadcom/phy-brcm-usb-init.c -+++ b/drivers/phy/broadcom/phy-brcm-usb-init.c -@@ -783,12 +783,24 @@ static void usb_init_ipp(struct brcm_usb - msleep(50); - } - -+static void usb_wake_enable(struct brcm_usb_init_params *params, -+ bool enable) -+{ -+ void __iomem *ctrl = params->regs[BRCM_REGS_CTRL]; -+ -+ if (enable) -+ USB_CTRL_SET(ctrl, USB_PM, RMTWKUP_EN); -+ else -+ USB_CTRL_UNSET(ctrl, USB_PM, RMTWKUP_EN); -+} -+ - static void usb_init_common(struct brcm_usb_init_params *params) - { - u32 reg; - void __iomem *ctrl = params->regs[BRCM_REGS_CTRL]; - - /* Clear any pending wake conditions */ -+ usb_wake_enable(params, false); - reg = brcm_usb_readl(USB_CTRL_REG(ctrl, USB_PM_STATUS)); - brcm_usb_writel(reg, USB_CTRL_REG(ctrl, USB_PM_STATUS)); - -@@ -935,6 +947,8 @@ static void usb_uninit_common(struct brc - - if (USB_CTRL_MASK_FAMILY(params, PLL_CTL, PLL_IDDQ_PWRDN)) - USB_CTRL_SET_FAMILY(params, PLL_CTL, PLL_IDDQ_PWRDN); -+ if (params->wake_enabled) -+ usb_wake_enable(params, true); - } - - static void usb_uninit_eohci(struct brcm_usb_init_params *params) -@@ -978,17 +992,6 @@ static void usb_set_dual_select(struct b - } - } - --static void usb_wake_enable(struct brcm_usb_init_params *params, -- int enable) --{ -- void __iomem *ctrl = params->regs[BRCM_REGS_CTRL]; -- -- if (enable) -- USB_CTRL_SET(ctrl, USB_PM, RMTWKUP_EN); -- else -- USB_CTRL_UNSET(ctrl, USB_PM, RMTWKUP_EN); --} -- - static const struct brcm_usb_init_ops bcm7445_ops = { - .init_ipp = usb_init_ipp, - .init_common = usb_init_common, -@@ -999,7 +1002,6 @@ static const struct brcm_usb_init_ops bc - .uninit_xhci = usb_uninit_xhci, - .get_dual_select = usb_get_dual_select, - .set_dual_select = usb_set_dual_select, -- .wake_enable = usb_wake_enable, - }; - - void brcm_usb_dvr_init_7445(struct brcm_usb_init_params *params) ---- a/drivers/phy/broadcom/phy-brcm-usb-init.h -+++ b/drivers/phy/broadcom/phy-brcm-usb-init.h -@@ -46,8 +46,6 @@ struct brcm_usb_init_ops { - void (*uninit_xhci)(struct brcm_usb_init_params *params); - int (*get_dual_select)(struct brcm_usb_init_params *params); - void (*set_dual_select)(struct brcm_usb_init_params *params, int mode); -- void (*wake_enable)(struct brcm_usb_init_params *params, -- int enable); - }; - - struct brcm_usb_init_params { -@@ -62,6 +60,8 @@ struct brcm_usb_init_params { - const u32 *usb_reg_bits_map; - const struct brcm_usb_init_ops *ops; - struct regmap *syscon_piarbctl; -+ bool wake_enabled; -+ bool suspend_with_clocks; - }; - - void brcm_usb_dvr_init_7445(struct brcm_usb_init_params *params); -@@ -145,13 +145,6 @@ static inline void brcm_usb_uninit_xhci( - ini->ops->uninit_xhci(ini); - } - --static inline void brcm_usb_wake_enable(struct brcm_usb_init_params *ini, -- int enable) --{ -- if (ini->ops->wake_enable) -- ini->ops->wake_enable(ini, enable); --} -- - static inline int brcm_usb_get_dual_select(struct brcm_usb_init_params *ini) - { - if (ini->ops->get_dual_select) ---- a/drivers/phy/broadcom/phy-brcm-usb.c -+++ b/drivers/phy/broadcom/phy-brcm-usb.c -@@ -535,16 +535,26 @@ static int brcm_usb_phy_suspend(struct d - struct brcm_usb_phy_data *priv = dev_get_drvdata(dev); - - if (priv->init_count) { -+ priv->ini.wake_enabled = device_may_wakeup(dev); - if (priv->phys[BRCM_USB_PHY_3_0].inited) - brcm_usb_uninit_xhci(&priv->ini); - if (priv->phys[BRCM_USB_PHY_2_0].inited) - brcm_usb_uninit_eohci(&priv->ini); - brcm_usb_uninit_common(&priv->ini); -- brcm_usb_wake_enable(&priv->ini, true); -- if (priv->phys[BRCM_USB_PHY_3_0].inited) -- clk_disable_unprepare(priv->usb_30_clk); -- if (priv->phys[BRCM_USB_PHY_2_0].inited || !priv->has_eohci) -- clk_disable_unprepare(priv->usb_20_clk); -+ -+ /* -+ * Handle the clocks unless needed for wake. This has -+ * to work for both older XHCI->3.0-clks, EOHCI->2.0-clks -+ * and newer XHCI->2.0-clks/3.0-clks. -+ */ -+ -+ if (!priv->ini.suspend_with_clocks) { -+ if (priv->phys[BRCM_USB_PHY_3_0].inited) -+ clk_disable_unprepare(priv->usb_30_clk); -+ if (priv->phys[BRCM_USB_PHY_2_0].inited || -+ !priv->has_eohci) -+ clk_disable_unprepare(priv->usb_20_clk); -+ } - if (priv->wake_irq >= 0) - enable_irq_wake(priv->wake_irq); - } -@@ -557,7 +567,6 @@ static int brcm_usb_phy_resume(struct de - - clk_prepare_enable(priv->usb_20_clk); - clk_prepare_enable(priv->usb_30_clk); -- brcm_usb_wake_enable(&priv->ini, false); - brcm_usb_init_ipp(&priv->ini); - - /* -@@ -579,6 +588,8 @@ static int brcm_usb_phy_resume(struct de - } else if (priv->has_xhci) { - brcm_usb_uninit_xhci(&priv->ini); - clk_disable_unprepare(priv->usb_30_clk); -+ if (!priv->has_eohci) -+ clk_disable_unprepare(priv->usb_20_clk); - } - } else { - if (priv->has_xhci) -@@ -589,7 +600,7 @@ static int brcm_usb_phy_resume(struct de - clk_disable_unprepare(priv->usb_20_clk); - clk_disable_unprepare(priv->usb_30_clk); - } -- -+ priv->ini.wake_enabled = false; - return 0; - } - #endif /* CONFIG_PM_SLEEP */ diff --git a/target/linux/bcm4908/patches-5.4/085-v5.8-0001-phy-phy-brcm-usb-Constify-static-structs.patch b/target/linux/bcm4908/patches-5.4/085-v5.8-0001-phy-phy-brcm-usb-Constify-static-structs.patch deleted file mode 100644 index 36683fc437..0000000000 --- a/target/linux/bcm4908/patches-5.4/085-v5.8-0001-phy-phy-brcm-usb-Constify-static-structs.patch +++ /dev/null @@ -1,99 +0,0 @@ -From c79cc3d55c4bf94e9028d6818d449fbdc488eac5 Mon Sep 17 00:00:00 2001 -From: Rikard Falkeborn <rikard.falkeborn@gmail.com> -Date: Sat, 16 May 2020 14:04:41 +0200 -Subject: [PATCH] phy: phy-brcm-usb: Constify static structs - -A number of structs were not modified and can therefore be made const -to allow the compiler to put them in read-only memory. - -In order to do so, update a few functions that don't modify there input -to take pointers to const. - -Before: - text data bss dec hex filename - 15511 6448 64 22023 5607 drivers/phy/broadcom/phy-brcm-usb.o - -After: - text data bss dec hex filename - 16058 5936 64 22058 562a drivers/phy/broadcom/phy-brcm-usb.o - -Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com> -Link: https://lore.kernel.org/r/20200516120441.7627-4-rikard.falkeborn@gmail.com -Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> ---- - drivers/phy/broadcom/phy-brcm-usb.c | 16 ++++++++-------- - 1 file changed, 8 insertions(+), 8 deletions(-) - ---- a/drivers/phy/broadcom/phy-brcm-usb.c -+++ b/drivers/phy/broadcom/phy-brcm-usb.c -@@ -39,14 +39,14 @@ struct match_chip_info { - u8 optional_reg; - }; - --static struct value_to_name_map brcm_dr_mode_to_name[] = { -+static const struct value_to_name_map brcm_dr_mode_to_name[] = { - { USB_CTLR_MODE_HOST, "host" }, - { USB_CTLR_MODE_DEVICE, "peripheral" }, - { USB_CTLR_MODE_DRD, "drd" }, - { USB_CTLR_MODE_TYPEC_PD, "typec-pd" } - }; - --static struct value_to_name_map brcm_dual_mode_to_name[] = { -+static const struct value_to_name_map brcm_dual_mode_to_name[] = { - { 0, "host" }, - { 1, "device" }, - { 2, "auto" }, -@@ -138,7 +138,7 @@ static int brcm_usb_phy_exit(struct phy - return 0; - } - --static struct phy_ops brcm_usb_phy_ops = { -+static const struct phy_ops brcm_usb_phy_ops = { - .init = brcm_usb_phy_init, - .exit = brcm_usb_phy_exit, - .owner = THIS_MODULE, -@@ -170,7 +170,7 @@ static struct phy *brcm_usb_phy_xlate(st - return ERR_PTR(-ENODEV); - } - --static int name_to_value(struct value_to_name_map *table, int count, -+static int name_to_value(const struct value_to_name_map *table, int count, - const char *name, int *value) - { - int x; -@@ -185,7 +185,7 @@ static int name_to_value(struct value_to - return -EINVAL; - } - --static const char *value_to_name(struct value_to_name_map *table, int count, -+static const char *value_to_name(const struct value_to_name_map *table, int count, - int value) - { - if (value >= count) -@@ -252,7 +252,7 @@ static const struct attribute_group brcm - .attrs = brcm_usb_phy_attrs, - }; - --static struct match_chip_info chip_info_7216 = { -+static const struct match_chip_info chip_info_7216 = { - .init_func = &brcm_usb_dvr_init_7216, - .required_regs = { - BRCM_REGS_CTRL, -@@ -262,7 +262,7 @@ static struct match_chip_info chip_info_ - }, - }; - --static struct match_chip_info chip_info_7211b0 = { -+static const struct match_chip_info chip_info_7211b0 = { - .init_func = &brcm_usb_dvr_init_7211b0, - .required_regs = { - BRCM_REGS_CTRL, -@@ -275,7 +275,7 @@ static struct match_chip_info chip_info_ - .optional_reg = BRCM_REGS_BDC_EC, - }; - --static struct match_chip_info chip_info_7445 = { -+static const struct match_chip_info chip_info_7445 = { - .init_func = &brcm_usb_dvr_init_7445, - .required_regs = { - BRCM_REGS_CTRL, diff --git a/target/linux/bcm4908/patches-5.4/086-v5.12-0001-phy-phy-brcm-usb-improve-getting-OF-matching-data.patch b/target/linux/bcm4908/patches-5.4/086-v5.12-0001-phy-phy-brcm-usb-improve-getting-OF-matching-data.patch deleted file mode 100644 index cc71373165..0000000000 --- a/target/linux/bcm4908/patches-5.4/086-v5.12-0001-phy-phy-brcm-usb-improve-getting-OF-matching-data.patch +++ /dev/null @@ -1,49 +0,0 @@ -From d14f4cce9340a6586512a0eb6bc680dedeaaef14 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Wed, 16 Dec 2020 15:33:04 +0100 -Subject: [PATCH] phy: phy-brcm-usb: improve getting OF matching data -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -1. Use of_device_get_match_data() helper to simplify the code -2. Check for NULL as a good practice - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Acked-by: Florian Fainelli <f.fainelli@gmail.com> -Link: https://lore.kernel.org/r/20201216143305.12179-1-zajec5@gmail.com -Signed-off-by: Vinod Koul <vkoul@kernel.org> ---- - drivers/phy/broadcom/phy-brcm-usb.c | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) - ---- a/drivers/phy/broadcom/phy-brcm-usb.c -+++ b/drivers/phy/broadcom/phy-brcm-usb.c -@@ -11,6 +11,7 @@ - #include <linux/io.h> - #include <linux/module.h> - #include <linux/of.h> -+#include <linux/of_device.h> - #include <linux/phy/phy.h> - #include <linux/platform_device.h> - #include <linux/interrupt.h> -@@ -427,7 +428,6 @@ static int brcm_usb_phy_probe(struct pla - struct device_node *dn = pdev->dev.of_node; - int err; - const char *mode; -- const struct of_device_id *match; - void (*dvr_init)(struct brcm_usb_init_params *params); - const struct match_chip_info *info; - struct regmap *rmap; -@@ -441,8 +441,9 @@ static int brcm_usb_phy_probe(struct pla - priv->ini.family_id = brcmstb_get_family_id(); - priv->ini.product_id = brcmstb_get_product_id(); - -- match = of_match_node(brcm_usb_dt_ids, dev->of_node); -- info = match->data; -+ info = of_device_get_match_data(&pdev->dev); -+ if (!info) -+ return -ENOENT; - dvr_init = info->init_func; - (*dvr_init)(&priv->ini); - diff --git a/target/linux/bcm4908/patches-5.4/086-v5.12-0002-phy-phy-brcm-usb-specify-init-function-format-at-str.patch b/target/linux/bcm4908/patches-5.4/086-v5.12-0002-phy-phy-brcm-usb-specify-init-function-format-at-str.patch deleted file mode 100644 index bdc932732c..0000000000 --- a/target/linux/bcm4908/patches-5.4/086-v5.12-0002-phy-phy-brcm-usb-specify-init-function-format-at-str.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 915f1d230e5292bc2156a9997bcb19d9e632f10b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Wed, 16 Dec 2020 15:33:05 +0100 -Subject: [PATCH] phy: phy-brcm-usb: specify init function format at struct - level -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This is slightly cleaner solution that assures noone assings a wrong -function to the pointer. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Acked-by: Florian Fainelli <f.fainelli@gmail.com> -Link: https://lore.kernel.org/r/20201216143305.12179-2-zajec5@gmail.com -Signed-off-by: Vinod Koul <vkoul@kernel.org> ---- - drivers/phy/broadcom/phy-brcm-usb.c | 7 +++---- - 1 file changed, 3 insertions(+), 4 deletions(-) - ---- a/drivers/phy/broadcom/phy-brcm-usb.c -+++ b/drivers/phy/broadcom/phy-brcm-usb.c -@@ -35,7 +35,7 @@ struct value_to_name_map { - }; - - struct match_chip_info { -- void *init_func; -+ void (*init_func)(struct brcm_usb_init_params *params); - u8 required_regs[BRCM_REGS_MAX + 1]; - u8 optional_reg; - }; -@@ -428,7 +428,6 @@ static int brcm_usb_phy_probe(struct pla - struct device_node *dn = pdev->dev.of_node; - int err; - const char *mode; -- void (*dvr_init)(struct brcm_usb_init_params *params); - const struct match_chip_info *info; - struct regmap *rmap; - int x; -@@ -444,8 +443,8 @@ static int brcm_usb_phy_probe(struct pla - info = of_device_get_match_data(&pdev->dev); - if (!info) - return -ENOENT; -- dvr_init = info->init_func; -- (*dvr_init)(&priv->ini); -+ -+ info->init_func(&priv->ini); - - dev_dbg(dev, "Best mapping table is for %s\n", - priv->ini.family_name); diff --git a/target/linux/bcm4908/patches-5.4/086-v5.12-0003-dt-bindings-phy-brcm-brcmstb-usb-phy-convert-to-the-.patch b/target/linux/bcm4908/patches-5.4/086-v5.12-0003-dt-bindings-phy-brcm-brcmstb-usb-phy-convert-to-the-.patch deleted file mode 100644 index 1edd63ea5d..0000000000 --- a/target/linux/bcm4908/patches-5.4/086-v5.12-0003-dt-bindings-phy-brcm-brcmstb-usb-phy-convert-to-the-.patch +++ /dev/null @@ -1,315 +0,0 @@ -From b39069a482ade0c5e18c407c3218ba1aeed371b6 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Wed, 6 Jan 2021 21:58:36 +0100 -Subject: [PATCH] dt-bindings: phy: brcm, brcmstb-usb-phy: convert to the - json-schema -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Changes that require mentioning: -1. interrupt-names - Name "wakeup" was changed to the "wake". It matches example and what - Linux driver looks for in the first place -2. brcm,ipp and brcm,ioc - Both were described as booleans with 0 / 1 values. In examples they - were integers and Linux checks for int as well. Both got uint32. -3. Added minimal description - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> -Reviewed-by: Rob Herring <robh@kernel.org> -Link: https://lore.kernel.org/r/20210106205838.10964-1-zajec5@gmail.com -Signed-off-by: Vinod Koul <vkoul@kernel.org> ---- - .../bindings/phy/brcm,brcmstb-usb-phy.txt | 86 -------- - .../bindings/phy/brcm,brcmstb-usb-phy.yaml | 193 ++++++++++++++++++ - 2 files changed, 193 insertions(+), 86 deletions(-) - delete mode 100644 Documentation/devicetree/bindings/phy/brcm,brcmstb-usb-phy.txt - create mode 100644 Documentation/devicetree/bindings/phy/brcm,brcmstb-usb-phy.yaml - ---- a/Documentation/devicetree/bindings/phy/brcm,brcmstb-usb-phy.txt -+++ /dev/null -@@ -1,86 +0,0 @@ --Broadcom STB USB PHY -- --Required properties: --- compatible: should be one of -- "brcm,brcmstb-usb-phy" -- "brcm,bcm7216-usb-phy" -- "brcm,bcm7211-usb-phy" -- --- reg and reg-names properties requirements are specific to the -- compatible string. -- "brcm,brcmstb-usb-phy": -- - reg: 1 or 2 offset and length pairs. One for the base CTRL registers -- and an optional pair for systems with USB 3.x support -- - reg-names: not specified -- "brcm,bcm7216-usb-phy": -- - reg: 3 offset and length pairs for CTRL, XHCI_EC and XHCI_GBL -- registers -- - reg-names: "ctrl", "xhci_ec", "xhci_gbl" -- "brcm,bcm7211-usb-phy": -- - reg: 5 offset and length pairs for CTRL, XHCI_EC, XHCI_GBL, -- USB_PHY and USB_MDIO registers and an optional pair -- for the BDC registers -- - reg-names: "ctrl", "xhci_ec", "xhci_gbl", "usb_phy", "usb_mdio", "bdc_ec" -- --- #phy-cells: Shall be 1 as it expects one argument for setting -- the type of the PHY. Possible values are: -- - PHY_TYPE_USB2 for USB1.1/2.0 PHY -- - PHY_TYPE_USB3 for USB3.x PHY -- --Optional Properties: --- clocks : clock phandles. --- clock-names: String, clock name. --- interrupts: wakeup interrupt --- interrupt-names: "wakeup" --- brcm,ipp: Boolean, Invert Port Power. -- Possible values are: 0 (Don't invert), 1 (Invert) --- brcm,ioc: Boolean, Invert Over Current detection. -- Possible values are: 0 (Don't invert), 1 (Invert) --- dr_mode: String, PHY Device mode. -- Possible values are: "host", "peripheral ", "drd" or "typec-pd" -- If this property is not defined, the phy will default to "host" mode. --- brcm,syscon-piarbctl: phandle to syscon for handling config registers --NOTE: one or both of the following two properties must be set --- brcm,has-xhci: Boolean indicating the phy has an XHCI phy. --- brcm,has-eohci: Boolean indicating the phy has an EHCI/OHCI phy. -- -- --Example: -- --usbphy_0: usb-phy@f0470200 { -- reg = <0xf0470200 0xb8>, -- <0xf0471940 0x6c0>; -- compatible = "brcm,brcmstb-usb-phy"; -- #phy-cells = <1>; -- dr_mode = "host" -- brcm,ioc = <1>; -- brcm,ipp = <1>; -- brcm,has-xhci; -- brcm,has-eohci; -- clocks = <&usb20>, <&usb30>; -- clock-names = "sw_usb", "sw_usb3"; --}; -- --usb-phy@29f0200 { -- reg = <0x29f0200 0x200>, -- <0x29c0880 0x30>, -- <0x29cc100 0x534>, -- <0x2808000 0x24>, -- <0x2980080 0x8>; -- reg-names = "ctrl", -- "xhci_ec", -- "xhci_gbl", -- "usb_phy", -- "usb_mdio"; -- brcm,ioc = <0x0>; -- brcm,ipp = <0x0>; -- compatible = "brcm,bcm7211-usb-phy"; -- interrupts = <0x30>; -- interrupt-parent = <&vpu_intr1_nosec_intc>; -- interrupt-names = "wake"; -- #phy-cells = <0x1>; -- brcm,has-xhci; -- syscon-piarbctl = <&syscon_piarbctl>; -- clocks = <&scmi_clk 256>; -- clock-names = "sw_usb"; --}; ---- /dev/null -+++ b/Documentation/devicetree/bindings/phy/brcm,brcmstb-usb-phy.yaml -@@ -0,0 +1,193 @@ -+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause -+%YAML 1.2 -+--- -+$id: http://devicetree.org/schemas/phy/brcm,brcmstb-usb-phy.yaml# -+$schema: http://devicetree.org/meta-schemas/core.yaml# -+ -+title: Broadcom STB USB PHY -+ -+description: Broadcom's PHY that handles EHCI/OHCI and/or XHCI -+ -+maintainers: -+ - Al Cooper <alcooperx@gmail.com> -+ - Rafał Miłecki <rafal@milecki.pl> -+ -+properties: -+ compatible: -+ enum: -+ - brcm,bcm7211-usb-phy -+ - brcm,bcm7216-usb-phy -+ - brcm,brcmstb-usb-phy -+ -+ reg: -+ minItems: 1 -+ maxItems: 6 -+ items: -+ - description: the base CTRL register -+ - description: XHCI EC register -+ - description: XHCI GBL register -+ - description: USB PHY register -+ - description: USB MDIO register -+ - description: BDC register -+ -+ reg-names: -+ minItems: 1 -+ maxItems: 6 -+ items: -+ - const: ctrl -+ - const: xhci_ec -+ - const: xhci_gbl -+ - const: usb_phy -+ - const: usb_mdio -+ - const: bdc_ec -+ -+ clocks: -+ minItems: 1 -+ maxItems: 2 -+ -+ clock-names: -+ minItems: 1 -+ maxItems: 2 -+ items: -+ - const: sw_usb -+ - const: sw_usb3 -+ -+ interrupts: -+ description: wakeup interrupt -+ -+ interrupt-names: -+ const: wake -+ -+ brcm,ipp: -+ $ref: /schemas/types.yaml#/definitions/uint32 -+ description: Invert Port Power -+ minimum: 0 -+ maximum: 1 -+ -+ brcm,ioc: -+ $ref: /schemas/types.yaml#/definitions/uint32 -+ description: Invert Over Current detection -+ minimum: 0 -+ maximum: 1 -+ -+ dr_mode: -+ description: PHY Device mode. If this property is not defined, the PHY will -+ default to "host" mode. -+ enum: -+ - host -+ - peripheral -+ - drd -+ - typec-pd -+ -+ brcm,syscon-piarbctl: -+ description: phandle to syscon for handling config registers -+ $ref: /schemas/types.yaml#/definitions/phandle -+ -+ brcm,has-xhci: -+ description: Indicates the PHY has an XHCI PHY. -+ type: boolean -+ -+ brcm,has-eohci: -+ description: Indicates the PHY has an EHCI/OHCI PHY. -+ type: boolean -+ -+ "#phy-cells": -+ description: | -+ Cell allows setting the type of the PHY. Possible values are: -+ - PHY_TYPE_USB2 for USB1.1/2.0 PHY -+ - PHY_TYPE_USB3 for USB3.x PHY -+ const: 1 -+ -+required: -+ - reg -+ - "#phy-cells" -+ -+anyOf: -+ - required: -+ - brcm,has-xhci -+ - required: -+ - brcm,has-eohci -+ -+allOf: -+ - if: -+ properties: -+ compatible: -+ contains: -+ const: brcm,brcmstb-usb-phy -+ then: -+ properties: -+ reg: -+ minItems: 1 -+ maxItems: 2 -+ - if: -+ properties: -+ compatible: -+ contains: -+ const: brcm,bcm7211-usb-phy -+ then: -+ properties: -+ reg: -+ minItems: 5 -+ maxItems: 6 -+ reg-names: -+ minItems: 5 -+ maxItems: 6 -+ - if: -+ properties: -+ compatible: -+ contains: -+ const: brcm,bcm7216-usb-phy -+ then: -+ properties: -+ reg: -+ minItems: 3 -+ maxItems: 3 -+ reg-names: -+ minItems: 3 -+ maxItems: 3 -+ -+additionalProperties: false -+ -+examples: -+ - | -+ #include <dt-bindings/phy/phy.h> -+ -+ usb-phy@f0470200 { -+ compatible = "brcm,brcmstb-usb-phy"; -+ reg = <0xf0470200 0xb8>, -+ <0xf0471940 0x6c0>; -+ #phy-cells = <1>; -+ dr_mode = "host"; -+ brcm,ioc = <1>; -+ brcm,ipp = <1>; -+ brcm,has-xhci; -+ brcm,has-eohci; -+ clocks = <&usb20>, <&usb30>; -+ clock-names = "sw_usb", "sw_usb3"; -+ }; -+ - | -+ #include <dt-bindings/phy/phy.h> -+ -+ usb-phy@29f0200 { -+ compatible = "brcm,bcm7211-usb-phy"; -+ reg = <0x29f0200 0x200>, -+ <0x29c0880 0x30>, -+ <0x29cc100 0x534>, -+ <0x2808000 0x24>, -+ <0x2980080 0x8>; -+ reg-names = "ctrl", -+ "xhci_ec", -+ "xhci_gbl", -+ "usb_phy", -+ "usb_mdio"; -+ brcm,ioc = <0x0>; -+ brcm,ipp = <0x0>; -+ interrupts = <0x30>; -+ interrupt-parent = <&vpu_intr1_nosec_intc>; -+ interrupt-names = "wake"; -+ #phy-cells = <0x1>; -+ brcm,has-xhci; -+ brcm,syscon-piarbctl = <&syscon_piarbctl>; -+ clocks = <&scmi_clk 256>; -+ clock-names = "sw_usb"; -+ }; diff --git a/target/linux/bcm4908/patches-5.4/086-v5.12-0004-dt-bindings-phy-brcm-brcmstb-usb-phy-add-BCM4908-bin.patch b/target/linux/bcm4908/patches-5.4/086-v5.12-0004-dt-bindings-phy-brcm-brcmstb-usb-phy-add-BCM4908-bin.patch deleted file mode 100644 index 6127800a43..0000000000 --- a/target/linux/bcm4908/patches-5.4/086-v5.12-0004-dt-bindings-phy-brcm-brcmstb-usb-phy-add-BCM4908-bin.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 46b616c1574def7a1629bdeded3d44e76382f950 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Wed, 6 Jan 2021 21:58:37 +0100 -Subject: [PATCH] dt-bindings: phy: brcm, brcmstb-usb-phy: add BCM4908 binding -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -BCM4908 uses the same PHY and may require just a slightly different -programming. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Acked-by: Florian Fainelli <f.fainelli@gmail.com> -Acked-by: Rob Herring <robh@kernel.org> -Link: https://lore.kernel.org/r/20210106205838.10964-2-zajec5@gmail.com -Signed-off-by: Vinod Koul <vkoul@kernel.org> ---- - .../devicetree/bindings/phy/brcm,brcmstb-usb-phy.yaml | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - ---- a/Documentation/devicetree/bindings/phy/brcm,brcmstb-usb-phy.yaml -+++ b/Documentation/devicetree/bindings/phy/brcm,brcmstb-usb-phy.yaml -@@ -15,6 +15,7 @@ maintainers: - properties: - compatible: - enum: -+ - brcm,bcm4908-usb-phy - - brcm,bcm7211-usb-phy - - brcm,bcm7216-usb-phy - - brcm,brcmstb-usb-phy -@@ -113,7 +114,9 @@ allOf: - properties: - compatible: - contains: -- const: brcm,brcmstb-usb-phy -+ enum: -+ - const: brcm,bcm4908-usb-phy -+ - const: brcm,brcmstb-usb-phy - then: - properties: - reg: diff --git a/target/linux/bcm4908/patches-5.4/086-v5.12-0005-phy-phy-brcm-usb-support-PHY-on-the-BCM4908.patch b/target/linux/bcm4908/patches-5.4/086-v5.12-0005-phy-phy-brcm-usb-support-PHY-on-the-BCM4908.patch deleted file mode 100644 index c021201f6b..0000000000 --- a/target/linux/bcm4908/patches-5.4/086-v5.12-0005-phy-phy-brcm-usb-support-PHY-on-the-BCM4908.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 4b402fa8e0b7817f3e3738d7828038f114e6899e Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Wed, 6 Jan 2021 21:58:38 +0100 -Subject: [PATCH] phy: phy-brcm-usb: support PHY on the BCM4908 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -BCM4908 seems to have slightly different registers but works when -programmed just like the STB one. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Acked-by: Florian Fainelli <f.fainelli@gmail.com> -Link: https://lore.kernel.org/r/20210106205838.10964-3-zajec5@gmail.com -Signed-off-by: Vinod Koul <vkoul@kernel.org> ---- - drivers/phy/broadcom/Kconfig | 3 ++- - drivers/phy/broadcom/phy-brcm-usb.c | 4 ++++ - 2 files changed, 6 insertions(+), 1 deletion(-) - ---- a/drivers/phy/broadcom/Kconfig -+++ b/drivers/phy/broadcom/Kconfig -@@ -83,10 +83,11 @@ config PHY_BRCM_SATA - - config PHY_BRCM_USB - tristate "Broadcom STB USB PHY driver" -- depends on ARCH_BRCMSTB -+ depends on ARCH_BCM4908 || ARCH_BRCMSTB - depends on OF - select GENERIC_PHY - select SOC_BRCMSTB -+ default ARCH_BCM4908 - default ARCH_BRCMSTB - help - Enable this to support the Broadcom STB USB PHY. ---- a/drivers/phy/broadcom/phy-brcm-usb.c -+++ b/drivers/phy/broadcom/phy-brcm-usb.c -@@ -287,6 +287,10 @@ static const struct match_chip_info chip - - static const struct of_device_id brcm_usb_dt_ids[] = { - { -+ .compatible = "brcm,bcm4908-usb-phy", -+ .data = &chip_info_7445, -+ }, -+ { - .compatible = "brcm,bcm7216-usb-phy", - .data = &chip_info_7216, - }, diff --git a/target/linux/bcm4908/patches-5.4/086-v5.13-0001-phy-phy-brcm-usb-select-SOC_BRCMSTB-on-brcmstb-only.patch b/target/linux/bcm4908/patches-5.4/086-v5.13-0001-phy-phy-brcm-usb-select-SOC_BRCMSTB-on-brcmstb-only.patch deleted file mode 100644 index a341326ef4..0000000000 --- a/target/linux/bcm4908/patches-5.4/086-v5.13-0001-phy-phy-brcm-usb-select-SOC_BRCMSTB-on-brcmstb-only.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 261ab1fd5c5d2d7ff7d5bab3f5db3c69c4bcea58 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Fri, 5 Mar 2021 16:24:06 +0100 -Subject: [PATCH] phy: phy-brcm-usb: select SOC_BRCMSTB on brcmstb only -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -phy-brcm-usb has some conditional init code required on selected brcmstb -devices. Execution of that code depends on family / product detected by -brcmstb soc code. - -For ARCH_BCM4908 brcmstb soc code always return 0 values as ids. Don't -bother selecting & compiling that redundant driver. - -Depends-on: 149ae80b1d50 ("soc: bcm: brcmstb: add stubs for getting platform IDs") -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Acked-by: Florian Fainelli <f.fainelli@gmail.com> -Link: https://lore.kernel.org/r/20210305152406.2588-1-zajec5@gmail.com -Signed-off-by: Vinod Koul <vkoul@kernel.org> ---- - drivers/phy/broadcom/Kconfig | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/phy/broadcom/Kconfig -+++ b/drivers/phy/broadcom/Kconfig -@@ -86,7 +86,7 @@ config PHY_BRCM_USB - depends on ARCH_BCM4908 || ARCH_BRCMSTB - depends on OF - select GENERIC_PHY -- select SOC_BRCMSTB -+ select SOC_BRCMSTB if ARCH_BRCMSTB - default ARCH_BCM4908 - default ARCH_BRCMSTB - help diff --git a/target/linux/bcm4908/patches-5.4/086-v5.13-0002-dt-bindings-phy-brcm-brcmstb-usb-phy-add-power-domai.patch b/target/linux/bcm4908/patches-5.4/086-v5.13-0002-dt-bindings-phy-brcm-brcmstb-usb-phy-add-power-domai.patch deleted file mode 100644 index 4db442c0ae..0000000000 --- a/target/linux/bcm4908/patches-5.4/086-v5.13-0002-dt-bindings-phy-brcm-brcmstb-usb-phy-add-power-domai.patch +++ /dev/null @@ -1,31 +0,0 @@ -From d9de0cbd5b1f6b51c92a40937945f26a35d848ff Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Tue, 9 Mar 2021 19:26:16 +0100 -Subject: [PATCH] dt-bindings: phy: brcm,brcmstb-usb-phy: add power-domains -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -On BCM4908 USB PHY is managed using power controller so it needs -describing properly using the power-domains. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Acked-by: Florian Fainelli <f.fainelli@gmail.com> -Link: https://lore.kernel.org/r/20210309182616.25783-1-zajec5@gmail.com -Signed-off-by: Vinod Koul <vkoul@kernel.org> ---- - .../devicetree/bindings/phy/brcm,brcmstb-usb-phy.yaml | 3 +++ - 1 file changed, 3 insertions(+) - ---- a/Documentation/devicetree/bindings/phy/brcm,brcmstb-usb-phy.yaml -+++ b/Documentation/devicetree/bindings/phy/brcm,brcmstb-usb-phy.yaml -@@ -42,6 +42,9 @@ properties: - - const: usb_mdio - - const: bdc_ec - -+ power-domains: -+ maxItems: 1 -+ - clocks: - minItems: 1 - maxItems: 2 diff --git a/target/linux/bcm4908/patches-5.4/087-v5.18-0001-dt-bindings-pinctrl-Add-binding-for-BCM4908-pinctrl.patch b/target/linux/bcm4908/patches-5.4/087-v5.18-0001-dt-bindings-pinctrl-Add-binding-for-BCM4908-pinctrl.patch deleted file mode 100644 index ab18c17fd1..0000000000 --- a/target/linux/bcm4908/patches-5.4/087-v5.18-0001-dt-bindings-pinctrl-Add-binding-for-BCM4908-pinctrl.patch +++ /dev/null @@ -1,111 +0,0 @@ -From 7b5730f0ff24b0d7d1cb660a482384a807618a46 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Mon, 24 Jan 2022 11:22:42 +0100 -Subject: [PATCH] dt-bindings: pinctrl: Add binding for BCM4908 pinctrl -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -It's hardware block that is part of every SoC from BCM4908 family. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Reviewed-by: Rob Herring <robh@kernel.org> -Link: https://lore.kernel.org/r/20220124102243.14912-1-zajec5@gmail.com -Signed-off-by: Linus Walleij <linus.walleij@linaro.org> ---- - .../pinctrl/brcm,bcm4908-pinctrl.yaml | 72 +++++++++++++++++++ - MAINTAINERS | 7 ++ - 2 files changed, 79 insertions(+) - create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm4908-pinctrl.yaml - ---- /dev/null -+++ b/Documentation/devicetree/bindings/pinctrl/brcm,bcm4908-pinctrl.yaml -@@ -0,0 +1,72 @@ -+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause -+%YAML 1.2 -+--- -+$id: http://devicetree.org/schemas/pinctrl/brcm,bcm4908-pinctrl.yaml# -+$schema: http://devicetree.org/meta-schemas/core.yaml# -+ -+title: Broadcom BCM4908 pin controller -+ -+maintainers: -+ - Rafał Miłecki <rafal@milecki.pl> -+ -+description: -+ Binding for pin controller present on BCM4908 family SoCs. -+ -+properties: -+ compatible: -+ const: brcm,bcm4908-pinctrl -+ -+ reg: -+ maxItems: 1 -+ -+patternProperties: -+ '-pins$': -+ type: object -+ $ref: pinmux-node.yaml# -+ -+ properties: -+ function: -+ enum: [ led_0, led_1, led_2, led_3, led_4, led_5, led_6, led_7, led_8, -+ led_9, led_10, led_11, led_12, led_13, led_14, led_15, led_16, -+ led_17, led_18, led_19, led_20, led_21, led_22, led_23, led_24, -+ led_25, led_26, led_27, led_28, led_29, led_30, led_31, -+ hs_uart, i2c, i2s, nand_ctrl, nand_data, emmc_ctrl, usb0_pwr, -+ usb1_pwr ] -+ -+ groups: -+ minItems: 1 -+ maxItems: 2 -+ items: -+ enum: [ led_0_grp_a, led_1_grp_a, led_2_grp_a, led_3_grp_a, -+ led_4_grp_a, led_5_grp_a, led_6_grp_a, led_7_grp_a, -+ led_8_grp_a, led_9_grp_a, led_10_grp_a, led_10_grp_b, -+ led_11_grp_a, led_11_grp_b, led_12_grp_a, led_12_grp_b, -+ led_13_grp_a, led_13_grp_b, led_14_grp_a, led_15_grp_a, -+ led_16_grp_a, led_17_grp_a, led_18_grp_a, led_19_grp_a, -+ led_20_grp_a, led_21_grp_a, led_22_grp_a, led_23_grp_a, -+ led_24_grp_a, led_25_grp_a, led_26_grp_a, led_27_grp_a, -+ led_28_grp_a, led_29_grp_a, led_30_grp_a, led_31_grp_a, -+ led_31_grp_b, hs_uart_grp, i2c_grp_a, i2c_grp_b, i2s_grp, -+ nand_ctrl_grp, nand_data_grp, emmc_ctrl_grp, usb0_pwr_grp, -+ usb1_pwr_grp ] -+ -+allOf: -+ - $ref: pinctrl.yaml# -+ -+required: -+ - compatible -+ - reg -+ -+unevaluatedProperties: false -+ -+examples: -+ - | -+ pinctrl@ff800560 { -+ compatible = "brcm,bcm4908-pinctrl"; -+ reg = <0xff800560 0x10>; -+ -+ led_0-a-pins { -+ function = "led_0"; -+ groups = "led_0_grp_a"; -+ }; -+ }; ---- a/MAINTAINERS -+++ b/MAINTAINERS -@@ -3217,6 +3217,13 @@ F: Documentation/devicetree/bindings/net - F: drivers/net/ethernet/broadcom/bcm4908_enet.* - F: drivers/net/ethernet/broadcom/unimac.h - -+BROADCOM BCM4908 PINMUX DRIVER -+M: Rafał Miłecki <rafal@milecki.pl> -+M: bcm-kernel-feedback-list@broadcom.com -+L: linux-gpio@vger.kernel.org -+S: Maintained -+F: Documentation/devicetree/bindings/pinctrl/brcm,bcm4908-pinctrl.yaml -+ - BROADCOM BCM5301X ARM ARCHITECTURE - M: Hauke Mehrtens <hauke@hauke-m.de> - M: Rafał Miłecki <zajec5@gmail.com> diff --git a/target/linux/bcm4908/patches-5.4/087-v5.18-0001-i2c-brcmstb-allow-compiling-on-BCM4908.patch b/target/linux/bcm4908/patches-5.4/087-v5.18-0001-i2c-brcmstb-allow-compiling-on-BCM4908.patch deleted file mode 100644 index 81952ec857..0000000000 --- a/target/linux/bcm4908/patches-5.4/087-v5.18-0001-i2c-brcmstb-allow-compiling-on-BCM4908.patch +++ /dev/null @@ -1,30 +0,0 @@ -From d0aee048d648ec2d9aa7af43b127ebf847d497d5 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Fri, 11 Feb 2022 11:58:06 +0100 -Subject: [PATCH] i2c: brcmstb: allow compiling on BCM4908 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -BCM4908 SoCs use the same I2C hardware block as STB and BCM63xx devices. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Acked-by: Florian Fainelli <f.fainelli@gmail.com> -Signed-off-by: Wolfram Sang <wsa@kernel.org> ---- - drivers/i2c/busses/Kconfig | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/drivers/i2c/busses/Kconfig -+++ b/drivers/i2c/busses/Kconfig -@@ -472,8 +472,8 @@ config I2C_BCM_KONA - - config I2C_BRCMSTB - tristate "BRCM Settop/DSL I2C controller" -- depends on ARCH_BRCMSTB || BMIPS_GENERIC || ARCH_BCM_63XX || \ -- COMPILE_TEST -+ depends on ARCH_BCM4908 || ARCH_BCM_63XX || ARCH_BRCMSTB || \ -+ BMIPS_GENERIC || COMPILE_TEST - default y - help - If you say yes to this option, support will be included for the diff --git a/target/linux/bcm4908/patches-5.4/087-v5.18-0002-pinctrl-bcm-add-driver-for-BCM4908-pinmux.patch b/target/linux/bcm4908/patches-5.4/087-v5.18-0002-pinctrl-bcm-add-driver-for-BCM4908-pinmux.patch deleted file mode 100644 index 670cbee948..0000000000 --- a/target/linux/bcm4908/patches-5.4/087-v5.18-0002-pinctrl-bcm-add-driver-for-BCM4908-pinmux.patch +++ /dev/null @@ -1,630 +0,0 @@ -From f7e322d99f1180270fb4a3e1ae992b3116cfcf34 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Mon, 24 Jan 2022 11:22:43 +0100 -Subject: [PATCH] pinctrl: bcm: add driver for BCM4908 pinmux -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -BCM4908 has its own pins layout so it needs a custom binding and a Linux -driver. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> -Link: https://lore.kernel.org/r/20220124102243.14912-2-zajec5@gmail.com -Signed-off-by: Linus Walleij <linus.walleij@linaro.org> ---- - MAINTAINERS | 1 + - drivers/pinctrl/bcm/Kconfig | 14 + - drivers/pinctrl/bcm/Makefile | 1 + - drivers/pinctrl/bcm/pinctrl-bcm4908.c | 563 ++++++++++++++++++++++++++ - 4 files changed, 579 insertions(+) - create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm4908.c - ---- a/MAINTAINERS -+++ b/MAINTAINERS -@@ -3223,6 +3223,7 @@ M: bcm-kernel-feedback-list@broadcom.com - L: linux-gpio@vger.kernel.org - S: Maintained - F: Documentation/devicetree/bindings/pinctrl/brcm,bcm4908-pinctrl.yaml -+F: drivers/pinctrl/bcm/pinctrl-bcm4908.c - - BROADCOM BCM5301X ARM ARCHITECTURE - M: Hauke Mehrtens <hauke@hauke-m.de> ---- a/drivers/pinctrl/bcm/Kconfig -+++ b/drivers/pinctrl/bcm/Kconfig -@@ -29,6 +29,20 @@ config PINCTRL_BCM2835 - help - Say Y here to enable the Broadcom BCM2835 GPIO driver. - -+config PINCTRL_BCM4908 -+ tristate "Broadcom BCM4908 pinmux driver" -+ depends on OF && (ARCH_BCM4908 || COMPILE_TEST) -+ select PINMUX -+ select PINCONF -+ select GENERIC_PINCONF -+ select GENERIC_PINCTRL_GROUPS -+ select GENERIC_PINMUX_FUNCTIONS -+ default ARCH_BCM4908 -+ help -+ Driver for BCM4908 family SoCs with integrated pin controller. -+ -+ If compiled as module it will be called pinctrl-bcm4908. -+ - config PINCTRL_IPROC_GPIO - bool "Broadcom iProc GPIO (with PINCONF) driver" - depends on OF_GPIO && (ARCH_BCM_IPROC || COMPILE_TEST) ---- a/drivers/pinctrl/bcm/Makefile -+++ b/drivers/pinctrl/bcm/Makefile -@@ -3,6 +3,7 @@ - - obj-$(CONFIG_PINCTRL_BCM281XX) += pinctrl-bcm281xx.o - obj-$(CONFIG_PINCTRL_BCM2835) += pinctrl-bcm2835.o -+obj-$(CONFIG_PINCTRL_BCM4908) += pinctrl-bcm4908.o - obj-$(CONFIG_PINCTRL_IPROC_GPIO) += pinctrl-iproc-gpio.o - obj-$(CONFIG_PINCTRL_CYGNUS_MUX) += pinctrl-cygnus-mux.o - obj-$(CONFIG_PINCTRL_NS) += pinctrl-ns.o ---- /dev/null -+++ b/drivers/pinctrl/bcm/pinctrl-bcm4908.c -@@ -0,0 +1,561 @@ -+// SPDX-License-Identifier: GPL-2.0 -+/* Copyright (C) 2021 Rafał Miłecki <rafal@milecki.pl> */ -+ -+#include <linux/err.h> -+#include <linux/io.h> -+#include <linux/mod_devicetable.h> -+#include <linux/module.h> -+#include <linux/pinctrl/pinconf-generic.h> -+#include <linux/pinctrl/pinctrl.h> -+#include <linux/pinctrl/pinmux.h> -+#include <linux/platform_device.h> -+#include <linux/slab.h> -+#include <linux/string_helpers.h> -+ -+#include "../core.h" -+#include "../pinmux.h" -+ -+#define BCM4908_NUM_PINS 86 -+ -+#define BCM4908_TEST_PORT_BLOCK_EN_LSB 0x00 -+#define BCM4908_TEST_PORT_BLOCK_DATA_MSB 0x04 -+#define BCM4908_TEST_PORT_BLOCK_DATA_LSB 0x08 -+#define BCM4908_TEST_PORT_LSB_PINMUX_DATA_SHIFT 12 -+#define BCM4908_TEST_PORT_COMMAND 0x0c -+#define BCM4908_TEST_PORT_CMD_LOAD_MUX_REG 0x00000021 -+ -+struct bcm4908_pinctrl { -+ struct device *dev; -+ void __iomem *base; -+ struct mutex mutex; -+ struct pinctrl_dev *pctldev; -+ struct pinctrl_desc pctldesc; -+}; -+ -+/* -+ * Groups -+ */ -+ -+struct bcm4908_pinctrl_pin_setup { -+ unsigned int number; -+ unsigned int function; -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup led_0_pins_a[] = { -+ { 0, 3 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup led_1_pins_a[] = { -+ { 1, 3 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup led_2_pins_a[] = { -+ { 2, 3 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup led_3_pins_a[] = { -+ { 3, 3 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup led_4_pins_a[] = { -+ { 4, 3 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup led_5_pins_a[] = { -+ { 5, 3 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup led_6_pins_a[] = { -+ { 6, 3 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup led_7_pins_a[] = { -+ { 7, 3 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup led_8_pins_a[] = { -+ { 8, 3 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup led_9_pins_a[] = { -+ { 9, 3 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup led_10_pins_a[] = { -+ { 10, 3 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup led_11_pins_a[] = { -+ { 11, 3 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup led_12_pins_a[] = { -+ { 12, 3 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup led_13_pins_a[] = { -+ { 13, 3 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup led_14_pins_a[] = { -+ { 14, 3 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup led_15_pins_a[] = { -+ { 15, 3 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup led_16_pins_a[] = { -+ { 16, 3 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup led_17_pins_a[] = { -+ { 17, 3 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup led_18_pins_a[] = { -+ { 18, 3 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup led_19_pins_a[] = { -+ { 19, 3 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup led_20_pins_a[] = { -+ { 20, 3 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup led_21_pins_a[] = { -+ { 21, 3 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup led_22_pins_a[] = { -+ { 22, 3 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup led_23_pins_a[] = { -+ { 23, 3 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup led_24_pins_a[] = { -+ { 24, 3 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup led_25_pins_a[] = { -+ { 25, 3 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup led_26_pins_a[] = { -+ { 26, 3 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup led_27_pins_a[] = { -+ { 27, 3 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup led_28_pins_a[] = { -+ { 28, 3 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup led_29_pins_a[] = { -+ { 29, 3 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup led_30_pins_a[] = { -+ { 30, 3 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup led_31_pins_a[] = { -+ { 31, 3 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup led_10_pins_b[] = { -+ { 8, 2 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup led_11_pins_b[] = { -+ { 9, 2 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup led_12_pins_b[] = { -+ { 0, 2 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup led_13_pins_b[] = { -+ { 1, 2 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup led_31_pins_b[] = { -+ { 30, 2 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup hs_uart_pins[] = { -+ { 10, 0 }, /* CTS */ -+ { 11, 0 }, /* RTS */ -+ { 12, 0 }, /* RXD */ -+ { 13, 0 }, /* TXD */ -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup i2c_pins_a[] = { -+ { 18, 0 }, /* SDA */ -+ { 19, 0 }, /* SCL */ -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup i2c_pins_b[] = { -+ { 22, 0 }, /* SDA */ -+ { 23, 0 }, /* SCL */ -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup i2s_pins[] = { -+ { 27, 0 }, /* MCLK */ -+ { 28, 0 }, /* LRCK */ -+ { 29, 0 }, /* SDATA */ -+ { 30, 0 }, /* SCLK */ -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup nand_ctrl_pins[] = { -+ { 32, 0 }, -+ { 33, 0 }, -+ { 34, 0 }, -+ { 43, 0 }, -+ { 44, 0 }, -+ { 45, 0 }, -+ { 56, 1 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup nand_data_pins[] = { -+ { 35, 0 }, -+ { 36, 0 }, -+ { 37, 0 }, -+ { 38, 0 }, -+ { 39, 0 }, -+ { 40, 0 }, -+ { 41, 0 }, -+ { 42, 0 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup emmc_ctrl_pins[] = { -+ { 46, 0 }, -+ { 47, 0 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup usb0_pwr_pins[] = { -+ { 63, 0 }, -+ { 64, 0 }, -+}; -+ -+static const struct bcm4908_pinctrl_pin_setup usb1_pwr_pins[] = { -+ { 66, 0 }, -+ { 67, 0 }, -+}; -+ -+struct bcm4908_pinctrl_grp { -+ const char *name; -+ const struct bcm4908_pinctrl_pin_setup *pins; -+ const unsigned int num_pins; -+}; -+ -+static const struct bcm4908_pinctrl_grp bcm4908_pinctrl_grps[] = { -+ { "led_0_grp_a", led_0_pins_a, ARRAY_SIZE(led_0_pins_a) }, -+ { "led_1_grp_a", led_1_pins_a, ARRAY_SIZE(led_1_pins_a) }, -+ { "led_2_grp_a", led_2_pins_a, ARRAY_SIZE(led_2_pins_a) }, -+ { "led_3_grp_a", led_3_pins_a, ARRAY_SIZE(led_3_pins_a) }, -+ { "led_4_grp_a", led_4_pins_a, ARRAY_SIZE(led_4_pins_a) }, -+ { "led_5_grp_a", led_5_pins_a, ARRAY_SIZE(led_5_pins_a) }, -+ { "led_6_grp_a", led_6_pins_a, ARRAY_SIZE(led_6_pins_a) }, -+ { "led_7_grp_a", led_7_pins_a, ARRAY_SIZE(led_7_pins_a) }, -+ { "led_8_grp_a", led_8_pins_a, ARRAY_SIZE(led_8_pins_a) }, -+ { "led_9_grp_a", led_9_pins_a, ARRAY_SIZE(led_9_pins_a) }, -+ { "led_10_grp_a", led_10_pins_a, ARRAY_SIZE(led_10_pins_a) }, -+ { "led_11_grp_a", led_11_pins_a, ARRAY_SIZE(led_11_pins_a) }, -+ { "led_12_grp_a", led_12_pins_a, ARRAY_SIZE(led_12_pins_a) }, -+ { "led_13_grp_a", led_13_pins_a, ARRAY_SIZE(led_13_pins_a) }, -+ { "led_14_grp_a", led_14_pins_a, ARRAY_SIZE(led_14_pins_a) }, -+ { "led_15_grp_a", led_15_pins_a, ARRAY_SIZE(led_15_pins_a) }, -+ { "led_16_grp_a", led_16_pins_a, ARRAY_SIZE(led_16_pins_a) }, -+ { "led_17_grp_a", led_17_pins_a, ARRAY_SIZE(led_17_pins_a) }, -+ { "led_18_grp_a", led_18_pins_a, ARRAY_SIZE(led_18_pins_a) }, -+ { "led_19_grp_a", led_19_pins_a, ARRAY_SIZE(led_19_pins_a) }, -+ { "led_20_grp_a", led_20_pins_a, ARRAY_SIZE(led_20_pins_a) }, -+ { "led_21_grp_a", led_21_pins_a, ARRAY_SIZE(led_21_pins_a) }, -+ { "led_22_grp_a", led_22_pins_a, ARRAY_SIZE(led_22_pins_a) }, -+ { "led_23_grp_a", led_23_pins_a, ARRAY_SIZE(led_23_pins_a) }, -+ { "led_24_grp_a", led_24_pins_a, ARRAY_SIZE(led_24_pins_a) }, -+ { "led_25_grp_a", led_25_pins_a, ARRAY_SIZE(led_25_pins_a) }, -+ { "led_26_grp_a", led_26_pins_a, ARRAY_SIZE(led_26_pins_a) }, -+ { "led_27_grp_a", led_27_pins_a, ARRAY_SIZE(led_27_pins_a) }, -+ { "led_28_grp_a", led_28_pins_a, ARRAY_SIZE(led_28_pins_a) }, -+ { "led_29_grp_a", led_29_pins_a, ARRAY_SIZE(led_29_pins_a) }, -+ { "led_30_grp_a", led_30_pins_a, ARRAY_SIZE(led_30_pins_a) }, -+ { "led_31_grp_a", led_31_pins_a, ARRAY_SIZE(led_31_pins_a) }, -+ { "led_10_grp_b", led_10_pins_b, ARRAY_SIZE(led_10_pins_b) }, -+ { "led_11_grp_b", led_11_pins_b, ARRAY_SIZE(led_11_pins_b) }, -+ { "led_12_grp_b", led_12_pins_b, ARRAY_SIZE(led_12_pins_b) }, -+ { "led_13_grp_b", led_13_pins_b, ARRAY_SIZE(led_13_pins_b) }, -+ { "led_31_grp_b", led_31_pins_b, ARRAY_SIZE(led_31_pins_b) }, -+ { "hs_uart_grp", hs_uart_pins, ARRAY_SIZE(hs_uart_pins) }, -+ { "i2c_grp_a", i2c_pins_a, ARRAY_SIZE(i2c_pins_a) }, -+ { "i2c_grp_b", i2c_pins_b, ARRAY_SIZE(i2c_pins_b) }, -+ { "i2s_grp", i2s_pins, ARRAY_SIZE(i2s_pins) }, -+ { "nand_ctrl_grp", nand_ctrl_pins, ARRAY_SIZE(nand_ctrl_pins) }, -+ { "nand_data_grp", nand_data_pins, ARRAY_SIZE(nand_data_pins) }, -+ { "emmc_ctrl_grp", emmc_ctrl_pins, ARRAY_SIZE(emmc_ctrl_pins) }, -+ { "usb0_pwr_grp", usb0_pwr_pins, ARRAY_SIZE(usb0_pwr_pins) }, -+ { "usb1_pwr_grp", usb1_pwr_pins, ARRAY_SIZE(usb1_pwr_pins) }, -+}; -+ -+/* -+ * Functions -+ */ -+ -+struct bcm4908_pinctrl_function { -+ const char *name; -+ const char * const *groups; -+ const unsigned int num_groups; -+}; -+ -+static const char * const led_0_groups[] = { "led_0_grp_a" }; -+static const char * const led_1_groups[] = { "led_1_grp_a" }; -+static const char * const led_2_groups[] = { "led_2_grp_a" }; -+static const char * const led_3_groups[] = { "led_3_grp_a" }; -+static const char * const led_4_groups[] = { "led_4_grp_a" }; -+static const char * const led_5_groups[] = { "led_5_grp_a" }; -+static const char * const led_6_groups[] = { "led_6_grp_a" }; -+static const char * const led_7_groups[] = { "led_7_grp_a" }; -+static const char * const led_8_groups[] = { "led_8_grp_a" }; -+static const char * const led_9_groups[] = { "led_9_grp_a" }; -+static const char * const led_10_groups[] = { "led_10_grp_a", "led_10_grp_b" }; -+static const char * const led_11_groups[] = { "led_11_grp_a", "led_11_grp_b" }; -+static const char * const led_12_groups[] = { "led_12_grp_a", "led_12_grp_b" }; -+static const char * const led_13_groups[] = { "led_13_grp_a", "led_13_grp_b" }; -+static const char * const led_14_groups[] = { "led_14_grp_a" }; -+static const char * const led_15_groups[] = { "led_15_grp_a" }; -+static const char * const led_16_groups[] = { "led_16_grp_a" }; -+static const char * const led_17_groups[] = { "led_17_grp_a" }; -+static const char * const led_18_groups[] = { "led_18_grp_a" }; -+static const char * const led_19_groups[] = { "led_19_grp_a" }; -+static const char * const led_20_groups[] = { "led_20_grp_a" }; -+static const char * const led_21_groups[] = { "led_21_grp_a" }; -+static const char * const led_22_groups[] = { "led_22_grp_a" }; -+static const char * const led_23_groups[] = { "led_23_grp_a" }; -+static const char * const led_24_groups[] = { "led_24_grp_a" }; -+static const char * const led_25_groups[] = { "led_25_grp_a" }; -+static const char * const led_26_groups[] = { "led_26_grp_a" }; -+static const char * const led_27_groups[] = { "led_27_grp_a" }; -+static const char * const led_28_groups[] = { "led_28_grp_a" }; -+static const char * const led_29_groups[] = { "led_29_grp_a" }; -+static const char * const led_30_groups[] = { "led_30_grp_a" }; -+static const char * const led_31_groups[] = { "led_31_grp_a", "led_31_grp_b" }; -+static const char * const hs_uart_groups[] = { "hs_uart_grp" }; -+static const char * const i2c_groups[] = { "i2c_grp_a", "i2c_grp_b" }; -+static const char * const i2s_groups[] = { "i2s_grp" }; -+static const char * const nand_ctrl_groups[] = { "nand_ctrl_grp" }; -+static const char * const nand_data_groups[] = { "nand_data_grp" }; -+static const char * const emmc_ctrl_groups[] = { "emmc_ctrl_grp" }; -+static const char * const usb0_pwr_groups[] = { "usb0_pwr_grp" }; -+static const char * const usb1_pwr_groups[] = { "usb1_pwr_grp" }; -+ -+static const struct bcm4908_pinctrl_function bcm4908_pinctrl_functions[] = { -+ { "led_0", led_0_groups, ARRAY_SIZE(led_0_groups) }, -+ { "led_1", led_1_groups, ARRAY_SIZE(led_1_groups) }, -+ { "led_2", led_2_groups, ARRAY_SIZE(led_2_groups) }, -+ { "led_3", led_3_groups, ARRAY_SIZE(led_3_groups) }, -+ { "led_4", led_4_groups, ARRAY_SIZE(led_4_groups) }, -+ { "led_5", led_5_groups, ARRAY_SIZE(led_5_groups) }, -+ { "led_6", led_6_groups, ARRAY_SIZE(led_6_groups) }, -+ { "led_7", led_7_groups, ARRAY_SIZE(led_7_groups) }, -+ { "led_8", led_8_groups, ARRAY_SIZE(led_8_groups) }, -+ { "led_9", led_9_groups, ARRAY_SIZE(led_9_groups) }, -+ { "led_10", led_10_groups, ARRAY_SIZE(led_10_groups) }, -+ { "led_11", led_11_groups, ARRAY_SIZE(led_11_groups) }, -+ { "led_12", led_12_groups, ARRAY_SIZE(led_12_groups) }, -+ { "led_13", led_13_groups, ARRAY_SIZE(led_13_groups) }, -+ { "led_14", led_14_groups, ARRAY_SIZE(led_14_groups) }, -+ { "led_15", led_15_groups, ARRAY_SIZE(led_15_groups) }, -+ { "led_16", led_16_groups, ARRAY_SIZE(led_16_groups) }, -+ { "led_17", led_17_groups, ARRAY_SIZE(led_17_groups) }, -+ { "led_18", led_18_groups, ARRAY_SIZE(led_18_groups) }, -+ { "led_19", led_19_groups, ARRAY_SIZE(led_19_groups) }, -+ { "led_20", led_20_groups, ARRAY_SIZE(led_20_groups) }, -+ { "led_21", led_21_groups, ARRAY_SIZE(led_21_groups) }, -+ { "led_22", led_22_groups, ARRAY_SIZE(led_22_groups) }, -+ { "led_23", led_23_groups, ARRAY_SIZE(led_23_groups) }, -+ { "led_24", led_24_groups, ARRAY_SIZE(led_24_groups) }, -+ { "led_25", led_25_groups, ARRAY_SIZE(led_25_groups) }, -+ { "led_26", led_26_groups, ARRAY_SIZE(led_26_groups) }, -+ { "led_27", led_27_groups, ARRAY_SIZE(led_27_groups) }, -+ { "led_28", led_28_groups, ARRAY_SIZE(led_28_groups) }, -+ { "led_29", led_29_groups, ARRAY_SIZE(led_29_groups) }, -+ { "led_30", led_30_groups, ARRAY_SIZE(led_30_groups) }, -+ { "led_31", led_31_groups, ARRAY_SIZE(led_31_groups) }, -+ { "hs_uart", hs_uart_groups, ARRAY_SIZE(hs_uart_groups) }, -+ { "i2c", i2c_groups, ARRAY_SIZE(i2c_groups) }, -+ { "i2s", i2s_groups, ARRAY_SIZE(i2s_groups) }, -+ { "nand_ctrl", nand_ctrl_groups, ARRAY_SIZE(nand_ctrl_groups) }, -+ { "nand_data", nand_data_groups, ARRAY_SIZE(nand_data_groups) }, -+ { "emmc_ctrl", emmc_ctrl_groups, ARRAY_SIZE(emmc_ctrl_groups) }, -+ { "usb0_pwr", usb0_pwr_groups, ARRAY_SIZE(usb0_pwr_groups) }, -+ { "usb1_pwr", usb1_pwr_groups, ARRAY_SIZE(usb1_pwr_groups) }, -+}; -+ -+/* -+ * Groups code -+ */ -+ -+static const struct pinctrl_ops bcm4908_pinctrl_ops = { -+ .get_groups_count = pinctrl_generic_get_group_count, -+ .get_group_name = pinctrl_generic_get_group_name, -+ .get_group_pins = pinctrl_generic_get_group_pins, -+ .dt_node_to_map = pinconf_generic_dt_node_to_map_group, -+ .dt_free_map = pinconf_generic_dt_free_map, -+}; -+ -+/* -+ * Functions code -+ */ -+ -+static int bcm4908_pinctrl_set_mux(struct pinctrl_dev *pctrl_dev, -+ unsigned int func_selector, -+ unsigned int group_selector) -+{ -+ struct bcm4908_pinctrl *bcm4908_pinctrl = pinctrl_dev_get_drvdata(pctrl_dev); -+ const struct bcm4908_pinctrl_grp *group; -+ struct group_desc *group_desc; -+ int i; -+ -+ group_desc = pinctrl_generic_get_group(pctrl_dev, group_selector); -+ if (!group_desc) -+ return -EINVAL; -+ group = group_desc->data; -+ -+ mutex_lock(&bcm4908_pinctrl->mutex); -+ for (i = 0; i < group->num_pins; i++) { -+ u32 lsb = 0; -+ -+ lsb |= group->pins[i].number; -+ lsb |= group->pins[i].function << BCM4908_TEST_PORT_LSB_PINMUX_DATA_SHIFT; -+ -+ writel(0x0, bcm4908_pinctrl->base + BCM4908_TEST_PORT_BLOCK_DATA_MSB); -+ writel(lsb, bcm4908_pinctrl->base + BCM4908_TEST_PORT_BLOCK_DATA_LSB); -+ writel(BCM4908_TEST_PORT_CMD_LOAD_MUX_REG, -+ bcm4908_pinctrl->base + BCM4908_TEST_PORT_COMMAND); -+ } -+ mutex_unlock(&bcm4908_pinctrl->mutex); -+ -+ return 0; -+} -+ -+static const struct pinmux_ops bcm4908_pinctrl_pmxops = { -+ .get_functions_count = pinmux_generic_get_function_count, -+ .get_function_name = pinmux_generic_get_function_name, -+ .get_function_groups = pinmux_generic_get_function_groups, -+ .set_mux = bcm4908_pinctrl_set_mux, -+}; -+ -+/* -+ * Controller code -+ */ -+ -+static struct pinctrl_desc bcm4908_pinctrl_desc = { -+ .name = "bcm4908-pinctrl", -+ .pctlops = &bcm4908_pinctrl_ops, -+ .pmxops = &bcm4908_pinctrl_pmxops, -+}; -+ -+static const struct of_device_id bcm4908_pinctrl_of_match_table[] = { -+ { .compatible = "brcm,bcm4908-pinctrl", }, -+ { } -+}; -+ -+static int bcm4908_pinctrl_probe(struct platform_device *pdev) -+{ -+ struct device *dev = &pdev->dev; -+ struct bcm4908_pinctrl *bcm4908_pinctrl; -+ struct pinctrl_desc *pctldesc; -+ struct pinctrl_pin_desc *pins; -+ int i; -+ -+ bcm4908_pinctrl = devm_kzalloc(dev, sizeof(*bcm4908_pinctrl), GFP_KERNEL); -+ if (!bcm4908_pinctrl) -+ return -ENOMEM; -+ pctldesc = &bcm4908_pinctrl->pctldesc; -+ platform_set_drvdata(pdev, bcm4908_pinctrl); -+ -+ /* Set basic properties */ -+ -+ bcm4908_pinctrl->dev = dev; -+ -+ bcm4908_pinctrl->base = devm_platform_ioremap_resource(pdev, 0); -+ if (IS_ERR(bcm4908_pinctrl->base)) -+ return PTR_ERR(bcm4908_pinctrl->base); -+ -+ mutex_init(&bcm4908_pinctrl->mutex); -+ -+ memcpy(pctldesc, &bcm4908_pinctrl_desc, sizeof(*pctldesc)); -+ -+ /* Set pinctrl properties */ -+ -+ pins = devm_kcalloc(dev, BCM4908_NUM_PINS, sizeof(*pins), GFP_KERNEL); -+ if (!pins) -+ return -ENOMEM; -+ for (i = 0; i < BCM4908_NUM_PINS; i++) { -+ pins[i].number = i; -+ pins[i].name = devm_kasprintf(dev, GFP_KERNEL, "pin-%d", i); -+ if (!pins[i].name) -+ return -ENOMEM; -+ } -+ pctldesc->pins = pins; -+ pctldesc->npins = BCM4908_NUM_PINS; -+ -+ /* Register */ -+ -+ bcm4908_pinctrl->pctldev = devm_pinctrl_register(dev, pctldesc, bcm4908_pinctrl); -+ if (IS_ERR(bcm4908_pinctrl->pctldev)) { -+ dev_err(dev, "Failed to register pinctrl\n"); -+ return PTR_ERR(bcm4908_pinctrl->pctldev); -+ } -+ -+ /* Groups */ -+ -+ for (i = 0; i < ARRAY_SIZE(bcm4908_pinctrl_grps); i++) { -+ const struct bcm4908_pinctrl_grp *group = &bcm4908_pinctrl_grps[i]; -+ int *pins; -+ int j; -+ -+ pins = devm_kcalloc(dev, group->num_pins, sizeof(*pins), GFP_KERNEL); -+ if (!pins) -+ return -ENOMEM; -+ for (j = 0; j < group->num_pins; j++) -+ pins[j] = group->pins[j].number; -+ -+ pinctrl_generic_add_group(bcm4908_pinctrl->pctldev, group->name, -+ pins, group->num_pins, (void *)group); -+ } -+ -+ /* Functions */ -+ -+ for (i = 0; i < ARRAY_SIZE(bcm4908_pinctrl_functions); i++) { -+ const struct bcm4908_pinctrl_function *function = &bcm4908_pinctrl_functions[i]; -+ -+ pinmux_generic_add_function(bcm4908_pinctrl->pctldev, -+ function->name, -+ function->groups, -+ function->num_groups, NULL); -+ } -+ -+ return 0; -+} -+ -+static struct platform_driver bcm4908_pinctrl_driver = { -+ .probe = bcm4908_pinctrl_probe, -+ .driver = { -+ .name = "bcm4908-pinctrl", -+ .of_match_table = bcm4908_pinctrl_of_match_table, -+ }, -+}; -+ -+module_platform_driver(bcm4908_pinctrl_driver); -+ -+MODULE_AUTHOR("Rafał Miłecki"); -+MODULE_LICENSE("GPL v2"); -+MODULE_DEVICE_TABLE(of, bcm4908_pinctrl_of_match_table); diff --git a/target/linux/bcm4908/patches-5.4/088-v5.18-phy-phy-brcm-usb-fixup-BCM4908-support.patch b/target/linux/bcm4908/patches-5.4/088-v5.18-phy-phy-brcm-usb-fixup-BCM4908-support.patch deleted file mode 100644 index a9568bcbba..0000000000 --- a/target/linux/bcm4908/patches-5.4/088-v5.18-phy-phy-brcm-usb-fixup-BCM4908-support.patch +++ /dev/null @@ -1,147 +0,0 @@ -From 32942d33d63d27714ed16a4176e5a99547adb6e0 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Fri, 18 Feb 2022 18:24:59 +0100 -Subject: [PATCH] phy: phy-brcm-usb: fixup BCM4908 support -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Just like every other family BCM4908 should get its own enum value. That -is required to properly handle it in chipset conditional code. - -The real change is excluding BCM4908 from the PLL reprogramming code -(see brcmusb_usb3_pll_54mhz()). I'm not sure what's the BCM4908 -reference clock frequency but: -1. BCM4908 custom driver from Broadcom's SDK doesn't reprogram PLL -2. Doing that in Linux driver stopped PHY handling some USB 3.0 devices - -This change makes USB 3.0 PHY recognize e.g.: -1. 04e8:6860 - Samsung Electronics Co., Ltd Galaxy series, misc. (MTP mode) -2. 1058:259f - Western Digital My Passport 259F - -Broadcom's STB SoCs come with a set of SUN_TOP_CTRL_* registers that -allow reading chip family and product ids. Such a block & register is -missing on BCM4908 so this commit introduces "compatible" string -specific binding. - -Fixes: 4b402fa8e0b7 ("phy: phy-brcm-usb: support PHY on the BCM4908") -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> -Link: https://lore.kernel.org/r/20220218172459.10431-1-zajec5@gmail.com -Signed-off-by: Vinod Koul <vkoul@kernel.org> ---- - drivers/phy/broadcom/phy-brcm-usb-init.c | 36 ++++++++++++++++++++++++ - drivers/phy/broadcom/phy-brcm-usb-init.h | 1 + - drivers/phy/broadcom/phy-brcm-usb.c | 11 +++++++- - 3 files changed, 47 insertions(+), 1 deletion(-) - ---- a/drivers/phy/broadcom/phy-brcm-usb-init.c -+++ b/drivers/phy/broadcom/phy-brcm-usb-init.c -@@ -79,6 +79,7 @@ - - enum brcm_family_type { - BRCM_FAMILY_3390A0, -+ BRCM_FAMILY_4908, - BRCM_FAMILY_7250B0, - BRCM_FAMILY_7271A0, - BRCM_FAMILY_7364A0, -@@ -96,6 +97,7 @@ enum brcm_family_type { - - static const char *family_names[BRCM_FAMILY_COUNT] = { - USB_BRCM_FAMILY(3390A0), -+ USB_BRCM_FAMILY(4908), - USB_BRCM_FAMILY(7250B0), - USB_BRCM_FAMILY(7271A0), - USB_BRCM_FAMILY(7364A0), -@@ -203,6 +205,27 @@ usb_reg_bits_map_table[BRCM_FAMILY_COUNT - USB_CTRL_USB_PM_USB20_HC_RESETB_VAR_MASK, - ENDIAN_SETTINGS, /* USB_CTRL_SETUP ENDIAN bits */ - }, -+ /* 4908 */ -+ [BRCM_FAMILY_4908] = { -+ 0, /* USB_CTRL_SETUP_SCB1_EN_MASK */ -+ 0, /* USB_CTRL_SETUP_SCB2_EN_MASK */ -+ 0, /* USB_CTRL_SETUP_SS_EHCI64BIT_EN_MASK */ -+ 0, /* USB_CTRL_SETUP_STRAP_IPP_SEL_MASK */ -+ 0, /* USB_CTRL_SETUP_OC3_DISABLE_MASK */ -+ 0, /* USB_CTRL_PLL_CTL_PLL_IDDQ_PWRDN_MASK */ -+ 0, /* USB_CTRL_USB_PM_BDC_SOFT_RESETB_MASK */ -+ USB_CTRL_USB_PM_XHC_SOFT_RESETB_MASK, -+ USB_CTRL_USB_PM_USB_PWRDN_MASK, -+ 0, /* USB_CTRL_USB30_CTL1_XHC_SOFT_RESETB_MASK */ -+ 0, /* USB_CTRL_USB30_CTL1_USB3_IOC_MASK */ -+ 0, /* USB_CTRL_USB30_CTL1_USB3_IPP_MASK */ -+ 0, /* USB_CTRL_USB_DEVICE_CTL1_PORT_MODE_MASK */ -+ 0, /* USB_CTRL_USB_PM_SOFT_RESET_MASK */ -+ 0, /* USB_CTRL_SETUP_CC_DRD_MODE_ENABLE_MASK */ -+ 0, /* USB_CTRL_SETUP_STRAP_CC_DRD_MODE_ENABLE_SEL_MASK */ -+ 0, /* USB_CTRL_USB_PM_USB20_HC_RESETB_VAR_MASK */ -+ 0, /* USB_CTRL_SETUP ENDIAN bits */ -+ }, - /* 7250b0 */ - [BRCM_FAMILY_7250B0] = { - USB_CTRL_SETUP_SCB1_EN_MASK, -@@ -559,6 +582,7 @@ static void brcmusb_usb3_pll_54mhz(struc - */ - switch (params->selected_family) { - case BRCM_FAMILY_3390A0: -+ case BRCM_FAMILY_4908: - case BRCM_FAMILY_7250B0: - case BRCM_FAMILY_7366C0: - case BRCM_FAMILY_74371A0: -@@ -1004,6 +1028,18 @@ static const struct brcm_usb_init_ops bc - .set_dual_select = usb_set_dual_select, - }; - -+void brcm_usb_dvr_init_4908(struct brcm_usb_init_params *params) -+{ -+ int fam; -+ -+ fam = BRCM_FAMILY_4908; -+ params->selected_family = fam; -+ params->usb_reg_bits_map = -+ &usb_reg_bits_map_table[fam][0]; -+ params->family_name = family_names[fam]; -+ params->ops = &bcm7445_ops; -+} -+ - void brcm_usb_dvr_init_7445(struct brcm_usb_init_params *params) - { - int fam; ---- a/drivers/phy/broadcom/phy-brcm-usb-init.h -+++ b/drivers/phy/broadcom/phy-brcm-usb-init.h -@@ -64,6 +64,7 @@ struct brcm_usb_init_params { - bool suspend_with_clocks; - }; - -+void brcm_usb_dvr_init_4908(struct brcm_usb_init_params *params); - void brcm_usb_dvr_init_7445(struct brcm_usb_init_params *params); - void brcm_usb_dvr_init_7216(struct brcm_usb_init_params *params); - void brcm_usb_dvr_init_7211b0(struct brcm_usb_init_params *params); ---- a/drivers/phy/broadcom/phy-brcm-usb.c -+++ b/drivers/phy/broadcom/phy-brcm-usb.c -@@ -253,6 +253,15 @@ static const struct attribute_group brcm - .attrs = brcm_usb_phy_attrs, - }; - -+static const struct match_chip_info chip_info_4908 = { -+ .init_func = &brcm_usb_dvr_init_4908, -+ .required_regs = { -+ BRCM_REGS_CTRL, -+ BRCM_REGS_XHCI_EC, -+ -1, -+ }, -+}; -+ - static const struct match_chip_info chip_info_7216 = { - .init_func = &brcm_usb_dvr_init_7216, - .required_regs = { -@@ -288,7 +297,7 @@ static const struct match_chip_info chip - static const struct of_device_id brcm_usb_dt_ids[] = { - { - .compatible = "brcm,bcm4908-usb-phy", -- .data = &chip_info_7445, -+ .data = &chip_info_4908, - }, - { - .compatible = "brcm,bcm7216-usb-phy", diff --git a/target/linux/bcm4908/patches-5.4/170-net-broadcom-bcm4908_enet-reset-DMA-rings-sw-indexes.patch b/target/linux/bcm4908/patches-5.4/170-net-broadcom-bcm4908_enet-reset-DMA-rings-sw-indexes.patch deleted file mode 100644 index 7e82230f9a..0000000000 --- a/target/linux/bcm4908/patches-5.4/170-net-broadcom-bcm4908_enet-reset-DMA-rings-sw-indexes.patch +++ /dev/null @@ -1,43 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Tue, 22 Jun 2021 07:05:04 +0200 -Subject: [PATCH] net: broadcom: bcm4908_enet: reset DMA rings sw indexes - properly -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Resetting software indexes in bcm4908_dma_alloc_buf_descs() is not -enough as it's called during device probe only. Driver resets DMA on -every .ndo_open callback and it's required to reset indexes then. - -This fixes inconsistent rings state and stalled traffic after interface -down & up sequence. - -Fixes: 4feffeadbcb2 ("net: broadcom: bcm4908enet: add BCM4908 controller driver") -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> ---- - drivers/net/ethernet/broadcom/bcm4908_enet.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - ---- a/drivers/net/ethernet/broadcom/bcm4908_enet.c -+++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c -@@ -174,9 +174,6 @@ static int bcm4908_dma_alloc_buf_descs(s - if (!ring->slots) - goto err_free_buf_descs; - -- ring->read_idx = 0; -- ring->write_idx = 0; -- - return 0; - - err_free_buf_descs: -@@ -303,6 +300,9 @@ static void bcm4908_enet_dma_ring_init(s - - enet_write(enet, ring->st_ram_block + ENET_DMA_CH_STATE_RAM_BASE_DESC_PTR, - (uint32_t)ring->dma_addr); -+ -+ ring->read_idx = 0; -+ ring->write_idx = 0; - } - - static void bcm4908_enet_dma_uninit(struct bcm4908_enet *enet) diff --git a/target/linux/bcm4908/patches-5.4/180-i2c-brcmstb-fix-support-for-DSL-and-CM-variants.patch b/target/linux/bcm4908/patches-5.4/180-i2c-brcmstb-fix-support-for-DSL-and-CM-variants.patch deleted file mode 100644 index 6f4ae30108..0000000000 --- a/target/linux/bcm4908/patches-5.4/180-i2c-brcmstb-fix-support-for-DSL-and-CM-variants.patch +++ /dev/null @@ -1,30 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Tue, 15 Feb 2022 08:27:35 +0100 -Subject: [PATCH] i2c: brcmstb: fix support for DSL and CM variants -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -DSL and CM (Cable Modem) support 8 B max transfer size and have a custom -DT binding for that reason. This driver was checking for a wrong -"compatible" however which resulted in an incorrect setup. - -Fixes: e2e5a2c61837 ("i2c: brcmstb: Adding support for CM and DSL SoCs") -Cc: Kamal Dasu <kdasu.kdev@gmail.com> -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Acked-by: Florian Fainelli <f.fainelli@gmail.com> ---- - drivers/i2c/busses/i2c-brcmstb.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/i2c/busses/i2c-brcmstb.c -+++ b/drivers/i2c/busses/i2c-brcmstb.c -@@ -640,7 +640,7 @@ static int brcmstb_i2c_probe(struct plat - - /* set the data in/out register size for compatible SoCs */ - if (of_device_is_compatible(dev->device->of_node, -- "brcmstb,brcmper-i2c")) -+ "brcm,brcmper-i2c")) - dev->data_regsz = sizeof(u8); - else - dev->data_regsz = sizeof(u32); diff --git a/target/linux/bcm4908/patches-5.4/181-watchdog-allow-building-BCM7038_WDT-for-BCM4908.patch b/target/linux/bcm4908/patches-5.4/181-watchdog-allow-building-BCM7038_WDT-for-BCM4908.patch deleted file mode 100644 index a42fb7d611..0000000000 --- a/target/linux/bcm4908/patches-5.4/181-watchdog-allow-building-BCM7038_WDT-for-BCM4908.patch +++ /dev/null @@ -1,28 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Wed, 9 Feb 2022 21:32:02 +0100 -Subject: [PATCH] watchdog: allow building BCM7038_WDT for BCM4908 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -BCM4908 is a SoCs family that shares a lot of hardware with BCM63xx -including the watchdog block. Allow building this driver for it. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Acked-by: Florian Fainelli <f.fainelli@gmail.com> -Reviewed-by: Guenter Roeck <linux@roeck-us.net> ---- - drivers/watchdog/Kconfig | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/watchdog/Kconfig -+++ b/drivers/watchdog/Kconfig -@@ -1759,7 +1759,7 @@ config BCM7038_WDT - tristate "BCM7038 Watchdog" - select WATCHDOG_CORE - depends on HAS_IOMEM -- depends on ARCH_BRCMSTB || BMIPS_GENERIC || COMPILE_TEST -+ depends on ARCH_BCM4908 || ARCH_BRCMSTB || BMIPS_GENERIC || COMPILE_TEST - help - Watchdog driver for the built-in hardware in Broadcom 7038 and - later SoCs used in set-top boxes. BCM7038 was made public diff --git a/target/linux/bcm4908/patches-5.4/182-watchdog-bcm7038_wdt-Support-BCM6345-compatible-stri.patch b/target/linux/bcm4908/patches-5.4/182-watchdog-bcm7038_wdt-Support-BCM6345-compatible-stri.patch deleted file mode 100644 index 6a6f7e4299..0000000000 --- a/target/linux/bcm4908/patches-5.4/182-watchdog-bcm7038_wdt-Support-BCM6345-compatible-stri.patch +++ /dev/null @@ -1,28 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Wed, 16 Feb 2022 07:28:34 +0100 -Subject: [PATCH] watchdog: bcm7038_wdt: Support BCM6345 compatible string -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -A new "compatible" value has been added in the commit 17fffe91ba36 -("dt-bindings: watchdog: Add BCM6345 compatible to BCM7038 binding"). -It's meant to be used for BCM63xx SoCs family but hardware block can be -programmed just like the 7038 one. - -Cc: Florian Fainelli <f.fainelli@gmail.com> -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> ---- - drivers/watchdog/bcm7038_wdt.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/watchdog/bcm7038_wdt.c -+++ b/drivers/watchdog/bcm7038_wdt.c -@@ -193,6 +193,7 @@ static SIMPLE_DEV_PM_OPS(bcm7038_wdt_pm_ - bcm7038_wdt_resume); - - static const struct of_device_id bcm7038_wdt_match[] = { -+ { .compatible = "brcm,bcm6345-wdt" }, - { .compatible = "brcm,bcm7038-wdt" }, - {}, - }; diff --git a/target/linux/bcm4908/patches-5.4/300-arm64-dts-broadcom-bcm4908-limit-amount-of-GPIOs.patch b/target/linux/bcm4908/patches-5.4/300-arm64-dts-broadcom-bcm4908-limit-amount-of-GPIOs.patch deleted file mode 100644 index 5d924d68c6..0000000000 --- a/target/linux/bcm4908/patches-5.4/300-arm64-dts-broadcom-bcm4908-limit-amount-of-GPIOs.patch +++ /dev/null @@ -1,23 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Mon, 15 Feb 2021 22:01:03 +0100 -Subject: [PATCH] arm64: dts: broadcom: bcm4908: limit amount of GPIOs -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Linux driver can't handle more than 64 GPIOs - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> ---- - ---- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi -+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi -@@ -290,7 +290,7 @@ - gpio0: gpio-controller@500 { - compatible = "brcm,bcm6345-gpio"; - reg-names = "dirout", "dat"; -- reg = <0x500 0x28>, <0x528 0x28>; -+ reg = <0x500 0x8>, <0x528 0x8>; - - #gpio-cells = <2>; - gpio-controller; diff --git a/target/linux/bcm4908/patches-5.4/400-mtd-rawnand-brcmnand-disable-WP-on-BCM4908.patch b/target/linux/bcm4908/patches-5.4/400-mtd-rawnand-brcmnand-disable-WP-on-BCM4908.patch deleted file mode 100644 index 65066236db..0000000000 --- a/target/linux/bcm4908/patches-5.4/400-mtd-rawnand-brcmnand-disable-WP-on-BCM4908.patch +++ /dev/null @@ -1,34 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Thu, 21 Jan 2021 10:44:53 +0100 -Subject: [PATCH] mtd: rawnand: brcmnand: disable WP on BCM4908 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -BCM4908 contains NAND controller version 0x0701 (v7.1). It means that -NAND_WP should be available. - -For some reason setting #WP on doesn't result in clearing NAND_STATUS_WP -status bit: -[ 1.077857] bcm63138_nand ff801800.nand: timeout on status poll (expected c0000040 got c00000c0) -[ 1.086832] bcm63138_nand ff801800.nand: nand #WP expected on - -For now try working without touching #WP. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> ---- - ---- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c -+++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c -@@ -38,7 +38,11 @@ - * 1: NAND_WP is set by default, cleared for erase/write operations - * 2: NAND_WP is always cleared - */ -+#if IS_ENABLED(CONFIG_ARCH_BCM4908) -+static int wp_on = 0; -+#else - static int wp_on = 1; -+#endif - module_param(wp_on, int, 0444); - - /*********************************************************************** diff --git a/target/linux/bcm4908/patches-5.4/401-mtd-support-BLKRRPART.patch b/target/linux/bcm4908/patches-5.4/401-mtd-support-BLKRRPART.patch deleted file mode 100644 index 70a1896328..0000000000 --- a/target/linux/bcm4908/patches-5.4/401-mtd-support-BLKRRPART.patch +++ /dev/null @@ -1,28 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Mon, 22 Mar 2021 07:15:17 +0100 -Subject: [PATCH] mtd: support BLKRRPART -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Rescan MTD subpartitions on request. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> ---- - ---- a/drivers/mtd/mtdchar.c -+++ b/drivers/mtd/mtdchar.c -@@ -1015,8 +1015,11 @@ static int mtdchar_ioctl(struct file *fi - - case BLKRRPART: - { -- /* No reread partition feature. Just return ok */ -- ret = 0; -+ int nr_parts; -+ -+ del_mtd_partitions(mtd); -+ nr_parts = parse_mtd_partitions(mtd, NULL, NULL); -+ ret = nr_parts < 0 ? nr_parts : 0; - break; - } - } diff --git a/target/linux/bcm4908/patches-5.4/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch b/target/linux/bcm4908/patches-5.4/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch deleted file mode 100644 index d9d972c9cd..0000000000 --- a/target/linux/bcm4908/patches-5.4/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch +++ /dev/null @@ -1,46 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Mon, 15 Feb 2021 23:59:26 +0100 -Subject: [PATCH] net: dsa: bcm_sf2: enable GPHY for switch probing -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -GPHY needs to be enabled to succesfully probe & setup switch port -connected to it. Otherwise hardcoding PHY OUI would be required. - -Before: -brcm-sf2 80080000.switch lan4 (uninitialized): PHY [800c05c0.mdio--1:08] driver [Generic PHY] (irq=POLL) -brcm-sf2 80080000.switch lan3 (uninitialized): PHY [800c05c0.mdio--1:09] driver [Generic PHY] (irq=POLL) -brcm-sf2 80080000.switch lan2 (uninitialized): PHY [800c05c0.mdio--1:0a] driver [Generic PHY] (irq=POLL) -brcm-sf2 80080000.switch lan1 (uninitialized): PHY [800c05c0.mdio--1:0b] driver [Generic PHY] (irq=POLL) -brcm-sf2 80080000.switch wan (uninitialized): error -5 setting up PHY for tree 0, switch 0, port 7 - -After: -brcm-sf2 80080000.switch lan4 (uninitialized): PHY [800c05c0.mdio--1:08] driver [Generic PHY] (irq=POLL) -brcm-sf2 80080000.switch lan3 (uninitialized): PHY [800c05c0.mdio--1:09] driver [Generic PHY] (irq=POLL) -brcm-sf2 80080000.switch lan2 (uninitialized): PHY [800c05c0.mdio--1:0a] driver [Generic PHY] (irq=POLL) -brcm-sf2 80080000.switch lan1 (uninitialized): PHY [800c05c0.mdio--1:0b] driver [Generic PHY] (irq=POLL) -brcm-sf2 80080000.switch wan (uninitialized): PHY [800c05c0.mdio--1:0c] driver [Generic PHY] (irq=POLL) - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> ---- - drivers/net/dsa/bcm_sf2.c | 4 ++++ - 1 file changed, 4 insertions(+) - ---- a/drivers/net/dsa/bcm_sf2.c -+++ b/drivers/net/dsa/bcm_sf2.c -@@ -1363,10 +1363,14 @@ static int bcm_sf2_sw_probe(struct platf - rev = reg_readl(priv, REG_PHY_REVISION); - priv->hw_params.gphy_rev = rev & PHY_REVISION_MASK; - -+ bcm_sf2_gphy_enable_set(priv->dev->ds, true); -+ - ret = b53_switch_register(dev); - if (ret) - goto out_mdio; - -+ bcm_sf2_gphy_enable_set(priv->dev->ds, false); -+ - dev_info(&pdev->dev, - "Starfighter 2 top: %x.%02x, core: %x.%02x, IRQs: %d, %d\n", - priv->hw_params.top_rev >> 8, priv->hw_params.top_rev & 0xff, diff --git a/target/linux/bcm4908/patches-5.4/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch b/target/linux/bcm4908/patches-5.4/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch deleted file mode 100644 index c8fe1121ba..0000000000 --- a/target/linux/bcm4908/patches-5.4/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch +++ /dev/null @@ -1,30 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Tue, 16 Feb 2021 00:06:35 +0100 -Subject: [PATCH] net: dsa: bcm_sf2: keep GPHY enabled on the BCM4908 - -Trying to access disabled PHY results in MDIO_READ_FAIL and: -[ 11.962886] brcm-sf2 80080000.switch wan: configuring for phy/internal link mode -[ 11.972500] 8021q: adding VLAN 0 to HW filter on device wan -[ 11.980205] ------------[ cut here ]------------ -[ 11.984885] WARNING: CPU: 0 PID: 7 at phy_error+0x10/0x58 - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> ---- - drivers/net/dsa/bcm_sf2.c | 6 ++++++ - 1 file changed, 6 insertions(+) - ---- a/drivers/net/dsa/bcm_sf2.c -+++ b/drivers/net/dsa/bcm_sf2.c -@@ -1377,6 +1377,12 @@ static int bcm_sf2_sw_probe(struct platf - priv->hw_params.core_rev >> 8, priv->hw_params.core_rev & 0xff, - priv->irq0, priv->irq1); - -+ /* BCM4908 has 5 GPHYs which means bcm_sf2_port_setup() will not enable -+ * GPHY when needed. Leave it enabled here. -+ */ -+ if (priv->type == BCM4908_DEVICE_ID) -+ bcm_sf2_gphy_enable_set(priv->dev->ds, true); -+ - return 0; - - out_mdio: |