diff --git a/target/linux/mpc85xx/base-files/etc/board.d/01_leds b/target/linux/mpc85xx/base-files/etc/board.d/01_leds index 7e1d379efe..6b4faf7697 100644 --- a/target/linux/mpc85xx/base-files/etc/board.d/01_leds +++ b/target/linux/mpc85xx/base-files/etc/board.d/01_leds @@ -16,6 +16,9 @@ extreme-networks,ws-ap3825i) ucidef_set_led_netdev "lan1" "LAN1" "green:lan1" "eth1" ucidef_set_led_netdev "lan2" "LAN2" "green:lan2" "eth0" ;; +hpe,msm460) + ucidef_set_led_netdev "lan" "LAN" "green:lan" "eth0" + ;; esac board_config_flush diff --git a/target/linux/mpc85xx/base-files/etc/board.d/02_network b/target/linux/mpc85xx/base-files/etc/board.d/02_network index 41859362b5..caf00ef414 100644 --- a/target/linux/mpc85xx/base-files/etc/board.d/02_network +++ b/target/linux/mpc85xx/base-files/etc/board.d/02_network @@ -16,6 +16,9 @@ aerohive,hiveap-330|\ enterasys,ws-ap3715i) ucidef_set_interfaces_lan_wan "eth1" "eth0" ;; +hpe,msm460) + ucidef_set_interface_lan "eth0" + ;; ocedo,panda) ucidef_set_interface_wan "eth1" ucidef_add_switch "switch0" \ diff --git a/target/linux/mpc85xx/base-files/etc/hotplug.d/ieee80211/10-fix-wifi-mac b/target/linux/mpc85xx/base-files/etc/hotplug.d/ieee80211/10-fix-wifi-mac index 20ad8eb44f..0e27dfb8cc 100644 --- a/target/linux/mpc85xx/base-files/etc/hotplug.d/ieee80211/10-fix-wifi-mac +++ b/target/linux/mpc85xx/base-files/etc/hotplug.d/ieee80211/10-fix-wifi-mac @@ -20,6 +20,11 @@ enterasys,ws-ap3710i|\ extreme-networks,ws-ap3825i) mtd_get_mac_ascii cfg2 RADIOADDR${PHYNBR} > /sys${DEVPATH}/macaddress ;; +hpe,msm460) + wifi_mac=$(mtd_get_mac_binary colubris-bid 0x1f9bd) + [ "$PHYNBR" -eq 0 ] && echo "$wifi_mac" > /sys${DEVPATH}/macaddress + [ "$PHYNBR" -eq 1 ] && echo "$(macaddr_add $wifi_mac 16)" > /sys${DEVPATH}/macaddress + ;; ocedo,panda) mtd_get_mac_ascii uboot-env0 wmac$(($PHYNBR + 1)) > /sys${DEVPATH}/macaddress ;; diff --git a/target/linux/mpc85xx/base-files/lib/upgrade/platform.sh b/target/linux/mpc85xx/base-files/lib/upgrade/platform.sh index 226b40a906..5d111676ae 100755 --- a/target/linux/mpc85xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/mpc85xx/base-files/lib/upgrade/platform.sh @@ -13,6 +13,7 @@ platform_do_upgrade() { local board=$(board_name) case "$board" in + hpe,msm460|\ ocedo,panda|\ sophos,red-15w-rev1|\ watchguard,firebox-t10) diff --git a/target/linux/mpc85xx/config-6.1 b/target/linux/mpc85xx/config-6.1 index c3e0414a78..c017422714 100644 --- a/target/linux/mpc85xx/config-6.1 +++ b/target/linux/mpc85xx/config-6.1 @@ -150,6 +150,7 @@ CONFIG_MPIC=y # CONFIG_MPIC_MSGR is not set CONFIG_MPIC_TIMER=y CONFIG_MPILIB=y +# CONFIG_MSM460 is not set # CONFIG_MTD_CFI is not set CONFIG_MTD_NAND_CORE=y CONFIG_MTD_NAND_ECC=y diff --git a/target/linux/mpc85xx/config-6.6 b/target/linux/mpc85xx/config-6.6 index 34ff126851..ef08a51979 100644 --- a/target/linux/mpc85xx/config-6.6 +++ b/target/linux/mpc85xx/config-6.6 @@ -158,6 +158,7 @@ CONFIG_MPIC=y # CONFIG_MPIC_MSGR is not set CONFIG_MPIC_TIMER=y CONFIG_MPILIB=y +# CONFIG_MSM460 is not set # CONFIG_MTD_CFI is not set CONFIG_MTD_NAND_CORE=y CONFIG_MTD_NAND_ECC=y diff --git a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/msm460.dts b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/msm460.dts new file mode 100644 index 0000000000..46f8e514c9 --- /dev/null +++ b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/msm460.dts @@ -0,0 +1,239 @@ +// SPDX-License-Identifier: GPL-2.0-or-later or MIT + +#include +#include +#include + +/include/ "fsl/p1020si-pre.dtsi" +/ { + model = "Hewlett-Packard MSM460"; + compatible = "hpe,msm460"; + + aliases { + led-boot = &system_green; + led-failsafe = &system_green; + led-running = &system_green; + led-upgrade = &system_green; + label-mac-device = &enet0; + }; + + chosen { + /* Needed for initramfs */ + bootargs-override = "console=ttyS0,115200 ubi.mtd=5,2048"; + stdout-path = &serial0; + }; + + memory { + device_type = "memory"; + }; + + lbc: localbus@ffe05000 { + reg = <0 0xffe05000 0 0x1000>; + ranges = <0x0 0x0 0x0 0xec000000 0x04000000 + 0x1 0x0 0x0 0xff800000 0x00040000 + 0x2 0x0 0x0 0xffa00000 0x00020000 + 0x3 0x0 0x0 0xffb00000 0x00020000>; + + nand@1,0 { + compatible = "fsl,p1020-fcm-nand", "fsl,elbc-fcm-nand"; + reg = <0x1 0x0 0x40000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + reg = <0x0 0xc0000>; + label = "u-boot"; + read-only; + }; + + partition@c0000 { + reg = <0xc0000 0x40000>; + label = "colubris-bid"; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_hwinfo_1f822: macaddr@1f822 { + /* ETH */ + compatible = "mac-base"; + reg = <0x1f822 0x6>; + #nvmem-cell-cells = <1>; + }; + + macaddr_hwinfo_1f9bd: macaddr@1f9bd { + /* WLAN */ + compatible = "mac-base"; + reg = <0x1f9bd 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + }; + + /* uenv{0,1} and ubi occupy kernel and slash partitions */ + + partition@100000 { + reg = <0x100000 0x80000>; + label = "uboot-env0"; + }; + + partition@180000 { + reg = <0x180000 0x80000>; + label = "uboot-env1"; + }; + + partition@200000 { + reg = <0x200000 0x300000>; + label = "reserved"; + }; + + partition@500000 { + reg = <0x500000 0x5f00000>; + label = "ubi"; + }; + + partition@6500000 { + reg = <0x6500000 0x400000>; + label = "pool"; + read-only; + }; + + partition@6900000 { + reg = <0x6900000 0x15e0000>; + label = "flash"; + read-only; + }; + + partition@7ee0000 { + reg = <0x7ee0000 0x20000>; + label = "pf"; + read-only; + }; + + /* BBT is at the end of the flash - 100000@7f00000 */ + }; + }; + }; + + soc: soc@ffe00000 { + ranges = <0x0 0x0 0xffe00000 0x100000>; + + i2c@3000 { + status = "disabled"; + }; + + gpio0: gpio-controller@fc00 { + }; + + mdio@24000 { + phy0: ethernet-phy@0 { + reg = <0x0>; + reset-gpios = <&gpio0 4 GPIO_ACTIVE_LOW>; + reset-assert-us = <10000>; + reset-deassert-us = <10000>; + }; + }; + + enet0: ethernet@b0000 { + phy-connection-type = "rgmii-id"; + phy-handle = <&phy0>; + nvmem-cells = <&macaddr_hwinfo_1f822 0>; + nvmem-cell-names = "mac-address"; + }; + + enet1: ethernet@b1000 { + status = "disabled"; + }; + + enet2: ethernet@b2000 { + status = "disabled"; + }; + + usb@22000 { + status = "disabled"; + }; + + usb@23000 { + status = "disabled"; + }; + }; + + pci0: pcie@ffe09000 { + ranges = <0x2000000 0x0 0xa0000000 0 0xa0000000 0x0 0x20000000 + 0x1000000 0x0 0x00000000 0 0xffc10000 0x0 0x10000>; + reg = <0 0xffe09000 0 0x1000>; + pcie@0 { + ranges = <0x2000000 0x0 0xa0000000 + 0x2000000 0x0 0xa0000000 + 0x0 0x20000000 + + 0x1000000 0x0 0x0 + 0x1000000 0x0 0x0 + 0x0 0x100000>; + }; + }; + + pci1: pcie@ffe0a000 { + reg = <0 0xffe0a000 0 0x1000>; + ranges = <0x2000000 0x0 0x80000000 0 0x80000000 0x0 0x20000000 + 0x1000000 0x0 0x00000000 0 0xffc00000 0x0 0x10000>; + pcie@0 { + ranges = <0x2000000 0x0 0x80000000 + 0x2000000 0x0 0x80000000 + 0x0 0x20000000 + + 0x1000000 0x0 0x0 + 0x1000000 0x0 0x0 + 0x0 0x100000>; + }; + }; + + leds { + compatible = "gpio-leds"; + + system_green: power { + gpios = <&gpio0 0 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_POWER; + default-state = "on"; + }; + + lan { + gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_LAN; + }; + + radio1 { + gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_WLAN; + function-enumerator = <1>; + linux,default-trigger = "phy0tpt"; + }; + + radio2 { + gpios = <&gpio0 3 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_WLAN; + function-enumerator = <2>; + linux,default-trigger = "phy1tpt"; + }; + }; + + buttons { + compatible = "gpio-keys"; + + reset { + label = "reset-btn"; + gpios = <&gpio0 5 GPIO_ACTIVE_HIGH>; + linux,code = ; + }; + }; +}; +/include/ "fsl/p1020si-post.dtsi" diff --git a/target/linux/mpc85xx/files/arch/powerpc/platforms/85xx/msm460.c b/target/linux/mpc85xx/files/arch/powerpc/platforms/85xx/msm460.c new file mode 100644 index 0000000000..a4f547d313 --- /dev/null +++ b/target/linux/mpc85xx/files/arch/powerpc/platforms/85xx/msm460.c @@ -0,0 +1,91 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +/* + * HPE MSM460 Board Setup + * + * Copyright (C) 2022 David Bauer + * + * Based on: + * mpc85xx_rdb.c: + * MPC85xx RDB Board Setup + * Copyright 2013 Freescale Semiconductor Inc. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include "smp.h" + +#include "mpc85xx.h" + +void __init msm_pic_init(void) +{ + struct mpic *mpic; + + mpic = mpic_alloc(NULL, 0, + MPIC_BIG_ENDIAN | + MPIC_SINGLE_DEST_CPU, + 0, 256, " OpenPIC "); + + BUG_ON(mpic == NULL); + mpic_init(mpic); +} + +/* + * Setup the architecture + */ +static void __init msm_setup_arch(void) +{ + if (ppc_md.progress) + ppc_md.progress("msm_setup_arch()", 0); + + mpc85xx_smp_init(); + + fsl_pci_assign_primary(); + + pr_info("MSM460 board from HPE\n"); +} + +machine_arch_initcall(msm, mpc85xx_common_publish_devices); + +/* + * Called very early, device-tree isn't unflattened + */ +static int __init msm_probe(void) +{ + if (of_machine_is_compatible("hpe,msm460")) + return 1; + return 0; +} + +define_machine(msm) { + .name = "P1020 RDB", + .probe = msm_probe, + .setup_arch = msm_setup_arch, + .init_IRQ = msm_pic_init, +#ifdef CONFIG_PCI + .pcibios_fixup_bus = fsl_pcibios_fixup_bus, + .pcibios_fixup_phb = fsl_pcibios_fixup_phb, +#endif + .get_irq = mpic_get_irq, + .calibrate_decr = generic_calibrate_decr, + .progress = udbg_progress, +}; diff --git a/target/linux/mpc85xx/image/p1020.mk b/target/linux/mpc85xx/image/p1020.mk index 56b5c23d4f..e3902d23d6 100644 --- a/target/linux/mpc85xx/image/p1020.mk +++ b/target/linux/mpc85xx/image/p1020.mk @@ -91,6 +91,24 @@ define Device/extreme-networks_ws-ap3825i endef TARGET_DEVICES += extreme-networks_ws-ap3825i +define Device/hpe_msm460 + DEVICE_VENDOR := Hewlett-Packard + DEVICE_MODEL := MSM460 + KERNEL = kernel-bin | fit none $(KDIR)/image-$$(DEVICE_DTS).dtb + KERNEL_NAME := zImage.la3000000 + KERNEL_ENTRY := 0x3000000 + KERNEL_LOADADDR := 0x3000000 + BLOCKSIZE := 128k + PAGESIZE := 2048 + SUBPAGESIZE := 2048 + KERNEL_IN_UBI := 1 + UBINIZE_OPTS := -E 5 + IMAGES := factory.bin sysupgrade.bin + IMAGE/factory.bin := append-ubi + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += hpe_msm460 + define Device/ocedo_panda DEVICE_VENDOR := OCEDO DEVICE_MODEL := Panda @@ -104,4 +122,3 @@ define Device/ocedo_panda IMAGE/fdt.bin := append-dtb endef TARGET_DEVICES += ocedo_panda - diff --git a/target/linux/mpc85xx/p1020/config-default b/target/linux/mpc85xx/p1020/config-default index 573ff362f9..d1c0532582 100644 --- a/target/linux/mpc85xx/p1020/config-default +++ b/target/linux/mpc85xx/p1020/config-default @@ -12,6 +12,7 @@ CONFIG_GPIO_74X164=y CONFIG_HAVE_RCU_TABLE_FREE=y CONFIG_HIVEAP_330=y CONFIG_PANDA=y +CONFIG_MSM460=y CONFIG_I2C_CHARDEV=y CONFIG_LEDS_LP5521=y CONFIG_LEDS_LP55XX_COMMON=y diff --git a/target/linux/mpc85xx/p1020/target.mk b/target/linux/mpc85xx/p1020/target.mk index 27873b01c9..498d8981a1 100644 --- a/target/linux/mpc85xx/p1020/target.mk +++ b/target/linux/mpc85xx/p1020/target.mk @@ -1,5 +1,5 @@ BOARDNAME:=P1020 -KERNEL_IMAGES:=simpleImage.ws-ap3710i simpleImage.ws-ap3825i simpleImage.hiveap-330 +KERNEL_IMAGES:=simpleImage.ws-ap3710i simpleImage.ws-ap3825i simpleImage.hiveap-330 zImage.la3000000 define Target/Description Build firmware images for Freescale P1020 based boards. diff --git a/target/linux/mpc85xx/patches-6.1/010-powerpc-add-compressed-zImage-for-mpc85xx.patch b/target/linux/mpc85xx/patches-6.1/010-powerpc-add-compressed-zImage-for-mpc85xx.patch new file mode 100644 index 0000000000..edf541a8cc --- /dev/null +++ b/target/linux/mpc85xx/patches-6.1/010-powerpc-add-compressed-zImage-for-mpc85xx.patch @@ -0,0 +1,40 @@ +From b30ba76a980b3a9282f309c23e3bb0b0eb2c72cd Mon Sep 17 00:00:00 2001 +From: David Bauer +Date: Thu, 30 May 2024 02:55:38 +0200 +Subject: [PATCH] powerpc: add compressed zImage for mpc85xx + +Add a universal zImage which can be loaded by mpc85xx boards at +load address 0x3000000. This allows boards to boot kernels larger than +16MB even if the image is loaded temporarily from NAND at offset +0x1000000 which some bootloaders do by default. + +Signed-off-by: David Bauer +--- + arch/powerpc/boot/Makefile | 1 + + arch/powerpc/boot/wrapper | 5 +++++ + 2 files changed, 6 insertions(+) + +--- a/arch/powerpc/boot/Makefile ++++ b/arch/powerpc/boot/Makefile +@@ -345,6 +345,7 @@ image-$(CONFIG_MPC836x_MDS) += cuImage. + image-$(CONFIG_ASP834x) += dtbImage.asp834x-redboot + + # Board ports in arch/powerpc/platform/85xx/Kconfig ++image-y += zImage.la3000000 + image-$(CONFIG_MPC8540_ADS) += cuImage.mpc8540ads + image-$(CONFIG_MPC8560_ADS) += cuImage.mpc8560ads + image-$(CONFIG_MPC85xx_CDS) += cuImage.mpc8541cds \ +--- a/arch/powerpc/boot/wrapper ++++ b/arch/powerpc/boot/wrapper +@@ -254,6 +254,11 @@ if [ -n "$esm_blob" -a "$platform" != "p + fi + + case "$platform" in ++la3000000) ++ binary=y ++ platformo="$object/fixed-head.o $object/of.o $object/epapr.o" ++ link_address='0x3000000' ++ ;; + of) + platformo="$object/of.o $object/epapr.o" + make_space=n diff --git a/target/linux/mpc85xx/patches-6.1/111-powerpc-85xx-hpe-msm-support.patch b/target/linux/mpc85xx/patches-6.1/111-powerpc-85xx-hpe-msm-support.patch new file mode 100644 index 0000000000..10ad4b98bd --- /dev/null +++ b/target/linux/mpc85xx/patches-6.1/111-powerpc-85xx-hpe-msm-support.patch @@ -0,0 +1,30 @@ +--- a/arch/powerpc/platforms/85xx/Kconfig ++++ b/arch/powerpc/platforms/85xx/Kconfig +@@ -114,6 +114,17 @@ config FIREBOX_T10 + This board is a VPN Gateway-Router with a + Freescale P1010 SoC. + ++config MSM460 ++ bool "HPE MSM460" ++ select DEFAULT_UIMAGE ++ select ARCH_REQUIRE_GPIOLIB ++ select GPIO_MPC8XXX ++ help ++ This option enables support for the HPE MSM460 board. ++ ++ This board is a Concurrent Dual-Band wireless access point with a ++ Freescale P1020 SoC. ++ + config MPC8540_ADS + bool "Freescale MPC8540 ADS" + select DEFAULT_UIMAGE +--- a/arch/powerpc/platforms/85xx/Makefile ++++ b/arch/powerpc/platforms/85xx/Makefile +@@ -21,6 +21,7 @@ obj-$(CONFIG_MPC8536_DS) += mpc8536_ds. + obj-$(CONFIG_MPC85xx_DS) += mpc85xx_ds.o + obj-$(CONFIG_MPC85xx_MDS) += mpc85xx_mds.o + obj-$(CONFIG_MPC85xx_RDB) += mpc85xx_rdb.o ++obj-$(CONFIG_MSM460) += msm460.o + obj-$(CONFIG_P1010_RDB) += p1010rdb.o + obj-$(CONFIG_P1022_DS) += p1022_ds.o + obj-$(CONFIG_P1022_RDK) += p1022_rdk.o diff --git a/target/linux/mpc85xx/patches-6.6/010-powerpc-add-compressed-zImage-for-mpc85xx.patch b/target/linux/mpc85xx/patches-6.6/010-powerpc-add-compressed-zImage-for-mpc85xx.patch new file mode 100644 index 0000000000..edf541a8cc --- /dev/null +++ b/target/linux/mpc85xx/patches-6.6/010-powerpc-add-compressed-zImage-for-mpc85xx.patch @@ -0,0 +1,40 @@ +From b30ba76a980b3a9282f309c23e3bb0b0eb2c72cd Mon Sep 17 00:00:00 2001 +From: David Bauer +Date: Thu, 30 May 2024 02:55:38 +0200 +Subject: [PATCH] powerpc: add compressed zImage for mpc85xx + +Add a universal zImage which can be loaded by mpc85xx boards at +load address 0x3000000. This allows boards to boot kernels larger than +16MB even if the image is loaded temporarily from NAND at offset +0x1000000 which some bootloaders do by default. + +Signed-off-by: David Bauer +--- + arch/powerpc/boot/Makefile | 1 + + arch/powerpc/boot/wrapper | 5 +++++ + 2 files changed, 6 insertions(+) + +--- a/arch/powerpc/boot/Makefile ++++ b/arch/powerpc/boot/Makefile +@@ -345,6 +345,7 @@ image-$(CONFIG_MPC836x_MDS) += cuImage. + image-$(CONFIG_ASP834x) += dtbImage.asp834x-redboot + + # Board ports in arch/powerpc/platform/85xx/Kconfig ++image-y += zImage.la3000000 + image-$(CONFIG_MPC8540_ADS) += cuImage.mpc8540ads + image-$(CONFIG_MPC8560_ADS) += cuImage.mpc8560ads + image-$(CONFIG_MPC85xx_CDS) += cuImage.mpc8541cds \ +--- a/arch/powerpc/boot/wrapper ++++ b/arch/powerpc/boot/wrapper +@@ -254,6 +254,11 @@ if [ -n "$esm_blob" -a "$platform" != "p + fi + + case "$platform" in ++la3000000) ++ binary=y ++ platformo="$object/fixed-head.o $object/of.o $object/epapr.o" ++ link_address='0x3000000' ++ ;; + of) + platformo="$object/of.o $object/epapr.o" + make_space=n diff --git a/target/linux/mpc85xx/patches-6.6/111-powerpc-85xx-hpe-msm-support.patch b/target/linux/mpc85xx/patches-6.6/111-powerpc-85xx-hpe-msm-support.patch new file mode 100644 index 0000000000..5cf2eb2a53 --- /dev/null +++ b/target/linux/mpc85xx/patches-6.6/111-powerpc-85xx-hpe-msm-support.patch @@ -0,0 +1,30 @@ +--- a/arch/powerpc/platforms/85xx/Kconfig ++++ b/arch/powerpc/platforms/85xx/Kconfig +@@ -114,6 +114,17 @@ config FIREBOX_T10 + This board is a VPN Gateway-Router with a + Freescale P1010 SoC. + ++config MSM460 ++ bool "HPE MSM460" ++ select DEFAULT_UIMAGE ++ select ARCH_REQUIRE_GPIOLIB ++ select GPIO_MPC8XXX ++ help ++ This option enables support for the HPE MSM460 board. ++ ++ This board is a Concurrent Dual-Band wireless access point with a ++ Freescale P1020 SoC. ++ + config MPC8540_ADS + bool "Freescale MPC8540 ADS" + select DEFAULT_UIMAGE +--- a/arch/powerpc/platforms/85xx/Makefile ++++ b/arch/powerpc/platforms/85xx/Makefile +@@ -19,6 +19,7 @@ obj8259-$(CONFIG_PPC_I8259) += mpc85xx + obj-$(CONFIG_MPC85xx_DS) += mpc85xx_ds.o $(obj8259-y) + obj-$(CONFIG_MPC85xx_MDS) += mpc85xx_mds.o + obj-$(CONFIG_MPC85xx_RDB) += mpc85xx_rdb.o ++obj-$(CONFIG_MSM460) += msm460.o + obj-$(CONFIG_P1010_RDB) += p1010rdb.o + obj-$(CONFIG_P1022_DS) += p1022_ds.o + obj-$(CONFIG_P1022_RDK) += p1022_rdk.o diff --git a/target/linux/mvebu/files-6.6/arch/arm64/boot/dts/marvell/cn9131-puzzle-m901.dts b/target/linux/mvebu/files-6.6/arch/arm64/boot/dts/marvell/cn9131-puzzle-m901.dts index d214853f1b..90d6e855be 100644 --- a/target/linux/mvebu/files-6.6/arch/arm64/boot/dts/marvell/cn9131-puzzle-m901.dts +++ b/target/linux/mvebu/files-6.6/arch/arm64/boot/dts/marvell/cn9131-puzzle-m901.dts @@ -54,6 +54,48 @@ gpios = <&cp0_gpio2 4 GPIO_ACTIVE_LOW>; }; }; + + thermal-zones { + chassis0-thermal { + thermal-sensors = <&puzzle_hwmon 0>; + PUZZLE_FAN_CHASSIS_THERMAL(chassis0, &chassis_fan_group0); + }; + + chassis1-thermal { + thermal-sensors = <&puzzle_hwmon 1>; + PUZZLE_FAN_CHASSIS_THERMAL(chassis1, &chassis_fan_group0); + }; + + cp0-phy0-thermal { + thermal-sensors = <&cp0_nbaset_phy0>; + PUZZLE_FAN_THERMAL(cp0_phy0, &chassis_fan_group0); + }; + + cp0-phy1-thermal { + thermal-sensors = <&cp0_nbaset_phy1>; + PUZZLE_FAN_THERMAL(cp0_phy1, &chassis_fan_group0); + }; + + cp0-phy2-thermal { + thermal-sensors = <&cp0_nbaset_phy2>; + PUZZLE_FAN_THERMAL(cp0_phy2, &chassis_fan_group0); + }; + + cp1-phy0-thermal { + thermal-sensors = <&cp1_nbaset_phy0>; + PUZZLE_FAN_THERMAL(cp1_phy0, &chassis_fan_group0); + }; + + cp1-phy1-thermal { + thermal-sensors = <&cp1_nbaset_phy1>; + PUZZLE_FAN_THERMAL(cp1_phy1, &chassis_fan_group0); + }; + + cp1-phy2-thermal { + thermal-sensors = <&cp1_nbaset_phy2>; + PUZZLE_FAN_THERMAL(cp1_phy2, &chassis_fan_group0); + }; + }; }; &uart0 { @@ -104,10 +146,11 @@ }; }; - hwmon { + puzzle_hwmon: hwmon { compatible = "iei,wt61p803-puzzle-hwmon"; #address-cells = <1>; #size-cells = <0>; + #thermal-sensor-cells = <1>; chassis_fan_group0: fan-group@0 { #cooling-cells = <2>; @@ -118,14 +161,6 @@ }; }; -&ap_thermal_ic { - PUZZLE_FAN_THERMAL(ic, &chassis_fan_group0); -}; - -&cp0_thermal_ic { - PUZZLE_FAN_THERMAL(cp0, &chassis_fan_group0); -}; - /* on-board eMMC - U9 */ &ap_sdhci0 { pinctrl-names = "default"; @@ -144,14 +179,17 @@ cp0_nbaset_phy0: ethernet-phy@0 { compatible = "ethernet-phy-ieee802.3-c45"; reg = <2>; + #thermal-sensor-cells = <0>; }; cp0_nbaset_phy1: ethernet-phy@1 { compatible = "ethernet-phy-ieee802.3-c45"; reg = <0>; + #thermal-sensor-cells = <0>; }; cp0_nbaset_phy2: ethernet-phy@2 { compatible = "ethernet-phy-ieee802.3-c45"; reg = <8>; + #thermal-sensor-cells = <0>; }; }; @@ -313,14 +351,17 @@ cp1_nbaset_phy0: ethernet-phy@3 { compatible = "ethernet-phy-ieee802.3-c45"; reg = <2>; + #thermal-sensor-cells = <0>; }; cp1_nbaset_phy1: ethernet-phy@4 { compatible = "ethernet-phy-ieee802.3-c45"; reg = <0>; + #thermal-sensor-cells = <0>; }; cp1_nbaset_phy2: ethernet-phy@5 { compatible = "ethernet-phy-ieee802.3-c45"; reg = <8>; + #thermal-sensor-cells = <0>; }; }; @@ -399,10 +440,6 @@ }; }; -&cp1_thermal_ic { - PUZZLE_FAN_THERMAL(cp1, &chassis_fan_group0); -}; - &cp1_usb3_1 { status = "okay"; phys = <&cp1_comphy3 1>; diff --git a/target/linux/mvebu/files-6.6/arch/arm64/boot/dts/marvell/cn9132-puzzle-m902.dts b/target/linux/mvebu/files-6.6/arch/arm64/boot/dts/marvell/cn9132-puzzle-m902.dts index 8c775e4a4f..67dace4888 100644 --- a/target/linux/mvebu/files-6.6/arch/arm64/boot/dts/marvell/cn9132-puzzle-m902.dts +++ b/target/linux/mvebu/files-6.6/arch/arm64/boot/dts/marvell/cn9132-puzzle-m902.dts @@ -99,6 +99,64 @@ tx-fault-gpio = <&cp2_module_expander1 8 GPIO_ACTIVE_HIGH>; status = "disabled"; }; + + thermal-zones { + chassis0-thermal { + thermal-sensors = <&puzzle_hwmon 0>; + PUZZLE_FAN_CHASSIS_THERMAL(chassis0, &chassis_fan_group0); + }; + + chassis1-thermal { + thermal-sensors = <&puzzle_hwmon 1>; + PUZZLE_FAN_CHASSIS_THERMAL(chassis1, &chassis_fan_group0); + }; + + cp0-phy0-thermal { + thermal-sensors = <&cp0_nbaset_phy0>; + PUZZLE_FAN_THERMAL(cp0_phy0, &chassis_fan_group0); + }; + + cp0-phy1-thermal { + thermal-sensors = <&cp0_nbaset_phy1>; + PUZZLE_FAN_THERMAL(cp0_phy1, &chassis_fan_group0); + }; + + cp0-phy2-thermal { + thermal-sensors = <&cp0_nbaset_phy2>; + PUZZLE_FAN_THERMAL(cp0_phy2, &chassis_fan_group0); + }; + + cp1-phy0-thermal { + thermal-sensors = <&cp1_nbaset_phy0>; + PUZZLE_FAN_THERMAL(cp1_phy0, &chassis_fan_group0); + }; + + cp1-phy1-thermal { + thermal-sensors = <&cp1_nbaset_phy1>; + PUZZLE_FAN_THERMAL(cp1_phy1, &chassis_fan_group0); + }; + + cp1-phy2-thermal { + thermal-sensors = <&cp1_nbaset_phy2>; + PUZZLE_FAN_THERMAL(cp1_phy2, &chassis_fan_group0); + }; + + cp2-phy0-thermal { + thermal-sensors = <&cp2_nbaset_phy0>; + PUZZLE_FAN_THERMAL(cp2_phy0, &chassis_fan_group0); + }; + + cp2-phy1-thermal { + thermal-sensors = <&cp2_nbaset_phy1>; + PUZZLE_FAN_THERMAL(cp2_phy1, &chassis_fan_group0); + }; + + cp2-phy2-thermal { + thermal-sensors = <&cp2_nbaset_phy2>; + PUZZLE_FAN_THERMAL(cp2_phy2, &chassis_fan_group0); + }; + }; + }; &uart0 { @@ -149,10 +207,11 @@ }; }; - hwmon { + puzzle_hwmon: hwmon { compatible = "iei,wt61p803-puzzle-hwmon"; #address-cells = <1>; #size-cells = <0>; + #thermal-sensor-cells = <1>; chassis_fan_group0: fan-group@0 { #cooling-cells = <2>; @@ -163,15 +222,6 @@ }; }; -&ap_thermal_ic { - PUZZLE_FAN_THERMAL(ic, &chassis_fan_group0); -}; - -&cp0_thermal_ic { - PUZZLE_FAN_THERMAL(cp0, &chassis_fan_group0); -}; - - /* on-board eMMC - U9 */ &ap_sdhci0 { pinctrl-names = "default"; @@ -187,17 +237,20 @@ &cp0_xmdio { status = "okay"; - cp0_nbaset_phy0: ethernet-phy@0 { + cp0_nbaset_phy0: ethernet-phy@2 { compatible = "ethernet-phy-ieee802.3-c45"; reg = <2>; + #thermal-sensor-cells = <0>; }; - cp0_nbaset_phy1: ethernet-phy@1 { + cp0_nbaset_phy1: ethernet-phy@0 { compatible = "ethernet-phy-ieee802.3-c45"; reg = <0>; + #thermal-sensor-cells = <0>; }; - cp0_nbaset_phy2: ethernet-phy@2 { + cp0_nbaset_phy2: ethernet-phy@8 { compatible = "ethernet-phy-ieee802.3-c45"; reg = <8>; + #thermal-sensor-cells = <0>; }; }; @@ -374,17 +427,20 @@ &cp1_xmdio { status = "okay"; - cp1_nbaset_phy0: ethernet-phy@3 { + cp1_nbaset_phy0: ethernet-phy@2 { compatible = "ethernet-phy-ieee802.3-c45"; reg = <2>; + #thermal-sensor-cells = <0>; }; - cp1_nbaset_phy1: ethernet-phy@4 { + cp1_nbaset_phy1: ethernet-phy@0 { compatible = "ethernet-phy-ieee802.3-c45"; reg = <0>; + #thermal-sensor-cells = <0>; }; - cp1_nbaset_phy2: ethernet-phy@5 { + cp1_nbaset_phy2: ethernet-phy@8 { compatible = "ethernet-phy-ieee802.3-c45"; reg = <8>; + #thermal-sensor-cells = <0>; }; }; @@ -451,10 +507,6 @@ }; }; -&cp1_thermal_ic { - PUZZLE_FAN_THERMAL(cp1, &chassis_fan_group0); -}; - /* * Instantiate the second connected CP115 */ @@ -487,17 +539,20 @@ &cp2_xmdio { status = "okay"; - cp2_nbaset_phy0: ethernet-phy@6 { + cp2_nbaset_phy0: ethernet-phy@2 { compatible = "ethernet-phy-ieee802.3-c45"; reg = <2>; + #thermal-sensor-cells = <0>; }; - cp2_nbaset_phy1: ethernet-phy@7 { + cp2_nbaset_phy1: ethernet-phy@0 { compatible = "ethernet-phy-ieee802.3-c45"; reg = <0>; + #thermal-sensor-cells = <0>; }; cp2_nbaset_phy2: ethernet-phy@8 { compatible = "ethernet-phy-ieee802.3-c45"; reg = <8>; + #thermal-sensor-cells = <0>; }; }; @@ -574,7 +629,3 @@ }; }; }; - -&cp2_thermal_ic { - PUZZLE_FAN_THERMAL(cp2, &chassis_fan_group0); -}; diff --git a/target/linux/mvebu/files-6.6/arch/arm64/boot/dts/marvell/puzzle-thermal.dtsi b/target/linux/mvebu/files-6.6/arch/arm64/boot/dts/marvell/puzzle-thermal.dtsi index ea79ab224e..eb8682b297 100644 --- a/target/linux/mvebu/files-6.6/arch/arm64/boot/dts/marvell/puzzle-thermal.dtsi +++ b/target/linux/mvebu/files-6.6/arch/arm64/boot/dts/marvell/puzzle-thermal.dtsi @@ -1,68 +1,98 @@ -#define PUZZLE_FAN_THERMAL(_cname, _fan) \ - polling-delay-passive = <500>; \ - polling-delay = <1000>; \ - \ - trips { \ - cpu-hot { \ - temperature = <75000>; \ - hysteresis = <5000>; \ - type = "hot"; \ - }; \ - _cname##_active_full: cpu-active-full { \ - temperature = <70000>; \ - hysteresis = <5000>; \ - type = "active"; \ - }; \ - _cname##_active_high: cpu-active-high { \ - temperature = <65000>; \ - hysteresis = <5000>; \ - type = "active"; \ - }; \ - _cname##_active_med: cpu-active-med { \ - temperature = <62500>; \ - hysteresis = <3000>; \ - type = "active"; \ - }; \ - _cname##_active_low: cpu-active-low { \ - temperature = <60000>; \ - hysteresis = <3000>; \ - type = "active"; \ - }; \ - _cname##_active_min: cpu-active-min { \ - temperature = <55000>; \ - hysteresis = <5000>; \ - type = "active"; \ - }; \ - _cname##_active_idle: cpu-active-idle { \ - temperature = <50000>; \ - hysteresis = <5000>; \ - type = "active"; \ - }; \ - }; \ - cooling-maps { \ - cpu-active-full { \ - trip = <&_cname##_active_full>; \ - cooling-device = <_fan THERMAL_NO_LIMIT \ - THERMAL_NO_LIMIT>; \ - }; \ - cpu-active-high { \ - trip = <&_cname##_active_high>; \ - cooling-device = <_fan 4 5>; \ - }; \ - cpu-active-med { \ - trip = <&_cname##_active_med>; \ - cooling-device = <_fan 3 4>; \ - }; \ - cpu-active-low { \ - trip = <&_cname##_active_low>; \ - cooling-device = <_fan 2 3>; \ - }; \ - cpu-active-min { \ - trip = <&_cname##_active_min>; \ - cooling-device = <_fan 1 2>; \ - }; \ - cpu-active-idle { \ - trip = <&_cname##_active_idle>; \ - cooling-device = <_fan 0 0>; \ - }; \ +#define PUZZLE_FAN_THERMAL(_cname, _fan) \ + polling-delay-passive = <0>; \ + polling-delay = <1000>; \ + \ + trips { \ + _cname##_active_full: trip-point5 { \ + temperature = <70000>; \ + hysteresis = <3000>; \ + type = "active"; \ + }; \ + _cname##_active_very_high: trip-point4 { \ + temperature = <67500>; \ + hysteresis = <3000>; \ + type = "active"; \ + }; \ + _cname##_active_high: trip-point3 { \ + temperature = <65000>; \ + hysteresis = <5000>; \ + type = "active"; \ + }; \ + _cname##_active_med: trip-point2 { \ + temperature = <62500>; \ + hysteresis = <3000>; \ + type = "active"; \ + }; \ + _cname##_active_low: trip-point1 { \ + temperature = <60000>; \ + hysteresis = <3000>; \ + type = "active"; \ + }; \ + _cname##_active_min: trip-point0 { \ + temperature = <55000>; \ + hysteresis = <5000>; \ + type = "active"; \ + }; \ + }; \ + cooling-maps { \ + map5 { \ + trip = <&_cname##_active_full>; \ + cooling-device = <_fan 6 6>; \ + }; \ + map4 { \ + trip = <&_cname##_active_very_high>; \ + cooling-device = <_fan 5 5>; \ + }; \ + map3 { \ + trip = <&_cname##_active_high>; \ + cooling-device = <_fan 4 4>; \ + }; \ + map2 { \ + trip = <&_cname##_active_med>; \ + cooling-device = <_fan 3 3>; \ + }; \ + map1 { \ + trip = <&_cname##_active_low>; \ + cooling-device = <_fan 2 2>; \ + }; \ + map0 { \ + trip = <&_cname##_active_min>; \ + cooling-device = <_fan 1 1>; \ + }; \ + } + +#define PUZZLE_FAN_CHASSIS_THERMAL(_cname, _fan) \ + polling-delay-passive = <0>; \ + polling-delay = <5000>; \ + \ + trips { \ + _cname##_active_full: trip-point2 { \ + temperature = <70000>; \ + hysteresis = <3000>; \ + type = "active"; \ + }; \ + _cname##_active_med: trip-point1 { \ + temperature = <62500>; \ + hysteresis = <3000>; \ + type = "active"; \ + }; \ + _cname##_active_min: trip-point0 { \ + temperature = <55000>; \ + hysteresis = <5000>; \ + type = "active"; \ + }; \ + }; \ + cooling-maps { \ + map2 { \ + trip = <&_cname##_active_full>; \ + cooling-device = <_fan 6 6>; \ + }; \ + map1 { \ + trip = <&_cname##_active_med>; \ + cooling-device = <_fan 3 3>; \ + }; \ + map0 { \ + trip = <&_cname##_active_min>; \ + cooling-device = <_fan 1 1>; \ + }; \ } diff --git a/target/linux/mvebu/patches-6.6/350-drivers-thermal-step_wise-add-support-for-hysteresis.patch b/target/linux/mvebu/patches-6.6/350-drivers-thermal-step_wise-add-support-for-hysteresis.patch new file mode 100644 index 0000000000..e7332b6df0 --- /dev/null +++ b/target/linux/mvebu/patches-6.6/350-drivers-thermal-step_wise-add-support-for-hysteresis.patch @@ -0,0 +1,65 @@ +From 9685ce100f0d302501117113ef0a526ad1acca1d Mon Sep 17 00:00:00 2001 +From: Ram Chandrasekar +Date: Mon, 7 May 2018 11:54:08 -0600 +Subject: [PATCH] drivers: thermal: step_wise: add support for hysteresis + +Step wise governor increases the mitigation level when the temperature +goes above a threshold and will decrease the mitigation when the +temperature falls below the threshold. If it were a case, where the +temperature hovers around a threshold, the mitigation will be applied +and removed at every iteration. This reaction to the temperature is +inefficient for performance. + +The use of hysteresis temperature could avoid this ping-pong of +mitigation by relaxing the mitigation to happen only when the +temperature goes below this lower hysteresis value. + +Signed-off-by: Ram Chandrasekar +Signed-off-by: Lina Iyer +[forward-ported for Linux 6.6, as stop-gap downstream solution] +Signed-off-by: Daniel Golle +--- + drivers/thermal/gov_step_wise.c | 23 ++++++++++++++++------- + 1 file changed, 16 insertions(+), 7 deletions(-) + +--- a/drivers/thermal/gov_step_wise.c ++++ b/drivers/thermal/gov_step_wise.c +@@ -86,22 +86,31 @@ static void thermal_zone_trip_update(str + struct thermal_instance *instance; + bool throttle = false; + int old_target; ++ int hyst_temp; + + trend = get_tz_trend(tz, trip_id); + +- if (tz->temperature >= trip->temperature) { +- throttle = true; +- trace_thermal_zone_trip(tz, trip_id, trip->type); +- } +- +- dev_dbg(&tz->device, "Trip%d[type=%d,temp=%d]:trend=%d,throttle=%d\n", +- trip_id, trip->type, trip->temperature, trend, throttle); ++ hyst_temp = trip->temperature - trip->hysteresis; ++ dev_dbg(&tz->device, "Trip%d[type=%d,temp=%d,hyst=%d]:trend=%d,throttle=%d\n", ++ trip_id, trip->type, trip->temperature, hyst_temp, trend, throttle); + + list_for_each_entry(instance, &tz->thermal_instances, tz_node) { + if (instance->trip != trip) + continue; + + old_target = instance->target; ++ throttle = false; ++ /* ++ * Lower the mitigation only if the temperature ++ * goes below the hysteresis temperature. ++ */ ++ if (tz->temperature >= trip->temperature || ++ (tz->temperature >= hyst_temp && ++ old_target != THERMAL_NO_TARGET)) { ++ throttle = true; ++ trace_thermal_zone_trip(tz, trip_id, trip->type); ++ } ++ + instance->target = get_target_state(instance, trend, throttle); + dev_dbg(&instance->cdev->device, "old_target=%d, target=%d\n", + old_target, (int)instance->target); diff --git a/target/linux/mvebu/patches-6.6/912-drivers-hwmon-wt61p803-puzzle-thermal-zone.patch b/target/linux/mvebu/patches-6.6/912-drivers-hwmon-wt61p803-puzzle-thermal-zone.patch new file mode 100644 index 0000000000..4633c03855 --- /dev/null +++ b/target/linux/mvebu/patches-6.6/912-drivers-hwmon-wt61p803-puzzle-thermal-zone.patch @@ -0,0 +1,10 @@ +--- a/drivers/hwmon/iei-wt61p803-puzzle-hwmon.c ++++ b/drivers/hwmon/iei-wt61p803-puzzle-hwmon.c +@@ -251,6 +251,7 @@ static const struct hwmon_ops iei_wt61p8 + }; + + static const struct hwmon_channel_info *iei_wt61p803_puzzle_info[] = { ++ HWMON_CHANNEL_INFO(chip, HWMON_C_REGISTER_TZ), + HWMON_CHANNEL_INFO(pwm, + HWMON_PWM_INPUT, + HWMON_PWM_INPUT),