From fe69010b1df668ae62f91ece8b9ce3b79b723547 Mon Sep 17 00:00:00 2001 From: Koen Vandeputte Date: Tue, 7 Feb 2023 14:39:47 +0100 Subject: [PATCH 01/26] kernel: add missing symbols in 5.15 Found these while playing around with video support Signed-off-by: Koen Vandeputte --- target/linux/generic/config-5.15 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/target/linux/generic/config-5.15 b/target/linux/generic/config-5.15 index 3374c239e2..b41de9cc28 100644 --- a/target/linux/generic/config-5.15 +++ b/target/linux/generic/config-5.15 @@ -3355,6 +3355,7 @@ CONFIG_MAY_USE_DEVLINK=y # CONFIG_MEDIA_CAMERA_SUPPORT is not set # CONFIG_MEDIA_CEC_SUPPORT is not set # CONFIG_MEDIA_CONTROLLER is not set +# CONFIG_MEDIA_CONTROLLER_DVB is not set # CONFIG_MEDIA_DIGITAL_TV_SUPPORT is not set # CONFIG_MEDIA_PCI_SUPPORT is not set # CONFIG_MEDIA_PLATFORM_SUPPORT is not set @@ -7242,6 +7243,7 @@ CONFIG_VHOST_MENU=y # CONFIG_VIDEO_CADENCE is not set # CONFIG_VIDEO_CAFE_CCIC is not set # CONFIG_VIDEO_CCS is not set +# CONFIG_VIDEO_CODA is not set # CONFIG_VIDEO_CS3308 is not set # CONFIG_VIDEO_CS5345 is not set # CONFIG_VIDEO_CS53L32A is not set @@ -7265,6 +7267,8 @@ CONFIG_VHOST_MENU=y # CONFIG_VIDEO_HEXIUM_ORION is not set # CONFIG_VIDEO_HI556 is not set # CONFIG_VIDEO_I2C is not set +# CONFIG_VIDEO_IMX_PXP is not set +# CONFIG_VIDEO_IMX208 is not set # CONFIG_VIDEO_IMX214 is not set # CONFIG_VIDEO_IMX219 is not set # CONFIG_VIDEO_IMX258 is not set @@ -7276,6 +7280,7 @@ CONFIG_VHOST_MENU=y # CONFIG_VIDEO_IMX355 is not set # CONFIG_VIDEO_IMX412 is not set # CONFIG_VIDEO_IMX477 is not set +# CONFIG_VIDEO_IMX8_JPEG is not set # CONFIG_VIDEO_IRS1125 is not set # CONFIG_VIDEO_IR_I2C is not set # CONFIG_VIDEO_IVTV is not set @@ -7285,6 +7290,7 @@ CONFIG_VHOST_MENU=y # CONFIG_VIDEO_M52790 is not set # CONFIG_VIDEO_M5MOLS is not set # CONFIG_VIDEO_MAX9286 is not set +# CONFIG_VIDEO_MEM2MEM_DEINTERLACE is not set # CONFIG_VIDEO_ML86V7667 is not set # CONFIG_VIDEO_MSP3400 is not set # CONFIG_VIDEO_MT9M001 is not set From 7699a5b1d77bcab3d63f6fb94b6f89f093db6395 Mon Sep 17 00:00:00 2001 From: Koen Vandeputte Date: Mon, 20 Mar 2023 18:41:36 +0100 Subject: [PATCH 02/26] ipq-wifi: bump to latest git HEAD f9cece0 ipq40xx: add support for Wallystech DR40x9 Signed-off-by: Koen Vandeputte --- package/firmware/ipq-wifi/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index 57cd226bb7..846032c96f 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -6,9 +6,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/firmware/qca-wireless.git -PKG_SOURCE_DATE:=2023-03-19 -PKG_SOURCE_VERSION:=31ff96d9f99f993cb43d79f0c411fe6bf55633bb -PKG_MIRROR_HASH:=8005a884059925a627024b9022ed06a36ebf4ed7a20e8aab191585afbdd6895f +PKG_SOURCE_DATE:=2023-03-20 +PKG_SOURCE_VERSION:=f9cece02724b8ca2c1a166a46f0afa89e632d431 +PKG_MIRROR_HASH:=89c20798c7ec83114aa69467f2467fe32cbb74ebeca277c60a033af960ca6c04 PKG_FLAGS:=nonshared From eb564690c995b284204aa762c0f77f3064419a9c Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Tue, 30 Jun 2020 18:07:50 +0200 Subject: [PATCH 03/26] ipq40xx: add support for Wallystech DR40x9 Adds support for the Wallys DR40x9 series boards. They come in IPQ4019 and IPQ4029 versions. IPQ4019/4029 only differ in that that IPQ4029 is the industrial version that is rated to higher temperatures. Specifications are: * CPU: Qualcomm IPQ40x9 (4x ARMv7A Cortex A7) at 716 MHz * RAM: 512 MB * Storage: 2MB of SPI-NOR, 128 MB of parallel NAND * USB 3.0 TypeA port for users * MiniPCI-E with PCI-E 2.0 link * MiniPCI-E for LTE modems with only USB2.0 link * 2 SIM card slots that are selected via GPIO11 * MicroSD card slot * Ethernet: 2x GBe with 24~48V passive POE * SFP port (Does not work, I2C and GPIO's not connected on hardware) * DC Jack * UART header * WLAN: In-SoC 2x2 802.11b/g/n and 2x2 802.11a/n/ac * 4x MMCX connectors for WLAN * Reset button * 8x LED-s Installation instructions: Connect to UART, pins are like this: -> 3.3V | TX | RX | GND Settings are 115200 8n1 Boot initramfs from TFTP: tftpboot 0x84000000 openwrt-ipq40xx-generic-wallys_dr40x9-initramfs-fit-uImage.itb bootm Then copy the sysupgrade image to the /tmp folder and execute sysupgrade -n The board file binary was provided from Wallystech on March 14th 2023 including full permission to use and distribute. Signed-off-by: Robert Marko Signed-off-by: Koen Vandeputte --- package/firmware/ipq-wifi/Makefile | 2 + .../ipq40xx/base-files/etc/board.d/02_network | 1 + .../base-files/etc/board.d/03_gpio_switches | 3 + .../base-files/lib/upgrade/platform.sh | 3 +- .../arch/arm/boot/dts/qcom-ipq40x9-dr40x9.dts | 422 ++++++++++++++++++ target/linux/ipq40xx/image/generic.mk | 13 + 6 files changed, 443 insertions(+), 1 deletion(-) create mode 100644 target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq40x9-dr40x9.dts diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index 846032c96f..f3bf1185f8 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -54,6 +54,7 @@ ALLWIFIBOARDS:= \ redmi_ax6 \ sony_ncp-hg100-cellular \ teltonika_rutx \ + wallys_dr40x9 \ xiaomi_ax3600 \ xiaomi_ax9000 \ zte_mf18a \ @@ -158,6 +159,7 @@ $(eval $(call generate-ipq-wifi-package,qxwlan_e2600ac-c2,Qxwlan E2600AC C2)) $(eval $(call generate-ipq-wifi-package,redmi_ax6,Redmi AX6)) $(eval $(call generate-ipq-wifi-package,sony_ncp-hg100-cellular,Sony NCP-HG100/Cellular)) $(eval $(call generate-ipq-wifi-package,teltonika_rutx,Teltonika RUTX)) +$(eval $(call generate-ipq-wifi-package,wallys_dr40x9,Wallys DR40X9)) $(eval $(call generate-ipq-wifi-package,xiaomi_ax3600,Xiaomi AX3600)) $(eval $(call generate-ipq-wifi-package,xiaomi_ax9000,Xiaomi AX9000)) $(eval $(call generate-ipq-wifi-package,zte_mf18a,ZTE MF18A)) diff --git a/target/linux/ipq40xx/base-files/etc/board.d/02_network b/target/linux/ipq40xx/base-files/etc/board.d/02_network index 3625938e38..37b9ca268b 100644 --- a/target/linux/ipq40xx/base-files/etc/board.d/02_network +++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network @@ -39,6 +39,7 @@ ipq40xx_setup_interfaces() mikrotik,cap-ac|\ netgear,wac510|\ sony,ncp-hg100-cellular|\ + wallys,dr40x9|\ zte,mf18a|\ zte,mf289f) ucidef_set_interfaces_lan_wan "lan" "wan" diff --git a/target/linux/ipq40xx/base-files/etc/board.d/03_gpio_switches b/target/linux/ipq40xx/base-files/etc/board.d/03_gpio_switches index 4918e2ccc1..f76fe9402d 100644 --- a/target/linux/ipq40xx/base-files/etc/board.d/03_gpio_switches +++ b/target/linux/ipq40xx/base-files/etc/board.d/03_gpio_switches @@ -32,6 +32,9 @@ mikrotik,hap-ac3-lte6-kit) sony,ncp-hg100-cellular) ucidef_add_gpio_switch "uart_dbgcon_en" "debug console enable" "427" "1" ;; +wallys,dr40x9) + ucidef_add_gpio_switch "sim_card_select" "SIM card select" "423" "0" + ;; zte,mf286d|\ zte,mf289f) ucidef_add_gpio_switch "power_btn_block" "Power button blocker" "421" "0" diff --git a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh index 2012213a56..988921fa8c 100644 --- a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh @@ -119,7 +119,8 @@ platform_do_upgrade() { netgear,wac510 |\ p2w,r619ac-64m |\ p2w,r619ac-128m |\ - qxwlan,e2600ac-c2) + qxwlan,e2600ac-c2 |\ + wallys,dr40x9) nand_do_upgrade "$1" ;; glinet,gl-b2200) diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq40x9-dr40x9.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq40x9-dr40x9.dts new file mode 100644 index 0000000000..b90b6b28c3 --- /dev/null +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq40x9-dr40x9.dts @@ -0,0 +1,422 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qcom-ipq4019.dtsi" +#include +#include +#include + +/ { + model = "Wallystech DR40X9"; + compatible = "wallys,dr40x9"; + + chosen { + bootargs-append = " ubi.mtd=ubi root=/dev/ubiblock0_1"; + }; + + soc { + counter@4a1000 { + compatible = "qcom,qca-gcnt"; + reg = <0x4a1000 0x4>; + }; + + tcsr@1949000 { + compatible = "qcom,tcsr"; + reg = <0x1949000 0x100>; + qcom,wifi_glb_cfg = ; + }; + + tcsr@194b000 { + status = "okay"; + + /* select hostmode */ + compatible = "qcom,tcsr"; + reg = <0x194b000 0x100>; + qcom,usb-hsphy-mode-select = ; + }; + + ess_tcsr@1953000 { + compatible = "qcom,tcsr"; + reg = <0x1953000 0x1000>; + qcom,ess-interface-select = ; + }; + + tcsr@1957000 { + compatible = "qcom,tcsr"; + reg = <0x1957000 0x100>; + qcom,wifi_noc_memtype_m0_m2 = ; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&tlmm 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + wlan2g { + label = "dr4029:green:wlan2g"; + gpios = <&tlmm 32 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + wlan5g { + label = "dr4029:green:wlan5g"; + gpios = <&tlmm 50 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + + wlan2g-strength { + label = "dr4029:green:wlan2g-strength"; + gpios = <&tlmm 36 GPIO_ACTIVE_LOW>; + }; + + wlan5g-strength { + label = "dr4029:green:wlan5g-strength"; + gpios = <&tlmm 39 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&tlmm { + mdio_pins: mdio_pinmux { + mux_1 { + pins = "gpio6"; + function = "mdio"; + bias-pull-up; + }; + mux_2 { + pins = "gpio7"; + function = "mdc"; + bias-pull-up; + }; + }; + + serial0_pins: serial0_pinmux { + mux { + pins = "gpio16", "gpio17"; + function = "blsp_uart0"; + bias-disable; + }; + }; + + serial1_pins: serial1_pinmux { + mux { + pins = "gpio8", "gpio9"; + function = "blsp_uart1"; + bias-disable; + }; + }; + + spi_0_pins: spi_0_pinmux { + pinmux { + function = "blsp_spi0"; + pins = "gpio13", "gpio14", "gpio15"; + drive-strength = <12>; + bias-disable; + }; + pinmux_cs { + function = "gpio"; + pins = "gpio12"; + drive-strength = <2>; + bias-disable; + output-high; + }; + }; + + nand_pins: nand_pins { + pullups { + pins = "gpio52", "gpio53", "gpio58", "gpio59"; + function = "qpic"; + bias-pull-up; + }; + + pulldowns { + pins = "gpio54", "gpio55", "gpio56", "gpio57", + "gpio60", "gpio62", "gpio63", "gpio64", + "gpio65", "gpio66", "gpio67", "gpio68", + "gpio69"; + function = "qpic"; + bias-pull-down; + }; + }; + + sd_pins: sd_pins { + pinmux { + function = "sdio"; + pins = "gpio23", "gpio24", "gpio25", "gpio26", + "gpio28", "gpio29", "gpio30", "gpio31"; + drive-strength = <10>; + }; + pinmux_sd_clk { + function = "sdio"; + pins = "gpio27"; + drive-strength = <16>; + }; + pinmux_sd7 { + function = "sdio"; + pins = "gpio32"; + drive-strength = <10>; + bias-disable; + }; + }; +}; + +&blsp_dma { + status = "okay"; +}; + +&blsp1_spi1 { + status = "okay"; + + pinctrl-0 = <&spi_0_pins>; + pinctrl-names = "default"; + + cs-gpios = <&tlmm 12 GPIO_ACTIVE_HIGH>; + + flash@0 { + compatible = "jedec,spi-nor"; + spi-max-frequency = <24000000>; + reg = <0>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition0@0 { + label = "0:SBL1"; + reg = <0x00000000 0x00040000>; + read-only; + }; + + partition1@40000 { + label = "0:MIBIB"; + reg = <0x00040000 0x00020000>; + read-only; + }; + + partition2@60000 { + label = "0:QSEE"; + reg = <0x00060000 0x00060000>; + read-only; + }; + + partition3@c0000 { + label = "0:CDT"; + reg = <0x000c0000 0x00010000>; + read-only; + }; + + partition4@d0000 { + label = "0:DDRPARAMS"; + reg = <0x000d0000 0x00010000>; + read-only; + }; + + partition5@e0000 { + label = "0:APPSBLENV"; /* uboot env */ + reg = <0x000e0000 0x00010000>; + read-only; + }; + + partition6@f0000 { + label = "0:APPSBL"; /* uboot */ + reg = <0x000f0000 0x00080000>; + read-only; + }; + + partition7@170000 { + label = "0:ART"; + reg = <0x00170000 0x00010000>; + read-only; + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + precal_art_1000: precal@1000 { + reg = <0x1000 0x2f20>; + }; + + precal_art_5000: precal@5000 { + reg = <0x5000 0x2f20>; + }; + + macaddr_art_0: mac-address@0 { + reg = <0x0 0x6>; + }; + + macaddr_art_6: mac-address@6 { + reg = <0x6 0x6>; + }; + + macaddr_art_1006: mac-address@1006 { + reg = <0x1006 0x6>; + }; + + macaddr_art_5006: mac-address@5006 { + reg = <0x5006 0x6>; + }; + + }; + + partition8@180000 { + label = "0:CONFIG"; + reg = <0x00180000 0x00010000>; + read-only; + }; + }; + }; +}; + +&qpic_bam { + status = "okay"; +}; + +&nand { + status = "okay"; + + pinctrl-0 = <&nand_pins>; + pinctrl-names = "default"; + + nand@0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "ubi"; + reg = <0x00000000 0x04000000>; + }; + }; + }; +}; + +&blsp1_uart1 { + status = "okay"; + pinctrl-0 = <&serial0_pins>; + pinctrl-names = "default"; +}; + +&blsp1_uart2 { + status = "okay"; + pinctrl-0 = <&serial1_pins>; + pinctrl-names = "default"; +}; + +&crypto { + status = "okay"; +}; + +&cryptobam { + num-channels = <4>; + qcom,num-ees = <2>; + status = "okay"; +}; + +&mdio { + status = "okay"; + pinctrl-0 = <&mdio_pins>; + pinctrl-names = "default"; + reset-gpios = <&tlmm 41 GPIO_ACTIVE_LOW>; + reset-delay-us = <2000>; +}; + +&pcie0 { + status = "okay"; + + perst-gpio = <&tlmm 38 GPIO_ACTIVE_LOW>; + wake-gpio = <&tlmm 40 GPIO_ACTIVE_LOW>; + + /* Unpolulated slot */ + bridge@0,0 { + reg = <0x00000000 0 0 0 0>; + #address-cells = <3>; + #size-cells = <2>; + ranges; + }; +}; + +&vqmmc { + status = "okay"; +}; + +&sdhci { + status = "okay"; + pinctrl-0 = <&sd_pins>; + pinctrl-names = "default"; + cd-gpios = <&tlmm 22 GPIO_ACTIVE_LOW>; + vqmmc-supply = <&vqmmc>; +}; + +&gmac { + status = "okay"; +}; + +&switch { + status = "okay"; +}; + +&swport4 { + status = "okay"; + label = "wan"; + nvmem-cells = <&macaddr_art_0>; + nvmem-cell-names = "mac-address"; +}; + +&swport5 { + status = "okay"; + label = "lan"; + nvmem-cells = <&macaddr_art_6>; + nvmem-cell-names = "mac-address"; +}; + +&wifi0 { + status = "okay"; + nvmem-cells = <&precal_art_1000>, <&macaddr_art_1006>; + nvmem-cell-names = "pre-calibration", "mac-address"; + qcom,ath10k-calibration-variant = "Wallys-DR40X9"; +}; + +&wifi1 { + status = "okay"; + nvmem-cell-names = "pre-calibration", "mac-address"; + nvmem-cells = <&precal_art_5000>, <&macaddr_art_5006>; + qcom,ath10k-calibration-variant = "Wallys-DR40X9"; +}; + +&usb2 { + status = "okay"; +}; + +&usb2_hs_phy { + status = "okay"; +}; + +&usb3 { + status = "okay"; +}; + +&usb3_ss_phy { + status = "okay"; +}; + +&usb3_hs_phy { + status = "okay"; +}; + +&prng { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk index 68a45dbf9b..48514b8841 100644 --- a/target/linux/ipq40xx/image/generic.mk +++ b/target/linux/ipq40xx/image/generic.mk @@ -1122,6 +1122,19 @@ endef # Missing DSA Setup #TARGET_DEVICES += unielec_u4019-32m +define Device/wallys_dr40x9 + $(call Device/FitImage) + $(call Device/UbiFit) + DEVICE_VENDOR := Wallys + DEVICE_MODEL := DR40X9 + SOC := qcom-ipq40x9 + DEVICE_DTS_CONFIG := config@ap.dk07.1-c1 + BLOCKSIZE := 128k + PAGESIZE := 2048 + DEVICE_PACKAGES := ipq-wifi-wallys_dr40x9 +endef +TARGET_DEVICES += wallys_dr40x9 + define Device/zte_mf18a $(call Device/FitImage) DEVICE_VENDOR := ZTE From 0a44c579a1ab3f699ad84728cc6cde78c99ba1d1 Mon Sep 17 00:00:00 2001 From: Andre Heider Date: Thu, 2 Feb 2023 19:20:42 +0100 Subject: [PATCH 04/26] build: introduce PKG_BUILD_FLAGS and move PKG_IREMAP to it PKG_BUILD_FLAGS is a new variable for package Makefiles similar to PKG_FLAGS. It's a whitespace separated list of flags to control various aspects of how a package is build. The build system and/or .config defines the default for each, but every package has the means to override it. Using $flagname enables a flag, no-$flagname disables it. Start with PKG_IREMAP as "iremap". That's easy as no package here nor in any package feed uses it. The default is unchanged: enabled. Packages can opt-out via: PKG_BUILD_FLAGS:=no-iremap (Not that any should, just to illustrate how to use it) Signed-off-by: Andre Heider --- include/package.mk | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/include/package.mk b/include/package.mk index 368bf0d7ca..8d14c17dbd 100644 --- a/include/package.mk +++ b/include/package.mk @@ -12,7 +12,6 @@ PKG_BUILD_DIR ?= $(BUILD_DIR)/$(if $(BUILD_VARIANT),$(PKG_NAME)-$(BUILD_VARIANT) PKG_INSTALL_DIR ?= $(PKG_BUILD_DIR)/ipkg-install PKG_BUILD_PARALLEL ?= PKG_USE_MIPS16 ?= 1 -PKG_IREMAP ?= 1 PKG_SKIP_DOWNLOAD=$(USE_SOURCE_DIR)$(USE_GIT_TREE)$(USE_GIT_SRC_CHECKOUT) MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) $(if $(filter 3.% 4.0 4.1,$(MAKE_VERSION)),-j)) @@ -30,7 +29,20 @@ ifdef CONFIG_USE_MIPS16 TARGET_CFLAGS += -mips16 -minterlink-mips16 endif endif -ifeq ($(strip $(PKG_IREMAP)),1) + +PKG_BUILD_FLAGS?= + +__unknown_flags=$(filter-out no-iremap,$(PKG_BUILD_FLAGS)) +ifneq ($(__unknown_flags),) + $(error unknown PKG_BUILD_FLAGS: $(__unknown_flags)) +endif + +# $1=flagname, $2=default (0/1) +define pkg_build_flag +$(if $(filter no-$(1),$(PKG_BUILD_FLAGS)),0,$(if $(filter $(1),$(PKG_BUILD_FLAGS)),1,$(2))) +endef + +ifeq ($(call pkg_build_flag,iremap,1),1) IREMAP_CFLAGS = $(call iremap,$(PKG_BUILD_DIR),$(notdir $(PKG_BUILD_DIR))) TARGET_CFLAGS += $(IREMAP_CFLAGS) endif From 5c545bdb365a78b8995ddfa441a6018f7ff3c011 Mon Sep 17 00:00:00 2001 From: Andre Heider Date: Thu, 2 Feb 2023 20:02:25 +0100 Subject: [PATCH 05/26] treewide: replace PKG_USE_MIPS16:=0 with PKG_BUILD_FLAGS:=no-mips16 Keep backwards compatibility via PKG_USE_MIPS16 for now, as this is used in all package feeds. Signed-off-by: Andre Heider --- include/package.mk | 21 +++++++++++++-------- package/devel/binutils/Makefile | 2 +- package/devel/perf/Makefile | 2 +- package/devel/trace-cmd/Makefile | 2 +- package/devel/valgrind/Makefile | 2 +- package/kernel/broadcom-wl/Makefile | 2 +- package/libs/elfutils/Makefile | 1 - package/libs/gmp/Makefile | 2 +- package/libs/libaudit/Makefile | 2 +- package/libs/mbedtls/Makefile | 2 +- package/libs/nettle/Makefile | 2 +- package/libs/openssl/Makefile | 2 +- package/libs/wolfssl/Makefile | 2 +- package/network/services/dropbear/Makefile | 2 +- package/network/utils/bpftools/Makefile | 2 +- package/system/fstools/Makefile | 2 +- package/system/usign/Makefile | 2 +- package/utils/px5g-mbedtls/Makefile | 2 +- package/utils/px5g-wolfssl/Makefile | 2 +- 19 files changed, 30 insertions(+), 26 deletions(-) diff --git a/include/package.mk b/include/package.mk index 8d14c17dbd..a1717a603d 100644 --- a/include/package.mk +++ b/include/package.mk @@ -11,7 +11,6 @@ include $(INCLUDE_DIR)/download.mk PKG_BUILD_DIR ?= $(BUILD_DIR)/$(if $(BUILD_VARIANT),$(PKG_NAME)-$(BUILD_VARIANT)/)$(PKG_NAME)$(if $(PKG_VERSION),-$(PKG_VERSION)) PKG_INSTALL_DIR ?= $(PKG_BUILD_DIR)/ipkg-install PKG_BUILD_PARALLEL ?= -PKG_USE_MIPS16 ?= 1 PKG_SKIP_DOWNLOAD=$(USE_SOURCE_DIR)$(USE_GIT_TREE)$(USE_GIT_SRC_CHECKOUT) MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) $(if $(filter 3.% 4.0 4.1,$(MAKE_VERSION)),-j)) @@ -23,16 +22,15 @@ PKG_JOBS?=-j1 else PKG_JOBS?=$(if $(PKG_BUILD_PARALLEL),$(MAKE_J),-j1) endif -ifdef CONFIG_USE_MIPS16 - ifeq ($(strip $(PKG_USE_MIPS16)),1) - TARGET_ASFLAGS_DEFAULT = $(filter-out -mips16 -minterlink-mips16,$(TARGET_CFLAGS)) - TARGET_CFLAGS += -mips16 -minterlink-mips16 - endif -endif PKG_BUILD_FLAGS?= +# TODO remove this when all packages moved to PKG_BUILD_FLAGS=no-mips16 +PKG_USE_MIPS16?=1 +ifneq ($(strip $(PKG_USE_MIPS16)),1) + PKG_BUILD_FLAGS+=no-mips16 +endif -__unknown_flags=$(filter-out no-iremap,$(PKG_BUILD_FLAGS)) +__unknown_flags=$(filter-out no-iremap no-mips16,$(PKG_BUILD_FLAGS)) ifneq ($(__unknown_flags),) $(error unknown PKG_BUILD_FLAGS: $(__unknown_flags)) endif @@ -46,6 +44,13 @@ ifeq ($(call pkg_build_flag,iremap,1),1) IREMAP_CFLAGS = $(call iremap,$(PKG_BUILD_DIR),$(notdir $(PKG_BUILD_DIR))) TARGET_CFLAGS += $(IREMAP_CFLAGS) endif +ifdef CONFIG_USE_MIPS16 + ifeq ($(call pkg_build_flag,mips16,1),1) + TARGET_ASFLAGS_DEFAULT = $(filter-out -mips16 -minterlink-mips16,$(TARGET_CFLAGS)) + TARGET_CFLAGS += -mips16 -minterlink-mips16 + TARGET_CXXFLAGS += -mips16 -minterlink-mips16 + endif +endif include $(INCLUDE_DIR)/hardening.mk include $(INCLUDE_DIR)/prereq.mk diff --git a/package/devel/binutils/Makefile b/package/devel/binutils/Makefile index 5166f26734..8547190e99 100644 --- a/package/devel/binutils/Makefile +++ b/package/devel/binutils/Makefile @@ -25,7 +25,7 @@ PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-3.0+ PKG_CPE_ID:=cpe:/a:gnu:binutils PKG_BUILD_PARALLEL:=1 -PKG_USE_MIPS16:=0 +PKG_BUILD_FLAGS:=no-mips16 include $(INCLUDE_DIR)/nls.mk include $(INCLUDE_DIR)/package.mk diff --git a/package/devel/perf/Makefile b/package/devel/perf/Makefile index d556e2d9f0..c0b2046bd6 100644 --- a/package/devel/perf/Makefile +++ b/package/devel/perf/Makefile @@ -12,7 +12,7 @@ PKG_NAME:=perf PKG_VERSION:=$(LINUX_VERSION) PKG_RELEASE:=4 -PKG_USE_MIPS16:=0 +PKG_BUILD_FLAGS:=no-mips16 PKG_BUILD_PARALLEL:=1 PKG_MAINTAINER:=Felix Fietkau PKG_FLAGS:=nonshared diff --git a/package/devel/trace-cmd/Makefile b/package/devel/trace-cmd/Makefile index eac281820f..687907acaa 100644 --- a/package/devel/trace-cmd/Makefile +++ b/package/devel/trace-cmd/Makefile @@ -12,7 +12,7 @@ PKG_LICENSE:=GPL-2.0-only PKG_LICENSE_FILES:=COPYING PKG_INSTALL:=1 -PKG_USE_MIPS16:=0 +PKG_BUILD_FLAGS:=no-mips16 PKG_BUILD_PARALLEL:=1 include $(INCLUDE_DIR)/package.mk diff --git a/package/devel/valgrind/Makefile b/package/devel/valgrind/Makefile index bbd01ce37d..372a720d01 100644 --- a/package/devel/valgrind/Makefile +++ b/package/devel/valgrind/Makefile @@ -22,7 +22,7 @@ PKG_CPE_ID:=cpe:/a:valgrind:valgrind PKG_FIXUP = autoreconf PKG_INSTALL := 1 PKG_BUILD_PARALLEL := 1 -PKG_USE_MIPS16:=0 +PKG_BUILD_FLAGS:=no-mips16 PKG_SSP:=0 STRIP:=: diff --git a/package/kernel/broadcom-wl/Makefile b/package/kernel/broadcom-wl/Makefile index 137e547bee..fe8045d4a9 100644 --- a/package/kernel/broadcom-wl/Makefile +++ b/package/kernel/broadcom-wl/Makefile @@ -24,7 +24,7 @@ endif PKG_EXTMOD_SUBDIRS:=driver driver-mini glue -PKG_USE_MIPS16:=0 +PKG_BUILD_FLAGS:=no-mips16 PKG_FLAGS:=nonshared include $(INCLUDE_DIR)/package.mk diff --git a/package/libs/elfutils/Makefile b/package/libs/elfutils/Makefile index 2c68a94ba0..f7364c36be 100644 --- a/package/libs/elfutils/Makefile +++ b/package/libs/elfutils/Makefile @@ -21,7 +21,6 @@ PKG_CPE_ID:=cpe:/a:elfutils_project:elfutils PKG_FIXUP:=autoreconf PKG_INSTALL:=1 -PKG_USE_MIPS16:=1 PKG_BUILD_DEPENDS:=!USE_GLIBC:argp-standalone include $(INCLUDE_DIR)/package.mk diff --git a/package/libs/gmp/Makefile b/package/libs/gmp/Makefile index eb7d808139..c9f886e764 100644 --- a/package/libs/gmp/Makefile +++ b/package/libs/gmp/Makefile @@ -20,7 +20,7 @@ PKG_INSTALL:=1 PKG_FIXUP:=autoreconf PKG_LICENSE:=GPL-2.0-or-later -PKG_USE_MIPS16:=0 +PKG_BUILD_FLAGS:=no-mips16 include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/package.mk diff --git a/package/libs/libaudit/Makefile b/package/libs/libaudit/Makefile index 13263c7deb..0d79c25365 100644 --- a/package/libs/libaudit/Makefile +++ b/package/libs/libaudit/Makefile @@ -22,7 +22,7 @@ PKG_CPE_ID:=cpe:/a:linux_audit_project:linux_audit PKG_FIXUP:=autoreconf -PKG_USE_MIPS16:=0 +PKG_BUILD_FLAGS:=no-mips16 PKG_INSTALL:=1 include $(INCLUDE_DIR)/package.mk diff --git a/package/libs/mbedtls/Makefile b/package/libs/mbedtls/Makefile index 02d076d18f..7c167e2296 100644 --- a/package/libs/mbedtls/Makefile +++ b/package/libs/mbedtls/Makefile @@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mbedtls PKG_VERSION:=2.28.2 PKG_RELEASE:=2 -PKG_USE_MIPS16:=0 +PKG_BUILD_FLAGS:=no-mips16 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/ARMmbed/mbedtls/tar.gz/v$(PKG_VERSION)? diff --git a/package/libs/nettle/Makefile b/package/libs/nettle/Makefile index 8825da4be7..87eff5a1ec 100644 --- a/package/libs/nettle/Makefile +++ b/package/libs/nettle/Makefile @@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=nettle PKG_VERSION:=3.8.1 PKG_RELEASE:=$(AUTORELEASE) -PKG_USE_MIPS16:=0 +PKG_BUILD_FLAGS:=no-mips16 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@GNU/nettle diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile index 57ff056e90..7918d40347 100644 --- a/package/libs/openssl/Makefile +++ b/package/libs/openssl/Makefile @@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=openssl PKG_VERSION:=3.0.8 PKG_RELEASE:=4 -PKG_USE_MIPS16:=0 +PKG_BUILD_FLAGS:=no-mips16 PKG_BUILD_PARALLEL:=1 diff --git a/package/libs/wolfssl/Makefile b/package/libs/wolfssl/Makefile index 6ad44a9acf..48e85b0bce 100644 --- a/package/libs/wolfssl/Makefile +++ b/package/libs/wolfssl/Makefile @@ -17,7 +17,7 @@ PKG_HASH:=b7ee150e49def77c765bc02aac92ddeb0bebefd4cb12aa263d8f95e405221fb8 PKG_FIXUP:=libtool libtool-abiver PKG_INSTALL:=1 -PKG_USE_MIPS16:=0 +PKG_BUILD_FLAGS:=no-mips16 PKG_BUILD_PARALLEL:=1 PKG_LICENSE:=GPL-2.0-or-later PKG_LICENSE_FILES:=LICENSING COPYING diff --git a/package/network/services/dropbear/Makefile b/package/network/services/dropbear/Makefile index eaf14c5533..ddd19bfa55 100644 --- a/package/network/services/dropbear/Makefile +++ b/package/network/services/dropbear/Makefile @@ -23,7 +23,7 @@ PKG_CPE_ID:=cpe:/a:matt_johnston:dropbear_ssh_server PKG_BUILD_PARALLEL:=1 PKG_ASLR_PIE_REGULAR:=1 -PKG_USE_MIPS16:=0 +PKG_BUILD_FLAGS:=no-mips16 PKG_FIXUP:=autoreconf PKG_FLAGS:=nonshared diff --git a/package/network/utils/bpftools/Makefile b/package/network/utils/bpftools/Makefile index a1ae22b93f..047d2a0967 100644 --- a/package/network/utils/bpftools/Makefile +++ b/package/network/utils/bpftools/Makefile @@ -19,7 +19,7 @@ PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE)) PKG_MAINTAINER:=Tony Ambardar -PKG_USE_MIPS16:=0 +PKG_BUILD_FLAGS:=no-mips16 PKG_BUILD_PARALLEL:=1 PKG_INSTALL:=1 diff --git a/package/system/fstools/Makefile b/package/system/fstools/Makefile index 912ed80ba2..379f5d8c9d 100644 --- a/package/system/fstools/Makefile +++ b/package/system/fstools/Makefile @@ -20,7 +20,7 @@ CMAKE_INSTALL:=1 PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:= -PKG_USE_MIPS16:=0 +PKG_BUILD_FLAGS:=no-mips16 PKG_FLAGS:=nonshared PKG_BUILD_DEPENDS := util-linux diff --git a/package/system/usign/Makefile b/package/system/usign/Makefile index 5267ce15f3..0d2d07017c 100644 --- a/package/system/usign/Makefile +++ b/package/system/usign/Makefile @@ -10,7 +10,7 @@ PKG_SOURCE_VERSION:=f1f65026a94137c91b5466b149ef3ea3f20091e9 PKG_MIRROR_HASH:=3f6569a5e63fdfd032976ac0f79d736d3935101ac1b97fb370514b013c5e6bb6 CMAKE_INSTALL:=1 PKG_CHECK_FORMAT_SECURITY:=1 -PKG_USE_MIPS16:=0 +PKG_BUILD_FLAGS:=no-mips16 PKG_LICENSE:=ISC PKG_LICENSE_FILES:= diff --git a/package/utils/px5g-mbedtls/Makefile b/package/utils/px5g-mbedtls/Makefile index 42ffd39ce3..6de5e55d06 100644 --- a/package/utils/px5g-mbedtls/Makefile +++ b/package/utils/px5g-mbedtls/Makefile @@ -11,7 +11,7 @@ PKG_NAME:=px5g-mbedtls PKG_RELEASE:=9 PKG_LICENSE:=LGPL-2.1 -PKG_USE_MIPS16:=0 +PKG_BUILD_FLAGS:=no-mips16 PKG_MAINTAINER:=Jo-Philipp Wich diff --git a/package/utils/px5g-wolfssl/Makefile b/package/utils/px5g-wolfssl/Makefile index 687a999ca7..be2d4af30c 100644 --- a/package/utils/px5g-wolfssl/Makefile +++ b/package/utils/px5g-wolfssl/Makefile @@ -8,7 +8,7 @@ PKG_NAME:=px5g-wolfssl PKG_RELEASE:=$(COMMITCOUNT).2 PKG_LICENSE:=GPL-2.0-or-later -PKG_USE_MIPS16:=0 +PKG_BUILD_FLAGS:=no-mips16 PKG_MAINTAINER:=Paul Spooren From da3700988d9e34e380bae21ee23d5458a7e972b4 Mon Sep 17 00:00:00 2001 From: Andre Heider Date: Thu, 2 Feb 2023 21:16:21 +0100 Subject: [PATCH 06/26] treewide: add support for "gc-sections" in PKG_BUILD_FLAGS This reduces open coding and allows to easily add a knob to enable it treewide, where chosen packages can still opt-out via "no-gc-sections". Note: libnl, mbedtls and opkg only used the CFLAGS part without the LDFLAGS counterpart. That doesn't help at all if the goal is to produce smaller binaries. I consider that an accident, and this fixes it. Note: there are also packages using only the LDFLAGS part. I didn't touch those, as gc might have been disabled via CFLAGS intentionally. Signed-off-by: Andre Heider --- include/package.mk | 7 ++++++- package/boot/kexec-tools/Makefile | 5 ++--- package/libs/libevent2/Makefile | 6 ++++-- package/libs/libnl/Makefile | 4 +++- package/libs/mbedtls/Makefile | 3 +-- package/libs/openssl/Makefile | 5 ++--- package/network/config/firewall/Makefile | 6 ++++-- package/network/services/dropbear/Makefile | 6 +++--- package/network/services/hostapd/Makefile | 6 ++++-- package/network/services/ppp/Makefile | 5 +++-- package/network/utils/iproute2/Makefile | 6 ++++-- package/network/utils/iptables/Makefile | 5 +---- package/network/utils/iw/Makefile | 6 ++++-- package/network/utils/tcpdump/Makefile | 4 +--- package/network/utils/umbim/Makefile | 5 ++--- package/network/utils/uqmi/Makefile | 5 +---- package/system/opkg/Makefile | 3 ++- package/utils/e2fsprogs/Makefile | 4 ++-- package/utils/mdadm/Makefile | 4 +--- package/utils/mtd-utils/Makefile | 4 +--- 20 files changed, 51 insertions(+), 48 deletions(-) diff --git a/include/package.mk b/include/package.mk index a1717a603d..4d97cda00f 100644 --- a/include/package.mk +++ b/include/package.mk @@ -30,7 +30,7 @@ ifneq ($(strip $(PKG_USE_MIPS16)),1) PKG_BUILD_FLAGS+=no-mips16 endif -__unknown_flags=$(filter-out no-iremap no-mips16,$(PKG_BUILD_FLAGS)) +__unknown_flags=$(filter-out no-iremap no-mips16 gc-sections no-gc-sections,$(PKG_BUILD_FLAGS)) ifneq ($(__unknown_flags),) $(error unknown PKG_BUILD_FLAGS: $(__unknown_flags)) endif @@ -51,6 +51,11 @@ ifdef CONFIG_USE_MIPS16 TARGET_CXXFLAGS += -mips16 -minterlink-mips16 endif endif +ifeq ($(call pkg_build_flag,gc-sections,0),1) + TARGET_CFLAGS+= -ffunction-sections -fdata-sections + TARGET_CXXFLAGS+= -ffunction-sections -fdata-sections + TARGET_LDFLAGS+= -Wl,--gc-sections +endif include $(INCLUDE_DIR)/hardening.mk include $(INCLUDE_DIR)/prereq.mk diff --git a/package/boot/kexec-tools/Makefile b/package/boot/kexec-tools/Makefile index 0cb7688a24..7f06ec7d64 100644 --- a/package/boot/kexec-tools/Makefile +++ b/package/boot/kexec-tools/Makefile @@ -17,6 +17,8 @@ PKG_HASH:=7fe36a064101cd5c515e41b2be393dce3ca88adce59d6ee668e0af7c0c4570cd PKG_CONFIG_DEPENDS := CONFIG_KEXEC_ZLIB CONFIG_KEXEC_LZMA +PKG_BUILD_FLAGS:=gc-sections + include $(INCLUDE_DIR)/package.mk define Package/kexec-tools/Default @@ -82,9 +84,6 @@ CONFIGURE_ARGS = \ $(if $(CONFIG_KEXEC_LZMA),--with,--without)-lzma \ TARGET_LD="$(TARGET_CROSS)ld" -TARGET_CFLAGS += -ffunction-sections -fdata-sections -TARGET_LDFLAGS += -Wl,--gc-sections - CONFIGURE_VARS += \ BUILD_CC="$(HOSTCC)" \ TARGET_CC="$(TARGET_CC)" diff --git a/package/libs/libevent2/Makefile b/package/libs/libevent2/Makefile index 85c159c2a6..50dd19bf00 100644 --- a/package/libs/libevent2/Makefile +++ b/package/libs/libevent2/Makefile @@ -26,6 +26,8 @@ PKG_CONFIG_DEPENDS:= \ CONFIG_PACKAGE_libevent2-pthreads \ CONFIG_PACKAGE_libevent2-mbedtls +PKG_BUILD_FLAGS:=gc-sections + include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/cmake.mk @@ -112,8 +114,8 @@ define Package/libevent2-pthreads/description threading & locking. endef -TARGET_CFLAGS += $(FPIC) -ffunction-sections -fdata-sections -flto -TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed -flto +TARGET_CFLAGS += $(FPIC) -flto +TARGET_LDFLAGS += -Wl,--as-needed -flto CMAKE_OPTIONS += \ -DEVENT__DISABLE_BENCHMARK:BOOL=ON \ diff --git a/package/libs/libnl/Makefile b/package/libs/libnl/Makefile index 71b043a9e5..56549dcc0a 100644 --- a/package/libs/libnl/Makefile +++ b/package/libs/libnl/Makefile @@ -20,6 +20,8 @@ PKG_CPE_ID:=cpe:/a:libnl_project:libnl PKG_INSTALL:=1 PKG_FIXUP:=autoreconf +PKG_BUILD_FLAGS:=gc-sections + include $(INCLUDE_DIR)/package.mk define Package/libnl/default @@ -80,7 +82,7 @@ define Package/libnl/description message construction and parsing, object caching system, etc. endef -TARGET_CFLAGS += -ffunction-sections -fdata-sections $(FPIC) +TARGET_CFLAGS += $(FPIC) CONFIGURE_ARGS += \ --disable-debug diff --git a/package/libs/mbedtls/Makefile b/package/libs/mbedtls/Makefile index 7c167e2296..f49bb24de6 100644 --- a/package/libs/mbedtls/Makefile +++ b/package/libs/mbedtls/Makefile @@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mbedtls PKG_VERSION:=2.28.2 PKG_RELEASE:=2 -PKG_BUILD_FLAGS:=no-mips16 +PKG_BUILD_FLAGS:=no-mips16 gc-sections PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/ARMmbed/mbedtls/tar.gz/v$(PKG_VERSION)? @@ -121,7 +121,6 @@ This package contains mbedtls helper programs for private key and CSR generation (gen_key, cert_req) endef -TARGET_CFLAGS += -ffunction-sections -fdata-sections TARGET_CFLAGS := $(filter-out -O%,$(TARGET_CFLAGS)) CMAKE_OPTIONS += \ diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile index 7918d40347..9fe5da9dd3 100644 --- a/package/libs/openssl/Makefile +++ b/package/libs/openssl/Makefile @@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=openssl PKG_VERSION:=3.0.8 PKG_RELEASE:=4 -PKG_BUILD_FLAGS:=no-mips16 +PKG_BUILD_FLAGS:=no-mips16 gc-sections PKG_BUILD_PARALLEL:=1 @@ -339,8 +339,7 @@ define Build/Configure ) endef -TARGET_CFLAGS += $(FPIC) -ffunction-sections -fdata-sections -TARGET_LDFLAGS += -Wl,--gc-sections +TARGET_CFLAGS += $(FPIC) define Build/Compile +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \ diff --git a/package/network/config/firewall/Makefile b/package/network/config/firewall/Makefile index e4a3ad97f7..95e2ae4b67 100644 --- a/package/network/config/firewall/Makefile +++ b/package/network/config/firewall/Makefile @@ -21,6 +21,8 @@ PKG_LICENSE:=ISC PKG_CONFIG_DEPENDS := CONFIG_IPV6 +PKG_BUILD_FLAGS:=gc-sections + include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/cmake.mk @@ -42,8 +44,8 @@ define Package/firewall/conffiles /etc/firewall.user endef -TARGET_CFLAGS += -ffunction-sections -fdata-sections -flto -TARGET_LDFLAGS += -Wl,--gc-sections -flto +TARGET_CFLAGS += -flto +TARGET_LDFLAGS += -flto CMAKE_OPTIONS += $(if $(CONFIG_IPV6),,-DDISABLE_IPV6=1) define Package/firewall/install diff --git a/package/network/services/dropbear/Makefile b/package/network/services/dropbear/Makefile index ddd19bfa55..1b3fdad067 100644 --- a/package/network/services/dropbear/Makefile +++ b/package/network/services/dropbear/Makefile @@ -23,7 +23,7 @@ PKG_CPE_ID:=cpe:/a:matt_johnston:dropbear_ssh_server PKG_BUILD_PARALLEL:=1 PKG_ASLR_PIE_REGULAR:=1 -PKG_BUILD_FLAGS:=no-mips16 +PKG_BUILD_FLAGS:=no-mips16 gc-sections PKG_FIXUP:=autoreconf PKG_FLAGS:=nonshared @@ -142,8 +142,8 @@ DB_OPT_CONFIG = \ DROPBEAR_SVR_AGENTFWD|CONFIG_DROPBEAR_AGENTFORWARD|1|0 \ -TARGET_CFLAGS += -DARGTYPE=3 -ffunction-sections -fdata-sections -flto -TARGET_LDFLAGS += -Wl,--gc-sections -flto=jobserver +TARGET_CFLAGS += -DARGTYPE=3 -flto +TARGET_LDFLAGS += -flto=jobserver db_opt_add =echo '\#define $(1) $(2)' >> $(PKG_BUILD_DIR)/localoptions.h db_opt_replace =$(ESED) 's,^(\#define $(1)) .*$$$$,\1 $(2),g' $(PKG_BUILD_DIR)/sysoptions.h diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index 889f145504..1b077530e1 100644 --- a/package/network/services/hostapd/Makefile +++ b/package/network/services/hostapd/Makefile @@ -32,6 +32,8 @@ PKG_CONFIG_DEPENDS:= \ CONFIG_DRIVER_11AX_SUPPORT \ CONFIG_WPA_ENABLE_WEP +PKG_BUILD_FLAGS:=gc-sections + EAPOL_TEST_PROVIDERS:=eapol-test eapol-test-openssl eapol-test-wolfssl SUPPLICANT_PROVIDERS:= @@ -585,8 +587,8 @@ TARGET_CPPFLAGS := \ -D_GNU_SOURCE \ $(if $(CONFIG_WPA_MSG_MIN_PRIORITY),-DCONFIG_MSG_MIN_PRIORITY=$(CONFIG_WPA_MSG_MIN_PRIORITY)) -TARGET_CFLAGS += -ffunction-sections -fdata-sections -flto -TARGET_LDFLAGS += -Wl,--gc-sections -flto=jobserver -fuse-linker-plugin -lubox -lubus +TARGET_CFLAGS += -flto +TARGET_LDFLAGS += -flto=jobserver -fuse-linker-plugin -lubox -lubus ifdef CONFIG_PACKAGE_kmod-cfg80211 TARGET_LDFLAGS += -lm -lnl-tiny diff --git a/package/network/services/ppp/Makefile b/package/network/services/ppp/Makefile index 8476204e14..48f2091a1f 100644 --- a/package/network/services/ppp/Makefile +++ b/package/network/services/ppp/Makefile @@ -26,6 +26,7 @@ PKG_VERSION:=$(PKG_RELEASE_VERSION).git-$(PKG_SOURCE_DATE) PKG_BUILD_DEPENDS:=libpcap PKG_ASLR_PIE_REGULAR:=1 +PKG_BUILD_FLAGS:=gc-sections PKG_BUILD_PARALLEL:=1 PKG_INSTALL:=1 @@ -192,8 +193,8 @@ $(call Build/Configure/Default,, \ $(PKG_BUILD_DIR)/pppd/plugins/pppoatm/linux/ endef -TARGET_CFLAGS += -ffunction-sections -fdata-sections -flto -TARGET_LDFLAGS += -Wl,--gc-sections -flto -fuse-linker-plugin +TARGET_CFLAGS += -flto +TARGET_LDFLAGS += -flto -fuse-linker-plugin MAKE_FLAGS += COPTS="$(TARGET_CFLAGS)" \ PRECOMPILED_FILTER=1 \ diff --git a/package/network/utils/iproute2/Makefile b/package/network/utils/iproute2/Makefile index 302d57bf8b..b3a809e0b5 100644 --- a/package/network/utils/iproute2/Makefile +++ b/package/network/utils/iproute2/Makefile @@ -19,6 +19,8 @@ PKG_BUILD_DEPENDS:=iptables PKG_LICENSE:=GPL-2.0 PKG_CPE_ID:=cpe:/a:iproute2_project:iproute2 +PKG_BUILD_FLAGS:=gc-sections + include $(INCLUDE_DIR)/kernel.mk include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/nls.mk @@ -171,8 +173,8 @@ define Build/Configure > $(PKG_BUILD_DIR)/include/SNAPSHOT.h endef -TARGET_CFLAGS += -ffunction-sections -fdata-sections -flto -TARGET_LDFLAGS += -Wl,--gc-sections -Wl,--as-needed +TARGET_CFLAGS += -flto +TARGET_LDFLAGS += -Wl,--as-needed TARGET_CPPFLAGS += -I$(STAGING_DIR)/usr/include/libnl-tiny MAKE_FLAGS += \ diff --git a/package/network/utils/iptables/Makefile b/package/network/utils/iptables/Makefile index e96cfa0b16..0d6d76fc08 100644 --- a/package/network/utils/iptables/Makefile +++ b/package/network/utils/iptables/Makefile @@ -20,6 +20,7 @@ PKG_FIXUP:=autoreconf PKG_FLAGS:=nonshared PKG_INSTALL:=1 +PKG_BUILD_FLAGS:=gc-sections PKG_BUILD_PARALLEL:=1 PKG_LICENSE:=GPL-2.0 PKG_CPE_ID:=cpe:/a:netfilter_core_team:iptables @@ -591,12 +592,8 @@ TARGET_CPPFLAGS := \ TARGET_CFLAGS += \ -I$(PKG_BUILD_DIR)/include \ -I$(LINUX_DIR)/user_headers/include \ - -ffunction-sections -fdata-sections \ -DNO_LEGACY -TARGET_LDFLAGS += \ - -Wl,--gc-sections - CONFIGURE_ARGS += \ --enable-shared \ --enable-static \ diff --git a/package/network/utils/iw/Makefile b/package/network/utils/iw/Makefile index eb3a9ba091..1eb3cd721a 100644 --- a/package/network/utils/iw/Makefile +++ b/package/network/utils/iw/Makefile @@ -18,6 +18,8 @@ PKG_HASH:=f167bbe947dd53bb9ebc0c1dcef5db6ad73ac1d6084f2c6f9376c5c360cc4d4e PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 +PKG_BUILD_FLAGS:=gc-sections + include $(INCLUDE_DIR)/package.mk define Package/iw @@ -55,8 +57,8 @@ ifeq ($(BUILD_VARIANT),full) endif MAKE_FLAGS += \ - CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -ffunction-sections -fdata-sections" \ - LDFLAGS="$(TARGET_LDFLAGS) -Wl,--gc-sections -flto" \ + CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \ + LDFLAGS="$(TARGET_LDFLAGS) -flto" \ NL1FOUND="" NL2FOUND=Y \ NLLIBNAME="libnl-tiny" \ LIBS="-lm -lnl-tiny" \ diff --git a/package/network/utils/tcpdump/Makefile b/package/network/utils/tcpdump/Makefile index 827a66e860..e07e9feb6d 100644 --- a/package/network/utils/tcpdump/Makefile +++ b/package/network/utils/tcpdump/Makefile @@ -20,6 +20,7 @@ PKG_LICENSE:=BSD-3-Clause PKG_CPE_ID:=cpe:/a:tcpdump:tcpdump PKG_INSTALL:=1 +PKG_BUILD_FLAGS:=gc-sections PKG_BUILD_PARALLEL:=1 include $(INCLUDE_DIR)/package.mk @@ -48,9 +49,6 @@ CONFIGURE_ARGS += \ --without-crypto \ $(call autoconf_bool,CONFIG_IPV6,ipv6) -TARGET_CFLAGS += -ffunction-sections -fdata-sections -TARGET_LDFLAGS += -Wl,--gc-sections - ifeq ($(BUILD_VARIANT),mini) TARGET_CFLAGS += -DTCPDUMP_MINI CONFIGURE_ARGS += --disable-smb diff --git a/package/network/utils/umbim/Makefile b/package/network/utils/umbim/Makefile index 3563949c67..1a09984a43 100644 --- a/package/network/utils/umbim/Makefile +++ b/package/network/utils/umbim/Makefile @@ -14,6 +14,7 @@ PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:= PKG_FLAGS:=nonshared +PKG_BUILD_FLAGS:=gc-sections include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/cmake.mk @@ -32,9 +33,7 @@ define Package/umbim/description endef TARGET_CFLAGS += \ - -I$(STAGING_DIR)/usr/include -ffunction-sections -fdata-sections - -TARGET_LDFLAGS += -Wl,--gc-sections + -I$(STAGING_DIR)/usr/include define Package/umbim/install $(INSTALL_DIR) $(1)/sbin diff --git a/package/network/utils/uqmi/Makefile b/package/network/utils/uqmi/Makefile index 02265d400c..989e7c11b6 100644 --- a/package/network/utils/uqmi/Makefile +++ b/package/network/utils/uqmi/Makefile @@ -14,6 +14,7 @@ PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:= PKG_FLAGS:=nonshared +PKG_BUILD_FLAGS:=gc-sections include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/cmake.mk @@ -33,13 +34,9 @@ endef TARGET_CFLAGS += \ -I$(STAGING_DIR)/usr/include \ - -ffunction-sections \ - -fdata-sections \ -Wno-error=dangling-pointer \ -Wno-error=maybe-uninitialized -TARGET_LDFLAGS += -Wl,--gc-sections - CMAKE_OPTIONS += \ -DDEBUG=1 diff --git a/package/system/opkg/Makefile b/package/system/opkg/Makefile index 83c9dab1b0..1841e190e6 100644 --- a/package/system/opkg/Makefile +++ b/package/system/opkg/Makefile @@ -28,6 +28,8 @@ PKG_CONFIG_DEPENDS += \ HOST_BUILD_DEPENDS:=libubox/host +PKG_BUILD_FLAGS:=gc-sections + include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/cmake.mk @@ -57,7 +59,6 @@ define Package/opkg/conffiles /etc/opkg/customfeeds.conf endef -TARGET_CFLAGS += -ffunction-sections -fdata-sections EXTRA_CFLAGS += $(TARGET_CPPFLAGS) CMAKE_OPTIONS += \ diff --git a/package/utils/e2fsprogs/Makefile b/package/utils/e2fsprogs/Makefile index e6c5cfe75c..cd9b10e175 100644 --- a/package/utils/e2fsprogs/Makefile +++ b/package/utils/e2fsprogs/Makefile @@ -23,6 +23,7 @@ PKG_BUILD_DEPENDS:=util-linux e2fsprogs/host PKG_INSTALL:=1 PKG_BUILD_PARALLEL:=1 +PKG_BUILD_FLAGS:=gc-sections include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/host-build.mk @@ -142,7 +143,7 @@ $(call Package/e2fsprogs) DEPENDS:= +e2fsprogs endef -TARGET_CFLAGS += $(FPIC) -ffunction-sections -fdata-sections -flto +TARGET_CFLAGS += $(FPIC) -flto TARGET_LDFLAGS += -flto @@ -171,7 +172,6 @@ define Build/Compile V=$(if $(findstring c,$(OPENWRT_VERBOSE)),1,) \ subst +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \ - LDFLAGS=-Wl,--gc-sections \ BUILDCC="$(HOSTCC)" \ DESTDIR="$(PKG_INSTALL_DIR)" \ ELF_OTHER_LIBS="$(TARGET_LDFLAGS) -luuid" \ diff --git a/package/utils/mdadm/Makefile b/package/utils/mdadm/Makefile index 553728194e..1828a88972 100644 --- a/package/utils/mdadm/Makefile +++ b/package/utils/mdadm/Makefile @@ -19,6 +19,7 @@ PKG_MAINTAINER:=Felix Fietkau PKG_CPE_ID:=cpe:/a:mdadm_project:mdadm PKG_BUILD_PARALLEL:=1 +PKG_BUILD_FLAGS:=gc-sections include $(INCLUDE_DIR)/package.mk @@ -43,7 +44,6 @@ define Package/mdadm/conffiles endef TARGET_CFLAGS += \ - -ffunction-sections -fdata-sections \ -DHAVE_STDINT_H -DNO_COROSYNC -DNO_DLM -DUSE_PTHREADS \ -DCONFFILE='\"/var/etc/mdadm.conf\"' \ -DMAP_DIR='\"/var/run/mdadm\"' \ @@ -53,8 +53,6 @@ TARGET_CFLAGS += \ TARGET_CXFLAGS = -DNO_LIBUDEV -TARGET_LDFLAGS += -Wl,--gc-sections - MAKE_FLAGS += \ CHECK_RUN_DIR=0 \ CXFLAGS="$(TARGET_CXFLAGS)" diff --git a/package/utils/mtd-utils/Makefile b/package/utils/mtd-utils/Makefile index afbfbceff5..bd53e071d5 100644 --- a/package/utils/mtd-utils/Makefile +++ b/package/utils/mtd-utils/Makefile @@ -19,6 +19,7 @@ PKG_INSTALL:=1 PKG_FIXUP:=autoreconf PKG_FLAGS:=nonshared +PKG_BUILD_FLAGS:=gc-sections PKG_BUILD_DEPENDS:=util-linux @@ -64,9 +65,6 @@ CONFIGURE_ARGS += \ --without-zstd \ --without-lzo -TARGET_CFLAGS += -ffunction-sections -fdata-sections -TARGET_LDFLAGS += -Wl,--gc-sections - define Package/ubi-utils/install $(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_BIN) \ From 07730ff3465d3cede3026cdd1c17453930f055ce Mon Sep 17 00:00:00 2001 From: Andre Heider Date: Thu, 2 Feb 2023 21:33:38 +0100 Subject: [PATCH 07/26] treewide: add support for "lto" in PKG_BUILD_FLAGS This reduces open coding and allows to easily add a knob to enable it treewide, where chosen packages can still opt-out via "no-lto". Some packages used LTO, but not the linker plugin. This unifies 'em all to attempt to produce better code. Quoting man gcc(1): "This improves the quality of optimization by exposing more code to the link-time optimizer." Also use -flto=auto instead of -flto=jobserver, as it's not guaranteed that every buildsystem uses +$(MAKE) correctly. Signed-off-by: Andre Heider --- include/package.mk | 7 ++++++- package/libs/jansson/Makefile | 5 ++--- package/libs/libevent2/Makefile | 6 +++--- package/libs/libnftnl/Makefile | 4 ++-- package/libs/wolfssl/Makefile | 5 +---- package/network/config/firewall/Makefile | 4 +--- package/network/config/netifd/Makefile | 7 +++---- package/network/config/swconfig/Makefile | 5 ++--- package/network/services/dnsmasq/Makefile | 4 +--- package/network/services/dropbear/Makefile | 5 ++--- package/network/services/hostapd/Makefile | 5 ++--- package/network/services/lldpd/Makefile | 4 ++-- package/network/services/ppp/Makefile | 5 +---- package/network/services/ustp/Makefile | 5 +++-- package/network/utils/iproute2/Makefile | 3 +-- package/network/utils/iw/Makefile | 7 +++---- package/network/utils/nftables/Makefile | 5 ++--- package/system/mtd/Makefile | 4 ++-- package/system/procd/Makefile | 4 +--- package/system/ubus/Makefile | 4 ++-- package/system/usign/Makefile | 5 +---- package/utils/busybox/Makefile | 4 +--- package/utils/e2fsprogs/Makefile | 6 ++---- 23 files changed, 46 insertions(+), 67 deletions(-) diff --git a/include/package.mk b/include/package.mk index 4d97cda00f..0fb947f035 100644 --- a/include/package.mk +++ b/include/package.mk @@ -30,7 +30,7 @@ ifneq ($(strip $(PKG_USE_MIPS16)),1) PKG_BUILD_FLAGS+=no-mips16 endif -__unknown_flags=$(filter-out no-iremap no-mips16 gc-sections no-gc-sections,$(PKG_BUILD_FLAGS)) +__unknown_flags=$(filter-out no-iremap no-mips16 gc-sections no-gc-sections lto no-lto,$(PKG_BUILD_FLAGS)) ifneq ($(__unknown_flags),) $(error unknown PKG_BUILD_FLAGS: $(__unknown_flags)) endif @@ -56,6 +56,11 @@ ifeq ($(call pkg_build_flag,gc-sections,0),1) TARGET_CXXFLAGS+= -ffunction-sections -fdata-sections TARGET_LDFLAGS+= -Wl,--gc-sections endif +ifeq ($(call pkg_build_flag,lto,0),1) + TARGET_CFLAGS+= -flto=auto -fno-fat-lto-objects + TARGET_CXXFLAGS+= -flto=auto -fno-fat-lto-objects + TARGET_LDFLAGS+= -flto=auto -fuse-linker-plugin +endif include $(INCLUDE_DIR)/hardening.mk include $(INCLUDE_DIR)/prereq.mk diff --git a/package/libs/jansson/Makefile b/package/libs/jansson/Makefile index d8567ed79a..e2b5206acb 100644 --- a/package/libs/jansson/Makefile +++ b/package/libs/jansson/Makefile @@ -19,6 +19,8 @@ PKG_LICENSE:=MIT PKG_LICENSE_FILES:=LICENSE PKG_CPE_ID:=cpe:/a:jansson_project:jansson +PKG_BUILD_FLAGS:=lto + include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/cmake.mk @@ -41,9 +43,6 @@ define Package/jansson/description Jansson is a C library for encoding, decoding and manipulating JSON data endef -TARGET_CFLAGS += -flto -TARGET_LDFLAGS += -flto - define Package/jansson/install $(INSTALL_DIR) $(1)/usr/lib $(CP) $(PKG_INSTALL_DIR)/usr/lib/libjansson*so.* $(1)/usr/lib/ diff --git a/package/libs/libevent2/Makefile b/package/libs/libevent2/Makefile index 50dd19bf00..92602607ae 100644 --- a/package/libs/libevent2/Makefile +++ b/package/libs/libevent2/Makefile @@ -26,7 +26,7 @@ PKG_CONFIG_DEPENDS:= \ CONFIG_PACKAGE_libevent2-pthreads \ CONFIG_PACKAGE_libevent2-mbedtls -PKG_BUILD_FLAGS:=gc-sections +PKG_BUILD_FLAGS:=gc-sections lto include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/cmake.mk @@ -114,8 +114,8 @@ define Package/libevent2-pthreads/description threading & locking. endef -TARGET_CFLAGS += $(FPIC) -flto -TARGET_LDFLAGS += -Wl,--as-needed -flto +TARGET_CFLAGS += $(FPIC) +TARGET_LDFLAGS += -Wl,--as-needed CMAKE_OPTIONS += \ -DEVENT__DISABLE_BENCHMARK:BOOL=ON \ diff --git a/package/libs/libnftnl/Makefile b/package/libs/libnftnl/Makefile index f92fb91eea..8d8c8c25e3 100644 --- a/package/libs/libnftnl/Makefile +++ b/package/libs/libnftnl/Makefile @@ -22,6 +22,7 @@ PKG_LICENSE_FILES:=COPYING PKG_INSTALL:=1 PKG_BUILD_PARALLEL:=1 +PKG_BUILD_FLAGS:=lto include $(INCLUDE_DIR)/package.mk @@ -41,8 +42,7 @@ define Package/libnftnl/description programming interface (API) to the in-kernel nf_tables subsystem. endef -TARGET_CFLAGS += $(FPIC) -flto -TARGET_LDFLAGS += -flto +TARGET_CFLAGS += $(FPIC) CONFIGURE_ARGS += \ --enable-static \ diff --git a/package/libs/wolfssl/Makefile b/package/libs/wolfssl/Makefile index 48e85b0bce..04d9d3ef66 100644 --- a/package/libs/wolfssl/Makefile +++ b/package/libs/wolfssl/Makefile @@ -17,7 +17,7 @@ PKG_HASH:=b7ee150e49def77c765bc02aac92ddeb0bebefd4cb12aa263d8f95e405221fb8 PKG_FIXUP:=libtool libtool-abiver PKG_INSTALL:=1 -PKG_BUILD_FLAGS:=no-mips16 +PKG_BUILD_FLAGS:=no-mips16 lto PKG_BUILD_PARALLEL:=1 PKG_LICENSE:=GPL-2.0-or-later PKG_LICENSE_FILES:=LICENSING COPYING @@ -118,12 +118,9 @@ endef TARGET_CFLAGS += \ $(FPIC) \ -fomit-frame-pointer \ - -flto \ -DFP_MAX_BITS=8192 \ $(if $(CONFIG_WOLFSSL_ALT_NAMES),-DWOLFSSL_ALT_NAMES) -TARGET_LDFLAGS += -flto - # --enable-stunnel needed for OpenSSL API compatibility bits CONFIGURE_ARGS += \ --enable-reproducible-build \ diff --git a/package/network/config/firewall/Makefile b/package/network/config/firewall/Makefile index 95e2ae4b67..0e00f38689 100644 --- a/package/network/config/firewall/Makefile +++ b/package/network/config/firewall/Makefile @@ -21,7 +21,7 @@ PKG_LICENSE:=ISC PKG_CONFIG_DEPENDS := CONFIG_IPV6 -PKG_BUILD_FLAGS:=gc-sections +PKG_BUILD_FLAGS:=gc-sections lto include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/cmake.mk @@ -44,8 +44,6 @@ define Package/firewall/conffiles /etc/firewall.user endef -TARGET_CFLAGS += -flto -TARGET_LDFLAGS += -flto CMAKE_OPTIONS += $(if $(CONFIG_IPV6),,-DDISABLE_IPV6=1) define Package/firewall/install diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile index d9d1bce26f..9b5fb08ab0 100644 --- a/package/network/config/netifd/Makefile +++ b/package/network/config/netifd/Makefile @@ -13,6 +13,8 @@ PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:= +PKG_BUILD_FLAGS:=lto + include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/cmake.mk @@ -30,10 +32,7 @@ endef TARGET_CFLAGS += \ -I$(STAGING_DIR)/usr/include/libnl-tiny \ - -I$(STAGING_DIR)/usr/include \ - -flto - -TARGET_LDFLAGS += -flto -fuse-linker-plugin + -I$(STAGING_DIR)/usr/include CMAKE_OPTIONS += \ -DLIBNL_LIBS=-lnl-tiny \ diff --git a/package/network/config/swconfig/Makefile b/package/network/config/swconfig/Makefile index 4d3e572d82..6549075e5c 100644 --- a/package/network/config/swconfig/Makefile +++ b/package/network/config/swconfig/Makefile @@ -13,6 +13,8 @@ PKG_RELEASE:=12 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 +PKG_BUILD_FLAGS:=lto + include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/kernel.mk @@ -23,9 +25,6 @@ define Package/swconfig TITLE:=Switch configuration utility endef -TARGET_CFLAGS += -flto -TARGET_LDFLAGS += -flto=jobserver - TARGET_CPPFLAGS := \ -D_GNU_SOURCE \ -I$(STAGING_DIR)/usr/include/libnl-tiny \ diff --git a/package/network/services/dnsmasq/Makefile b/package/network/services/dnsmasq/Makefile index f555712a7f..d8e2e29a87 100644 --- a/package/network/services/dnsmasq/Makefile +++ b/package/network/services/dnsmasq/Makefile @@ -24,6 +24,7 @@ PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_UPSTR PKG_INSTALL:=1 PKG_BUILD_PARALLEL:=1 +PKG_BUILD_FLAGS:=lto PKG_ASLR_PIE_REGULAR:=1 PKG_CONFIG_DEPENDS:= CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_dhcp \ CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_dhcpv6 \ @@ -133,9 +134,6 @@ endef Package/dnsmasq-dhcpv6/conffiles = $(Package/dnsmasq/conffiles) Package/dnsmasq-full/conffiles = $(Package/dnsmasq/conffiles) -TARGET_CFLAGS += -flto -TARGET_LDFLAGS += -flto=jobserver - COPTS = -DHAVE_UBUS -DHAVE_POLL_H \ $(if $(CONFIG_IPV6),,-DNO_IPV6) diff --git a/package/network/services/dropbear/Makefile b/package/network/services/dropbear/Makefile index 1b3fdad067..f05248054e 100644 --- a/package/network/services/dropbear/Makefile +++ b/package/network/services/dropbear/Makefile @@ -23,7 +23,7 @@ PKG_CPE_ID:=cpe:/a:matt_johnston:dropbear_ssh_server PKG_BUILD_PARALLEL:=1 PKG_ASLR_PIE_REGULAR:=1 -PKG_BUILD_FLAGS:=no-mips16 gc-sections +PKG_BUILD_FLAGS:=no-mips16 gc-sections lto PKG_FIXUP:=autoreconf PKG_FLAGS:=nonshared @@ -142,8 +142,7 @@ DB_OPT_CONFIG = \ DROPBEAR_SVR_AGENTFWD|CONFIG_DROPBEAR_AGENTFORWARD|1|0 \ -TARGET_CFLAGS += -DARGTYPE=3 -flto -TARGET_LDFLAGS += -flto=jobserver +TARGET_CFLAGS += -DARGTYPE=3 db_opt_add =echo '\#define $(1) $(2)' >> $(PKG_BUILD_DIR)/localoptions.h db_opt_replace =$(ESED) 's,^(\#define $(1)) .*$$$$,\1 $(2),g' $(PKG_BUILD_DIR)/sysoptions.h diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index 1b077530e1..f184830be3 100644 --- a/package/network/services/hostapd/Makefile +++ b/package/network/services/hostapd/Makefile @@ -32,7 +32,7 @@ PKG_CONFIG_DEPENDS:= \ CONFIG_DRIVER_11AX_SUPPORT \ CONFIG_WPA_ENABLE_WEP -PKG_BUILD_FLAGS:=gc-sections +PKG_BUILD_FLAGS:=gc-sections lto EAPOL_TEST_PROVIDERS:=eapol-test eapol-test-openssl eapol-test-wolfssl @@ -587,8 +587,7 @@ TARGET_CPPFLAGS := \ -D_GNU_SOURCE \ $(if $(CONFIG_WPA_MSG_MIN_PRIORITY),-DCONFIG_MSG_MIN_PRIORITY=$(CONFIG_WPA_MSG_MIN_PRIORITY)) -TARGET_CFLAGS += -flto -TARGET_LDFLAGS += -flto=jobserver -fuse-linker-plugin -lubox -lubus +TARGET_LDFLAGS += -lubox -lubus ifdef CONFIG_PACKAGE_kmod-cfg80211 TARGET_LDFLAGS += -lm -lnl-tiny diff --git a/package/network/services/lldpd/Makefile b/package/network/services/lldpd/Makefile index a08626366f..c3753534a6 100644 --- a/package/network/services/lldpd/Makefile +++ b/package/network/services/lldpd/Makefile @@ -21,6 +21,7 @@ PKG_CPE_ID:=cpe:/a:lldpd_project:lldpd PKG_FIXUP:=autoreconf PKG_BUILD_PARALLEL:=1 +PKG_BUILD_FLAGS:=lto PKG_INSTALL:=1 include $(INCLUDE_DIR)/package.mk @@ -111,7 +112,6 @@ CONFIGURE_ARGS += \ $(if $(CONFIG_LLDPD_WITH_SNMP),--with-snmp,) \ $(if $(CONFIG_USE_GLIBC),,--without-libbsd) -TARGET_CFLAGS += -flto -TARGET_LDFLAGS += -flto -Wl,--gc-sections,--as-needed +TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed $(eval $(call BuildPackage,lldpd)) diff --git a/package/network/services/ppp/Makefile b/package/network/services/ppp/Makefile index 48f2091a1f..80d5e46c34 100644 --- a/package/network/services/ppp/Makefile +++ b/package/network/services/ppp/Makefile @@ -26,7 +26,7 @@ PKG_VERSION:=$(PKG_RELEASE_VERSION).git-$(PKG_SOURCE_DATE) PKG_BUILD_DEPENDS:=libpcap PKG_ASLR_PIE_REGULAR:=1 -PKG_BUILD_FLAGS:=gc-sections +PKG_BUILD_FLAGS:=gc-sections lto PKG_BUILD_PARALLEL:=1 PKG_INSTALL:=1 @@ -193,9 +193,6 @@ $(call Build/Configure/Default,, \ $(PKG_BUILD_DIR)/pppd/plugins/pppoatm/linux/ endef -TARGET_CFLAGS += -flto -TARGET_LDFLAGS += -flto -fuse-linker-plugin - MAKE_FLAGS += COPTS="$(TARGET_CFLAGS)" \ PRECOMPILED_FILTER=1 \ STAGING_DIR="$(STAGING_DIR)" diff --git a/package/network/services/ustp/Makefile b/package/network/services/ustp/Makefile index 88bc993bb6..2cdd033754 100644 --- a/package/network/services/ustp/Makefile +++ b/package/network/services/ustp/Makefile @@ -19,6 +19,8 @@ PKG_MIRROR_HASH:=0e96edc983cf437b95874e5715d743f30bb826d8757dc3771ff872ab9cf18f3 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 +PKG_BUILD_FLAGS:=lto + include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/cmake.mk @@ -29,8 +31,7 @@ define Package/ustp DEPENDS:=+libubox +libubus endef -TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include -flto -TARGET_LDFLAGS += -flto -fuse-linker-plugin +TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include define Package/ustp/install $(INSTALL_DIR) $(1)/sbin $(1)/etc/init.d diff --git a/package/network/utils/iproute2/Makefile b/package/network/utils/iproute2/Makefile index b3a809e0b5..2cd14fe83d 100644 --- a/package/network/utils/iproute2/Makefile +++ b/package/network/utils/iproute2/Makefile @@ -19,7 +19,7 @@ PKG_BUILD_DEPENDS:=iptables PKG_LICENSE:=GPL-2.0 PKG_CPE_ID:=cpe:/a:iproute2_project:iproute2 -PKG_BUILD_FLAGS:=gc-sections +PKG_BUILD_FLAGS:=gc-sections lto include $(INCLUDE_DIR)/kernel.mk include $(INCLUDE_DIR)/package.mk @@ -173,7 +173,6 @@ define Build/Configure > $(PKG_BUILD_DIR)/include/SNAPSHOT.h endef -TARGET_CFLAGS += -flto TARGET_LDFLAGS += -Wl,--as-needed TARGET_CPPFLAGS += -I$(STAGING_DIR)/usr/include/libnl-tiny diff --git a/package/network/utils/iw/Makefile b/package/network/utils/iw/Makefile index 1eb3cd721a..746c2c3c12 100644 --- a/package/network/utils/iw/Makefile +++ b/package/network/utils/iw/Makefile @@ -18,7 +18,7 @@ PKG_HASH:=f167bbe947dd53bb9ebc0c1dcef5db6ad73ac1d6084f2c6f9376c5c360cc4d4e PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 -PKG_BUILD_FLAGS:=gc-sections +PKG_BUILD_FLAGS:=gc-sections lto include $(INCLUDE_DIR)/package.mk @@ -48,8 +48,7 @@ TARGET_CPPFLAGS:= \ -I$(STAGING_DIR)/usr/include/libnl-tiny \ $(TARGET_CPPFLAGS) \ -DCONFIG_LIBNL20 \ - -D_GNU_SOURCE \ - -flto + -D_GNU_SOURCE ifeq ($(BUILD_VARIANT),full) TARGET_CPPFLAGS += -DIW_FULL @@ -58,7 +57,7 @@ endif MAKE_FLAGS += \ CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \ - LDFLAGS="$(TARGET_LDFLAGS) -flto" \ + LDFLAGS="$(TARGET_LDFLAGS)" \ NL1FOUND="" NL2FOUND=Y \ NLLIBNAME="libnl-tiny" \ LIBS="-lm -lnl-tiny" \ diff --git a/package/network/utils/nftables/Makefile b/package/network/utils/nftables/Makefile index 9a180a0953..55a6a4bcf6 100644 --- a/package/network/utils/nftables/Makefile +++ b/package/network/utils/nftables/Makefile @@ -20,6 +20,8 @@ PKG_LICENSE_FILES:=COPYING PKG_FIXUP:=autoreconf PKG_INSTALL:=1 +PKG_BUILD_FLAGS:=lto + include $(INCLUDE_DIR)/package.mk DISABLE_NLS:= @@ -60,9 +62,6 @@ ifeq ($(BUILD_VARIANT),json) CONFIGURE_ARGS += --with-json endif -TARGET_CFLAGS += -flto -TARGET_LDFLAGS += -flto - define Build/InstallDev $(INSTALL_DIR) $(1)/usr/lib $(1)/usr/include $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib/ diff --git a/package/system/mtd/Makefile b/package/system/mtd/Makefile index 1a70a64b7d..d45f06fc43 100644 --- a/package/system/mtd/Makefile +++ b/package/system/mtd/Makefile @@ -18,6 +18,7 @@ PKG_LICENSE:=GPL-2.0+ PKG_LICENSE_FILES:= PKG_FLAGS:=nonshared +PKG_BUILD_FLAGS:=lto include $(INCLUDE_DIR)/package.mk @@ -36,8 +37,7 @@ endef target=$(firstword $(subst -, ,$(BOARD))) MAKE_FLAGS += TARGET="$(target)" -TARGET_CFLAGS += -Dtarget_$(target)=1 -Wall -flto -TARGET_LDFLAGS += -flto=jobserver +TARGET_CFLAGS += -Dtarget_$(target)=1 -Wall ifdef CONFIG_MTD_REDBOOT_PARTS MAKE_FLAGS += FIS_SUPPORT=1 diff --git a/package/system/procd/Makefile b/package/system/procd/Makefile index 56aa9e0b35..2d51b51ad7 100644 --- a/package/system/procd/Makefile +++ b/package/system/procd/Makefile @@ -22,6 +22,7 @@ PKG_LICENSE_FILES:= PKG_MAINTAINER:=John Crispin +PKG_BUILD_FLAGS:=lto PKG_ASLR_PIE_REGULAR:=1 PKG_CONFIG_DEPENDS:= \ CONFIG_TARGET_INIT_PATH CONFIG_KERNEL_SECCOMP CONFIG_PROCD_SHOW_BOOT \ @@ -36,9 +37,6 @@ endif CMAKE_OPTIONS += -DEARLY_PATH="$(TARGET_INIT_PATH)" -TARGET_CFLAGS += -flto -TARGET_LDFLAGS += -flto - define Package/procd/Default SECTION:=base CATEGORY:=Base system diff --git a/package/system/ubus/Makefile b/package/system/ubus/Makefile index 4c72780703..5a951ac249 100644 --- a/package/system/ubus/Makefile +++ b/package/system/ubus/Makefile @@ -15,6 +15,7 @@ PKG_LICENSE:=LGPL-2.1 PKG_LICENSE_FILES:= PKG_MAINTAINER:=Felix Fietkau +PKG_BUILD_FLAGS:=lto PKG_ASLR_PIE_REGULAR:=1 include $(INCLUDE_DIR)/package.mk @@ -50,8 +51,7 @@ define Package/libubus-lua TITLE:=Lua binding for the OpenWrt RPC client endef -TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include -flto -TARGET_LDFLAGS += -flto +TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include CMAKE_OPTIONS += \ -DLUAPATH=/usr/lib/lua \ diff --git a/package/system/usign/Makefile b/package/system/usign/Makefile index 0d2d07017c..3c28318028 100644 --- a/package/system/usign/Makefile +++ b/package/system/usign/Makefile @@ -10,7 +10,7 @@ PKG_SOURCE_VERSION:=f1f65026a94137c91b5466b149ef3ea3f20091e9 PKG_MIRROR_HASH:=3f6569a5e63fdfd032976ac0f79d736d3935101ac1b97fb370514b013c5e6bb6 CMAKE_INSTALL:=1 PKG_CHECK_FORMAT_SECURITY:=1 -PKG_BUILD_FLAGS:=no-mips16 +PKG_BUILD_FLAGS:=no-mips16 lto PKG_LICENSE:=ISC PKG_LICENSE_FILES:= @@ -30,9 +30,6 @@ define Package/usign TITLE:=OpenWrt signature verification utility endef -TARGET_CFLAGS += -flto -TARGET_LDFLAGS += -flto=jobserver - CMAKE_OPTIONS += \ -DUSE_LIBUBOX=on diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile index 9573278945..d7ad8ca8fa 100644 --- a/package/utils/busybox/Makefile +++ b/package/utils/busybox/Makefile @@ -16,6 +16,7 @@ PKG_HASH:=542750c8af7cb2630e201780b4f99f3dcceeb06f505b479ec68241c1e6af61a5 PKG_BUILD_DEPENDS:=BUSYBOX_CONFIG_PAM:libpam PKG_BUILD_PARALLEL:=1 +PKG_BUILD_FLAGS:=lto PKG_CHECK_FORMAT_SECURITY:=0 PKG_LICENSE:=GPL-2.0 @@ -103,9 +104,6 @@ ifeq ($(BUILD_VARIANT),selinux) LDLIBS += selinux sepol endif -TARGET_CFLAGS += -flto -TARGET_LDFLAGS += -flto=jobserver -fuse-linker-plugin - MAKE_VARS := MAKE_FLAGS += \ EXTRA_CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \ diff --git a/package/utils/e2fsprogs/Makefile b/package/utils/e2fsprogs/Makefile index cd9b10e175..9437947ab6 100644 --- a/package/utils/e2fsprogs/Makefile +++ b/package/utils/e2fsprogs/Makefile @@ -23,7 +23,7 @@ PKG_BUILD_DEPENDS:=util-linux e2fsprogs/host PKG_INSTALL:=1 PKG_BUILD_PARALLEL:=1 -PKG_BUILD_FLAGS:=gc-sections +PKG_BUILD_FLAGS:=gc-sections lto include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/host-build.mk @@ -143,9 +143,7 @@ $(call Package/e2fsprogs) DEPENDS:= +e2fsprogs endef -TARGET_CFLAGS += $(FPIC) -flto - -TARGET_LDFLAGS += -flto +TARGET_CFLAGS += $(FPIC) CONFIGURE_ARGS += \ --disable-testio-debug \ From aef8bab9d71d85dcb6d99ff70078be3f2bdfbf61 Mon Sep 17 00:00:00 2001 From: Andre Heider Date: Fri, 3 Feb 2023 13:15:43 +0100 Subject: [PATCH 08/26] build: add a config knob to enable gc-sections for all packages This enables the linker's garbage collection for all packages which haven't opted-out. Signed-off-by: Andre Heider --- config/Config-build.in | 8 ++++++++ include/package.mk | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/config/Config-build.in b/config/Config-build.in index 8c81ef654c..f93ad37586 100644 --- a/config/Config-build.in +++ b/config/Config-build.in @@ -144,6 +144,14 @@ menu "Global build settings" help Adds -g3 to the CFLAGS. + config USE_GC_SECTIONS + bool + prompt "Dead code and data elimination for all packages (EXPERIMENTAL)" + help + Places functions and data items into its own sections to use the linker's + garbage collection capabilites. + Packages can choose to opt-out via setting PKG_BUILD_FLAGS:=no-gc-sections + config IPV6 def_bool y diff --git a/include/package.mk b/include/package.mk index 0fb947f035..687f74edc1 100644 --- a/include/package.mk +++ b/include/package.mk @@ -51,7 +51,7 @@ ifdef CONFIG_USE_MIPS16 TARGET_CXXFLAGS += -mips16 -minterlink-mips16 endif endif -ifeq ($(call pkg_build_flag,gc-sections,0),1) +ifeq ($(call pkg_build_flag,gc-sections,$(if $(CONFIG_USE_GC_SECTIONS),1,0)),1) TARGET_CFLAGS+= -ffunction-sections -fdata-sections TARGET_CXXFLAGS+= -ffunction-sections -fdata-sections TARGET_LDFLAGS+= -Wl,--gc-sections From 9fe7cc62a6ca49e81e5656ace144e35c31a9a408 Mon Sep 17 00:00:00 2001 From: Andre Heider Date: Sat, 28 Jan 2023 16:04:10 +0100 Subject: [PATCH 09/26] treewide: opt-out of tree-wide LTO usage These fail to build with LTO enabled or packages depending on them do. Signed-off-by: Andre Heider --- package/boot/grub2/Makefile | 1 + package/libs/argp-standalone/Makefile | 2 ++ package/libs/mbedtls/Makefile | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/package/boot/grub2/Makefile b/package/boot/grub2/Makefile index 7d6cfd5395..249acf1487 100644 --- a/package/boot/grub2/Makefile +++ b/package/boot/grub2/Makefile @@ -25,6 +25,7 @@ ifneq ($(BUILD_VARIANT),none) endif PKG_FLAGS:=nonshared +PKG_BUILD_FLAGS:=no-lto include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/package.mk diff --git a/package/libs/argp-standalone/Makefile b/package/libs/argp-standalone/Makefile index 1a48dcb2cd..23e5169796 100644 --- a/package/libs/argp-standalone/Makefile +++ b/package/libs/argp-standalone/Makefile @@ -19,6 +19,8 @@ PKG_MAINTAINER:=Ted Hess PKG_LICENSE:=LGPL-2.1 PKG_LICENSE:=Makefile.am +PKG_BUILD_FLAGS:=no-lto + include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/host-build.mk diff --git a/package/libs/mbedtls/Makefile b/package/libs/mbedtls/Makefile index f49bb24de6..f86d489190 100644 --- a/package/libs/mbedtls/Makefile +++ b/package/libs/mbedtls/Makefile @@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mbedtls PKG_VERSION:=2.28.2 PKG_RELEASE:=2 -PKG_BUILD_FLAGS:=no-mips16 gc-sections +PKG_BUILD_FLAGS:=no-mips16 gc-sections no-lto PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/ARMmbed/mbedtls/tar.gz/v$(PKG_VERSION)? From 1342afcd27ebc142caf859e3acb3671c0378dea0 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Tue, 31 Jan 2023 12:03:09 +0100 Subject: [PATCH 10/26] kernel: qca-ssdk: opt-out of LTO SSDK is doing everything custom, so trying to use mold and/or LTO fails, so lets opt-out of using both of them. Signed-off-by: Robert Marko [a.heider: split and switch to PKG_BUILD_FLAGS] Signed-off-by: Andre Heider --- package/kernel/qca-ssdk/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/package/kernel/qca-ssdk/Makefile b/package/kernel/qca-ssdk/Makefile index c9829d1516..62c60fc1be 100644 --- a/package/kernel/qca-ssdk/Makefile +++ b/package/kernel/qca-ssdk/Makefile @@ -10,6 +10,7 @@ PKG_SOURCE_VERSION:=628b22bc3d5ee81414b75ab3de6a255c82754dec PKG_MIRROR_HASH:=859344f79504b9953639dc5aa27042249f68e3a9a269e66d7f7a25e1ab38c110 PKG_FLAGS:=nonshared +PKG_BUILD_FLAGS:=no-lto include $(INCLUDE_DIR)/kernel.mk include $(INCLUDE_DIR)/package.mk From 9ea7019ffd60ab3ef5a5654116fbc339f856482c Mon Sep 17 00:00:00 2001 From: Andre Heider Date: Sat, 28 Jan 2023 15:24:37 +0100 Subject: [PATCH 11/26] build: add a config knob to enable LTO for all packages This enables LTO for all packages which haven't opted-out. Signed-off-by: Andre Heider --- config/Config-build.in | 7 +++++++ include/package.mk | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/config/Config-build.in b/config/Config-build.in index f93ad37586..df2d9101ca 100644 --- a/config/Config-build.in +++ b/config/Config-build.in @@ -152,6 +152,13 @@ menu "Global build settings" garbage collection capabilites. Packages can choose to opt-out via setting PKG_BUILD_FLAGS:=no-gc-sections + config USE_LTO + bool + prompt "Use the link-time optimizer for all packages (EXPERIMENTAL)" + help + Adds LTO flags to the CFLAGS and LDFLAGS. + Packages can choose to opt-out via setting PKG_BUILD_FLAGS:=no-lto + config IPV6 def_bool y diff --git a/include/package.mk b/include/package.mk index 687f74edc1..d80f3bce49 100644 --- a/include/package.mk +++ b/include/package.mk @@ -56,7 +56,7 @@ ifeq ($(call pkg_build_flag,gc-sections,$(if $(CONFIG_USE_GC_SECTIONS),1,0)),1) TARGET_CXXFLAGS+= -ffunction-sections -fdata-sections TARGET_LDFLAGS+= -Wl,--gc-sections endif -ifeq ($(call pkg_build_flag,lto,0),1) +ifeq ($(call pkg_build_flag,lto,$(if $(CONFIG_USE_LTO),1,0)),1) TARGET_CFLAGS+= -flto=auto -fno-fat-lto-objects TARGET_CXXFLAGS+= -flto=auto -fno-fat-lto-objects TARGET_LDFLAGS+= -flto=auto -fuse-linker-plugin From c6eb099db98eeb438d84a75cf5fcfe49f104be2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Tue, 21 Mar 2023 19:22:53 +0100 Subject: [PATCH 12/26] kernel: update pending b53 mmap patches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update B53 MMAP pending patches to the latest version sent upstream. Fixes regression in bmips BCM63268 switches. Fixes: fff07085fb5a ("kernel: add pending bmips patches") Signed-off-by: Álvaro Fernández Rojas --- ...-net-dsa-b53-mmap-add-more-63xx-SoCs.patch | 108 ++++++++++++++ ...t-dsa-b53-mmap-add-more-BCM63xx-SoCs.patch | 105 -------------- ...dsa-b53-mmap-allow-passing-a-chip-ID.patch | 137 +++++++++++------- ...b53-add-BCM63268-RGMII-configuration.patch | 100 +++++++------ 4 files changed, 244 insertions(+), 206 deletions(-) create mode 100644 target/linux/generic/pending-5.15/773-net-dsa-b53-mmap-add-more-63xx-SoCs.patch delete mode 100644 target/linux/generic/pending-5.15/773-net-dsa-b53-mmap-add-more-BCM63xx-SoCs.patch diff --git a/target/linux/generic/pending-5.15/773-net-dsa-b53-mmap-add-more-63xx-SoCs.patch b/target/linux/generic/pending-5.15/773-net-dsa-b53-mmap-add-more-63xx-SoCs.patch new file mode 100644 index 0000000000..1e95425952 --- /dev/null +++ b/target/linux/generic/pending-5.15/773-net-dsa-b53-mmap-add-more-63xx-SoCs.patch @@ -0,0 +1,108 @@ +From patchwork Tue Mar 21 17:33:57 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +X-Patchwork-Submitter: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= + +X-Patchwork-Id: 13183003 +X-Patchwork-Delegate: kuba@kernel.org +Return-Path: +X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on + aws-us-west-2-korg-lkml-1.web.codeaurora.org +Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) + by smtp.lore.kernel.org (Postfix) with ESMTP id 823A1C761AF + for ; Tue, 21 Mar 2023 17:35:06 +0000 (UTC) +Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand + id S230490AbjCURfE (ORCPT ); + Tue, 21 Mar 2023 13:35:04 -0400 +Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47440 "EHLO + lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org + with ESMTP id S230357AbjCURex (ORCPT + ); Tue, 21 Mar 2023 13:34:53 -0400 +Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com + [IPv6:2a00:1450:4864:20::430]) + by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9A45559D8; + Tue, 21 Mar 2023 10:34:26 -0700 (PDT) +Received: by mail-wr1-x430.google.com with SMTP id m2so14547588wrh.6; + Tue, 21 Mar 2023 10:34:26 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=gmail.com; s=20210112; t=1679420063; + h=content-transfer-encoding:mime-version:references:in-reply-to + :message-id:date:subject:cc:to:from:from:to:cc:subject:date + :message-id:reply-to; + bh=cUvnluVaZPzfEQB9fMRuYo+4/361t/7po7nyUBBJfxc=; + b=F0pa8JmQZ1FeXVtdpCygur8UmLrgKwxCcjaMn312u5zNvsXsEPeCAIDqP2tvNNTwv/ + UYjaNaoZ77HSvv/gSqeG808AXGyNs1PvLuHZYuUTJRNuLaMixKtkNFi4ypheCdk0WCiE + IWz0DIm6ojmdwMqafDUKQ6Qwkv5R0vo8Wh5vpjimEmCelOyMvfuLZNqubsiGqpnCguBp + uWlmKh95/VubCGgiGG2xK1IXQayL14ENuWseDds7nVpVK50NycrFgJbL17Bd6qJKYkbo + m70IC+9jM0hjwKXpyi6ipCBNcW+1E6JIwILVC04Xi+BTpOGhbUAQ59Yn2hyq7tQM7dzs + 4PLg== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20210112; t=1679420063; + h=content-transfer-encoding:mime-version:references:in-reply-to + :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc + :subject:date:message-id:reply-to; + bh=cUvnluVaZPzfEQB9fMRuYo+4/361t/7po7nyUBBJfxc=; + b=SCX78yTuGjdnE5nuL0p7+kxGnOzsCExsigLdaV+x/JswmwxSpZvxn223i1yM95klj9 + Rk0RnXqATLF1wZA7L1YmbeZ66zxUwW/osnCjJHPeEF8AGgjK/qawtLl/HJQHN67NaRNQ + bDsRn2nWQ2GRTRFpvD+iGRy4uyQCDu9HFxLbn43fBsBmRnXWGPQP5cEb90tL83/Onp4D + Lx/XcyZOh9QRfJNhj+G1BAeRCLRA/sdA0W3Ecu5SCFs+LtS6uvLVGWDKEDfnZhYY8Xqf + Mx9evWzdW2OorEN2FI6+xTglvnEBcVhHIJ7XEGAhCG6ocgMZeck++774S8RWumWl8xpy + /K9Q== +X-Gm-Message-State: AO0yUKUORAlGfbkNwnYmQnTWcGPqW6sp4g9WfgQmRZGCV+9tCB0OebSP + ICq6v4YPmUPNRl/WNnVCbps= +X-Google-Smtp-Source: + AK7set8pFDl8fHRwGPhAguqxIfqnQ4PY+b57IHEsybIaQ/HPNwdJ1cs1+IPBGHe3TL14dTS4aVNpHA== +X-Received: by 2002:a5d:6991:0:b0:2ce:aab5:f96b with SMTP id + g17-20020a5d6991000000b002ceaab5f96bmr2965175wru.67.1679420062764; + Tue, 21 Mar 2023 10:34:22 -0700 (PDT) +Received: from atlantis.lan (255.red-79-146-124.dynamicip.rima-tde.net. + [79.146.124.255]) + by smtp.gmail.com with ESMTPSA id + b13-20020a056000054d00b002da1261aa44sm184775wrf.48.2023.03.21.10.34.21 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Tue, 21 Mar 2023 10:34:21 -0700 (PDT) +From: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= +To: f.fainelli@gmail.com, jonas.gorski@gmail.com, andrew@lunn.ch, + olteanv@gmail.com, davem@davemloft.net, edumazet@google.com, + kuba@kernel.org, pabeni@redhat.com, robh+dt@kernel.org, + krzysztof.kozlowski+dt@linaro.org, netdev@vger.kernel.org, + devicetree@vger.kernel.org, linux-kernel@vger.kernel.org +Cc: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= +Subject: [PATCH v2 2/4] net: dsa: b53: mmap: add more 63xx SoCs +Date: Tue, 21 Mar 2023 18:33:57 +0100 +Message-Id: <20230321173359.251778-3-noltari@gmail.com> +X-Mailer: git-send-email 2.30.2 +In-Reply-To: <20230321173359.251778-1-noltari@gmail.com> +References: <20230320155024.164523-1-noltari@gmail.com> + <20230321173359.251778-1-noltari@gmail.com> +MIME-Version: 1.0 +Precedence: bulk +List-ID: +X-Mailing-List: netdev@vger.kernel.org +X-Patchwork-Delegate: kuba@kernel.org + +BCM6318, BCM6362 and BCM63268 are SoCs with a B53 MMAP switch. + +Signed-off-by: Álvaro Fernández Rojas +Reviewed-by: Florian Fainelli +--- + v2: no changes. + + drivers/net/dsa/b53/b53_mmap.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/net/dsa/b53/b53_mmap.c ++++ b/drivers/net/dsa/b53/b53_mmap.c +@@ -333,8 +333,11 @@ static void b53_mmap_shutdown(struct pla + + static const struct of_device_id b53_mmap_of_table[] = { + { .compatible = "brcm,bcm3384-switch" }, ++ { .compatible = "brcm,bcm6318-switch" }, + { .compatible = "brcm,bcm6328-switch" }, ++ { .compatible = "brcm,bcm6362-switch" }, + { .compatible = "brcm,bcm6368-switch" }, ++ { .compatible = "brcm,bcm63268-switch" }, + { .compatible = "brcm,bcm63xx-switch" }, + { /* sentinel */ }, + }; diff --git a/target/linux/generic/pending-5.15/773-net-dsa-b53-mmap-add-more-BCM63xx-SoCs.patch b/target/linux/generic/pending-5.15/773-net-dsa-b53-mmap-add-more-BCM63xx-SoCs.patch deleted file mode 100644 index 8bbf4c8e7d..0000000000 --- a/target/linux/generic/pending-5.15/773-net-dsa-b53-mmap-add-more-BCM63xx-SoCs.patch +++ /dev/null @@ -1,105 +0,0 @@ -From patchwork Mon Mar 20 15:50:22 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 8bit -X-Patchwork-Submitter: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= - -X-Patchwork-Id: 13181527 -X-Patchwork-Delegate: kuba@kernel.org -Return-Path: -X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on - aws-us-west-2-korg-lkml-1.web.codeaurora.org -Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) - by smtp.lore.kernel.org (Postfix) with ESMTP id 70553C6FD1D - for ; Mon, 20 Mar 2023 16:01:00 +0000 (UTC) -Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand - id S233364AbjCTQA5 (ORCPT ); - Mon, 20 Mar 2023 12:00:57 -0400 -Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51588 "EHLO - lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org - with ESMTP id S233532AbjCTQAP (ORCPT - ); Mon, 20 Mar 2023 12:00:15 -0400 -Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com - [IPv6:2a00:1450:4864:20::335]) - by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A422B3E0B3; - Mon, 20 Mar 2023 08:50:37 -0700 (PDT) -Received: by mail-wm1-x335.google.com with SMTP id - t17-20020a05600c451100b003edc906aeeaso1726035wmo.1; - Mon, 20 Mar 2023 08:50:37 -0700 (PDT) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=gmail.com; s=20210112; t=1679327430; - h=content-transfer-encoding:mime-version:references:in-reply-to - :message-id:date:subject:cc:to:from:from:to:cc:subject:date - :message-id:reply-to; - bh=NmGOzoXiGILw8p8HpY3VfgsDYOA5bH4v8OqaYevH4J4=; - b=KptaZem0Zxnxtwy+VdrvXw5NY/HSYmbxmV8+mSnoXZgQGHLjW/gCyDXpzRqcSBXIGV - fvtFTanvZcTCA4f/cyoAkEsqIkmQyDHwEshHutyJEaWN9q3yB5eTAnUcq4z3e7P4nTu2 - +ZOho9zDyRb4r24J6UbiN9ZUzcsuYVQwm1Qz0zJ+63dx+gD20hgCL+7775pvqoFYwgpP - 1ABgO6OngXBB42/L8+ZBwsg3mXy06HuqMLEQK/FmtcXjTml0OaO3S5cJvUdNGsdNrvx+ - kaTtRBBzqin3DRExaIekr/jPzOB3X1oV2TzhInT4SPhtULIah750U4ljBqf92PwnjvHc - 6JDQ== -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20210112; t=1679327430; - h=content-transfer-encoding:mime-version:references:in-reply-to - :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc - :subject:date:message-id:reply-to; - bh=NmGOzoXiGILw8p8HpY3VfgsDYOA5bH4v8OqaYevH4J4=; - b=GsByHVP16hADSORlzScxFXsjTNWGBbyYNiWQHZzojsE/ffOZrXokZWDNH4GTlB7uv4 - 4Gs1NNLT8Bk95OjDvHAm5bJxZGwyfeHZeTqxBpBlGapyqb2D9XGxpYXbF9VaQgd7oKjN - v7Si3AKtD8g7o//OkdsslkT8JxzhdjmHK0pJN9ssxhHMePGutYkZH+n7JlIrQVaDs7iU - nvg1lcFLNvn+MrLpNE5r8KMIPdTwGMIOQAuZ1tqttHrGRkfi92KF1p93p/Qn8uDIGO/B - ocZHPyMlXDh/Q7Qjsy/BihOrW3+cSZm7OomPh8vWhppGKwkxLYCZAsKeDGOjLvfdV2Rf - lZwQ== -X-Gm-Message-State: AO0yUKW2wNtd5kSfm2dxbqnhxVZrNkzLVVdLsO0eADsnjtWufqMWFS0a - ZubXW4z6gV3Oqv2lPuWyQDU= -X-Google-Smtp-Source: - AK7set8bMf4RMiUM14onDSGmYFsmJuDQ+P9yadvVBWt05IjyUwc/8tNalTsC2hQ62KhoCUpBfCEb7g== -X-Received: by 2002:a05:600c:468c:b0:3eb:38b0:e748 with SMTP id - p12-20020a05600c468c00b003eb38b0e748mr10091873wmo.13.1679327430592; - Mon, 20 Mar 2023 08:50:30 -0700 (PDT) -Received: from atlantis.lan (255.red-79-146-124.dynamicip.rima-tde.net. - [79.146.124.255]) - by smtp.gmail.com with ESMTPSA id - 3-20020a05600c020300b003eddefd8792sm4812333wmi.14.2023.03.20.08.50.29 - (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Mon, 20 Mar 2023 08:50:30 -0700 (PDT) -From: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= -To: f.fainelli@gmail.com, andrew@lunn.ch, olteanv@gmail.com, - davem@davemloft.net, edumazet@google.com, kuba@kernel.org, - pabeni@redhat.com, robh+dt@kernel.org, - krzysztof.kozlowski+dt@linaro.org, netdev@vger.kernel.org, - devicetree@vger.kernel.org, linux-kernel@vger.kernel.org -Cc: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= -Subject: [PATCH 2/4] net: dsa: b53: mmap: add more BCM63xx SoCs -Date: Mon, 20 Mar 2023 16:50:22 +0100 -Message-Id: <20230320155024.164523-3-noltari@gmail.com> -X-Mailer: git-send-email 2.30.2 -In-Reply-To: <20230320155024.164523-1-noltari@gmail.com> -References: <20230320155024.164523-1-noltari@gmail.com> -MIME-Version: 1.0 -Precedence: bulk -List-ID: -X-Mailing-List: netdev@vger.kernel.org -X-Patchwork-Delegate: kuba@kernel.org - -BCM6318, BCM6362 and BCM63268 are SoCs with a B53 MMAP switch. - -Signed-off-by: Álvaro Fernández Rojas ---- - drivers/net/dsa/b53/b53_mmap.c | 3 +++ - 1 file changed, 3 insertions(+) - ---- a/drivers/net/dsa/b53/b53_mmap.c -+++ b/drivers/net/dsa/b53/b53_mmap.c -@@ -333,8 +333,11 @@ static void b53_mmap_shutdown(struct pla - - static const struct of_device_id b53_mmap_of_table[] = { - { .compatible = "brcm,bcm3384-switch" }, -+ { .compatible = "brcm,bcm6318-switch" }, - { .compatible = "brcm,bcm6328-switch" }, -+ { .compatible = "brcm,bcm6362-switch" }, - { .compatible = "brcm,bcm6368-switch" }, -+ { .compatible = "brcm,bcm63268-switch" }, - { .compatible = "brcm,bcm63xx-switch" }, - { /* sentinel */ }, - }; diff --git a/target/linux/generic/pending-5.15/774-net-dsa-b53-mmap-allow-passing-a-chip-ID.patch b/target/linux/generic/pending-5.15/774-net-dsa-b53-mmap-allow-passing-a-chip-ID.patch index 4581144dc9..b84ad12d01 100644 --- a/target/linux/generic/pending-5.15/774-net-dsa-b53-mmap-allow-passing-a-chip-ID.patch +++ b/target/linux/generic/pending-5.15/774-net-dsa-b53-mmap-allow-passing-a-chip-ID.patch @@ -1,96 +1,125 @@ -From patchwork Mon Mar 20 15:50:23 2023 +From patchwork Tue Mar 21 17:33:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= -X-Patchwork-Id: 13181525 +X-Patchwork-Id: 13183004 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) - by smtp.lore.kernel.org (Postfix) with ESMTP id AA605C7618D - for ; Mon, 20 Mar 2023 16:00:42 +0000 (UTC) + by smtp.lore.kernel.org (Postfix) with ESMTP id B2B12C74A5B + for ; Tue, 21 Mar 2023 17:35:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand - id S233060AbjCTQAk (ORCPT ); - Mon, 20 Mar 2023 12:00:40 -0400 -Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50606 "EHLO + id S230297AbjCURfK (ORCPT ); + Tue, 21 Mar 2023 13:35:10 -0400 +Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org - with ESMTP id S233508AbjCTQAL (ORCPT - ); Mon, 20 Mar 2023 12:00:11 -0400 -Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com - [IPv6:2a00:1450:4864:20::332]) - by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8A523E0BA; - Mon, 20 Mar 2023 08:50:37 -0700 (PDT) -Received: by mail-wm1-x332.google.com with SMTP id - fm20-20020a05600c0c1400b003ead37e6588so9459945wmb.5; - Mon, 20 Mar 2023 08:50:37 -0700 (PDT) + with ESMTP id S230374AbjCURex (ORCPT + ); Tue, 21 Mar 2023 13:34:53 -0400 +Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com + [IPv6:2a00:1450:4864:20::432]) + by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C906B5550A; + Tue, 21 Mar 2023 10:34:26 -0700 (PDT) +Received: by mail-wr1-x432.google.com with SMTP id y14so14546846wrq.4; + Tue, 21 Mar 2023 10:34:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=gmail.com; s=20210112; t=1679327432; + d=gmail.com; s=20210112; t=1679420064; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; - bh=16/AUEfT4/3aNTDuWfjKv1lfTz12+h3pg0SmLHFA5Y8=; - b=n+22dPTXjE1jqw2beYW8Kqab5uczPETidauati8u3xeWTbKyfCENVVcYJBQgNPM3pw - BeH+srFpkROFpxJ+btOlNSEZA4pIuBf2EOOU4AWrlPTWglRDxVHZ3X7kVDptJnxVGvre - zNQ31LP8wxHP9XSFxYbkK9ybYYC8WP3fQZwcGcAgliP2cbKQMwuUP/i2w3Hqml8t6rP1 - 5HaZgmWt9wdh8c76nCWP03IuNM9oJ9qa3YWDBrVVN2eMe0mGxZmKR+Wb/BZj3o5ezJmu - q41drXRwHBC6vF1K+HHeOgAcMlTKIJUAo2daNVm/UBTXj2SXsvfh4nfgrWVAexOpd/uP - elYw== + bh=vnvnwWc5Tmg09HBQo/m9RbRM6yM8KLx8r1VA+Abfg3k=; + b=eFv+mwe94Y2YZMiJP5gydXVrGlbIAR5HCrY0rdcoGoMPzQUHLFckZeYCgEKudI55I7 + gMLZYCtLwvDXvKeHM2AUigsq2YuJSeF5QwICPrhTnMwUGBg4yyyltrc3+J0lSd6/4kQv + h0yM1Oo4v0d8CuqjBU6bXienIk34AFVJfsPq+vWQTjAbUL7ht4WHZ2Ez2MFoTvZpkIJA + 5iWMyVoMbugZl6eqNRjvDHFmtBtrZIv8AFs10r2Ca6+Yxm+aq0v33DRkbSVVqgFPNEzy + q5QOXOeLBPL6BvyovOpmVSWGoHf1zFV7lrzcqi+uc+FuYxQ9dyN3ND73DrrhWSkLaSg9 + r8yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20210112; t=1679327432; + d=1e100.net; s=20210112; t=1679420064; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; - bh=16/AUEfT4/3aNTDuWfjKv1lfTz12+h3pg0SmLHFA5Y8=; - b=6ZfI8DXxxDA2NF5hw1Mfoc/pGgW+OfRfwgMoE4jB/ABbQg8zdQ/Ja7FGIqVPbi2hZe - fvd7j+dw8CZvNbkRbsYQvMTwRfDRonn8aAwJBBNkMyTcm8s3D5BRURzVpe0ScyzPYvxQ - 0cXZASSL+EXA7Fyf51y4emSNy6Xb3nY0pjKWFUphqra9TdFQzhtnpdlN3tTwXFN9jlEu - 3Se1FWEiQP5FRtqXIU/oefh5FMXoJEDCKq8geZ04mouAdeVxZd/FUBR754EY6uNAhMVG - hef4iX7HeDpTCJLCprNVFgQ80bbl/uh+QnBtEVGlDFcH4GR7csGSIp2g/3Qzj/m78rkz - ml1Q== -X-Gm-Message-State: AO0yUKUPCBZQSCICZA8m4nHTp32xYgPPzQnSGO9a0aop0wLJeOUszuYx - hH7zNhPrx7BZWaytny88AN0= + bh=vnvnwWc5Tmg09HBQo/m9RbRM6yM8KLx8r1VA+Abfg3k=; + b=jIRB8pIlrLA/ovhnEoePs/6SX8fn6l7l4fY2CxX2pLrTbP1JI8AAetPavvrNVQTr2M + Vm0iLbKyL/VpTq9+bSN1SMjaoi4lAMj0pgafoHrwABMVZpFauYvtCfSYTstZ2pw4Dr1j + wYQGj3BUSpFIYHtSIDMkb5449WA3T3TONhaQLRFAUCBD6gAFyEky5fY+DIHrGaj352B6 + 9ST/tkqHgPpuFlmromr42KQWoTFU+Pj0Uhyp7ru4BsnF7tTshWroZZIHUJmSACudEadr + fBPiuurX9jgp9zNqj8Oy0HjiVUnULFCapj8yICGp5s44uDAK/XFqFXpOuJ8ptS6uPazU + xUwg== +X-Gm-Message-State: AO0yUKX2w6QZfaGDHtlZAlY/U8F8VuJa3HwlgXbxgGChgdgvIoFThawv + oDyFAhWbVfe4DxwXTwxgJ/I= X-Google-Smtp-Source: - AK7set9y2vPkyUF0Tln19u08/DwcR4L11U6iFXPmpi6kdzFhq0OrCiFNu8aAeCvisP/C/rvYvKH9Lw== -X-Received: by 2002:a05:600c:310e:b0:3e9:f15b:935b with SMTP id - g14-20020a05600c310e00b003e9f15b935bmr34745262wmo.32.1679327432097; - Mon, 20 Mar 2023 08:50:32 -0700 (PDT) + AK7set+sH60XiJYup7bqrZTzFJVNe1YGcX/UTfjWV9xfGwNyodc34cHvKpqNagw5J+vEpv6CKvNHaA== +X-Received: by 2002:adf:f344:0:b0:2cd:de25:1c76 with SMTP id + e4-20020adff344000000b002cdde251c76mr12989754wrp.17.1679420064464; + Tue, 21 Mar 2023 10:34:24 -0700 (PDT) Received: from atlantis.lan (255.red-79-146-124.dynamicip.rima-tde.net. [79.146.124.255]) by smtp.gmail.com with ESMTPSA id - 3-20020a05600c020300b003eddefd8792sm4812333wmi.14.2023.03.20.08.50.30 + b13-20020a056000054d00b002da1261aa44sm184775wrf.48.2023.03.21.10.34.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Mon, 20 Mar 2023 08:50:31 -0700 (PDT) + Tue, 21 Mar 2023 10:34:23 -0700 (PDT) From: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= -To: f.fainelli@gmail.com, andrew@lunn.ch, olteanv@gmail.com, - davem@davemloft.net, edumazet@google.com, kuba@kernel.org, - pabeni@redhat.com, robh+dt@kernel.org, +To: f.fainelli@gmail.com, jonas.gorski@gmail.com, andrew@lunn.ch, + olteanv@gmail.com, davem@davemloft.net, edumazet@google.com, + kuba@kernel.org, pabeni@redhat.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= -Subject: [PATCH 3/4] net: dsa: b53: mmap: allow passing a chip ID -Date: Mon, 20 Mar 2023 16:50:23 +0100 -Message-Id: <20230320155024.164523-4-noltari@gmail.com> +Subject: [PATCH v2 3/4] net: dsa: b53: mmap: allow passing a chip ID +Date: Tue, 21 Mar 2023 18:33:58 +0100 +Message-Id: <20230321173359.251778-4-noltari@gmail.com> X-Mailer: git-send-email 2.30.2 -In-Reply-To: <20230320155024.164523-1-noltari@gmail.com> +In-Reply-To: <20230321173359.251778-1-noltari@gmail.com> References: <20230320155024.164523-1-noltari@gmail.com> + <20230321173359.251778-1-noltari@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org -BCM63268 SoCs require a special handling for their RGMIIs, so we should be -able to identify them as a special BCM63xx switch. +BCM6318 and BCM63268 SoCs require a special handling for their RGMIIs, so we +should be able to identify them as a special BCM63xx switch. Signed-off-by: Álvaro Fernández Rojas --- - drivers/net/dsa/b53/b53_mmap.c | 32 +++++++++++++++++++++++--------- - drivers/net/dsa/b53/b53_priv.h | 9 ++++++++- - 2 files changed, 31 insertions(+), 10 deletions(-) + v2: + - Add missing chip to b53_switch_chips[]. + - Fix device_get_match_data() casting warning. + - Add BCM63268_DEVICE_ID to BCM6318 too. + - Add BCM6318 in commit description. + drivers/net/dsa/b53/b53_common.c | 13 +++++++++++++ + drivers/net/dsa/b53/b53_mmap.c | 32 +++++++++++++++++++++++--------- + drivers/net/dsa/b53/b53_priv.h | 9 ++++++++- + 3 files changed, 44 insertions(+), 10 deletions(-) + +--- a/drivers/net/dsa/b53/b53_common.c ++++ b/drivers/net/dsa/b53/b53_common.c +@@ -2461,6 +2461,19 @@ static const struct b53_chip_data b53_sw + .jumbo_size_reg = B53_JUMBO_MAX_SIZE_63XX, + }, + { ++ .chip_id = BCM63268_DEVICE_ID, ++ .dev_name = "BCM63268", ++ .vlans = 4096, ++ .enabled_ports = 0, /* pdata must provide them */ ++ .arl_bins = 4, ++ .arl_buckets = 1024, ++ .imp_port = 8, ++ .vta_regs = B53_VTA_REGS_63XX, ++ .duplex_reg = B53_DUPLEX_STAT_63XX, ++ .jumbo_pm_reg = B53_JUMBO_PORT_MASK_63XX, ++ .jumbo_size_reg = B53_JUMBO_MAX_SIZE_63XX, ++ }, ++ { + .chip_id = BCM53010_DEVICE_ID, + .dev_name = "BCM53010", + .vlans = 4096, --- a/drivers/net/dsa/b53/b53_mmap.c +++ b/drivers/net/dsa/b53/b53_mmap.c @@ -248,7 +248,7 @@ static int b53_mmap_probe_of(struct plat @@ -98,7 +127,7 @@ Signed-off-by: Álvaro Fernández Rojas pdata->regs = mem; - pdata->chip_id = BCM63XX_DEVICE_ID; -+ pdata->chip_id = (u32)device_get_match_data(dev); ++ pdata->chip_id = (u32)(unsigned long)device_get_match_data(dev); pdata->big_endian = of_property_read_bool(np, "big-endian"); of_ports = of_get_child_by_name(np, "ports"); @@ -119,7 +148,7 @@ Signed-off-by: Álvaro Fernández Rojas + .data = (void *)BCM63XX_DEVICE_ID, + }, { + .compatible = "brcm,bcm6318-switch", -+ .data = (void *)BCM63XX_DEVICE_ID, ++ .data = (void *)BCM63268_DEVICE_ID, + }, { + .compatible = "brcm,bcm6328-switch", + .data = (void *)BCM63XX_DEVICE_ID, diff --git a/target/linux/generic/pending-5.15/775-net-dsa-b53-add-BCM63268-RGMII-configuration.patch b/target/linux/generic/pending-5.15/775-net-dsa-b53-add-BCM63268-RGMII-configuration.patch index 213357bfc5..d90d757fb2 100644 --- a/target/linux/generic/pending-5.15/775-net-dsa-b53-add-BCM63268-RGMII-configuration.patch +++ b/target/linux/generic/pending-5.15/775-net-dsa-b53-add-BCM63268-RGMII-configuration.patch @@ -1,80 +1,82 @@ -From patchwork Mon Mar 20 15:50:24 2023 +From patchwork Tue Mar 21 17:33:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= -X-Patchwork-Id: 13181526 +X-Patchwork-Id: 13183005 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) - by smtp.lore.kernel.org (Postfix) with ESMTP id 93F5BC6FD1D - for ; Mon, 20 Mar 2023 16:00:57 +0000 (UTC) + by smtp.lore.kernel.org (Postfix) with ESMTP id 31BE4C761A6 + for ; Tue, 21 Mar 2023 17:35:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand - id S233333AbjCTQAy (ORCPT ); - Mon, 20 Mar 2023 12:00:54 -0400 -Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46084 "EHLO + id S229674AbjCURfN (ORCPT ); + Tue, 21 Mar 2023 13:35:13 -0400 +Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org - with ESMTP id S233519AbjCTQAM (ORCPT - ); Mon, 20 Mar 2023 12:00:12 -0400 -Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com - [IPv6:2a00:1450:4864:20::330]) - by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA2C438B53; - Mon, 20 Mar 2023 08:50:38 -0700 (PDT) -Received: by mail-wm1-x330.google.com with SMTP id iw17so2507691wmb.0; - Mon, 20 Mar 2023 08:50:37 -0700 (PDT) + with ESMTP id S230327AbjCURfB (ORCPT + ); Tue, 21 Mar 2023 13:35:01 -0400 +Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com + [IPv6:2a00:1450:4864:20::436]) + by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1D855507D; + Tue, 21 Mar 2023 10:34:27 -0700 (PDT) +Received: by mail-wr1-x436.google.com with SMTP id i9so14537769wrp.3; + Tue, 21 Mar 2023 10:34:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=gmail.com; s=20210112; t=1679327433; + d=gmail.com; s=20210112; t=1679420066; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; - bh=WlRvHn65p7ApqB1hkWXEl334dlDtfL7sexIylSD7RF8=; - b=Xb9J1kzvH/7/KC9kfFPe5nfM0jOx0VqmPqlTVHQ2ICuE/eznYiDnZR2GROkiEBeSW5 - aj8nTpjx/Zgj9GE1Ere9JmGDP4qH6Ms4GG1dcgxiwCZUubj8EmKPPzq+xRYgui52JXXZ - GG9yZPfp/eWkFHvSgIPzHyC1iWc88F8XSN7+xdXyC7MOoEWIbvy0y04VrbuO9p8+RjCl - XbF+dk2kkZAseZ7QMlgJZ2Bt8HfHx2I4D6+r4BhyVy6oIsdzkMTei+drCezAB5fFzerw - y3GD2qAHDRRSrMpv7wTUuM9Erg/6k7sGs+HKjLlgmmAwT7LMqxNkXvmZeU5IucnlPzyQ - zxGw== + bh=asmFs22xWYwR1Ql9m/IrNv+MPUNDn8hSjmwDRYvO7mE=; + b=Cqj2C6aG5vEOlhh9N3ybvDA0CV38nhQODnfdnr7utNddd323iDagoJty1Wmi3MAzj1 + 5ORmYT5fQvUnild7C4RhcCNTBn+MoYZ+wDZwZYelu6BKHkW11YFK949ax5B50by+ASR2 + z+rGI3wR5fVXd4VDgmcsT6zF5x69wKyhbhqIfrhG9BVFTctfaBgDS/l+bX1C56kSqv82 + bQkKSSAehSLGpFoCU3q62OGoZVi3jDe6HDb5M1Dp2mgHhqsW19otZpJ57DjtZ1CmtPai + o7T/ew6WoIYSl6whBmV36jeNaDJ3TItOBrKc4nMJBDWaCg4DNzUSe0ei5Xz7Oik5lb3p + y9ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20210112; t=1679327433; + d=1e100.net; s=20210112; t=1679420066; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; - bh=WlRvHn65p7ApqB1hkWXEl334dlDtfL7sexIylSD7RF8=; - b=mx+DrcUS/RrkssaKZwtjxNb1RtQP6+pwhyW7/EaPvgWZPMBZeDHy7B+x5GRw7gA8l5 - lIqtZ41yhnrcZ8wp6SSyG+pJJ2Xn4q0N8W3NJS8vZz5/ORmoRdLxyNY8IdlTQlmjV9YT - jY1LCVegFoErlMPP49XZ1fzJtRPIeFv0MZphvdw7nXk5yhg4+vpnfCPKzOJdOmpEgfut - GnIW/BBXCezqjF0GT9Lmp61lPf1j0PCq8lmrcrZtKwI11zyVmOPqgdWmkRh+YirD5L0P - ORDeuqwz5SkyDZ+Sw+dahSLeLtZ/VB+58nFWPpxF4yUw/sKPrhpkZfGzo/VN/jDL1ZfN - 1t3w== -X-Gm-Message-State: AO0yUKVurWpxXw8kQLLJFFk7zmIVuc+hSmpXM9lpLIB/ByDuw5z3fAds - TZs+QVHvNnvyK9ovwNMJwU0= + bh=asmFs22xWYwR1Ql9m/IrNv+MPUNDn8hSjmwDRYvO7mE=; + b=UdI2iQNBYwRf40ivf3ROR132t95BU/p3RUzXdZLCyz6c6JWtECQ5byyGeEwoX10n5u + HlepoNTJxMFLYrAHGvNLDPpWPuLXMa645S1mCVZ7NyWp8W96XzSynNZPeXHuJdb464QU + A7UTRSW3mlvKe9OR3EcB2CfBZv0yHWR0ldbnxcxGUFw8z78PNqpOVnITtjBdfpGesJ9c + VJw+fiM6hCcahor4nk9LLcAryPm8xmhDLxBKaLILO8wyTUiHY8G9hsXnFCtcpetnF5wS + pW13beAE+odb7ZZaXZUYpWGYhCe/hLzNjbo8YpgzHwadZthxPrT5YvNIYwyrvoViLM0n + KDRQ== +X-Gm-Message-State: AO0yUKW+9H/kqcAUyWeZhZJhiJjsBcYn1THmZaSDrPrk/pNuGXJXGtJd + NgsGZW8iSqLEv81yK+U5Os8= X-Google-Smtp-Source: - AK7set8fEPc92nUNA58HgNEL8eOH1DCae42kd5S11MkuO5+TV9yIVNP77n+5gS3XrTpCzsFfJmaf/A== -X-Received: by 2002:a05:600c:470e:b0:3eb:42fc:fb30 with SMTP id - v14-20020a05600c470e00b003eb42fcfb30mr34204824wmo.32.1679327433327; - Mon, 20 Mar 2023 08:50:33 -0700 (PDT) + AK7set/lzQZwCSxVaOe5dZ+7TR3xaQty/vg5xvZDpRW8TwTiPQblIbw5kJJTPLp67RySehrPIlCqSg== +X-Received: by 2002:a5d:65c9:0:b0:2ce:ac31:54ff with SMTP id + e9-20020a5d65c9000000b002ceac3154ffmr2776515wrw.2.1679420066191; + Tue, 21 Mar 2023 10:34:26 -0700 (PDT) Received: from atlantis.lan (255.red-79-146-124.dynamicip.rima-tde.net. [79.146.124.255]) by smtp.gmail.com with ESMTPSA id - 3-20020a05600c020300b003eddefd8792sm4812333wmi.14.2023.03.20.08.50.32 + b13-20020a056000054d00b002da1261aa44sm184775wrf.48.2023.03.21.10.34.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Mon, 20 Mar 2023 08:50:32 -0700 (PDT) + Tue, 21 Mar 2023 10:34:25 -0700 (PDT) From: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= -To: f.fainelli@gmail.com, andrew@lunn.ch, olteanv@gmail.com, - davem@davemloft.net, edumazet@google.com, kuba@kernel.org, - pabeni@redhat.com, robh+dt@kernel.org, +To: f.fainelli@gmail.com, jonas.gorski@gmail.com, andrew@lunn.ch, + olteanv@gmail.com, davem@davemloft.net, edumazet@google.com, + kuba@kernel.org, pabeni@redhat.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org -Cc: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= -Subject: [PATCH 4/4] net: dsa: b53: add BCM63268 RGMII configuration -Date: Mon, 20 Mar 2023 16:50:24 +0100 -Message-Id: <20230320155024.164523-5-noltari@gmail.com> +Cc: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= , + Simon Horman +Subject: [PATCH v2 4/4] net: dsa: b53: add BCM63268 RGMII configuration +Date: Tue, 21 Mar 2023 18:33:59 +0100 +Message-Id: <20230321173359.251778-5-noltari@gmail.com> X-Mailer: git-send-email 2.30.2 -In-Reply-To: <20230320155024.164523-1-noltari@gmail.com> +In-Reply-To: <20230321173359.251778-1-noltari@gmail.com> References: <20230320155024.164523-1-noltari@gmail.com> + <20230321173359.251778-1-noltari@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: @@ -84,7 +86,11 @@ X-Patchwork-Delegate: kuba@kernel.org BCM63268 requires special RGMII configuration to work. Signed-off-by: Álvaro Fernández Rojas +Reviewed-by: Florian Fainelli +Reviewed-by: Simon Horman --- + v2: no changes. + drivers/net/dsa/b53/b53_common.c | 6 +++++- drivers/net/dsa/b53/b53_regs.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) From 82dc16fde0337b573c543f023f3fe1d3657e17e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Tue, 21 Mar 2023 19:36:16 +0100 Subject: [PATCH 13/26] bmips: disable B53 MMAP phy read/write ops MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without this change, internal and external B53 switches couldn't coexist as reported in https://github.com/openwrt/openwrt/issues/10313. In order to fix this we need to force the B53 MMAP DSA switch driver to use bcm6368-mdio-mux for accessing the PHY registers instead of its own phy_read() and phy_write() functions. Signed-off-by: Álvaro Fernández Rojas --- .../net/ethernet/broadcom/bcm6368-enetsw.c | 2 +- ...-b53-mmap-disable-phy-read-write-ops.patch | 46 +++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 target/linux/bmips/patches-5.15/510-net-dsa-b53-mmap-disable-phy-read-write-ops.patch diff --git a/target/linux/bmips/files/drivers/net/ethernet/broadcom/bcm6368-enetsw.c b/target/linux/bmips/files/drivers/net/ethernet/broadcom/bcm6368-enetsw.c index 64736ebf61..f43e484a9b 100644 --- a/target/linux/bmips/files/drivers/net/ethernet/broadcom/bcm6368-enetsw.c +++ b/target/linux/bmips/files/drivers/net/ethernet/broadcom/bcm6368-enetsw.c @@ -22,7 +22,7 @@ #include /* MTU */ -#define ENETSW_TAG_SIZE 6 +#define ENETSW_TAG_SIZE (6 + VLAN_HLEN) #define ENETSW_MTU_OVERHEAD (VLAN_ETH_HLEN + VLAN_HLEN + \ ENETSW_TAG_SIZE) #define ENETSW_FRAG_SIZE(x) (SKB_DATA_ALIGN(NET_SKB_PAD + x + \ diff --git a/target/linux/bmips/patches-5.15/510-net-dsa-b53-mmap-disable-phy-read-write-ops.patch b/target/linux/bmips/patches-5.15/510-net-dsa-b53-mmap-disable-phy-read-write-ops.patch new file mode 100644 index 0000000000..3b1ee6cfa2 --- /dev/null +++ b/target/linux/bmips/patches-5.15/510-net-dsa-b53-mmap-disable-phy-read-write-ops.patch @@ -0,0 +1,46 @@ +From 03e31e5197a041857299c70bbbc461131156d434 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= +Date: Tue, 21 Mar 2023 19:11:58 +0100 +Subject: [PATCH] net: dsa: b53: mmap: disable phy read/write ops +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +B53 MMAP switches have a MDIO Mux bus controller which should be used instead +of phy_read() and phy_write() ops. + +Signed-off-by: Álvaro Fernández Rojas +--- + drivers/net/dsa/b53/b53_mmap.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/drivers/net/dsa/b53/b53_mmap.c ++++ b/drivers/net/dsa/b53/b53_mmap.c +@@ -279,6 +279,7 @@ static int b53_mmap_probe(struct platfor + struct b53_platform_data *pdata = pdev->dev.platform_data; + struct b53_mmap_priv *priv; + struct b53_device *dev; ++ struct dsa_switch_ops *dso; + int ret; + + if (!pdata && np) { +@@ -298,10 +299,19 @@ static int b53_mmap_probe(struct platfor + + priv->regs = pdata->regs; + ++ dso = devm_kzalloc(&pdev->dev, sizeof(*dso), GFP_KERNEL); ++ if (!dso) ++ return -ENOMEM; ++ + dev = b53_switch_alloc(&pdev->dev, &b53_mmap_ops, priv); + if (!dev) + return -ENOMEM; + ++ memcpy(dso, dev->ds->ops, sizeof(*dso)); ++ dso->phy_read = NULL; ++ dso->phy_write = NULL; ++ dev->ds->ops = dso; ++ + dev->pdata = pdata; + + platform_set_drvdata(pdev, dev); From 61f3c3b1eebd598b62f03cb2c63dde965624e0f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Mon, 23 May 2022 20:52:53 +0200 Subject: [PATCH 14/26] bmips: dgnd3700v2: enable external BCM53125 switch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Netgear DGND3700v2 has an external BCM53125 switch which can now be enabled as a DSA disjoint switch tree setup. Signed-off-by: Álvaro Fernández Rojas --- .../bmips/dts/bcm6362-netgear-dgnd3700-v2.dts | 56 ++++++++++++++++++- .../nand/base-files/etc/board.d/02_network | 2 +- 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts b/target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts index b99fecaaa6..d0befc2c34 100644 --- a/target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts +++ b/target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts @@ -148,6 +148,58 @@ }; }; +&mdio_ext { + switch@1e { + compatible = "brcm,bcm53125"; + reg = <30>; + + dsa,member = <1 0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "lan1"; + }; + + port@1 { + reg = <1>; + label = "lan2"; + }; + + port@2 { + reg = <2>; + label = "lan3"; + }; + + port@3 { + reg = <3>; + label = "lan4"; + }; + + port@4 { + reg = <4>; + label = "wan"; + }; + + port@8 { + reg = <8>; + label = "cpu"; + + phy-mode = "rgmii"; + ethernet = <&switch0port4>; + + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + }; + }; +}; + &nflash { status = "okay"; @@ -224,8 +276,10 @@ }; &switch0 { + dsa,member = <0 0>; + ports { - port@4 { + switch0port4: port@4 { reg = <4>; label = "extsw"; diff --git a/target/linux/bmips/nand/base-files/etc/board.d/02_network b/target/linux/bmips/nand/base-files/etc/board.d/02_network index e853621665..3134116bc2 100644 --- a/target/linux/bmips/nand/base-files/etc/board.d/02_network +++ b/target/linux/bmips/nand/base-files/etc/board.d/02_network @@ -11,7 +11,7 @@ comtrend,vr-3032u) ;; netgear,dgnd3700-v2) ucidef_set_bridge_device switch - ucidef_set_interface_lan "extsw" + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan" ;; esac From 80a3ecc894897f7fa42ab0b98c61ae7533ea7703 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Sun, 19 Mar 2023 18:17:29 +0100 Subject: [PATCH 15/26] bmips: add Huawei HG253s v2 support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Huawei HG253s v2 is a BCM6362 with 128M RAM, internal wifi and external BCM53124S switch. This device is already supported in bcm63xx target, so more information can be found in https://openwrt.org/toh/huawei/hg253s_v2. It's a perfect example of a device with internal and external switch coexistance since most devices only have ports on one of the switches but not both of them. Signed-off-by: Álvaro Fernández Rojas --- .../bmips/dts/bcm6362-huawei-hg253s-v2.dts | 241 ++++++++++++++++++ target/linux/bmips/image/bcm63xx_nand.mk | 21 ++ .../nand/base-files/etc/board.d/02_network | 1 + .../nand/base-files/lib/upgrade/platform.sh | 1 + 4 files changed, 264 insertions(+) create mode 100644 target/linux/bmips/dts/bcm6362-huawei-hg253s-v2.dts diff --git a/target/linux/bmips/dts/bcm6362-huawei-hg253s-v2.dts b/target/linux/bmips/dts/bcm6362-huawei-hg253s-v2.dts new file mode 100644 index 0000000000..c3bf11629b --- /dev/null +++ b/target/linux/bmips/dts/bcm6362-huawei-hg253s-v2.dts @@ -0,0 +1,241 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "bcm6362.dtsi" + +/ { + model = "Huawei HG253s v2"; + compatible = "huawei,hg253s-v2", "brcm,bcm6362"; + + aliases { + led-boot = &led_phone_green; + led-failsafe = &led_phone_green; + led-upgrade = &led_phone_green; + + led-internet = &led_internet_green; + led-usb = &led_usb_green; + led-wireless = &led_wireless_green; + }; + + keys { + compatible = "gpio-keys-polled"; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio 24 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + + wlan { + label = "wlan"; + gpios = <&gpio 25 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + + wps { + label = "wps"; + gpios = <&gpio 26 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_phone_green: led@28 { + label = "green:phone"; + gpios = <&gpio 28 GPIO_ACTIVE_LOW>; + }; + + led_usb_green: led@30 { + label = "green:usb"; + gpios = <&gpio 30 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&ehci { + status = "okay"; +}; + +ðernet { + status = "okay"; + + nvmem-cells = <&macaddr_cferom_6a0>; + nvmem-cell-names = "mac-address"; +}; + +&leds { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_leds>; + + led_internet_green: led@3 { + reg = <3>; + active-low; + label = "green:internet"; + }; + + led_wireless_green: led@5 { + reg = <5>; + active-low; + label = "green:wifi"; + }; +}; + +&lsspi { + status = "okay"; + + switch@0 { + compatible = "brcm,bcm53125"; + reg = <0>; + spi-max-frequency = <781000>; + + dsa,member = <1 0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@1 { + reg = <1>; + label = "lan4"; + }; + + port@2 { + reg = <2>; + label = "lan3"; + }; + + port@3 { + reg = <3>; + label = "lan2"; + }; + + port@4 { + reg = <4>; + label = "lan1"; + }; + + port@8 { + reg = <8>; + label = "cpu"; + + phy-mode = "rgmii"; + ethernet = <&switch0port4>; + + fixed-link { + speed = <1000>; + full-duplex; + asym-pause; + pause; + }; + }; + }; + }; +}; + +&mdio_ext { + phy24: ethernet-phy@18 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <24>; + }; +}; + +&nflash { + status = "okay"; + + nandcs@0 { + compatible = "brcm,nandcs"; + reg = <0>; + nand-ecc-step-size = <512>; + nand-ecc-strength = <15>; + nand-on-flash-bbt; + brcm,nand-oob-sector-size = <64>; + + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + cferom: partition@0 { + label = "cferom"; + reg = <0x0000000 0x0020000>; + read-only; + }; + + partition@20000 { + compatible = "brcm,wfi"; + label = "wfi"; + reg = <0x0020000 0x7d80000>; + }; + + partition@7da0000 { + label = "nvram"; + reg = <0x7da0000 0x160000>; + }; + }; + }; +}; + +&ohci { + status = "okay"; +}; + +&pinctrl { + pinctrl_leds: leds { + function = "led"; + pins = "gpio3", "gpio5"; + }; +}; + +&switch0 { + dsa,member = <0 0>; + + ports { + switch0port4: port@4 { + reg = <4>; + label = "extsw"; + + phy-mode = "rgmii"; + + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + + port@5 { + reg = <5>; + label = "wan"; + + phy-handle = <&phy24>; + phy-mode = "rgmii-txid"; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&usbh { + status = "okay"; +}; + +&cferom { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_cferom_6a0: macaddr@6a0 { + reg = <0x6a0 0x6>; + }; +}; diff --git a/target/linux/bmips/image/bcm63xx_nand.mk b/target/linux/bmips/image/bcm63xx_nand.mk index 82b04891d5..6c4655bbab 100644 --- a/target/linux/bmips/image/bcm63xx_nand.mk +++ b/target/linux/bmips/image/bcm63xx_nand.mk @@ -63,6 +63,27 @@ define Device/comtrend_vr-3032u endef TARGET_DEVICES += comtrend_vr-3032u +define Device/huawei_hg253s-v2 + $(Device/bcm63xx-nand) + IMAGES := flash.bin sysupgrade.bin + IMAGE/flash.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | cfe-jffs2-cferam | append-ubi + DEVICE_VENDOR := Huawei + DEVICE_MODEL := HG253s + DEVICE_VARIANT := v2 + CHIP_ID := 6362 + CFE_PART_FLAGS := 1 + CFE_PART_ID := 0x0001EFEE + CFE_RAM_FILE := huawei,hg253s-v2/cferam.000 + CFE_RAM_JFFS2_NAME := cferam.000 + BLOCKSIZE := 128k + PAGESIZE := 2048 + SUBPAGESIZE := 512 + VID_HDR_OFFSET := 2048 + DEVICE_PACKAGES += $(USB2_PACKAGES) + CFE_WFI_FLASH_TYPE := 3 +endef +TARGET_DEVICES += huawei_hg253s-v2 + define Device/netgear_dgnd3700-v2 $(Device/bcm63xx-nand) DEVICE_VENDOR := NETGEAR diff --git a/target/linux/bmips/nand/base-files/etc/board.d/02_network b/target/linux/bmips/nand/base-files/etc/board.d/02_network index 3134116bc2..ce4440270c 100644 --- a/target/linux/bmips/nand/base-files/etc/board.d/02_network +++ b/target/linux/bmips/nand/base-files/etc/board.d/02_network @@ -9,6 +9,7 @@ comtrend,vr-3032u) ucidef_set_bridge_device switch ucidef_set_interface_lan "lan1 lan2 lan3 lan4" ;; +huawei,hg253s-v2 |\ netgear,dgnd3700-v2) ucidef_set_bridge_device switch ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan" diff --git a/target/linux/bmips/nand/base-files/lib/upgrade/platform.sh b/target/linux/bmips/nand/base-files/lib/upgrade/platform.sh index 05e6db1836..33217ed975 100644 --- a/target/linux/bmips/nand/base-files/lib/upgrade/platform.sh +++ b/target/linux/bmips/nand/base-files/lib/upgrade/platform.sh @@ -46,6 +46,7 @@ cfe_jffs2_nand_upgrade() { platform_do_upgrade() { case "$(board_name)" in comtrend,vr-3032u|\ + huawei,hg253s-v2|\ netgear,dgnd3700-v2) cfe_jffs2_nand_upgrade "$1" ;; From 68883278ab2973f6df226e023cabd3ab8353289b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Tue, 21 Mar 2023 20:21:16 +0100 Subject: [PATCH 16/26] bmips: dts: nand: add missing address/size cells MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes the following warnings for Netgear DGND3700v2 and Comtrend VR-3032u: [ 1.059540] 7 fixed-partitions partitions found on MTD device brcmnand.0 [ 1.066570] OF: Bad cell count for /ubus/nand@10000200/nandcs@0/partitions [ 1.073766] OF: Bad cell count for /ubus/nand@10000200/nandcs@0/partitions [ 1.081927] OF: Bad cell count for /ubus/nand@10000200/nandcs@0/partitions [ 1.089128] OF: Bad cell count for /ubus/nand@10000200/nandcs@0/partitions Signed-off-by: Álvaro Fernández Rojas --- target/linux/bmips/dts/bcm63168-comtrend-vr-3032u.dts | 3 +++ target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts | 3 +++ 2 files changed, 6 insertions(+) diff --git a/target/linux/bmips/dts/bcm63168-comtrend-vr-3032u.dts b/target/linux/bmips/dts/bcm63168-comtrend-vr-3032u.dts index 95fda0843c..22a0ffe792 100644 --- a/target/linux/bmips/dts/bcm63168-comtrend-vr-3032u.dts +++ b/target/linux/bmips/dts/bcm63168-comtrend-vr-3032u.dts @@ -162,6 +162,9 @@ nand-on-flash-bbt; brcm,nand-oob-sector-size = <64>; + #address-cells = <1>; + #size-cells = <1>; + partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts b/target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts index d0befc2c34..6333c4e7d7 100644 --- a/target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts +++ b/target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts @@ -210,6 +210,9 @@ nand-ecc-strength = <15>; nand-on-flash-bbt; + #address-cells = <1>; + #size-cells = <1>; + partitions { compatible = "fixed-partitions"; #address-cells = <1>; From 0c2b591b845640a733b5ead84970918e9240ebd5 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 19 Feb 2023 23:35:42 +0100 Subject: [PATCH 17/26] CI: kernel: skip subtarget test on non-specific target test Reduce testing time by skipping subtarget test on non-specific target test. Signed-off-by: Christian Marangi --- .github/workflows/kernel.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index 6a94e79779..a25829a4c0 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -52,6 +52,12 @@ jobs: TARGETS_SUBTARGETS="$(echo "$ALL_TARGETS" | sort -u -t '/' -k1 | awk '{ print $1 }')" TARGETS="$(echo "$ALL_TARGETS" | sort -u -t '/' -k1,1 | awk '{ print $1 }')" + # On testing non-specific target, skip testing each subtarget + if echo "$CHANGED_FILES" | grep -v -q target/linux || + echo "$CHANGED_FILES" | grep -q target/linux/generic; then + TARGETS_SUBTARGETS=$TARGETS + fi + JSON_TARGETS_SUBTARGETS='[' FIRST=1 for TARGET in $TARGETS_SUBTARGETS; do From a2973060ea354647e9684c5a386252cce965fcbc Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Wed, 22 Mar 2023 00:45:06 +0100 Subject: [PATCH 18/26] CI: build: disable cache of external toolchain/sdk Our buildbot build a different external toolchain/sdk for each build. This cause the idea of using the tar hash to cache it broken and wrong. This makes the github cache bloated and remove space for ccache cache. Drop cache for external toolchain/sdk as the feature is broken and cause problems to ccache cache. Signed-off-by: Christian Marangi --- .github/workflows/build.yml | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 19d3c23403..22286c054e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -198,13 +198,11 @@ jobs: if curl $SUMS_FILE | grep -q ".*openwrt-toolchain.*tar.xz"; then TOOLCHAIN_STRING="$( curl $SUMS_FILE | grep ".*openwrt-toolchain.*tar.xz")" TOOLCHAIN_FILE=$(echo "$TOOLCHAIN_STRING" | sed -n -e 's/.*\(openwrt-toolchain.*\).tar.xz/\1/p') - TOOLCHAIN_SHA256=$(echo "$TOOLCHAIN_STRING" | cut -d ' ' -f 1) echo "toolchain-type=external_toolchain" >> $GITHUB_OUTPUT elif curl $SUMS_FILE | grep -q ".*openwrt-sdk.*tar.xz"; then TOOLCHAIN_STRING="$( curl $SUMS_FILE | grep ".*openwrt-sdk.*tar.xz")" TOOLCHAIN_FILE=$(echo "$TOOLCHAIN_STRING" | sed -n -e 's/.*\(openwrt-sdk.*\).tar.xz/\1/p') - TOOLCHAIN_SHA256=$(echo "$TOOLCHAIN_STRING" | cut -d ' ' -f 1) echo "toolchain-type=external_sdk" >> $GITHUB_OUTPUT else @@ -212,17 +210,8 @@ jobs: fi echo "TOOLCHAIN_FILE=$TOOLCHAIN_FILE" >> "$GITHUB_ENV" - echo "TOOLCHAIN_SHA256=$TOOLCHAIN_SHA256" >> "$GITHUB_ENV" echo "TOOLCHAIN_PATH=$TOOLCHAIN_PATH" >> "$GITHUB_ENV" - - name: Cache external toolchain/sdk - if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type != 'internal' - id: cache-external-toolchain - uses: actions/cache@v3 - with: - path: openwrt/${{ env.TOOLCHAIN_FILE }} - key: ${{ env.TOOLCHAIN_FILE }}-${{ steps.parse-toolchain.outputs.toolchain-type }}-${{ env.TOOLCHAIN_SHA256 }} - - name: Cache ccache uses: actions/cache@v3 with: @@ -232,7 +221,7 @@ jobs: ccache-kernel-${{ env.TARGET }}/${{ env.SUBTARGET }}- - name: Download external toolchain/sdk - if: inputs.build_toolchain == false && steps.cache-external-toolchain.outputs.cache-hit != 'true' && steps.parse-toolchain.outputs.toolchain-type != 'internal' + if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type != 'internal' shell: su buildbot -c "sh -e {0}" working-directory: openwrt run: | @@ -284,7 +273,7 @@ jobs: --config ${{ env.TARGET }}/${{ env.SUBTARGET }} - name: Adapt external sdk to external toolchain format - if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_sdk' && steps.cache-external-toolchain.outputs.cache-hit != 'true' + if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_sdk' shell: su buildbot -c "sh -e {0}" working-directory: openwrt run: | From d2fc620d0a5e0287aa8d60fb10f5d5f590f571f2 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Tue, 14 Mar 2023 22:57:24 +0100 Subject: [PATCH 19/26] odhcpd: bump to latest git HEAD 7c0f603 router: skip RA and wait for LINK-LOCAL to be assigned ba30afc config: skip interface setup if interface not IFF_RUNNING 06b111e Revert "odhcpd: Reduce error messages" 90d6cc9 odhcpd: Reduce error messages Also drop AUTORELEASE since it got deprecated. Signed-off-by: Christian Marangi --- package/network/services/odhcpd/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/network/services/odhcpd/Makefile b/package/network/services/odhcpd/Makefile index 37280effbe..36d7a50aed 100644 --- a/package/network/services/odhcpd/Makefile +++ b/package/network/services/odhcpd/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=odhcpd -PKG_RELEASE:=$(AUTORELEASE) +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/odhcpd.git -PKG_SOURCE_DATE:=2023-02-17 -PKG_SOURCE_VERSION:=edc5e1738682e764e64bcbffde1e0a1cc9feac21 -PKG_MIRROR_HASH:=4d8f630770bcf4594c8fc0a2ee34bc40ce8618cc46e76ae5c3629da2fea9e90b +PKG_MIRROR_HASH:=a27ac6f006e6591487a2425adab0bf4c9975785e7d49120408d4e5c4ddb00d56 +PKG_SOURCE_DATE:=2023-03-22 +PKG_SOURCE_VERSION:=7c0f603abc1481ddabcdeae0eaaf72d5535ecefa PKG_MAINTAINER:=Hans Dedecker PKG_LICENSE:=GPL-2.0 From a97965b7b11f33ff8ebd49560c4c680e49deed67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Wed, 22 Mar 2023 18:24:28 +0100 Subject: [PATCH 20/26] kernel: add pending patches for bcm63268-timer-clocks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bcm63268-timer-clocks have been sent upstream with a positive review, so let's add them to pending v5.15. Also add devm_clk_hw_register_gate() patch from v5.17 to backports since it's needed for upstream bcm63268-timer-clocks patches. Signed-off-by: Álvaro Fernández Rojas --- ...add-BCM63268-timer-clock-definitions.patch | 35 ---- ...add-BCM63268-timer-reset-definitions.patch | 26 --- ...ngs-clock-Add-BCM63268-timer-binding.patch | 59 ------- ...k-gate-Add-devm_clk_hw_register_gate.patch | 105 ++++++++++++ ...add-BCM63268-timer-clock-definitions.patch | 114 +++++++++++++ ...add-BCM63268-timer-reset-definitions.patch | 107 ++++++++++++ ...M63268-timer-clock-and-reset-driver.patch} | 154 +++++++++++++----- 7 files changed, 435 insertions(+), 165 deletions(-) delete mode 100644 target/linux/bmips/patches-5.15/110-mips-bmips-add-BCM63268-timer-clock-definitions.patch delete mode 100644 target/linux/bmips/patches-5.15/111-mips-bmips-add-BCM63268-timer-reset-definitions.patch delete mode 100644 target/linux/bmips/patches-5.15/112-dt-bindings-clock-Add-BCM63268-timer-binding.patch create mode 100644 target/linux/generic/backport-5.15/080-v5.17-clk-gate-Add-devm_clk_hw_register_gate.patch create mode 100644 target/linux/generic/pending-5.15/850-dt-bindings-clk-add-BCM63268-timer-clock-definitions.patch create mode 100644 target/linux/generic/pending-5.15/851-dt-bindings-reset-add-BCM63268-timer-reset-definitions.patch rename target/linux/{bmips/patches-5.15/113-clk-bcm-Add-BCM63268-timer-clock-and-reset-driver.patch => generic/pending-5.15/852-clk-bcm-Add-BCM63268-timer-clock-and-reset-driver.patch} (52%) diff --git a/target/linux/bmips/patches-5.15/110-mips-bmips-add-BCM63268-timer-clock-definitions.patch b/target/linux/bmips/patches-5.15/110-mips-bmips-add-BCM63268-timer-clock-definitions.patch deleted file mode 100644 index 0df7db9717..0000000000 --- a/target/linux/bmips/patches-5.15/110-mips-bmips-add-BCM63268-timer-clock-definitions.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 5a079515cb3066aeb658634301a98871b47c2af4 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= -Date: Thu, 25 Feb 2021 19:44:22 +0100 -Subject: [PATCH 1/4] mips: bmips: add BCM63268 timer clock definitions -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Add missing timer clock definitions for BCM63268. - -Signed-off-by: Álvaro Fernández Rojas ---- - include/dt-bindings/clock/bcm63268-clock.h | 13 +++++++++++++ - 1 file changed, 13 insertions(+) - ---- a/include/dt-bindings/clock/bcm63268-clock.h -+++ b/include/dt-bindings/clock/bcm63268-clock.h -@@ -27,4 +27,17 @@ - #define BCM63268_CLK_TBUS 27 - #define BCM63268_CLK_ROBOSW250 31 - -+#define BCM63268_TCLK_EPHY1 0 -+#define BCM63268_TCLK_EPHY2 1 -+#define BCM63268_TCLK_EPHY3 2 -+#define BCM63268_TCLK_GPHY1 3 -+#define BCM63268_TCLK_DSL 4 -+#define BCM63268_TCLK_WAKEON_EPHY 6 -+#define BCM63268_TCLK_WAKEON_DSL 7 -+#define BCM63268_TCLK_FAP1 11 -+#define BCM63268_TCLK_FAP2 15 -+#define BCM63268_TCLK_UTO_50 16 -+#define BCM63268_TCLK_UTO_EXTIN 17 -+#define BCM63268_TCLK_USB_REF 18 -+ - #endif /* __DT_BINDINGS_CLOCK_BCM63268_H */ diff --git a/target/linux/bmips/patches-5.15/111-mips-bmips-add-BCM63268-timer-reset-definitions.patch b/target/linux/bmips/patches-5.15/111-mips-bmips-add-BCM63268-timer-reset-definitions.patch deleted file mode 100644 index 7b694d3289..0000000000 --- a/target/linux/bmips/patches-5.15/111-mips-bmips-add-BCM63268-timer-reset-definitions.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 3327df17635dd9d24a855ac6b7247fac381514cf Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= -Date: Thu, 25 Feb 2021 19:45:04 +0100 -Subject: [PATCH 2/4] mips: bmips: add BCM63268 timer reset definitions -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Add missing timer reset definitions for BCM63268. - -Signed-off-by: Álvaro Fernández Rojas ---- - include/dt-bindings/reset/bcm63268-reset.h | 4 ++++ - 1 file changed, 4 insertions(+) - ---- a/include/dt-bindings/reset/bcm63268-reset.h -+++ b/include/dt-bindings/reset/bcm63268-reset.h -@@ -23,4 +23,8 @@ - #define BCM63268_RST_PCIE_HARD 17 - #define BCM63268_RST_GPHY 18 - -+#define BCM63268_TRST_SW 29 -+#define BCM63268_TRST_HW 30 -+#define BCM63268_TRST_POR 31 -+ - #endif /* __DT_BINDINGS_RESET_BCM63268_H */ diff --git a/target/linux/bmips/patches-5.15/112-dt-bindings-clock-Add-BCM63268-timer-binding.patch b/target/linux/bmips/patches-5.15/112-dt-bindings-clock-Add-BCM63268-timer-binding.patch deleted file mode 100644 index 945bdfc3d0..0000000000 --- a/target/linux/bmips/patches-5.15/112-dt-bindings-clock-Add-BCM63268-timer-binding.patch +++ /dev/null @@ -1,59 +0,0 @@ -From c17702bad18a085ae913752b45bcc20c2cea879e Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= -Date: Thu, 25 Feb 2021 19:53:08 +0100 -Subject: [PATCH 3/4] dt-bindings: clock: Add BCM63268 timer binding -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Document the Broadcom BCM63268 Clock and Reset controller. - -Signed-off-by: Álvaro Fernández Rojas ---- - .../clock/brcm,bcm63268-timer-clocks.yaml | 40 +++++++++++++++++++ - 1 file changed, 40 insertions(+) - create mode 100644 Documentation/devicetree/bindings/clock/brcm,bcm63268-timer-clocks.yaml - ---- /dev/null -+++ b/Documentation/devicetree/bindings/clock/brcm,bcm63268-timer-clocks.yaml -@@ -0,0 +1,40 @@ -+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) -+%YAML 1.2 -+--- -+$id: http://devicetree.org/schemas/clock/brcm,bcm63268-timer-clocks.yaml# -+$schema: http://devicetree.org/meta-schemas/core.yaml# -+ -+title: Broadcom BCM63268 Timer Clock and Reset Device Tree Bindings -+ -+maintainers: -+ - Álvaro Fernández Rojas -+ -+properties: -+ compatible: -+ const: brcm,bcm63268-timer-clocks -+ -+ reg: -+ maxItems: 1 -+ -+ "#clock-cells": -+ const: 1 -+ -+ "#reset-cells": -+ const: 1 -+ -+required: -+ - compatible -+ - reg -+ - "#clock-cells" -+ - "#reset-cells" -+ -+additionalProperties: false -+ -+examples: -+ - | -+ timer_clk: clock-controller@100000ac { -+ compatible = "brcm,bcm63268-timer-clocks"; -+ reg = <0x100000ac 0x4>; -+ #clock-cells = <1>; -+ #reset-cells = <1>; -+ }; diff --git a/target/linux/generic/backport-5.15/080-v5.17-clk-gate-Add-devm_clk_hw_register_gate.patch b/target/linux/generic/backport-5.15/080-v5.17-clk-gate-Add-devm_clk_hw_register_gate.patch new file mode 100644 index 0000000000..51c23b6e34 --- /dev/null +++ b/target/linux/generic/backport-5.15/080-v5.17-clk-gate-Add-devm_clk_hw_register_gate.patch @@ -0,0 +1,105 @@ +From 815f0e738a8d5663a02350e2580706829144a722 Mon Sep 17 00:00:00 2001 +From: Horatiu Vultur +Date: Wed, 3 Nov 2021 09:50:59 +0100 +Subject: [PATCH] clk: gate: Add devm_clk_hw_register_gate() + +Add devm_clk_hw_register_gate() - devres-managed version of +clk_hw_register_gate() + +Suggested-by: Stephen Boyd +Signed-off-by: Horatiu Vultur +Acked-by: Nicolas Ferre +Signed-off-by: Nicolas Ferre +Link: https://lore.kernel.org/r/20211103085102.1656081-2-horatiu.vultur@microchip.com +--- + drivers/clk/clk-gate.c | 35 +++++++++++++++++++++++++++++++++++ + include/linux/clk-provider.h | 23 +++++++++++++++++++++++ + 2 files changed, 58 insertions(+) + +--- a/drivers/clk/clk-gate.c ++++ b/drivers/clk/clk-gate.c +@@ -7,6 +7,7 @@ + */ + + #include ++#include + #include + #include + #include +@@ -222,3 +223,37 @@ void clk_hw_unregister_gate(struct clk_h + kfree(gate); + } + EXPORT_SYMBOL_GPL(clk_hw_unregister_gate); ++ ++static void devm_clk_hw_release_gate(struct device *dev, void *res) ++{ ++ clk_hw_unregister_gate(*(struct clk_hw **)res); ++} ++ ++struct clk_hw *__devm_clk_hw_register_gate(struct device *dev, ++ struct device_node *np, const char *name, ++ const char *parent_name, const struct clk_hw *parent_hw, ++ const struct clk_parent_data *parent_data, ++ unsigned long flags, ++ void __iomem *reg, u8 bit_idx, ++ u8 clk_gate_flags, spinlock_t *lock) ++{ ++ struct clk_hw **ptr, *hw; ++ ++ ptr = devres_alloc(devm_clk_hw_release_gate, sizeof(*ptr), GFP_KERNEL); ++ if (!ptr) ++ return ERR_PTR(-ENOMEM); ++ ++ hw = __clk_hw_register_gate(dev, np, name, parent_name, parent_hw, ++ parent_data, flags, reg, bit_idx, ++ clk_gate_flags, lock); ++ ++ if (!IS_ERR(hw)) { ++ *ptr = hw; ++ devres_add(dev, ptr); ++ } else { ++ devres_free(ptr); ++ } ++ ++ return hw; ++} ++EXPORT_SYMBOL_GPL(__devm_clk_hw_register_gate); +--- a/include/linux/clk-provider.h ++++ b/include/linux/clk-provider.h +@@ -490,6 +490,13 @@ struct clk_hw *__clk_hw_register_gate(st + unsigned long flags, + void __iomem *reg, u8 bit_idx, + u8 clk_gate_flags, spinlock_t *lock); ++struct clk_hw *__devm_clk_hw_register_gate(struct device *dev, ++ struct device_node *np, const char *name, ++ const char *parent_name, const struct clk_hw *parent_hw, ++ const struct clk_parent_data *parent_data, ++ unsigned long flags, ++ void __iomem *reg, u8 bit_idx, ++ u8 clk_gate_flags, spinlock_t *lock); + struct clk *clk_register_gate(struct device *dev, const char *name, + const char *parent_name, unsigned long flags, + void __iomem *reg, u8 bit_idx, +@@ -544,6 +551,22 @@ struct clk *clk_register_gate(struct dev + __clk_hw_register_gate((dev), NULL, (name), NULL, NULL, (parent_data), \ + (flags), (reg), (bit_idx), \ + (clk_gate_flags), (lock)) ++/** ++ * devm_clk_hw_register_gate - register a gate clock with the clock framework ++ * @dev: device that is registering this clock ++ * @name: name of this clock ++ * @parent_name: name of this clock's parent ++ * @flags: framework-specific flags for this clock ++ * @reg: register address to control gating of this clock ++ * @bit_idx: which bit in the register controls gating of this clock ++ * @clk_gate_flags: gate-specific flags for this clock ++ * @lock: shared register lock for this clock ++ */ ++#define devm_clk_hw_register_gate(dev, name, parent_name, flags, reg, bit_idx,\ ++ clk_gate_flags, lock) \ ++ __devm_clk_hw_register_gate((dev), NULL, (name), (parent_name), NULL, \ ++ NULL, (flags), (reg), (bit_idx), \ ++ (clk_gate_flags), (lock)) + void clk_unregister_gate(struct clk *clk); + void clk_hw_unregister_gate(struct clk_hw *hw); + int clk_gate_is_enabled(struct clk_hw *hw); diff --git a/target/linux/generic/pending-5.15/850-dt-bindings-clk-add-BCM63268-timer-clock-definitions.patch b/target/linux/generic/pending-5.15/850-dt-bindings-clk-add-BCM63268-timer-clock-definitions.patch new file mode 100644 index 0000000000..cc6f1e0d9d --- /dev/null +++ b/target/linux/generic/pending-5.15/850-dt-bindings-clk-add-BCM63268-timer-clock-definitions.patch @@ -0,0 +1,114 @@ +From patchwork Wed Mar 22 17:15:12 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +X-Patchwork-Submitter: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= + +X-Patchwork-Id: 13184389 +Return-Path: +X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on + aws-us-west-2-korg-lkml-1.web.codeaurora.org +Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) + by smtp.lore.kernel.org (Postfix) with ESMTP id 73F2DC6FD1C + for ; Wed, 22 Mar 2023 17:15:59 +0000 (UTC) +Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand + id S231363AbjCVRP5 (ORCPT ); + Wed, 22 Mar 2023 13:15:57 -0400 +Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58824 "EHLO + lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org + with ESMTP id S231408AbjCVRPy (ORCPT + ); Wed, 22 Mar 2023 13:15:54 -0400 +Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com + [IPv6:2a00:1450:4864:20::32d]) + by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70E4C64B28; + Wed, 22 Mar 2023 10:15:24 -0700 (PDT) +Received: by mail-wm1-x32d.google.com with SMTP id n19so1740892wms.0; + Wed, 22 Mar 2023 10:15:24 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=gmail.com; s=20210112; t=1679505322; + h=content-transfer-encoding:mime-version:references:in-reply-to + :message-id:date:subject:cc:to:from:from:to:cc:subject:date + :message-id:reply-to; + bh=dEknM98Izmc8d/crPsoJ+ejZxfl78958Ei6SPYhYDHs=; + b=LTOQ75W3s5nYo+nEfiJAKqytSopONB4jCtU3zRygzPMasugVOrYFMsUR+WrpsAjuRT + v4HgWpJxEsIWeRXrUN9W21mFXhGgJLJXSxRnrio0CsZZBNMdkebbNOphgKXIWAdm+2iM + PzqAdGm5t38wT2mmm6V/9hCy90+12raHM82tNFdhhiezfg2cukVOKP3j/TeOVCwas0gQ + iFc+CuZB6y73zYXvMUMUpTsqI5vev4xJsSMHIQJVmUxJAwqhOBhN9JCRo7Ao+wayjn2d + Fxo6AV3A8v68nVfoQ0K0I+eWXG48nMCX45iWh/lVvVTOFcR99kn4va7NY1oVnPsh+WQz + WcLA== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20210112; t=1679505322; + h=content-transfer-encoding:mime-version:references:in-reply-to + :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc + :subject:date:message-id:reply-to; + bh=dEknM98Izmc8d/crPsoJ+ejZxfl78958Ei6SPYhYDHs=; + b=wv2NSR1B5RnsdoEE7mgJSHAfSs1JHZbQ1HPMldyaGWAk1dcucqh/uDzM3Flz+ADRi1 + 19NoaB2Ur7QaWZejbuplnIOK/nte3PnmqJ9ZNw8HejmuS4eU8mB1V1aJUSKSPGsfUi4a + LYe3HSw87l0jrAC7ptdKvdUtzBoIkX0CeFvfguTQQkDhUTyAFIG144hY6uPXY9Mga96b + gnNe2dLCzHQLbEJpaDaavT7FEEcLDxaq7jNcR2xqEEZaIwfcew+Q05t4xL/3i8GAj9Ru + 6ivQjIbBKfYQF88o7KnOW9o1wjrGsk+Nd4Iy0OLZix3JQasCJGrKV7ib5awI9J39upYV + fa4A== +X-Gm-Message-State: AO0yUKWw75I1M5Vjrd4vXq4GTruQu0H84pycgyi2CT3bczTYRJpWmEWg + +bHDhvp1n5IWW85GI9vKWpbclB13a/S0RQ== +X-Google-Smtp-Source: + AK7set9T/2oJsVetUb2L4mPEWu8YqDrnK8EzHK5bJf1ABIa1Et8f7BFJ7AA3j14ITZuf8cH0HqlRtg== +X-Received: by 2002:a05:600c:2304:b0:3ed:2949:985b with SMTP id + 4-20020a05600c230400b003ed2949985bmr206833wmo.23.1679505322457; + Wed, 22 Mar 2023 10:15:22 -0700 (PDT) +Received: from atlantis.lan (255.red-79-146-124.dynamicip.rima-tde.net. + [79.146.124.255]) + by smtp.gmail.com with ESMTPSA id + v10-20020a05600c470a00b003ee11ac2288sm8414333wmo.21.2023.03.22.10.15.21 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Wed, 22 Mar 2023 10:15:22 -0700 (PDT) +From: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= +To: mturquette@baylibre.com, sboyd@kernel.org, robh+dt@kernel.org, + krzysztof.kozlowski+dt@linaro.org, p.zabel@pengutronix.de, + f.fainelli@gmail.com, jonas.gorski@gmail.com, + william.zhang@broadcom.com, linux-clk@vger.kernel.org, + devicetree@vger.kernel.org, linux-kernel@vger.kernel.org +Cc: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= , + Rob Herring +Subject: [PATCH v4 1/4] dt-bindings: clk: add BCM63268 timer clock definitions +Date: Wed, 22 Mar 2023 18:15:12 +0100 +Message-Id: <20230322171515.120353-2-noltari@gmail.com> +X-Mailer: git-send-email 2.30.2 +In-Reply-To: <20230322171515.120353-1-noltari@gmail.com> +References: <20230322171515.120353-1-noltari@gmail.com> +MIME-Version: 1.0 +Precedence: bulk +List-ID: +X-Mailing-List: linux-clk@vger.kernel.org + +Add missing timer clock definitions for BCM63268. + +Signed-off-by: Álvaro Fernández Rojas +Acked-by: Rob Herring +--- + v4: no changes + v3: no changes + v2: change commit title, as suggested by Stephen Boyd + + include/dt-bindings/clock/bcm63268-clock.h | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +--- a/include/dt-bindings/clock/bcm63268-clock.h ++++ b/include/dt-bindings/clock/bcm63268-clock.h +@@ -27,4 +27,17 @@ + #define BCM63268_CLK_TBUS 27 + #define BCM63268_CLK_ROBOSW250 31 + ++#define BCM63268_TCLK_EPHY1 0 ++#define BCM63268_TCLK_EPHY2 1 ++#define BCM63268_TCLK_EPHY3 2 ++#define BCM63268_TCLK_GPHY1 3 ++#define BCM63268_TCLK_DSL 4 ++#define BCM63268_TCLK_WAKEON_EPHY 6 ++#define BCM63268_TCLK_WAKEON_DSL 7 ++#define BCM63268_TCLK_FAP1 11 ++#define BCM63268_TCLK_FAP2 15 ++#define BCM63268_TCLK_UTO_50 16 ++#define BCM63268_TCLK_UTO_EXTIN 17 ++#define BCM63268_TCLK_USB_REF 18 ++ + #endif /* __DT_BINDINGS_CLOCK_BCM63268_H */ diff --git a/target/linux/generic/pending-5.15/851-dt-bindings-reset-add-BCM63268-timer-reset-definitions.patch b/target/linux/generic/pending-5.15/851-dt-bindings-reset-add-BCM63268-timer-reset-definitions.patch new file mode 100644 index 0000000000..5f1be105ac --- /dev/null +++ b/target/linux/generic/pending-5.15/851-dt-bindings-reset-add-BCM63268-timer-reset-definitions.patch @@ -0,0 +1,107 @@ +From patchwork Wed Mar 22 17:15:13 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +X-Patchwork-Submitter: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= + +X-Patchwork-Id: 13184390 +Return-Path: +X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on + aws-us-west-2-korg-lkml-1.web.codeaurora.org +Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) + by smtp.lore.kernel.org (Postfix) with ESMTP id D0B1AC6FD1C + for ; Wed, 22 Mar 2023 17:16:08 +0000 (UTC) +Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand + id S231472AbjCVRQI (ORCPT ); + Wed, 22 Mar 2023 13:16:08 -0400 +Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58934 "EHLO + lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org + with ESMTP id S231435AbjCVRP5 (ORCPT + ); Wed, 22 Mar 2023 13:15:57 -0400 +Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com + [IPv6:2a00:1450:4864:20::329]) + by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9655064863; + Wed, 22 Mar 2023 10:15:25 -0700 (PDT) +Received: by mail-wm1-x329.google.com with SMTP id + v4-20020a05600c470400b003ee4f06428fso2424553wmo.4; + Wed, 22 Mar 2023 10:15:25 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=gmail.com; s=20210112; t=1679505324; + h=content-transfer-encoding:mime-version:references:in-reply-to + :message-id:date:subject:cc:to:from:from:to:cc:subject:date + :message-id:reply-to; + bh=C7ykhArT1dO7P8wtmI92eo4c7KtPZI9w182/5+cB3T0=; + b=WRZRU2SM9n1LfUj4SgTPfQczADC2pfvoIrOsNpBLTym2eOfmkTetb/WbGSla5kw2Wb + SH5MIC2fFeScJg6T5FFAUOOLmRVW9xvl8Q3T3NKb3z/9wvPHO767nrdIbffRWMJFs7gW + wT/kuTpn8GYdfY0sZ/dMTkq41DVusEkxfX6GxtG85O98ZP8xMHQog8aPs9fRfUvI5ZKB + eGYcRz/Wn1cHhjey9jtWzQEEmZ/BT3b0HQTF9Tl88oofhiEgbyjFXr91+vRsLbsJpGXH + /1FjjaLG5DnonKubV9rmbuCU8KzwH331gi2KuRjvLD2V+OMewqSa5i+GvgVv8x2zC8y+ + /mLQ== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20210112; t=1679505324; + h=content-transfer-encoding:mime-version:references:in-reply-to + :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc + :subject:date:message-id:reply-to; + bh=C7ykhArT1dO7P8wtmI92eo4c7KtPZI9w182/5+cB3T0=; + b=bhd0fNh0jDOMlGSC4F+p5igV8AUlGEPj2cXUwgdgqRfSSuUy9z+Li8cT0MbY/aWH5Z + qInRVA+R1cWV3ubrDyKag6oEc0LDU234bnMFcP9b7MRlrM8Dpit9TFSyqJU4sDUWNDs5 + KOe2k/SNIdat6munC9VOuEBDO0eB/UDMN+repKwXNdHChp/Toq9qMvW4Uy8uHxosbQlD + 8P88GbKFjynb1E8I8croGjfub7+y8PPsWB0xNUcafIv6xs3MnVOP1Mk4KwBCbqS509la + mfjsriXtIybO8XFqtn100ungjvbFWdogEplLdSPVdgAqdfF5J8gHxAoApoeYejYkL5/R + kOhQ== +X-Gm-Message-State: AO0yUKWdzr3dMmjKhD8tF+ec4Dfdq9VGZ/WCU4d85npKQvxSwhNPZZ1J + 5WYRIqivh0suFC1OqEidwenpiJYvXedYjw== +X-Google-Smtp-Source: + AK7set87ew2/mKWeShXTTW/YBbBJNR2zeGFV0CfuqLXhiJEU6tqFuyKcW+vFEoKHIbNUS8wRy1SzLA== +X-Received: by 2002:a05:600c:290:b0:3ee:6d88:774a with SMTP id + 16-20020a05600c029000b003ee6d88774amr160734wmk.14.1679505323514; + Wed, 22 Mar 2023 10:15:23 -0700 (PDT) +Received: from atlantis.lan (255.red-79-146-124.dynamicip.rima-tde.net. + [79.146.124.255]) + by smtp.gmail.com with ESMTPSA id + v10-20020a05600c470a00b003ee11ac2288sm8414333wmo.21.2023.03.22.10.15.22 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Wed, 22 Mar 2023 10:15:23 -0700 (PDT) +From: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= +To: mturquette@baylibre.com, sboyd@kernel.org, robh+dt@kernel.org, + krzysztof.kozlowski+dt@linaro.org, p.zabel@pengutronix.de, + f.fainelli@gmail.com, jonas.gorski@gmail.com, + william.zhang@broadcom.com, linux-clk@vger.kernel.org, + devicetree@vger.kernel.org, linux-kernel@vger.kernel.org +Cc: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= , + Rob Herring +Subject: [PATCH v4 2/4] dt-bindings: reset: add BCM63268 timer reset + definitions +Date: Wed, 22 Mar 2023 18:15:13 +0100 +Message-Id: <20230322171515.120353-3-noltari@gmail.com> +X-Mailer: git-send-email 2.30.2 +In-Reply-To: <20230322171515.120353-1-noltari@gmail.com> +References: <20230322171515.120353-1-noltari@gmail.com> +MIME-Version: 1.0 +Precedence: bulk +List-ID: +X-Mailing-List: linux-clk@vger.kernel.org + +Add missing timer reset definitions for BCM63268. + +Signed-off-by: Álvaro Fernández Rojas +Acked-by: Rob Herring +--- + v4: no changes + v3: no changes + v2: change commit title, as suggested by Stephen Boyd + + include/dt-bindings/reset/bcm63268-reset.h | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/include/dt-bindings/reset/bcm63268-reset.h ++++ b/include/dt-bindings/reset/bcm63268-reset.h +@@ -23,4 +23,8 @@ + #define BCM63268_RST_PCIE_HARD 17 + #define BCM63268_RST_GPHY 18 + ++#define BCM63268_TRST_SW 29 ++#define BCM63268_TRST_HW 30 ++#define BCM63268_TRST_POR 31 ++ + #endif /* __DT_BINDINGS_RESET_BCM63268_H */ diff --git a/target/linux/bmips/patches-5.15/113-clk-bcm-Add-BCM63268-timer-clock-and-reset-driver.patch b/target/linux/generic/pending-5.15/852-clk-bcm-Add-BCM63268-timer-clock-and-reset-driver.patch similarity index 52% rename from target/linux/bmips/patches-5.15/113-clk-bcm-Add-BCM63268-timer-clock-and-reset-driver.patch rename to target/linux/generic/pending-5.15/852-clk-bcm-Add-BCM63268-timer-clock-and-reset-driver.patch index 484647a6e1..7e500cd1b5 100644 --- a/target/linux/bmips/patches-5.15/113-clk-bcm-Add-BCM63268-timer-clock-and-reset-driver.patch +++ b/target/linux/generic/pending-5.15/852-clk-bcm-Add-BCM63268-timer-clock-and-reset-driver.patch @@ -1,19 +1,100 @@ -From 3c8dd9d0937a19f3f20f28ba0b0b64f448d50dd4 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= -Date: Thu, 25 Feb 2021 19:54:04 +0100 -Subject: [PATCH 4/4] clk: bcm: Add BCM63268 timer clock and reset driver +From patchwork Wed Mar 22 17:15:15 2023 +Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit +X-Patchwork-Submitter: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= + +X-Patchwork-Id: 13184392 +Return-Path: +X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on + aws-us-west-2-korg-lkml-1.web.codeaurora.org +Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) + by smtp.lore.kernel.org (Postfix) with ESMTP id 199D9C76196 + for ; Wed, 22 Mar 2023 17:16:11 +0000 (UTC) +Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand + id S231512AbjCVRQJ (ORCPT ); + Wed, 22 Mar 2023 13:16:09 -0400 +Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58942 "EHLO + lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org + with ESMTP id S231442AbjCVRP5 (ORCPT + ); Wed, 22 Mar 2023 13:15:57 -0400 +Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com + [IPv6:2a00:1450:4864:20::32c]) + by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DDB36487D; + Wed, 22 Mar 2023 10:15:27 -0700 (PDT) +Received: by mail-wm1-x32c.google.com with SMTP id + i5-20020a05600c354500b003edd24054e0so6717370wmq.4; + Wed, 22 Mar 2023 10:15:27 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=gmail.com; s=20210112; t=1679505325; + h=content-transfer-encoding:mime-version:references:in-reply-to + :message-id:date:subject:cc:to:from:from:to:cc:subject:date + :message-id:reply-to; + bh=rkv/eZYA1ncHp5FnV2ZWc3hgYnAx28S86QA9vmcXFCY=; + b=Y1mva2Bt3sUbKxLgEUS331CJbGxUc4z8kTQW8qiHWGhYlFKtm+d5z4sT40E5BeZAnU + zmTbCI7jbroe9NYBxGUmSli6LNVDPjND80ChbhWTqbqMQTmeQFWut9KmeBWK6Oze2lC/ + XMSOorUzowjcU2xtHNrzoq2KH2pstW573lsB8WnzFVfhMaRkE9DfRr6WNyA7zC8DyxM5 + ezxlCQtCmgPfCqlyksbIDKrgrRf3GiUR0yUd6xRU+MssyvH1FkYGDCerPctDto6lGHBz + 8Y15jT3l6OnQMT6dkekgpPF5/XrSUY93u9g0B4U8+0dhNj+K7vmDen+jqdess+tpLnq/ + gFrA== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20210112; t=1679505325; + h=content-transfer-encoding:mime-version:references:in-reply-to + :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc + :subject:date:message-id:reply-to; + bh=rkv/eZYA1ncHp5FnV2ZWc3hgYnAx28S86QA9vmcXFCY=; + b=Ym4+u8bbTQGNkewUBrLf+89vE0EFJBQp2f1crwUxZFboKTROF9ltZonY1CGepo7b0B + fkx3TbWQy5X65g3ScuieqtClCI8WanPeNBJ48+JipJYO3ODVNBxnVaTuW/0FOIcahfqe + sG5GvggHhzRz+Yeybsbnupmzxnw8Ez0BpMl3p7zcjHL7BGZDdOOX2Zbw3zfyYa5sg2nX + UXYJT36zy2h39gxUsy9QkhQ76CG3w6omniohZpYidpojpiDjbOy0nKFky4kUe+YyA1fF + 4IBhjAm6mH+uh6wHSG1qj+NAXHs0xDDJps16PbJwAgL7Qt9K5WW+R/UAYPmHFgaRIHOw + /seA== +X-Gm-Message-State: AO0yUKXRtoYO8Nfus6Ca8lhM39P1Xn6TGkhatEfoISd1YNOkTJJN2hW+ + xRphLgxlzNfCLcVPlpGK9dk= +X-Google-Smtp-Source: + AK7set9VnMEykugk8ZYnkXuqK41bX1dzlvKsAXHEjr8i2NZBld0buKhQLcGYEcwxnBgVTtC7eRGfXw== +X-Received: by 2002:a1c:7c0b:0:b0:3e2:1dac:b071 with SMTP id + x11-20020a1c7c0b000000b003e21dacb071mr178053wmc.13.1679505325582; + Wed, 22 Mar 2023 10:15:25 -0700 (PDT) +Received: from atlantis.lan (255.red-79-146-124.dynamicip.rima-tde.net. + [79.146.124.255]) + by smtp.gmail.com with ESMTPSA id + v10-20020a05600c470a00b003ee11ac2288sm8414333wmo.21.2023.03.22.10.15.24 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Wed, 22 Mar 2023 10:15:25 -0700 (PDT) +From: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= +To: mturquette@baylibre.com, sboyd@kernel.org, robh+dt@kernel.org, + krzysztof.kozlowski+dt@linaro.org, p.zabel@pengutronix.de, + f.fainelli@gmail.com, jonas.gorski@gmail.com, + william.zhang@broadcom.com, linux-clk@vger.kernel.org, + devicetree@vger.kernel.org, linux-kernel@vger.kernel.org +Cc: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= +Subject: [PATCH v4 4/4] clk: bcm: Add BCM63268 timer clock and reset driver +Date: Wed, 22 Mar 2023 18:15:15 +0100 +Message-Id: <20230322171515.120353-5-noltari@gmail.com> +X-Mailer: git-send-email 2.30.2 +In-Reply-To: <20230322171515.120353-1-noltari@gmail.com> +References: <20230322171515.120353-1-noltari@gmail.com> +MIME-Version: 1.0 +Precedence: bulk +List-ID: +X-Mailing-List: linux-clk@vger.kernel.org Add driver for BCM63268 timer clock and reset controller. Signed-off-by: Álvaro Fernández Rojas --- + v4: add changes suggested by Stephen Boyd: + - Usage of of_device_get_match_data() isn't needed. + - Use devm_clk_hw_register_gate(). + - Drop clk_hw_unregister_gate(). + v3: add missing include to fix build warning + v2: add changes suggested by Stephen Boyd + drivers/clk/bcm/Kconfig | 9 ++ drivers/clk/bcm/Makefile | 1 + - drivers/clk/bcm/clk-bcm63268-timer.c | 232 +++++++++++++++++++++++++++ - 3 files changed, 242 insertions(+) + drivers/clk/bcm/clk-bcm63268-timer.c | 215 +++++++++++++++++++++++++++ + 3 files changed, 225 insertions(+) create mode 100644 drivers/clk/bcm/clk-bcm63268-timer.c --- a/drivers/clk/bcm/Kconfig @@ -46,17 +127,17 @@ Signed-off-by: Álvaro Fernández Rojas obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm281xx.o --- /dev/null +++ b/drivers/clk/bcm/clk-bcm63268-timer.c -@@ -0,0 +1,232 @@ +@@ -0,0 +1,215 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * BCM63268 Timer Clock and Reset Controller Driver + * -+ * Copyright (C) 2021 Álvaro Fernández Rojas ++ * Copyright (C) 2023 Álvaro Fernández Rojas + */ + +#include +#include -+#include ++#include +#include +#include +#include @@ -78,7 +159,6 @@ Signed-off-by: Álvaro Fernández Rojas +struct bcm63268_tclk_table_entry { + const char * const name; + u8 bit; -+ unsigned long flags; +}; + +static const struct bcm63268_tclk_table_entry bcm63268_timer_clocks[] = { @@ -197,17 +277,14 @@ Signed-off-by: Álvaro Fernández Rojas +static int bcm63268_tclk_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; -+ const struct bcm63268_tclk_table_entry *entry, *table; ++ const struct bcm63268_tclk_table_entry *entry; + struct bcm63268_tclkrst_hw *hw; ++ struct clk_hw *clk; + u8 maxbit = 0; + int i, ret; + -+ table = of_device_get_match_data(dev); -+ if (!table) -+ return -EINVAL; -+ -+ for (entry = table; entry->name; entry++) -+ maxbit = max_t(u8, maxbit, entry->bit); ++ for (entry = bcm63268_timer_clocks; entry->name; entry++) ++ maxbit = max(maxbit, entry->bit); + maxbit++; + + hw = devm_kzalloc(&pdev->dev, struct_size(hw, data.hws, maxbit), @@ -227,24 +304,21 @@ Signed-off-by: Álvaro Fernández Rojas + if (IS_ERR(hw->regs)) + return PTR_ERR(hw->regs); + -+ for (entry = table; entry->name; entry++) { -+ struct clk_hw *clk; -+ -+ clk = clk_hw_register_gate(dev, entry->name, NULL, -+ entry->flags, hw->regs, entry->bit, -+ CLK_GATE_BIG_ENDIAN, &hw->lock); -+ if (IS_ERR(clk)) { -+ ret = PTR_ERR(clk); -+ goto out_err; -+ } ++ for (entry = bcm63268_timer_clocks; entry->name; entry++) { ++ clk = devm_clk_hw_register_gate(dev, entry->name, NULL, 0, ++ hw->regs, entry->bit, ++ CLK_GATE_BIG_ENDIAN, ++ &hw->lock); ++ if (IS_ERR(clk)) ++ return PTR_ERR(clk); + + hw->data.hws[entry->bit] = clk; + } + -+ ret = of_clk_add_hw_provider(dev->of_node, of_clk_hw_onecell_get, -+ &hw->data); -+ if (!ret) -+ return 0; ++ ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get, ++ &hw->data); ++ if (ret) ++ return ret; + + hw->rcdev.of_node = dev->of_node; + hw->rcdev.ops = &bcm63268_timer_reset_ops; @@ -253,22 +327,12 @@ Signed-off-by: Álvaro Fernández Rojas + if (ret) + dev_err(dev, "Failed to register reset controller\n"); + -+out_err: -+ for (i = 0; i < hw->data.num; i++) { -+ if (!IS_ERR(hw->data.hws[i])) -+ clk_hw_unregister_gate(hw->data.hws[i]); -+ } -+ -+ return ret; ++ return 0; +} + +static const struct of_device_id bcm63268_tclk_dt_ids[] = { -+ { -+ .compatible = "brcm,bcm63268-timer-clocks", -+ .data = &bcm63268_timer_clocks, -+ }, { -+ /* sentinel */ -+ } ++ { .compatible = "brcm,bcm63268-timer-clocks" }, ++ { /* sentinel */ } +}; + +static struct platform_driver bcm63268_tclk = { From cc07d1d2fd3662611e2044c9fc514f7f756ebd6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Wed, 22 Mar 2023 18:30:37 +0100 Subject: [PATCH 21/26] bmips: drop unneded cpu labels from external switches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These labels aren't needed and were accidentally added when adding external switches support for bmips. Fixes: 80a3ecc89489 ("bmips: add Huawei HG253s v2 support") Fixes: 61f3c3b1eebd ("bmips: dgnd3700v2: enable external BCM53125 switch") Signed-off-by: Álvaro Fernández Rojas --- target/linux/bmips/dts/bcm6362-huawei-hg253s-v2.dts | 1 - target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts | 1 - 2 files changed, 2 deletions(-) diff --git a/target/linux/bmips/dts/bcm6362-huawei-hg253s-v2.dts b/target/linux/bmips/dts/bcm6362-huawei-hg253s-v2.dts index c3bf11629b..e848b99b2c 100644 --- a/target/linux/bmips/dts/bcm6362-huawei-hg253s-v2.dts +++ b/target/linux/bmips/dts/bcm6362-huawei-hg253s-v2.dts @@ -123,7 +123,6 @@ port@8 { reg = <8>; - label = "cpu"; phy-mode = "rgmii"; ethernet = <&switch0port4>; diff --git a/target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts b/target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts index 6333c4e7d7..c96a6c4585 100644 --- a/target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts +++ b/target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts @@ -186,7 +186,6 @@ port@8 { reg = <8>; - label = "cpu"; phy-mode = "rgmii"; ethernet = <&switch0port4>; From 6df12200d903338d36008cb207a41bd456346b5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Wed, 22 Mar 2023 20:10:01 +0100 Subject: [PATCH 22/26] bmips: add support for Sercomm H-500s MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sercomm H-500s is a BCM63268 with 128M, internal and external (Quantenna) wifi and external BCM53134S switch. This device is already supported in bcm63xx target, so more information can be found in https://openwrt.org/toh/sercomm/h500-s. It's a perfect example of a device with internal and external switch coexistance since most devices only have ports on one of the switches but not both of them. Signed-off-by: Álvaro Fernández Rojas --- .../dts/bcm63167-sercomm-h500-s-lowi.dts | 8 + .../dts/bcm63167-sercomm-h500-s-vfes.dts | 8 + .../bmips/dts/bcm63167-sercomm-h500-s.dtsi | 298 ++++++++++++++++++ target/linux/bmips/image/bcm63xx_nand.mk | 54 ++++ .../nand/base-files/etc/board.d/02_network | 4 + .../nand/base-files/lib/upgrade/platform.sh | 4 +- ...cronix_nand_block_protection_support.patch | 29 ++ ...520-net-dsa-b53-add-bcm53134-support.patch | 98 ++++++ 8 files changed, 502 insertions(+), 1 deletion(-) create mode 100644 target/linux/bmips/dts/bcm63167-sercomm-h500-s-lowi.dts create mode 100644 target/linux/bmips/dts/bcm63167-sercomm-h500-s-vfes.dts create mode 100644 target/linux/bmips/dts/bcm63167-sercomm-h500-s.dtsi create mode 100644 target/linux/bmips/patches-5.15/210-macronix_nand_block_protection_support.patch create mode 100644 target/linux/bmips/patches-5.15/520-net-dsa-b53-add-bcm53134-support.patch diff --git a/target/linux/bmips/dts/bcm63167-sercomm-h500-s-lowi.dts b/target/linux/bmips/dts/bcm63167-sercomm-h500-s-lowi.dts new file mode 100644 index 0000000000..c0ad03fa22 --- /dev/null +++ b/target/linux/bmips/dts/bcm63167-sercomm-h500-s-lowi.dts @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "bcm63167-sercomm-h500-s.dtsi" + +/ { + model = "Sercomm H500-s lowi"; + compatible = "sercomm,h500-s-lowi", "brcm,bcm63167", "brcm,bcm63268"; +}; diff --git a/target/linux/bmips/dts/bcm63167-sercomm-h500-s-vfes.dts b/target/linux/bmips/dts/bcm63167-sercomm-h500-s-vfes.dts new file mode 100644 index 0000000000..830a5cba14 --- /dev/null +++ b/target/linux/bmips/dts/bcm63167-sercomm-h500-s-vfes.dts @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "bcm63167-sercomm-h500-s.dtsi" + +/ { + model = "Sercomm H500-s vfes"; + compatible = "sercomm,h500-s-vfes", "brcm,bcm63167", "brcm,bcm63268"; +}; diff --git a/target/linux/bmips/dts/bcm63167-sercomm-h500-s.dtsi b/target/linux/bmips/dts/bcm63167-sercomm-h500-s.dtsi new file mode 100644 index 0000000000..c7edad8342 --- /dev/null +++ b/target/linux/bmips/dts/bcm63167-sercomm-h500-s.dtsi @@ -0,0 +1,298 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "bcm63268.dtsi" + +/ { + aliases { + led-boot = &led_power_green; + led-failsafe = &led_power_red; + led-running = &led_power_green; + led-upgrade = &led_power_green; + + led-internet = &led_internet_green; + led-usb = &led_mobile_green; + led-wireless = &led_wireless_green; + }; + + keys { + compatible = "gpio-keys-polled"; + poll-interval = <20>; + + wps { + label = "wps"; + gpios = <&gpio 34 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + + reset { + label = "reset"; + gpios = <&gpio 35 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + }; +}; + +&ehci { + status = "okay"; +}; + +ðernet { + status = "okay"; + + nvmem-cells = <&macaddr_cferom_6a0>; + nvmem-cell-names = "mac-address"; +}; + +&leds { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_leds>; + + led@0 { + reg = <0>; + label = "red:mobile"; + }; + + led_mobile_green: led@1 { + reg = <1>; + label = "green:mobile"; + }; + + led_power_red: led@8 { + reg = <8>; + label = "red:power"; + }; + + led_wireless_green: led@9 { + reg = <9>; + label = "green:wifi"; + }; + + led@12 { + reg = <12>; + label = "red:phone"; + }; + + led@13 { + reg = <13>; + label = "red:wifi"; + }; + + led@14 { + reg = <14>; + label = "red:internet"; + }; + + led_internet_green: led@15 { + reg = <15>; + label = "green:internet"; + }; + + led@16 { + reg = <16>; + label = "green:phone"; + }; + + led_power_green: led@17 { + reg = <17>; + label = "green:power"; + }; + + led@23 { + reg = <23>; + label = "blue:mobile"; + }; +}; + +&mdio_int { + phy12: ethernet-phy@c { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <12>; + }; +}; + +&mdio_ext { + switch@1e { + compatible = "brcm,bcm53134"; + reg = <30>; + + dsa,member = <1 0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@1 { + reg = <1>; + label = "lan3"; + }; + + port@2 { + reg = <2>; + label = "lan2"; + }; + + port@3 { + reg = <3>; + label = "lan1"; + }; + + port@5 { + reg = <5>; + label = "wifi"; + + phy-mode = "rgmii"; + + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + + port@8 { + reg = <8>; + + phy-mode = "rgmii"; + ethernet = <&switch0port4>; + + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + }; + }; +}; + +&nflash { + status = "okay"; + + nandcs@0 { + compatible = "brcm,nandcs"; + reg = <0>; + nand-ecc-step-size = <512>; + nand-ecc-strength = <4>; + nand-on-flash-bbt; + brcm,nand-oob-sector-size = <64>; + + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + cferom: partition@0 { + label = "cferom"; + reg = <0x0000000 0x0020000>; + read-only; + }; + + partition@20000 { + label = "part_map"; + reg = <0x0020000 0x00a0000>; + read-only; + }; + + partition@c0000 { + label = "cferam1"; + reg = <0x00c0000 0x0140000>; + read-only; + }; + + partition@200000 { + label = "cferam2"; + reg = <0x0200000 0x0140000>; + read-only; + }; + + partition@6920000 { + label = "bootflag1"; + reg = <0x6920000 0x0140000>; + }; + + partition@6a60000 { + label = "bootflag2"; + reg = <0x6a60000 0x0140000>; + }; + + partition@520000 { + compatible = "sercomm,wfi"; + label = "wfi"; + reg = <0x0520000 0x6400000>; + }; + + partition@6ba0000 { + label = "xml_cfg"; + reg = <0x6ba0000 0x0280000>; + read-only; + }; + + partition@6e20000 { + label = "app_data"; + reg = <0x6e20000 0x0280000>; + read-only; + }; + }; + }; +}; + +&ohci { + status = "okay"; +}; + +&switch0 { + dsa,member = <0 0>; + + ports { + port@3 { + reg = <3>; + label = "wan"; + + phy-handle = <&phy12>; + }; + + switch0port4: port@4 { + reg = <4>; + label = "extsw"; + + phy-mode = "rgmii-txid"; + + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + }; +}; + +&pinctrl { + pinctrl_leds: leds { + function = "led"; + pins = "gpio0", "gpio1", "gpio8", "gpio9", + "gpio12", "gpio13", "gpio14", "gpio15", + "gpio16", "gpio17", "gpio23"; + }; +}; + +&uart0 { + status = "okay"; +}; + +&usbh { + status = "okay"; +}; + +&cferom { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_cferom_6a0: macaddr@6a0 { + reg = <0x6a0 0x6>; + }; +}; diff --git a/target/linux/bmips/image/bcm63xx_nand.mk b/target/linux/bmips/image/bcm63xx_nand.mk index 6c4655bbab..01540625ed 100644 --- a/target/linux/bmips/image/bcm63xx_nand.mk +++ b/target/linux/bmips/image/bcm63xx_nand.mk @@ -100,3 +100,57 @@ define Device/netgear_dgnd3700-v2 CFE_WFI_VERSION := 0x5731 endef TARGET_DEVICES += netgear_dgnd3700-v2 + +define Device/sercomm_h500-s-lowi + $(Device/sercomm-nand) + DEVICE_VENDOR := Sercomm + DEVICE_MODEL := H500-s + DEVICE_VARIANT := lowi + DEVICE_LOADADDR := $(KERNEL_LOADADDR) + KERNEL := kernel-bin | append-dtb | lzma | cfe-jffs2-kernel + CHIP_ID := 63268 + SOC := bcm63167 + BLOCKSIZE := 128k + PAGESIZE := 2048 + SUBPAGESIZE := 512 + VID_HDR_OFFSET := 2048 + DEVICE_PACKAGES += $(USB2_PACKAGES) + SERCOMM_PID := \ + 30 30 30 30 30 30 30 31 34 33 34 62 33 31 30 30 \ + 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \ + 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \ + 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \ + 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \ + 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \ + 30 30 30 30 33 33 30 35 30 30 30 30 30 30 30 30 \ + 0D 0A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + SERCOMM_VERSION := 1001 +endef +TARGET_DEVICES += sercomm_h500-s-lowi + +define Device/sercomm_h500-s-vfes + $(Device/sercomm-nand) + DEVICE_VENDOR := Sercomm + DEVICE_MODEL := H500-s + DEVICE_VARIANT := vfes + DEVICE_LOADADDR := $(KERNEL_LOADADDR) + KERNEL := kernel-bin | append-dtb | lzma | cfe-jffs2-kernel + CHIP_ID := 63268 + SOC := bcm63167 + BLOCKSIZE := 128k + PAGESIZE := 2048 + SUBPAGESIZE := 512 + VID_HDR_OFFSET := 2048 + DEVICE_PACKAGES += $(USB2_PACKAGES) + SERCOMM_PID := \ + 30 30 30 30 30 30 30 31 34 32 35 38 34 62 30 30 \ + 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \ + 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \ + 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \ + 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \ + 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \ + 30 30 30 30 33 34 31 37 30 30 30 30 30 30 30 30 \ + 0D 0A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + SERCOMM_VERSION := 1001 +endef +TARGET_DEVICES += sercomm_h500-s-vfes diff --git a/target/linux/bmips/nand/base-files/etc/board.d/02_network b/target/linux/bmips/nand/base-files/etc/board.d/02_network index ce4440270c..ea95f57251 100644 --- a/target/linux/bmips/nand/base-files/etc/board.d/02_network +++ b/target/linux/bmips/nand/base-files/etc/board.d/02_network @@ -14,6 +14,10 @@ netgear,dgnd3700-v2) ucidef_set_bridge_device switch ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan" ;; +sercomm,h500-s-lowi |\ +sercomm,h500-s-vfes) + ucidef_set_bridge_device switch + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 wifi" "wan" esac board_config_flush diff --git a/target/linux/bmips/nand/base-files/lib/upgrade/platform.sh b/target/linux/bmips/nand/base-files/lib/upgrade/platform.sh index 33217ed975..69901eb29c 100644 --- a/target/linux/bmips/nand/base-files/lib/upgrade/platform.sh +++ b/target/linux/bmips/nand/base-files/lib/upgrade/platform.sh @@ -47,7 +47,9 @@ platform_do_upgrade() { case "$(board_name)" in comtrend,vr-3032u|\ huawei,hg253s-v2|\ - netgear,dgnd3700-v2) + netgear,dgnd3700-v2|\ + sercomm,h500-s-lowi|\ + sercomm,h500-s-vfes) cfe_jffs2_nand_upgrade "$1" ;; *) diff --git a/target/linux/bmips/patches-5.15/210-macronix_nand_block_protection_support.patch b/target/linux/bmips/patches-5.15/210-macronix_nand_block_protection_support.patch new file mode 100644 index 0000000000..3d45f69e03 --- /dev/null +++ b/target/linux/bmips/patches-5.15/210-macronix_nand_block_protection_support.patch @@ -0,0 +1,29 @@ +From 5a37811de679bff03e9c5a746f75574910ede964 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= +Date: Wed, 22 Mar 2023 20:52:13 +0100 +Subject: [PATCH] Revert "mtd: rawnand: Macronix: Add support for block + protection" +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This reverts commit 03a539c7a118427a6609a26461358c56ac8f3a06. + +Macronix block protection doesn't seem to be supported on Sercomm H-500s +devices since it hangs the device. + +Signed-off-by: Álvaro Fernández Rojas +--- + drivers/mtd/nand/raw/nand_macronix.c | 5 ----- + 1 file changed, 5 deletions(-) + +--- a/drivers/mtd/nand/raw/nand_macronix.c ++++ b/drivers/mtd/nand/raw/nand_macronix.c +@@ -323,7 +323,6 @@ static int macronix_nand_init(struct nan + + macronix_nand_fix_broken_get_timings(chip); + macronix_nand_onfi_init(chip); +- macronix_nand_block_protection_support(chip); + macronix_nand_deep_power_down_support(chip); + + return 0; diff --git a/target/linux/bmips/patches-5.15/520-net-dsa-b53-add-bcm53134-support.patch b/target/linux/bmips/patches-5.15/520-net-dsa-b53-add-bcm53134-support.patch new file mode 100644 index 0000000000..3134e292fd --- /dev/null +++ b/target/linux/bmips/patches-5.15/520-net-dsa-b53-add-bcm53134-support.patch @@ -0,0 +1,98 @@ +From 8ec46b847fc64a40da5c2c891e1732c863703bb5 Mon Sep 17 00:00:00 2001 +From: Paul Geurts +Date: Wed, 22 Mar 2023 20:17:04 +0100 +Subject: [PATCH] net: dsa: b53: mdio: add support for BCM53134 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add support for the BCM53134 Ethernet switch in the existing b53 dsa driver. +The BCM53134 is very familiar to the BCM58XX series. + +Signed-off-by: Paul Geurts +Signed-off-by: Álvaro Fernández Rojas +--- + drivers/net/dsa/b53/b53_common.c | 15 +++++++++++++++ + drivers/net/dsa/b53/b53_mdio.c | 5 ++++- + drivers/net/dsa/b53/b53_priv.h | 4 +++- + 3 files changed, 22 insertions(+), 2 deletions(-) + +--- a/drivers/net/dsa/b53/b53_common.c ++++ b/drivers/net/dsa/b53/b53_common.c +@@ -2609,6 +2609,20 @@ static const struct b53_chip_data b53_sw + .jumbo_pm_reg = B53_JUMBO_PORT_MASK, + .jumbo_size_reg = B53_JUMBO_MAX_SIZE, + }, ++ { ++ .chip_id = BCM53134_DEVICE_ID, ++ .dev_name = "BCM53134", ++ .vlans = 4096, ++ .enabled_ports = 0x12f, ++ .imp_port = 8, ++ .cpu_port = B53_CPU_PORT, ++ .vta_regs = B53_VTA_REGS, ++ .arl_bins = 4, ++ .arl_buckets = 1024, ++ .duplex_reg = B53_DUPLEX_STAT_GE, ++ .jumbo_pm_reg = B53_JUMBO_PORT_MASK, ++ .jumbo_size_reg = B53_JUMBO_MAX_SIZE, ++ }, + }; + + static int b53_switch_init(struct b53_device *dev) +@@ -2785,6 +2799,7 @@ int b53_switch_detect(struct b53_device + case BCM53012_DEVICE_ID: + case BCM53018_DEVICE_ID: + case BCM53019_DEVICE_ID: ++ case BCM53134_DEVICE_ID: + dev->chip_id = id32; + break; + default: +--- a/drivers/net/dsa/b53/b53_mdio.c ++++ b/drivers/net/dsa/b53/b53_mdio.c +@@ -286,6 +286,7 @@ static const struct b53_io_ops b53_mdio_ + #define B53_BRCM_OUI_2 0x03625c00 + #define B53_BRCM_OUI_3 0x00406000 + #define B53_BRCM_OUI_4 0x01410c00 ++#define B53_BRCM_OUI_5 0xae025000 + + static int b53_mdio_probe(struct mdio_device *mdiodev) + { +@@ -313,7 +314,8 @@ static int b53_mdio_probe(struct mdio_de + if ((phy_id & 0xfffffc00) != B53_BRCM_OUI_1 && + (phy_id & 0xfffffc00) != B53_BRCM_OUI_2 && + (phy_id & 0xfffffc00) != B53_BRCM_OUI_3 && +- (phy_id & 0xfffffc00) != B53_BRCM_OUI_4) { ++ (phy_id & 0xfffffc00) != B53_BRCM_OUI_4 && ++ (phy_id & 0xfffffc00) != B53_BRCM_OUI_5) { + dev_err(&mdiodev->dev, "Unsupported device: 0x%08x\n", phy_id); + return -ENODEV; + } +@@ -377,6 +379,7 @@ static const struct of_device_id b53_of_ + { .compatible = "brcm,bcm53115" }, + { .compatible = "brcm,bcm53125" }, + { .compatible = "brcm,bcm53128" }, ++ { .compatible = "brcm,bcm53134" }, + { .compatible = "brcm,bcm5365" }, + { .compatible = "brcm,bcm5389" }, + { .compatible = "brcm,bcm5395" }, +--- a/drivers/net/dsa/b53/b53_priv.h ++++ b/drivers/net/dsa/b53/b53_priv.h +@@ -85,6 +85,7 @@ enum { + BCM583XX_DEVICE_ID = 0x58300, + BCM7445_DEVICE_ID = 0x7445, + BCM7278_DEVICE_ID = 0x7278, ++ BCM53134_DEVICE_ID = 0x5075, + }; + + #define B53_N_PORTS 9 +@@ -210,7 +211,8 @@ static inline int is58xx(struct b53_devi + return dev->chip_id == BCM58XX_DEVICE_ID || + dev->chip_id == BCM583XX_DEVICE_ID || + dev->chip_id == BCM7445_DEVICE_ID || +- dev->chip_id == BCM7278_DEVICE_ID; ++ dev->chip_id == BCM7278_DEVICE_ID || ++ dev->chip_id == BCM53134_DEVICE_ID; + } + + #define B53_63XX_RGMII0 4 From 889bbf89bb679f0c5b0fa432e27a3e0dd8940a4e Mon Sep 17 00:00:00 2001 From: Tony Butler Date: Sun, 19 Mar 2023 02:34:07 -0700 Subject: [PATCH 23/26] ramips: mt7621: enable lzma-loader for AFOUNDRY EW1200 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes boot loader LZMA decompression issues (LZMA ERROR 1) As reported in issue #12208 Reported-by: Raúl M. Tested-by: Raúl M. Signed-off-by: Tony Butler --- target/linux/ramips/image/mt7621.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 07e63a5cf1..5d2a484426 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -140,6 +140,7 @@ TARGET_DEVICES += adslr_g7 define Device/afoundry_ew1200 $(Device/dsa-migration) + $(Device/uimage-lzma-loader) IMAGE_SIZE := 16064k DEVICE_VENDOR := AFOUNDRY DEVICE_MODEL := EW1200 From 694b8e6521b3d08ca8c22028a75862ecd279b0c8 Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Sat, 31 Dec 2022 00:15:48 +0100 Subject: [PATCH 24/26] ath79: support Ruckus ZoneFlex 7351 Ruckus ZoneFlex 7351 is a dual-band, dual-radio 802.11n 2x2 MIMO enterprise access point. Hardware highligts: - CPU: Atheros AR7161 SoC at 680 MHz - RAM: 64MB DDR - Flash: 16MB SPI-NOR - Wi-Fi 2.4GHz: AR9280 PCI 2x2 MIMO radio with external beamforming - Wi-Fi 5GHz: AR9280 PCI 2x2 MIMO radio with external beamforming - Ethernet: single Gigabit Ethernet port through Marvell 88E1116R gigabit PHY - Standalone 12V/1A power input - USB: optional single USB 2.0 host port on the 7351-U variant. Serial console: 115200-8-N-1 on internal H1 header. Pinout: H1 ---------- |1|x3|4|5| ---------- Pin 1 is near the "H1" marking. 1 - RX x - no pin 3 - VCC (3.3V) 4 - GND 5 - TX Installation: - Using serial console - requires some disassembly, 3.3V USB-Serial adapter, TFTP server, and removing a single T10 screw. 0. Connect serial console to H1 header. Ensure the serial converter does not back-power the board, otherwise it will fail to boot. 1. Power-on the board. Then quickly connect serial converter to PC and hit Ctrl+C in the terminal to break boot sequence. If you're lucky, you'll enter U-boot shell. Then skip to point 3. Connection parameters are 115200-8-N-1. 2. Allow the board to boot. Press the reset button, so the board reboots into U-boot again and go back to point 1. 3. Set the "bootcmd" variable to disable the dual-boot feature of the system and ensure that uImage is loaded. This is critical step, and needs to be done only on initial installation. > setenv bootcmd "bootm 0xbf040000" > saveenv 4. Boot the OpenWrt initramfs using TFTP. Replace IP addresses as needed: > setenv serverip 192.168.1.2 > setenv ipaddr 192.168.1.1 > tftpboot 0x81000000 openwrt-ath79-generic-ruckus_zf7351-initramfs-kernel.bin > bootm 0x81000000 5. Optional, but highly recommended: back up contents of "firmware" partition: $ ssh root@192.168.1.1 cat /dev/mtd1 > ruckus_zf7351_fw_backup.bin 6. Copy over sysupgrade image, and perform actual installation. OpenWrt shall boot from flash afterwards: $ ssh root@192.168.1.1 # sysupgrade -n openwrt-ath79-generic-ruckus_zf7351-squashfs-sysupgrade.bin After unit boots, it should be available at the usual 192.168.1.1/24. Return to factory firmware: 1. Copy over the backup to /tmp, for example using scp 2. Unset the "bootcmd" variable: fw_setenv bootcmd "" 3. Use sysupgrade with force to restore the backup: sysupgrade -F ruckus_zf7351_backup.bin 4. System will reboot. Quirks and known issues: - Flash layout is changed from the factory, to use both firmware image partitions for storage using mtd-concat, and uImage format is used to actually boot the system, which rules out the dual-boot capability. - Both radio has its own EEPROM on board, not connected to CPU. - The stock firmware has dual-boot capability, which is not supported in OpenWrt by choice. It is controlled by data in the top 64kB of RAM which is unmapped, to avoid the interference in the boot process and accidental switch to the inactive image, although boot script presence in form of "bootcmd" variable should prevent this entirely. - On some versions of stock firmware, it is possible to obtain root shell, however not much is available in terms of debugging facitilies. 1. Login to the rkscli 2. Execute hidden command "Ruckus" 3. Copy and paste ";/bin/sh;" including quotes. This is required only once, the payload will be stored in writable filesystem. 4. Execute hidden command "!v54!". Press Enter leaving empty reply for "What's your chow?" prompt. 5. Busybox shell shall open. Source: https://alephsecurity.com/vulns/aleph-2019014 - There is second method to achieve root shell, using command injection in the web interface: 1. Login to web administration interface 2. Go to Administration > Diagnostics 3. Enter |telnetd${IFS}-p${IFS}204${IFS}-l${IFS}/bin/sh into "ping" field 4. Press "Run test" 5. Telnet to the device IP at port 204 6. Busybox shell shall open. Source: https://github.com/chk-jxcn/ruckusremoteshell Signed-off-by: Lech Perczak --- package/boot/uboot-envtools/files/ath79 | 3 +- .../linux/ath79/dts/ar7161_ruckus_gd11.dtsi | 243 ++++++++++++++++++ .../linux/ath79/dts/ar7161_ruckus_zf7351.dts | 115 +++++++++ .../generic/base-files/etc/board.d/02_network | 2 + target/linux/ath79/image/generic.mk | 15 ++ 5 files changed, 377 insertions(+), 1 deletion(-) create mode 100644 target/linux/ath79/dts/ar7161_ruckus_gd11.dtsi create mode 100644 target/linux/ath79/dts/ar7161_ruckus_zf7351.dts diff --git a/package/boot/uboot-envtools/files/ath79 b/package/boot/uboot-envtools/files/ath79 index 0510a4b51a..3b3ff43b13 100644 --- a/package/boot/uboot-envtools/files/ath79 +++ b/package/boot/uboot-envtools/files/ath79 @@ -139,7 +139,8 @@ plasmacloud,pa300e) qihoo,c301) ubootenv_add_uci_config "/dev/mtd9" "0x0" "0x10000" "0x10000" ;; -ruckus,zf7025) +ruckus,zf7025|\ +ruckus,zf7351) ubootenv_add_uci_config "/dev/mtd5" "0x0" "0x40000" "0x40000" ;; ruckus,zf7321|\ diff --git a/target/linux/ath79/dts/ar7161_ruckus_gd11.dtsi b/target/linux/ath79/dts/ar7161_ruckus_gd11.dtsi new file mode 100644 index 0000000000..c640765545 --- /dev/null +++ b/target/linux/ath79/dts/ar7161_ruckus_gd11.dtsi @@ -0,0 +1,243 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar7100.dtsi" + +#include +#include + +/ { + compatible = "ruckus,gd11", "qca,ar7161"; + + aliases { + led-boot = &led_power_green; + led-failsafe = &led_power_red; + led-running = &led_power_green; + led-upgrade = &led_power_red; + label-mac-device = ð0; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; + + leds { + compatible = "gpio-leds"; + dir-green { + label = "green:dir"; + gpios = <&gpio 6 GPIO_ACTIVE_HIGH>; + }; + + opt-green { + label = "green:opt"; + gpios = <&gpio 7 GPIO_ACTIVE_HIGH>; + }; + + led_power_green: power-green { + label = "green:power"; + gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; + default-state = "on"; + }; + + led_power_red: power-red { + label = "red:power"; + gpios = <&gpio 1 GPIO_ACTIVE_HIGH>; + panic-indicator; + }; + + wlan2g-green { + label = "green:wlan2g"; + gpios = <&gpio 2 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "phy0assoc"; + }; + + wlan2g-yellow { + label = "yellow:wlan2g"; + gpios = <&gpio 3 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "phy0tpt"; + }; + + wlan5g-green { + label = "green:wlan5g"; + gpios = <&gpio 4 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "phy1assoc"; + }; + + wlan5g-yellow { + label = "yellow:wlan5g"; + gpios = <&gpio 5 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "phy1tpt"; + }; + }; + + reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + ruckus-himem@3ff0000 { + /* Ruckus Himem area used to control + * redundant boot image selection + */ + compatible = "nvmem-rmem"; + reg = <0x3ff0000 0x10000>; + no-map; + }; + }; + + beamforming-2g-spi { + compatible = "spi-gpio"; + mosi-gpios = <&ath9k0 5 GPIO_ACTIVE_HIGH>; + sck-gpios = <&ath9k0 6 GPIO_ACTIVE_HIGH>; + num-chipselects = <0>; + #address-cells = <1>; + #size-cells = <0>; + + beamforming_2g_gpio: beamforming-2g-gpio@0 { + compatible = "fairchild,74hc595"; + reg = <0>; + registers-number = <1>; + spi-max-frequency = <24000000>; + gpio-controller; + #gpio-cells = <2>; + }; + }; + + beamforming-5g-spi { + compatible = "spi-gpio"; + mosi-gpios = <&ath9k1 5 GPIO_ACTIVE_HIGH>; + sck-gpios = <&ath9k1 6 GPIO_ACTIVE_HIGH>; + num-chipselects = <0>; + #address-cells = <1>; + #size-cells = <0>; + + beamforming_5g_gpio: beamforming-5g-gpio@0 { + compatible = "fairchild,74hc595"; + reg = <0>; + registers-number = <1>; + spi-max-frequency = <24000000>; + gpio-controller; + #gpio-cells = <2>; + }; + }; +}; + +&pcie0 { + status = "okay"; + + ath9k0: wifi@0,11 { /* 2.4 GHz */ + compatible = "pci168c,0029"; + reg = <0x8800 0 0 0 0>; + nvmem-cells = <&macaddr_bdata_60>; + nvmem-cell-names = "mac-address"; + #gpio-cells = <2>; + gpio-controller; + }; + + ath9k1: wifi@0,12 { /* 5 GHz */ + compatible = "pci168c,0029"; + reg = <0x9000 0 0 0 0>; + nvmem-cells = <&macaddr_bdata_76>; + nvmem-cell-names = "mac-address"; + #gpio-cells = <2>; + gpio-controller; + }; +}; + +&mdio0 { + status = "okay"; + + phy0: ethernet-phy@1e { + reg = <0x1e>; + }; +}; + +ð0 { + status = "okay"; + nvmem-cells = <&macaddr_bdata_66>; + nvmem-cell-names = "mac-address"; + + pll-data = <0x00110000 0x00001099 0x00991099>; + phy-handle = <&phy0>; + phy-mode = "rgmii-id"; +}; + +&spi { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <104000000>; + m25p,fast-read; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + reg = <0x0 0x40000>; + label = "u-boot"; + read-only; + }; + + /* On stock FW this encompasses rcks_wlan.main, + * rcks_wlan.bkup and datafs partitions + */ + partition@40000 { + compatible = "openwrt,uimage", "denx,uimage"; + reg = <0x40000 0xf40000>; + label = "firmware"; + }; + + partition@f80000 { + compatible = "u-boot,env"; + reg = <0xf80000 0x40000>; + label = "u-boot-env"; + }; + + board_data: partition@fc0000 { + reg = <0xfc0000 0x40000>; + label = "board-data"; + read-only; + }; + }; + }; +}; + +&usb1 { + status = "okay"; +}; + +&usb2 { + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; + +&board_data { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_bdata_60: macaddr@60 { + reg = <0x60 0x6>; + }; + + macaddr_bdata_66: macaddr@66 { + reg = <0x66 0x6>; + }; + + macaddr_bdata_76: macaddr@76 { + reg = <0x76 0x6>; + }; +}; diff --git a/target/linux/ath79/dts/ar7161_ruckus_zf7351.dts b/target/linux/ath79/dts/ar7161_ruckus_zf7351.dts new file mode 100644 index 0000000000..37ea305790 --- /dev/null +++ b/target/linux/ath79/dts/ar7161_ruckus_zf7351.dts @@ -0,0 +1,115 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar7161_ruckus_gd11.dtsi" + +/ { + model = "Ruckus ZoneFlex 7351[-U]"; + compatible = "ruckus,zf7351", "qca,ar7161"; + +}; + +&beamforming_2g_gpio { + /* Default beamforming switches configuration from stock firmware, + * the AP is started and for broadcast frames - all outputs high */ + lb0 { + line-name = "beamforming:2g:lb0"; + gpios = <0 GPIO_ACTIVE_HIGH>; + output-high; + gpio-hog; + }; + + lb1 { + line-name = "beamforming:2g:lb1"; + gpios = <1 GPIO_ACTIVE_HIGH>; + output-high; + gpio-hog; + }; + + lb2 { + line-name = "beamforming:2g:lb2"; + gpios = <2 GPIO_ACTIVE_HIGH>; + output-high; + gpio-hog; + }; + + lb3 { + line-name = "beamforming:2g:lb3"; + gpios = <4 GPIO_ACTIVE_HIGH>; + output-high; + gpio-hog; + }; + + lb4 { + line-name = "beamforming:2g:lb4"; + gpios = <5 GPIO_ACTIVE_HIGH>; + output-high; + gpio-hog; + }; + + lb5 { + line-name = "beamforming:2g:lb5"; + gpios = <6 GPIO_ACTIVE_HIGH>; + output-high; + gpio-hog; + }; +}; + +&beamforming_5g_gpio { + /* Default beamforming switches configuration from stock firmware, + * the AP is started and for broadcast frames - all outputs high */ + hb0 { + line-name = "beamforming:5g:hb0"; + gpios = <0 GPIO_ACTIVE_HIGH>; + output-high; + gpio-hog; + }; + + hb1 { + line-name = "beamforming:5g:hb1"; + gpios = <1 GPIO_ACTIVE_HIGH>; + output-high; + gpio-hog; + }; + + hb2 { + line-name = "beamforming:5g:hb2"; + gpios = <2 GPIO_ACTIVE_HIGH>; + output-high; + gpio-hog; + }; + + hb3 { + line-name = "beamforming:5g:hb3"; + gpios = <3 GPIO_ACTIVE_HIGH>; + output-high; + gpio-hog; + }; + + hb4 { + line-name = "beamforming:5g:hb4"; + gpios = <4 GPIO_ACTIVE_HIGH>; + output-high; + gpio-hog; + }; + + hb5 { + line-name = "beamforming:5g:hb5"; + gpios = <5 GPIO_ACTIVE_HIGH>; + output-high; + gpio-hog; + }; + + hb6 { + line-name = "beamforming:5g:hb6"; + gpios = <6 GPIO_ACTIVE_HIGH>; + output-high; + gpio-hog; + }; + + hb7 { + line-name = "beamforming:5g:hb7"; + gpios = <7 GPIO_ACTIVE_HIGH>; + output-high; + gpio-hog; + }; +}; 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 b20a3c13f8..a4392e0353 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -67,6 +67,7 @@ ath79_setup_interfaces() pisen,wmb001n|\ pisen,wmm003n|\ ruckus,zf7321|\ + ruckus,zf7351|\ siemens,ws-ap3610|\ sophos,ap15|\ sophos,ap55|\ @@ -744,6 +745,7 @@ ath79_setup_macs() ;; ruckus,zf7025|\ ruckus,zf7321|\ + ruckus,zf7351|\ ruckus,zf7372) lan_mac=$(mtd_get_mac_binary board-data 0x807E) label_mac=$lan_mac diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index 7072dc131e..fd63b623cd 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -2530,6 +2530,21 @@ define Device/ruckus_zf7025 endef TARGET_DEVICES += ruckus_zf7025 +define Device/ruckus_gd11_common + $(Device/ruckus_common) + SOC := ar7161 + IMAGE_SIZE := 15616k + BLOCKSIZE := 256k + DEVICE_PACKAGES := kmod-usb2 kmod-usb-chipidea2 +endef + +define Device/ruckus_zf7351 + $(Device/ruckus_gd11_common) + DEVICE_MODEL := ZoneFlex 7351[-U] + DEVICE_PACKAGES += -swconfig +endef +TARGET_DEVICES += ruckus_zf7351 + define Device/ruckus_zf73xx_common $(Device/ruckus_common) DEVICE_PACKAGES := -swconfig kmod-usb2 kmod-usb-chipidea2 From 0eebc6f0ddb0791406d30530e3fc25d39428bd5a Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Tue, 7 Mar 2023 21:25:59 +0100 Subject: [PATCH 25/26] ath79: support Ruckus ZoneFlex 7341/7343/7363 Ruckus ZoneFlex 7363 is a dual-band, dual-radio 802.11n 2x2 MIMO enterprise access point. ZoneFlex 7343 is the single band variant of 7363 restricted to 2.4GHz, and ZoneFlex 7341 is 7343 minus two Fast Ethernet ports. Hardware highligts: - CPU: Atheros AR7161 SoC at 680 MHz - RAM: 64MB DDR - Flash: 16MB SPI-NOR - Wi-Fi 2.4GHz: AR9280 PCI 2x2 MIMO radio with external beamforming - Wi-Fi 5GHz: AR9280 PCI 2x2 MIMO radio with external beamforming - Ethernet 1: single Gigabit Ethernet port through Marvell 88E1116R gigabit PHY - Ethernet 2: two Fast Ethernet ports through Realtek RTL8363S switch, connected with Fast Ethernet link to CPU. - PoE: input through Gigabit port - Standalone 12V/1A power input - USB: optional single USB 2.0 host port on the -U variants. Serial console: 115200-8-N-1 on internal H1 header. Pinout: H1 ---------- |1|x3|4|5| ---------- Pin 1 is near the "H1" marking. 1 - RX x - no pin 3 - VCC (3.3V) 4 - GND 5 - TX Installation: - Using serial console - requires some disassembly, 3.3V USB-Serial adapter, TFTP server, and removing a single PH1 screw. 0. Connect serial console to H1 header. Ensure the serial converter does not back-power the board, otherwise it will fail to boot. 1. Power-on the board. Then quickly connect serial converter to PC and hit Ctrl+C in the terminal to break boot sequence. If you're lucky, you'll enter U-boot shell. Then skip to point 3. Connection parameters are 115200-8-N-1. 2. Allow the board to boot. Press the reset button, so the board reboots into U-boot again and go back to point 1. 3. Set the "bootcmd" variable to disable the dual-boot feature of the system and ensure that uImage is loaded. This is critical step, and needs to be done only on initial installation. > setenv bootcmd "bootm 0xbf040000" > saveenv 4. Boot the OpenWrt initramfs using TFTP. Replace IP addresses as needed. Use the Gigabit interface, Fast Ethernet ports are not supported under U-boot: > setenv serverip 192.168.1.2 > setenv ipaddr 192.168.1.1 > tftpboot 0x81000000 openwrt-ath79-generic-ruckus_zf7363-initramfs-kernel.bin > bootm 0x81000000 5. Optional, but highly recommended: back up contents of "firmware" partition: $ ssh root@192.168.1.1 cat /dev/mtd1 > ruckus_zf7363_fw_backup.bin 6. Copy over sysupgrade image, and perform actual installation. OpenWrt shall boot from flash afterwards: $ ssh root@192.168.1.1 # sysupgrade -n openwrt-ath79-generic-ruckus_zf7363-squashfs-sysupgrade.bin After unit boots, it should be available at the usual 192.168.1.1/24. Return to factory firmware: 1. Copy over the backup to /tmp, for example using scp 2. Unset the "bootcmd" variable: fw_setenv bootcmd "" 3. Use sysupgrade with force to restore the backup: sysupgrade -F ruckus_zf7363_backup.bin 4. System will reboot. Quirks and known issues: - Fast Ethernet ports on ZF7363 and ZF7343 are supported, but management features of the RTL8363S switch aren't implemented yet, though the switch is visible over MDIO0 bus. This is a gigabit-capable switch, so link establishment with a gigabit link partner may take a longer time because RTL8363S advertises gigabit, and the port magnetics don't support it, so a downshift needs to occur. Both ports are accessible at eth1 interface, which - strangely - runs only at 100Mbps itself. - Flash layout is changed from the factory, to use both firmware image partitions for storage using mtd-concat, and uImage format is used to actually boot the system, which rules out the dual-boot capability. - Both radio has its own EEPROM on board, not connected to CPU. - The stock firmware has dual-boot capability, which is not supported in OpenWrt by choice. It is controlled by data in the top 64kB of RAM which is unmapped, to avoid the interference in the boot process and accidental switch to the inactive image, although boot script presence in form of "bootcmd" variable should prevent this entirely. - On some versions of stock firmware, it is possible to obtain root shell, however not much is available in terms of debugging facitilies. 1. Login to the rkscli 2. Execute hidden command "Ruckus" 3. Copy and paste ";/bin/sh;" including quotes. This is required only once, the payload will be stored in writable filesystem. 4. Execute hidden command "!v54!". Press Enter leaving empty reply for "What's your chow?" prompt. 5. Busybox shell shall open. Source: https://alephsecurity.com/vulns/aleph-2019014 - There is second method to achieve root shell, using command injection in the web interface: 1. Login to web administration interface 2. Go to Administration > Diagnostics 3. Enter |telnetd${IFS}-p${IFS}204${IFS}-l${IFS}/bin/sh into "ping" field 4. Press "Run test" 5. Telnet to the device IP at port 204 6. Busybox shell shall open. Source: https://github.com/chk-jxcn/ruckusremoteshell Signed-off-by: Lech Perczak --- package/boot/uboot-envtools/files/ath79 | 4 +- .../linux/ath79/dts/ar7161_ruckus_gd11.dtsi | 2 +- .../linux/ath79/dts/ar7161_ruckus_zf7341.dts | 8 ++ .../linux/ath79/dts/ar7161_ruckus_zf734x.dtsi | 119 ++++++++++++++++++ .../linux/ath79/dts/ar7161_ruckus_zf7363.dts | 39 ++++++ .../generic/base-files/etc/board.d/02_network | 4 + target/linux/ath79/image/generic.mk | 15 +++ 7 files changed, 189 insertions(+), 2 deletions(-) create mode 100644 target/linux/ath79/dts/ar7161_ruckus_zf7341.dts create mode 100644 target/linux/ath79/dts/ar7161_ruckus_zf734x.dtsi create mode 100644 target/linux/ath79/dts/ar7161_ruckus_zf7363.dts diff --git a/package/boot/uboot-envtools/files/ath79 b/package/boot/uboot-envtools/files/ath79 index 3b3ff43b13..b968fa8fde 100644 --- a/package/boot/uboot-envtools/files/ath79 +++ b/package/boot/uboot-envtools/files/ath79 @@ -140,7 +140,9 @@ qihoo,c301) ubootenv_add_uci_config "/dev/mtd9" "0x0" "0x10000" "0x10000" ;; ruckus,zf7025|\ -ruckus,zf7351) +ruckus,zf7341|\ +ruckus,zf7351|\ +ruckus,zf7363) ubootenv_add_uci_config "/dev/mtd5" "0x0" "0x40000" "0x40000" ;; ruckus,zf7321|\ diff --git a/target/linux/ath79/dts/ar7161_ruckus_gd11.dtsi b/target/linux/ath79/dts/ar7161_ruckus_gd11.dtsi index c640765545..e97e31e58e 100644 --- a/target/linux/ath79/dts/ar7161_ruckus_gd11.dtsi +++ b/target/linux/ath79/dts/ar7161_ruckus_gd11.dtsi @@ -16,7 +16,7 @@ label-mac-device = ð0; }; - keys { + keys: keys { compatible = "gpio-keys"; reset { diff --git a/target/linux/ath79/dts/ar7161_ruckus_zf7341.dts b/target/linux/ath79/dts/ar7161_ruckus_zf7341.dts new file mode 100644 index 0000000000..17735e596f --- /dev/null +++ b/target/linux/ath79/dts/ar7161_ruckus_zf7341.dts @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar7161_ruckus_zf734x.dtsi" + +/ { + model = "Ruckus ZoneFlex 7341[-U]"; + compatible = "ruckus,zf7341", "qca,ar7161"; +}; diff --git a/target/linux/ath79/dts/ar7161_ruckus_zf734x.dtsi b/target/linux/ath79/dts/ar7161_ruckus_zf734x.dtsi new file mode 100644 index 0000000000..8861b09d1b --- /dev/null +++ b/target/linux/ath79/dts/ar7161_ruckus_zf734x.dtsi @@ -0,0 +1,119 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar7161_ruckus_gd11.dtsi" + +&keys { + opt { + /* Not used by stock firmware */ + label = "opt"; + linux,code = ; + gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; + debounce-interval = <60>; + }; +}; + +&beamforming_2g_gpio { + /* Default beamforming switches configuration from stock firmware, + * the AP is started and for broadcast frames - all outputs high */ + lb0 { + line-name = "beamforming:2g:lb0"; + gpios = <0 GPIO_ACTIVE_LOW>; + output-high; + gpio-hog; + }; + + lb1 { + line-name = "beamforming:2g:lb1"; + gpios = <1 GPIO_ACTIVE_LOW>; + output-high; + gpio-hog; + }; + + lb2 { + line-name = "beamforming:2g:lb2"; + gpios = <2 GPIO_ACTIVE_LOW>; + output-high; + gpio-hog; + }; + + lb3 { + line-name = "beamforming:2g:lb3"; + gpios = <3 GPIO_ACTIVE_LOW>; + output-high; + gpio-hog; + }; + + lb4 { + line-name = "beamforming:2g:lb4"; + gpios = <4 GPIO_ACTIVE_LOW>; + output-high; + gpio-hog; + }; + + lb5 { + line-name = "beamforming:2g:lb5"; + gpios = <5 GPIO_ACTIVE_LOW>; + output-high; + gpio-hog; + }; + + lb6 { + line-name = "beamforming:2g:lb6"; + gpios = <6 GPIO_ACTIVE_LOW>; + output-high; + gpio-hog; + }; + + lb7 { + line-name = "beamforming:2g:lb7"; + gpios = <7 GPIO_ACTIVE_LOW>; + output-high; + gpio-hog; + }; +}; + +&beamforming_5g_gpio { + /* Default beamforming switches configuration from stock firmware, + * the AP is started and for broadcast frames - all outputs high */ + hb0 { + line-name = "beamforming:5g:hb0"; + gpios = <0 GPIO_ACTIVE_LOW>; + output-high; + gpio-hog; + }; + + hb1 { + line-name = "beamforming:5g:hb1"; + gpios = <1 GPIO_ACTIVE_LOW>; + output-high; + gpio-hog; + }; + + hb2 { + line-name = "beamforming:5g:hb2"; + gpios = <2 GPIO_ACTIVE_LOW>; + output-high; + gpio-hog; + }; + + hb3 { + line-name = "beamforming:5g:hb3"; + gpios = <3 GPIO_ACTIVE_LOW>; + output-high; + gpio-hog; + }; + + hb4 { + line-name = "beamforming:5g:hb4"; + gpios = <4 GPIO_ACTIVE_LOW>; + output-high; + gpio-hog; + }; + + hb5 { + line-name = "beamforming:5g:hb5"; + gpios = <5 GPIO_ACTIVE_LOW>; + output-high; + gpio-hog; + }; +}; diff --git a/target/linux/ath79/dts/ar7161_ruckus_zf7363.dts b/target/linux/ath79/dts/ar7161_ruckus_zf7363.dts new file mode 100644 index 0000000000..4ece56dd0a --- /dev/null +++ b/target/linux/ath79/dts/ar7161_ruckus_zf7363.dts @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar7161_ruckus_zf734x.dtsi" + +/ { + model = "Ruckus ZoneFlex 7343/7363[-U]"; + compatible = "ruckus,zf7363", "qca,ar7161"; +}; + +&mdio0 { + ethernet-phy@0 { + reg = <0x0>; + max-speed = <100>; + }; + + ethernet-phy@1 { + reg = <0x1>; + max-speed = <100>; + }; +}; + +ð1 { + status = "okay"; + pll-data = <0x00110000 0x00001099 0x00991099>; + nvmem-cells = <&macaddr_bdata_6c>; + nvmem-cell-names = "mac-address"; + phy-mode = "rgmii-id"; + + fixed-link { + speed = <100>; + full-duplex; + }; +}; + +&board_data { + macaddr_bdata_6c: macaddr@6c { + reg = <0x6c 0x6>; + }; +}; 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 a4392e0353..31ea891d57 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -67,6 +67,7 @@ ath79_setup_interfaces() pisen,wmb001n|\ pisen,wmm003n|\ ruckus,zf7321|\ + ruckus,zf7341|\ ruckus,zf7351|\ siemens,ws-ap3610|\ sophos,ap15|\ @@ -139,6 +140,7 @@ ath79_setup_interfaces() engenius,ews511ap|\ engenius,ews660ap|\ ocedo,ursus|\ + ruckus,zf7363|\ ruckus,zf7372|\ ubnt,unifi-ap-outdoor-plus) ucidef_set_interface_lan "eth0 eth1" @@ -745,7 +747,9 @@ ath79_setup_macs() ;; ruckus,zf7025|\ ruckus,zf7321|\ + ruckus,zf7341|\ ruckus,zf7351|\ + ruckus,zf7363|\ ruckus,zf7372) lan_mac=$(mtd_get_mac_binary board-data 0x807E) label_mac=$lan_mac diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index fd63b623cd..608b51766f 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -2538,6 +2538,13 @@ define Device/ruckus_gd11_common DEVICE_PACKAGES := kmod-usb2 kmod-usb-chipidea2 endef +define Device/ruckus_zf7341 + $(Device/ruckus_gd11_common) + DEVICE_MODEL := ZoneFlex 7341[-U] + DEVICE_PACKAGES += -swconfig +endef +TARGET_DEVICES += ruckus_zf7341 + define Device/ruckus_zf7351 $(Device/ruckus_gd11_common) DEVICE_MODEL := ZoneFlex 7351[-U] @@ -2545,6 +2552,14 @@ define Device/ruckus_zf7351 endef TARGET_DEVICES += ruckus_zf7351 +define Device/ruckus_zf7363 + $(Device/ruckus_gd11_common) + DEVICE_MODEL := ZoneFlex 7363[-U] + DEVICE_ALT0_VENDOR := Ruckus + DEVICE_ALT0_MODEL := ZoneFlex 7343[-U] +endef +TARGET_DEVICES += ruckus_zf7363 + define Device/ruckus_zf73xx_common $(Device/ruckus_common) DEVICE_PACKAGES := -swconfig kmod-usb2 kmod-usb-chipidea2 From f7c1631155d2ba1a0962bc1cc603c40180b4e9a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Thu, 23 Mar 2023 12:20:31 +0100 Subject: [PATCH 26/26] kernel: fix DSA B53 BCM63xx RGMII patch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refreshing the patches for fff07085fb5a moved the b53_adjust_63xx_rgmii() call from b53_phylink_mac_link_up() to b53_phylink_mac_link_down(). In order to properly configure the RGMII ports we need to restore it to its correct place. Fixes: fff07085fb5a ("kernel: add pending bmips patches") Signed-off-by: Álvaro Fernández Rojas --- .../772-net-dsa-b53-add-support-for-BCM63xx-RGMIIs.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/generic/pending-5.15/772-net-dsa-b53-add-support-for-BCM63xx-RGMIIs.patch b/target/linux/generic/pending-5.15/772-net-dsa-b53-add-support-for-BCM63xx-RGMIIs.patch index 9e130e47d2..ca963d1260 100644 --- a/target/linux/generic/pending-5.15/772-net-dsa-b53-add-support-for-BCM63xx-RGMIIs.patch +++ b/target/linux/generic/pending-5.15/772-net-dsa-b53-add-support-for-BCM63xx-RGMIIs.patch @@ -152,7 +152,7 @@ Reviewed-by: Andrew Lunn if (is531x5(dev) && phy_interface_is_rgmii(phydev)) { if (port == dev->imp_port) off = B53_RGMII_CTRL_IMP; -@@ -1396,6 +1439,9 @@ void b53_phylink_mac_link_down(struct ds +@@ -1419,6 +1462,9 @@ void b53_phylink_mac_link_up(struct dsa_ { struct b53_device *dev = ds->priv;