From 9a2666951051f8072ba83f0535e1534ea0dbf6aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Mon, 30 Jan 2023 08:33:16 +0100 Subject: [PATCH 1/7] ci: add Coverity Scan scheduled workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Coverity Scan is a static code analysis service focused on open source software quality and security, so lets scan various OpenWrt components every Friday for the start. Signed-off-by: Petr Štetiar --- .github/workflows/build.yml | 70 ++++++++++++++++++++++++++++++++++ .github/workflows/coverity.yml | 64 +++++++++++++++++++++++++++++++ 2 files changed, 134 insertions(+) create mode 100644 .github/workflows/coverity.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 22286c054e..8744bc7737 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,6 +2,8 @@ name: Build sub target on: workflow_call: + secrets: + coverity_api_token: inputs: target: required: true @@ -25,6 +27,23 @@ on: use_openwrt_container: type: boolean default: true + coverity_project_name: + type: string + default: OpenWrt + coverity_check_packages: + type: string + coverity_compiler_template_list: + type: string + default: >- + arm-openwrt-linux-gcc + coverity_force_compile_packages: + type: string + default: >- + curl + libnl + mbedtls + wolfssl + openssl permissions: contents: read @@ -361,6 +380,57 @@ jobs: working-directory: openwrt run: make -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh + - name: Coverity prepare toolchain + if: inputs.coverity_check_packages != '' + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: | + wget -q https://scan.coverity.com/download/linux64 --post-data "token=${{ secrets.coverity_api_token }}&project=${{ inputs.coverity_project_name }}" -O coverity.tar.gz + wget -q https://scan.coverity.com/download/linux64 --post-data "token=${{ secrets.coverity_api_token }}&project=${{ inputs.coverity_project_name }}&md5=1" -O coverity.tar.gz.md5 + echo ' coverity.tar.gz' >> coverity.tar.gz.md5 + md5sum -c coverity.tar.gz.md5 + + mkdir cov-analysis-linux64 + tar xzf coverity.tar.gz --strip 1 -C cov-analysis-linux64 + export PATH=$(pwd)/cov-analysis-linux64/bin:$PATH + + for template in ${{ inputs.coverity_compiler_template_list }}; do + cov-configure --template --comptype gcc --compiler "$template" + done + + - name: Clean and recompile packages with Coverity toolchain + if: inputs.coverity_check_packages != '' + shell: su buildbot -c "bash {0}" + working-directory: openwrt + run: | + set -o pipefail -o errexit + + coverity_check_packages=(${{ inputs.coverity_check_packages }}) + printf -v clean_packages "package/%s/clean " "${coverity_check_packages[@]}" + make -j$(nproc) BUILD_LOG=1 $clean_packages || ret=$? .github/workflows/scripts/show_build_failures.sh + + coverity_force_compile_packages=(${{ inputs.coverity_force_compile_packages }}) + printf -v force_compile_packages "package/%s/compile " "${coverity_force_compile_packages[@]}" + make -j$(nproc) BUILD_LOG=1 $force_compile_packages || ret=$? .github/workflows/scripts/show_build_failures.sh + + printf -v compile_packages "package/%s/compile " "${coverity_check_packages[@]}" + export PATH=$(pwd)/cov-analysis-linux64/bin:$PATH + cov-build --dir cov-int make -j $(nproc) BUILD_LOG=1 $compile_packages || ret=$? .github/workflows/scripts/show_build_failures.sh + + - name: Upload build to Coverity for analysis + if: inputs.coverity_check_packages != '' + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: | + tar czf cov-int.tar.gz ./cov-int + curl \ + --form token="${{ secrets.coverity_api_token }}" \ + --form email="contact@openwrt.org" \ + --form file=@cov-int.tar.gz \ + --form version="${{ github.ref_name }}-${{ github.sha }}" \ + --form description="OpenWrt ${{ github.ref_name }}-${{ github.sha }}" \ + "https://scan.coverity.com/builds?project=${{ inputs.coverity_project_name }}" + - name: Upload logs if: failure() uses: actions/upload-artifact@v3 diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml new file mode 100644 index 0000000000..db628d05ee --- /dev/null +++ b/.github/workflows/coverity.yml @@ -0,0 +1,64 @@ +name: Coverity scan build + +on: + schedule: + - cron: '30 2 * * 6' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + +jobs: + coverity_build: + name: Coverity x86/64 build + secrets: + coverity_api_token: ${{ secrets.COVERITY_API_TOKEN }} + permissions: + contents: read + packages: read + uses: ./.github/workflows/build.yml + with: + target: x86/64 + build_full: true + include_feeds: true + coverity_compiler_template_list: >- + x86_64-openwrt-linux-gcc + x86_64-openwrt-linux-musl-gcc + # qosify fails to build with cov-build + coverity_check_packages: >- + cgi-io + dnsmasq + dropbear + firewall + fstools + fwtool + iwinfo + jsonfilter + libnl-tiny + libubox + mtd + netifd + odhcp6c + odhcpd + opkg + procd + relayd + rpcd + swconfig + ubox + ubus + ucert + uci + uclient + ucode + ugps + uhttpd + umbim + umdns + unetd + uqmi + urngd + usbmode + usign + usteer + ustp + ustream-ssl From 11de53729a5501c309a7d838c35fb52b195e2f65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Tue, 25 Apr 2023 21:17:52 +0200 Subject: [PATCH 2/7] bmips: increment polled keys interval to 100 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There's no need to poll the gpio keys every 20 ms and the linux kernel documentation suggests 100 ms. Signed-off-by: Álvaro Fernández Rojas --- target/linux/bmips/dts/bcm63167-sercomm-h500-s.dtsi | 2 +- target/linux/bmips/dts/bcm63168-comtrend-vr-3032u.dts | 2 +- target/linux/bmips/dts/bcm63168-sercomm-shg2500.dts | 2 +- target/linux/bmips/dts/bcm6318-comtrend-ar-5315u.dts | 2 +- target/linux/bmips/dts/bcm6328-comtrend-ar-5387un.dts | 2 +- target/linux/bmips/dts/bcm6358-huawei-hg556a-b.dts | 2 +- target/linux/bmips/dts/bcm6362-huawei-hg253s-v2.dts | 2 +- target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts | 2 +- target/linux/bmips/dts/bcm6368-comtrend-vr-3025u.dts | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/target/linux/bmips/dts/bcm63167-sercomm-h500-s.dtsi b/target/linux/bmips/dts/bcm63167-sercomm-h500-s.dtsi index 591029c463..8e0024a20f 100644 --- a/target/linux/bmips/dts/bcm63167-sercomm-h500-s.dtsi +++ b/target/linux/bmips/dts/bcm63167-sercomm-h500-s.dtsi @@ -16,7 +16,7 @@ keys { compatible = "gpio-keys-polled"; - poll-interval = <20>; + poll-interval = <100>; wps { label = "wps"; diff --git a/target/linux/bmips/dts/bcm63168-comtrend-vr-3032u.dts b/target/linux/bmips/dts/bcm63168-comtrend-vr-3032u.dts index 062fdcafe9..8c4611ee88 100644 --- a/target/linux/bmips/dts/bcm63168-comtrend-vr-3032u.dts +++ b/target/linux/bmips/dts/bcm63168-comtrend-vr-3032u.dts @@ -19,7 +19,7 @@ keys { compatible = "gpio-keys-polled"; - poll-interval = <20>; + poll-interval = <100>; reset { label = "reset"; diff --git a/target/linux/bmips/dts/bcm63168-sercomm-shg2500.dts b/target/linux/bmips/dts/bcm63168-sercomm-shg2500.dts index bcab940771..bb769b09e1 100644 --- a/target/linux/bmips/dts/bcm63168-sercomm-shg2500.dts +++ b/target/linux/bmips/dts/bcm63168-sercomm-shg2500.dts @@ -27,7 +27,7 @@ keys { compatible = "gpio-keys-polled"; - poll-interval = <20>; + poll-interval = <100>; wps { label = "wps"; diff --git a/target/linux/bmips/dts/bcm6318-comtrend-ar-5315u.dts b/target/linux/bmips/dts/bcm6318-comtrend-ar-5315u.dts index 7f2d438efb..8ac37be495 100644 --- a/target/linux/bmips/dts/bcm6318-comtrend-ar-5315u.dts +++ b/target/linux/bmips/dts/bcm6318-comtrend-ar-5315u.dts @@ -19,7 +19,7 @@ keys { compatible = "gpio-keys-polled"; - poll-interval = <20>; + poll-interval = <100>; wps { label = "wps"; diff --git a/target/linux/bmips/dts/bcm6328-comtrend-ar-5387un.dts b/target/linux/bmips/dts/bcm6328-comtrend-ar-5387un.dts index 276858dff7..72802366a0 100644 --- a/target/linux/bmips/dts/bcm6328-comtrend-ar-5387un.dts +++ b/target/linux/bmips/dts/bcm6328-comtrend-ar-5387un.dts @@ -18,7 +18,7 @@ keys { compatible = "gpio-keys-polled"; - poll-interval = <20>; + poll-interval = <100>; reset { label = "reset"; diff --git a/target/linux/bmips/dts/bcm6358-huawei-hg556a-b.dts b/target/linux/bmips/dts/bcm6358-huawei-hg556a-b.dts index 18adc73b63..716c6227f8 100644 --- a/target/linux/bmips/dts/bcm6358-huawei-hg556a-b.dts +++ b/target/linux/bmips/dts/bcm6358-huawei-hg556a-b.dts @@ -18,7 +18,7 @@ keys { compatible = "gpio-keys-polled"; - poll-interval = <20>; + poll-interval = <100>; help { label = "help"; diff --git a/target/linux/bmips/dts/bcm6362-huawei-hg253s-v2.dts b/target/linux/bmips/dts/bcm6362-huawei-hg253s-v2.dts index e848b99b2c..2a9a6c559a 100644 --- a/target/linux/bmips/dts/bcm6362-huawei-hg253s-v2.dts +++ b/target/linux/bmips/dts/bcm6362-huawei-hg253s-v2.dts @@ -18,7 +18,7 @@ keys { compatible = "gpio-keys-polled"; - poll-interval = <20>; + poll-interval = <100>; reset { label = "reset"; diff --git a/target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts b/target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts index c96a6c4585..ddcde2b688 100644 --- a/target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts +++ b/target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts @@ -21,7 +21,7 @@ keys { compatible = "gpio-keys-polled"; - poll-interval = <20>; + poll-interval = <100>; wlan { label = "wlan"; diff --git a/target/linux/bmips/dts/bcm6368-comtrend-vr-3025u.dts b/target/linux/bmips/dts/bcm6368-comtrend-vr-3025u.dts index b29078d645..60029fe7f8 100644 --- a/target/linux/bmips/dts/bcm6368-comtrend-vr-3025u.dts +++ b/target/linux/bmips/dts/bcm6368-comtrend-vr-3025u.dts @@ -18,7 +18,7 @@ keys { compatible = "gpio-keys-polled"; - poll-interval = <20>; + poll-interval = <100>; reset { label = "reset"; From e9f5b773d29ef6d10f5e23e21edb1897a8d828e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Thu, 27 Apr 2023 13:47:24 +0200 Subject: [PATCH 3/7] bmips: document GPIO external interrupts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BCM63xx SoCs have an external interrupt controller which can be used for specific GPIO keys. Signed-off-by: Álvaro Fernández Rojas --- target/linux/bmips/dts/bcm6318.dtsi | 1 + target/linux/bmips/dts/bcm63268.dtsi | 1 + target/linux/bmips/dts/bcm6328.dtsi | 1 + target/linux/bmips/dts/bcm6358.dtsi | 1 + target/linux/bmips/dts/bcm6362.dtsi | 1 + target/linux/bmips/dts/bcm6368.dtsi | 1 + .../bcm6318-interrupt-controller.h | 5 ++++ .../bcm63268-interrupt-controller.h | 9 ++++++-- .../bcm6328-interrupt-controller.h | 5 ++++ .../bcm6358-interrupt-controller.h | 7 ++++++ .../bcm6362-interrupt-controller.h | 7 +++++- .../bcm6368-interrupt-controller.h | 23 ++++++++++++------- 12 files changed, 51 insertions(+), 11 deletions(-) diff --git a/target/linux/bmips/dts/bcm6318.dtsi b/target/linux/bmips/dts/bcm6318.dtsi index fc5085c506..28c656d090 100644 --- a/target/linux/bmips/dts/bcm6318.dtsi +++ b/target/linux/bmips/dts/bcm6318.dtsi @@ -6,6 +6,7 @@ #include #include #include +#include #include #include diff --git a/target/linux/bmips/dts/bcm63268.dtsi b/target/linux/bmips/dts/bcm63268.dtsi index e30cdd862f..f9a31d36ef 100644 --- a/target/linux/bmips/dts/bcm63268.dtsi +++ b/target/linux/bmips/dts/bcm63268.dtsi @@ -6,6 +6,7 @@ #include #include #include +#include #include #include diff --git a/target/linux/bmips/dts/bcm6328.dtsi b/target/linux/bmips/dts/bcm6328.dtsi index d61903e154..f45f94f5b8 100644 --- a/target/linux/bmips/dts/bcm6328.dtsi +++ b/target/linux/bmips/dts/bcm6328.dtsi @@ -6,6 +6,7 @@ #include #include #include +#include #include #include diff --git a/target/linux/bmips/dts/bcm6358.dtsi b/target/linux/bmips/dts/bcm6358.dtsi index eb8ca0c10d..b56ec698ba 100644 --- a/target/linux/bmips/dts/bcm6358.dtsi +++ b/target/linux/bmips/dts/bcm6358.dtsi @@ -6,6 +6,7 @@ #include #include #include +#include #include / { diff --git a/target/linux/bmips/dts/bcm6362.dtsi b/target/linux/bmips/dts/bcm6362.dtsi index d7fff43c44..e615eaf8b3 100644 --- a/target/linux/bmips/dts/bcm6362.dtsi +++ b/target/linux/bmips/dts/bcm6362.dtsi @@ -6,6 +6,7 @@ #include #include #include +#include #include #include diff --git a/target/linux/bmips/dts/bcm6368.dtsi b/target/linux/bmips/dts/bcm6368.dtsi index baa1c43417..0ac1269166 100644 --- a/target/linux/bmips/dts/bcm6368.dtsi +++ b/target/linux/bmips/dts/bcm6368.dtsi @@ -6,6 +6,7 @@ #include #include #include +#include #include / { diff --git a/target/linux/bmips/files/include/dt-bindings/interrupt-controller/bcm6318-interrupt-controller.h b/target/linux/bmips/files/include/dt-bindings/interrupt-controller/bcm6318-interrupt-controller.h index 34bf929eda..91d70377cc 100644 --- a/target/linux/bmips/files/include/dt-bindings/interrupt-controller/bcm6318-interrupt-controller.h +++ b/target/linux/bmips/files/include/dt-bindings/interrupt-controller/bcm6318-interrupt-controller.h @@ -81,4 +81,9 @@ #define BCM6318_IRQ_EPHY2_IDDQ_ENERGY 78 #define BCM6318_IRQ_EPHY3_IDDQ_ENERGY 79 +#define BCM6318_EXTIRQ_0 0 /* GPIO 33 */ +#define BCM6318_EXTIRQ_1 1 +#define BCM6318_EXTIRQ_2 2 +#define BCM6318_EXTIRQ_3 3 + #endif /* __DT_BINDINGS_INTERRUPT_CONTROLLER_BCM6318_H */ diff --git a/target/linux/bmips/files/include/dt-bindings/interrupt-controller/bcm63268-interrupt-controller.h b/target/linux/bmips/files/include/dt-bindings/interrupt-controller/bcm63268-interrupt-controller.h index 84a5f44611..90b7890f50 100644 --- a/target/linux/bmips/files/include/dt-bindings/interrupt-controller/bcm63268-interrupt-controller.h +++ b/target/linux/bmips/files/include/dt-bindings/interrupt-controller/bcm63268-interrupt-controller.h @@ -35,9 +35,9 @@ #define BCM63268_IRQ_ATM_DMA3 29 #define BCM63268_IRQ_WAKE_ON_IRQ 30 #define BCM63268_IRQ_GPHY 31 -#define BCM63268_IRQ_DECT0 32 +#define BCM63268_IRQ_DECT0 32 #define BCM63268_IRQ_DECT1 33 -#define BCM63268_IRQ_UART1 34 +#define BCM63268_IRQ_UART1 34 #define BCM63268_IRQ_WLAN_GPIO 35 #define BCM63268_IRQ_USB_CTL_TX_DMA 36 #define BCM63268_IRQ_USB_BULK_TX_DMA 37 @@ -83,4 +83,9 @@ #define BCM63268_IRQ_ATM_DMA19 79 #define BCM63268_IRQ_LSSPI 80 +#define BCM63268_EXTIRQ_0 0 /* GPIO 32 */ +#define BCM63268_EXTIRQ_1 1 /* GPIO 33 */ +#define BCM63268_EXTIRQ_2 2 /* GPIO 34 */ +#define BCM63268_EXTIRQ_3 3 /* GPIO 35 */ + #endif /* __DT_BINDINGS_INTERRUPT_CONTROLLER_BCM63268_H */ diff --git a/target/linux/bmips/files/include/dt-bindings/interrupt-controller/bcm6328-interrupt-controller.h b/target/linux/bmips/files/include/dt-bindings/interrupt-controller/bcm6328-interrupt-controller.h index 1f5192d9fe..2a6a1da888 100644 --- a/target/linux/bmips/files/include/dt-bindings/interrupt-controller/bcm6328-interrupt-controller.h +++ b/target/linux/bmips/files/include/dt-bindings/interrupt-controller/bcm6328-interrupt-controller.h @@ -65,4 +65,9 @@ #define BCM6328_IRQ_ATM_DMA19 62 #define BCM6328_IRQ_SAR 63 +#define BCM6328_EXTIRQ_0 0 /* GPIO 23 */ +#define BCM6328_EXTIRQ_1 1 /* GPIO 24 */ +#define BCM6328_EXTIRQ_2 2 /* GPIO 15 */ +#define BCM6328_EXTIRQ_3 3 /* GPIO 12 */ + #endif /* __DT_BINDINGS_INTERRUPT_CONTROLLER_BCM6328_H */ diff --git a/target/linux/bmips/files/include/dt-bindings/interrupt-controller/bcm6358-interrupt-controller.h b/target/linux/bmips/files/include/dt-bindings/interrupt-controller/bcm6358-interrupt-controller.h index dc412d1f59..51c7e50cf4 100644 --- a/target/linux/bmips/files/include/dt-bindings/interrupt-controller/bcm6358-interrupt-controller.h +++ b/target/linux/bmips/files/include/dt-bindings/interrupt-controller/bcm6358-interrupt-controller.h @@ -35,4 +35,11 @@ #define BCM6358_IRQ_DG 30 #define BCM6358_IRQ_MPI 31 +#define BCM6358_EXTIRQ0_0 0 /* GPIO 34 */ +#define BCM6358_EXTIRQ0_1 1 /* GPIO 35 */ +#define BCM6358_EXTIRQ0_2 2 /* GPIO 36 */ +#define BCM6358_EXTIRQ0_3 3 /* GPIO 37 */ +#define BCM6358_EXTIRQ1_4 0 /* GPIO 32 */ +#define BCM6358_EXTIRQ1_5 1 /* GPIO 33 */ + #endif /* __DT_BINDINGS_INTERRUPT_CONTROLLER_BCM6358_H */ diff --git a/target/linux/bmips/files/include/dt-bindings/interrupt-controller/bcm6362-interrupt-controller.h b/target/linux/bmips/files/include/dt-bindings/interrupt-controller/bcm6362-interrupt-controller.h index 2cb329204a..bec089b159 100644 --- a/target/linux/bmips/files/include/dt-bindings/interrupt-controller/bcm6362-interrupt-controller.h +++ b/target/linux/bmips/files/include/dt-bindings/interrupt-controller/bcm6362-interrupt-controller.h @@ -65,7 +65,12 @@ #define BCM6362_IRQ_ATM_DMA15 59 #define BCM6362_IRQ_ATM_DMA16 60 #define BCM6362_IRQ_ATM_DMA17 61 -#define BCM6362_IRQ_ATM_DMA18 62 +#define BCM6362_IRQ_ATM_DMA18 62 #define BCM6362_IRQ_ATM_DMA19 63 +#define BCM6362_EXTIRQ_0 0 /* GPIO 24 */ +#define BCM6362_EXTIRQ_1 1 /* GPIO 25 */ +#define BCM6362_EXTIRQ_2 2 /* GPIO 26 */ +#define BCM6362_EXTIRQ_3 3 /* GPIO 27 */ + #endif /* __DT_BINDINGS_INTERRUPT_CONTROLLER_BCM6362_H */ diff --git a/target/linux/bmips/files/include/dt-bindings/interrupt-controller/bcm6368-interrupt-controller.h b/target/linux/bmips/files/include/dt-bindings/interrupt-controller/bcm6368-interrupt-controller.h index 96a73d645e..0f36200749 100644 --- a/target/linux/bmips/files/include/dt-bindings/interrupt-controller/bcm6368-interrupt-controller.h +++ b/target/linux/bmips/files/include/dt-bindings/interrupt-controller/bcm6368-interrupt-controller.h @@ -35,14 +35,14 @@ #define BCM6368_IRQ_USB_BULK_TX_DMA 29 #define BCM6368_IRQ_USB_ISO_RX_DMA 30 #define BCM6368_IRQ_USB_ISO_TX_DMA 31 -#define BCM6368_IRQ_ENETSW_RX_DMA0 32 -#define BCM6368_IRQ_ENETSW_RX_DMA1 33 -#define BCM6368_IRQ_ENETSW_RX_DMA2 34 -#define BCM6368_IRQ_ENETSW_RX_DMA3 35 -#define BCM6368_IRQ_ENETSW_TX_DMA0 36 -#define BCM6368_IRQ_ENETSW_TX_DMA1 37 -#define BCM6368_IRQ_ENETSW_TX_DMA2 38 -#define BCM6368_IRQ_ENETSW_TX_DMA3 39 +#define BCM6368_IRQ_ENETSW_RX_DMA0 32 +#define BCM6368_IRQ_ENETSW_RX_DMA1 33 +#define BCM6368_IRQ_ENETSW_RX_DMA2 34 +#define BCM6368_IRQ_ENETSW_RX_DMA3 35 +#define BCM6368_IRQ_ENETSW_TX_DMA0 36 +#define BCM6368_IRQ_ENETSW_TX_DMA1 37 +#define BCM6368_IRQ_ENETSW_TX_DMA2 38 +#define BCM6368_IRQ_ENETSW_TX_DMA3 39 #define BCM6368_IRQ_ATM_DMA0 40 #define BCM6368_IRQ_ATM_DMA1 41 #define BCM6368_IRQ_ATM_DMA2 42 @@ -68,4 +68,11 @@ #define BCM6368_IRQ_PCM_DMA0 62 #define BCM6368_IRQ_PCM_DMA1 63 +#define BCM6368_EXTIRQ0_0 0 /* GPIO 34 */ +#define BCM6368_EXTIRQ0_1 1 /* GPIO 35 */ +#define BCM6368_EXTIRQ0_2 2 /* GPIO 36 */ +#define BCM6368_EXTIRQ0_3 3 /* GPIO 37 */ +#define BCM6368_EXTIRQ1_4 0 /* GPIO 32 */ +#define BCM6368_EXTIRQ1_5 1 /* GPIO 33 */ + #endif /* __DT_BINDINGS_INTERRUPT_CONTROLLER_BCM6368_H */ From c3549b931902e02a76a5cdf31817c58a8c315f12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Thu, 27 Apr 2023 13:49:10 +0200 Subject: [PATCH 4/7] bmips: fix external interrupt controller MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - irq_domain_add_simple() can't be used on bmips since interrupts aren't hardcoded with specific offsets for internal and external as opposed to bcm63xx. This is needed to avoid collisions with other interrupts. - remove unused bcm63xx-specific code. Signed-off-by: Álvaro Fernández Rojas --- ...ort-for-bcm6345-style-external-inter.patch | 23 ++----------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/target/linux/bmips/patches-5.15/100-irqchip-add-support-for-bcm6345-style-external-inter.patch b/target/linux/bmips/patches-5.15/100-irqchip-add-support-for-bcm6345-style-external-inter.patch index ba55107bb1..d64426ea1d 100644 --- a/target/linux/bmips/patches-5.15/100-irqchip-add-support-for-bcm6345-style-external-inter.patch +++ b/target/linux/bmips/patches-5.15/100-irqchip-add-support-for-bcm6345-style-external-inter.patch @@ -73,7 +73,7 @@ Signed-off-by: Jonas Gorski obj-$(CONFIG_BCM7120_L2_IRQ) += irq-bcm7120-l2.o --- /dev/null +++ b/drivers/irqchip/irq-bcm6345-ext.c -@@ -0,0 +1,299 @@ +@@ -0,0 +1,280 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive @@ -94,14 +94,6 @@ Signed-off-by: Jonas Gorski +#include +#include + -+#ifdef CONFIG_BCM63XX -+#include -+ -+#define VIRQ_BASE IRQ_EXTERNAL_BASE -+#else -+#define VIRQ_BASE 0 -+#endif -+ +#define MAX_IRQS 4 + +#define EXTIRQ_CFG_SENSE 0 @@ -271,7 +263,6 @@ Signed-off-by: Jonas Gorski +{ + struct intc_data *data; + unsigned int i; -+ int start = VIRQ_BASE; + + data = kzalloc(sizeof(*data), GFP_KERNEL); + if (!data) @@ -296,17 +287,7 @@ Signed-off-by: Jonas Gorski + data->chip.irq_unmask = bcm6345_ext_intc_irq_unmask; + data->chip.irq_set_type = bcm6345_ext_intc_set_type; + -+ /* -+ * If we have less than 4 irqs, this is the second controller on -+ * bcm63xx. So increase the VIRQ start to not overlap with the first -+ * one, but only do so if we actually use a non-zero start. -+ * -+ * This can be removed when bcm63xx has no legacy users anymore. -+ */ -+ if (start && num_irqs < 4) -+ start += 4; -+ -+ data->domain = irq_domain_add_simple(node, num_irqs, start, ++ data->domain = irq_domain_add_linear(node, num_irqs, + &bcm6345_ext_domain_ops, data); + if (!data->domain) { + kfree(data); From de0ed4ffbfba7cb39acc93f783c3eccb1e3859d2 Mon Sep 17 00:00:00 2001 From: Olliver Schinagl Date: Thu, 13 Apr 2023 11:38:54 +0200 Subject: [PATCH 5/7] generic: Convert incorrect generic/5.15 patches again OpenWrt's developer guide prefers having actual patches so they an be sent upstream more easily. However, in the case of hack-5.15 patches which are not meant for upstream, adding proper fields allows for `git am` to properly function. This commit tries to rectify that, by digging in the history to find where and how it was first added. Signed-off-by: Olliver Schinagl Signed-off-by: Daniel Golle --- ...net-mtk_eth_soc-add-support-for-MT7981.patch | 17 +++++++++++++++++ ...s-mtk-lynxi-workaround-2500BaseX-no-an.patch | 13 +++++++++++++ .../795-backport-phylink_pcs-helpers.patch | 17 +++++++++++++++++ 3 files changed, 47 insertions(+) diff --git a/target/linux/generic/backport-5.15/733-v6.3-18-net-ethernet-mtk_eth_soc-add-support-for-MT7981.patch b/target/linux/generic/backport-5.15/733-v6.3-18-net-ethernet-mtk_eth_soc-add-support-for-MT7981.patch index 066b70c5e2..c1cf323800 100644 --- a/target/linux/generic/backport-5.15/733-v6.3-18-net-ethernet-mtk_eth_soc-add-support-for-MT7981.patch +++ b/target/linux/generic/backport-5.15/733-v6.3-18-net-ethernet-mtk_eth_soc-add-support-for-MT7981.patch @@ -1,3 +1,20 @@ +From f5d43ddd334b7c32fcaed9ba46afbd85cb467f1f Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Sun, 19 Mar 2023 12:56:28 +0000 +Subject: [PATCH] net: ethernet: mtk_eth_soc: add support for MT7981 SoC + +The MediaTek MT7981 SoC comes with two 1G/2.5G SGMII ports, just like +MT7986. + +In addition MT7981 is equipped with a built-in 1000Base-T PHY which can +be used with GMAC1. + +As many MT7981 boards make use of inverting SGMII signal polarity, add +new device-tree attribute 'mediatek,pn_swap' to support them. + +Signed-off-by: Daniel Golle +Signed-off-by: Jakub Kicinski + --- a/drivers/net/ethernet/mediatek/mtk_eth_path.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_path.c @@ -96,12 +96,20 @@ static int set_mux_gmac2_gmac0_to_gephy( diff --git a/target/linux/generic/hack-5.15/750-net-pcs-mtk-lynxi-workaround-2500BaseX-no-an.patch b/target/linux/generic/hack-5.15/750-net-pcs-mtk-lynxi-workaround-2500BaseX-no-an.patch index b03f0feab2..8b7f2f0955 100644 --- a/target/linux/generic/hack-5.15/750-net-pcs-mtk-lynxi-workaround-2500BaseX-no-an.patch +++ b/target/linux/generic/hack-5.15/750-net-pcs-mtk-lynxi-workaround-2500BaseX-no-an.patch @@ -1,3 +1,16 @@ +From 880d1311335120f64447ca9d11933872d734e19a Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Mon, 27 Mar 2023 18:41:54 +0100 +Subject: [PATCH] generic: pcs-mtk-lynxi: add hack to use 2500Base-X without AN + +Using 2500Base-T SFP modules e.g. on the BananaPi R3 requires manually +disabling auto-negotiation, e.g. using ethtool. While a proper fix +using SFP quirks is being discussed upstream, bring a work-around to +restore user experience to what it was before the switch to the +dedicated SGMII PCS driver. + +Signed-off-by: Daniel Golle + --- a/drivers/net/pcs/pcs-mtk-lynxi.c +++ b/drivers/net/pcs/pcs-mtk-lynxi.c @@ -92,14 +92,23 @@ static void mtk_pcs_lynxi_get_state(stru diff --git a/target/linux/generic/hack-5.15/795-backport-phylink_pcs-helpers.patch b/target/linux/generic/hack-5.15/795-backport-phylink_pcs-helpers.patch index 2ccdc905a5..b1e7065a8b 100644 --- a/target/linux/generic/hack-5.15/795-backport-phylink_pcs-helpers.patch +++ b/target/linux/generic/hack-5.15/795-backport-phylink_pcs-helpers.patch @@ -1,3 +1,20 @@ +From 027586ae8ecacff49757ed854c020f35d24a599c Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Sat, 11 Mar 2023 03:44:41 +0000 +Subject: [PATCH] generic: backport some phylink helper functions + +It isn't feasible to literally backport all upstream phylink_pcs changes +down to Linux 5.15: It's just too many patches, and many downstream +drivers and hacks are likely to break. We are too close to branching off +to risk this, and it's also just too much work. +Instead just add helper functions used by modern PCS drivers while keeping +the original functions instact as well. While this may add a kilobyte or +two of extra kernel size, it has the advantage that we get the best of both +worlds: None of the existing codepaths are touched, but yet we have the +option to backport singular improvements to Ethernet drivers where needed. + +Signed-off-by: Daniel Golle + --- a/include/linux/phylink.h +++ b/include/linux/phylink.h @@ -584,10 +584,37 @@ int phylink_speed_up(struct phylink *pl) From 1e8b318ebe72d2c865b140f8075583fcda22783d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Thu, 27 Apr 2023 17:46:12 +0200 Subject: [PATCH 6/7] broadcom-sprom: update to latest version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaces SPROMs with the ones from bmips fixups to prevent errors such as: https://github.com/openwrt/openwrt/pull/11474#issuecomment-1524235591 Signed-off-by: Álvaro Fernández Rojas --- package/firmware/broadcom-sprom/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/firmware/broadcom-sprom/Makefile b/package/firmware/broadcom-sprom/Makefile index 23c07942d3..01bca2c35b 100644 --- a/package/firmware/broadcom-sprom/Makefile +++ b/package/firmware/broadcom-sprom/Makefile @@ -3,9 +3,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:=broadcom-sprom -PKG_SOURCE_DATE:=2023-04-19 -PKG_SOURCE_VERSION:=d1d94f2407d9090ce72363614bbb87230a92ba44 -PKG_MIRROR_HASH:=76cc5590a577713a65a512db12014d4fef61d9c67750e9f69753b358f442db8e +PKG_SOURCE_DATE:=2023-04-27 +PKG_SOURCE_VERSION:=d36f7fcb37711106a3a2652b576436cb09aa5b6f +PKG_MIRROR_HASH:=fde251ab4ed26d61c95269316119710d6ccb8fe30ef13305d08b3e7d7d8a4c60 PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git From 2c530fcb972c112e7a2b10f9c21ac6d276624b5e Mon Sep 17 00:00:00 2001 From: David Bauer Date: Thu, 27 Apr 2023 22:24:15 +0200 Subject: [PATCH 7/7] ramips: reduce Archer AX23 / MR70X SPI-frequency It was brought to attention the Archer AX23 v1 fails to read jffs2 data from time to time. While this is not reproducible on my unit, it is on others. Reducing the SPI frequency does the trick. While it worked with at lest 40 MHz, opt for the cautious side and choose a save frequency of 25 MHz. Apply the same treatment to the Mercusys MR70X which uses a similar design just in case. Signed-off-by: David Bauer --- target/linux/ramips/dts/mt7621_mercusys_mr70x-v1.dts | 2 +- target/linux/ramips/dts/mt7621_tplink_archer-ax23-v1.dts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/ramips/dts/mt7621_mercusys_mr70x-v1.dts b/target/linux/ramips/dts/mt7621_mercusys_mr70x-v1.dts index 7eb94ba9cf..245d130a1f 100644 --- a/target/linux/ramips/dts/mt7621_mercusys_mr70x-v1.dts +++ b/target/linux/ramips/dts/mt7621_mercusys_mr70x-v1.dts @@ -52,7 +52,7 @@ flash@0 { compatible = "jedec,spi-nor"; reg = <0>; - spi-max-frequency = <80000000>; + spi-max-frequency = <25000000>; partitions { compatible = "fixed-partitions"; diff --git a/target/linux/ramips/dts/mt7621_tplink_archer-ax23-v1.dts b/target/linux/ramips/dts/mt7621_tplink_archer-ax23-v1.dts index 5c2ef1fa11..50834c5866 100644 --- a/target/linux/ramips/dts/mt7621_tplink_archer-ax23-v1.dts +++ b/target/linux/ramips/dts/mt7621_tplink_archer-ax23-v1.dts @@ -85,7 +85,7 @@ flash@0 { compatible = "jedec,spi-nor"; reg = <0>; - spi-max-frequency = <80000000>; + spi-max-frequency = <25000000>; partitions { compatible = "fixed-partitions";