diff --git a/config/Config-kernel.in b/config/Config-kernel.in index e22fcf6382..8a78e297cb 100644 --- a/config/Config-kernel.in +++ b/config/Config-kernel.in @@ -380,7 +380,6 @@ config KERNEL_AIO config KERNEL_IO_URING bool "Compile the kernel with io_uring support" default y if !SMALL_FLASH - depends on LINUX_5_4 config KERNEL_FHANDLE bool "Compile the kernel with support for fhandle syscalls" @@ -975,6 +974,15 @@ if KERNEL_IPV6 config KERNEL_IPV6_PIMSM_V2 def_bool n + config KERNEL_IPV6_SEG6_LWTUNNEL + bool "Enable support for lightweight tunnels" + default y if !SMALL_FLASH + help + Using lwtunnel (needed for IPv6 segment routing) requires ip-full package. + + config KERNEL_LWTUNNEL_BPF + def_bool n + endif # diff --git a/include/kernel-version.mk b/include/kernel-version.mk index 4a2b9ae2f4..8b2577961c 100644 --- a/include/kernel-version.mk +++ b/include/kernel-version.mk @@ -6,9 +6,9 @@ ifdef CONFIG_TESTING_KERNEL KERNEL_PATCHVER:=$(KERNEL_TESTING_PATCHVER) endif -LINUX_VERSION-5.4 = .87 +LINUX_VERSION-5.4 = .89 -LINUX_KERNEL_HASH-5.4.87 = 6a34e93e2e84bb645155124962307ad9d3646124f43838d087209ed4ea595c31 +LINUX_KERNEL_HASH-5.4.89 = 268dd5177b6df1867d4ed2452ffb11a016d955c43aba5e07940886f347ab0aaf remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1)))) sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1))))))) diff --git a/package/boot/uboot-envtools/files/ipq40xx b/package/boot/uboot-envtools/files/ipq40xx index 8a0de7a548..b24cbf979e 100644 --- a/package/boot/uboot-envtools/files/ipq40xx +++ b/package/boot/uboot-envtools/files/ipq40xx @@ -43,6 +43,12 @@ plasmacloud,pa1200 |\ plasmacloud,pa2200) ubootenv_add_uci_config "/dev/mtd5" "0x0" "0x10000" "0x10000" ;; +aruba,ap-303) + ubootenv_add_uci_config "/dev/mtd13" "0x0" "0x10000" "0x10000" + ;; +aruba,ap-365) + ubootenv_add_uci_config "/dev/mtd8" "0x0" "0x10000" "0x10000" + ;; buffalo,wtr-m2133hp) ubootenv_add_uci_config "/dev/mtd8" "0x0" "0x40000" "0x20000" ;; diff --git a/package/boot/uboot-envtools/files/ipq806x b/package/boot/uboot-envtools/files/ipq806x index 6aae089ac4..96a4ee6450 100644 --- a/package/boot/uboot-envtools/files/ipq806x +++ b/package/boot/uboot-envtools/files/ipq806x @@ -45,6 +45,7 @@ qcom,ipq8064-ap148 |\ qcom,ipq8064-db149) ubootenv_add_uci_config $(ubootenv_mtdinfo) ;; +ubnt,unifi-ac-hd |\ zyxel,nbg6817) ubootenv_add_uci_config "/dev/mtdblock9" "0x0" "0x10000" "0x10000" ;; diff --git a/package/boot/uboot-rockchip/Makefile b/package/boot/uboot-rockchip/Makefile index 31299e9da0..6253679834 100644 --- a/package/boot/uboot-rockchip/Makefile +++ b/package/boot/uboot-rockchip/Makefile @@ -5,10 +5,10 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk -PKG_VERSION:=2020.10 +PKG_VERSION:=2021.01 PKG_RELEASE:=1 -PKG_HASH:=0d481bbdc05c0ee74908ec2f56a6daa53166cc6a78a0e4fac2ac5d025770a622 +PKG_HASH:=b407e1510a74e863b8b5cb42a24625344f0e0c2fc7582d8c866bd899367d0454 PKG_MAINTAINER:=Tobias Maedel diff --git a/package/boot/uboot-rockchip/patches/002-spl-remove-dtoc-of-pdata-generation.patch b/package/boot/uboot-rockchip/patches/002-spl-remove-dtoc-of-pdata-generation.patch index 4161c46ce2..bd401103ea 100644 --- a/package/boot/uboot-rockchip/patches/002-spl-remove-dtoc-of-pdata-generation.patch +++ b/package/boot/uboot-rockchip/patches/002-spl-remove-dtoc-of-pdata-generation.patch @@ -17,7 +17,7 @@ Signed-off-by: David Bauer --- a/scripts/Makefile.spl +++ b/scripts/Makefile.spl -@@ -320,12 +320,6 @@ PHONY += dts_dir +@@ -321,12 +321,6 @@ PHONY += dts_dir dts_dir: $(shell [ -d $(obj)/dts ] || mkdir -p $(obj)/dts) diff --git a/package/boot/uboot-rockchip/patches/100-rockchip-rk3328-Add-support-for-FriendlyARM-NanoPi-R.patch b/package/boot/uboot-rockchip/patches/100-rockchip-rk3328-Add-support-for-FriendlyARM-NanoPi-R.patch index e8b1c9b67d..60416a6880 100644 --- a/package/boot/uboot-rockchip/patches/100-rockchip-rk3328-Add-support-for-FriendlyARM-NanoPi-R.patch +++ b/package/boot/uboot-rockchip/patches/100-rockchip-rk3328-Add-support-for-FriendlyARM-NanoPi-R.patch @@ -1,6 +1,6 @@ -From 82cab423557470769a14fd3d1258cb02ec5b052b Mon Sep 17 00:00:00 2001 +From 4189a8db90ca7edc16cf9509576ca2e74f028c1c Mon Sep 17 00:00:00 2001 From: David Bauer -Date: Fri, 10 Jul 2020 14:58:30 +0200 +Date: Thu, 7 Jan 2021 00:05:46 +0100 Subject: [PATCH] rockchip: rk3328: Add support for FriendlyARM NanoPi R2S This adds support for the NanoPi R2S from FriendlyArm. @@ -20,15 +20,15 @@ Signed-off-by: David Bauer arch/arm/dts/rk3328-nanopi-r2s-u-boot.dtsi | 40 +++ arch/arm/dts/rk3328-nanopi-r2s.dts | 370 +++++++++++++++++++++ board/rockchip/evb_rk3328/MAINTAINERS | 7 + - configs/nanopi-r2s-rk3328_defconfig | 99 ++++++ - 5 files changed, 517 insertions(+) + configs/nanopi-r2s-rk3328_defconfig | 98 ++++++ + 5 files changed, 516 insertions(+) create mode 100644 arch/arm/dts/rk3328-nanopi-r2s-u-boot.dtsi create mode 100644 arch/arm/dts/rk3328-nanopi-r2s.dts create mode 100644 configs/nanopi-r2s-rk3328_defconfig --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile -@@ -108,6 +108,7 @@ dtb-$(CONFIG_ROCKCHIP_RK3308) += \ +@@ -110,6 +110,7 @@ dtb-$(CONFIG_ROCKCHIP_RK3308) += \ dtb-$(CONFIG_ROCKCHIP_RK3328) += \ rk3328-evb.dtb \ @@ -470,7 +470,7 @@ Signed-off-by: David Bauer M: Chen-Yu Tsai --- /dev/null +++ b/configs/nanopi-r2s-rk3328_defconfig -@@ -0,0 +1,99 @@ +@@ -0,0 +1,98 @@ +CONFIG_ARM=y +CONFIG_ARCH_ROCKCHIP=y +CONFIG_SYS_TEXT_BASE=0x00200000 @@ -485,7 +485,7 @@ Signed-off-by: David Bauer +CONFIG_NR_DRAM_BANKS=1 +CONFIG_DEBUG_UART_BASE=0xFF130000 +CONFIG_DEBUG_UART_CLOCK=24000000 -+CONFIG_SMBIOS_PRODUCT_NAME="nanopi_r2s_rk3328" ++CONFIG_SYSINFO=y +CONFIG_DEBUG_UART=y +CONFIG_TPL_SYS_MALLOC_F_LEN=0x800 +# CONFIG_ANDROID_BOOT_IMAGE is not set @@ -569,4 +569,3 @@ Signed-off-by: David Bauer +CONFIG_SPL_TINY_MEMSET=y +CONFIG_TPL_TINY_MEMSET=y +CONFIG_ERRNO_STR=y -+CONFIG_SMBIOS_MANUFACTURER="pine64" diff --git a/package/boot/uboot-rockchip/src/of-platdata/nanopi-r2s-rk3328/dt-platdata.c b/package/boot/uboot-rockchip/src/of-platdata/nanopi-r2s-rk3328/dt-platdata.c index a931ab7924..17e1e302a5 100644 --- a/package/boot/uboot-rockchip/src/of-platdata/nanopi-r2s-rk3328/dt-platdata.c +++ b/package/boot/uboot-rockchip/src/of-platdata/nanopi-r2s-rk3328/dt-platdata.c @@ -4,19 +4,14 @@ * This file was generated by dtoc from a .dtb (device tree binary) file. */ +/* Allow use of U_BOOT_DEVICE() in this file */ +#define DT_PLATDATA_C + #include #include #include -static struct dtd_rockchip_rk3328_grf dtv_syscon_at_ff100000 = { - .reg = {0xff100000, 0x1000}, -}; -U_BOOT_DEVICE(syscon_at_ff100000) = { - .name = "rockchip_rk3328_grf", - .platdata = &dtv_syscon_at_ff100000, - .platdata_size = sizeof(dtv_syscon_at_ff100000), -}; - +/* Node /clock-controller@ff440000 index 0 */ static struct dtd_rockchip_rk3328_cru dtv_clock_controller_at_ff440000 = { .reg = {0xff440000, 0x1000}, .rockchip_grf = 0x3a, @@ -25,97 +20,10 @@ U_BOOT_DEVICE(clock_controller_at_ff440000) = { .name = "rockchip_rk3328_cru", .platdata = &dtv_clock_controller_at_ff440000, .platdata_size = sizeof(dtv_clock_controller_at_ff440000), + .parent_idx = -1, }; -static struct dtd_ns16550_serial dtv_serial_at_ff130000 = { - .clock_frequency = 0x16e3600, - .clocks = { - {NULL, {40}}, - {NULL, {212}},}, - .dma_names = {"tx", "rx"}, - .dmas = {0x10, 0x6, 0x10, 0x7}, - .interrupts = {0x0, 0x39, 0x4}, - .pinctrl_0 = 0x26, - .pinctrl_names = "default", - .reg = {0xff130000, 0x100}, - .reg_io_width = 0x4, - .reg_shift = 0x2, -}; -U_BOOT_DEVICE(serial_at_ff130000) = { - .name = "ns16550_serial", - .platdata = &dtv_serial_at_ff130000, - .platdata_size = sizeof(dtv_serial_at_ff130000), -}; - -static struct dtd_rockchip_rk3288_dw_mshc dtv_mmc_at_ff500000 = { - .bus_width = 0x4, - .cap_sd_highspeed = true, - .clocks = { - {NULL, {317}}, - {NULL, {33}}, - {NULL, {74}}, - {NULL, {78}},}, - .disable_wp = true, - .fifo_depth = 0x100, - .interrupts = {0x0, 0xc, 0x4}, - .max_frequency = 0x8f0d180, - .pinctrl_0 = {0x47, 0x48, 0x49, 0x4a}, - .pinctrl_names = "default", - .reg = {0xff500000, 0x4000}, - .sd_uhs_sdr104 = true, - .sd_uhs_sdr12 = true, - .sd_uhs_sdr25 = true, - .sd_uhs_sdr50 = true, - .u_boot_spl_fifo_mode = true, - .vmmc_supply = 0x4b, - .vqmmc_supply = 0x1e, -}; -U_BOOT_DEVICE(mmc_at_ff500000) = { - .name = "rockchip_rk3288_dw_mshc", - .platdata = &dtv_mmc_at_ff500000, - .platdata_size = sizeof(dtv_mmc_at_ff500000), -}; - -static struct dtd_rockchip_rk3328_pinctrl dtv_pinctrl = { - .ranges = true, - .rockchip_grf = 0x3a, -}; -U_BOOT_DEVICE(pinctrl) = { - .name = "rockchip_rk3328_pinctrl", - .platdata = &dtv_pinctrl, - .platdata_size = sizeof(dtv_pinctrl), -}; - -static struct dtd_rockchip_gpio_bank dtv_gpio0_at_ff210000 = { - .clocks = { - {NULL, {200}},}, - .gpio_controller = true, - .interrupt_controller = true, - .interrupts = {0x0, 0x33, 0x4}, - .reg = {0xff210000, 0x100}, -}; -U_BOOT_DEVICE(gpio0_at_ff210000) = { - .name = "rockchip_gpio_bank", - .platdata = &dtv_gpio0_at_ff210000, - .platdata_size = sizeof(dtv_gpio0_at_ff210000), -}; - -static struct dtd_regulator_fixed dtv_sdmmc_regulator = { - .gpio = {0x61, 0x1e, 0x1}, - .pinctrl_0 = 0x67, - .pinctrl_names = "default", - .regulator_boot_on = true, - .regulator_max_microvolt = 0x325aa0, - .regulator_min_microvolt = 0x325aa0, - .regulator_name = "vcc_sd", - .vin_supply = 0x1c, -}; -U_BOOT_DEVICE(sdmmc_regulator) = { - .name = "regulator_fixed", - .platdata = &dtv_sdmmc_regulator, - .platdata_size = sizeof(dtv_sdmmc_regulator), -}; - +/* Node /dmc index 1 */ static struct dtd_rockchip_rk3328_dmc dtv_dmc = { .reg = {0xff400000, 0x1000, 0xff780000, 0x3000, 0xff100000, 0x1000, 0xff440000, 0x1000, 0xff720000, 0x1000, 0xff798000, 0x1000}, @@ -149,14 +57,118 @@ U_BOOT_DEVICE(dmc) = { .name = "rockchip_rk3328_dmc", .platdata = &dtv_dmc, .platdata_size = sizeof(dtv_dmc), + .parent_idx = -1, +}; + +/* Node /pinctrl/gpio0@ff210000 index 2 */ +static struct dtd_rockchip_gpio_bank dtv_gpio0_at_ff210000 = { + .clocks = { + {0, {200}},}, + .gpio_controller = true, + .interrupt_controller = true, + .interrupts = {0x0, 0x33, 0x4}, + .reg = {0xff210000, 0x100}, +}; +U_BOOT_DEVICE(gpio0_at_ff210000) = { + .name = "rockchip_gpio_bank", + .platdata = &dtv_gpio0_at_ff210000, + .platdata_size = sizeof(dtv_gpio0_at_ff210000), + .parent_idx = 4, +}; + +/* Node /mmc@ff500000 index 3 */ +static struct dtd_rockchip_rk3288_dw_mshc dtv_mmc_at_ff500000 = { + .bus_width = 0x4, + .cap_sd_highspeed = true, + .clocks = { + {0, {317}}, + {0, {33}}, + {0, {74}}, + {0, {78}},}, + .disable_wp = true, + .fifo_depth = 0x100, + .interrupts = {0x0, 0xc, 0x4}, + .max_frequency = 0x8f0d180, + .pinctrl_0 = {0x47, 0x48, 0x49, 0x4a}, + .pinctrl_names = "default", + .reg = {0xff500000, 0x4000}, + .sd_uhs_sdr104 = true, + .sd_uhs_sdr12 = true, + .sd_uhs_sdr25 = true, + .sd_uhs_sdr50 = true, + .u_boot_spl_fifo_mode = true, + .vmmc_supply = 0x4b, + .vqmmc_supply = 0x1e, +}; +U_BOOT_DEVICE(mmc_at_ff500000) = { + .name = "rockchip_rk3288_dw_mshc", + .platdata = &dtv_mmc_at_ff500000, + .platdata_size = sizeof(dtv_mmc_at_ff500000), + .parent_idx = -1, +}; + +/* Node /pinctrl index 4 */ +static struct dtd_rockchip_rk3328_pinctrl dtv_pinctrl = { + .ranges = true, + .rockchip_grf = 0x3a, +}; +U_BOOT_DEVICE(pinctrl) = { + .name = "rockchip_rk3328_pinctrl", + .platdata = &dtv_pinctrl, + .platdata_size = sizeof(dtv_pinctrl), + .parent_idx = -1, +}; + +/* Node /sdmmc-regulator index 5 */ +static struct dtd_regulator_fixed dtv_sdmmc_regulator = { + .gpio = {0x61, 0x1e, 0x1}, + .pinctrl_0 = 0x67, + .pinctrl_names = "default", + .regulator_boot_on = true, + .regulator_max_microvolt = 0x325aa0, + .regulator_min_microvolt = 0x325aa0, + .regulator_name = "vcc_sd", + .vin_supply = 0x1c, +}; +U_BOOT_DEVICE(sdmmc_regulator) = { + .name = "regulator_fixed", + .platdata = &dtv_sdmmc_regulator, + .platdata_size = sizeof(dtv_sdmmc_regulator), + .parent_idx = -1, +}; + +/* Node /serial@ff130000 index 6 */ +static struct dtd_ns16550_serial dtv_serial_at_ff130000 = { + .clock_frequency = 0x16e3600, + .clocks = { + {0, {40}}, + {0, {212}},}, + .dma_names = {"tx", "rx"}, + .dmas = {0x10, 0x6, 0x10, 0x7}, + .interrupts = {0x0, 0x39, 0x4}, + .pinctrl_0 = 0x26, + .pinctrl_names = "default", + .reg = {0xff130000, 0x100}, + .reg_io_width = 0x4, + .reg_shift = 0x2, +}; +U_BOOT_DEVICE(serial_at_ff130000) = { + .name = "ns16550_serial", + .platdata = &dtv_serial_at_ff130000, + .platdata_size = sizeof(dtv_serial_at_ff130000), + .parent_idx = -1, +}; + +/* Node /syscon@ff100000 index 7 */ +static struct dtd_rockchip_rk3328_grf dtv_syscon_at_ff100000 = { + .reg = {0xff100000, 0x1000}, +}; +U_BOOT_DEVICE(syscon_at_ff100000) = { + .name = "rockchip_rk3328_grf", + .platdata = &dtv_syscon_at_ff100000, + .platdata_size = sizeof(dtv_syscon_at_ff100000), + .parent_idx = -1, }; void dm_populate_phandle_data(void) { - dtv_serial_at_ff130000.clocks[0].node = DM_GET_DEVICE(clock_controller_at_ff440000); - dtv_serial_at_ff130000.clocks[1].node = DM_GET_DEVICE(clock_controller_at_ff440000); - dtv_mmc_at_ff500000.clocks[0].node = DM_GET_DEVICE(clock_controller_at_ff440000); - dtv_mmc_at_ff500000.clocks[1].node = DM_GET_DEVICE(clock_controller_at_ff440000); - dtv_mmc_at_ff500000.clocks[2].node = DM_GET_DEVICE(clock_controller_at_ff440000); - dtv_mmc_at_ff500000.clocks[3].node = DM_GET_DEVICE(clock_controller_at_ff440000); - dtv_gpio0_at_ff210000.clocks[0].node = DM_GET_DEVICE(clock_controller_at_ff440000); } diff --git a/package/boot/uboot-rockchip/src/of-platdata/nanopi-r2s-rk3328/dt-structs-gen.h b/package/boot/uboot-rockchip/src/of-platdata/nanopi-r2s-rk3328/dt-structs-gen.h index 22efe0d247..847b121a34 100644 --- a/package/boot/uboot-rockchip/src/of-platdata/nanopi-r2s-rk3328/dt-structs-gen.h +++ b/package/boot/uboot-rockchip/src/of-platdata/nanopi-r2s-rk3328/dt-structs-gen.h @@ -69,9 +69,3 @@ struct dtd_rockchip_rk3328_pinctrl { bool ranges; fdt32_t rockchip_grf; }; -#define dtd_syscon dtd_rockchip_rk3328_cru -#define dtd_simple_mfd dtd_rockchip_rk3328_grf -#define dtd_rockchip_rk3328_uart dtd_ns16550_serial -#define dtd_snps_dw_apb_uart dtd_ns16550_serial -#define dtd_rockchip_cru dtd_rockchip_rk3328_cru -#define dtd_rockchip_rk3328_dw_mshc dtd_rockchip_rk3288_dw_mshc diff --git a/package/kernel/linux/modules/leds.mk b/package/kernel/linux/modules/leds.mk index fe90c6b559..bc94e54ae1 100644 --- a/package/kernel/linux/modules/leds.mk +++ b/package/kernel/linux/modules/leds.mk @@ -38,21 +38,6 @@ endef $(eval $(call KernelPackage,ledtrig-activity)) -define KernelPackage/ledtrig-heartbeat - SUBMENU:=$(LEDS_MENU) - TITLE:=LED Heartbeat Trigger - KCONFIG:=CONFIG_LEDS_TRIGGER_HEARTBEAT - FILES:=$(LED_TRIGGER_DIR)/ledtrig-heartbeat.ko - AUTOLOAD:=$(call AutoLoad,50,ledtrig-heartbeat) -endef - -define KernelPackage/ledtrig-heartbeat/description - Kernel module that allows LEDs to blink like heart beat -endef - -$(eval $(call KernelPackage,ledtrig-heartbeat)) - - define KernelPackage/ledtrig-gpio SUBMENU:=$(LEDS_MENU) TITLE:=LED GPIO Trigger @@ -68,52 +53,6 @@ endef $(eval $(call KernelPackage,ledtrig-gpio)) -define KernelPackage/ledtrig-netdev - SUBMENU:=$(LEDS_MENU) - TITLE:=LED NETDEV Trigger - KCONFIG:=CONFIG_LEDS_TRIGGER_NETDEV - FILES:=$(LINUX_DIR)/drivers/leds/trigger/ledtrig-netdev.ko - AUTOLOAD:=$(call AutoLoad,50,ledtrig-netdev) -endef - -define KernelPackage/ledtrig-netdev/description - Kernel module to drive LEDs based on network activity -endef - -$(eval $(call KernelPackage,ledtrig-netdev)) - - -define KernelPackage/ledtrig-default-on - SUBMENU:=$(LEDS_MENU) - TITLE:=LED Default ON Trigger - KCONFIG:=CONFIG_LEDS_TRIGGER_DEFAULT_ON - FILES:=$(LED_TRIGGER_DIR)/ledtrig-default-on.ko - AUTOLOAD:=$(call AutoLoad,50,ledtrig-default-on,1) -endef - -define KernelPackage/ledtrig-default-on/description - Kernel module that allows LEDs to be initialised in the ON state -endef - -$(eval $(call KernelPackage,ledtrig-default-on)) - - -define KernelPackage/ledtrig-timer - SUBMENU:=$(LEDS_MENU) - TITLE:=LED Timer Trigger - KCONFIG:=CONFIG_LEDS_TRIGGER_TIMER - FILES:=$(LED_TRIGGER_DIR)/ledtrig-timer.ko - AUTOLOAD:=$(call AutoLoad,50,ledtrig-timer,1) -endef - -define KernelPackage/ledtrig-timer/description - Kernel module that allows LEDs to be controlled by a programmable timer - via sysfs -endef - -$(eval $(call KernelPackage,ledtrig-timer)) - - define KernelPackage/ledtrig-transient SUBMENU:=$(LEDS_MENU) TITLE:=LED Transient Trigger diff --git a/package/kernel/linux/modules/netfilter.mk b/package/kernel/linux/modules/netfilter.mk index 0e3671437c..5cbc11b95b 100644 --- a/package/kernel/linux/modules/netfilter.mk +++ b/package/kernel/linux/modules/netfilter.mk @@ -1087,7 +1087,7 @@ $(eval $(call KernelPackage,nfnetlink-queue)) define KernelPackage/nf-conntrack-netlink TITLE:=Connection tracking netlink interface FILES:=$(LINUX_DIR)/net/netfilter/nf_conntrack_netlink.ko - KCONFIG:=CONFIG_NF_CT_NETLINK CONFIG_NF_CONNTRACK_EVENTS=y + KCONFIG:=CONFIG_NF_CT_NETLINK CONFIG_NF_CONNTRACK_EVENTS=y CONFIG_NETFILTER_NETLINK_GLUE_CT=y AUTOLOAD:=$(call AutoProbe,nf_conntrack_netlink) $(call AddDepends/nfnetlink,+kmod-ipt-conntrack) endef diff --git a/package/kernel/linux/modules/other.mk b/package/kernel/linux/modules/other.mk index 421b1b536c..83d998c83a 100644 --- a/package/kernel/linux/modules/other.mk +++ b/package/kernel/linux/modules/other.mk @@ -1039,11 +1039,11 @@ $(eval $(call KernelPackage,random-core)) define KernelPackage/thermal SUBMENU:=$(OTHER_MENU) - TITLE:=Generic Thermal sysfs driver + TITLE:=Thermal driver DEPENDS:=+kmod-hwmon-core HIDDEN:=1 KCONFIG:= \ - CONFIG_THERMAL \ + CONFIG_THERMAL=y \ CONFIG_THERMAL_OF=y \ CONFIG_CPU_THERMAL=y \ CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y \ @@ -1055,14 +1055,11 @@ define KernelPackage/thermal CONFIG_THERMAL_GOV_USER_SPACE=n \ CONFIG_THERMAL_HWMON=y \ CONFIG_THERMAL_EMULATION=n - FILES:=$(LINUX_DIR)/drivers/thermal/thermal_sys.ko - AUTOLOAD:=$(call AutoProbe,thermal_sys) endef define KernelPackage/thermal/description - Generic Thermal Sysfs driver offers a generic mechanism for thermal - management. Usually it's made up of one or more thermal zone and cooling - device. + Thermal driver offers a generic mechanism for thermal management. + Usually it's made up of one or more thermal zone and cooling device. endef $(eval $(call KernelPackage,thermal)) diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile index e03c91e9c4..096225754c 100644 --- a/package/kernel/mac80211/Makefile +++ b/package/kernel/mac80211/Makefile @@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 PKG_VERSION:=5.8.18-1 -PKG_RELEASE:=4 +PKG_RELEASE:=5 PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.8.18/ PKG_HASH:=f04a8172423c6a945fc7d9844b04f33fda9ae574e552f8f18ee3bdfcfb494563 diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh index 1f273ba515..e433afa558 100644 --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh @@ -1019,14 +1019,14 @@ drv_mac80211_setup() { if [ "$no_reload" != "0" ]; then add_ap=1 ubus wait_for hostapd - local hostapd_pid=$(ubus call hostapd config_add "{\"iface\":\"$primary_ap\", \"config\":\"${hostapd_conf_file}\"}" | jsonfilter -l 1 -e @.pid) - wireless_add_process "$hostapd_pid" "/usr/sbin/hostapd" 1 1 + local hostapd_res="$(ubus call hostapd config_add "{\"iface\":\"$primary_ap\", \"config\":\"${hostapd_conf_file}\"}")" + ret="$?" + [ "$ret" != 0 -o -z "$hostapd_res" ] && { + wireless_setup_failed HOSTAPD_START_FAILED + return + } + wireless_add_process "$(jsonfilter -s "$hostapd_res" -l 1 -e @.pid)" "/usr/sbin/hostapd" 1 1 fi - ret="$?" - [ "$ret" != 0 ] && { - wireless_setup_failed HOSTAPD_START_FAILED - return - } } uci -q -P /var/state set wireless._${phy}.aplist="${NEWAPLIST}" uci -q -P /var/state set wireless._${phy}.md5="${NEW_MD5}" diff --git a/package/kernel/mac80211/patches/subsys/343-mac80211-minstrel_ht-fix-max-probability-rate-select.patch b/package/kernel/mac80211/patches/subsys/343-mac80211-minstrel_ht-fix-max-probability-rate-select.patch index a0b918c9a1..0dbfa9d4fb 100644 --- a/package/kernel/mac80211/patches/subsys/343-mac80211-minstrel_ht-fix-max-probability-rate-select.patch +++ b/package/kernel/mac80211/patches/subsys/343-mac80211-minstrel_ht-fix-max-probability-rate-select.patch @@ -76,7 +76,15 @@ Signed-off-by: Felix Fietkau bool ht_supported = mi->sta->ht_cap.ht_supported; mi->sample_mode = MINSTREL_SAMPLE_IDLE; -@@ -903,9 +913,6 @@ minstrel_ht_update_stats(struct minstrel +@@ -863,6 +873,7 @@ minstrel_ht_update_stats(struct minstrel + else + index = MINSTREL_OFDM_GROUP * MCS_GROUP_RATES; + ++ tmp_max_prob_rate = index; + for (j = 0; j < ARRAY_SIZE(tmp_mcs_tp_rate); j++) + tmp_mcs_tp_rate[j] = index; + +@@ -903,9 +914,6 @@ minstrel_ht_update_stats(struct minstrel /* Find max throughput rate set within a group */ minstrel_ht_sort_best_tp_rates(mi, index, tmp_group_tp_rate); @@ -86,7 +94,7 @@ Signed-off-by: Felix Fietkau } memcpy(mg->max_group_tp_rate, tmp_group_tp_rate, -@@ -917,6 +924,27 @@ minstrel_ht_update_stats(struct minstrel +@@ -917,6 +925,27 @@ minstrel_ht_update_stats(struct minstrel tmp_legacy_tp_rate); memcpy(mi->max_tp_rate, tmp_mcs_tp_rate, sizeof(mi->max_tp_rate)); diff --git a/package/kernel/mac80211/patches/subsys/344-mac80211-minstrel_ht-increase-stats-update-interval.patch b/package/kernel/mac80211/patches/subsys/344-mac80211-minstrel_ht-increase-stats-update-interval.patch index 5c7785f892..9972a9414e 100644 --- a/package/kernel/mac80211/patches/subsys/344-mac80211-minstrel_ht-increase-stats-update-interval.patch +++ b/package/kernel/mac80211/patches/subsys/344-mac80211-minstrel_ht-increase-stats-update-interval.patch @@ -9,7 +9,7 @@ Signed-off-by: Felix Fietkau --- a/net/mac80211/rc80211_minstrel_ht.c +++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -1864,7 +1864,7 @@ minstrel_ht_alloc(struct ieee80211_hw *h +@@ -1865,7 +1865,7 @@ minstrel_ht_alloc(struct ieee80211_hw *h mp->has_mrr = true; mp->hw = hw; diff --git a/package/kernel/mac80211/patches/subsys/345-mac80211-minstrel_ht-fix-rounding-error-in-throughpu.patch b/package/kernel/mac80211/patches/subsys/345-mac80211-minstrel_ht-fix-rounding-error-in-throughpu.patch new file mode 100644 index 0000000000..1df5dec039 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/345-mac80211-minstrel_ht-fix-rounding-error-in-throughpu.patch @@ -0,0 +1,34 @@ +From: Felix Fietkau +Date: Fri, 15 Jan 2021 12:15:06 +0100 +Subject: [PATCH] mac80211: minstrel_ht: fix rounding error in throughput + calculation + +On lower data rates, the throughput calculation has a significant rounding +error, causing rates like 48M and 54M OFDM to share the same throughput +value with >= 90% success probablity. + +This is because the result of the division (prob_avg * 1000) / nsecs +is really small (8 in this example). + +Improve accuracy by moving over some zeroes, making better use of the full +range of u32 before the division. + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/rc80211_minstrel_ht.c ++++ b/net/mac80211/rc80211_minstrel_ht.c +@@ -445,10 +445,9 @@ minstrel_ht_get_tp_avg(struct minstrel_h + * (prob is scaled - see MINSTREL_FRAC above) + */ + if (prob_avg > MINSTREL_FRAC(90, 100)) +- return MINSTREL_TRUNC(100000 * ((MINSTREL_FRAC(90, 100) * 1000) +- / nsecs)); +- else +- return MINSTREL_TRUNC(100000 * ((prob_avg * 1000) / nsecs)); ++ prob_avg = MINSTREL_FRAC(90, 100); ++ ++ return MINSTREL_TRUNC(100 * ((prob_avg * 1000000) / nsecs)); + } + + /* diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index d22cf8d2ce..ff03632beb 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -8,9 +8,9 @@ PKG_LICENSE_FILES:= PKG_SOURCE_URL:=https://github.com/openwrt/mt76 PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2020-12-18 -PKG_SOURCE_VERSION:=4a90fdf6105e1517897aac1b451b73a54b3d9d0d -PKG_MIRROR_HASH:=1ea778584d0fabbc75eb3b2f42aba0c0f2f5e6f0f5ae3084c17b9f02876ebdcc +PKG_SOURCE_DATE:=2021-01-14 +PKG_SOURCE_VERSION:=4c8a09cc45d03897a473c270fede699a0420a483 +PKG_MIRROR_HASH:=5b708e288484eaf735b9135faf9d45453cef56568032bea53d0238c281e6111c PKG_MAINTAINER:=Felix Fietkau PKG_BUILD_PARALLEL:=1 diff --git a/package/kernel/mt76/patches/100-tools-Set-mode-for-new-file-tmp-mt76-test-s.patch b/package/kernel/mt76/patches/100-tools-Set-mode-for-new-file-tmp-mt76-test-s.patch deleted file mode 100644 index 71b43a1cb6..0000000000 --- a/package/kernel/mt76/patches/100-tools-Set-mode-for-new-file-tmp-mt76-test-s.patch +++ /dev/null @@ -1,25 +0,0 @@ -From fe89f9bc4055fd6055ce8792a715a40a6c75ba44 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Thu, 17 Dec 2020 13:54:04 +0100 -Subject: [PATCH] tools: Set mode for new file /tmp/mt76-test-%s - -Set the file system mode for the newly created file /tmp/mt76-test-%s, -this is mandatory according to the man page and fixes a compile error -with glibc. - -Signed-off-by: Hauke Mehrtens ---- - tools/eeprom.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/tools/eeprom.c -+++ b/tools/eeprom.c -@@ -77,7 +77,7 @@ mt76_eeprom_create_file(void) - return -1; - } - -- fd = open(eeprom_file, O_RDWR | O_CREAT | O_EXCL); -+ fd = open(eeprom_file, O_RDWR | O_CREAT | O_EXCL, 00644); - if (fd < 0) - goto out; - diff --git a/package/libs/mbedtls/Makefile b/package/libs/mbedtls/Makefile index bec7ffaf22..d6c9bd1007 100644 --- a/package/libs/mbedtls/Makefile +++ b/package/libs/mbedtls/Makefile @@ -21,7 +21,12 @@ PKG_LICENSE:=GPL-2.0-or-later PKG_LICENSE_FILES:=gpl-2.0.txt PKG_CPE_ID:=cpe:/a:arm:mbed_tls +<<<<<<< HEAD PKG_CONFIG_DEPENDS:=CONFIG_LIBMBEDTLS_DEBUG_C CONFIG_LIBMBEDTLS_HAVE_SSE2 +PKG_CONFIG_DEPENDS := \ + CONFIG_LIBMBEDTLS_DEBUG_C \ + CONFIG_LIBMBEDTLS_HAVE_SSE2 \ + CONFIG_LIBMBEDTLS_HKDF_C include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/cmake.mk @@ -57,6 +62,7 @@ config LIBMBEDTLS_DEBUG_C by around 60 KiB (for an ARMv5 platform). Usually, you don't need this, so don't select this if you're unsure. + config LIBMBEDTLS_HAVE_SSE2 depends on PACKAGE_libmbedtls bool @@ -70,6 +76,14 @@ config LIBMBEDTLS_HAVE_SSE2 support them, such as Geode GX and LX. In this case you may save 23KB by saying yes here. AMD Geode NX, and Intel Pentium 4 and above support SSE2. + +config LIBMBEDTLS_HKDF_C + depends on PACKAGE_libmbedtls + bool "Enable the HKDF algorithm (RFC 5869)" + default n + help + This option adds support for the Hashed Message Authentication Code + (HMAC)-based key derivation function (HKDF). endef define Package/mbedtls-util @@ -111,6 +125,13 @@ define Build/Configure END { exit(rc) }' $(PKG_BUILD_DIR)/include/mbedtls/config.h \ >$(PKG_BUILD_DIR)/include/mbedtls/config.h.new && \ mv $(PKG_BUILD_DIR)/include/mbedtls/config.h.new $(PKG_BUILD_DIR)/include/mbedtls/config.h + + awk 'BEGIN { rc = 1 } \ + /#define MBEDTLS_HKDF_C/ { $$$$0 = "$(if $(CONFIG_LIBMBEDTLS_HKDF_C),,// )#define MBEDTLS_HKDF_C"; rc = 0 } \ + { print } \ + END { exit(rc) }' $(PKG_BUILD_DIR)/include/mbedtls/config.h \ + >$(PKG_BUILD_DIR)/include/mbedtls/config.h.new && \ + mv $(PKG_BUILD_DIR)/include/mbedtls/config.h.new $(PKG_BUILD_DIR)/include/mbedtls/config.h endef define Build/InstallDev diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index f57b072974..cbbe6c1009 100644 --- a/package/network/services/hostapd/Makefile +++ b/package/network/services/hostapd/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=hostapd -PKG_RELEASE:=23 +PKG_RELEASE:=28 PKG_SOURCE_URL:=http://w1.fi/hostap.git PKG_SOURCE_PROTO:=git @@ -145,6 +145,7 @@ define Package/hostapd/Default TITLE:=IEEE 802.1x Authenticator URL:=http://hostap.epitest.fi/ DEPENDS:=$(DRV_DEPENDS) +hostapd-common +libubus + USERID:=network=101:network=101 PROVIDES:=hostapd CONFLICTS:=$(HOSTAPD_PROVIDERS) HOSTAPD_PROVIDERS+=$(1) @@ -228,6 +229,7 @@ define Package/wpad/Default SUBMENU:=WirelessAPD TITLE:=IEEE 802.1x Auth/Supplicant DEPENDS:=$(DRV_DEPENDS) +hostapd-common +libubus + USERID:=network=101:network=101 URL:=http://hostap.epitest.fi/ PROVIDES:=hostapd wpa-supplicant CONFLICTS:=$(HOSTAPD_PROVIDERS) $(SUPPLICANT_PROVIDERS) @@ -342,6 +344,7 @@ define Package/wpa-supplicant/Default TITLE:=WPA Supplicant URL:=http://hostap.epitest.fi/wpa_supplicant/ DEPENDS:=$(DRV_DEPENDS) +hostapd-common +libubus + USERID:=network=101:network=101 PROVIDES:=wpa-supplicant CONFLICTS:=$(SUPPLICANT_PROVIDERS) SUPPLICANT_PROVIDERS+=$(1) @@ -593,10 +596,12 @@ define Install/supplicant endef define Package/hostapd-common/install - $(INSTALL_DIR) $(1)/lib/netifd $(1)/etc/rc.button $(1)/etc/hotplug.d/ieee80211 $(1)/etc/init.d + $(INSTALL_DIR) $(1)/etc/capabilities $(1)/etc/rc.button $(1)/etc/hotplug.d/ieee80211 $(1)/etc/init.d $(1)/lib/netifd $(1)/usr/share/acl.d $(INSTALL_DATA) ./files/hostapd.sh $(1)/lib/netifd/hostapd.sh $(INSTALL_BIN) ./files/wpad.init $(1)/etc/init.d/wpad $(INSTALL_BIN) ./files/wps-hotplug.sh $(1)/etc/rc.button/wps + $(INSTALL_DATA) ./files/wpad_acl.json $(1)/usr/share/acl.d + $(INSTALL_DATA) ./files/wpad.json $(1)/etc/capabilities endef define Package/hostapd/install diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh index 714a276bb6..6d279b3db1 100644 --- a/package/network/services/hostapd/files/hostapd.sh +++ b/package/network/services/hostapd/files/hostapd.sh @@ -113,7 +113,6 @@ hostapd_prepare_device_config() { local config="$1" local driver="$2" - local base="${config%%.conf}" local base_cfg= json_get_vars country country_ie beacon_int:100 dtim_period:2 doth require_mode legacy_rates \ @@ -333,6 +332,8 @@ hostapd_common_add_bss_config() { config_add_array airtime_sta_weight config_add_int airtime_bss_weight airtime_bss_limit + config_add_boolean multicast_to_unicast per_sta_vif + config_add_array hostapd_bss_options } @@ -430,7 +431,7 @@ append_osu_icon() { } append_osu_provider() { - local cfgtype osu_server_uri osu_friendly_name osu_nai osu_nai2 osu_method_list + local cfgtype osu_server_uri osu_friendly_name osu_nai osu_nai2 osu_method_list config_load wireless config_get cfgtype "$1" TYPE @@ -482,7 +483,8 @@ hostapd_set_bss_options() { acct_server acct_secret acct_port acct_interval \ bss_load_update_period chan_util_avg_period sae_require_mfp \ multi_ap multi_ap_backhaul_ssid multi_ap_backhaul_key skip_inactivity_poll \ - airtime_bss_weight airtime_bss_limit airtime_sta_weight + airtime_bss_weight airtime_bss_limit airtime_sta_weight \ + multicast_to_unicast per_sta_vif set_default isolate 0 set_default maxassoc 0 @@ -666,7 +668,7 @@ hostapd_set_bss_options() { set_default wps_independent 1 wps_state=2 - [ -n "$wps_configured" ] && wps_state=1 + [ -n "$wps_not_configured" ] && wps_state=1 [ "$ext_registrar" -gt 0 -a -n "$network_bridge" ] && append bss_conf "upnp_iface=$network_bridge" "$N" @@ -743,7 +745,7 @@ hostapd_set_bss_options() { if [ "$ieee80211r" -gt "0" ]; then json_get_vars mobility_domain ft_psk_generate_local ft_over_ds reassociation_deadline - + set_default mobility_domain "$(echo "$ssid" | md5sum | head -c 4)" set_default ft_over_ds 1 set_default reassociation_deadline 1000 @@ -944,6 +946,16 @@ hostapd_set_bss_options() { json_for_each_item append_operator_icon operator_icon fi + set_default multicast_to_unicast 0 + if [ "$multicast_to_unicast" -gt 0 ]; then + append bss_conf "multicast_to_unicast=$multicast_to_unicast" "$N" + fi + + set_default per_sta_vif 0 + if [ "$per_sta_vif" -gt 0 ]; then + append bss_conf "per_sta_vif=$per_sta_vif" "$N" + fi + json_get_values opts hostapd_bss_options for val in $opts; do append bss_conf "$val" "$N" @@ -1104,7 +1116,6 @@ wpa_supplicant_add_network() { set_default multi_ap 0 local key_mgmt='NONE' - local enc_str= local network_data= local T=" " @@ -1359,7 +1370,7 @@ wpa_supplicant_add_network() { append network_data "mcast_rate=$mc_rate" "$N$T" } - if [ "$key_mgnt" = "WPS" ]; then + if [ "$key_mgmt" = "WPS" ]; then echo "wps_cred_processing=1" >> "$_config" else cat >> "$_config" <= sizeof(addr->buf.v6))) goto err; - snprintf(addr->buf.v4, sizeof(addr->buf.v6), "%s", s); + snprintf(addr->buf.v6, sizeof(addr->buf.v6), "%s", s); addr->family = AF_INET6; - if ((p = strchr(addr->buf.v4, '/')) != NULL) + if ((p = strchr(addr->buf.v6, '/')) != NULL) { *p++ = 0; @@ -379,9 +379,9 @@ static struct cidr * cidr_parse6(const char *s) addr->prefix = 128; } - if (p == addr->buf.v4+1) + if (p == addr->buf.v6+1) memset(&addr->addr.v6, 0, sizeof(addr->addr.v6)); - else if (inet_pton(AF_INET6, addr->buf.v4, &addr->addr.v6) != 1) + else if (inet_pton(AF_INET6, addr->buf.v6, &addr->addr.v6) != 1) goto err; return addr; diff --git a/scripts/target-metadata.pl b/scripts/target-metadata.pl index 973dcb9137..d4d4325816 100755 --- a/scripts/target-metadata.pl +++ b/scripts/target-metadata.pl @@ -429,7 +429,8 @@ sub gen_profile_mk() { my @targets = parse_target_metadata($file); foreach my $cur (@targets) { next unless $cur->{id} eq $target; - print "PROFILE_NAMES = ".join(" ", map { $_->{id} } @{$cur->{profiles}})."\n"; + my @profile_ids_unique = do { my %seen; grep { !$seen{$_}++} map { $_->{id} } @{$cur->{profiles}}}; + print "PROFILE_NAMES = ".join(" ", @profile_ids_unique)."\n"; foreach my $profile (@{$cur->{profiles}}) { print $profile->{id}.'_NAME:='.$profile->{name}."\n"; print $profile->{id}.'_HAS_IMAGE_METADATA:='.$profile->{has_image_metadata}."\n"; diff --git a/target/linux/at91/sama5/config-default b/target/linux/at91/sama5/config-default index d64aa1e2c6..e9d9bf7f3f 100644 --- a/target/linux/at91/sama5/config-default +++ b/target/linux/at91/sama5/config-default @@ -313,9 +313,7 @@ CONFIG_KEYBOARD_QT1070=y CONFIG_LEDS_GPIO=y CONFIG_LEDS_PWM=y CONFIG_LEDS_TRIGGER_CPU=y -# CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set CONFIG_LEDS_TRIGGER_GPIO=y -CONFIG_LEDS_TRIGGER_HEARTBEAT=y CONFIG_LIBFDT=y CONFIG_LOCALVERSION_AUTO=y CONFIG_LOCK_DEBUGGING_SUPPORT=y diff --git a/target/linux/ath79/dts/ar9342_ubnt_bullet-ac.dts b/target/linux/ath79/dts/ar9342_ubnt_bullet-ac.dts new file mode 100644 index 0000000000..be0b0792bb --- /dev/null +++ b/target/linux/ath79/dts/ar9342_ubnt_bullet-ac.dts @@ -0,0 +1,38 @@ +// SPDX-License-Identifier: GPL-2.0-only + +#include "ar9342_ubnt_wa_1port.dtsi" + +/ { + compatible = "ubnt,bullet-ac", "ubnt,wa", "qca,ar9342"; + model = "Ubiquiti Bullet AC (2WA)"; + + aliases { + led-boot = &led_rssi3; + led-failsafe = &led_rssi3; + led-upgrade = &led_rssi3; + }; + + leds { + compatible = "gpio-leds"; + + rssi0 { + label = "blue:rssi0"; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + }; + + rssi1 { + label = "blue:rssi1"; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + }; + + rssi2 { + label = "blue:rssi2"; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + }; + + led_rssi3: rssi3 { + label = "blue:rssi3"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + }; + }; +}; diff --git a/target/linux/ath79/dts/qca9531_tplink_tl-wr810n-v1.dts b/target/linux/ath79/dts/qca9531_tplink_tl-wr810n-v1.dts index c792df60df..36f83809b8 100644 --- a/target/linux/ath79/dts/qca9531_tplink_tl-wr810n-v1.dts +++ b/target/linux/ath79/dts/qca9531_tplink_tl-wr810n-v1.dts @@ -17,15 +17,9 @@ }; &usb0 { - #address-cells = <1>; - #size-cells = <0>; - vbus-supply = <®_usb_vbus>; status = "okay"; - hub_port: port@1 { - reg = <1>; - #trigger-source-cells = <0>; - }; + vbus-supply = <®_usb_vbus>; }; &usb_phy { diff --git a/target/linux/ath79/generic/base-files/etc/board.d/01_leds b/target/linux/ath79/generic/base-files/etc/board.d/01_leds index 7df27dbd6c..d23c64142d 100755 --- a/target/linux/ath79/generic/base-files/etc/board.d/01_leds +++ b/target/linux/ath79/generic/base-files/etc/board.d/01_leds @@ -352,6 +352,17 @@ tplink,tl-wr842n-v2) trendnet,tew-823dru) ucidef_set_led_netdev "wan" "WAN" "green:planet" "eth0" ;; +ubnt,bullet-ac|\ +ubnt,nanobeam-ac|\ +ubnt,nanobeam-ac-gen2|\ +ubnt,nanostation-ac|\ +ubnt,powerbeam-5ac-gen2) + ucidef_set_rssimon "wlan0" "200000" "1" + ucidef_set_led_rssi "rssilow" "RSSILOW" "blue:rssi0" "wlan0" "1" "100" + ucidef_set_led_rssi "rssimediumlow" "RSSIMEDIUMLOW" "blue:rssi1" "wlan0" "26" "100" + ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" "blue:rssi2" "wlan0" "51" "100" + ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "blue:rssi3" "wlan0" "76" "100" + ;; ubnt,bullet-m-ar7240|\ ubnt,bullet-m-ar7241|\ ubnt,bullet-m-xw|\ @@ -369,16 +380,6 @@ ubnt,rocket-m) ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" "green:link3" "wlan0" "51" "100" ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "green:link4" "wlan0" "76" "100" ;; -ubnt,nanobeam-ac|\ -ubnt,nanobeam-ac-gen2|\ -ubnt,nanostation-ac|\ -ubnt,powerbeam-5ac-gen2) - ucidef_set_rssimon "wlan0" "200000" "1" - ucidef_set_led_rssi "rssilow" "RSSILOW" "blue:rssi0" "wlan0" "1" "100" - ucidef_set_led_rssi "rssimediumlow" "RSSIMEDIUMLOW" "blue:rssi1" "wlan0" "26" "100" - ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" "blue:rssi2" "wlan0" "51" "100" - ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "blue:rssi3" "wlan0" "76" "100" - ;; wallys,dr531) ucidef_set_led_netdev "lan" "LAN" "green:lan" "eth0" ucidef_set_led_switch "wan" "WAN" "green:wan" "switch0" "0x2" diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network index 9336e8dbf2..ec9f0d0218 100755 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -66,6 +66,7 @@ ath79_setup_interfaces() tplink,re450-v2|\ tplink,re450-v3|\ tplink,tl-wr902ac-v1|\ + ubnt,bullet-ac|\ ubnt,bullet-m-ar7240|\ ubnt,bullet-m-ar7241|\ ubnt,bullet-m-xw|\ diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index bd3d80e0fd..67afafdaad 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -28,6 +28,7 @@ case "$FIRMWARE" in qxwlan,e600gac-v2-8m|\ qxwlan,e600gac-v2-16m|\ ubnt,aircube-ac|\ + ubnt,bullet-ac|\ ubnt,unifiac-lite|\ ubnt,unifiac-lr|\ ubnt,unifiac-mesh|\ diff --git a/target/linux/ath79/image/generic-ubnt.mk b/target/linux/ath79/image/generic-ubnt.mk index 710ab54772..91a18d3d35 100644 --- a/target/linux/ath79/image/generic-ubnt.mk +++ b/target/linux/ath79/image/generic-ubnt.mk @@ -67,6 +67,16 @@ define Device/ubnt-sw KERNEL := kernel-bin | append-dtb | relocate-kernel | lzma | uImage lzma endef +define Device/ubnt-2wa + $(Device/ubnt) + SOC := ar9342 + IMAGE_SIZE := 15744k + UBNT_BOARD := WA + UBNT_CHIP := ar934x + UBNT_TYPE := 2WA + UBNT_VERSION := 8.5.3 +endef + define Device/ubnt-wa $(Device/ubnt) SOC := ar9342 @@ -144,6 +154,13 @@ define Device/ubnt_airrouter endef TARGET_DEVICES += ubnt_airrouter +define Device/ubnt_bullet-ac + $(Device/ubnt-2wa) + DEVICE_MODEL := Bullet AC + DEVICE_PACKAGES += kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct rssileds +endef +TARGET_DEVICES += ubnt_bullet-ac + define Device/ubnt_bullet-m-ar7240 $(Device/ubnt-xm) SOC := ar7240 diff --git a/target/linux/bcm27xx/patches-5.4/950-0084-hci_h5-Don-t-send-conf_req-when-ACTIVE.patch b/target/linux/bcm27xx/patches-5.4/950-0084-hci_h5-Don-t-send-conf_req-when-ACTIVE.patch index 87240aa5d8..a800039f88 100644 --- a/target/linux/bcm27xx/patches-5.4/950-0084-hci_h5-Don-t-send-conf_req-when-ACTIVE.patch +++ b/target/linux/bcm27xx/patches-5.4/950-0084-hci_h5-Don-t-send-conf_req-when-ACTIVE.patch @@ -11,7 +11,7 @@ other with conf_req and conf_rsp messages, in a demented game of tag. --- a/drivers/bluetooth/hci_h5.c +++ b/drivers/bluetooth/hci_h5.c -@@ -346,7 +346,8 @@ static void h5_handle_internal_rx(struct +@@ -342,7 +342,8 @@ static void h5_handle_internal_rx(struct h5_link_control(hu, conf_req, 3); } else if (memcmp(data, conf_req, 2) == 0) { h5_link_control(hu, conf_rsp, 2); diff --git a/target/linux/bcm47xx/Makefile b/target/linux/bcm47xx/Makefile index bd0032a0e3..6be852919c 100644 --- a/target/linux/bcm47xx/Makefile +++ b/target/linux/bcm47xx/Makefile @@ -22,7 +22,6 @@ endef include $(INCLUDE_DIR)/target.mk DEFAULT_PACKAGES += swconfig nvram otrx \ - kmod-leds-gpio kmod-gpio-button-hotplug \ - kmod-ledtrig-default-on kmod-ledtrig-timer kmod-ledtrig-netdev + kmod-leds-gpio kmod-gpio-button-hotplug $(eval $(call BuildTarget)) diff --git a/target/linux/bcm4908/Makefile b/target/linux/bcm4908/Makefile new file mode 100644 index 0000000000..d5f82a188e --- /dev/null +++ b/target/linux/bcm4908/Makefile @@ -0,0 +1,23 @@ +# SPDX-License-Identifier: GPL-2.0-only + +include $(TOPDIR)/rules.mk + +ARCH:=aarch64 +BOARD:=bcm4908 +BOARDNAME:=Broadcom BCM4908 (ARMv8A CPUs Brahma-B53) +FEATURES:=squashfs nand usb pci pcie gpio source-only +CPU_TYPE:=cortex-a53 +SUBTARGETS:=generic + +KERNEL_PATCHVER:=5.4 +KERNEL_TESTING_PATCHVER:=5.4 + +define Target/Description + Build firmware images for Broadcom BCM4908 SoC family routers. +endef + +include $(INCLUDE_DIR)/target.mk + +KERNELNAME:=Image dtbs + +$(eval $(call BuildTarget)) diff --git a/target/linux/bcm4908/config-5.4 b/target/linux/bcm4908/config-5.4 new file mode 100644 index 0000000000..9991afda15 --- /dev/null +++ b/target/linux/bcm4908/config-5.4 @@ -0,0 +1,201 @@ +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_ERRATUM_1165522=y +CONFIG_ARM64_ERRATUM_1286807=y +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_ARM64_WORKAROUND_REPEAT_TLBI=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_B53_MDIO_DRIVER is not set +# CONFIG_B53_MMAP_DRIVER is not set +# CONFIG_B53_SERDES is not set +# CONFIG_B53_SRAB_DRIVER is not set +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_CAVIUM_TX2_ERRATUM_219=y +CONFIG_CLKDEV_LOOKUP=y +CONFIG_CLONE_BACKWARDS=y +CONFIG_CMDLINE="earlycon=bcm63xx_uart,0xff800640" +CONFIG_CMDLINE_FORCE=y +CONFIG_COMMON_CLK=y +CONFIG_CPU_RMAP=y +CONFIG_CRYPTO_AEAD=y +CONFIG_CRYPTO_AEAD2=y +CONFIG_CRYPTO_HASH2=y +CONFIG_CRYPTO_MANAGER=y +CONFIG_CRYPTO_MANAGER2=y +CONFIG_CRYPTO_NULL2=y +CONFIG_CRYPTO_RNG2=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_FUJITSU_ERRATUM_010001=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_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=250 +CONFIG_HZ_250=y +CONFIG_HZ_PERIODIC=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_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_NAND_BRCMNAND=y +CONFIG_MTD_NAND_CORE=y +CONFIG_MTD_NAND_ECC_SW_HAMMING=y +CONFIG_MTD_RAW_NAND=y +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_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_RCU_NEED_SEGCBLIST=y +CONFIG_RCU_STALL_COMMON=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_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_UNMAP_KERNEL_AT_EL0=y +CONFIG_USB_SUPPORT=y +CONFIG_VMAP_STACK=y +CONFIG_XPS=y +CONFIG_ZONE_DMA32=y diff --git a/target/linux/bcm4908/generic/target.mk b/target/linux/bcm4908/generic/target.mk new file mode 100644 index 0000000000..f5cb1fb19b --- /dev/null +++ b/target/linux/bcm4908/generic/target.mk @@ -0,0 +1 @@ +BOARDNAME:=Generic diff --git a/target/linux/bcm4908/image/Makefile b/target/linux/bcm4908/image/Makefile new file mode 100644 index 0000000000..f5db38915d --- /dev/null +++ b/target/linux/bcm4908/image/Makefile @@ -0,0 +1,44 @@ +# SPDX-License-Identifier: GPL-2.0-only + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/image.mk + +define Build/bcm4908lzma + $(STAGING_DIR_HOST)/bin/lzma e -lc1 -lp2 -pb2 -d22 $@ $@.new + mv $@.new $@ +endef + +define Build/bcm4908kernel + $(STAGING_DIR_HOST)/bin/bcm4908kernel -i $@ -o $@.new + mv $@.new $@ +endef + +define Device/Default + KERNEL := kernel-bin | bcm4908lzma | bcm4908kernel + KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts) + KERNEL_INITRAMFS_SUFFIX := .bin + KERNEL_INITRAMFS := kernel-bin | bcm4908lzma | bcm4908kernel + FILESYSTEMS := squashfs + KERNEL_NAME := Image + IMAGE_NAME = $$(IMAGE_PREFIX)-$$(1).$$(2) + BLOCKSIZE := 128k + PAGESIZE := 2048 +endef + +define Device/asus_gt-ac5300 + DEVICE_VENDOR := Asus + DEVICE_MODEL := GT-AC5300 + DEVICE_DTS := broadcom/bcm4908/bcm4908-asus-gt-ac5300 + IMAGES := bin +endef +TARGET_DEVICES += asus_gt-ac5300 + +define Device/netgear_r8000p + DEVICE_VENDOR := Netgear + DEVICE_MODEL := R8000P + DEVICE_DTS := broadcom/bcm4908/bcm4906-netgear-r8000p + IMAGES := bin +endef +TARGET_DEVICES += netgear_r8000p + +$(eval $(call BuildImage)) 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 new file mode 100644 index 0000000000..66726cbf0b --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/030-v5.11-0001-dt-bindings-arm-bcm-document-BCM4908-bindings.patch @@ -0,0 +1,60 @@ +From 2f8913a7b17efd3a116825160a2d3a6610444587 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +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 +Signed-off-by: Florian Fainelli +--- + .../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 ++ ++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 new file mode 100644 index 0000000000..3598b5b9c7 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/030-v5.11-0002-arm64-dts-broadcom-add-BCM4908-and-Asus-GT-AC5300-ea.patch @@ -0,0 +1,307 @@ +From 2961f69f151c0a6771f55cef46398fe49ca20902 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +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 +Signed-off-by: Florian Fainelli +--- + 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 ++#include ++ ++#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 = ; ++ gpios = <&gpio0 28 GPIO_ACTIVE_LOW>; ++ }; ++ ++ wps { ++ label = "WPS"; ++ linux,code = ; ++ gpios = <&gpio0 29 GPIO_ACTIVE_LOW>; ++ }; ++ ++ restart { ++ label = "Reset"; ++ linux,code = ; ++ gpios = <&gpio0 30 GPIO_ACTIVE_LOW>; ++ }; ++ ++ brightness { ++ label = "LEDs"; ++ linux,code = ; ++ 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 ++#include ++ ++/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 = , ++ , ++ , ++ ; ++ }; ++ ++ pmu { ++ compatible = "arm,cortex-a53-pmu"; ++ interrupts = , ++ , ++ , ++ ; ++ 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 = ; ++ status = "disabled"; ++ }; ++ ++ usb@c400 { ++ compatible = "generic-ohci"; ++ reg = <0xc400 0x100>; ++ interrupts = ; ++ status = "disabled"; ++ }; ++ ++ usb@d000 { ++ compatible = "generic-xhci"; ++ reg = <0xd000 0x8c8>; ++ interrupts = ; ++ 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 = ; ++ 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 = ; ++ 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 new file mode 100644 index 0000000000..42bdbf51b6 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/030-v5.11-0003-v5.11-arm64-add-config-for-Broadcom-BCM4908-SoCs.patch @@ -0,0 +1,44 @@ +From dccb22d078ebd098115e4f66bde1ee2249c8640b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +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 +Signed-off-by: Florian Fainelli +--- + 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 new file mode 100644 index 0000000000..24a0749c77 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/031-v5.12-0001-dt-bindings-arm-bcm-document-Netgear-R8000P-binding.patch @@ -0,0 +1,28 @@ +From 3a5da4f54801ac42837a0b3151fa8285e01e8b0e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +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 +Acked-by: Rob Herring +Signed-off-by: Florian Fainelli +--- + 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 new file mode 100644 index 0000000000..93fa2150af --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/031-v5.12-0002-arm64-dts-broadcom-bcm4908-add-BCM4906-Netgear-R8000.patch @@ -0,0 +1,104 @@ +From c8b404fb05dcfadff477e49b7ea6b500e015f101 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +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 +Signed-off-by: Florian Fainelli +--- + 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 ++#include ++#include ++ ++#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 = ; ++ 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 = , ++ ; ++ 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 new file mode 100644 index 0000000000..ccd260fadf --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/031-v5.12-0003-arm64-dts-broadcom-bcm4908-use-proper-NAND-binding.patch @@ -0,0 +1,32 @@ +From 56098be85d19cd56b59d7b3854ea035cc8cb9e95 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +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 +Signed-off-by: Florian Fainelli +--- + 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 = ; 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 new file mode 100644 index 0000000000..8ce4d69d8f --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/031-v5.12-0004-arm64-dts-broadcom-bcm4908-describe-PCIe-reset-contr.patch @@ -0,0 +1,41 @@ +From 1b88c6ed26a1aa1d68d1661404e6e939709ff530 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +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 +Signed-off-by: Florian Fainelli +--- + 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/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 new file mode 100644 index 0000000000..1786066a23 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/070-v5.10-0001-net-dsa-b53-Use-dev_-err-info-instead-of-pr_.patch @@ -0,0 +1,50 @@ +From 3b33438c52def0de4a5577ad541e50923bcc2596 Mon Sep 17 00:00:00 2001 +From: Paul Barker +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 +Signed-off-by: David S. Miller +--- + 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 + #include + #include +@@ -2458,8 +2456,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; + } + } +@@ -2489,7 +2488,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 new file mode 100644 index 0000000000..ab00e58c0f --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/070-v5.10-0002-net-dsa-b53-Print-err-message-on-SW_RST-timeout.patch @@ -0,0 +1,30 @@ +From 434d2312cd8057aa6972f2b39aa0b359d02af9f4 Mon Sep 17 00:00:00 2001 +From: Paul Barker +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 +Acked-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + 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 +@@ -740,8 +740,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-0029-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch b/target/linux/bcm4908/patches-5.4/071-v5.12-0029-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch new file mode 100644 index 0000000000..dcf1e62f77 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/071-v5.12-0029-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch @@ -0,0 +1,131 @@ +From 73b7a6047971aa6ce4a70fc4901964d14f077171 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +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 +Acked-by: Florian Fainelli +Link: https://lore.kernel.org/r/20210106213202.17459-3-zajec5@gmail.com +Signed-off-by: Jakub Kicinski +--- + 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 +@@ -2260,6 +2260,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; +@@ -542,7 +543,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); +@@ -984,6 +986,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, +@@ -1032,6 +1058,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/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 new file mode 100644 index 0000000000..8da2fe8cf2 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/080-v5.11-tty-serial-bcm63xx-lower-driver-dependencies.patch @@ -0,0 +1,31 @@ +From f35a07f92616700733636c06dd6e5b6cdc807fe4 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +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 +Link: https://lore.kernel.org/r/20201125090608.28442-1-zajec5@gmail.com +Signed-off-by: Greg Kroah-Hartman +--- + 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 new file mode 100644 index 0000000000..8ccd876619 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/081-v5.12-reset-simple-add-BCM4908-MISC-PCIe-reset-controller-.patch @@ -0,0 +1,40 @@ +From def26913b66fd94e431afecf28e09c08e8c02a35 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +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 +Acked-by: Florian Fainelli +Signed-off-by: Philipp Zabel +--- + 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 new file mode 100644 index 0000000000..c5c1a5dc7e --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/082-v5.12-0001-dt-bindings-power-document-Broadcom-s-PMB-binding.patch @@ -0,0 +1,90 @@ +From 82853543057f78d8a331272b70bc3f1e8cb0cbf4 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +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 +Reviewed-by: Rob Herring +Acked-by: Florian Fainelli +Acked-by: Ulf Hansson +Signed-off-by: Florian Fainelli +--- + .../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 ++ ++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 ++ ++ 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 new file mode 100644 index 0000000000..e462174ca6 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/082-v5.12-0002-soc-bcm-add-PM-driver-for-Broadcom-s-PMB.patch @@ -0,0 +1,406 @@ +From 8bcac4011ebe0dbdd46fd55b036ee855c95702d3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +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 +Acked-by: Ulf Hansson +Signed-off-by: Florian Fainelli +--- + 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 +@@ -3405,6 +3405,16 @@ L: linux-mips@vger.kernel.org + S: Maintained + F: drivers/firmware/broadcom/* + ++BROADCOM PMB (POWER MANAGEMENT BUS) DRIVER ++M: Rafał Miłecki ++M: Florian Fainelli ++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 + 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 ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#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 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 new file mode 100644 index 0000000000..90f6224386 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/083-v5.5-0001-phy-phy-brcm-usb-init-fix-__iomem-annotations.patch @@ -0,0 +1,286 @@ +From e4b957d3a7c74749e2ccfb3dedb63b81e84b292c Mon Sep 17 00:00:00 2001 +From: Ben Dooks +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 '' 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] *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 '' 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] *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 '' 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] *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 '' 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] *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 '' 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] *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 '' 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] *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 '' 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] *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 '' 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] *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 '' 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] *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 '' 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] *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 '' 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] *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 '' 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] *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 '' 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] *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] * +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] *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] *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 '' 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] *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 '' 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] *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 '' 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] *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 '' 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] *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 '' 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] *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] * +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] *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] *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] * +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] *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] *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] * +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] *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] *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] * +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] *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] *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] * +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] *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] *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] * +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] *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] *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 '' 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] *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 '' 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] *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 '' 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] *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 '' 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] *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 '' 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] *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] * +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] *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] *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] * +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] *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] *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] * +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] *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] *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 '' 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] *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 '' 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] *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 '' 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] *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 '' 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] *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 '' 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] *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] * +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] *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] *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] * +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] *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] *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] * +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] *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] *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] * +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] *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] *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 +Signed-off-by: Kishon Vijay Abraham I +--- + 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 new file mode 100644 index 0000000000..9252c35fb9 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/083-v5.5-0002-phy-phy-brcm-usb-init-fix-use-of-integer-as-pointer.patch @@ -0,0 +1,26 @@ +From 1025cb924bd517f3c458f36973582d4c2adedd6a Mon Sep 17 00:00:00 2001 +From: Ben Dooks +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 +Reviewed-by: Andrew Murray +Signed-off-by: Kishon Vijay Abraham I +--- + 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 new file mode 100644 index 0000000000..ac368d5dd1 --- /dev/null +++ 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 @@ -0,0 +1,61 @@ +From dc9aa43c43668481089c48135707ec3f8f5b2e19 Mon Sep 17 00:00:00 2001 +From: Al Cooper +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 +Reviewed-by: Florian Fainelli +Signed-off-by: Kishon Vijay Abraham I +--- + 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 new file mode 100644 index 0000000000..e269f80cf4 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/084-v5.6-0002-phy-usb-Get-all-drivers-that-use-USB-clks-using-corr.patch @@ -0,0 +1,102 @@ +From ece5ffd9e15e9c8471e58b581a098032a679d34e Mon Sep 17 00:00:00 2001 +From: Al Cooper +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 +Reviewed-by: Florian Fainelli +Signed-off-by: Kishon Vijay Abraham I +--- + 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 new file mode 100644 index 0000000000..356e305460 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/084-v5.6-0003-phy-usb-Put-USB-phys-into-IDDQ-on-suspend-to-save-po.patch @@ -0,0 +1,51 @@ +From 6597af4e4835ec0709638d48f73c11b5c624790f Mon Sep 17 00:00:00 2001 +From: Al Cooper +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 +Reviewed-by: Florian Fainelli +Signed-off-by: Kishon Vijay Abraham I +--- + 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 new file mode 100644 index 0000000000..d52edfef77 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/084-v5.6-0004-phy-usb-Add-wake-on-functionality.patch @@ -0,0 +1,205 @@ +From f1c0db40a3ade1f1a39e5794d728f2953d817322 Mon Sep 17 00:00:00 2001 +From: Al Cooper +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 +Reviewed-by: Florian Fainelli +Signed-off-by: Kishon Vijay Abraham I +--- + 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 new file mode 100644 index 0000000000..2a63556122 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/084-v5.6-0005-phy-usb-Restructure-in-preparation-for-adding-7216-U.patch @@ -0,0 +1,611 @@ +From 94583a41047eb9489f576344b8ba9370cf4cbfb7 Mon Sep 17 00:00:00 2001 +From: Al Cooper +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 +Reviewed-by: Florian Fainelli +Signed-off-by: Kishon Vijay Abraham I +--- + 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 new file mode 100644 index 0000000000..2a57d1dc80 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/084-v5.6-0006-dt-bindings-Add-Broadcom-STB-USB-PHY-binding-documen.patch @@ -0,0 +1,108 @@ +From b11df0c9efbbe2b52c5133ca15030f01b43ec6ef Mon Sep 17 00:00:00 2001 +From: Al Cooper +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 +Reviewed-by: Rob Herring +Reviewed-by: Florian Fainelli +Signed-off-by: Kishon Vijay Abraham I +--- + .../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 new file mode 100644 index 0000000000..11cc080c23 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/084-v5.6-0007-phy-usb-Add-support-for-new-Synopsys-USB-controller-.patch @@ -0,0 +1,358 @@ +From 4e5b9c9a73b32d28759225a40d30848393a8f1fd Mon Sep 17 00:00:00 2001 +From: Al Cooper +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 +Reviewed-by: Florian Fainelli +Signed-off-by: Kishon Vijay Abraham I +--- + 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 ++#include ++ ++#include ++#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 new file mode 100644 index 0000000000..008108c589 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/084-v5.6-0008-phy-usb-Add-support-for-new-Synopsys-USB-controller-.patch @@ -0,0 +1,680 @@ +From 9d5f51dcdb646c2ed21649d379fbb703994f1ec9 Mon Sep 17 00:00:00 2001 +From: Al Cooper +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 +Reviewed-by: Florian Fainelli +Signed-off-by: Kishon Vijay Abraham I +--- + .../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 + #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 ++ + #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 + #include + #include ++#include + + #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 new file mode 100644 index 0000000000..a9e4b60ea6 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/084-v5.6-0009-phy-usb-fix-driver-to-defer-on-clk_get-defer.patch @@ -0,0 +1,44 @@ +From 89927fe0061aaa69b39e95ed793d2c61903b7895 Mon Sep 17 00:00:00 2001 +From: Al Cooper +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 +Reviewed-by: Florian Fainelli +Signed-off-by: Kishon Vijay Abraham I +--- + 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 new file mode 100644 index 0000000000..48f829f799 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/084-v5.6-0010-phy-usb-PHY-s-MDIO-registers-not-accessible-without-.patch @@ -0,0 +1,44 @@ +From fc430aea02068150d053ef24bc424db3dd1357d4 Mon Sep 17 00:00:00 2001 +From: Al Cooper +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 +Reviewed-by: Florian Fainelli +Signed-off-by: Kishon Vijay Abraham I +--- + 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 new file mode 100644 index 0000000000..80ec141685 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/084-v5.6-0011-phy-usb-bdc-Fix-occasional-failure-with-BDC-on-7211.patch @@ -0,0 +1,135 @@ +From bed63b636fedf47dbab899a5193ec5ec4539f6fc Mon Sep 17 00:00:00 2001 +From: Al Cooper +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 +Reviewed-by: Florian Fainelli +Signed-off-by: Kishon Vijay Abraham I +--- + .../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 new file mode 100644 index 0000000000..b10f86d0a3 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/084-v5.6-0012-phy-usb-USB-driver-is-crashing-during-S3-resume-on-7.patch @@ -0,0 +1,26 @@ +From 5dfe1cec580829faa49842672a25481b104c26ef Mon Sep 17 00:00:00 2001 +From: Al Cooper +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 +Reviewed-by: Florian Fainelli +Signed-off-by: Kishon Vijay Abraham I +--- + 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 new file mode 100644 index 0000000000..5a3a687adb --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/084-v5.6-0013-phy-usb-Add-support-for-wake-and-USB-low-power-mode-.patch @@ -0,0 +1,328 @@ +From b0c0b66c0b432d3f3a1ae5849298ba9c7f1810c5 Mon Sep 17 00:00:00 2001 +From: Al Cooper +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 +Reviewed-by: Florian Fainelli +Signed-off-by: Kishon Vijay Abraham I +--- + .../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 new file mode 100644 index 0000000000..36683fc437 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/085-v5.8-0001-phy-phy-brcm-usb-Constify-static-structs.patch @@ -0,0 +1,99 @@ +From c79cc3d55c4bf94e9028d6818d449fbdc488eac5 Mon Sep 17 00:00:00 2001 +From: Rikard Falkeborn +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 +Link: https://lore.kernel.org/r/20200516120441.7627-4-rikard.falkeborn@gmail.com +Signed-off-by: Kishon Vijay Abraham I +--- + 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 new file mode 100644 index 0000000000..cc71373165 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/086-v5.12-0001-phy-phy-brcm-usb-improve-getting-OF-matching-data.patch @@ -0,0 +1,49 @@ +From d14f4cce9340a6586512a0eb6bc680dedeaaef14 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +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 +Acked-by: Florian Fainelli +Link: https://lore.kernel.org/r/20201216143305.12179-1-zajec5@gmail.com +Signed-off-by: Vinod Koul +--- + 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 + #include + #include ++#include + #include + #include + #include +@@ -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 new file mode 100644 index 0000000000..bdc932732c --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/086-v5.12-0002-phy-phy-brcm-usb-specify-init-function-format-at-str.patch @@ -0,0 +1,50 @@ +From 915f1d230e5292bc2156a9997bcb19d9e632f10b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +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 +Acked-by: Florian Fainelli +Link: https://lore.kernel.org/r/20201216143305.12179-2-zajec5@gmail.com +Signed-off-by: Vinod Koul +--- + 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 new file mode 100644 index 0000000000..1edd63ea5d --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/086-v5.12-0003-dt-bindings-phy-brcm-brcmstb-usb-phy-convert-to-the-.patch @@ -0,0 +1,315 @@ +From b39069a482ade0c5e18c407c3218ba1aeed371b6 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +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 +Reviewed-by: Florian Fainelli +Reviewed-by: Rob Herring +Link: https://lore.kernel.org/r/20210106205838.10964-1-zajec5@gmail.com +Signed-off-by: Vinod Koul +--- + .../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 ++ - Rafał Miłecki ++ ++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 ++ ++ 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 ++ ++ 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 new file mode 100644 index 0000000000..6127800a43 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/086-v5.12-0004-dt-bindings-phy-brcm-brcmstb-usb-phy-add-BCM4908-bin.patch @@ -0,0 +1,41 @@ +From 46b616c1574def7a1629bdeded3d44e76382f950 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +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 +Acked-by: Florian Fainelli +Acked-by: Rob Herring +Link: https://lore.kernel.org/r/20210106205838.10964-2-zajec5@gmail.com +Signed-off-by: Vinod Koul +--- + .../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 new file mode 100644 index 0000000000..c021201f6b --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/086-v5.12-0005-phy-phy-brcm-usb-support-PHY-on-the-BCM4908.patch @@ -0,0 +1,48 @@ +From 4b402fa8e0b7817f3e3738d7828038f114e6899e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +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 +Acked-by: Florian Fainelli +Link: https://lore.kernel.org/r/20210106205838.10964-3-zajec5@gmail.com +Signed-off-by: Vinod Koul +--- + 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/130-arm64-dts-broadcom-bcm4908-describe-internal-switch.patch b/target/linux/bcm4908/patches-5.4/130-arm64-dts-broadcom-bcm4908-describe-internal-switch.patch new file mode 100644 index 0000000000..d039e04172 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/130-arm64-dts-broadcom-bcm4908-describe-internal-switch.patch @@ -0,0 +1,183 @@ +From 12cda92893ea57cdd84a8ccfcc05946d7f3a1cd7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 12 Jan 2021 12:56:58 +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 +--- + .../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 */ ++ phy@0 { ++ reg = <0>; ++ }; ++ ++ /* lan7 */ ++ phy@1 { ++ reg = <1>; ++ }; ++ ++ /* lan4 */ ++ phy@2 { ++ reg = <2>; ++ }; ++ ++ /* lan3 */ ++ 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 = ; + status = "disabled"; + }; ++ ++ switch@80000 { ++ compatible = "simple-mfd"; ++ #size-cells = <1>; ++ #address-cells = <1>; ++ ranges = <0 0x80000 0x50000>; ++ ++ 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 = , ++ ; ++ 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 = <1>; ++ #address-cells = <0>; ++ ++ phy8: phy@8 { ++ reg = <8>; ++ }; ++ ++ phy9: phy@9 { ++ reg = <9>; ++ }; ++ ++ phy10: phy@a { ++ reg = <10>; ++ }; ++ ++ phy11: phy@b { ++ reg = <11>; ++ }; ++ ++ phy12: phy@c { ++ reg = <12>; ++ }; ++ }; ++ }; + }; + + bus@ff800000 { diff --git a/target/linux/bcm4908/patches-5.4/131-arm64-dts-broadcom-bcm4908-describe-PMB-block.patch b/target/linux/bcm4908/patches-5.4/131-arm64-dts-broadcom-bcm4908-describe-PMB-block.patch new file mode 100644 index 0000000000..5b0ae7af1c --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/131-arm64-dts-broadcom-bcm4908-describe-PMB-block.patch @@ -0,0 +1,53 @@ +From 11a7fb140af5cfa706a8d9c0a309247f020a8d0c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Mon, 11 Jan 2021 08:15:35 +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 +--- +Florian: this patch is based on top of the +[PATCH] arm64: dts: broadcom: bcm4908: describe internal switch +one. Both modify "ranges". +--- + .../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-mfd"; ++ 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/180-soc-brcmstb-add-stubs-for-getting-platform-IDs.patch b/target/linux/bcm4908/patches-5.4/180-soc-brcmstb-add-stubs-for-getting-platform-IDs.patch new file mode 100644 index 0000000000..366e6089c4 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/180-soc-brcmstb-add-stubs-for-getting-platform-IDs.patch @@ -0,0 +1,50 @@ +From c149974b2ae2e2296c66262a4ee797c06c39982b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Thu, 14 Jan 2021 11:33:01 +0100 +Subject: [PATCH] soc: brcmstb: add stubs for getting platform IDs + +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. +--- + 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 +@@ -12,6 +12,8 @@ static inline u32 BRCM_REV(u32 reg) + return reg & 0xff; + } + ++#ifdef CONFIG_SOC_BRCMSTB ++ + /* + * Helper functions for getting family or product id from the + * SoC driver. +@@ -19,4 +21,18 @@ 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/800-phy-phy-brcm-usb-select-SOC_BRCMSTB-on-brcmstb-only.patch b/target/linux/bcm4908/patches-5.4/800-phy-phy-brcm-usb-select-SOC_BRCMSTB-on-brcmstb-only.patch new file mode 100644 index 0000000000..965d60c18e --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/800-phy-phy-brcm-usb-select-SOC_BRCMSTB-on-brcmstb-only.patch @@ -0,0 +1,26 @@ +From 73f63c66bf80bebd46d38a2660078dbe3fe11170 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Thu, 14 Jan 2021 12:02:28 +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 + +BCM4908 doesn't need brcmstb SoC stuff compiled. + +Signed-off-by: Rafał Miłecki +--- + 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/bcm53xx/Makefile b/target/linux/bcm53xx/Makefile index 26ab94edd1..16fe4f31c8 100644 --- a/target/linux/bcm53xx/Makefile +++ b/target/linux/bcm53xx/Makefile @@ -27,7 +27,6 @@ KERNELNAME:=zImage dtbs DEFAULT_PACKAGES += swconfig nvram \ osafeloader oseama otrx \ kmod-gpio-button-hotplug \ - kmod-leds-gpio kmod-ledtrig-default-on kmod-ledtrig-timer \ - autocore-arm + kmod-leds-gpio autocore-arm $(eval $(call BuildTarget)) diff --git a/target/linux/gemini/Makefile b/target/linux/gemini/Makefile index 0835adc41d..d30b8d3ac8 100644 --- a/target/linux/gemini/Makefile +++ b/target/linux/gemini/Makefile @@ -25,7 +25,7 @@ include $(INCLUDE_DIR)/target.mk DEFAULT_PACKAGES += \ kmod-usb-fotg210 \ kmod-usb-ledtrig-usbport \ - kmod-leds-gpio kmod-ledtrig-heartbeat \ + kmod-leds-gpio \ kmod-gpio-button-hotplug $(eval $(call BuildTarget)) diff --git a/target/linux/generic/config-5.4 b/target/linux/generic/config-5.4 index d51155b77c..e5e4506987 100644 --- a/target/linux/generic/config-5.4 +++ b/target/linux/generic/config-5.4 @@ -2400,7 +2400,6 @@ CONFIG_IPV6_NDISC_NODETYPE=y # CONFIG_IPV6_ROUTER_PREF is not set # CONFIG_IPV6_ROUTE_INFO is not set # CONFIG_IPV6_SEG6_HMAC is not set -# CONFIG_IPV6_SEG6_LWTUNNEL is not set # CONFIG_IPV6_SIT is not set # CONFIG_IPV6_SIT_6RD is not set # CONFIG_IPV6_TUNNEL is not set @@ -2692,7 +2691,7 @@ CONFIG_LEDS_TRIGGERS=y CONFIG_LEDS_TRIGGER_DEFAULT_ON=y # CONFIG_LEDS_TRIGGER_DISK is not set # CONFIG_LEDS_TRIGGER_GPIO is not set -# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set +CONFIG_LEDS_TRIGGER_HEARTBEAT=y # CONFIG_LEDS_TRIGGER_MTD is not set CONFIG_LEDS_TRIGGER_NETDEV=y # CONFIG_LEDS_TRIGGER_ONESHOT is not set @@ -3674,6 +3673,7 @@ CONFIG_NF_CONNTRACK_PROCFS=y # CONFIG_NF_CONNTRACK_ZONES is not set # CONFIG_NF_CT_NETLINK is not set # CONFIG_NF_CT_NETLINK_TIMEOUT is not set +# CONFIG_NF_CT_NETLINK_HELPER is not set # CONFIG_NF_CT_PROTO_DCCP is not set # CONFIG_NF_CT_PROTO_GRE is not set # CONFIG_NF_CT_PROTO_SCTP is not set diff --git a/target/linux/generic/hack-5.4/904-debloat_dma_buf.patch b/target/linux/generic/hack-5.4/904-debloat_dma_buf.patch index a5713a67e7..7c67478fc0 100644 --- a/target/linux/generic/hack-5.4/904-debloat_dma_buf.patch +++ b/target/linux/generic/hack-5.4/904-debloat_dma_buf.patch @@ -45,7 +45,7 @@ Signed-off-by: Felix Fietkau selftest.o \ --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c -@@ -1300,4 +1300,5 @@ static void __exit dma_buf_deinit(void) +@@ -1313,4 +1313,5 @@ static void __exit dma_buf_deinit(void) dma_buf_uninit_debugfs(); kern_unmount(dma_buf_mnt); } diff --git a/target/linux/generic/hack-5.4/999-thermal-tristate.patch b/target/linux/generic/hack-5.4/999-thermal-tristate.patch deleted file mode 100644 index 1d40613b90..0000000000 --- a/target/linux/generic/hack-5.4/999-thermal-tristate.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/drivers/thermal/Kconfig -+++ b/drivers/thermal/Kconfig -@@ -4,7 +4,7 @@ - # - - menuconfig THERMAL -- bool "Generic Thermal sysfs driver" -+ tristate "Generic Thermal sysfs driver" - help - Generic Thermal Sysfs driver offers a generic mechanism for - thermal management. Usually it's made up of one or more thermal diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-ap-303.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-ap-303.dts index a3cecddd6e..13f89d810c 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-ap-303.dts +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-ap-303.dts @@ -145,10 +145,8 @@ }; partition@380000 { - /* This is empty */ label = "appsblenv"; reg = <0x380000 0x10000>; - read-only; }; partition@390000 { diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-ap-365.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-ap-365.dts index 1d4e50292e..988a4421b5 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-ap-365.dts +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-ap-365.dts @@ -138,7 +138,6 @@ partition@e0000 { label = "u-boot-env"; reg = <0xe0000 0x10000>; - read-only; }; partition@f0000 { diff --git a/target/linux/ipq40xx/image/Makefile b/target/linux/ipq40xx/image/Makefile index 53e5ed3472..079b0ec5dd 100644 --- a/target/linux/ipq40xx/image/Makefile +++ b/target/linux/ipq40xx/image/Makefile @@ -156,6 +156,7 @@ endef define Device/aruba_ap-303 $(call Device/aruba_glenmorangie) DEVICE_MODEL := AP-303 + DEVICE_PACKAGES += uboot-envtools endef TARGET_DEVICES += aruba_ap-303 @@ -168,7 +169,7 @@ TARGET_DEVICES += aruba_ap-303h define Device/aruba_ap-365 $(call Device/aruba_glenmorangie) DEVICE_MODEL := AP-365 - DEVICE_PACKAGES += kmod-hwmon-ad7418 + DEVICE_PACKAGES += kmod-hwmon-ad7418 uboot-envtools endef TARGET_DEVICES += aruba_ap-365 diff --git a/target/linux/ipq806x/base-files/etc/board.d/02_network b/target/linux/ipq806x/base-files/etc/board.d/02_network index fbf56c5e0c..ddef4b7ac6 100755 --- a/target/linux/ipq806x/base-files/etc/board.d/02_network +++ b/target/linux/ipq806x/base-files/etc/board.d/02_network @@ -66,6 +66,9 @@ qcom,ipq8064-db149) ucidef_add_switch "switch0" \ "1:lan" "2:lan" "3:lan" "4:lan" "6u@eth1" "5:wan" "0u@eth0" ;; +ubnt,unifi-ac-hd) + ucidef_set_interface_lan "eth0 eth1" + ;; zyxel,nbg6817) hw_mac_addr=$(mtd_get_mac_ascii 0:APPSBLENV ethaddr) ucidef_add_switch "switch0" \ diff --git a/target/linux/ipq806x/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ipq806x/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac index f0256fd259..5af3a5b805 100644 --- a/target/linux/ipq806x/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac +++ b/target/linux/ipq806x/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac @@ -9,6 +9,14 @@ PHYNBR=${DEVPATH##*/phy} . /lib/functions.sh . /lib/functions/system.sh +board=$(board_name) + +case "$board" in + ubnt,unifi-ac-hd) + macaddr_add $(mtd_get_mac_binary EEPROM 0x6) $(($PHYNBR + 1)) > /sys${DEVPATH}/macaddress + ;; +esac + OPATH=${DEVPATH##/devices/platform/} OPATH=${OPATH%%/ieee*} diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-unifi-ac-hd.dts b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-unifi-ac-hd.dts new file mode 100644 index 0000000000..7c2d6c9d13 --- /dev/null +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-unifi-ac-hd.dts @@ -0,0 +1,300 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qcom-ipq8064-v2.0.dtsi" + +#include +#include + +/ { + model = "Ubiquiti UniFi AC HD"; + compatible = "ubnt,unifi-ac-hd", "qcom,ipq8064"; + + aliases { + label-mac-device = &gmac2; + led-boot = &led_dome_white; + led-failsafe = &led_dome_white; + led-running = &led_dome_blue; + led-upgrade = &led_dome_blue; + mdio-gpio0 = &mdio0; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-0 = <&led_pins>; + pinctrl-names = "default"; + + led_dome_blue: dome_blue { + label = "blue:dome"; + gpios = <&qcom_pinmux 9 GPIO_ACTIVE_HIGH>; + }; + + led_dome_white: dome_white { + label = "white:dome"; + gpios = <&qcom_pinmux 53 GPIO_ACTIVE_HIGH>; + }; + }; + + keys { + compatible = "gpio-keys"; + pinctrl-0 = <&button_pins>; + pinctrl-names = "default"; + + reset { + label = "reset"; + gpios = <&qcom_pinmux 68 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + }; +}; + +&qcom_pinmux { + button_pins: button_pins { + mux { + pins = "gpio68"; + function = "gpio"; + drive-strength = <2>; + bias-pull-up; + }; + }; + + led_pins: led_pins { + mux { + pins = "gpio9", "gpio53"; + function = "gpio"; + drive-strength = <2>; + bias-pull-down; + output-low; + }; + }; + + spi_pins: spi_pins { + mux { + pins = "gpio18", "gpio19", "gpio21"; + function = "gsbi5"; + drive-strength = <10>; + bias-none; + }; + + cs { + pins = "gpio20"; + drive-strength = <12>; + }; + }; +}; + +&CPU_SPC { + status = "disabled"; +}; + +&gsbi5 { + status = "okay"; + + qcom,mode = ; + + spi@1a280000 { + status = "okay"; + + pinctrl-0 = <&spi_pins>; + pinctrl-names = "default"; + cs-gpios = <&qcom_pinmux 20 0>; + + flash@0 { + compatible = "mx25u25635f", "jedec,spi-nor"; + #address-cells = <1>; + #size-cells = <1>; + spi-max-frequency = <50000000>; + reg = <0>; + m25p,fast-read; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "SBL1"; + reg = <0x0 0x20000>; + read-only; + }; + + partition@20000 { + label = "MIBIB"; + reg = <0x20000 0x10000>; + read-only; + }; + + partition@30000 { + label = "SBL2"; + reg = <0x30000 0x20000>; + read-only; + }; + + partition@50000 { + label = "SBL3"; + reg = <0x50000 0x30000>; + read-only; + }; + + partition@80000 { + label = "DDRCONFIG"; + reg = <0x80000 0x10000>; + read-only; + }; + + partition@90000 { + label = "SSD"; + reg = <0x90000 0x10000>; + read-only; + }; + + partition@a0000 { + label = "TZ"; + reg = <0xa0000 0x30000>; + read-only; + }; + + partition@d0000 { + label = "RPM"; + reg = <0xd0000 0x20000>; + read-only; + }; + + partition@f0000 { + label = "APPSBL"; + reg = <0xf0000 0xc0000>; + read-only; + }; + + partition@1b0000 { + label = "APPSBLENV"; + reg = <0x1b0000 0x10000>; + read-only; + }; + + eeprom: partition@1c0000 { + label = "EEPROM"; + reg = <0x1c0000 0x10000>; + read-only; + }; + + partition@1d0000 { + label = "bootselect"; + reg = <0x1d0000 0x10000>; + }; + + partition@1e0000 { + compatible = "denx,fit"; + label = "firmware"; + reg = <0x1e0000 0xe70000>; + }; + + partition@1050000 { + label = "kernel1"; + reg = <0x1050000 0xe70000>; + read-only; + }; + + partition@1ec0000 { + label = "debug"; + reg = <0x1ec0000 0x100000>; + read-only; + }; + + partition@1fc0000 { + label = "cfg"; + reg = <0x1fc0000 0x40000>; + read-only; + }; + }; + }; + }; +}; + +&adm_dma { + status = "okay"; +}; + +&nand_controller { + status = "okay"; + + pinctrl-0 = <&nand_pins>; + pinctrl-names = "default"; + nand-ecc-strength = <4>; + nand-bus-width = <8>; +}; + +&mdio0 { + status = "okay"; + + pinctrl-0 = <&mdio0_pins>; + pinctrl-names = "default"; +}; + +&gmac2 { + status = "okay"; + + phy-mode = "sgmii"; + qcom,id = <2>; + qcom,emulation = <0>; + mdiobus = <&mdio0>; + + mtd-mac-address = <&eeprom 0x0>; + + fixed-link { + speed = <1000>; + full-duplex; + }; +}; + +&gmac1 { + status = "okay"; + + phy-mode = "sgmii"; + qcom,id = <1>; + qcom,emulation = <0>; + mdiobus = <&mdio0>; + + mtd-mac-address = <&eeprom 0x6>; + + fixed-link { + speed = <1000>; + full-duplex; + }; +}; + +&pcie0 { + status = "okay"; +}; + +&pcie1 { + status = "okay"; +}; + +&tcsr { + status = "okay"; +}; + +&hs_phy_0 { + status = "okay"; +}; + +&ss_phy_0 { + status = "okay"; +}; + +&usb3_0 { + status = "okay"; +}; + +&hs_phy_1 { + status = "okay"; +}; + +&ss_phy_1 { + status = "okay"; +}; + +&usb3_1 { + status = "okay"; +}; diff --git a/target/linux/ipq806x/image/Makefile b/target/linux/ipq806x/image/Makefile index b77c0a99c0..bc917d4fa4 100644 --- a/target/linux/ipq806x/image/Makefile +++ b/target/linux/ipq806x/image/Makefile @@ -382,6 +382,18 @@ define Device/tplink_vr2600v endef TARGET_DEVICES += tplink_vr2600v +define Device/ubnt_unifi-ac-hd + $(call Device/FitImageLzma) + DEVICE_VENDOR := Ubiquiti + DEVICE_MODEL := UniFi AC HD + SOC := qcom-ipq8064 + BLOCKSIZE := 64k + IMAGE_SIZE := 14784k + DEVICE_PACKAGES := ath10k-firmware-qca9984-ct + IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | append-metadata | check-size +endef +TARGET_DEVICES += ubnt_unifi-ac-hd + define Device/zyxel_nbg6817 DEVICE_VENDOR := ZyXEL DEVICE_MODEL := NBG6817 diff --git a/target/linux/ipq806x/patches-5.4/0069-arm-boot-add-dts-files.patch b/target/linux/ipq806x/patches-5.4/0069-arm-boot-add-dts-files.patch index a5fce41112..055a4cbc30 100644 --- a/target/linux/ipq806x/patches-5.4/0069-arm-boot-add-dts-files.patch +++ b/target/linux/ipq806x/patches-5.4/0069-arm-boot-add-dts-files.patch @@ -10,7 +10,7 @@ Signed-off-by: John Crispin --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile -@@ -842,7 +842,23 @@ dtb-$(CONFIG_ARCH_QCOM) += \ +@@ -842,7 +842,24 @@ dtb-$(CONFIG_ARCH_QCOM) += \ qcom-ipq4019-ap.dk04.1-c3.dtb \ qcom-ipq4019-ap.dk07.1-c1.dtb \ qcom-ipq4019-ap.dk07.1-c2.dtb \ @@ -25,6 +25,7 @@ Signed-off-by: John Crispin + qcom-ipq8064-g10.dtb \ + qcom-ipq8064-r7500.dtb \ + qcom-ipq8064-r7500v2.dtb \ ++ qcom-ipq8064-unifi-ac-hd.dtb \ + qcom-ipq8064-wg2600hp.dtb \ + qcom-ipq8064-wpq864.dtb \ + qcom-ipq8064-wxr-2533dhp.dtb \ diff --git a/target/linux/lantiq/ase/config-5.4 b/target/linux/lantiq/ase/config-5.4 index 01f6799b32..9e4d047059 100644 --- a/target/linux/lantiq/ase/config-5.4 +++ b/target/linux/lantiq/ase/config-5.4 @@ -12,7 +12,6 @@ CONFIG_GPIO_GENERIC=y CONFIG_GPIO_GENERIC_PLATFORM=y # CONFIG_ISDN is not set CONFIG_LANTIQ_ETOP=y -CONFIG_LEDS_TRIGGER_HEARTBEAT=y CONFIG_NLS=y CONFIG_SGL_ALLOC=y CONFIG_SOC_AMAZON_SE=y diff --git a/target/linux/lantiq/falcon/target.mk b/target/linux/lantiq/falcon/target.mk index c07c8c2d82..4051b5ada4 100644 --- a/target/linux/lantiq/falcon/target.mk +++ b/target/linux/lantiq/falcon/target.mk @@ -5,8 +5,7 @@ FEATURES+=nand source-only CPU_TYPE:=24kc DEFAULT_PACKAGES+= kmod-leds-gpio \ - kmod-gpio-button-hotplug \ - kmod-ledtrig-heartbeat + kmod-gpio-button-hotplug define Target/Description Lantiq Falcon diff --git a/target/linux/lantiq/xrx200/config-5.4 b/target/linux/lantiq/xrx200/config-5.4 index 45406cf9de..fc857fe72a 100644 --- a/target/linux/lantiq/xrx200/config-5.4 +++ b/target/linux/lantiq/xrx200/config-5.4 @@ -26,7 +26,6 @@ CONFIG_INPUT_POLLDEV=y CONFIG_INTEL_XWAY_PHY=y # CONFIG_ISDN is not set CONFIG_LANTIQ_XRX200_LEGACY=y -CONFIG_LEDS_TRIGGER_HEARTBEAT=y CONFIG_LZO_COMPRESS=y CONFIG_LZO_DECOMPRESS=y CONFIG_MIPS_MT=y diff --git a/target/linux/lantiq/xway_legacy/config-5.4 b/target/linux/lantiq/xway_legacy/config-5.4 index 91dbebbe9d..4930762160 100644 --- a/target/linux/lantiq/xway_legacy/config-5.4 +++ b/target/linux/lantiq/xway_legacy/config-5.4 @@ -13,8 +13,6 @@ CONFIG_INPUT_EVDEV=y CONFIG_INPUT_POLLDEV=y # CONFIG_ISDN is not set CONFIG_LANTIQ_ETOP=y -CONFIG_LEDS_TRIGGER_HEARTBEAT=y -# CONFIG_LEDS_TRIGGER_TIMER is not set CONFIG_LZO_COMPRESS=y CONFIG_LZO_DECOMPRESS=y CONFIG_NLS=y diff --git a/target/linux/layerscape/patches-5.4/820-usb-0005-usb-dwc3-add-otg-properties-update.patch b/target/linux/layerscape/patches-5.4/820-usb-0005-usb-dwc3-add-otg-properties-update.patch index 95f8af1eea..22d8f2bace 100644 --- a/target/linux/layerscape/patches-5.4/820-usb-0005-usb-dwc3-add-otg-properties-update.patch +++ b/target/linux/layerscape/patches-5.4/820-usb-0005-usb-dwc3-add-otg-properties-update.patch @@ -36,7 +36,7 @@ Signed-off-by: Peter Chen dwc->sysdev_is_parent = device_property_read_bool(dev, --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h -@@ -954,6 +954,7 @@ struct dwc3_scratchpad_array { +@@ -955,6 +955,7 @@ struct dwc3_scratchpad_array { * @nr_scratch: number of scratch buffers * @u1u2: only used on revisions <1.83a for workaround * @maximum_speed: maximum speed requested (mainly for testing purposes) @@ -44,7 +44,7 @@ Signed-off-by: Peter Chen * @revision: revision register contents * @version_type: VERSIONTYPE register contents, a sub release of a revision * @dr_mode: requested mode of operation -@@ -1110,6 +1111,7 @@ struct dwc3 { +@@ -1111,6 +1112,7 @@ struct dwc3 { u32 nr_scratch; u32 u1u2; u32 maximum_speed; diff --git a/target/linux/layerscape/patches-5.4/820-usb-0006-usb-dwc3-drd-add-usb-role-switch-class-support-for-d.patch b/target/linux/layerscape/patches-5.4/820-usb-0006-usb-dwc3-drd-add-usb-role-switch-class-support-for-d.patch index b8f0c6a2cc..4e6f128695 100644 --- a/target/linux/layerscape/patches-5.4/820-usb-0006-usb-dwc3-drd-add-usb-role-switch-class-support-for-d.patch +++ b/target/linux/layerscape/patches-5.4/820-usb-0006-usb-dwc3-drd-add-usb-role-switch-class-support-for-d.patch @@ -23,7 +23,7 @@ Signed-off-by: Li Jun #include #include -@@ -1095,6 +1096,7 @@ struct dwc3 { +@@ -1096,6 +1097,7 @@ struct dwc3 { void __iomem *regs; size_t regs_size; diff --git a/target/linux/layerscape/patches-5.4/820-usb-0009-usb-dwc3-Add-workaround-for-host-mode-VBUS-glitch-wh.patch b/target/linux/layerscape/patches-5.4/820-usb-0009-usb-dwc3-Add-workaround-for-host-mode-VBUS-glitch-wh.patch index a8d23623be..82e2a25e2d 100644 --- a/target/linux/layerscape/patches-5.4/820-usb-0009-usb-dwc3-Add-workaround-for-host-mode-VBUS-glitch-wh.patch +++ b/target/linux/layerscape/patches-5.4/820-usb-0009-usb-dwc3-Add-workaround-for-host-mode-VBUS-glitch-wh.patch @@ -44,7 +44,7 @@ Reviewed-by: Peter Chen --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h -@@ -1047,6 +1047,8 @@ struct dwc3_scratchpad_array { +@@ -1048,6 +1048,8 @@ struct dwc3_scratchpad_array { * 3 - Reserved * @dis_metastability_quirk: set to disable metastability quirk. * @dis_split_quirk: set to disable split boundary. @@ -53,7 +53,7 @@ Reviewed-by: Peter Chen * @imod_interval: set the interrupt moderation interval in 250ns * increments or 0 to disable. */ -@@ -1242,6 +1244,8 @@ struct dwc3 { +@@ -1243,6 +1245,8 @@ struct dwc3 { unsigned dis_split_quirk:1; diff --git a/target/linux/mediatek/patches-5.4/0303-mtd-spinand-disable-on-die-ECC.patch b/target/linux/mediatek/patches-5.4/0303-mtd-spinand-disable-on-die-ECC.patch index 56b9585d7f..5c18ea0f74 100644 --- a/target/linux/mediatek/patches-5.4/0303-mtd-spinand-disable-on-die-ECC.patch +++ b/target/linux/mediatek/patches-5.4/0303-mtd-spinand-disable-on-die-ECC.patch @@ -11,7 +11,7 @@ Signed-off-by: Xiangsheng Hou --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c -@@ -495,7 +495,7 @@ static int spinand_mtd_read(struct mtd_i +@@ -491,7 +491,7 @@ static int spinand_mtd_read(struct mtd_i int ret = 0; if (ops->mode != MTD_OPS_RAW && spinand->eccinfo.ooblayout) @@ -20,7 +20,7 @@ Signed-off-by: Xiangsheng Hou mutex_lock(&spinand->lock); -@@ -543,7 +543,7 @@ static int spinand_mtd_write(struct mtd_ +@@ -539,7 +539,7 @@ static int spinand_mtd_write(struct mtd_ int ret = 0; if (ops->mode != MTD_OPS_RAW && mtd->ooblayout) diff --git a/target/linux/mediatek/patches-5.4/0600-net-phylink-propagate-resolved-link-config-via-mac_l.patch b/target/linux/mediatek/patches-5.4/0600-net-phylink-propagate-resolved-link-config-via-mac_l.patch index 96fa3be1ef..0c9ef86a3b 100644 --- a/target/linux/mediatek/patches-5.4/0600-net-phylink-propagate-resolved-link-config-via-mac_l.patch +++ b/target/linux/mediatek/patches-5.4/0600-net-phylink-propagate-resolved-link-config-via-mac_l.patch @@ -83,7 +83,7 @@ Signed-off-by: David S. Miller /* Queue modes */ #define MVPP2_QDIST_SINGLE_MODE 0 -@@ -3467,8 +3470,9 @@ static void mvpp2_start_dev(struct mvpp2 +@@ -3468,8 +3471,9 @@ static void mvpp2_start_dev(struct mvpp2 .interface = port->phy_interface, }; mvpp2_mac_config(&port->phylink_config, MLO_AN_INBAND, &state); @@ -95,7 +95,7 @@ Signed-off-by: David S. Miller } netif_tx_start_all_queues(port->dev); -@@ -5126,8 +5130,11 @@ static void mvpp2_mac_config(struct phyl +@@ -5127,8 +5131,11 @@ static void mvpp2_mac_config(struct phyl mvpp2_port_enable(port); } diff --git a/target/linux/mediatek/patches-5.4/0601-net-dsa-propagate-resolved-link-config-via-mac_link_.patch b/target/linux/mediatek/patches-5.4/0601-net-dsa-propagate-resolved-link-config-via-mac_link_.patch index e693a17d29..ef6f66e3fc 100644 --- a/target/linux/mediatek/patches-5.4/0601-net-dsa-propagate-resolved-link-config-via-mac_link_.patch +++ b/target/linux/mediatek/patches-5.4/0601-net-dsa-propagate-resolved-link-config-via-mac_link_.patch @@ -51,7 +51,7 @@ Signed-off-by: David S. Miller struct ethtool_eee *p = &priv->dev->ports[port].eee; --- a/drivers/net/dsa/lantiq_gswip.c +++ b/drivers/net/dsa/lantiq_gswip.c -@@ -1518,7 +1518,9 @@ static void gswip_phylink_mac_link_down( +@@ -1507,7 +1507,9 @@ static void gswip_phylink_mac_link_down( static void gswip_phylink_mac_link_up(struct dsa_switch *ds, int port, unsigned int mode, phy_interface_t interface, diff --git a/target/linux/mvebu/image/cortexa72.mk b/target/linux/mvebu/image/cortexa72.mk index 8bd4581766..1440c07a0b 100644 --- a/target/linux/mvebu/image/cortexa72.mk +++ b/target/linux/mvebu/image/cortexa72.mk @@ -38,7 +38,7 @@ define Device/marvell_macchiatobin-singleshot DEVICE_ALT0_VENDOR := SolidRun DEVICE_ALT0_MODEL := Armada 8040 Community Board DEVICE_ALT0_VARIANT := Single Shot - DEVICE_PACKAGES += kmod-i2c-mux-pca954x kmod-ledtrig-heartbeat + DEVICE_PACKAGES += kmod-i2c-mux-pca954x DEVICE_DTS := armada-8040-mcbin-singleshot SUPPORTED_DEVICES := marvell,armada8040-mcbin-singleshot endef diff --git a/target/linux/mxs/profiles/01-duckbill.mk b/target/linux/mxs/profiles/01-duckbill.mk index cab379a213..5224c3cfed 100644 --- a/target/linux/mxs/profiles/01-duckbill.mk +++ b/target/linux/mxs/profiles/01-duckbill.mk @@ -10,7 +10,7 @@ define Profile/duckbill FEATURES+=usbgadget PACKAGES+= \ -dnsmasq -firewall -ppp -ip6tables -iptables -6relayd -mtd uboot-envtools \ - kmod-leds-gpio kmod-ledtrig-timer -kmod-ipt-nathelper uboot-mxs-duckbill + kmod-leds-gpio -kmod-ipt-nathelper uboot-mxs-duckbill endef define Profile/duckbill/Description diff --git a/target/linux/mxs/profiles/02-olinuxino-maxi.mk b/target/linux/mxs/profiles/02-olinuxino-maxi.mk index e3d1c3b3c0..5c8ab287dd 100644 --- a/target/linux/mxs/profiles/02-olinuxino-maxi.mk +++ b/target/linux/mxs/profiles/02-olinuxino-maxi.mk @@ -9,7 +9,7 @@ define Profile/olinuxino-maxi NAME:=Olimex OLinuXino Maxi/Mini boards PACKAGES += imx-bootlets uboot-mxs-mx23_olinuxino \ kmod-usb-net-smsc95xx kmod-gpio-mcp23s08 \ - kmod-leds-gpio kmod-ledtrig-heartbeat kmod-sound-core + kmod-leds-gpio kmod-sound-core endef define Profile/olinuxino-maxi/Description diff --git a/target/linux/mxs/profiles/03-olinuxino-micro.mk b/target/linux/mxs/profiles/03-olinuxino-micro.mk index 535f6b53f1..62de50151d 100644 --- a/target/linux/mxs/profiles/03-olinuxino-micro.mk +++ b/target/linux/mxs/profiles/03-olinuxino-micro.mk @@ -8,7 +8,7 @@ define Profile/olinuxino-micro NAME:=Olimex OLinuXino Micro/Nano boards PACKAGES += imx-bootlets uboot-mxs-mx23_olinuxino \ - kmod-gpio-mcp23s08 kmod-leds-gpio kmod-ledtrig-heartbeat + kmod-gpio-mcp23s08 kmod-leds-gpio endef define Profile/olinuxino-micro/Description diff --git a/target/linux/omap/config-5.4 b/target/linux/omap/config-5.4 index 9e156f69e7..322ed65d16 100644 --- a/target/linux/omap/config-5.4 +++ b/target/linux/omap/config-5.4 @@ -379,7 +379,6 @@ CONFIG_LEDS_PWM=y CONFIG_LEDS_TRIGGER_BACKLIGHT=y CONFIG_LEDS_TRIGGER_CPU=y CONFIG_LEDS_TRIGGER_GPIO=y -CONFIG_LEDS_TRIGGER_HEARTBEAT=y CONFIG_LEDS_TRIGGER_ONESHOT=y CONFIG_LIBCRC32C=y CONFIG_LIBFDT=y diff --git a/target/linux/oxnas/Makefile b/target/linux/oxnas/Makefile index 750eddbcbb..f503c2819f 100644 --- a/target/linux/oxnas/Makefile +++ b/target/linux/oxnas/Makefile @@ -13,7 +13,7 @@ include $(INCLUDE_DIR)/target.mk DEFAULT_PACKAGES += \ kmod-button-hotplug kmod-input-gpio-keys-polled \ - kmod-ledtrig-timer kmod-leds-gpio uboot-envtools + kmod-leds-gpio uboot-envtools KERNELNAME:=zImage dtbs diff --git a/target/linux/oxnas/config-5.4 b/target/linux/oxnas/config-5.4 index 7b14110486..d8c87acabf 100644 --- a/target/linux/oxnas/config-5.4 +++ b/target/linux/oxnas/config-5.4 @@ -227,8 +227,6 @@ CONFIG_KEXEC_CORE=y CONFIG_LEDS_GPIO=y CONFIG_LEDS_TRIGGER_CPU=y CONFIG_LEDS_TRIGGER_GPIO=y -CONFIG_LEDS_TRIGGER_HEARTBEAT=y -# CONFIG_LEDS_TRIGGER_NETDEV is not set CONFIG_LEDS_TRIGGER_ONESHOT=y CONFIG_LIBFDT=y CONFIG_LOCALVERSION_AUTO=y diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk index dfdb5f28d3..2d0050f986 100644 --- a/target/linux/ramips/image/mt7620.mk +++ b/target/linux/ramips/image/mt7620.mk @@ -1175,8 +1175,7 @@ define Device/zbtlink_zbt-we1026-h-32m DEVICE_VENDOR := Zbtlink DEVICE_MODEL := ZBT-WE1026-H DEVICE_VARIANT := 32M - DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-sdhci-mt7620 \ - kmod-ledtrig-netdev + DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-sdhci-mt7620 endef TARGET_DEVICES += zbtlink_zbt-we1026-h-32m diff --git a/target/linux/ramips/image/rt305x.mk b/target/linux/ramips/image/rt305x.mk index cf24be0f1b..7730b5aaa9 100644 --- a/target/linux/ramips/image/rt305x.mk +++ b/target/linux/ramips/image/rt305x.mk @@ -413,7 +413,6 @@ define Device/dlink_dir-610-a1 DEVICE_VENDOR := D-Link DEVICE_MODEL := DIR-610 DEVICE_VARIANT := A1 - DEVICE_PACKAGES := kmod-ledtrig-netdev kmod-ledtrig-timer SUPPORTED_DEVICES += dir-610-a1 DEFAULT := n endef @@ -554,7 +553,7 @@ define Device/hame_mpr-a1 DEVICE_VENDOR := HAME DEVICE_MODEL := MPR DEVICE_VARIANT := A1 - DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-ledtrig-netdev + DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 SUPPORTED_DEVICES += mpr-a1 DEFAULT := n endef @@ -567,7 +566,7 @@ define Device/hame_mpr-a2 DEVICE_VENDOR := HAME DEVICE_MODEL := MPR DEVICE_VARIANT := A2 - DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-ledtrig-netdev + DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 SUPPORTED_DEVICES += mpr-a2 endef TARGET_DEVICES += hame_mpr-a2 @@ -631,8 +630,8 @@ define Device/intenso_memory2move UIMAGE_NAME:= Linux Kernel Image DEVICE_VENDOR := Intenso DEVICE_MODEL := Memory 2 Move - DEVICE_PACKAGES := kmod-ledtrig-netdev kmod-ledtrig-timer kmod-usb2 \ - kmod-usb-storage kmod-scsi-core kmod-fs-ext4 kmod-fs-vfat block-mount + DEVICE_PACKAGES := kmod-usb2 kmod-usb-storage kmod-scsi-core kmod-fs-ext4 \ + kmod-fs-vfat block-mount SUPPORTED_DEVICES += m2m endef TARGET_DEVICES += intenso_memory2move @@ -868,7 +867,7 @@ define Device/poray_m3 poray-header -B M3 -F 4M DEVICE_VENDOR := Poray DEVICE_MODEL := M3 - DEVICE_PACKAGES := kmod-usb2 kmod-ledtrig-netdev kmod-ledtrig-timer + DEVICE_PACKAGES := kmod-usb2 SUPPORTED_DEVICES += m3 DEFAULT := n endef @@ -883,7 +882,7 @@ define Device/poray_m4-4m DEVICE_VENDOR := Poray DEVICE_MODEL := M4 DEVICE_VARIANT := 4M - DEVICE_PACKAGES := kmod-usb2 kmod-ledtrig-netdev kmod-ledtrig-timer + DEVICE_PACKAGES := kmod-usb2 SUPPORTED_DEVICES += m4-4M DEFAULT := n endef @@ -898,7 +897,7 @@ define Device/poray_m4-8m DEVICE_VENDOR := Poray DEVICE_MODEL := M4 DEVICE_VARIANT := 8M - DEVICE_PACKAGES := kmod-usb2 kmod-ledtrig-netdev kmod-ledtrig-timer + DEVICE_PACKAGES := kmod-usb2 SUPPORTED_DEVICES += m4-8M endef TARGET_DEVICES += poray_m4-8m @@ -911,7 +910,7 @@ define Device/poray_x5 poray-header -B X5 -F 8M DEVICE_VENDOR := Poray DEVICE_MODEL := X5/X6 - DEVICE_PACKAGES := kmod-usb2 kmod-ledtrig-netdev kmod-ledtrig-timer + DEVICE_PACKAGES := kmod-usb2 SUPPORTED_DEVICES += x5 endef TARGET_DEVICES += poray_x5 @@ -924,7 +923,7 @@ define Device/poray_x8 poray-header -B X8 -F 8M DEVICE_VENDOR := Poray DEVICE_MODEL := X8 - DEVICE_PACKAGES := kmod-usb2 kmod-ledtrig-netdev kmod-ledtrig-timer + DEVICE_PACKAGES := kmod-usb2 SUPPORTED_DEVICES += x8 endef TARGET_DEVICES += poray_x8 @@ -1179,7 +1178,7 @@ define Device/zorlik_zl5900v2 IMAGE_SIZE := 7872k DEVICE_VENDOR := Zorlik DEVICE_MODEL := ZL5900V2 - DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-ledtrig-netdev + DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 endef TARGET_DEVICES += zorlik_zl5900v2 diff --git a/target/linux/ramips/mt7621/config-5.4 b/target/linux/ramips/mt7621/config-5.4 index b2ad37510b..fba22a39cf 100644 --- a/target/linux/ramips/mt7621/config-5.4 +++ b/target/linux/ramips/mt7621/config-5.4 @@ -1,24 +1,9 @@ CONFIG_ARCH_32BIT_OFF_T=y CONFIG_ARCH_CLOCKSOURCE_DATA=y -CONFIG_ARCH_HAS_DMA_COHERENT_TO_PFN=y -CONFIG_ARCH_HAS_DMA_PREP_COHERENT=y -CONFIG_ARCH_HAS_DMA_WRITE_COMBINE=y -CONFIG_ARCH_HAS_ELF_RANDOMIZE=y -CONFIG_ARCH_HAS_RESET_CONTROLLER=y -CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE=y -CONFIG_ARCH_HAS_TICK_BROADCAST=y -CONFIG_ARCH_HAS_UNCACHED_SEGMENT=y CONFIG_ARCH_HIBERNATION_POSSIBLE=y CONFIG_ARCH_MMAP_RND_BITS_MAX=15 CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=15 -CONFIG_ARCH_SUPPORTS_UPROBES=y CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARCH_USE_BUILTIN_BSWAP=y -CONFIG_ARCH_USE_MEMREMAP_PROT=y -CONFIG_ARCH_USE_QUEUED_RWLOCKS=y -CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y -CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT=y -CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y CONFIG_AT803X_PHY=y CONFIG_BLK_MQ_PCI=y CONFIG_BOARD_SCACHE=y @@ -65,6 +50,7 @@ CONFIG_CRYPTO_NULL2=y CONFIG_CRYPTO_RNG2=y CONFIG_CSRC_R4K=y CONFIG_DEBUG_PINCTRL=y +CONFIG_DIMLIB=y CONFIG_DMA_NONCOHERENT=y CONFIG_DMA_NONCOHERENT_CACHE_SYNC=y # CONFIG_DMA_RALINK is not set @@ -108,46 +94,12 @@ CONFIG_GPIO_MT7621=y # CONFIG_GPIO_RALINK is not set CONFIG_GPIO_WATCHDOG=y # CONFIG_GPIO_WATCHDOG_ARCH_INITCALL is not set +CONFIG_GRO_CELLS=y CONFIG_HANDLE_DOMAIN_IRQ=y CONFIG_HARDWARE_WATCHPOINTS=y CONFIG_HAS_DMA=y CONFIG_HAS_IOMEM=y CONFIG_HAS_IOPORT_MAP=y -CONFIG_HAVE_ARCH_COMPILER_H=y -CONFIG_HAVE_ARCH_JUMP_LABEL=y -CONFIG_HAVE_ARCH_KGDB=y -CONFIG_HAVE_ARCH_SECCOMP_FILTER=y -CONFIG_HAVE_ARCH_TRACEHOOK=y -CONFIG_HAVE_ASM_MODVERSIONS=y -CONFIG_HAVE_CLK=y -CONFIG_HAVE_CLK_PREPARE=y -CONFIG_HAVE_CONTEXT_TRACKING=y -CONFIG_HAVE_COPY_THREAD_TLS=y -CONFIG_HAVE_C_RECORDMCOUNT=y -CONFIG_HAVE_DEBUG_KMEMLEAK=y -CONFIG_HAVE_DEBUG_STACKOVERFLOW=y -CONFIG_HAVE_DMA_CONTIGUOUS=y -CONFIG_HAVE_DYNAMIC_FTRACE=y -CONFIG_HAVE_FAST_GUP=y -CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y -CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_FUNCTION_TRACER=y -CONFIG_HAVE_GENERIC_VDSO=y -CONFIG_HAVE_IDE=y -CONFIG_HAVE_IOREMAP_PROT=y -CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK=y -CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y -CONFIG_HAVE_KVM=y -CONFIG_HAVE_LD_DEAD_CODE_DATA_ELIMINATION=y -CONFIG_HAVE_MEMBLOCK_NODE_MAP=y -CONFIG_HAVE_MOD_ARCH_SPECIFIC=y -CONFIG_HAVE_NET_DSA=y -CONFIG_HAVE_OPROFILE=y -CONFIG_HAVE_PCI=y -CONFIG_HAVE_PERF_EVENTS=y -CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y -CONFIG_HAVE_RSEQ=y -CONFIG_HAVE_SYSCALL_TRACEPOINTS=y CONFIG_HIGHMEM=y CONFIG_HZ=250 CONFIG_HZ_250=y @@ -177,6 +129,7 @@ CONFIG_MIKROTIK_RB_SYSFS=y CONFIG_MIPS=y CONFIG_MIPS_ASID_BITS=8 CONFIG_MIPS_ASID_SHIFT=0 +CONFIG_MIPS_CBPF_JIT=y CONFIG_MIPS_CLOCK_VSYSCALL=y CONFIG_MIPS_CM=y # CONFIG_MIPS_CMDLINE_BUILTIN_EXTEND is not set @@ -315,6 +268,7 @@ CONFIG_SYS_SUPPORTS_MIPS_CPS=y CONFIG_SYS_SUPPORTS_MULTITHREADING=y CONFIG_SYS_SUPPORTS_SCHED_SMT=y CONFIG_SYS_SUPPORTS_SMP=y +CONFIG_SYS_SUPPORTS_ZBOOT=y CONFIG_TARGET_ISA_REV=2 CONFIG_TICK_CPU_ACCOUNTING=y CONFIG_TIMER_OF=y diff --git a/target/linux/ramips/patches-5.4/998-thermal-bool.patch b/target/linux/ramips/patches-5.4/998-thermal-bool.patch deleted file mode 100644 index 5d2732ef64..0000000000 --- a/target/linux/ramips/patches-5.4/998-thermal-bool.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/drivers/thermal/Kconfig -+++ b/drivers/thermal/Kconfig -@@ -4,7 +4,7 @@ - # - - menuconfig THERMAL -- tristate "Generic Thermal sysfs driver" -+ bool "Generic Thermal sysfs driver" - help - Generic Thermal Sysfs driver offers a generic mechanism for - thermal management. Usually it's made up of one or more thermal diff --git a/target/linux/rockchip/armv8/config-5.4 b/target/linux/rockchip/armv8/config-5.4 index f2ff03d941..d1d61e8c95 100644 --- a/target/linux/rockchip/armv8/config-5.4 +++ b/target/linux/rockchip/armv8/config-5.4 @@ -237,7 +237,6 @@ CONFIG_LEDS_GPIO=y CONFIG_LEDS_PWM=y CONFIG_LEDS_SYSCON=y CONFIG_LEDS_TRIGGER_CPU=y -CONFIG_LEDS_TRIGGER_HEARTBEAT=y CONFIG_LEDS_TRIGGER_PANIC=y CONFIG_LEGACY_PTYS=y CONFIG_LEGACY_PTY_COUNT=16 diff --git a/target/linux/sunxi/image/cortexa7.mk b/target/linux/sunxi/image/cortexa7.mk index a87817037d..d491dbc338 100644 --- a/target/linux/sunxi/image/cortexa7.mk +++ b/target/linux/sunxi/image/cortexa7.mk @@ -25,8 +25,8 @@ TARGET_DEVICES += cubietech_cubietruck define Device/friendlyarm_nanopi-m1-plus DEVICE_VENDOR := FriendlyARM DEVICE_MODEL := NanoPi M1 Plus - DEVICE_PACKAGES:=kmod-rtc-sunxi kmod-leds-gpio kmod-ledtrig-heartbeat \ - kmod-brcmfmac brcmfmac-firmware-43430-sdio wpad-basic-wolfssl + DEVICE_PACKAGES:=kmod-rtc-sunxi kmod-leds-gpio kmod-brcmfmac \ + brcmfmac-firmware-43430-sdio wpad-basic-wolfssl SOC := sun8i-h3 endef TARGET_DEVICES += friendlyarm_nanopi-m1-plus @@ -41,8 +41,8 @@ TARGET_DEVICES += friendlyarm_nanopi-neo define Device/friendlyarm_nanopi-neo-air DEVICE_VENDOR := FriendlyARM DEVICE_MODEL := NanoPi NEO Air - DEVICE_PACKAGES := kmod-rtc-sunxi kmod-leds-gpio kmod-ledtrig-heartbeat \ - kmod-brcmfmac brcmfmac-firmware-43430-sdio wpad-basic-wolfssl + DEVICE_PACKAGES := kmod-rtc-sunxi kmod-leds-gpio kmod-brcmfmac \ + brcmfmac-firmware-43430-sdio wpad-basic-wolfssl SOC := sun8i-h3 endef TARGET_DEVICES += friendlyarm_nanopi-neo-air @@ -50,9 +50,8 @@ TARGET_DEVICES += friendlyarm_nanopi-neo-air define Device/friendlyarm_nanopi-r1 DEVICE_VENDOR := FriendlyARM DEVICE_MODEL := NanoPi R1 - DEVICE_PACKAGES := kmod-rtc-sunxi kmod-usb-net-rtl8152 \ - kmod-brcmfmac kmod-leds-gpio kmod-ledtrig-heartbeat wpad-basic-wolfssl \ - brcmfmac-firmware-43430-sdio + DEVICE_PACKAGES := kmod-rtc-sunxi kmod-usb-net-rtl8152 kmod-leds-gpio \ + kmod-brcmfmac brcmfmac-firmware-43430-sdio wpad-basic-wolfssl SOC := sun8i-h3 endef TARGET_DEVICES += friendlyarm_nanopi-r1 @@ -152,8 +151,8 @@ TARGET_DEVICES += olimex_a20-olinuxino-micro define Device/sinovoip_bananapi-m2-plus DEVICE_VENDOR := Sinovoip DEVICE_MODEL := Banana Pi M2+ - DEVICE_PACKAGES:=kmod-rtc-sunxi kmod-leds-gpio kmod-ledtrig-heartbeat \ - kmod-brcmfmac brcmfmac-firmware-43430a0-sdio wpad-basic-wolfssl + DEVICE_PACKAGES:=kmod-rtc-sunxi kmod-leds-gpio kmod-brcmfmac \ + brcmfmac-firmware-43430a0-sdio wpad-basic-wolfssl SOC := sun8i-h3 endef TARGET_DEVICES += sinovoip_bananapi-m2-plus diff --git a/target/linux/x86/image/geode.mk b/target/linux/x86/image/geode.mk index 4ebb14888a..2ed2245f7d 100644 --- a/target/linux/x86/image/geode.mk +++ b/target/linux/x86/image/geode.mk @@ -1,7 +1,6 @@ define Device/generic DEVICE_TITLE := Generic x86/Geode - DEVICE_PACKAGES += kmod-crypto-cbc kmod-crypto-hw-geode kmod-ledtrig-gpio \ - kmod-ledtrig-heartbeat kmod-ledtrig-netdev + DEVICE_PACKAGES += kmod-crypto-cbc kmod-crypto-hw-geode kmod-ledtrig-gpio GRUB2_VARIANT := legacy endef TARGET_DEVICES += generic diff --git a/target/linux/zynq/config-5.4 b/target/linux/zynq/config-5.4 index 8d702a83b9..258c3e14b4 100644 --- a/target/linux/zynq/config-5.4 +++ b/target/linux/zynq/config-5.4 @@ -379,8 +379,6 @@ CONFIG_LEDS_TRIGGER_BACKLIGHT=y CONFIG_LEDS_TRIGGER_CAMERA=y CONFIG_LEDS_TRIGGER_CPU=y CONFIG_LEDS_TRIGGER_GPIO=y -CONFIG_LEDS_TRIGGER_HEARTBEAT=y -# CONFIG_LEDS_TRIGGER_NETDEV is not set CONFIG_LEDS_TRIGGER_ONESHOT=y CONFIG_LEDS_TRIGGER_TRANSIENT=y CONFIG_LIBFDT=y diff --git a/toolchain/glibc/common.mk b/toolchain/glibc/common.mk index 8b81ae1974..a32e375117 100644 --- a/toolchain/glibc/common.mk +++ b/toolchain/glibc/common.mk @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=glibc PKG_VERSION:=2.32 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_PROTO:=git PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) -PKG_SOURCE_VERSION:=0d9793e82a19bcef10ef7d73a26cd44b7ad30753 -PKG_MIRROR_HASH:=edb3e1f8792f3f10d6ade9ac35837e8b0b65ee12219f3580e1ac8ba363ef9e8f +PKG_SOURCE_VERSION:=4c619b3eed558172198790f842740abb9af1989d +PKG_MIRROR_HASH:=b662bceabc5a077c5be8a582aaf1567450fd774df5e31f91928272c1e4e572de PKG_SOURCE_URL:=https://sourceware.org/git/glibc.git PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz diff --git a/toolchain/glibc/patches/050-Revert-Disallow-use-of-DES-encryption-functions-in-n.patch b/toolchain/glibc/patches/050-Revert-Disallow-use-of-DES-encryption-functions-in-n.patch index 002e7a1770..10d9f65d18 100644 --- a/toolchain/glibc/patches/050-Revert-Disallow-use-of-DES-encryption-functions-in-n.patch +++ b/toolchain/glibc/patches/050-Revert-Disallow-use-of-DES-encryption-functions-in-n.patch @@ -23,11 +23,9 @@ provides them. sunrpc/des_soft.c | 2 +- 13 files changed, 305 insertions(+), 90 deletions(-) -diff --git a/conform/data/stdlib.h-data b/conform/data/stdlib.h-data -index 6913828196..d8fcccc2fb 100644 --- a/conform/data/stdlib.h-data +++ b/conform/data/stdlib.h-data -@@ -149,6 +149,9 @@ function {unsigned short int*} seed48 (unsigned short int[3]) +@@ -149,6 +149,9 @@ function {unsigned short int*} seed48 (u #if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined XPG4 && !defined XPG42 && !defined UNIX98 function int setenv (const char*, const char*, int) #endif @@ -37,8 +35,6 @@ index 6913828196..d8fcccc2fb 100644 #if !defined ISO && !defined ISO99 && !defined ISO11 && !defined XPG4 && !defined POSIX && !defined POSIX2008 function {char*} setstate (char*) #endif -diff --git a/conform/data/unistd.h-data b/conform/data/unistd.h-data -index aa070528e8..ddf4f25132 100644 --- a/conform/data/unistd.h-data +++ b/conform/data/unistd.h-data @@ -437,6 +437,9 @@ function int chroot (const char*) @@ -61,8 +57,6 @@ index aa070528e8..ddf4f25132 100644 function int execl (const char*, const char*, ...) function int execle (const char*, const char*, ...) function int execlp (const char*, const char*, ...) -diff --git a/crypt/cert.c b/crypt/cert.c -index e070ca398d..80029e9078 100644 --- a/crypt/cert.c +++ b/crypt/cert.c @@ -10,22 +10,6 @@ @@ -102,8 +96,6 @@ index e070ca398d..80029e9078 100644 -} - -#endif -diff --git a/crypt/crypt-entry.c b/crypt/crypt-entry.c -index 502b5846f0..09332c690a 100644 --- a/crypt/crypt-entry.c +++ b/crypt/crypt-entry.c @@ -35,7 +35,6 @@ @@ -114,7 +106,7 @@ index 502b5846f0..09332c690a 100644 /* Prototypes for local functions. */ #ifndef __GNU_LIBRARY__ -@@ -177,7 +176,17 @@ crypt (const char *key, const char *salt) +@@ -177,7 +176,17 @@ crypt (const char *key, const char *salt return __crypt_r (key, salt, &_ufc_foobar); } @@ -134,8 +126,6 @@ index 502b5846f0..09332c690a 100644 + return crypt (key, salt); +} #endif -diff --git a/crypt/crypt.h b/crypt/crypt.h -index ca8ad456cc..7d0de95018 100644 --- a/crypt/crypt.h +++ b/crypt/crypt.h @@ -36,6 +36,14 @@ __BEGIN_DECLS @@ -168,8 +158,6 @@ index ca8ad456cc..7d0de95018 100644 #endif __END_DECLS -diff --git a/crypt/crypt_util.c b/crypt/crypt_util.c -index 4b2f0a89cb..b012cde6bd 100644 --- a/crypt/crypt_util.c +++ b/crypt/crypt_util.c @@ -34,7 +34,6 @@ @@ -196,7 +184,7 @@ index 4b2f0a89cb..b012cde6bd 100644 /* * This is the final -@@ -788,7 +785,6 @@ _ufc_output_conversion_r (ufc_long v1, ufc_long v2, const char *salt, +@@ -788,7 +785,6 @@ _ufc_output_conversion_r (ufc_long v1, u __data->crypt_3_buf[13] = 0; } @@ -204,7 +192,7 @@ index 4b2f0a89cb..b012cde6bd 100644 /* * UNIX encrypt function. Takes a bitvector -@@ -889,14 +885,12 @@ __encrypt_r (char *__block, int __edflag, +@@ -889,14 +885,12 @@ __encrypt_r (char *__block, int __edflag } } weak_alias (__encrypt_r, encrypt_r) @@ -219,7 +207,7 @@ index 4b2f0a89cb..b012cde6bd 100644 /* -@@ -921,15 +915,12 @@ __setkey_r (const char *__key, struct crypt_data * __restrict __data) +@@ -921,15 +915,12 @@ __setkey_r (const char *__key, struct cr _ufc_mk_keytab_r((char *) ktab, __data); } weak_alias (__setkey_r, setkey_r) @@ -235,11 +223,9 @@ index 4b2f0a89cb..b012cde6bd 100644 void __b64_from_24bit (char **cp, int *buflen, -diff --git a/manual/conf.texi b/manual/conf.texi -index f959b00bb6..51fb2f5aa1 100644 --- a/manual/conf.texi +++ b/manual/conf.texi -@@ -780,8 +780,6 @@ Inquire about the parameter corresponding to @code{_XOPEN_LEGACY}. +@@ -780,8 +780,6 @@ Inquire about the parameter correspondin @item _SC_XOPEN_CRYPT @standards{X/Open, unistd.h} Inquire about the parameter corresponding to @code{_XOPEN_CRYPT}. @@ -248,11 +234,9 @@ index f959b00bb6..51fb2f5aa1 100644 @item _SC_XOPEN_ENH_I18N @standards{X/Open, unistd.h} -diff --git a/manual/crypt.texi b/manual/crypt.texi -index af23dd7847..1b151f2d74 100644 --- a/manual/crypt.texi +++ b/manual/crypt.texi -@@ -16,8 +16,19 @@ subject to them, even if you do not use the functions in this chapter +@@ -16,8 +16,19 @@ subject to them, even if you do not use yourself. The restrictions vary from place to place and are changed often, so we cannot give any more specific advice than this warning. @@ -272,7 +256,7 @@ index af23dd7847..1b151f2d74 100644 * Unpredictable Bytes:: Randomness for cryptographic purposes. @end menu -@@ -190,6 +201,199 @@ unpredictable as possible; @pxref{Unpredictable Bytes}. +@@ -190,6 +201,199 @@ unpredictable as possible; @pxref{Unpred @include genpass.c.texi @end smallexample @@ -472,8 +456,6 @@ index af23dd7847..1b151f2d74 100644 The next program demonstrates how to verify a passphrase. It checks a hash hardcoded into the program, because looking up real users' hashed passphrases may require special privileges (@pxref{User Database}). -diff --git a/manual/string.texi b/manual/string.texi -index 23f516439a..5586b52dee 100644 --- a/manual/string.texi +++ b/manual/string.texi @@ -36,8 +36,8 @@ too. @@ -487,7 +469,7 @@ index 23f516439a..5586b52dee 100644 * Encode Binary Data:: Encoding and Decoding of Binary Data. * Argz and Envz Vectors:: Null-separated string vectors. @end menu -@@ -2426,73 +2426,73 @@ functionality under a different name, such as @code{explicit_memset}, +@@ -2426,73 +2426,73 @@ functionality under a different name, su systems it may be in @file{strings.h} instead. @end deftypefun @@ -538,22 +520,11 @@ index 23f516439a..5586b52dee 100644 -@node Obfuscating Data -@section Obfuscating Data --@cindex Rot13 +@node Trivial Encryption +@section Trivial Encryption +@cindex encryption - --The @code{memfrob} function reversibly obfuscates an array of binary --data. This is not true encryption; the obfuscated data still bears a --clear relationship to the original, and no secret key is required to --undo the obfuscation. It is analogous to the ``Rot13'' cipher used on --Usenet for obscuring offensive jokes, spoilers for works of fiction, --and so on, but it can be applied to arbitrary binary data. - --Programs that need true encryption---a transformation that completely --obscures the original and cannot be reversed without knowledge of a --secret key---should use a dedicated cryptography library, such as --@uref{https://www.gnu.org/software/libgcrypt/,,libgcrypt}. ++ ++ +The @code{memfrob} function converts an array of data to something +unrecognizable and back again. It is not encryption in its usual sense +since it is easy for someone to convert the encrypted data back to clear @@ -561,8 +532,20 @@ index 23f516439a..5586b52dee 100644 +method for obscuring offensive jokes from sensitive eyes and such. +Unlike Rot13, @code{memfrob} works on arbitrary binary data, not just +text. -+@cindex Rot13 + @cindex Rot13 +-The @code{memfrob} function reversibly obfuscates an array of binary +-data. This is not true encryption; the obfuscated data still bears a +-clear relationship to the original, and no secret key is required to +-undo the obfuscation. It is analogous to the ``Rot13'' cipher used on +-Usenet for obscuring offensive jokes, spoilers for works of fiction, +-and so on, but it can be applied to arbitrary binary data. +- +-Programs that need true encryption---a transformation that completely +-obscures the original and cannot be reversed without knowledge of a +-secret key---should use a dedicated cryptography library, such as +-@uref{https://www.gnu.org/software/libgcrypt/,,libgcrypt}. +- -Programs that need to @emph{destroy} data should use -@code{explicit_bzero} (@pxref{Erasing Sensitive Data}), or possibly -@code{strfry} (@pxref{Shuffling Bytes}). @@ -579,13 +562,14 @@ index 23f516439a..5586b52dee 100644 -beginning at @var{mem}, in place. Each byte is bitwise xor-ed with -the binary pattern 00101010 (hexadecimal 0x2A). The return value is -always @var{mem}. +- +-@code{memfrob} a second time on the same data returns it to +-its original state. +@code{memfrob} transforms (frobnicates) each byte of the data structure +at @var{mem}, which is @var{length} bytes long, by bitwise exclusive +oring it with binary 00101010. It does the transformation in place and +its return value is always @var{mem}. - --@code{memfrob} a second time on the same data returns it to --its original state. ++ +Note that @code{memfrob} a second time on the same data structure +returns it to its original state. + @@ -600,8 +584,6 @@ index 23f516439a..5586b52dee 100644 @end deftypefun @node Encode Binary Data -diff --git a/posix/unistd.h b/posix/unistd.h -index 32b8161619..6fac59999f 100644 --- a/posix/unistd.h +++ b/posix/unistd.h @@ -107,6 +107,9 @@ __BEGIN_DECLS @@ -614,7 +596,7 @@ index 32b8161619..6fac59999f 100644 /* The enhanced internationalization capabilities according to XPG4.2 are present. */ #define _XOPEN_ENH_I18N 1 -@@ -1129,17 +1132,25 @@ ssize_t copy_file_range (int __infd, __off64_t *__pinoff, +@@ -1129,17 +1132,25 @@ ssize_t copy_file_range (int __infd, __o extern int fdatasync (int __fildes); #endif /* Use POSIX199309 */ @@ -643,11 +625,9 @@ index 32b8161619..6fac59999f 100644 /* Swab pairs bytes in the first N bytes of the area pointed to by FROM and copy the result to TO. The value of TO must not be in the range [FROM - N + 1, FROM - 1]. If N is odd the first byte in FROM -diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h -index 3aa27a9d25..67e5e66f94 100644 --- a/stdlib/stdlib.h +++ b/stdlib/stdlib.h -@@ -962,6 +962,12 @@ extern int getsubopt (char **__restrict __optionp, +@@ -962,6 +962,12 @@ extern int getsubopt (char **__restrict #endif @@ -660,11 +640,9 @@ index 3aa27a9d25..67e5e66f94 100644 /* X/Open pseudo terminal handling. */ #ifdef __USE_XOPEN2KXSI -diff --git a/sunrpc/des_crypt.c b/sunrpc/des_crypt.c -index 9b4bd2d5dd..a4d8b2936b 100644 --- a/sunrpc/des_crypt.c +++ b/sunrpc/des_crypt.c -@@ -86,9 +86,6 @@ common_crypt (char *key, char *buf, register unsigned len, +@@ -86,9 +86,6 @@ common_crypt (char *key, char *buf, regi return desdev == DES_SW ? DESERR_NONE : DESERR_NOHWDEVICE; } @@ -674,7 +652,7 @@ index 9b4bd2d5dd..a4d8b2936b 100644 /* * CBC mode encryption */ -@@ -105,7 +102,7 @@ cbc_crypt (char *key, char *buf, unsigned int len, unsigned int mode, +@@ -105,7 +102,7 @@ cbc_crypt (char *key, char *buf, unsigne COPY8 (dp.des_ivec, ivec); return err; } @@ -683,14 +661,12 @@ index 9b4bd2d5dd..a4d8b2936b 100644 /* * ECB mode encryption -@@ -118,4 +115,4 @@ ecb_crypt (char *key, char *buf, unsigned int len, unsigned int mode) +@@ -118,4 +115,4 @@ ecb_crypt (char *key, char *buf, unsigne dp.des_mode = ECB; return common_crypt (key, buf, len, mode, &dp); } -hidden_nolink (ecb_crypt, libc, GLIBC_2_1) +libc_hidden_nolink_sunrpc (ecb_crypt, GLIBC_2_1) -diff --git a/sunrpc/des_soft.c b/sunrpc/des_soft.c -index a87de96cc7..f884f8f21b 100644 --- a/sunrpc/des_soft.c +++ b/sunrpc/des_soft.c @@ -71,4 +71,4 @@ des_setparity (char *p) @@ -699,6 +675,3 @@ index a87de96cc7..f884f8f21b 100644 } -hidden_nolink (des_setparity, libc, GLIBC_2_1) +libc_hidden_nolink_sunrpc (des_setparity, GLIBC_2_1) --- -2.25.1 - diff --git a/toolchain/glibc/patches/100-fix_cross_rpcgen.patch b/toolchain/glibc/patches/100-fix_cross_rpcgen.patch index 6ee1e80424..9baed08139 100644 --- a/toolchain/glibc/patches/100-fix_cross_rpcgen.patch +++ b/toolchain/glibc/patches/100-fix_cross_rpcgen.patch @@ -33,3 +33,4 @@ +typedef char *caddr_t; # define __daddr_t_defined #endif + diff --git a/toolchain/glibc/patches/300-arc.patch b/toolchain/glibc/patches/300-arc.patch new file mode 100644 index 0000000000..66f7aeb3ef --- /dev/null +++ b/toolchain/glibc/patches/300-arc.patch @@ -0,0 +1,55 @@ +--- a/sysdeps/arc/atomic-machine.h ++++ b/sysdeps/arc/atomic-machine.h +@@ -64,6 +64,10 @@ typedef uintmax_t uatomic_max_t; + __atomic_val_bysize (__arch_compare_and_exchange_val, int, \ + mem, new, old, __ATOMIC_ACQUIRE) + ++#ifdef __ARC700__ ++#define atomic_full_barrier() ({ asm volatile ("sync":::"memory"); }) ++#else + #define atomic_full_barrier() ({ asm volatile ("dmb 3":::"memory"); }) ++#endif + + #endif /* _ARC_BITS_ATOMIC_H */ +--- a/sysdeps/unix/sysv/linux/arc/syscall.S ++++ b/sysdeps/unix/sysv/linux/arc/syscall.S +@@ -24,8 +24,13 @@ ENTRY (syscall) + mov_s r1, r2 + mov_s r2, r3 + mov_s r3, r4 ++#ifdef __ARC700__ ++ mov r4, r5 ++ mov r5, r6 ++#else + mov_s r4, r5 + mov_s r5, r6 ++#endif + + ARC_TRAP_INSN + brhi r0, -4096, L (call_syscall_err) +--- a/sysdeps/unix/sysv/linux/arc/sysdep.h ++++ b/sysdeps/unix/sysv/linux/arc/sysdep.h +@@ -128,7 +128,11 @@ L (call_syscall_err): ASM_LINE_SEP \ + mov r8, __NR_##syscall_name ASM_LINE_SEP \ + ARC_TRAP_INSN ASM_LINE_SEP + ++# ifdef __ARC700__ ++# define ARC_TRAP_INSN trap0 ++# else + # define ARC_TRAP_INSN trap_s 0 ++# endif + + #else /* !__ASSEMBLER__ */ + +@@ -139,7 +143,11 @@ extern long int __syscall_error (long in + hidden_proto (__syscall_error) + # endif + ++# ifdef __ARC700__ ++# define ARC_TRAP_INSN "trap0 \n\t" ++# else + # define ARC_TRAP_INSN "trap_s 0 \n\t" ++#endif + + # undef INTERNAL_SYSCALL_NCS + # define INTERNAL_SYSCALL_NCS(number, nr_args, args...) \ diff --git a/tools/fakeroot/patches/100-portability.patch b/tools/fakeroot/patches/100-portability.patch index 315a9e16bf..7ba12996be 100644 --- a/tools/fakeroot/patches/100-portability.patch +++ b/tools/fakeroot/patches/100-portability.patch @@ -25,7 +25,23 @@ #ifdef HAVE_SYS_ACL_H #include #endif /* HAVE_SYS_ACL_H */ -@@ -1911,7 +1918,7 @@ ssize_t fremovexattr(int fd, const char +@@ -188,6 +195,15 @@ extern int unsetenv (const char *name); + #undef __lxstat64 + #undef _FILE_OFFSET_BITS + ++ ++#ifndef AT_EMPTY_PATH ++#define AT_EMPTY_PATH 0 ++#endif ++ ++#ifndef AT_NO_AUTOMOUNT ++#define AT_NO_AUTOMOUNT 0 ++#endif ++ + /* + // next_wrap_st: + // this structure is used in next_wrap, which is defined in +@@ -1911,7 +1927,7 @@ ssize_t fremovexattr(int fd, const char } #endif /* HAVE_FREMOVEXATTR */ @@ -34,7 +50,7 @@ if (fakeroot_disabled) return next_setpriority(which, who, prio); next_setpriority(which, who, prio); -@@ -2520,3 +2527,19 @@ int sysinfo(int command, char *buf, long +@@ -2520,3 +2536,19 @@ int sysinfo(int command, char *buf, long } } #endif diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile index 6074ecc608..a8c6ab4f65 100644 --- a/tools/firmware-utils/Makefile +++ b/tools/firmware-utils/Makefile @@ -27,6 +27,7 @@ define Host/Compile $(call cc,add_header) $(call cc,addpattern) $(call cc,asustrx) + $(call cc,bcm4908kernel,-Wall) $(call cc,buffalo-enc buffalo-lib,-Wall) $(call cc,buffalo-tag buffalo-lib,-Wall) $(call cc,buffalo-tftp buffalo-lib,-Wall) diff --git a/tools/firmware-utils/src/bcm4908kernel.c b/tools/firmware-utils/src/bcm4908kernel.c new file mode 100644 index 0000000000..fc5b2812ef --- /dev/null +++ b/tools/firmware-utils/src/bcm4908kernel.c @@ -0,0 +1,127 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (C) 2021 Rafał Miłecki + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#if !defined(__BYTE_ORDER) +#error "Unknown byte order" +#endif + +#if __BYTE_ORDER == __BIG_ENDIAN +#define cpu_to_le32(x) bswap_32(x) +#define le32_to_cpu(x) bswap_32(x) +#elif __BYTE_ORDER == __LITTLE_ENDIAN +#define cpu_to_le32(x) (x) +#define le32_to_cpu(x) (x) +#else +#error "Unsupported endianness" +#endif + +struct bcm4908kernel_header { + uint32_t unk1; + uint32_t unk2; + uint32_t length; + uint8_t magic[4]; + uint32_t unused; +}; + +static void usage() { + printf("Usage:\n"); + printf("\n"); + printf("\t-i pathname\t\t\tinput kernel filepath\n"); + printf("\t-o pathname\t\t\toutput kernel filepath\n"); +} + +int main(int argc, char **argv) { + struct bcm4908kernel_header header; + uint8_t buf[1024]; + FILE *out = NULL; + FILE *in = NULL; + size_t length; + size_t bytes; + int err = 0; + char c; + + if (argc >= 2 && !strcmp(argv[1], "-h")) { + usage(); + return 0; + } + + while ((c = getopt(argc, argv, "i:o:")) != -1) { + switch (c) { + case 'i': + in = fopen(optarg, "r"); + break; + case 'o': + out = fopen(optarg, "w+"); + break; + } + } + + if (!in || !out) { + fprintf(stderr, "Failed to open input and/or output file\n"); + usage(); + return -EINVAL; + } + + if (fread(&header, 1, sizeof(header), in) != sizeof(header)) { + fprintf(stderr, "Failed to read %zu bytes from input file\n", sizeof(header)); + err = -EIO; + goto err_close; + } + + if (!memcmp(header.magic, "BRCM", 4)) { + fprintf(stderr, "Input file already contains BCM4908 kernel header\n"); + err = -EIO; + goto err_close; + } + + err = fseek(out, sizeof(header), SEEK_SET); + if (err) { + err = -errno; + fprintf(stderr, "Failed to fseek(): %d\n", err); + goto err_close; + } + + length = 0; + rewind(in); + while ((bytes = fread(buf, 1, sizeof(buf), in)) > 0) { + if (fwrite(buf, 1, bytes, out) != bytes) { + fprintf(stderr, "Failed to write %zu B to the output file\n", bytes); + err = -EIO; + goto err_close; + } + length += bytes; + } + + header.unk1 = cpu_to_le32(0x00080000); + header.unk2 = cpu_to_le32(0x00080000); + header.length = cpu_to_le32(length); + header.magic[0] = 'B'; + header.magic[1] = 'R'; + header.magic[2] = 'C'; + header.magic[3] = 'M'; + header.unused = 0; + + fseek(out, 0, SEEK_SET); + + if (fwrite(&header, 1, sizeof(header), out) != sizeof(header)) { + fprintf(stderr, "Failed to write header to the output file\n"); + err = -EIO; + goto err_close; + } + +err_close: + fclose(out); + fclose(in); + return err; +} diff --git a/tools/zstd/Makefile b/tools/zstd/Makefile index ec85362544..4ec910d4ba 100644 --- a/tools/zstd/Makefile +++ b/tools/zstd/Makefile @@ -4,7 +4,8 @@ PKG_NAME:=zstd PKG_VERSION:=1.4.4 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=@GITHUB/facebook/zstd/releases/download/v$(PKG_VERSION) +PKG_SOURCE_URL_FILE:=v$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/facebook/zstd/archive/ PKG_HASH:=a364f5162c7d1a455cc915e8e3cf5f4bd8b75d09bc0f53965b0c9ca1383c52c8 PKG_LICENSE:=BSD-3-Clause