From 7e7218d1331d0b557b0e9a513aef5de584b6b1d2 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 7 Mar 2021 18:15:50 +0000 Subject: [PATCH 01/18] mediatek: remove no longer needed sysupgrade hack Keeping configuration is now handled in fstools like for other types of flash as well. Signed-off-by: Daniel Golle --- .../base-files/lib/preinit/79_move_config | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 target/linux/mediatek/mt7622/base-files/lib/preinit/79_move_config diff --git a/target/linux/mediatek/mt7622/base-files/lib/preinit/79_move_config b/target/linux/mediatek/mt7622/base-files/lib/preinit/79_move_config deleted file mode 100644 index 8a30b84497..0000000000 --- a/target/linux/mediatek/mt7622/base-files/lib/preinit/79_move_config +++ /dev/null @@ -1,18 +0,0 @@ -. /lib/upgrade/common.sh - -RECOVERY_PART=/dev/mmcblk0p6 - -move_config() { - if [ -b $RECOVERY_PART ]; then - insmod nls_cp437 - insmod nls_iso8859-1 - insmod fat - insmod vfat - mkdir -p /recovery - mount -o rw,noatime $RECOVERY_PART /recovery - [ -f "/recovery/$BACKUP_FILE" ] && mv -f "/recovery/$BACKUP_FILE" / - umount /recovery - fi -} - -boot_hook_add preinit_mount_root move_config From 9e64e4ce26719ea81637b0e3d9754bd5190f0c21 Mon Sep 17 00:00:00 2001 From: Tony Ambardar Date: Mon, 1 Mar 2021 01:07:45 -0800 Subject: [PATCH 02/18] bpftools: fix libbpf pkgconfig file The pkgconfig file hardcodes a host library directory which cannot be overridden by OpenWrt during builds. Use SED to fix this and potential include directory problems, as is done with several other packages. This fixes a strange issue intermittently seen building iproute2 on the oxnas target: iptables modules directory: /usr/lib/iptables libc has setns: yes SELinux support: no libbpf support: no libbpf version 0.3.0 is too low, please update it to at least 0.1.0 LIBBPF_FORCE=on set, but couldn't find a usable libbpf Fixes: 2f0d672088c3 ("bpftools: add utility and library packages supporting eBPF usage") Reported-by: Russell Senior Signed-off-by: Tony Ambardar --- package/network/utils/bpftools/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package/network/utils/bpftools/Makefile b/package/network/utils/bpftools/Makefile index a466c82e9f..15bed2d89e 100644 --- a/package/network/utils/bpftools/Makefile +++ b/package/network/utils/bpftools/Makefile @@ -145,6 +145,10 @@ define Build/InstallDev/libbpf $(INSTALL_DIR) $(1)/usr/lib/pkgconfig $(CP) $(PKG_INSTALL_DIR)/usr/lib$(LIB_SUFFIX)/pkgconfig/libbpf.pc \ $(1)/usr/lib/pkgconfig/ + $(SED) 's,/usr/include,$$$${prefix}/include,g' \ + $(1)/usr/lib/pkgconfig/libbpf.pc + $(SED) 's,/usr/lib,$$$${exec_prefix}/lib,g' \ + $(1)/usr/lib/pkgconfig/libbpf.pc endef ifeq ($(BUILD_VARIANT),lib) From 24737d85e8cadb6062cff556b7fae29265f326e8 Mon Sep 17 00:00:00 2001 From: Georgi Valkov Date: Tue, 2 Mar 2021 12:41:10 +0200 Subject: [PATCH 03/18] bpftools: fix param order for install on macOS Fix: bpftools 5.11.2 does not compile on macOS, because the -m option was placed between src and dst. Corrected by moving -m 644 before src. Signed-off-by: Georgi Valkov --- .../200-fix-install-param-order-on-macos.patch | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 package/network/utils/bpftools/patches/200-fix-install-param-order-on-macos.patch diff --git a/package/network/utils/bpftools/patches/200-fix-install-param-order-on-macos.patch b/package/network/utils/bpftools/patches/200-fix-install-param-order-on-macos.patch new file mode 100644 index 0000000000..ffb7e2ce52 --- /dev/null +++ b/package/network/utils/bpftools/patches/200-fix-install-param-order-on-macos.patch @@ -0,0 +1,11 @@ +--- a/tools/lib/bpf/Makefile ++++ b/tools/lib/bpf/Makefile +@@ -236,7 +236,7 @@ define do_install + if [ ! -d '$(DESTDIR_SQ)$2' ]; then \ + $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2'; \ + fi; \ +- $(INSTALL) $1 $(if $3,-m $3,) '$(DESTDIR_SQ)$2' ++ $(INSTALL) $(if $3,-m $3,) $1 '$(DESTDIR_SQ)$2' + endef + + install_lib: all_cmd From ffeb37047e85a5efd96890db12710e9d60b4b76a Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 8 Mar 2021 00:10:51 +0000 Subject: [PATCH 04/18] procd: update to git HEAD 945d0d7 utils: fix C style in header file 2cfc26f inittab: detect active console from kernel if no console= specified Signed-off-by: Daniel Golle --- package/system/procd/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/system/procd/Makefile b/package/system/procd/Makefile index 64c14b534d..861dd0da57 100644 --- a/package/system/procd/Makefile +++ b/package/system/procd/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=$(AUTORELEASE) PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/procd.git -PKG_SOURCE_DATE:=2021-03-02 -PKG_SOURCE_VERSION:=64e9f3a4ef61b53f72d0c9cf03da109e43b6700e -PKG_MIRROR_HASH:=59e1ea81e16b865c8e1bf16d747fd802285fd6bf8d689065e48dc1dee07447fb +PKG_SOURCE_DATE:=2021-03-08 +PKG_SOURCE_VERSION:=2cfc26f8456a4d5ba3836c914a742f3d00bad781 +PKG_MIRROR_HASH:=4b514143949b6ea5799a7b0b2f2f4ad5f084f88929eb0ac5a01ffc7852a71d22 CMAKE_INSTALL:=1 PKG_LICENSE:=GPL-2.0 From a3b863dc9fa799d5a2195131cd018898b044177f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Fri, 5 Mar 2021 17:51:39 +0100 Subject: [PATCH 05/18] bmips: automatically detect CPU frequency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some BCM63xx SoCs support multiple CPU frequencies depending on HW configuration. Signed-off-by: Álvaro Fernández Rojas --- ...s-automatically-detect-CPU-frequency.patch | 239 ++++++++++++++++++ 1 file changed, 239 insertions(+) create mode 100644 target/linux/bmips/patches-5.10/200-bmips-automatically-detect-CPU-frequency.patch diff --git a/target/linux/bmips/patches-5.10/200-bmips-automatically-detect-CPU-frequency.patch b/target/linux/bmips/patches-5.10/200-bmips-automatically-detect-CPU-frequency.patch new file mode 100644 index 0000000000..d68e4b97e8 --- /dev/null +++ b/target/linux/bmips/patches-5.10/200-bmips-automatically-detect-CPU-frequency.patch @@ -0,0 +1,239 @@ +From 38d5e4b3bcc25db14a2d5f428acf56dff862c97e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= +Date: Fri, 5 Mar 2021 15:14:32 +0100 +Subject: [PATCH] bmips: automatically detect CPU frequency +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Some BCM63xx SoCs support multiple CPU frequencies depending on HW config. + +Signed-off-by: Álvaro Fernández Rojas +--- + arch/mips/bmips/setup.c | 197 +++++++++++++++++++++- + arch/mips/configs/bmips_bcm63xx_defconfig | 91 ++++++++++ + 2 files changed, 281 insertions(+), 7 deletions(-) + create mode 100644 arch/mips/configs/bmips_bcm63xx_defconfig + +--- a/arch/mips/bmips/setup.c ++++ b/arch/mips/bmips/setup.c +@@ -31,11 +31,51 @@ + + #define RELO_NORMAL_VEC BIT(18) + ++#define REG_BCM6318_SOB ((void __iomem *)CKSEG1ADDR(0x10000900)) ++#define BCM6318_FREQ_SHIFT 23 ++#define BCM6318_FREQ_MASK (0x3 << BCM6318_FREQ_SHIFT) ++ + #define REG_BCM6328_OTP ((void __iomem *)CKSEG1ADDR(0x1000062c)) + #define BCM6328_TP1_DISABLED BIT(9) ++#define REG_BCM6328_MISC_SB ((void __iomem *)CKSEG1ADDR(0x10001a40)) ++#define BCM6328_FCVO_SHIFT 7 ++#define BCM6328_FCVO_MASK (0x1f << BCM6328_FCVO_SHIFT) ++ ++#define REG_BCM6358_DDR_PLLC ((void __iomem *)CKSEG1ADDR(0x100012b8)) ++#define BCM6358_PLLC_M1_SHIFT 0 ++#define BCM6358_PLLC_M1_MASK (0xff << BCM6358_PLLC_M1_SHIFT) ++#define BCM6358_PLLC_N1_SHIFT 23 ++#define BCM6358_PLLC_N1_MASK (0x3f << BCM6358_PLLC_N1_SHIFT) ++#define BCM6358_PLLC_N2_SHIFT 29 ++#define BCM6358_PLLC_N2_MASK (0x7 << BCM6358_PLLC_N2_SHIFT) ++ ++#define REG_BCM6362_MISC_SB ((void __iomem *)CKSEG1ADDR(0x10001814)) ++#define BCM6362_FCVO_SHIFT 1 ++#define BCM6362_FCVO_MASK (0x1f << BCM6362_FCVO_SHIFT) ++ ++#define REG_BCM6368_DDR_PLLC ((void __iomem *)CKSEG1ADDR(0x100012a0)) ++#define BCM6368_PLLC_P1_SHIFT 0 ++#define BCM6368_PLLC_P1_MASK (0xf << BCM6368_PLLC_P1_SHIFT) ++#define BCM6368_PLLC_P2_SHIFT 4 ++#define BCM6368_PLLC_P2_MASK (0xf << BCM6368_PLLC_P2_SHIFT) ++#define BCM6368_PLLC_NDIV_SHIFT 16 ++#define BCM6368_PLLC_NDIV_MASK (0x1ff << BCM6368_PLLC_NDIV_SHIFT) ++#define REG_BCM6368_DDR_PLLD ((void __iomem *)CKSEG1ADDR(0x100012a4)) ++#define BCM6368_PLLD_MDIV_SHIFT 0 ++#define BCM6368_PLLD_MDIV_MASK (0xff << BCM6368_PLLD_MDIV_SHIFT) ++ ++#define REG_BCM63268_MISC_SB ((void __iomem *)CKSEG1ADDR(0x10001814)) ++#define BCM63268_FCVO_SHIFT 21 ++#define BCM63268_FCVO_MASK (0xf << BCM63268_FCVO_SHIFT) ++ + + static const unsigned long kbase = VMLINUX_LOAD_ADDRESS & 0xfff00000; + ++struct bmips_cpufreq { ++ const char *compatible; ++ u32 (*cpu_freq)(void); ++}; ++ + struct bmips_quirk { + const char *compatible; + void (*quirk_fn)(void); +@@ -138,17 +178,160 @@ const char *get_system_type(void) + return "Generic BMIPS kernel"; + } + ++static u32 bcm6318_cpufreq(void) ++{ ++ u32 val = __raw_readl(REG_BCM6318_SOB); ++ ++ switch ((val & BCM6318_FREQ_MASK) >> BCM6318_FREQ_SHIFT) { ++ case 0: ++ return 166000000; ++ case 2: ++ return 250000000; ++ case 3: ++ return 333000000; ++ case 1: ++ return 400000000; ++ default: ++ return 0; ++ } ++} ++ ++static u32 bcm6328_cpufreq(void) ++{ ++ u32 val = __raw_readl(REG_BCM6328_MISC_SB); ++ ++ switch ((val & BCM6328_FCVO_MASK) >> BCM6328_FCVO_SHIFT) { ++ case 0x12: ++ case 0x14: ++ case 0x19: ++ return 160000000; ++ case 0x1c: ++ return 192000000; ++ case 0x13: ++ case 0x15: ++ return 200000000; ++ case 0x1a: ++ return 384000000; ++ case 0x16: ++ return 400000000; ++ default: ++ return 320000000; ++ } ++} ++ ++static u32 bcm6358_cpufreq(void) ++{ ++ u32 val, n1, n2, m1; ++ ++ val = __raw_readl(REG_BCM6358_DDR_PLLC); ++ n1 = (val & BCM6358_PLLC_M1_MASK) >> BCM6358_PLLC_N1_SHIFT; ++ n2 = (val & BCM6358_PLLC_N2_MASK) >> BCM6358_PLLC_N2_SHIFT; ++ m1 = (val & BCM6358_PLLC_M1_MASK) >> BCM6358_PLLC_M1_SHIFT; ++ ++ return (16 * 1000000 * n1 * n2) / m1; ++} ++ ++static u32 bcm6362_cpufreq(void) ++{ ++ u32 val = __raw_readl(REG_BCM6362_MISC_SB); ++ ++ switch ((val & BCM6362_FCVO_MASK) >> BCM6362_FCVO_SHIFT) { ++ case 0x04: ++ case 0x0c: ++ case 0x14: ++ case 0x1c: ++ return 160000000; ++ case 0x15: ++ case 0x1d: ++ return 200000000; ++ case 0x03: ++ case 0x0b: ++ case 0x13: ++ case 0x1b: ++ return 240000000; ++ case 0x07: ++ case 0x17: ++ return 384000000; ++ case 0x05: ++ case 0x0e: ++ case 0x16: ++ case 0x1e: ++ case 0x1f: ++ return 400000000; ++ case 0x06: ++ return 440000000; ++ default: ++ return 320000000; ++ } ++} ++ ++static u32 bcm6368_cpufreq(void) ++{ ++ unsigned int val, p1, p2, ndiv, m1; ++ ++ val = __raw_readl(REG_BCM6368_DDR_PLLC); ++ p1 = (val & BCM6368_PLLC_P1_MASK) >> BCM6368_PLLC_P1_SHIFT; ++ p2 = (val & BCM6368_PLLC_P2_MASK) >> BCM6368_PLLC_P2_SHIFT; ++ ndiv = (val & BCM6368_PLLC_NDIV_MASK) >> ++ BCM6368_PLLC_NDIV_SHIFT; ++ ++ val = __raw_readl(REG_BCM6368_DDR_PLLD); ++ m1 = (val & BCM6368_PLLD_MDIV_MASK) >> BCM6368_PLLD_MDIV_SHIFT; ++ ++ return (((64 * 1000000) / p1) * p2 * ndiv) / m1; ++} ++ ++static u32 bcm63268_cpufreq(void) ++{ ++ u32 val = __raw_readl(REG_BCM63268_MISC_SB); ++ ++ switch ((val & BCM63268_FCVO_MASK) >> BCM63268_FCVO_SHIFT) { ++ case 0x3: ++ case 0xe: ++ return 320000000; ++ case 0xa: ++ return 333000000; ++ case 0x2: ++ case 0xb: ++ case 0xf: ++ return 400000000; ++ default: ++ return 0; ++ } ++} ++ ++static const struct bmips_cpufreq bmips_cpufreq_list[] = { ++ { "brcm,bcm6318", &bcm6318_cpufreq }, ++ { "brcm,bcm6328", &bcm6328_cpufreq }, ++ { "brcm,bcm6358", &bcm6358_cpufreq }, ++ { "brcm,bcm6362", &bcm6362_cpufreq }, ++ { "brcm,bcm6368", &bcm6368_cpufreq }, ++ { "brcm,bcm63268", &bcm63268_cpufreq }, ++ { /* sentinel */ } ++}; ++ + void __init plat_time_init(void) + { ++ const struct bmips_cpufreq *cf; + struct device_node *np; +- u32 freq; ++ u32 freq = 0; + +- np = of_find_node_by_name(NULL, "cpus"); +- if (!np) +- panic("missing 'cpus' DT node"); +- if (of_property_read_u32(np, "mips-hpt-frequency", &freq) < 0) +- panic("missing 'mips-hpt-frequency' property"); +- of_node_put(np); ++ for (cf = bmips_cpufreq_list; cf->cpu_freq; cf++) { ++ if (of_flat_dt_is_compatible(of_get_flat_dt_root(), ++ cf->compatible)) { ++ freq = cf->cpu_freq() / 2; ++ printk("%s detected @ %u MHz\n", cf->compatible, freq / 500000); ++ } ++ } ++ ++ if (!freq) { ++ np = of_find_node_by_name(NULL, "cpus"); ++ if (!np) ++ panic("missing 'cpus' DT node"); ++ if (of_property_read_u32(np, "mips-hpt-frequency", &freq) < 0) ++ panic("missing 'mips-hpt-frequency' property"); ++ of_node_put(np); ++ } + + mips_hpt_frequency = freq; + } From 45180e862c3ce7bd3fb1f90209c7863998f77d97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Mon, 8 Mar 2021 10:12:42 +0100 Subject: [PATCH 06/18] bmips: remove unneeded console from bootargs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit console parameter is no longer needed after latest procd update. Signed-off-by: Álvaro Fernández Rojas --- target/linux/bmips/dts/bcm6318.dtsi | 2 +- target/linux/bmips/dts/bcm63268.dtsi | 2 +- target/linux/bmips/dts/bcm6328.dtsi | 2 +- target/linux/bmips/dts/bcm6358.dtsi | 2 +- target/linux/bmips/dts/bcm6362.dtsi | 2 +- target/linux/bmips/dts/bcm6368.dtsi | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/target/linux/bmips/dts/bcm6318.dtsi b/target/linux/bmips/dts/bcm6318.dtsi index e7016eb1b2..b8531ffc56 100644 --- a/target/linux/bmips/dts/bcm6318.dtsi +++ b/target/linux/bmips/dts/bcm6318.dtsi @@ -21,7 +21,7 @@ }; chosen { - bootargs = "console=ttyS0,115200n8 earlycon"; + bootargs = "earlycon"; stdout-path = "serial0:115200n8"; }; diff --git a/target/linux/bmips/dts/bcm63268.dtsi b/target/linux/bmips/dts/bcm63268.dtsi index 5581351311..08442ab99d 100644 --- a/target/linux/bmips/dts/bcm63268.dtsi +++ b/target/linux/bmips/dts/bcm63268.dtsi @@ -24,7 +24,7 @@ }; chosen { - bootargs = "console=ttyS0,115200n8 earlycon"; + bootargs = "earlycon"; stdout-path = "serial0:115200n8"; }; diff --git a/target/linux/bmips/dts/bcm6328.dtsi b/target/linux/bmips/dts/bcm6328.dtsi index 62f1309e0a..d139d6ec5d 100644 --- a/target/linux/bmips/dts/bcm6328.dtsi +++ b/target/linux/bmips/dts/bcm6328.dtsi @@ -23,7 +23,7 @@ }; chosen { - bootargs = "console=ttyS0,115200n8 earlycon"; + bootargs = "earlycon"; stdout-path = "serial0:115200n8"; }; diff --git a/target/linux/bmips/dts/bcm6358.dtsi b/target/linux/bmips/dts/bcm6358.dtsi index b396d9335b..bb08abf25b 100644 --- a/target/linux/bmips/dts/bcm6358.dtsi +++ b/target/linux/bmips/dts/bcm6358.dtsi @@ -22,7 +22,7 @@ }; chosen { - bootargs = "console=ttyS0,115200n8 earlycon"; + bootargs = "earlycon"; stdout-path = "serial0:115200n8"; }; diff --git a/target/linux/bmips/dts/bcm6362.dtsi b/target/linux/bmips/dts/bcm6362.dtsi index 0929d6ea3f..d7f9f910d3 100644 --- a/target/linux/bmips/dts/bcm6362.dtsi +++ b/target/linux/bmips/dts/bcm6362.dtsi @@ -24,7 +24,7 @@ }; chosen { - bootargs = "console=ttyS0,115200n8 earlycon"; + bootargs = "earlycon"; stdout-path = "serial0:115200n8"; }; diff --git a/target/linux/bmips/dts/bcm6368.dtsi b/target/linux/bmips/dts/bcm6368.dtsi index 2c980f91f4..b812dea451 100644 --- a/target/linux/bmips/dts/bcm6368.dtsi +++ b/target/linux/bmips/dts/bcm6368.dtsi @@ -23,7 +23,7 @@ }; chosen { - bootargs = "console=ttyS0,115200n8 earlycon"; + bootargs = "earlycon"; stdout-path = "serial0:115200n8"; }; From 101491ae4ad6cf13a1da784b90a7fd72705ee8d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Mon, 8 Mar 2021 10:42:25 +0100 Subject: [PATCH 07/18] bmips: dts: comestic changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Improve and refactor device tree files. Signed-off-by: Álvaro Fernández Rojas --- .../linux/bmips/dts/bcm63168-comtrend-vr-3032u.dts | 2 -- target/linux/bmips/dts/bcm6318.dtsi | 4 ++-- target/linux/bmips/dts/bcm63268.dtsi | 12 ++++++------ target/linux/bmips/dts/bcm6328.dtsi | 4 ++-- target/linux/bmips/dts/bcm6358.dtsi | 4 ++-- .../linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts | 2 -- target/linux/bmips/dts/bcm6362.dtsi | 8 ++++---- target/linux/bmips/dts/bcm6368.dtsi | 4 ++-- 8 files changed, 18 insertions(+), 22 deletions(-) diff --git a/target/linux/bmips/dts/bcm63168-comtrend-vr-3032u.dts b/target/linux/bmips/dts/bcm63168-comtrend-vr-3032u.dts index 04904d9ef7..565a04160d 100644 --- a/target/linux/bmips/dts/bcm63168-comtrend-vr-3032u.dts +++ b/target/linux/bmips/dts/bcm63168-comtrend-vr-3032u.dts @@ -152,8 +152,6 @@ nandcs@0 { compatible = "brcm,nandcs"; - #size-cells = <1>; - #address-cells = <1>; reg = <0>; nand-ecc-step-size = <512>; nand-ecc-strength = <15>; diff --git a/target/linux/bmips/dts/bcm6318.dtsi b/target/linux/bmips/dts/bcm6318.dtsi index b8531ffc56..f5cfd77438 100644 --- a/target/linux/bmips/dts/bcm6318.dtsi +++ b/target/linux/bmips/dts/bcm6318.dtsi @@ -282,10 +282,10 @@ }; hsspi: spi@10003000 { - compatible = "brcm,bcm6328-hsspi"; - reg = <0x10003000 0x600>; #address-cells = <1>; #size-cells = <0>; + compatible = "brcm,bcm6328-hsspi"; + reg = <0x10003000 0x600>; interrupt-parent = <&periph_intc>; interrupts = ; diff --git a/target/linux/bmips/dts/bcm63268.dtsi b/target/linux/bmips/dts/bcm63268.dtsi index 08442ab99d..bf9998a552 100644 --- a/target/linux/bmips/dts/bcm63268.dtsi +++ b/target/linux/bmips/dts/bcm63268.dtsi @@ -311,11 +311,11 @@ }; nflash: nand@10000200 { + #address-cells = <1>; + #size-cells = <0>; compatible = "brcm,nand-bcm6368", "brcm,brcmnand-v4.0", "brcm,brcmnand"; - #address-cells = <1>; - #size-cells = <0>; reg = <0x10000200 0x180>, <0x10000600 0x200>, <0x100000b0 0x10>; @@ -336,10 +336,10 @@ }; lsspi: spi@10000800 { - compatible = "brcm,bcm6358-spi"; - reg = <0x10000800 0x70c>; #address-cells = <1>; #size-cells = <0>; + compatible = "brcm,bcm6358-spi"; + reg = <0x10000800 0x70c>; interrupt-parent = <&periph_intc>; interrupts = ; @@ -353,10 +353,10 @@ }; hsspi: spi@10001000 { - compatible = "brcm,bcm6328-hsspi"; - reg = <0x10001000 0x600>; #address-cells = <1>; #size-cells = <0>; + compatible = "brcm,bcm6328-hsspi"; + reg = <0x10001000 0x600>; interrupt-parent = <&periph_intc>; interrupts = ; diff --git a/target/linux/bmips/dts/bcm6328.dtsi b/target/linux/bmips/dts/bcm6328.dtsi index d139d6ec5d..aa90cc2a9b 100644 --- a/target/linux/bmips/dts/bcm6328.dtsi +++ b/target/linux/bmips/dts/bcm6328.dtsi @@ -299,10 +299,10 @@ }; hsspi: spi@10001000 { - compatible = "brcm,bcm6328-hsspi"; - reg = <0x10001000 0x600>; #address-cells = <1>; #size-cells = <0>; + compatible = "brcm,bcm6328-hsspi"; + reg = <0x10001000 0x600>; interrupt-parent = <&periph_intc>; interrupts = ; diff --git a/target/linux/bmips/dts/bcm6358.dtsi b/target/linux/bmips/dts/bcm6358.dtsi index bb08abf25b..c06001c62d 100644 --- a/target/linux/bmips/dts/bcm6358.dtsi +++ b/target/linux/bmips/dts/bcm6358.dtsi @@ -264,10 +264,10 @@ }; lsspi: spi@fffe0800 { - compatible = "brcm,bcm6358-spi"; - reg = <0xfffe0800 0x70c>; #address-cells = <1>; #size-cells = <0>; + compatible = "brcm,bcm6358-spi"; + reg = <0xfffe0800 0x70c>; interrupt-parent = <&periph_intc>; interrupts = ; diff --git a/target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts b/target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts index 05aedc61cc..ba4bd33c35 100644 --- a/target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts +++ b/target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts @@ -149,8 +149,6 @@ nandcs@0 { compatible = "brcm,nandcs"; - #size-cells = <1>; - #address-cells = <1>; reg = <0>; nand-ecc-step-size = <512>; nand-ecc-strength = <15>; diff --git a/target/linux/bmips/dts/bcm6362.dtsi b/target/linux/bmips/dts/bcm6362.dtsi index d7f9f910d3..f46074045c 100644 --- a/target/linux/bmips/dts/bcm6362.dtsi +++ b/target/linux/bmips/dts/bcm6362.dtsi @@ -371,10 +371,10 @@ }; lsspi: spi@10000800 { - compatible = "brcm,bcm6358-spi"; - reg = <0x10000800 0x70c>; #address-cells = <1>; #size-cells = <0>; + compatible = "brcm,bcm6358-spi"; + reg = <0x10000800 0x70c>; interrupt-parent = <&periph_intc>; interrupts = ; @@ -388,10 +388,10 @@ }; hsspi: spi@10001000 { - compatible = "brcm,bcm6328-hsspi"; - reg = <0x10001000 0x600>; #address-cells = <1>; #size-cells = <0>; + compatible = "brcm,bcm6328-hsspi"; + reg = <0x10001000 0x600>; interrupt-parent = <&periph_intc>; interrupts = ; diff --git a/target/linux/bmips/dts/bcm6368.dtsi b/target/linux/bmips/dts/bcm6368.dtsi index b812dea451..5aa2b82221 100644 --- a/target/linux/bmips/dts/bcm6368.dtsi +++ b/target/linux/bmips/dts/bcm6368.dtsi @@ -398,10 +398,10 @@ }; lsspi: spi@10000800 { - compatible = "brcm,bcm6358-spi"; - reg = <0x10000800 0x70c>; #address-cells = <1>; #size-cells = <0>; + compatible = "brcm,bcm6358-spi"; + reg = <0x10000800 0x70c>; interrupt-parent = <&periph_intc>; interrupts = ; From 12dbad1a86ebdbb4c9bd71b14eec245bc6373844 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Mon, 8 Mar 2021 10:46:06 +0100 Subject: [PATCH 08/18] gitignore: add .vscode for VS Code users MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For Visual Studio Code users, .vscode is created inside the workspace. Signed-off-by: Álvaro Fernández Rojas --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index b6bfe1a525..9647daa5a4 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,4 @@ git-src .project .cproject .ccache +.vscode From a48ef37747c935674806148e9b31e80b1abb0549 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gonz=C3=A1lez=20Cabanelas?= Date: Sat, 6 Mar 2021 19:59:19 +0100 Subject: [PATCH 09/18] bcm63xx: AD1018-nor: add NAND flash MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Sercomm AD1018 has a NAND flash. We recently added support for NANDs in this target. Use the internal NAND as additional storage. Signed-off-by: Daniel González Cabanelas --- .../dts/bcm6328-sercomm-ad1018-nor.dts | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/target/linux/bcm63xx/dts/bcm6328-sercomm-ad1018-nor.dts b/target/linux/bcm63xx/dts/bcm6328-sercomm-ad1018-nor.dts index 83f7578b06..5a9f52648e 100644 --- a/target/linux/bcm63xx/dts/bcm6328-sercomm-ad1018-nor.dts +++ b/target/linux/bcm63xx/dts/bcm6328-sercomm-ad1018-nor.dts @@ -146,6 +146,30 @@ }; }; +&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>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "storage"; + reg = <0 0>; /* autodetected size */ + }; + }; + }; +}; + &uart0 { status = "okay"; }; From a1289047235e7e88d5b217a5233359f073291c15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Mon, 8 Mar 2021 17:45:33 +0100 Subject: [PATCH 10/18] bmips: improve CPU frequency patch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes BCM6358 address and calculations. Signed-off-by: Álvaro Fernández Rojas --- ...-automatically-detect-CPU-frequency.patch} | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) rename target/linux/bmips/patches-5.10/{200-bmips-automatically-detect-CPU-frequency.patch => 200-mips-bmips-automatically-detect-CPU-frequency.patch} (90%) diff --git a/target/linux/bmips/patches-5.10/200-bmips-automatically-detect-CPU-frequency.patch b/target/linux/bmips/patches-5.10/200-mips-bmips-automatically-detect-CPU-frequency.patch similarity index 90% rename from target/linux/bmips/patches-5.10/200-bmips-automatically-detect-CPU-frequency.patch rename to target/linux/bmips/patches-5.10/200-mips-bmips-automatically-detect-CPU-frequency.patch index d68e4b97e8..2a3aac217f 100644 --- a/target/linux/bmips/patches-5.10/200-bmips-automatically-detect-CPU-frequency.patch +++ b/target/linux/bmips/patches-5.10/200-mips-bmips-automatically-detect-CPU-frequency.patch @@ -1,7 +1,7 @@ -From 38d5e4b3bcc25db14a2d5f428acf56dff862c97e Mon Sep 17 00:00:00 2001 +From 0377ad93031d3e51c2afe44231241185f684b6af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Fri, 5 Mar 2021 15:14:32 +0100 -Subject: [PATCH] bmips: automatically detect CPU frequency +Subject: [PATCH 1/2] mips: bmips: automatically detect CPU frequency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -10,10 +10,8 @@ Some BCM63xx SoCs support multiple CPU frequencies depending on HW config. Signed-off-by: Álvaro Fernández Rojas --- - arch/mips/bmips/setup.c | 197 +++++++++++++++++++++- - arch/mips/configs/bmips_bcm63xx_defconfig | 91 ++++++++++ - 2 files changed, 281 insertions(+), 7 deletions(-) - create mode 100644 arch/mips/configs/bmips_bcm63xx_defconfig + arch/mips/bmips/setup.c | 198 ++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 191 insertions(+), 7 deletions(-) --- a/arch/mips/bmips/setup.c +++ b/arch/mips/bmips/setup.c @@ -31,7 +29,7 @@ Signed-off-by: Álvaro Fernández Rojas +#define BCM6328_FCVO_SHIFT 7 +#define BCM6328_FCVO_MASK (0x1f << BCM6328_FCVO_SHIFT) + -+#define REG_BCM6358_DDR_PLLC ((void __iomem *)CKSEG1ADDR(0x100012b8)) ++#define REG_BCM6358_DDR_PLLC ((void __iomem *)0xfffe12b8) +#define BCM6358_PLLC_M1_SHIFT 0 +#define BCM6358_PLLC_M1_MASK (0xff << BCM6358_PLLC_M1_SHIFT) +#define BCM6358_PLLC_N1_SHIFT 23 @@ -69,7 +67,7 @@ Signed-off-by: Álvaro Fernández Rojas struct bmips_quirk { const char *compatible; void (*quirk_fn)(void); -@@ -138,17 +178,160 @@ const char *get_system_type(void) +@@ -138,17 +178,161 @@ const char *get_system_type(void) return "Generic BMIPS kernel"; } @@ -119,7 +117,7 @@ Signed-off-by: Álvaro Fernández Rojas + u32 val, n1, n2, m1; + + val = __raw_readl(REG_BCM6358_DDR_PLLC); -+ n1 = (val & BCM6358_PLLC_M1_MASK) >> BCM6358_PLLC_N1_SHIFT; ++ n1 = (val & BCM6358_PLLC_N1_MASK) >> BCM6358_PLLC_N1_SHIFT; + n2 = (val & BCM6358_PLLC_N2_MASK) >> BCM6358_PLLC_N2_SHIFT; + m1 = (val & BCM6358_PLLC_M1_MASK) >> BCM6358_PLLC_M1_SHIFT; + @@ -162,7 +160,7 @@ Signed-off-by: Álvaro Fernández Rojas + +static u32 bcm6368_cpufreq(void) +{ -+ unsigned int val, p1, p2, ndiv, m1; ++ u32 val, p1, p2, ndiv, m1; + + val = __raw_readl(REG_BCM6368_DDR_PLLC); + p1 = (val & BCM6368_PLLC_P1_MASK) >> BCM6368_PLLC_P1_SHIFT; @@ -223,6 +221,7 @@ Signed-off-by: Álvaro Fernández Rojas + cf->compatible)) { + freq = cf->cpu_freq() / 2; + printk("%s detected @ %u MHz\n", cf->compatible, freq / 500000); ++ break; + } + } + From 76d5677c7587d274041ef68e65328655573d122f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Mon, 8 Mar 2021 17:47:10 +0100 Subject: [PATCH 11/18] bmips: automatically detect RAM size MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Introduce new patch for automatically detecting RAM size. Some boards have a different amount of RAM depending on the HW revision. Therefore, automatically detecting the RAM size instead of hard-coding it will reduce the number of device definitions. Signed-off-by: Álvaro Fernández Rojas --- .../bmips/dts/bcm63168-comtrend-vr-3032u.dts | 5 - .../bmips/dts/bcm6318-comtrend-ar-5315u.dts | 5 - .../bmips/dts/bcm6328-comtrend-ar-5387un.dts | 5 - .../bmips/dts/bcm6358-huawei-hg556a-b.dts | 5 - .../bmips/dts/bcm6362-netgear-dgnd3700-v2.dts | 5 - .../bmips/dts/bcm6368-comtrend-vr-3025u.dts | 5 - ...-bmips-automatically-detect-RAM-size.patch | 196 ++++++++++++++++++ 7 files changed, 196 insertions(+), 30 deletions(-) create mode 100644 target/linux/bmips/patches-5.10/201-mips-bmips-automatically-detect-RAM-size.patch diff --git a/target/linux/bmips/dts/bcm63168-comtrend-vr-3032u.dts b/target/linux/bmips/dts/bcm63168-comtrend-vr-3032u.dts index 565a04160d..ed7f51890c 100644 --- a/target/linux/bmips/dts/bcm63168-comtrend-vr-3032u.dts +++ b/target/linux/bmips/dts/bcm63168-comtrend-vr-3032u.dts @@ -15,11 +15,6 @@ led-usb = &led_usb_green; }; - memory@0 { - device_type = "memory"; - reg = <0x00000000 0x04000000>; - }; - keys { compatible = "gpio-keys-polled"; poll-interval = <20>; diff --git a/target/linux/bmips/dts/bcm6318-comtrend-ar-5315u.dts b/target/linux/bmips/dts/bcm6318-comtrend-ar-5315u.dts index be21e7f262..35c74fd3ac 100644 --- a/target/linux/bmips/dts/bcm6318-comtrend-ar-5315u.dts +++ b/target/linux/bmips/dts/bcm6318-comtrend-ar-5315u.dts @@ -13,11 +13,6 @@ led-upgrade = &led_power_green; }; - memory@0 { - device_type = "memory"; - reg = <0x00000000 0x04000000>; - }; - keys { compatible = "gpio-keys-polled"; poll-interval = <20>; diff --git a/target/linux/bmips/dts/bcm6328-comtrend-ar-5387un.dts b/target/linux/bmips/dts/bcm6328-comtrend-ar-5387un.dts index a099809396..a3192dffa4 100644 --- a/target/linux/bmips/dts/bcm6328-comtrend-ar-5387un.dts +++ b/target/linux/bmips/dts/bcm6328-comtrend-ar-5387un.dts @@ -13,11 +13,6 @@ led-upgrade = &led_power_green; }; - memory@0 { - device_type = "memory"; - reg = <0x00000000 0x04000000>; - }; - keys { compatible = "gpio-keys-polled"; poll-interval = <20>; diff --git a/target/linux/bmips/dts/bcm6358-huawei-hg556a-b.dts b/target/linux/bmips/dts/bcm6358-huawei-hg556a-b.dts index f62c79fccb..ba776caf78 100644 --- a/target/linux/bmips/dts/bcm6358-huawei-hg556a-b.dts +++ b/target/linux/bmips/dts/bcm6358-huawei-hg556a-b.dts @@ -17,11 +17,6 @@ led-usb = &hspa_red; }; - memory@0 { - device_type = "memory"; - reg = <0x00000000 0x04000000>; - }; - keys { compatible = "gpio-keys-polled"; poll-interval = <20>; diff --git a/target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts b/target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts index ba4bd33c35..4da673cafa 100644 --- a/target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts +++ b/target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts @@ -17,11 +17,6 @@ led-usb2 = &led_usb2_green; }; - memory@0 { - device_type = "memory"; - reg = <0x00000000 0x04000000>; - }; - keys { compatible = "gpio-keys-polled"; poll-interval = <20>; diff --git a/target/linux/bmips/dts/bcm6368-comtrend-vr-3025u.dts b/target/linux/bmips/dts/bcm6368-comtrend-vr-3025u.dts index 3a80dcda97..683b01875e 100644 --- a/target/linux/bmips/dts/bcm6368-comtrend-vr-3025u.dts +++ b/target/linux/bmips/dts/bcm6368-comtrend-vr-3025u.dts @@ -13,11 +13,6 @@ led-upgrade = &led_power_green; }; - memory@0 { - device_type = "memory"; - reg = <0x00000000 0x04000000>; - }; - keys { compatible = "gpio-keys-polled"; poll-interval = <20>; diff --git a/target/linux/bmips/patches-5.10/201-mips-bmips-automatically-detect-RAM-size.patch b/target/linux/bmips/patches-5.10/201-mips-bmips-automatically-detect-RAM-size.patch new file mode 100644 index 0000000000..11459ad58f --- /dev/null +++ b/target/linux/bmips/patches-5.10/201-mips-bmips-automatically-detect-RAM-size.patch @@ -0,0 +1,196 @@ +From f9ee3f28ecb979c77423be965ef9dd313bdb9e9b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= +Date: Mon, 8 Mar 2021 16:58:34 +0100 +Subject: [PATCH 2/2] mips: bmips: automatically detect RAM size +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Some devices have different amounts of RAM installed depending on HW revision. + +Signed-off-by: Álvaro Fernández Rojas +--- + arch/mips/bmips/setup.c | 118 ++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 118 insertions(+) + +--- a/arch/mips/bmips/setup.c ++++ b/arch/mips/bmips/setup.c +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -34,13 +35,16 @@ + #define REG_BCM6318_SOB ((void __iomem *)CKSEG1ADDR(0x10000900)) + #define BCM6318_FREQ_SHIFT 23 + #define BCM6318_FREQ_MASK (0x3 << BCM6318_FREQ_SHIFT) ++#define BCM6318_SDRAM_ADDR ((void __iomem *)CKSEG1ADDR(0x10004000)) + + #define REG_BCM6328_OTP ((void __iomem *)CKSEG1ADDR(0x1000062c)) + #define BCM6328_TP1_DISABLED BIT(9) + #define REG_BCM6328_MISC_SB ((void __iomem *)CKSEG1ADDR(0x10001a40)) + #define BCM6328_FCVO_SHIFT 7 + #define BCM6328_FCVO_MASK (0x1f << BCM6328_FCVO_SHIFT) ++#define BCM6328_MEMC_ADDR ((void __iomem *)CKSEG1ADDR(0x10003000)) + ++#define BCM6358_MEMC_ADDR ((void __iomem *)0xfffe1200) + #define REG_BCM6358_DDR_PLLC ((void __iomem *)0xfffe12b8) + #define BCM6358_PLLC_M1_SHIFT 0 + #define BCM6358_PLLC_M1_MASK (0xff << BCM6358_PLLC_M1_SHIFT) +@@ -52,7 +56,9 @@ + #define REG_BCM6362_MISC_SB ((void __iomem *)CKSEG1ADDR(0x10001814)) + #define BCM6362_FCVO_SHIFT 1 + #define BCM6362_FCVO_MASK (0x1f << BCM6362_FCVO_SHIFT) ++#define BCM6362_MEMC_ADDR ((void __iomem *)CKSEG1ADDR(0x10003000)) + ++#define BCM6368_MEMC_ADDR ((void __iomem *)CKSEG1ADDR(0x10001200)) + #define REG_BCM6368_DDR_PLLC ((void __iomem *)CKSEG1ADDR(0x100012a0)) + #define BCM6368_PLLC_P1_SHIFT 0 + #define BCM6368_PLLC_P1_MASK (0xf << BCM6368_PLLC_P1_SHIFT) +@@ -67,7 +73,21 @@ + #define REG_BCM63268_MISC_SB ((void __iomem *)CKSEG1ADDR(0x10001814)) + #define BCM63268_FCVO_SHIFT 21 + #define BCM63268_FCVO_MASK (0xf << BCM63268_FCVO_SHIFT) ++#define BCM63268_MEMC_ADDR ((void __iomem *)CKSEG1ADDR(0x10003000)) + ++#define SDRAM_CFG_REG 0x0 ++#define SDRAM_SPACE_SHIFT 4 ++#define SDRAM_SPACE_MASK (0xf << SDRAM_SPACE_SHIFT) ++ ++#define MEMC_CFG_REG 0x4 ++#define MEMC_CFG_32B_SHIFT 1 ++#define MEMC_CFG_32B_MASK (1 << MEMC_CFG_32B_SHIFT) ++#define MEMC_CFG_COL_SHIFT 3 ++#define MEMC_CFG_COL_MASK (0x3 << MEMC_CFG_COL_SHIFT) ++#define MEMC_CFG_ROW_SHIFT 6 ++#define MEMC_CFG_ROW_MASK (0x3 << MEMC_CFG_ROW_SHIFT) ++ ++#define DDR_CSEND_REG 0x8 + + static const unsigned long kbase = VMLINUX_LOAD_ADDRESS & 0xfff00000; + +@@ -76,6 +96,11 @@ struct bmips_cpufreq { + u32 (*cpu_freq)(void); + }; + ++struct bmips_memsize { ++ const char *compatible; ++ phys_addr_t (*mem_size)(void); ++}; ++ + struct bmips_quirk { + const char *compatible; + void (*quirk_fn)(void); +@@ -337,9 +362,90 @@ void __init plat_time_init(void) + mips_hpt_frequency = freq; + } + ++static inline phys_addr_t bmips_dram_size(unsigned int cols, ++ unsigned int rows, ++ unsigned int is_32b, ++ unsigned int banks) ++{ ++ rows += 11; /* 0 => 11 address bits ... 2 => 13 address bits */ ++ cols += 8; /* 0 => 8 address bits ... 2 => 10 address bits */ ++ is_32b += 1; ++ ++ return 1 << (cols + rows + is_32b + banks); ++} ++ ++static phys_addr_t _bcm6318_memsize(void __iomem *addr) ++{ ++ u32 val; ++ ++ val = __raw_readl(addr + SDRAM_CFG_REG); ++ val = (val & SDRAM_SPACE_MASK) >> SDRAM_SPACE_SHIFT; ++ ++ return (1 << (val + 20)); ++} ++ ++static phys_addr_t _bcm6328_memsize(void __iomem *addr) ++{ ++ return __raw_readl(addr + DDR_CSEND_REG) << 24; ++} ++ ++static phys_addr_t _bcm6358_memsize(void __iomem *addr) ++{ ++ unsigned int cols, rows, is_32b; ++ u32 val; ++ ++ val = __raw_readl(addr + MEMC_CFG_REG); ++ rows = (val & MEMC_CFG_ROW_MASK) >> MEMC_CFG_ROW_SHIFT; ++ cols = (val & MEMC_CFG_COL_MASK) >> MEMC_CFG_COL_SHIFT; ++ is_32b = (val & MEMC_CFG_32B_MASK) ? 0 : 1; ++ ++ return bmips_dram_size(cols, rows, is_32b, 2); ++} ++ ++static phys_addr_t bcm6318_memsize(void) ++{ ++ return _bcm6318_memsize(BCM6318_SDRAM_ADDR); ++} ++ ++static phys_addr_t bcm6328_memsize(void) ++{ ++ return _bcm6328_memsize(BCM6328_MEMC_ADDR); ++} ++ ++static phys_addr_t bcm6358_memsize(void) ++{ ++ return _bcm6358_memsize(BCM6358_MEMC_ADDR); ++} ++ ++static phys_addr_t bcm6362_memsize(void) ++{ ++ return _bcm6328_memsize(BCM6362_MEMC_ADDR); ++} ++ ++static phys_addr_t bcm6368_memsize(void) ++{ ++ return _bcm6358_memsize(BCM6368_MEMC_ADDR); ++} ++ ++static phys_addr_t bcm63268_memsize(void) ++{ ++ return _bcm6328_memsize(BCM63268_MEMC_ADDR); ++} ++ ++static const struct bmips_memsize bmips_memsize_list[] = { ++ { "brcm,bcm6318", &bcm6318_memsize }, ++ { "brcm,bcm6328", &bcm6328_memsize }, ++ { "brcm,bcm6358", &bcm6358_memsize }, ++ { "brcm,bcm6362", &bcm6362_memsize }, ++ { "brcm,bcm6368", &bcm6368_memsize }, ++ { "brcm,bcm63268", &bcm63268_memsize }, ++ { /* sentinel */ } ++}; ++ + void __init plat_mem_setup(void) + { + void *dtb; ++ const struct bmips_memsize *ms; + const struct bmips_quirk *q; + + set_io_port_base(0); +@@ -358,6 +464,18 @@ void __init plat_mem_setup(void) + + __dt_setup_arch(dtb); + ++ for (ms = bmips_memsize_list; ms->mem_size; ms++) { ++ if (of_flat_dt_is_compatible(of_get_flat_dt_root(), ++ ms->compatible)) { ++ phys_addr_t mem = ms->mem_size(); ++ if (mem) { ++ memblock_add(0, mem); ++ printk("%uMB of RAM installed\n", mem >> 20); ++ break; ++ } ++ } ++ } ++ + for (q = bmips_quirk_list; q->quirk_fn; q++) { + if (of_flat_dt_is_compatible(of_get_flat_dt_root(), + q->compatible)) { From 2a1bdde0d05dd97aa58da546d15197409d481bb3 Mon Sep 17 00:00:00 2001 From: Dominick Grift Date: Sat, 6 Mar 2021 21:02:36 +0100 Subject: [PATCH 12/18] libsepol: update to version 3.2 a9e0004f libsepol: invalidate the pointer to the policydb if policydb_init fails 6238e025 libsepol/cil: fix NULL pointer dereference in cil_fill_ipaddr b69d77bc libsepol/cil: handle SID without assigned context when writing policy.conf 0861c659 libsepol: Validate policydb values when reading binary policy 8f5409cf libsepol: Create function ebitmap_highest_set_bit() 0451adeb libsepol/cil: Destroy disabled optional blocks after pass is complete 32f8ed3d libsepol/cil: introduce intermediate cast to silence -Wvoid-pointer-to-enum-cast 4662bdc1 libsepol/cil: be more robust when encountering 6b561058 libsepol/cil: fix NULL pointer dereference with empty macro argument 0d0e47c7 libsepol/cil: Fix integer overflow in the handling of hll line marks 1b36ace2 libsepol: include header files in source files when matching declarations 1f1fa9d4 libsepol: uniformize prototypes of sepol_mls_contains and sepol_mls_check 72a88d75 libsepol: remove unused files eba0ffee libsepol/cil: Fix heap-use-after-free when using optional blockinherit 1048f8d3 libsepol/cil: unlink blockinherit->block link when destroying a block b3202918 libsepol/cil: fix memory leak when a constraint expression is too deep f0d98f83 libsepol/cil: Fix heap-use-after-free in __class_reset_perm_values() 5d021d66 libsepol/cil: Update symtab nprim field when adding or removing datums 34bd9a9d libsepol: destroy filename_trans list properly bdf4e332 libsepol/cil: fix NULL pointer dereference when parsing an improper integer b7ea65f5 libsepol/cil: destroy perm_datums when __cil_resolve_perms fails 228c06d9 libsepol/cil: fix out-of-bound read in cil_print_recursive_blockinherit a25d9104 libsepol/cil: constify some strings e2d01842 libsepol/cil: propagate failure of cil_fill_list() 6c8fca10 libsepol/cil: do not add a stack variable to a list 38a09b74 libsepol/cil: fix NULL pointer dereference when using an unused alias 3c357285 libsepol/cil: remove useless print statement 90809674 libsepol/cil: always destroy the lexer state d16a1e46 libsepol/cil: Use the macro FLAVOR() whenever possible 2aac859a libsepol/cil: Use the macro NODE() whenever possible d317b470 libsepol/cil: Remove unnecessary assignment in cil_resolve_name_keep_aliases() 9b9761cf libsepol/cil: Remove unused field from struct cil_args_resolve e257d4c7 libsepol/cil: Get rid of unnecessary check in cil_gen_node() ebba2b00 libsepol/cil: cil_tree_walk() helpers should use CIL_TREE_SKIP_* 89dab467 libsepol: free memory when realloc() fails 2d353bd5 libsepol/cil: Give error for more than one true or false block 4a142ac4 libsepol: Bump libsepol.so version 506c7b95 libsepol: Drop deprecated functions ae58e84b libsepol: Get rid of the old and duplicated symbols c97d63c6 libsepol: silence potential NULL pointer dereference warning 64387cb3 libsepol: drop confusing BUG_ON macro 521e6a2f libsepol/cil: fix signed overflow caused by using (1 << 31) - 1 a152653b libsepol/cil: Fix neverallow checking involving classmaps 734e4beb libsepol/cil: Validate conditional expressions before adding to binary policy 685f577a libsepol/cil: Validate constraint expressions before adding to binary policy 8206b8cb libsepol: implement POLICYDB_VERSION_COMP_FTRANS 42ae834a libsepol,checkpolicy: optimize storage of filename transitions Signed-off-by: Dominick Grift --- package/libs/libsepol/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/libs/libsepol/Makefile b/package/libs/libsepol/Makefile index 8ceb7164a7..c7950a9ba0 100644 --- a/package/libs/libsepol/Makefile +++ b/package/libs/libsepol/Makefile @@ -6,12 +6,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libsepol -PKG_VERSION:=3.1 +PKG_VERSION:=3.2 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=https://github.com/SELinuxProject/selinux/releases/download/20200710 -PKG_HASH:=ae6778d01443fdd38cd30eeee846494e19f4d407b09872580372f4aa4bf8a3cc +PKG_SOURCE_URL:=https://github.com/SELinuxProject/selinux/releases/download/3.2 +PKG_HASH:=dfc7f662af8000116e56a01de6a0394ed79be1b34b999e551346233c5dd19508 PKG_MAINTAINER:=Thomas Petazzoni From b1fc2b5b0be61d994d6a0429fd78331c0c57639a Mon Sep 17 00:00:00 2001 From: Dominick Grift Date: Sat, 6 Mar 2021 21:02:37 +0100 Subject: [PATCH 13/18] libselinux: update to version 3.2 142826a3 libselinux: fix segfault in add_xattr_entry() 398d2cee libselinux: rename gettid() to something which never conflicts with the libc 8f0f0a28 selinux(8,5): Describe fcontext regular expressions 9cc6b5cf libselinux/getconlist: report failures 156dd0de libselinux: update getseuser e2dca5df libselinux: accept const fromcon in get_context API da4829d0 libselinux: Always close status page fd 45b15c22 selinux(8): explain that runtime disable is deprecated 3c16aaef selinux(8): mark up SELINUX values c2a58cc5 libselinux: LABEL_BACKEND_ANDROID add option to enable db0f2f38 libselinux: Add build option to disable X11 backend 4a142ac4 libsepol: Bump libsepol.so version d23342a9 libselinux: convert matchpathcon to selabel_lookup() 7ef5b185 libselinux: Change userspace AVC setenforce and policy load messages to audit format. f5d644c7 libselinux: Add additional log callback details in man page for auditing. 075f9cfe libselinux: Fix selabel_lookup() for the root dir. a4149e0e libselinux: Add new log callback levels for enforcing and policy load notices. a63f93d8 libselinux: initialize last_policyload in selinux_status_open() ef902db9 libselinux: safely access shared memory in selinux_status_updated() 9e4480b9 libselinux: Remove trailing slash on selabel_file lookups. 21fb5f20 libselinux: use full argument specifiers for security_check_context in man page e7abd802 libselinux: fix build order 05bdc031 libselinux: use kernel status page by default Signed-off-by: Dominick Grift --- package/libs/libselinux/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/libs/libselinux/Makefile b/package/libs/libselinux/Makefile index 5fe745d004..0c5f9baceb 100644 --- a/package/libs/libselinux/Makefile +++ b/package/libs/libselinux/Makefile @@ -6,12 +6,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libselinux -PKG_VERSION:=3.1 -PKG_RELEASE:=3 +PKG_VERSION:=3.2 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=https://github.com/SELinuxProject/selinux/releases/download/20200710 -PKG_HASH:=ea5dcbb4d859e3f999c26a13c630da2f16dff9462e3cc8cb7b458ac157d112e7 +PKG_SOURCE_URL:=https://github.com/SELinuxProject/selinux/releases/download/3.2 +PKG_HASH:=df758ef1d9d4811051dd901ea6b029ae334ffd7c671c128beb16bce1e25ac161 HOST_BUILD_DEPENDS:=libsepol/host pcre/host PKG_LICENSE:=libselinux-1.0 From 4670492ad72e54e0608ef5f92d7066c1c7fa8f45 Mon Sep 17 00:00:00 2001 From: Dominick Grift Date: Sat, 6 Mar 2021 21:02:38 +0100 Subject: [PATCH 14/18] libsemanage: update to version 3.2 c35919a7 libsemanage: sync filesystem with sandbox 5b05e829 Revert "libsemanage/genhomedircon: check usepasswd" edae9275 libsemanage: Free contents of modkey in semanage_direct_remove ce46daab libsemanage/genhomedircon: check usepasswd 6ebb35d2 libsemanage: Bump libsemanage.so version c08b73d7 libsemanage: Drop deprecated functions b46406de libsemanage: Remove legacy and duplicate symbols Signed-off-by: Dominick Grift --- package/libs/libsemanage/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/libs/libsemanage/Makefile b/package/libs/libsemanage/Makefile index 79b492d0d3..ff1519f14e 100644 --- a/package/libs/libsemanage/Makefile +++ b/package/libs/libsemanage/Makefile @@ -6,12 +6,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libsemanage -PKG_VERSION:=3.1 +PKG_VERSION:=3.2 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=https://github.com/SELinuxProject/selinux/releases/download/20200710 -PKG_HASH:=22d6c75526e40d1781c30bcf29abf97171bdfe6780923f11c8e1c76a75a21ff8 +PKG_SOURCE_URL:=https://github.com/SELinuxProject/selinux/releases/download/3.2 +PKG_HASH:=d722a55ca4fe2d4e2b30527720db657e6238b28079e69e2e4affeb8e733ee511 PKG_MAINTAINER:=Thomas Petazzoni PKG_LICENSE:=LGPL-2.1 PKG_LICENSE_FILES:=COPYING From 68934a5704be61e952c6ce04573bb54577b26680 Mon Sep 17 00:00:00 2001 From: Dominick Grift Date: Sat, 6 Mar 2021 21:02:39 +0100 Subject: [PATCH 15/18] policycoreutils: update to version 3.2 d464187c policycoreutils: sestatus belongs to bin not sbin d59932a7 policycoreutils: Resolve path in restorecon_xattr 5682c0d5 policycoreutils/fixfiles.8: add missing file systems and merge check and verify 57dd1f65 policycoreutils/setfiles: Drop unused nerr variable be7f54cb setfiles: drop ABORT_ON_ERRORS and related code 9207823c setfiles: Do not abort on labeling error c064d214 selinux_config(5): add a note that runtime disable is deprecated 8bc865e1 newrole: support cross-compilation with PAM and audit ba2d6c10 fixfiles: correctly restore context of mountpoints Signed-off-by: Dominick Grift --- package/utils/policycoreutils/Makefile | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/package/utils/policycoreutils/Makefile b/package/utils/policycoreutils/Makefile index ec55a3d8ee..249c2afb94 100644 --- a/package/utils/policycoreutils/Makefile +++ b/package/utils/policycoreutils/Makefile @@ -6,12 +6,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=policycoreutils -PKG_VERSION:=3.1 -PKG_RELEASE:=5 +PKG_VERSION:=3.2 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=https://github.com/SELinuxProject/selinux/releases/download/20200710 -PKG_HASH:=c889f62ee80f8b6a369469a9b8af51f5b797975aeaa291f5c5960cc12eed1934 +PKG_SOURCE_URL:=https://github.com/SELinuxProject/selinux/releases/download/3.2 +PKG_HASH:=d1331c6fa766c547b071c491de90b9f343c8dbffdb119be8a5a7e491199b93a9 PKG_INSTALL:=1 HOST_BUILD_DEPENDS:=libsemanage/host gettext-full/host PKG_BUILD_DEPENDS:=BUSYBOX_CONFIG_PAM:libpam gettext-full/host @@ -27,11 +27,11 @@ include $(INCLUDE_DIR)/host-build.mk DIR_USR_BIN:= \ newrole \ - secon + secon \ + sestatus DIR_USR_SBIN:= \ load_policy \ - sestatus \ setsebool LIBEXEC_UTILS := \ @@ -43,7 +43,8 @@ SBIN_UTILS:= \ USR_BIN_UTILS:= \ newrole \ - secon + secon \ + sestatus USR_SBIN_UTILS:= \ fixfiles \ @@ -52,7 +53,6 @@ USR_SBIN_UTILS:= \ run_init \ semodule \ load_policy \ - sestatus \ setsebool TARGET_LDFLAGS += $(INTL_LDFLAGS) $(if $(INTL_FULL),-lintl) From 0b58ebcfe215c2456b752042e80268fe1ec6173a Mon Sep 17 00:00:00 2001 From: Dominick Grift Date: Sat, 6 Mar 2021 21:02:40 +0100 Subject: [PATCH 16/18] secilc: update to version 3.2 49ff851c secilc: fixes cil_role_statements.md example 03881703 secilc/docs: add custom color theme 4c8d6094 secilc/docs: add syntax highlighting for secil 057d72af secilc/docs: use fenced code blocks for cil examples e8bcdb84 cil_network_labeling_statements: fixes nodecon examples eefa5511 cil_access_vector_rules: allowx, auditallowx and dontauditx fixes 9e9b8103 secilc/docs: document expandtypeattribute fbe1e526 Update the cil docs to match the current behaviour. Signed-off-by: Dominick Grift --- package/utils/secilc/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/utils/secilc/Makefile b/package/utils/secilc/Makefile index 26c20f9213..7ed22615c0 100644 --- a/package/utils/secilc/Makefile +++ b/package/utils/secilc/Makefile @@ -6,12 +6,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=secilc -PKG_VERSION:=3.1 +PKG_VERSION:=3.2 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=https://github.com/SELinuxProject/selinux/releases/download/20200710 -PKG_HASH:=86117246fec3017af710a9ff7c1dae3ed1cd571e232a86cff3e2a3de2d6aa65c +PKG_SOURCE_URL:=https://github.com/SELinuxProject/selinux/releases/download/3.2 +PKG_HASH:=5f6e6528a281b29ac5e558babffc3d8aab682fd8df8977daff5f266a50292cc3 HOST_BUILD_DEPENDS:=libsepol/host PKG_MAINTAINER:=Dominick Grift From 49edc4d17f241bca2a566dfdee0a64538b046cd7 Mon Sep 17 00:00:00 2001 From: Dominick Grift Date: Sat, 6 Mar 2021 21:02:41 +0100 Subject: [PATCH 17/18] checkpolicy: update to version 3.2 521e6a2f libsepol/cil: fix signed overflow caused by using (1 << 31) - 1 42ae834a libsepol,checkpolicy: optimize storage of filename transitions Signed-off-by: Dominick Grift --- package/utils/checkpolicy/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/utils/checkpolicy/Makefile b/package/utils/checkpolicy/Makefile index 8def9ea65d..206bf201c0 100644 --- a/package/utils/checkpolicy/Makefile +++ b/package/utils/checkpolicy/Makefile @@ -6,12 +6,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=checkpolicy -PKG_VERSION:=3.1 +PKG_VERSION:=3.2 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=https://github.com/SELinuxProject/selinux/releases/download/20200710 -PKG_HASH:=dfc7707070520c93b14fbbdfdbe081364d806bf28e3e79e10318c2594c77bbb2 +PKG_SOURCE_URL:=https://github.com/SELinuxProject/selinux/releases/download/3.2 +PKG_HASH:=9b1c81fa86fe3867842164448d90c8e7ea94b2987497809c65d4caa87a5c5bc8 PKG_INSTALL:=1 PKG_BUILD_DEPENDS:=libselinux HOST_BUILD_DEPENDS:=libselinux/host From bff84f3e8ec6fbeeeb609b2d1fe28300c4c7c6ee Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 8 Mar 2021 21:27:07 +0000 Subject: [PATCH 18/18] arm-trusted-firmware-mediatek: fix typo SPI-SNAND -> SPI-NAND Signed-off-by: Daniel Golle --- package/boot/arm-trusted-firmware-mediatek/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/boot/arm-trusted-firmware-mediatek/Makefile b/package/boot/arm-trusted-firmware-mediatek/Makefile index 1dc1dbc189..9ec69db09d 100644 --- a/package/boot/arm-trusted-firmware-mediatek/Makefile +++ b/package/boot/arm-trusted-firmware-mediatek/Makefile @@ -48,7 +48,7 @@ define Trusted-Firmware-A/mt7622-snand-1ddr endef define Trusted-Firmware-A/mt7622-snand-2ddr - NAME:=MediaTek MT7622 (SPI-SNAND, 2x DDR3) + NAME:=MediaTek MT7622 (SPI-NAND, 2x DDR3) BOOT_DEVICE:=snand DDR3_FLYBY:=1 endef