Merge branch 'openwrt:master' into master

This commit is contained in:
Hayzam Sherif 2023-10-29 19:40:10 +04:00 committed by GitHub
commit 23099c6e4f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
79 changed files with 4595 additions and 619 deletions

View file

@ -1,2 +1,2 @@
LINUX_VERSION-5.15 = .135
LINUX_KERNEL_HASH-5.15.135 = 14835e629e237f136cfed484fdb533c95242429809bdcdb2a2d66dfcb7447170
LINUX_VERSION-5.15 = .137
LINUX_KERNEL_HASH-5.15.137 = 9749b21609f9e7ad9c46160c2c107db823b99cef77fa6cb080b6c2dc685fb2f7

View file

@ -9,10 +9,6 @@ endif
INITRAMFS_EXTRA_FILES ?= $(GENERIC_PLATFORM_DIR)/image/initramfs-base-files.txt
ifneq (,$(KERNEL_CC))
KERNEL_MAKEOPTS += CC="$(KERNEL_CC)"
endif
export HOST_EXTRACFLAGS=-I$(STAGING_DIR_HOST)/include
# defined in quilt.mk

View file

@ -119,6 +119,10 @@ KERNEL_MAKE_FLAGS = \
cmd_syscalls= \
$(if $(__package_mk),KBUILD_EXTRA_SYMBOLS="$(wildcard $(PKG_SYMVERS_DIR)/*.symvers)")
ifneq (,$(KERNEL_CC))
KERNEL_MAKE_FLAGS += CC="$(KERNEL_CC)"
endif
KERNEL_NOSTDINC_FLAGS = \
-nostdinc $(if $(DUMP),, -isystem $(shell $(TARGET_CC) -print-file-name=include))

View file

@ -94,6 +94,22 @@ define Trusted-Firmware-A/mt7622-sdmmc-2ddr
DDR3_FLYBY:=1
endef
define Trusted-Firmware-A/mt7981-emmc-ddr4
NAME:=MediaTek MT7981 (eMMC, DDR4)
BOOT_DEVICE:=emmc
BUILD_SUBTARGET:=filogic
PLAT:=mt7981
DDR_TYPE:=ddr4
endef
define Trusted-Firmware-A/mt7981-spim-nand-ddr4
NAME:=MediaTek MT7981 (SPI-NAND via SPIM, DDR4)
BOOT_DEVICE:=spim-nand
BUILD_SUBTARGET:=filogic
PLAT:=mt7981
DDR_TYPE:=ddr4
endef
define Trusted-Firmware-A/mt7981-nor-ddr3
NAME:=MediaTek MT7981 (SPI-NOR, DDR3)
BOOT_DEVICE:=nor
@ -349,6 +365,8 @@ TFA_TARGETS:= \
mt7981-sdmmc-ddr3 \
mt7981-snand-ddr3 \
mt7981-spim-nand-ddr3 \
mt7981-emmc-ddr4 \
mt7981-spim-nand-ddr4 \
mt7986-emmc-ddr3 \
mt7986-nor-ddr3 \
mt7986-sdmmc-ddr3 \

View file

@ -37,6 +37,23 @@ bananapi,bpi-r3)
;;
esac
;;
cmcc,rax3000m)
case "$(cmdline_get_var root)" in
/dev/mmc*)
local envdev=$(find_mmc_part "ubootenv" "mmcblk0")
ubootenv_add_uci_config "$envdev" "0x0" "0x40000" "0x40000" "1"
ubootenv_add_uci_config "$envdev" "0x40000" "0x40000" "0x40000" "1"
;;
*)
. /lib/upgrade/nand.sh
local envubi=$(nand_find_ubi ubi)
local envdev=/dev/$(nand_find_volume $envubi ubootenv)
local envdev2=/dev/$(nand_find_volume $envubi ubootenv2)
ubootenv_add_uci_config "$envdev" "0x0" "0x1f000" "0x1f000" "1"
ubootenv_add_uci_config "$envdev2" "0x0" "0x1f000" "0x1f000" "1"
;;
esac
;;
glinet,gl-mt3000)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x20000"
;;

View file

@ -11,7 +11,8 @@ case "$board" in
dynalink,dl-wrx36|\
netgear,rax120v2|\
netgear,wax218|\
netgear,wax620)
netgear,wax620|\
netgear,wax630)
idx="$(find_mtd_index 0:appsblenv)"
[ -n "$idx" ] && \
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000" "2"

View file

@ -200,6 +200,30 @@ define U-Boot/mt7629_rfb
UBOOT_CONFIG:=mt7629_rfb
endef
define U-Boot/mt7981_cmcc_rax3000m-emmc
NAME:=CMCC RAX3000M
BUILD_SUBTARGET:=filogic
BUILD_DEVICES:=cmcc_rax3000m
UBOOT_CONFIG:=mt7981_cmcc_rax3000m-emmc
UBOOT_IMAGE:=u-boot.fip
BL2_BOOTDEV:=emmc
BL2_SOC:=mt7981
BL2_DDRTYPE:=ddr4
DEPENDS:=+trusted-firmware-a-mt7981-emmc-ddr4
endef
define U-Boot/mt7981_cmcc_rax3000m-nand
NAME:=CMCC RAX3000M
BUILD_SUBTARGET:=filogic
BUILD_DEVICES:=cmcc_rax3000m
UBOOT_CONFIG:=mt7981_cmcc_rax3000m-nand
UBOOT_IMAGE:=u-boot.fip
BL2_BOOTDEV:=spim-nand
BL2_SOC:=mt7981
BL2_DDRTYPE:=ddr4
DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr4
endef
define U-Boot/mt7981_h3c_magic-nx30-pro
NAME:=H3C Magic NX30 Pro
BUILD_SUBTARGET:=filogic
@ -496,6 +520,8 @@ UBOOT_TARGETS := \
mt7628_rfb \
ravpower_rp-wd009 \
mt7629_rfb \
mt7981_cmcc_rax3000m-emmc \
mt7981_cmcc_rax3000m-nand \
mt7981_h3c_magic-nx30-pro \
mt7981_rfb-spim-nand \
mt7981_rfb-emmc \

View file

@ -239,12 +239,12 @@
+&eth {
+ status = "okay";
+ mediatek,gmac-id = <0>;
+ phy-mode = "sgmii";
+ phy-mode = "2500base-x";
+ mediatek,switch = "mt7531";
+ reset-gpios = <&gpio 5 GPIO_ACTIVE_HIGH>;
+
+ fixed-link {
+ speed = <1000>;
+ speed = <2500>;
+ full-duplex;
+ };
+};

View file

@ -0,0 +1,697 @@
--- /dev/null
+++ b/configs/mt7981_cmcc_rax3000m-emmc_defconfig
@@ -0,0 +1,175 @@
+CONFIG_ARM=y
+CONFIG_POSITION_INDEPENDENT=y
+CONFIG_ARCH_MEDIATEK=y
+CONFIG_TARGET_MT7981=y
+CONFIG_TEXT_BASE=0x41e00000
+CONFIG_SYS_MALLOC_F_LEN=0x4000
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_DEFAULT_DEVICE_TREE="mt7981-cmcc-rax3000m-emmc"
+CONFIG_DEFAULT_ENV_FILE="cmcc_rax3000m-emmc_env"
+CONFIG_DEFAULT_FDT_FILE="mediatek/mt7981-cmcc-rax3000m-emmc.dtb"
+CONFIG_OF_LIBFDT_OVERLAY=y
+CONFIG_DEBUG_UART_BASE=0x11002000
+CONFIG_DEBUG_UART_CLOCK=40000000
+CONFIG_DEBUG_UART=y
+CONFIG_SYS_LOAD_ADDR=0x46000000
+CONFIG_SMBIOS_PRODUCT_NAME=""
+CONFIG_AUTOBOOT_KEYED=y
+CONFIG_BOOTDELAY=30
+CONFIG_AUTOBOOT_MENU_SHOW=y
+CONFIG_CFB_CONSOLE_ANSI=y
+CONFIG_BOARD_LATE_INIT=y
+CONFIG_BUTTON=y
+CONFIG_BUTTON_GPIO=y
+CONFIG_GPIO_HOG=y
+CONFIG_CMD_ENV_FLAGS=y
+CONFIG_FIT=y
+CONFIG_FIT_ENABLE_SHA256_SUPPORT=y
+CONFIG_LED=y
+CONFIG_LED_BLINK=y
+CONFIG_LED_GPIO=y
+CONFIG_LOGLEVEL=7
+CONFIG_LOG=y
+CONFIG_SYS_PROMPT="MT7981> "
+CONFIG_CMD_BOOTMENU=y
+CONFIG_CMD_BOOTP=y
+CONFIG_CMD_BUTTON=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_CDP=y
+CONFIG_CMD_CPU=y
+CONFIG_CMD_DHCP=y
+CONFIG_CMD_DM=y
+CONFIG_CMD_DNS=y
+CONFIG_CMD_ECHO=y
+CONFIG_CMD_ENV_READMEM=y
+CONFIG_CMD_ERASEENV=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_FAT=y
+CONFIG_CMD_FDT=y
+CONFIG_CMD_FS_GENERIC=y
+CONFIG_CMD_FS_UUID=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_GPT=y
+CONFIG_CMD_HASH=y
+CONFIG_CMD_ITEST=y
+CONFIG_CMD_LED=y
+CONFIG_CMD_LICENSE=y
+CONFIG_CMD_LINK_LOCAL=y
+# CONFIG_CMD_MBR is not set
+CONFIG_CMD_MMC=y
+CONFIG_CMD_PCI=y
+CONFIG_CMD_PSTORE=y
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
+CONFIG_CMD_SF_TEST=y
+CONFIG_CMD_PING=y
+CONFIG_CMD_PXE=y
+CONFIG_CMD_PWM=y
+CONFIG_CMD_SMC=y
+CONFIG_CMD_TFTPBOOT=y
+CONFIG_CMD_TFTPSRV=y
+CONFIG_CMD_ASKENV=y
+CONFIG_CMD_PART=y
+CONFIG_CMD_RARP=y
+CONFIG_CMD_SETEXPR=y
+CONFIG_CMD_SLEEP=y
+CONFIG_CMD_SNTP=y
+CONFIG_CMD_SOURCE=y
+CONFIG_CMD_STRINGS=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_UUID=y
+CONFIG_DISPLAY_CPUINFO=y
+CONFIG_DM_MMC=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_REGULATOR_GPIO=y
+CONFIG_DM_USB=y
+CONFIG_DM_PWM=y
+CONFIG_PWM_MTK=y
+CONFIG_HUSH_PARSER=y
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_VERSION_VARIABLE=y
+CONFIG_PARTITION_UUIDS=y
+CONFIG_NETCONSOLE=y
+CONFIG_REGMAP=y
+CONFIG_SYSCON=y
+CONFIG_CLK=y
+CONFIG_DM_GPIO=y
+CONFIG_DM_SCSI=y
+CONFIG_AHCI=y
+CONFIG_AHCI_PCI=y
+CONFIG_SCSI_AHCI=y
+CONFIG_SCSI=y
+CONFIG_CMD_SCSI=y
+CONFIG_PHY=y
+CONFIG_PHY_MTK_TPHY=y
+CONFIG_PHY_FIXED=y
+CONFIG_MTK_AHCI=y
+CONFIG_DM_ETH=y
+CONFIG_MEDIATEK_ETH=y
+CONFIG_PCI=y
+CONFIG_DM_PCI=y
+CONFIG_PCIE_MEDIATEK=y
+CONFIG_PINCTRL=y
+CONFIG_PINCONF=y
+CONFIG_PINCTRL_MT7622=y
+CONFIG_POWER_DOMAIN=y
+CONFIG_PRE_CONSOLE_BUFFER=y
+CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
+CONFIG_MTK_POWER_DOMAIN=y
+CONFIG_RAM=y
+CONFIG_DM_SERIAL=y
+CONFIG_MTK_SERIAL=y
+CONFIG_MMC=y
+CONFIG_MMC_DEFAULT_DEV=1
+CONFIG_MMC_HS200_SUPPORT=y
+CONFIG_MMC_MTK=y
+CONFIG_MMC_SUPPORTS_TUNING=y
+CONFIG_SUPPORT_EMMC_BOOT=y
+CONFIG_SPI=y
+CONFIG_SYSRESET_WATCHDOG=y
+CONFIG_WDT_MTK=y
+CONFIG_LZO=y
+CONFIG_ZSTD=y
+CONFIG_HEXDUMP=y
+CONFIG_RANDOM_UUID=y
+CONFIG_REGEX=y
+CONFIG_USB=y
+CONFIG_USB_HOST=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_MTK=y
+CONFIG_USB_STORAGE=y
+CONFIG_OF_EMBED=y
+CONFIG_ENV_OVERWRITE=y
+CONFIG_ENV_IS_IN_MMC=y
+CONFIG_ENV_OFFSET=0x400000
+CONFIG_ENV_OFFSET_REDUND=0x440000
+CONFIG_ENV_SIZE=0x40000
+CONFIG_ENV_SIZE_REDUND=0x40000
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_REGMAP=y
+CONFIG_SYSCON=y
+CONFIG_CLK=y
+CONFIG_SUPPORT_EMMC_BOOT=y
+CONFIG_PHY_FIXED=y
+CONFIG_DM_ETH=y
+CONFIG_MEDIATEK_ETH=y
+CONFIG_PINCTRL=y
+CONFIG_PINCONF=y
+CONFIG_PINCTRL_MT7981=y
+CONFIG_POWER_DOMAIN=y
+CONFIG_MTK_POWER_DOMAIN=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_SERIAL=y
+CONFIG_MTK_SERIAL=y
+CONFIG_HEXDUMP=y
+CONFIG_USE_DEFAULT_ENV_FILE=y
+CONFIG_CMD_SF=y
+CONFIG_LMB_MAX_REGIONS=64
+CONFIG_USE_IPADDR=y
+CONFIG_IPADDR="192.168.1.1"
+CONFIG_USE_SERVERIP=y
+CONFIG_SERVERIP="192.168.1.254"
--- /dev/null
+++ b/configs/mt7981_cmcc_rax3000m-nand_defconfig
@@ -0,0 +1,175 @@
+CONFIG_ARM=y
+CONFIG_POSITION_INDEPENDENT=y
+CONFIG_ARCH_MEDIATEK=y
+CONFIG_TARGET_MT7981=y
+CONFIG_TEXT_BASE=0x41e00000
+CONFIG_SYS_MALLOC_F_LEN=0x4000
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_DEFAULT_DEVICE_TREE="mt7981-cmcc-rax3000m-nand"
+CONFIG_DEFAULT_ENV_FILE="cmcc_rax3000m-nand_env"
+CONFIG_DEFAULT_FDT_FILE="mediatek/mt7981-cmcc-rax3000m-nand.dtb"
+CONFIG_OF_LIBFDT_OVERLAY=y
+CONFIG_DEBUG_UART_BASE=0x11002000
+CONFIG_DEBUG_UART_CLOCK=40000000
+CONFIG_DEBUG_UART=y
+CONFIG_SYS_LOAD_ADDR=0x46000000
+CONFIG_SMBIOS_PRODUCT_NAME=""
+CONFIG_AUTOBOOT_KEYED=y
+CONFIG_BOOTDELAY=30
+CONFIG_AUTOBOOT_MENU_SHOW=y
+CONFIG_CFB_CONSOLE_ANSI=y
+CONFIG_BOARD_LATE_INIT=y
+CONFIG_BUTTON=y
+CONFIG_BUTTON_GPIO=y
+CONFIG_GPIO_HOG=y
+CONFIG_CMD_ENV_FLAGS=y
+CONFIG_FIT=y
+CONFIG_FIT_ENABLE_SHA256_SUPPORT=y
+CONFIG_LED=y
+CONFIG_LED_BLINK=y
+CONFIG_LED_GPIO=y
+CONFIG_LOGLEVEL=7
+CONFIG_LOG=y
+CONFIG_SYS_PROMPT="MT7981> "
+CONFIG_CMD_BOOTMENU=y
+CONFIG_CMD_BOOTP=y
+CONFIG_CMD_BUTTON=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_CDP=y
+CONFIG_CMD_CPU=y
+CONFIG_CMD_DHCP=y
+CONFIG_CMD_DM=y
+CONFIG_CMD_DNS=y
+CONFIG_CMD_ECHO=y
+CONFIG_CMD_ENV_READMEM=y
+CONFIG_CMD_ERASEENV=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_FAT=y
+CONFIG_CMD_FDT=y
+CONFIG_CMD_FS_GENERIC=y
+CONFIG_CMD_FS_UUID=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_GPT=y
+CONFIG_CMD_HASH=y
+CONFIG_CMD_ITEST=y
+CONFIG_CMD_LED=y
+CONFIG_CMD_LICENSE=y
+CONFIG_CMD_LINK_LOCAL=y
+# CONFIG_CMD_MBR is not set
+CONFIG_CMD_PCI=y
+CONFIG_CMD_PSTORE=y
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
+CONFIG_CMD_SF_TEST=y
+CONFIG_CMD_PING=y
+CONFIG_CMD_PXE=y
+CONFIG_CMD_PWM=y
+CONFIG_CMD_SMC=y
+CONFIG_CMD_TFTPBOOT=y
+CONFIG_CMD_TFTPSRV=y
+CONFIG_CMD_UBI=y
+CONFIG_CMD_UBI_RENAME=y
+CONFIG_CMD_UBIFS=y
+CONFIG_CMD_ASKENV=y
+CONFIG_CMD_PART=y
+CONFIG_CMD_RARP=y
+CONFIG_CMD_SETEXPR=y
+CONFIG_CMD_SLEEP=y
+CONFIG_CMD_SNTP=y
+CONFIG_CMD_SOURCE=y
+CONFIG_CMD_STRINGS=y
+CONFIG_CMD_UUID=y
+CONFIG_DISPLAY_CPUINFO=y
+CONFIG_DM_MTD=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_REGULATOR_GPIO=y
+CONFIG_DM_PWM=y
+CONFIG_PWM_MTK=y
+CONFIG_HUSH_PARSER=y
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_VERSION_VARIABLE=y
+CONFIG_PARTITION_UUIDS=y
+CONFIG_NETCONSOLE=y
+CONFIG_REGMAP=y
+CONFIG_SYSCON=y
+CONFIG_CLK=y
+CONFIG_DM_GPIO=y
+CONFIG_DM_SCSI=y
+CONFIG_AHCI=y
+CONFIG_AHCI_PCI=y
+CONFIG_SCSI_AHCI=y
+CONFIG_SCSI=y
+CONFIG_CMD_SCSI=y
+CONFIG_PHY=y
+CONFIG_PHY_MTK_TPHY=y
+CONFIG_PHY_FIXED=y
+CONFIG_MTK_AHCI=y
+CONFIG_DM_ETH=y
+CONFIG_MEDIATEK_ETH=y
+CONFIG_PCI=y
+# CONFIG_MMC is not set
+# CONFIG_DM_MMC is not set
+CONFIG_MTD=y
+CONFIG_MTD_UBI_FASTMAP=y
+CONFIG_DM_PCI=y
+CONFIG_PCIE_MEDIATEK=y
+CONFIG_PINCTRL=y
+CONFIG_PINCONF=y
+CONFIG_PINCTRL_MT7622=y
+CONFIG_POWER_DOMAIN=y
+CONFIG_PRE_CONSOLE_BUFFER=y
+CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
+CONFIG_MTK_POWER_DOMAIN=y
+CONFIG_RAM=y
+CONFIG_DM_SERIAL=y
+CONFIG_MTK_SERIAL=y
+CONFIG_SPI=y
+CONFIG_DM_SPI=y
+CONFIG_MTK_SPI_NAND=y
+CONFIG_MTK_SPI_NAND_MTD=y
+CONFIG_SYSRESET_WATCHDOG=y
+CONFIG_WDT_MTK=y
+CONFIG_LZO=y
+CONFIG_ZSTD=y
+CONFIG_HEXDUMP=y
+CONFIG_RANDOM_UUID=y
+CONFIG_REGEX=y
+CONFIG_OF_EMBED=y
+CONFIG_ENV_OVERWRITE=y
+CONFIG_ENV_IS_IN_UBI=y
+CONFIG_ENV_UBI_PART="ubi"
+CONFIG_ENV_SIZE=0x1f000
+CONFIG_ENV_SIZE_REDUND=0x1f000
+CONFIG_ENV_UBI_VOLUME="ubootenv"
+CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2"
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_REGMAP=y
+CONFIG_SYSCON=y
+CONFIG_CLK=y
+CONFIG_PHY_FIXED=y
+CONFIG_DM_ETH=y
+CONFIG_MEDIATEK_ETH=y
+CONFIG_PINCTRL=y
+CONFIG_PINCONF=y
+CONFIG_PINCTRL_MT7981=y
+CONFIG_POWER_DOMAIN=y
+CONFIG_MTK_POWER_DOMAIN=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_SERIAL=y
+CONFIG_MTK_SERIAL=y
+CONFIG_HEXDUMP=y
+CONFIG_USE_DEFAULT_ENV_FILE=y
+CONFIG_MTD_SPI_NAND=y
+CONFIG_MTK_SPIM=y
+CONFIG_CMD_MTD=y
+CONFIG_CMD_NAND=y
+CONFIG_CMD_NAND_TRIMFFS=y
+CONFIG_LMB_MAX_REGIONS=64
+CONFIG_USE_IPADDR=y
+CONFIG_IPADDR="192.168.1.1"
+CONFIG_USE_SERVERIP=y
+CONFIG_SERVERIP="192.168.1.254"
--- /dev/null
+++ b/arch/arm/dts/mt7981-cmcc-rax3000m.dtsi
@@ -0,0 +1,85 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2022 MediaTek Inc.
+ * Author: Sam Shih <sam.shih@mediatek.com>
+ */
+
+/dts-v1/;
+#include "mt7981.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/linux-event-codes.h>
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ model = "CMCC RAX3000M";
+ compatible = "mediatek,mt7981", "mediatek,mt7981-rfb";
+
+ chosen {
+ stdout-path = &uart0;
+ tick-timer = &timer0;
+ };
+
+ memory@40000000 {
+ device_type = "memory";
+ reg = <0x40000000 0x20000000>;
+ };
+
+ keys {
+ compatible = "gpio-keys";
+
+ button-reset {
+ label = "reset";
+ linux,code = <KEY_RESTART>;
+ gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
+ };
+
+ button-mesh {
+ label = "mesh";
+ linux,code = <BTN_9>;
+ linux,input-type = <EV_SW>;
+ gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
+ };
+ };
+
+ leds {
+ compatible = "gpio-leds";
+
+ led-0 {
+ label = "green:status";
+ gpios = <&gpio 9 GPIO_ACTIVE_LOW>;
+ };
+
+ led-1 {
+ label = "blue:status";
+ gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
+ };
+
+ led-2 {
+ label = "red:status";
+ gpios = <&gpio 35 GPIO_ACTIVE_LOW>;
+ };
+ };
+};
+
+&eth {
+ status = "okay";
+ mediatek,gmac-id = <0>;
+ phy-mode = "2500base-x";
+ mediatek,switch = "mt7531";
+ reset-gpios = <&gpio 39 GPIO_ACTIVE_HIGH>;
+
+ fixed-link {
+ speed = <2500>;
+ full-duplex;
+ };
+};
+
+&uart0 {
+ mediatek,force-highspeed;
+ status = "okay";
+};
+
+&watchdog {
+ status = "disabled";
+};
--- /dev/null
+++ b/arch/arm/dts/mt7981-cmcc-rax3000m-emmc.dts
@@ -0,0 +1,53 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+/dts-v1/;
+#include "mt7981-cmcc-rax3000m.dtsi"
+
+/ {
+ reg_3p3v: regulator-3p3v {
+ compatible = "regulator-fixed";
+ regulator-name = "fixed-3.3V";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ regulator-boot-on;
+ regulator-always-on;
+ };
+};
+
+&mmc0 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&mmc0_pins_default>;
+ max-frequency = <26000000>;
+ bus-width = <8>;
+ cap-mmc-hw-reset;
+ vmmc-supply = <&reg_3p3v>;
+ non-removable;
+ status = "okay";
+};
+
+&pinctrl {
+ mmc0_pins_default: mmc0default {
+ mux {
+ function = "flash";
+ groups = "emmc_45";
+ };
+ conf-cmd-dat {
+ pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO",
+ "SPI0_CS", "SPI0_HOLD", "SPI0_WP",
+ "SPI1_CLK", "SPI1_MOSI", "SPI1_MISO";
+ input-enable;
+ drive-strength = <MTK_DRIVE_4mA>;
+ bias-pull-up = <MTK_PUPD_SET_R1R0_01>;
+ };
+ conf-clk {
+ pins = "SPI1_CS";
+ drive-strength = <MTK_DRIVE_6mA>;
+ bias-pull-down = <MTK_PUPD_SET_R1R0_10>;
+ };
+ conf-rst {
+ pins = "PWM0";
+ drive-strength = <MTK_DRIVE_4mA>;
+ bias-pull-up = <MTK_PUPD_SET_R1R0_01>;
+ };
+ };
+};
--- /dev/null
+++ b/arch/arm/dts/mt7981-cmcc-rax3000m-nand.dts
@@ -0,0 +1,77 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+/dts-v1/;
+#include "mt7981-cmcc-rax3000m.dtsi"
+
+&pinctrl {
+ spi_flash_pins: spi0-pins-func-1 {
+ mux {
+ function = "flash";
+ groups = "spi0", "spi0_wp_hold";
+ };
+
+ conf-pu {
+ pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP";
+ drive-strength = <MTK_DRIVE_8mA>;
+ bias-pull-up = <MTK_PUPD_SET_R1R0_00>;
+ };
+
+ conf-pd {
+ pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO";
+ drive-strength = <MTK_DRIVE_8mA>;
+ bias-pull-down = <MTK_PUPD_SET_R1R0_00>;
+ };
+ };
+};
+
+&spi0 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&spi_flash_pins>;
+ status = "okay";
+ must_tx;
+ enhance_timing;
+ dma_ext;
+ ipm_design;
+ support_quad;
+ tick_dly = <2>;
+ sample_sel = <0>;
+
+ spi_nand@0 {
+ compatible = "spi-nand";
+ reg = <0>;
+ spi-max-frequency = <52000000>;
+
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition@0 {
+ label = "bl2";
+ reg = <0x0 0x100000>;
+ };
+
+ partition@100000 {
+ label = "orig-env";
+ reg = <0x100000 0x80000>;
+ };
+
+ partition@160000 {
+ label = "factory";
+ reg = <0x180000 0x200000>;
+ };
+
+ partition@380000 {
+ label = "fip";
+ reg = <0x380000 0x200000>;
+ };
+
+ partition@580000 {
+ label = "ubi";
+ reg = <0x580000 0x7200000>;
+ };
+ };
+ };
+};
--- /dev/null
+++ b/cmcc_rax3000m-emmc_env
@@ -0,0 +1,55 @@
+ipaddr=192.168.1.1
+serverip=192.168.1.254
+loadaddr=0x46000000
+console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0
+bootargs=root=/dev/mmcblk0p65
+bootcmd=if pstore check ; then run boot_recovery ; else run boot_emmc ; fi
+bootconf=config-1#mt7981b-cmcc-rax3000m-emmc
+bootdelay=0
+bootfile=openwrt-mediatek-filogic-cmcc_rax3000m-initramfs-recovery.itb
+bootfile_bl2=openwrt-mediatek-filogic-cmcc_rax3000m-emmc-preloader.bin
+bootfile_fip=openwrt-mediatek-filogic-cmcc_rax3000m-emmc-bl31-uboot.fip
+bootfile_upg=openwrt-mediatek-filogic-cmcc_rax3000m-squashfs-sysupgrade.itb
+bootled_pwr=red:status
+bootled_rec=blue:status
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
+bootmenu_default=0
+bootmenu_delay=0
+bootmenu_title= ( ( ( OpenWrt ) ) ) [eMMC]
+bootmenu_0=Initialize environment.=run _firstboot
+bootmenu_0d=Run default boot command.=run boot_default
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
+bootmenu_2=Boot production system from eMMC.=run boot_production ; run bootmenu_confirm_return
+bootmenu_3=Boot recovery system from eMMC.=run boot_recovery ; run bootmenu_confirm_return
+bootmenu_4=Load production system via TFTP then write to eMMC.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
+bootmenu_5=Load recovery system via TFTP then write to eMMC.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
+bootmenu_6=Load BL31+U-Boot FIP via TFTP then write to eMMC.=run boot_tftp_write_fip ; run bootmenu_confirm_return
+bootmenu_7=Load BL2 preloader via TFTP then write to eMMC.=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
+bootmenu_8=Reboot.=reset
+bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
+boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
+boot_production=led $bootled_pwr on ; run emmc_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off
+boot_recovery=led $bootled_rec on ; run emmc_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off
+boot_emmc=run boot_production ; run boot_recovery
+boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done
+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run emmc_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
+boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run emmc_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
+boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run emmc_write_fip
+boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run emmc_write_bl2
+boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
+mmc_write_vol=imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc erase 0x$part_addr 0x$image_size && mmc write $loadaddr 0x$part_addr 0x$image_size
+mmc_read_vol=mmc read $loadaddr $part_addr 0x100 && imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc read $loadaddr 0x$part_addr 0x$image_size && setexpr filesize $image_size * 0x200
+part_default=production
+part_recovery=recovery
+reset_factory=eraseenv && reset
+emmc_read_production=part start mmc 0 $part_default part_addr && part size mmc 0 $part_default part_size && run mmc_read_vol
+emmc_read_recovery=part start mmc 0 $part_recovery part_addr && part size mmc 0 $part_recovery part_size && run mmc_read_vol
+emmc_write_bl2=mmc partconf 0 1 1 1 && mmc erase 0x0 0x400 && mmc write $fileaddr 0x0 0x400 ; mmc partconf 0 1 1 0
+emmc_write_fip=mmc erase 0x3400 0x2000 && mmc write $fileaddr 0x3400 0x2000 && mmc erase 0x2000 0x800
+emmc_write_production=part start mmc 0 $part_default part_addr && part size mmc 0 $part_default part_size && run mmc_write_vol
+emmc_write_recovery=part start mmc 0 $part_recovery part_addr && part size mmc 0 $part_recovery part_size && run mmc_write_vol
+_init_env=setenv _init_env ; setenv _create_env ; saveenv ; saveenv
+_firstboot=setenv _firstboot ; run _switch_to_menu ; run _init_env ; run boot_first
+_switch_to_menu=setenv _switch_to_menu ; setenv bootdelay 3 ; setenv bootmenu_delay 3 ; setenv bootmenu_0 $bootmenu_0d ; setenv bootmenu_0d ; run _bootmenu_update_title
+_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title $ver"
--- /dev/null
+++ b/cmcc_rax3000m-nand_env
@@ -0,0 +1,56 @@
+ipaddr=192.168.1.1
+serverip=192.168.1.254
+loadaddr=0x46000000
+console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0
+bootconf=config-1#mt7981b-cmcc-rax3000m-nand
+bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi
+bootdelay=0
+bootfile=openwrt-mediatek-filogic-cmcc_rax3000m-initramfs-recovery.itb
+bootfile_bl2=openwrt-mediatek-filogic-cmcc_rax3000m-nand-preloader.bin
+bootfile_fip=openwrt-mediatek-filogic-cmcc_rax3000m-nand-bl31-uboot.fip
+bootfile_upg=openwrt-mediatek-filogic-cmcc_rax3000m-squashfs-sysupgrade.itb
+bootled_pwr=red:status
+bootled_rec=blue:status
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
+bootmenu_default=0
+bootmenu_delay=0
+bootmenu_title= ( ( ( OpenWrt ) ) ) [SPI-NAND]
+bootmenu_0=Initialize environment.=run _firstboot
+bootmenu_0d=Run default boot command.=run boot_default
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
+bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return
+bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return
+bootmenu_4=Load production system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
+bootmenu_5=Load recovery system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
+bootmenu_6=Load BL31+U-Boot FIP via TFTP then write to NAND.=run boot_tftp_write_fip ; run bootmenu_confirm_return
+bootmenu_7=Load BL2 preloader via TFTP then write to NAND.=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
+bootmenu_8=Reboot.=reset
+bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
+boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
+boot_production=led $bootled_pwr on ; run ubi_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off
+boot_recovery=led $bootled_rec on ; run ubi_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off
+boot_ubi=run boot_production ; run boot_recovery ; run boot_tftp_forever
+boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done
+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run ubi_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
+boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
+boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
+boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run mtd_write_fip && run reset_factory
+boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run mtd_write_bl2
+part_default=production
+part_recovery=recovery
+reset_factory=ubi part ubi ; mw $loadaddr 0x0 0x800 ; ubi write $loadaddr ubootenv 0x800 ; ubi write $loadaddr ubootenv2 0x800
+mtd_write_fip=mtd erase fip && mtd write fip $loadaddr
+mtd_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr
+ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x100000 dynamic 0 || run ubi_format ; ubi check ubootenv2 || ubi create ubootenv2 0x100000 dynamic 1 || run ubi_format
+ubi_format=ubi detach ; mtd erase ubi && ubi part ubi ; reset
+ubi_prepare_rootfs=if ubi check rootfs_data ; then else if env exists rootfs_data_max ; then ubi create rootfs_data $rootfs_data_max dynamic || ubi create rootfs_data - dynamic ; else ubi create rootfs_data - dynamic ; fi ; fi
+ubi_read_production=ubi read $loadaddr fit && iminfo $loadaddr && run ubi_prepare_rootfs
+ubi_read_recovery=ubi check recovery && ubi read $loadaddr recovery
+ubi_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data
+ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic 2 && ubi write $loadaddr fit $filesize
+ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic 3 && ubi write $loadaddr recovery $filesize
+_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv
+_firstboot=setenv _firstboot ; run _switch_to_menu ; run _init_env ; run boot_first
+_switch_to_menu=setenv _switch_to_menu ; setenv bootdelay 3 ; setenv bootmenu_delay 3 ; setenv bootmenu_0 $bootmenu_0d ; setenv bootmenu_0d ; run _bootmenu_update_title
+_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title $ver"

View file

@ -6,9 +6,9 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/firmware/qca-wireless.git
PKG_SOURCE_DATE:=2023-09-16
PKG_SOURCE_VERSION:=57aa1b1562ac60f11a6bec8be02cd3b68b12b3fa
PKG_MIRROR_HASH:=f8f9ab78ae85180a6e601d7c911d6c350b0cc132172d4baefc8f9fe07566ce0f
PKG_SOURCE_DATE:=2023-10-12
PKG_SOURCE_VERSION:=cd04ab7f984fe28613276c01fd0ac7afbe5516d5
PKG_MIRROR_HASH:=857ae436fd09785749411a665b31c82cec84b68b1e096f69ebb6c2a0efb5583f
PKG_FLAGS:=nonshared
@ -36,6 +36,7 @@ ALLWIFIBOARDS:= \
netgear_rax120v2 \
netgear_wax218 \
netgear_wax620 \
netgear_wax630 \
prpl_haze \
qnap_301w \
redmi_ax6 \
@ -142,6 +143,7 @@ $(eval $(call generate-ipq-wifi-package,edimax_cax1800,Edimax CAX1800))
$(eval $(call generate-ipq-wifi-package,netgear_rax120v2,Netgear RAX120v2))
$(eval $(call generate-ipq-wifi-package,netgear_wax218,Netgear WAX218))
$(eval $(call generate-ipq-wifi-package,netgear_wax620,Netgear WAX620))
$(eval $(call generate-ipq-wifi-package,netgear_wax630,Netgear WAX630))
$(eval $(call generate-ipq-wifi-package,qnap_301w,QNAP 301w))
$(eval $(call generate-ipq-wifi-package,prpl_haze,prpl Haze))
$(eval $(call generate-ipq-wifi-package,redmi_ax6,Redmi AX6))

View file

@ -496,12 +496,12 @@ $(eval $(call KernelPackage,nbd))
define KernelPackage/nvme
SUBMENU:=$(BLOCK_MENU)
TITLE:=NVM Express block device
DEPENDS:=@PCI_SUPPORT
DEPENDS:=@PCI_SUPPORT +kmod-hwmon-core
KCONFIG:= \
CONFIG_NVME_CORE \
CONFIG_BLK_DEV_NVME \
CONFIG_NVME_MULTIPATH=n \
CONFIG_NVME_HWMON=n
CONFIG_NVME_HWMON=y
FILES:= \
$(LINUX_DIR)/drivers/nvme/host/nvme-core.ko \
$(LINUX_DIR)/drivers/nvme/host/nvme.ko

View file

@ -534,7 +534,6 @@ $(eval $(call KernelPackage,usb-wdm))
define KernelPackage/usb-audio
TITLE:=Support for USB audio devices
KCONFIG:= \
CONFIG_USB_AUDIO \
CONFIG_SND_USB=y \
CONFIG_SND_USB_AUDIO
$(call AddDepends/usb)

View file

@ -0,0 +1,47 @@
--- a/Makefile.real
+++ b/Makefile.real
@@ -6,6 +6,18 @@ else
export BACKPORTS_GIT_TRACKER_DEF=
endif
+ifneq ($(LLVM),)
+ifneq ($(filter %/,$(LLVM)),)
+LLVM_PREFIX := $(LLVM)
+else ifneq ($(filter -%,$(LLVM)),)
+LLVM_SUFFIX := $(LLVM)
+endif
+
+HOSTCC = $(LLVM_PREFIX)clang$(LLVM_SUFFIX)
+else
+HOSTCC = gcc
+endif
+
# disable built-in rules for this file
.SUFFIXES:
@@ -24,21 +36,21 @@ listnewconfig oldaskconfig oldconfig \
silentoldconfig olddefconfig oldnoconfig \
allnoconfig allyesconfig allmodconfig \
alldefconfig randconfig:
- @$(MAKE) -C kconf conf
+ @$(MAKE) -C kconf CC=$(HOSTCC) conf
@./kconf/conf --$@ Kconfig
.PHONY: usedefconfig
usedefconfig:
- @$(MAKE) -C kconf conf
+ @$(MAKE) -C kconf CC=$(HOSTCC) conf
@./kconf/conf --defconfig=defconfig Kconfig
.PHONY: savedefconfig
savedefconfig:
- @$(MAKE) -C kconf conf
+ @$(MAKE) -C kconf CC=$(HOSTCC) conf
@./kconf/conf --savedefconfig=defconfig Kconfig
defconfig-%::
- @$(MAKE) -C kconf conf
+ @$(MAKE) -C kconf CC=$(HOSTCC) conf
@./kconf/conf --defconfig=defconfigs/$(@:defconfig-%=%) Kconfig
.config:

View file

@ -12,9 +12,9 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/odhcpd.git
PKG_MIRROR_HASH:=e2e00e2bb6b7bacda5dcb713e4f9a4b1e316d75b140a4aa77145471bf6fe5c17
PKG_SOURCE_DATE:=2023-06-24
PKG_SOURCE_VERSION:=52112643308bb02a3b4fa2894dd7d4340ba4a237
PKG_MIRROR_HASH:=9936331b64880260cf969cc5656e1e1a8b7dc0e0843d64621242c500a330b4d6
PKG_SOURCE_DATE:=2023-10-24
PKG_SOURCE_VERSION:=d8118f6e76e5519881f9a37137c3a06b3cb60fd2
PKG_MAINTAINER:=Hans Dedecker <dedeckeh@gmail.com>
PKG_LICENSE:=GPL-2.0

View file

@ -12,21 +12,31 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=https://github.com/jow-/ucode.git
PKG_SOURCE_DATE:=2023-06-06
PKG_SOURCE_VERSION:=c7d84aae09691a99ae3db427c0b2463732ef84f4
PKG_MIRROR_HASH:=38826ae70d886d1d7ada3fc6591ac807169aa28107f60f7f2e617520083525fb
PKG_SOURCE_DATE:=2023-10-19
PKG_SOURCE_VERSION:=07c03173d4e6a30953f92fa88ed29b0b956c9106
PKG_MIRROR_HASH:=fd770335f442ebfc0f4e28d94bb60d886c43aa239ab88e965be7c490b3283a82
PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
PKG_LICENSE:=ISC
PKG_ABI_VERSION:=20220812
PKG_ABI_VERSION:=20230711
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/cmake.mk
CMAKE_OPTIONS += -DSOVERSION=$(PKG_ABI_VERSION)
ifeq ($(HOST_OS),Darwin)
CMAKE_HOST_OPTIONS += \
-DCMAKE_SKIP_RPATH=FALSE \
-DCMAKE_MACOSX_RPATH=1 \
-DCMAKE_INSTALL_RPATH="${STAGING_DIR_HOSTPKG}/lib"
else
CMAKE_HOST_OPTIONS += \
-DSOVERSION=$(PKG_ABI_VERSION)
endif
CMAKE_HOST_OPTIONS += \
-DSOVERSION=$(PKG_ABI_VERSION) \
-DFS_SUPPORT=ON \
-DMATH_SUPPORT=ON \
-DNL80211_SUPPORT=OFF \
@ -35,7 +45,9 @@ CMAKE_HOST_OPTIONS += \
-DSTRUCT_SUPPORT=ON \
-DUBUS_SUPPORT=OFF \
-DUCI_SUPPORT=OFF \
-DULOOP_SUPPORT=OFF
-DULOOP_SUPPORT=OFF \
-DDEBUG_SUPPORT=ON \
-DLOG_SUPPORT=OFF
define Package/ucode/default
@ -70,105 +82,29 @@ define Package/libucode/description
The libucode package provides the shared runtime library for the ucode interpreter.
endef
# 1: name
# 2: cmake symbol
# 3: depends
# 4: description
define UcodeModule
UCODE_MODULES += ucode-mod-$(strip $(1))
CMAKE_OPTIONS += -D$(strip $(2))=$(if $(CONFIG_PACKAGE_ucode-mod-$(strip $(1))),ON,OFF)
PKG_CONFIG_DEPENDS += CONFIG_PACKAGE_ucode-mod-$(strip $(1))
define Package/ucode-mod-fs
define Package/ucode-mod-$(strip $(1))
$(Package/ucode/default)
TITLE+= (filesystem module)
DEPENDS:=ucode
endef
TITLE+= ($(strip $(1)) module)
DEPENDS:=ucode $(3)
endef
define Package/ucode-mod-fs/description
The filesystem plugin module allows interaction with the local file system.
endef
define Package/ucode-mod-$(strip $(1))/description
$(strip $(4))
endef
define Package/ucode-mod-math
$(Package/ucode/default)
TITLE+= (math module)
DEPENDS:=ucode
endef
define Package/ucode-mod-math/description
The math plugin provides access to various <math.h> procedures.
endef
define Package/ucode-mod-nl80211
$(Package/ucode/default)
TITLE+= (nl80211 module)
DEPENDS:=ucode +libnl-tiny +libubox
endef
define Package/ucode-mod-nl80211/description
The nl80211 plugin provides access to the Linux wireless 802.11 netlink API.
endef
define Package/ucode-mod-resolv
$(Package/ucode/default)
TITLE+= (resolv module)
DEPENDS:=ucode
endef
define Package/ucode-mod-resolv/description
The resolv plugin implements simple DNS resolving.
endef
define Package/ucode-mod-rtnl
$(Package/ucode/default)
TITLE+= (rtnl module)
DEPENDS:=ucode +libnl-tiny +libubox
endef
define Package/ucode-mod-rtnl/description
The rtnl plugin provides access to the Linux routing netlink API.
endef
define Package/ucode-mod-struct
$(Package/ucode/default)
TITLE+= (struct module)
DEPENDS:=ucode
endef
define Package/ucode-mod-struct/description
The struct plugin implements Python 3 compatible struct.pack/unpack functionality.
endef
define Package/ucode-mod-ubus
$(Package/ucode/default)
TITLE+= (ubus module)
DEPENDS:=ucode +libubus +libblobmsg-json
endef
define Package/ucode-mod-ubus/description
The ubus module allows ucode template scripts to enumerate and invoke ubus
procedures.
endef
define Package/ucode-mod-uci
$(Package/ucode/default)
TITLE+= (uci module)
DEPENDS:=ucode +libuci
endef
define Package/ucode-mod-uci/description
The uci module allows templates to read and modify uci configuration.
endef
define Package/ucode-mod-uloop
$(Package/ucode/default)
TITLE+= (uloop module)
DEPENDS:=ucode +libubox
endef
define Package/ucode-mod-uloop/description
The uloop module allows ucode scripts to interact with OpenWrt uloop event
loop implementation.
define Package/ucode-mod-$(strip $(1))/install
$(INSTALL_DIR) $$(1)/usr/lib/ucode
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/$(strip $(1)).so $$(1)/usr/lib/ucode/
endef
endef
@ -189,60 +125,55 @@ define Package/libucode/install
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libucode.so.* $(1)/usr/lib/
endef
define Package/ucode-mod-fs/install
$(INSTALL_DIR) $(1)/usr/lib/ucode
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/fs.so $(1)/usr/lib/ucode/
endef
define Package/ucode-mod-math/install
$(INSTALL_DIR) $(1)/usr/lib/ucode
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/math.so $(1)/usr/lib/ucode/
endef
$(eval $(call UcodeModule, \
debug, DEBUG_SUPPORT, +libubox +libucode, \
The debug plugin module provides runtime debugging and introspection facilities.))
define Package/ucode-mod-nl80211/install
$(INSTALL_DIR) $(1)/usr/lib/ucode
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/nl80211.so $(1)/usr/lib/ucode/
endef
$(eval $(call UcodeModule, \
fs, FS_SUPPORT, , \
The filesystem plugin module allows interaction with the local file system.))
define Package/ucode-mod-resolv/install
$(INSTALL_DIR) $(1)/usr/lib/ucode
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/resolv.so $(1)/usr/lib/ucode/
endef
$(eval $(call UcodeModule, \
log, LOG_SUPPORT, +libubox, \
The log plugin module provides access to the syslog and libubox ulog APIs.))
define Package/ucode-mod-rtnl/install
$(INSTALL_DIR) $(1)/usr/lib/ucode
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/rtnl.so $(1)/usr/lib/ucode/
endef
$(eval $(call UcodeModule, \
math, MATH_SUPPORT, , \
The math plugin provides access to various <math.h> procedures.))
define Package/ucode-mod-struct/install
$(INSTALL_DIR) $(1)/usr/lib/ucode
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/struct.so $(1)/usr/lib/ucode/
endef
$(eval $(call UcodeModule, \
nl80211, NL80211_SUPPORT, +libnl-tiny +libubox, \
The nl80211 plugin provides access to the Linux wireless 802.11 netlink API.))
define Package/ucode-mod-ubus/install
$(INSTALL_DIR) $(1)/usr/lib/ucode
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/ubus.so $(1)/usr/lib/ucode/
endef
$(eval $(call UcodeModule, \
resolv, RESOLV_SUPPORT, , \
The resolv plugin implements simple DNS resolving.))
define Package/ucode-mod-uci/install
$(INSTALL_DIR) $(1)/usr/lib/ucode
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/uci.so $(1)/usr/lib/ucode/
endef
$(eval $(call UcodeModule, \
rtnl, RTNL_SUPPORT, +libnl-tiny +libubox, \
The rtnl plugin provides access to the Linux routing netlink API.))
define Package/ucode-mod-uloop/install
$(INSTALL_DIR) $(1)/usr/lib/ucode
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/uloop.so $(1)/usr/lib/ucode/
endef
$(eval $(call UcodeModule, \
struct, STRUCT_SUPPORT, , \
The struct plugin implements Python 3 compatible struct.pack/unpack functionality.))
$(eval $(call UcodeModule, \
ubus, UBUS_SUPPORT, +libubus +libblobmsg-json, \
The ubus module allows ucode template scripts to enumerate and invoke ubus procedures.))
$(eval $(call UcodeModule, \
uci, UCI_SUPPORT, +libuci, \
The uci module allows templates to read and modify uci configuration.))
$(eval $(call UcodeModule, \
uloop, ULOOP_SUPPORT, +libubox, \
The uloop module allows ucode scripts to interact with OpenWrt uloop event loop implementation.))
$(eval $(call BuildPackage,libucode))
$(eval $(call BuildPackage,ucode))
$(eval $(call BuildPackage,ucode-mod-fs))
$(eval $(call BuildPackage,ucode-mod-math))
$(eval $(call BuildPackage,ucode-mod-nl80211))
$(eval $(call BuildPackage,ucode-mod-resolv))
$(eval $(call BuildPackage,ucode-mod-rtnl))
$(eval $(call BuildPackage,ucode-mod-struct))
$(eval $(call BuildPackage,ucode-mod-ubus))
$(eval $(call BuildPackage,ucode-mod-uci))
$(eval $(call BuildPackage,ucode-mod-uloop))
$(foreach mod,$(UCODE_MODULES), \
$(eval $(call BuildPackage,$(mod))))
$(eval $(call HostBuild))

View file

@ -82,7 +82,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
}
}
@@ -1241,9 +1278,14 @@ static const u16 bcm_sf2_4908_reg_offset
@@ -1247,9 +1284,14 @@ static const u16 bcm_sf2_4908_reg_offset
[REG_SPHY_CNTRL] = 0x24,
[REG_CROSSBAR] = 0xc8,
[REG_RGMII_11_CNTRL] = 0x014c,

View file

@ -29,7 +29,7 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -1542,10 +1542,14 @@ static int bcm_sf2_sw_probe(struct platf
@@ -1548,10 +1548,14 @@ static int bcm_sf2_sw_probe(struct platf
rev = reg_readl(priv, REG_PHY_REVISION);
priv->hw_params.gphy_rev = rev & PHY_REVISION_MASK;

View file

@ -15,7 +15,7 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -1556,6 +1556,12 @@ static int bcm_sf2_sw_probe(struct platf
@@ -1562,6 +1562,12 @@ static int bcm_sf2_sw_probe(struct platf
priv->hw_params.core_rev >> 8, priv->hw_params.core_rev & 0xff,
priv->irq0, priv->irq1);

View file

@ -90,41 +90,23 @@ it on BCM4708 family.
/*
* Reset a halted HC.
*
@@ -611,10 +654,20 @@ static int xhci_init(struct usb_hcd *hcd
static int xhci_run_finished(struct xhci_hcd *xhci)
{
- if (xhci_start(xhci)) {
- xhci_halt(xhci);
- return -ENODEV;
+ int err;
+
+ err = xhci_start(xhci);
+ if (err) {
+ err = -ENODEV;
+ goto err_halt;
@@ -634,6 +677,16 @@ static int xhci_run_finished(struct xhci
spin_unlock_irqrestore(&xhci->lock, flags);
return -ENODEV;
}
+
+ if (xhci->quirks & XHCI_FAKE_DOORBELL) {
+ err = xhci_fake_doorbell(xhci, 1);
+ if (err)
+ goto err_halt;
+ int err = xhci_fake_doorbell(xhci, 1);
+ if (err) {
+ xhci_halt(xhci);
+ spin_unlock_irqrestore(&xhci->lock, flags);
+ return err;
+ }
+ }
+
xhci->shared_hcd->state = HC_STATE_RUNNING;
xhci->cmd_ring_state = CMD_RING_STATE_RUNNING;
@@ -624,6 +677,10 @@ static int xhci_run_finished(struct xhci
xhci_dbg_trace(xhci, trace_xhci_dbg_init,
"Finished xhci_run for USB3 roothub");
return 0;
+
+err_halt:
+ xhci_halt(xhci);
+ return err;
}
/*
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1908,6 +1908,7 @@ struct xhci_hcd {

View file

@ -90,7 +90,7 @@ it on BCM4708 family.
/*
* Reset a halted HC.
*
@@ -641,6 +684,14 @@ static int xhci_run_finished(struct xhci
@@ -641,6 +684,15 @@ static int xhci_run_finished(struct xhci
return -ENODEV;
}
@ -98,6 +98,7 @@ it on BCM4708 family.
+ int err = xhci_fake_doorbell(xhci, 1);
+ if (err) {
+ xhci_halt(xhci);
+ spin_unlock_irqrestore(&xhci->lock, flags);
+ return err;
+ }
+ }

View file

@ -256,7 +256,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -763,6 +763,10 @@ int dev_fill_forward_path(const struct n
@@ -769,6 +769,10 @@ int dev_fill_forward_path(const struct n
if (WARN_ON_ONCE(last_dev == ctx.dev))
return -1;
}

View file

@ -304,7 +304,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
}
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -686,7 +686,7 @@ static void bcm_sf2_sw_validate(struct d
@@ -692,7 +692,7 @@ static void bcm_sf2_sw_validate(struct d
state->interface != PHY_INTERFACE_MODE_GMII &&
state->interface != PHY_INTERFACE_MODE_INTERNAL &&
state->interface != PHY_INTERFACE_MODE_MOCA) {
@ -313,7 +313,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
if (port != core_readl(priv, CORE_IMP0_PRT_ID))
dev_err(ds->dev,
"Unsupported interface: %d for port %d\n",
@@ -714,10 +714,8 @@ static void bcm_sf2_sw_validate(struct d
@@ -720,10 +720,8 @@ static void bcm_sf2_sw_validate(struct d
phylink_set(mask, 100baseT_Half);
phylink_set(mask, 100baseT_Full);

View file

@ -73,7 +73,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
/* Specifies the type of the struct net_device::ml_priv pointer */
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1222,22 +1222,6 @@ int dev_change_name(struct net_device *d
@@ -1242,22 +1242,6 @@ int dev_change_name(struct net_device *d
net = dev_net(dev);
@ -96,7 +96,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
down_write(&devnet_rename_sem);
if (strncmp(newname, dev->name, IFNAMSIZ) == 0) {
@@ -1254,7 +1238,8 @@ int dev_change_name(struct net_device *d
@@ -1274,7 +1258,8 @@ int dev_change_name(struct net_device *d
}
if (oldname[0] && !strchr(oldname, '%'))

View file

@ -0,0 +1,28 @@
From 414a98abbefd82d591f4e2d1efd2917bcd3b6f6d Mon Sep 17 00:00:00 2001
From: Peng Fan <peng.fan@nxp.com>
Date: Fri, 13 Oct 2023 13:49:02 +0100
Subject: [PATCH] nvmem: imx: correct nregs for i.MX6SLL
The nregs for i.MX6SLL should be 80 per fuse map, correct it.
Fixes: 6da27821a6f5 ("nvmem: imx-ocotp: add support for imx6sll")
Cc: Stable@vger.kernel.org
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20231013124904.175782-2-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/nvmem/imx-ocotp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/nvmem/imx-ocotp.c
+++ b/drivers/nvmem/imx-ocotp.c
@@ -499,7 +499,7 @@ static const struct ocotp_params imx6sl_
};
static const struct ocotp_params imx6sll_params = {
- .nregs = 128,
+ .nregs = 80,
.bank_address_words = 0,
.set_timing = imx_ocotp_set_imx6_timing,
.ctrl = IMX_OCOTP_BM_CTRL_DEFAULT,

View file

@ -0,0 +1,28 @@
From 7d6e10f5d254681983b53d979422c8de3fadbefb Mon Sep 17 00:00:00 2001
From: Peng Fan <peng.fan@nxp.com>
Date: Fri, 13 Oct 2023 13:49:03 +0100
Subject: [PATCH] nvmem: imx: correct nregs for i.MX6UL
The nregs for i.MX6UL should be 144 per fuse map, correct it.
Fixes: 4aa2b4802046 ("nvmem: octop: Add support for imx6ul")
Cc: Stable@vger.kernel.org
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20231013124904.175782-3-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/nvmem/imx-ocotp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/nvmem/imx-ocotp.c
+++ b/drivers/nvmem/imx-ocotp.c
@@ -513,7 +513,7 @@ static const struct ocotp_params imx6sx_
};
static const struct ocotp_params imx6ul_params = {
- .nregs = 128,
+ .nregs = 144,
.bank_address_words = 0,
.set_timing = imx_ocotp_set_imx6_timing,
.ctrl = IMX_OCOTP_BM_CTRL_DEFAULT,

View file

@ -0,0 +1,28 @@
From 2382c1b044231fd49eaf9aa82bc7113fc55487b8 Mon Sep 17 00:00:00 2001
From: Peng Fan <peng.fan@nxp.com>
Date: Fri, 13 Oct 2023 13:49:04 +0100
Subject: [PATCH] nvmem: imx: correct nregs for i.MX6ULL
The nregs for i.MX6ULL should be 80 per fuse map, correct it.
Fixes: ffbc34bf0e9c ("nvmem: imx-ocotp: Implement i.MX6ULL/ULZ support")
Cc: Stable@vger.kernel.org
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20231013124904.175782-4-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/nvmem/imx-ocotp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/nvmem/imx-ocotp.c
+++ b/drivers/nvmem/imx-ocotp.c
@@ -520,7 +520,7 @@ static const struct ocotp_params imx6ul_
};
static const struct ocotp_params imx6ull_params = {
- .nregs = 64,
+ .nregs = 80,
.bank_address_words = 0,
.set_timing = imx_ocotp_set_imx6_timing,
.ctrl = IMX_OCOTP_BM_CTRL_DEFAULT,

View file

@ -0,0 +1,37 @@
From 16724d6ea40a2c9315f5a0d81005dfa4d7a6da24 Mon Sep 17 00:00:00 2001
From: Luca Weiss <luca.weiss@fairphone.com>
Date: Fri, 20 Oct 2023 11:55:40 +0100
Subject: [PATCH] nvmem: qfprom: Mark core clk as optional
On some platforms like sc7280 on non-ChromeOS devices the core clock
cannot be touched by Linux so we cannot provide it. Mark it as optional
as accessing qfprom for reading works without it but we still prohibit
writing if we cannot provide the clock.
Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20231020105545.216052-2-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/nvmem/qfprom.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- a/drivers/nvmem/qfprom.c
+++ b/drivers/nvmem/qfprom.c
@@ -423,12 +423,12 @@ static int qfprom_probe(struct platform_
if (IS_ERR(priv->vcc))
return PTR_ERR(priv->vcc);
- priv->secclk = devm_clk_get(dev, "core");
+ priv->secclk = devm_clk_get_optional(dev, "core");
if (IS_ERR(priv->secclk))
return dev_err_probe(dev, PTR_ERR(priv->secclk), "Error getting clock\n");
- /* Only enable writing if we have SoC data. */
- if (priv->soc_data)
+ /* Only enable writing if we have SoC data and a valid clock */
+ if (priv->soc_data && priv->secclk)
econfig.reg_write = qfprom_reg_write;
}

View file

@ -0,0 +1,330 @@
From 2cc3b37f5b6df8189d55d0e812d9658ce256dfec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
Date: Fri, 20 Oct 2023 11:55:41 +0100
Subject: [PATCH] nvmem: add explicit config option to read old syntax fixed OF
cells
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Binding for fixed NVMEM cells defined directly as NVMEM device subnodes
has been deprecated. It has been replaced by the "fixed-layout" NVMEM
layout binding.
New syntax is meant to be clearer and should help avoiding imprecise
bindings.
NVMEM subsystem already supports the new binding. It should be a good
idea to limit support for old syntax to existing drivers that actually
support & use it (we can't break backward compatibility!). That way we
additionally encourage new bindings & drivers to ignore deprecated
binding.
It wasn't clear (to me) if rtc and w1 code actually uses old syntax
fixed cells. I enabled them to don't risk any breakage.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
[for meson-{efuse,mx-efuse}.c]
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
[for mtk-efuse.c, nvmem/core.c, nvmem-provider.h]
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
[MT8192, MT8195 Chromebooks]
Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
[for microchip-otpc.c]
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
[SAMA7G5-EK]
Tested-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20231020105545.216052-3-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/mtd/mtdcore.c | 2 ++
drivers/nvmem/apple-efuses.c | 1 +
drivers/nvmem/core.c | 8 +++++---
drivers/nvmem/imx-ocotp-scu.c | 1 +
drivers/nvmem/imx-ocotp.c | 1 +
drivers/nvmem/meson-efuse.c | 1 +
drivers/nvmem/meson-mx-efuse.c | 1 +
drivers/nvmem/microchip-otpc.c | 1 +
drivers/nvmem/mtk-efuse.c | 1 +
drivers/nvmem/qcom-spmi-sdam.c | 1 +
drivers/nvmem/qfprom.c | 1 +
drivers/nvmem/rave-sp-eeprom.c | 1 +
drivers/nvmem/rockchip-efuse.c | 1 +
drivers/nvmem/sc27xx-efuse.c | 1 +
drivers/nvmem/sec-qfprom.c | 1 +
drivers/nvmem/sprd-efuse.c | 1 +
drivers/nvmem/stm32-romem.c | 1 +
drivers/nvmem/sunplus-ocotp.c | 1 +
drivers/nvmem/sunxi_sid.c | 1 +
drivers/nvmem/uniphier-efuse.c | 1 +
drivers/nvmem/zynqmp_nvmem.c | 1 +
drivers/rtc/nvmem.c | 1 +
drivers/w1/slaves/w1_ds250x.c | 1 +
include/linux/nvmem-provider.h | 2 ++
24 files changed, 30 insertions(+), 3 deletions(-)
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -541,6 +541,7 @@ static int mtd_nvmem_add(struct mtd_info
config.dev = &mtd->dev;
config.name = dev_name(&mtd->dev);
config.owner = THIS_MODULE;
+ config.add_legacy_fixed_of_cells = of_device_is_compatible(node, "nvmem-cells");
config.reg_read = mtd_nvmem_reg_read;
config.size = mtd->size;
config.word_size = 1;
@@ -898,6 +899,7 @@ static struct nvmem_device *mtd_otp_nvme
config.name = compatible;
config.id = NVMEM_DEVID_AUTO;
config.owner = THIS_MODULE;
+ config.add_legacy_fixed_of_cells = true;
config.type = NVMEM_TYPE_OTP;
config.root_only = true;
config.ignore_wp = true;
--- a/drivers/nvmem/apple-efuses.c
+++ b/drivers/nvmem/apple-efuses.c
@@ -36,6 +36,7 @@ static int apple_efuses_probe(struct pla
struct resource *res;
struct nvmem_config config = {
.dev = &pdev->dev,
+ .add_legacy_fixed_of_cells = true,
.read_only = true,
.reg_read = apple_efuses_read,
.stride = sizeof(u32),
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -998,9 +998,11 @@ struct nvmem_device *nvmem_register(cons
if (rval)
goto err_remove_cells;
- rval = nvmem_add_cells_from_legacy_of(nvmem);
- if (rval)
- goto err_remove_cells;
+ if (config->add_legacy_fixed_of_cells) {
+ rval = nvmem_add_cells_from_legacy_of(nvmem);
+ if (rval)
+ goto err_remove_cells;
+ }
rval = nvmem_add_cells_from_fixed_layout(nvmem);
if (rval)
--- a/drivers/nvmem/imx-ocotp-scu.c
+++ b/drivers/nvmem/imx-ocotp-scu.c
@@ -220,6 +220,7 @@ static int imx_scu_ocotp_write(void *con
static struct nvmem_config imx_scu_ocotp_nvmem_config = {
.name = "imx-scu-ocotp",
+ .add_legacy_fixed_of_cells = true,
.read_only = false,
.word_size = 4,
.stride = 1,
--- a/drivers/nvmem/imx-ocotp.c
+++ b/drivers/nvmem/imx-ocotp.c
@@ -616,6 +616,7 @@ static int imx_ocotp_probe(struct platfo
return PTR_ERR(priv->clk);
priv->params = of_device_get_match_data(&pdev->dev);
+ imx_ocotp_nvmem_config.add_legacy_fixed_of_cells = true;
imx_ocotp_nvmem_config.size = 4 * priv->params->nregs;
imx_ocotp_nvmem_config.dev = dev;
imx_ocotp_nvmem_config.priv = priv;
--- a/drivers/nvmem/meson-efuse.c
+++ b/drivers/nvmem/meson-efuse.c
@@ -93,6 +93,7 @@ static int meson_efuse_probe(struct plat
econfig->dev = dev;
econfig->name = dev_name(dev);
+ econfig->add_legacy_fixed_of_cells = true;
econfig->stride = 1;
econfig->word_size = 1;
econfig->reg_read = meson_efuse_read;
--- a/drivers/nvmem/meson-mx-efuse.c
+++ b/drivers/nvmem/meson-mx-efuse.c
@@ -211,6 +211,7 @@ static int meson_mx_efuse_probe(struct p
efuse->config.owner = THIS_MODULE;
efuse->config.dev = &pdev->dev;
efuse->config.priv = efuse;
+ efuse->config.add_legacy_fixed_of_cells = true;
efuse->config.stride = drvdata->word_size;
efuse->config.word_size = drvdata->word_size;
efuse->config.size = SZ_512;
--- a/drivers/nvmem/microchip-otpc.c
+++ b/drivers/nvmem/microchip-otpc.c
@@ -261,6 +261,7 @@ static int mchp_otpc_probe(struct platfo
return ret;
mchp_nvmem_config.dev = otpc->dev;
+ mchp_nvmem_config.add_legacy_fixed_of_cells = true;
mchp_nvmem_config.size = size;
mchp_nvmem_config.priv = otpc;
nvmem = devm_nvmem_register(&pdev->dev, &mchp_nvmem_config);
--- a/drivers/nvmem/mtk-efuse.c
+++ b/drivers/nvmem/mtk-efuse.c
@@ -83,6 +83,7 @@ static int mtk_efuse_probe(struct platfo
return PTR_ERR(priv->base);
pdata = device_get_match_data(dev);
+ econfig.add_legacy_fixed_of_cells = true;
econfig.stride = 1;
econfig.word_size = 1;
econfig.reg_read = mtk_reg_read;
--- a/drivers/nvmem/qcom-spmi-sdam.c
+++ b/drivers/nvmem/qcom-spmi-sdam.c
@@ -142,6 +142,7 @@ static int sdam_probe(struct platform_de
sdam->sdam_config.name = "spmi_sdam";
sdam->sdam_config.id = NVMEM_DEVID_AUTO;
sdam->sdam_config.owner = THIS_MODULE;
+ sdam->sdam_config.add_legacy_fixed_of_cells = true;
sdam->sdam_config.stride = 1;
sdam->sdam_config.word_size = 1;
sdam->sdam_config.reg_read = sdam_read;
--- a/drivers/nvmem/qfprom.c
+++ b/drivers/nvmem/qfprom.c
@@ -357,6 +357,7 @@ static int qfprom_probe(struct platform_
{
struct nvmem_config econfig = {
.name = "qfprom",
+ .add_legacy_fixed_of_cells = true,
.stride = 1,
.word_size = 1,
.id = NVMEM_DEVID_AUTO,
--- a/drivers/nvmem/rave-sp-eeprom.c
+++ b/drivers/nvmem/rave-sp-eeprom.c
@@ -328,6 +328,7 @@ static int rave_sp_eeprom_probe(struct p
of_property_read_string(np, "zii,eeprom-name", &config.name);
config.priv = eeprom;
config.dev = dev;
+ config.add_legacy_fixed_of_cells = true;
config.size = size;
config.reg_read = rave_sp_eeprom_reg_read;
config.reg_write = rave_sp_eeprom_reg_write;
--- a/drivers/nvmem/rockchip-efuse.c
+++ b/drivers/nvmem/rockchip-efuse.c
@@ -205,6 +205,7 @@ static int rockchip_rk3399_efuse_read(vo
static struct nvmem_config econfig = {
.name = "rockchip-efuse",
+ .add_legacy_fixed_of_cells = true,
.stride = 1,
.word_size = 1,
.read_only = true,
--- a/drivers/nvmem/sc27xx-efuse.c
+++ b/drivers/nvmem/sc27xx-efuse.c
@@ -248,6 +248,7 @@ static int sc27xx_efuse_probe(struct pla
econfig.reg_read = sc27xx_efuse_read;
econfig.priv = efuse;
econfig.dev = &pdev->dev;
+ econfig.add_legacy_fixed_of_cells = true;
nvmem = devm_nvmem_register(&pdev->dev, &econfig);
if (IS_ERR(nvmem)) {
dev_err(&pdev->dev, "failed to register nvmem config\n");
--- a/drivers/nvmem/sec-qfprom.c
+++ b/drivers/nvmem/sec-qfprom.c
@@ -47,6 +47,7 @@ static int sec_qfprom_probe(struct platf
{
struct nvmem_config econfig = {
.name = "sec-qfprom",
+ .add_legacy_fixed_of_cells = true,
.stride = 1,
.word_size = 1,
.id = NVMEM_DEVID_AUTO,
--- a/drivers/nvmem/sprd-efuse.c
+++ b/drivers/nvmem/sprd-efuse.c
@@ -408,6 +408,7 @@ static int sprd_efuse_probe(struct platf
econfig.read_only = false;
econfig.name = "sprd-efuse";
econfig.size = efuse->data->blk_nums * SPRD_EFUSE_BLOCK_WIDTH;
+ econfig.add_legacy_fixed_of_cells = true;
econfig.reg_read = sprd_efuse_read;
econfig.reg_write = sprd_efuse_write;
econfig.priv = efuse;
--- a/drivers/nvmem/stm32-romem.c
+++ b/drivers/nvmem/stm32-romem.c
@@ -207,6 +207,7 @@ static int stm32_romem_probe(struct plat
priv->cfg.priv = priv;
priv->cfg.owner = THIS_MODULE;
priv->cfg.type = NVMEM_TYPE_OTP;
+ priv->cfg.add_legacy_fixed_of_cells = true;
priv->lower = 0;
--- a/drivers/nvmem/sunplus-ocotp.c
+++ b/drivers/nvmem/sunplus-ocotp.c
@@ -145,6 +145,7 @@ disable_clk:
static struct nvmem_config sp_ocotp_nvmem_config = {
.name = "sp-ocotp",
+ .add_legacy_fixed_of_cells = true,
.read_only = true,
.word_size = 1,
.size = QAC628_OTP_SIZE,
--- a/drivers/nvmem/sunxi_sid.c
+++ b/drivers/nvmem/sunxi_sid.c
@@ -154,6 +154,7 @@ static int sunxi_sid_probe(struct platfo
nvmem_cfg->dev = dev;
nvmem_cfg->name = "sunxi-sid";
nvmem_cfg->type = NVMEM_TYPE_OTP;
+ nvmem_cfg->add_legacy_fixed_of_cells = true;
nvmem_cfg->read_only = true;
nvmem_cfg->size = cfg->size;
nvmem_cfg->word_size = 1;
--- a/drivers/nvmem/uniphier-efuse.c
+++ b/drivers/nvmem/uniphier-efuse.c
@@ -52,6 +52,7 @@ static int uniphier_efuse_probe(struct p
econfig.size = resource_size(res);
econfig.priv = priv;
econfig.dev = dev;
+ econfig.add_legacy_fixed_of_cells = true;
nvmem = devm_nvmem_register(dev, &econfig);
return PTR_ERR_OR_ZERO(nvmem);
--- a/drivers/nvmem/zynqmp_nvmem.c
+++ b/drivers/nvmem/zynqmp_nvmem.c
@@ -58,6 +58,7 @@ static int zynqmp_nvmem_probe(struct pla
priv->dev = dev;
econfig.dev = dev;
+ econfig.add_legacy_fixed_of_cells = true;
econfig.reg_read = zynqmp_nvmem_read;
econfig.priv = priv;
--- a/drivers/rtc/nvmem.c
+++ b/drivers/rtc/nvmem.c
@@ -21,6 +21,7 @@ int devm_rtc_nvmem_register(struct rtc_d
nvmem_config->dev = dev;
nvmem_config->owner = rtc->owner;
+ nvmem_config->add_legacy_fixed_of_cells = true;
nvmem = devm_nvmem_register(dev, nvmem_config);
if (IS_ERR(nvmem))
dev_err(dev, "failed to register nvmem device for RTC\n");
--- a/drivers/w1/slaves/w1_ds250x.c
+++ b/drivers/w1/slaves/w1_ds250x.c
@@ -168,6 +168,7 @@ static int w1_eprom_add_slave(struct w1_
struct nvmem_device *nvmem;
struct nvmem_config nvmem_cfg = {
.dev = &sl->dev,
+ .add_legacy_fixed_of_cells = true,
.reg_read = w1_nvmem_read,
.type = NVMEM_TYPE_OTP,
.read_only = true,
--- a/include/linux/nvmem-provider.h
+++ b/include/linux/nvmem-provider.h
@@ -82,6 +82,7 @@ struct nvmem_cell_info {
* @owner: Pointer to exporter module. Used for refcounting.
* @cells: Optional array of pre-defined NVMEM cells.
* @ncells: Number of elements in cells.
+ * @add_legacy_fixed_of_cells: Read fixed NVMEM cells from old OF syntax.
* @keepout: Optional array of keepout ranges (sorted ascending by start).
* @nkeepout: Number of elements in the keepout array.
* @type: Type of the nvmem storage
@@ -112,6 +113,7 @@ struct nvmem_config {
struct module *owner;
const struct nvmem_cell_info *cells;
int ncells;
+ bool add_legacy_fixed_of_cells;
const struct nvmem_keepout *keepout;
unsigned int nkeepout;
enum nvmem_type type;

View file

@ -0,0 +1,77 @@
From 0720219f4d34a88a9badb4de70cfad7585687d48 Mon Sep 17 00:00:00 2001
From: Rob Herring <robh@kernel.org>
Date: Fri, 20 Oct 2023 11:55:45 +0100
Subject: [PATCH] nvmem: Use device_get_match_data()
Use preferred device_get_match_data() instead of of_match_device() to
get the driver match data. With this, adjust the includes to explicitly
include the correct headers.
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20231020105545.216052-7-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/nvmem/mxs-ocotp.c | 10 ++++------
drivers/nvmem/stm32-romem.c | 7 ++++---
2 files changed, 8 insertions(+), 9 deletions(-)
--- a/drivers/nvmem/mxs-ocotp.c
+++ b/drivers/nvmem/mxs-ocotp.c
@@ -13,8 +13,9 @@
#include <linux/io.h>
#include <linux/module.h>
#include <linux/nvmem-provider.h>
-#include <linux/of_device.h>
+#include <linux/of.h>
#include <linux/platform_device.h>
+#include <linux/property.h>
#include <linux/slab.h>
#include <linux/stmp_device.h>
@@ -140,11 +141,10 @@ static int mxs_ocotp_probe(struct platfo
struct device *dev = &pdev->dev;
const struct mxs_data *data;
struct mxs_ocotp *otp;
- const struct of_device_id *match;
int ret;
- match = of_match_device(dev->driver->of_match_table, dev);
- if (!match || !match->data)
+ data = device_get_match_data(dev);
+ if (!data)
return -EINVAL;
otp = devm_kzalloc(dev, sizeof(*otp), GFP_KERNEL);
@@ -169,8 +169,6 @@ static int mxs_ocotp_probe(struct platfo
if (ret)
return ret;
- data = match->data;
-
ocotp_config.size = data->size;
ocotp_config.priv = otp;
ocotp_config.dev = dev;
--- a/drivers/nvmem/stm32-romem.c
+++ b/drivers/nvmem/stm32-romem.c
@@ -10,7 +10,9 @@
#include <linux/io.h>
#include <linux/module.h>
#include <linux/nvmem-provider.h>
-#include <linux/of_device.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/property.h>
#include <linux/tee_drv.h>
#include "stm32-bsec-optee-ta.h"
@@ -211,8 +213,7 @@ static int stm32_romem_probe(struct plat
priv->lower = 0;
- cfg = (const struct stm32_romem_cfg *)
- of_match_device(dev->driver->of_match_table, dev)->data;
+ cfg = device_get_match_data(dev);
if (!cfg) {
priv->cfg.read_only = true;
priv->cfg.size = resource_size(res);

View file

@ -0,0 +1,77 @@
From f4cf4e5db331a5ce69e3f0b21d322cac0f4e4b5d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
Date: Mon, 23 Oct 2023 12:27:59 +0200
Subject: [PATCH] Revert "nvmem: add new config option"
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This reverts commit 517f14d9cf3533d5ab4fded195ab6f80a92e378f.
Config option "no_of_node" is no longer needed since adding a more
explicit and targeted option "add_legacy_fixed_of_cells".
That "no_of_node" config option was needed *earlier* to help mtd's case.
DT nodes of MTD partitions (that are also NVMEM devices) may contain
subnodes. Those SHOULD NOT be treated as NVMEM fixed cells.
To prevent NVMEM core code from parsing subnodes a "no_of_node" option
was added (and set to true in mtd) to make for_each_child_of_node() in
NVMEM a no-op. That was a bit hacky because it was messing with
"of_node" pointer to achieve some side-effect.
With the introduction of "add_legacy_fixed_of_cells" config option
things got more explicit. MTD subsystem simply tells NVMEM when to look
for fixed cells and there is no need to hack "of_node" pointer anymore.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20231023102759.31529-1-zajec5@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/mtd/mtdcore.c | 1 -
drivers/nvmem/core.c | 2 +-
include/linux/nvmem-provider.h | 2 --
3 files changed, 1 insertion(+), 4 deletions(-)
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -549,7 +549,6 @@ static int mtd_nvmem_add(struct mtd_info
config.read_only = true;
config.root_only = true;
config.ignore_wp = true;
- config.no_of_node = !of_device_is_compatible(node, "nvmem-cells");
config.priv = mtd;
mtd->nvmem = nvmem_register(&config);
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -936,7 +936,7 @@ struct nvmem_device *nvmem_register(cons
nvmem->nkeepout = config->nkeepout;
if (config->of_node)
nvmem->dev.of_node = config->of_node;
- else if (!config->no_of_node)
+ else
nvmem->dev.of_node = config->dev->of_node;
switch (config->id) {
--- a/include/linux/nvmem-provider.h
+++ b/include/linux/nvmem-provider.h
@@ -89,7 +89,6 @@ struct nvmem_cell_info {
* @read_only: Device is read-only.
* @root_only: Device is accessibly to root only.
* @of_node: If given, this will be used instead of the parent's of_node.
- * @no_of_node: Device should not use the parent's of_node even if it's !NULL.
* @reg_read: Callback to read data.
* @reg_write: Callback to write data.
* @size: Device size.
@@ -122,7 +121,6 @@ struct nvmem_config {
bool ignore_wp;
struct nvmem_layout *layout;
struct device_node *of_node;
- bool no_of_node;
nvmem_reg_read_t reg_read;
nvmem_reg_write_t reg_write;
int size;

View file

@ -0,0 +1,28 @@
From 414a98abbefd82d591f4e2d1efd2917bcd3b6f6d Mon Sep 17 00:00:00 2001
From: Peng Fan <peng.fan@nxp.com>
Date: Fri, 13 Oct 2023 13:49:02 +0100
Subject: [PATCH] nvmem: imx: correct nregs for i.MX6SLL
The nregs for i.MX6SLL should be 80 per fuse map, correct it.
Fixes: 6da27821a6f5 ("nvmem: imx-ocotp: add support for imx6sll")
Cc: Stable@vger.kernel.org
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20231013124904.175782-2-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/nvmem/imx-ocotp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/nvmem/imx-ocotp.c
+++ b/drivers/nvmem/imx-ocotp.c
@@ -499,7 +499,7 @@ static const struct ocotp_params imx6sl_
};
static const struct ocotp_params imx6sll_params = {
- .nregs = 128,
+ .nregs = 80,
.bank_address_words = 0,
.set_timing = imx_ocotp_set_imx6_timing,
.ctrl = IMX_OCOTP_BM_CTRL_DEFAULT,

View file

@ -0,0 +1,28 @@
From 7d6e10f5d254681983b53d979422c8de3fadbefb Mon Sep 17 00:00:00 2001
From: Peng Fan <peng.fan@nxp.com>
Date: Fri, 13 Oct 2023 13:49:03 +0100
Subject: [PATCH] nvmem: imx: correct nregs for i.MX6UL
The nregs for i.MX6UL should be 144 per fuse map, correct it.
Fixes: 4aa2b4802046 ("nvmem: octop: Add support for imx6ul")
Cc: Stable@vger.kernel.org
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20231013124904.175782-3-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/nvmem/imx-ocotp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/nvmem/imx-ocotp.c
+++ b/drivers/nvmem/imx-ocotp.c
@@ -513,7 +513,7 @@ static const struct ocotp_params imx6sx_
};
static const struct ocotp_params imx6ul_params = {
- .nregs = 128,
+ .nregs = 144,
.bank_address_words = 0,
.set_timing = imx_ocotp_set_imx6_timing,
.ctrl = IMX_OCOTP_BM_CTRL_DEFAULT,

View file

@ -0,0 +1,28 @@
From 2382c1b044231fd49eaf9aa82bc7113fc55487b8 Mon Sep 17 00:00:00 2001
From: Peng Fan <peng.fan@nxp.com>
Date: Fri, 13 Oct 2023 13:49:04 +0100
Subject: [PATCH] nvmem: imx: correct nregs for i.MX6ULL
The nregs for i.MX6ULL should be 80 per fuse map, correct it.
Fixes: ffbc34bf0e9c ("nvmem: imx-ocotp: Implement i.MX6ULL/ULZ support")
Cc: Stable@vger.kernel.org
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20231013124904.175782-4-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/nvmem/imx-ocotp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/nvmem/imx-ocotp.c
+++ b/drivers/nvmem/imx-ocotp.c
@@ -520,7 +520,7 @@ static const struct ocotp_params imx6ul_
};
static const struct ocotp_params imx6ull_params = {
- .nregs = 64,
+ .nregs = 80,
.bank_address_words = 0,
.set_timing = imx_ocotp_set_imx6_timing,
.ctrl = IMX_OCOTP_BM_CTRL_DEFAULT,

View file

@ -0,0 +1,37 @@
From 16724d6ea40a2c9315f5a0d81005dfa4d7a6da24 Mon Sep 17 00:00:00 2001
From: Luca Weiss <luca.weiss@fairphone.com>
Date: Fri, 20 Oct 2023 11:55:40 +0100
Subject: [PATCH] nvmem: qfprom: Mark core clk as optional
On some platforms like sc7280 on non-ChromeOS devices the core clock
cannot be touched by Linux so we cannot provide it. Mark it as optional
as accessing qfprom for reading works without it but we still prohibit
writing if we cannot provide the clock.
Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20231020105545.216052-2-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/nvmem/qfprom.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- a/drivers/nvmem/qfprom.c
+++ b/drivers/nvmem/qfprom.c
@@ -423,12 +423,12 @@ static int qfprom_probe(struct platform_
if (IS_ERR(priv->vcc))
return PTR_ERR(priv->vcc);
- priv->secclk = devm_clk_get(dev, "core");
+ priv->secclk = devm_clk_get_optional(dev, "core");
if (IS_ERR(priv->secclk))
return dev_err_probe(dev, PTR_ERR(priv->secclk), "Error getting clock\n");
- /* Only enable writing if we have SoC data. */
- if (priv->soc_data)
+ /* Only enable writing if we have SoC data and a valid clock */
+ if (priv->soc_data && priv->secclk)
econfig.reg_write = qfprom_reg_write;
}

View file

@ -0,0 +1,330 @@
From 2cc3b37f5b6df8189d55d0e812d9658ce256dfec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
Date: Fri, 20 Oct 2023 11:55:41 +0100
Subject: [PATCH] nvmem: add explicit config option to read old syntax fixed OF
cells
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Binding for fixed NVMEM cells defined directly as NVMEM device subnodes
has been deprecated. It has been replaced by the "fixed-layout" NVMEM
layout binding.
New syntax is meant to be clearer and should help avoiding imprecise
bindings.
NVMEM subsystem already supports the new binding. It should be a good
idea to limit support for old syntax to existing drivers that actually
support & use it (we can't break backward compatibility!). That way we
additionally encourage new bindings & drivers to ignore deprecated
binding.
It wasn't clear (to me) if rtc and w1 code actually uses old syntax
fixed cells. I enabled them to don't risk any breakage.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
[for meson-{efuse,mx-efuse}.c]
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
[for mtk-efuse.c, nvmem/core.c, nvmem-provider.h]
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
[MT8192, MT8195 Chromebooks]
Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
[for microchip-otpc.c]
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
[SAMA7G5-EK]
Tested-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20231020105545.216052-3-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/mtd/mtdcore.c | 2 ++
drivers/nvmem/apple-efuses.c | 1 +
drivers/nvmem/core.c | 8 +++++---
drivers/nvmem/imx-ocotp-scu.c | 1 +
drivers/nvmem/imx-ocotp.c | 1 +
drivers/nvmem/meson-efuse.c | 1 +
drivers/nvmem/meson-mx-efuse.c | 1 +
drivers/nvmem/microchip-otpc.c | 1 +
drivers/nvmem/mtk-efuse.c | 1 +
drivers/nvmem/qcom-spmi-sdam.c | 1 +
drivers/nvmem/qfprom.c | 1 +
drivers/nvmem/rave-sp-eeprom.c | 1 +
drivers/nvmem/rockchip-efuse.c | 1 +
drivers/nvmem/sc27xx-efuse.c | 1 +
drivers/nvmem/sec-qfprom.c | 1 +
drivers/nvmem/sprd-efuse.c | 1 +
drivers/nvmem/stm32-romem.c | 1 +
drivers/nvmem/sunplus-ocotp.c | 1 +
drivers/nvmem/sunxi_sid.c | 1 +
drivers/nvmem/uniphier-efuse.c | 1 +
drivers/nvmem/zynqmp_nvmem.c | 1 +
drivers/rtc/nvmem.c | 1 +
drivers/w1/slaves/w1_ds250x.c | 1 +
include/linux/nvmem-provider.h | 2 ++
24 files changed, 30 insertions(+), 3 deletions(-)
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -523,6 +523,7 @@ static int mtd_nvmem_add(struct mtd_info
config.dev = &mtd->dev;
config.name = dev_name(&mtd->dev);
config.owner = THIS_MODULE;
+ config.add_legacy_fixed_of_cells = of_device_is_compatible(node, "nvmem-cells");
config.reg_read = mtd_nvmem_reg_read;
config.size = mtd->size;
config.word_size = 1;
@@ -891,6 +892,7 @@ static struct nvmem_device *mtd_otp_nvme
config.name = compatible;
config.id = NVMEM_DEVID_AUTO;
config.owner = THIS_MODULE;
+ config.add_legacy_fixed_of_cells = true;
config.type = NVMEM_TYPE_OTP;
config.root_only = true;
config.ignore_wp = true;
--- a/drivers/nvmem/apple-efuses.c
+++ b/drivers/nvmem/apple-efuses.c
@@ -36,6 +36,7 @@ static int apple_efuses_probe(struct pla
struct resource *res;
struct nvmem_config config = {
.dev = &pdev->dev,
+ .add_legacy_fixed_of_cells = true,
.read_only = true,
.reg_read = apple_efuses_read,
.stride = sizeof(u32),
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -998,9 +998,11 @@ struct nvmem_device *nvmem_register(cons
if (rval)
goto err_remove_cells;
- rval = nvmem_add_cells_from_legacy_of(nvmem);
- if (rval)
- goto err_remove_cells;
+ if (config->add_legacy_fixed_of_cells) {
+ rval = nvmem_add_cells_from_legacy_of(nvmem);
+ if (rval)
+ goto err_remove_cells;
+ }
rval = nvmem_add_cells_from_fixed_layout(nvmem);
if (rval)
--- a/drivers/nvmem/imx-ocotp-scu.c
+++ b/drivers/nvmem/imx-ocotp-scu.c
@@ -220,6 +220,7 @@ static int imx_scu_ocotp_write(void *con
static struct nvmem_config imx_scu_ocotp_nvmem_config = {
.name = "imx-scu-ocotp",
+ .add_legacy_fixed_of_cells = true,
.read_only = false,
.word_size = 4,
.stride = 1,
--- a/drivers/nvmem/imx-ocotp.c
+++ b/drivers/nvmem/imx-ocotp.c
@@ -616,6 +616,7 @@ static int imx_ocotp_probe(struct platfo
return PTR_ERR(priv->clk);
priv->params = of_device_get_match_data(&pdev->dev);
+ imx_ocotp_nvmem_config.add_legacy_fixed_of_cells = true;
imx_ocotp_nvmem_config.size = 4 * priv->params->nregs;
imx_ocotp_nvmem_config.dev = dev;
imx_ocotp_nvmem_config.priv = priv;
--- a/drivers/nvmem/meson-efuse.c
+++ b/drivers/nvmem/meson-efuse.c
@@ -93,6 +93,7 @@ static int meson_efuse_probe(struct plat
econfig->dev = dev;
econfig->name = dev_name(dev);
+ econfig->add_legacy_fixed_of_cells = true;
econfig->stride = 1;
econfig->word_size = 1;
econfig->reg_read = meson_efuse_read;
--- a/drivers/nvmem/meson-mx-efuse.c
+++ b/drivers/nvmem/meson-mx-efuse.c
@@ -211,6 +211,7 @@ static int meson_mx_efuse_probe(struct p
efuse->config.owner = THIS_MODULE;
efuse->config.dev = &pdev->dev;
efuse->config.priv = efuse;
+ efuse->config.add_legacy_fixed_of_cells = true;
efuse->config.stride = drvdata->word_size;
efuse->config.word_size = drvdata->word_size;
efuse->config.size = SZ_512;
--- a/drivers/nvmem/microchip-otpc.c
+++ b/drivers/nvmem/microchip-otpc.c
@@ -261,6 +261,7 @@ static int mchp_otpc_probe(struct platfo
return ret;
mchp_nvmem_config.dev = otpc->dev;
+ mchp_nvmem_config.add_legacy_fixed_of_cells = true;
mchp_nvmem_config.size = size;
mchp_nvmem_config.priv = otpc;
nvmem = devm_nvmem_register(&pdev->dev, &mchp_nvmem_config);
--- a/drivers/nvmem/mtk-efuse.c
+++ b/drivers/nvmem/mtk-efuse.c
@@ -83,6 +83,7 @@ static int mtk_efuse_probe(struct platfo
return PTR_ERR(priv->base);
pdata = device_get_match_data(dev);
+ econfig.add_legacy_fixed_of_cells = true;
econfig.stride = 1;
econfig.word_size = 1;
econfig.reg_read = mtk_reg_read;
--- a/drivers/nvmem/qcom-spmi-sdam.c
+++ b/drivers/nvmem/qcom-spmi-sdam.c
@@ -142,6 +142,7 @@ static int sdam_probe(struct platform_de
sdam->sdam_config.name = "spmi_sdam";
sdam->sdam_config.id = NVMEM_DEVID_AUTO;
sdam->sdam_config.owner = THIS_MODULE;
+ sdam->sdam_config.add_legacy_fixed_of_cells = true;
sdam->sdam_config.stride = 1;
sdam->sdam_config.word_size = 1;
sdam->sdam_config.reg_read = sdam_read;
--- a/drivers/nvmem/qfprom.c
+++ b/drivers/nvmem/qfprom.c
@@ -357,6 +357,7 @@ static int qfprom_probe(struct platform_
{
struct nvmem_config econfig = {
.name = "qfprom",
+ .add_legacy_fixed_of_cells = true,
.stride = 1,
.word_size = 1,
.id = NVMEM_DEVID_AUTO,
--- a/drivers/nvmem/rave-sp-eeprom.c
+++ b/drivers/nvmem/rave-sp-eeprom.c
@@ -328,6 +328,7 @@ static int rave_sp_eeprom_probe(struct p
of_property_read_string(np, "zii,eeprom-name", &config.name);
config.priv = eeprom;
config.dev = dev;
+ config.add_legacy_fixed_of_cells = true;
config.size = size;
config.reg_read = rave_sp_eeprom_reg_read;
config.reg_write = rave_sp_eeprom_reg_write;
--- a/drivers/nvmem/rockchip-efuse.c
+++ b/drivers/nvmem/rockchip-efuse.c
@@ -205,6 +205,7 @@ static int rockchip_rk3399_efuse_read(vo
static struct nvmem_config econfig = {
.name = "rockchip-efuse",
+ .add_legacy_fixed_of_cells = true,
.stride = 1,
.word_size = 1,
.read_only = true,
--- a/drivers/nvmem/sc27xx-efuse.c
+++ b/drivers/nvmem/sc27xx-efuse.c
@@ -248,6 +248,7 @@ static int sc27xx_efuse_probe(struct pla
econfig.reg_read = sc27xx_efuse_read;
econfig.priv = efuse;
econfig.dev = &pdev->dev;
+ econfig.add_legacy_fixed_of_cells = true;
nvmem = devm_nvmem_register(&pdev->dev, &econfig);
if (IS_ERR(nvmem)) {
dev_err(&pdev->dev, "failed to register nvmem config\n");
--- a/drivers/nvmem/sec-qfprom.c
+++ b/drivers/nvmem/sec-qfprom.c
@@ -47,6 +47,7 @@ static int sec_qfprom_probe(struct platf
{
struct nvmem_config econfig = {
.name = "sec-qfprom",
+ .add_legacy_fixed_of_cells = true,
.stride = 1,
.word_size = 1,
.id = NVMEM_DEVID_AUTO,
--- a/drivers/nvmem/sprd-efuse.c
+++ b/drivers/nvmem/sprd-efuse.c
@@ -408,6 +408,7 @@ static int sprd_efuse_probe(struct platf
econfig.read_only = false;
econfig.name = "sprd-efuse";
econfig.size = efuse->data->blk_nums * SPRD_EFUSE_BLOCK_WIDTH;
+ econfig.add_legacy_fixed_of_cells = true;
econfig.reg_read = sprd_efuse_read;
econfig.reg_write = sprd_efuse_write;
econfig.priv = efuse;
--- a/drivers/nvmem/stm32-romem.c
+++ b/drivers/nvmem/stm32-romem.c
@@ -207,6 +207,7 @@ static int stm32_romem_probe(struct plat
priv->cfg.priv = priv;
priv->cfg.owner = THIS_MODULE;
priv->cfg.type = NVMEM_TYPE_OTP;
+ priv->cfg.add_legacy_fixed_of_cells = true;
priv->lower = 0;
--- a/drivers/nvmem/sunplus-ocotp.c
+++ b/drivers/nvmem/sunplus-ocotp.c
@@ -145,6 +145,7 @@ disable_clk:
static struct nvmem_config sp_ocotp_nvmem_config = {
.name = "sp-ocotp",
+ .add_legacy_fixed_of_cells = true,
.read_only = true,
.word_size = 1,
.size = QAC628_OTP_SIZE,
--- a/drivers/nvmem/sunxi_sid.c
+++ b/drivers/nvmem/sunxi_sid.c
@@ -154,6 +154,7 @@ static int sunxi_sid_probe(struct platfo
nvmem_cfg->dev = dev;
nvmem_cfg->name = "sunxi-sid";
nvmem_cfg->type = NVMEM_TYPE_OTP;
+ nvmem_cfg->add_legacy_fixed_of_cells = true;
nvmem_cfg->read_only = true;
nvmem_cfg->size = cfg->size;
nvmem_cfg->word_size = 1;
--- a/drivers/nvmem/uniphier-efuse.c
+++ b/drivers/nvmem/uniphier-efuse.c
@@ -52,6 +52,7 @@ static int uniphier_efuse_probe(struct p
econfig.size = resource_size(res);
econfig.priv = priv;
econfig.dev = dev;
+ econfig.add_legacy_fixed_of_cells = true;
nvmem = devm_nvmem_register(dev, &econfig);
return PTR_ERR_OR_ZERO(nvmem);
--- a/drivers/nvmem/zynqmp_nvmem.c
+++ b/drivers/nvmem/zynqmp_nvmem.c
@@ -58,6 +58,7 @@ static int zynqmp_nvmem_probe(struct pla
priv->dev = dev;
econfig.dev = dev;
+ econfig.add_legacy_fixed_of_cells = true;
econfig.reg_read = zynqmp_nvmem_read;
econfig.priv = priv;
--- a/drivers/rtc/nvmem.c
+++ b/drivers/rtc/nvmem.c
@@ -21,6 +21,7 @@ int devm_rtc_nvmem_register(struct rtc_d
nvmem_config->dev = dev;
nvmem_config->owner = rtc->owner;
+ nvmem_config->add_legacy_fixed_of_cells = true;
nvmem = devm_nvmem_register(dev, nvmem_config);
if (IS_ERR(nvmem))
dev_err(dev, "failed to register nvmem device for RTC\n");
--- a/drivers/w1/slaves/w1_ds250x.c
+++ b/drivers/w1/slaves/w1_ds250x.c
@@ -168,6 +168,7 @@ static int w1_eprom_add_slave(struct w1_
struct nvmem_device *nvmem;
struct nvmem_config nvmem_cfg = {
.dev = &sl->dev,
+ .add_legacy_fixed_of_cells = true,
.reg_read = w1_nvmem_read,
.type = NVMEM_TYPE_OTP,
.read_only = true,
--- a/include/linux/nvmem-provider.h
+++ b/include/linux/nvmem-provider.h
@@ -82,6 +82,7 @@ struct nvmem_cell_info {
* @owner: Pointer to exporter module. Used for refcounting.
* @cells: Optional array of pre-defined NVMEM cells.
* @ncells: Number of elements in cells.
+ * @add_legacy_fixed_of_cells: Read fixed NVMEM cells from old OF syntax.
* @keepout: Optional array of keepout ranges (sorted ascending by start).
* @nkeepout: Number of elements in the keepout array.
* @type: Type of the nvmem storage
@@ -112,6 +113,7 @@ struct nvmem_config {
struct module *owner;
const struct nvmem_cell_info *cells;
int ncells;
+ bool add_legacy_fixed_of_cells;
const struct nvmem_keepout *keepout;
unsigned int nkeepout;
enum nvmem_type type;

View file

@ -0,0 +1,77 @@
From 0720219f4d34a88a9badb4de70cfad7585687d48 Mon Sep 17 00:00:00 2001
From: Rob Herring <robh@kernel.org>
Date: Fri, 20 Oct 2023 11:55:45 +0100
Subject: [PATCH] nvmem: Use device_get_match_data()
Use preferred device_get_match_data() instead of of_match_device() to
get the driver match data. With this, adjust the includes to explicitly
include the correct headers.
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20231020105545.216052-7-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/nvmem/mxs-ocotp.c | 10 ++++------
drivers/nvmem/stm32-romem.c | 7 ++++---
2 files changed, 8 insertions(+), 9 deletions(-)
--- a/drivers/nvmem/mxs-ocotp.c
+++ b/drivers/nvmem/mxs-ocotp.c
@@ -13,8 +13,9 @@
#include <linux/io.h>
#include <linux/module.h>
#include <linux/nvmem-provider.h>
-#include <linux/of_device.h>
+#include <linux/of.h>
#include <linux/platform_device.h>
+#include <linux/property.h>
#include <linux/slab.h>
#include <linux/stmp_device.h>
@@ -140,11 +141,10 @@ static int mxs_ocotp_probe(struct platfo
struct device *dev = &pdev->dev;
const struct mxs_data *data;
struct mxs_ocotp *otp;
- const struct of_device_id *match;
int ret;
- match = of_match_device(dev->driver->of_match_table, dev);
- if (!match || !match->data)
+ data = device_get_match_data(dev);
+ if (!data)
return -EINVAL;
otp = devm_kzalloc(dev, sizeof(*otp), GFP_KERNEL);
@@ -169,8 +169,6 @@ static int mxs_ocotp_probe(struct platfo
if (ret)
return ret;
- data = match->data;
-
ocotp_config.size = data->size;
ocotp_config.priv = otp;
ocotp_config.dev = dev;
--- a/drivers/nvmem/stm32-romem.c
+++ b/drivers/nvmem/stm32-romem.c
@@ -10,7 +10,9 @@
#include <linux/io.h>
#include <linux/module.h>
#include <linux/nvmem-provider.h>
-#include <linux/of_device.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/property.h>
#include <linux/tee_drv.h>
#include "stm32-bsec-optee-ta.h"
@@ -211,8 +213,7 @@ static int stm32_romem_probe(struct plat
priv->lower = 0;
- cfg = (const struct stm32_romem_cfg *)
- of_match_device(dev->driver->of_match_table, dev)->data;
+ cfg = device_get_match_data(dev);
if (!cfg) {
priv->cfg.read_only = true;
priv->cfg.size = resource_size(res);

View file

@ -0,0 +1,77 @@
From f4cf4e5db331a5ce69e3f0b21d322cac0f4e4b5d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
Date: Mon, 23 Oct 2023 12:27:59 +0200
Subject: [PATCH] Revert "nvmem: add new config option"
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This reverts commit 517f14d9cf3533d5ab4fded195ab6f80a92e378f.
Config option "no_of_node" is no longer needed since adding a more
explicit and targeted option "add_legacy_fixed_of_cells".
That "no_of_node" config option was needed *earlier* to help mtd's case.
DT nodes of MTD partitions (that are also NVMEM devices) may contain
subnodes. Those SHOULD NOT be treated as NVMEM fixed cells.
To prevent NVMEM core code from parsing subnodes a "no_of_node" option
was added (and set to true in mtd) to make for_each_child_of_node() in
NVMEM a no-op. That was a bit hacky because it was messing with
"of_node" pointer to achieve some side-effect.
With the introduction of "add_legacy_fixed_of_cells" config option
things got more explicit. MTD subsystem simply tells NVMEM when to look
for fixed cells and there is no need to hack "of_node" pointer anymore.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20231023102759.31529-1-zajec5@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/mtd/mtdcore.c | 1 -
drivers/nvmem/core.c | 2 +-
include/linux/nvmem-provider.h | 2 --
3 files changed, 1 insertion(+), 4 deletions(-)
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -531,7 +531,6 @@ static int mtd_nvmem_add(struct mtd_info
config.read_only = true;
config.root_only = true;
config.ignore_wp = true;
- config.no_of_node = !of_device_is_compatible(node, "nvmem-cells");
config.priv = mtd;
mtd->nvmem = nvmem_register(&config);
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -936,7 +936,7 @@ struct nvmem_device *nvmem_register(cons
nvmem->nkeepout = config->nkeepout;
if (config->of_node)
nvmem->dev.of_node = config->of_node;
- else if (!config->no_of_node)
+ else
nvmem->dev.of_node = config->dev->of_node;
switch (config->id) {
--- a/include/linux/nvmem-provider.h
+++ b/include/linux/nvmem-provider.h
@@ -89,7 +89,6 @@ struct nvmem_cell_info {
* @read_only: Device is read-only.
* @root_only: Device is accessibly to root only.
* @of_node: If given, this will be used instead of the parent's of_node.
- * @no_of_node: Device should not use the parent's of_node even if it's !NULL.
* @reg_read: Callback to read data.
* @reg_write: Callback to write data.
* @size: Device size.
@@ -122,7 +121,6 @@ struct nvmem_config {
bool ignore_wp;
struct nvmem_layout *layout;
struct device_node *of_node;
- bool no_of_node;
nvmem_reg_read_t reg_read;
nvmem_reg_write_t reg_write;
int size;

View file

@ -77,7 +77,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
#include "mtdcore.h"
@@ -1082,6 +1083,8 @@ int mtd_device_parse_register(struct mtd
@@ -1083,6 +1084,8 @@ int mtd_device_parse_register(struct mtd
register_reboot_notifier(&mtd->reboot_notifier);
}

View file

@ -116,7 +116,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
help
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3577,6 +3577,11 @@ static int xmit_one(struct sk_buff *skb,
@@ -3597,6 +3597,11 @@ static int xmit_one(struct sk_buff *skb,
if (dev_nit_active(dev))
dev_queue_xmit_nit(skb, dev);

View file

@ -20,7 +20,7 @@ Subject: [PATCH] net/usb/qmi_wwan: add MeigLink modem support
{QMI_FIXED_INTF(0x0408, 0xea42, 4)}, /* Yota / Megafon M100-1 */
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -244,6 +244,8 @@ static void option_instat_callback(struc
@@ -247,6 +247,8 @@ static void option_instat_callback(struc
#define UBLOX_PRODUCT_R410M 0x90b2
/* These Yuga products use Qualcomm's vendor ID */
#define YUGA_PRODUCT_CLM920_NC5 0x9625
@ -29,7 +29,7 @@ Subject: [PATCH] net/usb/qmi_wwan: add MeigLink modem support
#define QUECTEL_VENDOR_ID 0x2c7c
/* These Quectel products use Quectel's vendor ID */
@@ -1180,6 +1182,11 @@ static const struct usb_device_id option
@@ -1185,6 +1187,11 @@ static const struct usb_device_id option
.driver_info = ZLP },
{ USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96),
.driver_info = RSVD(4) },

View file

@ -341,7 +341,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -3025,11 +3025,13 @@ static const struct seq_operations fib_r
@@ -3029,11 +3029,13 @@ static const struct seq_operations fib_r
int __net_init fib_proc_init(struct net *net)
{
@ -357,7 +357,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
fib_triestat_seq_show, NULL))
goto out2;
@@ -3040,17 +3042,21 @@ int __net_init fib_proc_init(struct net
@@ -3044,17 +3046,21 @@ int __net_init fib_proc_init(struct net
return 0;
out3:

View file

@ -39,7 +39,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
static inline uint16_t __get_unaligned_le16(const uint8_t *p)
--- /dev/null
+++ b/tools/include/tools/linux_types.h
@@ -0,0 +1,26 @@
@@ -0,0 +1,18 @@
+#ifndef __LINUX_TYPES_H
+#define __LINUX_TYPES_H
+
@ -47,23 +47,15 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
+
+typedef int8_t __s8;
+typedef uint8_t __u8;
+typedef uint8_t __be8;
+typedef uint8_t __le8;
+
+typedef int16_t __s16;
+typedef uint16_t __u16;
+typedef uint16_t __be16;
+typedef uint16_t __le16;
+
+typedef int32_t __s32;
+typedef uint32_t __u32;
+typedef uint32_t __be32;
+typedef uint32_t __le32;
+
+typedef int64_t __s64;
+typedef uint64_t __u64;
+typedef uint64_t __be64;
+typedef uint64_t __le64;
+
+#endif
--- a/tools/include/linux/types.h
@ -81,6 +73,16 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
struct page;
struct kmem_cache;
@@ -51,7 +55,9 @@ typedef __s8 s8;
#define __force
#define __user
#define __must_check
+#ifndef __cold
#define __cold
+#endif
typedef __u16 __bitwise __le16;
typedef __u16 __bitwise __be16;
--- a/tools/perf/pmu-events/jevents.py
+++ b/tools/perf/pmu-events/jevents.py
@@ -684,6 +684,7 @@ def main() -> None:
@ -91,3 +93,250 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
#include <stddef.h>
struct compact_pmu_event {
--- a/tools/arch/x86/include/asm/insn.h
+++ b/tools/arch/x86/include/asm/insn.h
@@ -7,8 +7,8 @@
* Copyright (C) IBM Corporation, 2009
*/
-#include <asm/byteorder.h>
/* insn_attr_t is defined in inat.h */
+#include <linux/kernel.h>
#include "inat.h" /* __ignore_sync_check__ */
#if defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN)
--- a/tools/arch/x86/include/asm/orc_types.h
+++ b/tools/arch/x86/include/asm/orc_types.h
@@ -40,7 +40,6 @@
#define ORC_REG_MAX 15
#ifndef __ASSEMBLY__
-#include <asm/byteorder.h>
/*
* This struct is more or less a vastly simplified version of the DWARF Call
@@ -53,12 +52,12 @@
struct orc_entry {
s16 sp_offset;
s16 bp_offset;
-#if defined(__LITTLE_ENDIAN_BITFIELD)
+#if __BYTE_ORDER == __LITTLE_ENDIAN
unsigned sp_reg:4;
unsigned bp_reg:4;
unsigned type:2;
unsigned end:1;
-#elif defined(__BIG_ENDIAN_BITFIELD)
+#elif __BYTE_ORDER == __BIG_ENDIAN
unsigned bp_reg:4;
unsigned sp_reg:4;
unsigned unused:5;
--- a/tools/arch/x86/lib/insn.c
+++ b/tools/arch/x86/lib/insn.c
@@ -15,7 +15,11 @@
#include "../include/asm/insn.h" /* __ignore_sync_check__ */
#include "../include/asm-generic/unaligned.h" /* __ignore_sync_check__ */
+#ifdef __KERNEL__
#include <linux/errno.h>
+#else
+#include <errno.h>
+#endif
#include <linux/kconfig.h>
#include "../include/asm/emulate_prefix.h" /* __ignore_sync_check__ */
--- a/tools/include/asm-generic/bitops/fls.h
+++ b/tools/include/asm-generic/bitops/fls.h
@@ -2,6 +2,8 @@
#ifndef _ASM_GENERIC_BITOPS_FLS_H_
#define _ASM_GENERIC_BITOPS_FLS_H_
+#include <string.h>
+
/**
* fls - find last (most-significant) bit set
* @x: the word to search
@@ -10,7 +12,7 @@
* Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
*/
-static __always_inline int fls(unsigned int x)
+static __always_inline int __generic_fls(unsigned int x)
{
int r = 32;
@@ -38,5 +40,6 @@ static __always_inline int fls(unsigned
}
return r;
}
+#define fls __generic_fls
#endif /* _ASM_GENERIC_BITOPS_FLS_H_ */
--- a/tools/include/asm-generic/bitsperlong.h
+++ b/tools/include/asm-generic/bitsperlong.h
@@ -4,11 +4,13 @@
#include <uapi/asm-generic/bitsperlong.h>
+#ifndef BITS_PER_LONG
#ifdef __SIZEOF_LONG__
#define BITS_PER_LONG (__CHAR_BIT__ * __SIZEOF_LONG__)
#else
#define BITS_PER_LONG __WORDSIZE
#endif
+#endif
#if BITS_PER_LONG != __BITS_PER_LONG
#error Inconsistent word size. Check asm/bitsperlong.h
--- a/tools/include/linux/rbtree.h
+++ b/tools/include/linux/rbtree.h
@@ -18,7 +18,6 @@
#define __TOOLS_LINUX_PERF_RBTREE_H
#include <linux/kernel.h>
-#include <linux/stddef.h>
struct rb_node {
unsigned long __rb_parent_color;
--- a/tools/objtool/Makefile
+++ b/tools/objtool/Makefile
@@ -4,7 +4,7 @@ include ../scripts/Makefile.arch
# always use the host compiler
AR = $(HOSTAR)
-CC = $(HOSTCC)
+CC = $(HOSTCC) $(HOST_EXTRACFLAGS)
LD = $(HOSTLD)
ifeq ($(srctree),)
@@ -43,6 +43,7 @@ BUILD_ORC := n
ifeq ($(SRCARCH),x86)
BUILD_ORC := y
+ CFLAGS += -DBUILD_ORC
endif
export BUILD_ORC
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -1164,11 +1164,12 @@ static int add_ignore_alternatives(struc
return 0;
}
+#ifndef BUILD_ORC
/*
* Symbols that replace INSN_CALL_DYNAMIC, every (tail) call to such a symbol
* will be added to the .retpoline_sites section.
*/
-__weak bool arch_is_retpoline(struct symbol *sym)
+bool arch_is_retpoline(struct symbol *sym)
{
return false;
}
@@ -1177,7 +1178,7 @@ __weak bool arch_is_retpoline(struct sym
* Symbols that replace INSN_RETURN, every (tail) call to such a symbol
* will be added to the .return_sites section.
*/
-__weak bool arch_is_rethunk(struct symbol *sym)
+bool arch_is_rethunk(struct symbol *sym)
{
return false;
}
@@ -1186,10 +1187,11 @@ __weak bool arch_is_rethunk(struct symbo
* Symbols that are embedded inside other instructions, because sometimes crazy
* code exists. These are mostly ignored for validation purposes.
*/
-__weak bool arch_is_embedded_insn(struct symbol *sym)
+bool arch_is_embedded_insn(struct symbol *sym)
{
return false;
}
+#endif
#define NEGATIVE_RELOC ((void *)-1L)
--- a/tools/objtool/include/objtool/objtool.h
+++ b/tools/objtool/include/objtool/objtool.h
@@ -12,7 +12,9 @@
#include <objtool/elf.h>
+#ifndef __weak
#define __weak __attribute__((weak))
+#endif
struct pv_state {
bool clean;
--- a/tools/objtool/orc_dump.c
+++ b/tools/objtool/orc_dump.c
@@ -5,10 +5,10 @@
#include <unistd.h>
#include <linux/objtool.h>
-#include <asm/orc_types.h>
#include <objtool/objtool.h>
#include <objtool/warn.h>
#include <objtool/endianness.h>
+#include <asm/orc_types.h>
static const char *reg_name(unsigned int reg)
{
--- a/tools/objtool/orc_gen.c
+++ b/tools/objtool/orc_gen.c
@@ -7,11 +7,11 @@
#include <string.h>
#include <linux/objtool.h>
-#include <asm/orc_types.h>
#include <objtool/check.h>
#include <objtool/warn.h>
#include <objtool/endianness.h>
+#include <asm/orc_types.h>
static int init_orc_entry(struct orc_entry *orc, struct cfi_state *cfi,
struct instruction *insn)
--- a/tools/objtool/special.c
+++ b/tools/objtool/special.c
@@ -54,9 +54,11 @@ struct special_entry entries[] = {
{},
};
-void __weak arch_handle_alternative(unsigned short feature, struct special_alt *alt)
+#ifndef BUILD_ORC
+void arch_handle_alternative(unsigned short feature, struct special_alt *alt)
{
}
+#endif
static void reloc_to_sec_off(struct reloc *reloc, struct section **sec,
unsigned long *off)
--- a/tools/objtool/weak.c
+++ b/tools/objtool/weak.c
@@ -15,12 +15,14 @@
return ENOSYS; \
})
-int __weak orc_dump(const char *_objname)
+#ifndef BUILD_ORC
+int orc_dump(const char *_objname)
{
UNSUPPORTED("ORC");
}
-int __weak orc_create(struct objtool_file *file)
+int orc_create(struct objtool_file *file)
{
UNSUPPORTED("ORC");
}
+#endif
--- a/tools/scripts/Makefile.include
+++ b/tools/scripts/Makefile.include
@@ -92,7 +92,7 @@ LLVM_OBJCOPY ?= llvm-objcopy
LLVM_STRIP ?= llvm-strip
ifeq ($(CC_NO_CLANG), 1)
-EXTRA_WARNINGS += -Wstrict-aliasing=3
+# EXTRA_WARNINGS += -Wstrict-aliasing=3
else ifneq ($(CROSS_COMPILE),)
# Allow userspace to override CLANG_CROSS_FLAGS to specify their own

View file

@ -91,7 +91,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
#include "mtdcore.h"
@@ -1074,6 +1075,8 @@ int mtd_device_parse_register(struct mtd
@@ -1075,6 +1076,8 @@ int mtd_device_parse_register(struct mtd
register_reboot_notifier(&mtd->reboot_notifier);
}

View file

@ -351,7 +351,7 @@ Signed-off-by: Alexandros C. Couloumbis <alex@ozo.com>
+ LZMA_FREE(address);
+}
+
+static ISzAlloc lzma_alloc = {p_lzma_malloc, p_lzma_free};
+static ISzAlloc lzma_alloc = { .Alloc = p_lzma_malloc, .Free = p_lzma_free };
+
+#endif
--- /dev/null

View file

@ -66,7 +66,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
static void rt_fibinfo_free(struct rtable __rcu **rtp)
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -2773,6 +2773,7 @@ static const char *const rtn_type_names[
@@ -2777,6 +2777,7 @@ static const char *const rtn_type_names[
[RTN_THROW] = "THROW",
[RTN_NAT] = "NAT",
[RTN_XRESOLVE] = "XRESOLVE",

View file

@ -32,7 +32,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
__u8 inner_protocol_type:1;
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -6054,6 +6054,9 @@ static enum gro_result dev_gro_receive(s
@@ -6074,6 +6074,9 @@ static enum gro_result dev_gro_receive(s
int same_flow;
int grow;
@ -42,7 +42,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
if (netif_elide_gro(skb->dev))
goto normal;
@@ -8068,6 +8071,48 @@ static void __netdev_adjacent_dev_unlink
@@ -8088,6 +8091,48 @@ static void __netdev_adjacent_dev_unlink
&upper_dev->adj_list.lower);
}
@ -91,7 +91,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
static int __netdev_upper_dev_link(struct net_device *dev,
struct net_device *upper_dev, bool master,
void *upper_priv, void *upper_info,
@@ -8119,6 +8164,7 @@ static int __netdev_upper_dev_link(struc
@@ -8139,6 +8184,7 @@ static int __netdev_upper_dev_link(struc
if (ret)
return ret;
@ -99,7 +99,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
ret = call_netdevice_notifiers_info(NETDEV_CHANGEUPPER,
&changeupper_info.info);
ret = notifier_to_errno(ret);
@@ -8215,6 +8261,7 @@ static void __netdev_upper_dev_unlink(st
@@ -8235,6 +8281,7 @@ static void __netdev_upper_dev_unlink(st
__netdev_adjacent_dev_unlink_neighbour(dev, upper_dev);
@ -107,7 +107,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
call_netdevice_notifiers_info(NETDEV_CHANGEUPPER,
&changeupper_info.info);
@@ -9034,6 +9081,7 @@ int dev_set_mac_address(struct net_devic
@@ -9054,6 +9101,7 @@ int dev_set_mac_address(struct net_devic
if (err)
return err;
dev->addr_assign_type = NET_ADDR_SET;

View file

@ -20,7 +20,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
/**
* napi_disable - prevent NAPI from scheduling
@@ -3362,6 +3363,7 @@ struct softnet_data {
@@ -3363,6 +3364,7 @@ struct softnet_data {
unsigned int processed;
unsigned int time_squeeze;
unsigned int received_rps;
@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
#endif
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4563,7 +4563,7 @@ static int rps_ipi_queued(struct softnet
@@ -4583,7 +4583,7 @@ static int rps_ipi_queued(struct softnet
#ifdef CONFIG_RPS
struct softnet_data *mysd = this_cpu_ptr(&softnet_data);
@ -39,7 +39,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
sd->rps_ipi_next = mysd->rps_ipi_list;
mysd->rps_ipi_list = sd;
@@ -5744,6 +5744,8 @@ static DEFINE_PER_CPU(struct work_struct
@@ -5764,6 +5764,8 @@ static DEFINE_PER_CPU(struct work_struct
/* Network device is going away, flush any packets still pending */
static void flush_backlog(struct work_struct *work)
{
@ -48,7 +48,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
struct sk_buff *skb, *tmp;
struct softnet_data *sd;
@@ -5759,9 +5761,18 @@ static void flush_backlog(struct work_st
@@ -5779,9 +5781,18 @@ static void flush_backlog(struct work_st
input_queue_head_incr(sd);
}
}
@ -67,7 +67,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
skb_queue_walk_safe(&sd->process_queue, skb, tmp) {
if (skb->dev->reg_state == NETREG_UNREGISTERING) {
__skb_unlink(skb, &sd->process_queue);
@@ -5769,7 +5780,18 @@ static void flush_backlog(struct work_st
@@ -5789,7 +5800,18 @@ static void flush_backlog(struct work_st
input_queue_head_incr(sd);
}
}
@ -86,7 +86,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
}
static bool flush_required(int cpu)
@@ -6452,6 +6474,7 @@ static int process_backlog(struct napi_s
@@ -6472,6 +6494,7 @@ static int process_backlog(struct napi_s
local_irq_disable();
rps_lock(sd);
@ -94,7 +94,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
if (skb_queue_empty(&sd->input_pkt_queue)) {
/*
* Inline a custom version of __napi_complete().
@@ -6461,7 +6484,8 @@ static int process_backlog(struct napi_s
@@ -6481,7 +6504,8 @@ static int process_backlog(struct napi_s
* We can use a plain write instead of clear_bit(),
* and we dont need an smp_mb() memory barrier.
*/
@ -104,7 +104,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
again = false;
} else {
skb_queue_splice_tail_init(&sd->input_pkt_queue,
@@ -6878,6 +6902,57 @@ int dev_set_threaded(struct net_device *
@@ -6898,6 +6922,57 @@ int dev_set_threaded(struct net_device *
}
EXPORT_SYMBOL(dev_set_threaded);
@ -162,7 +162,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
void netif_napi_add(struct net_device *dev, struct napi_struct *napi,
int (*poll)(struct napi_struct *, int), int weight)
{
@@ -11354,6 +11429,9 @@ static int dev_cpu_dead(unsigned int old
@@ -11378,6 +11453,9 @@ static int dev_cpu_dead(unsigned int old
raise_softirq_irqoff(NET_TX_SOFTIRQ);
local_irq_enable();
@ -172,7 +172,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
#ifdef CONFIG_RPS
remsd = oldsd->rps_ipi_list;
oldsd->rps_ipi_list = NULL;
@@ -11693,6 +11771,7 @@ static int __init net_dev_init(void)
@@ -11717,6 +11795,7 @@ static int __init net_dev_init(void)
sd->cpu = i;
#endif

View file

@ -351,7 +351,7 @@ Signed-off-by: Alexandros C. Couloumbis <alex@ozo.com>
+ LZMA_FREE(address);
+}
+
+static ISzAlloc lzma_alloc = {p_lzma_malloc, p_lzma_free};
+static ISzAlloc lzma_alloc = { .Alloc = p_lzma_malloc, .Free = p_lzma_free };
+
+#endif
--- /dev/null

View file

@ -0,0 +1,43 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;
/plugin/;
/ {
compatible = "cmcc,rax3000m", "mediatek,mt7981";
fragment@0 {
target = <&mmc0>;
__overlay__ {
bus-width = <8>;
max-frequency = <26000000>;
no-sd;
no-sdio;
non-removable;
pinctrl-names = "default", "state_uhs";
pinctrl-0 = <&mmc0_pins_default>;
pinctrl-1 = <&mmc0_pins_uhs>;
vmmc-supply = <&reg_3p3v>;
status = "okay";
};
};
fragment@1 {
target = <&pio>;
__overlay__ {
mmc0_pins_default: mmc0-pins {
mux {
function = "flash";
groups = "emmc_45";
};
};
mmc0_pins_uhs: mmc0-uhs-pins {
mux {
function = "flash";
groups = "emmc_45";
};
};
};
};
};

View file

@ -0,0 +1,128 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;
/plugin/;
/ {
compatible = "cmcc,rax3000m", "mediatek,mt7981";
fragment@0 {
target = <&gmac0>;
__overlay__ {
nvmem-cells = <&macaddr_factory_2a 0>;
nvmem-cell-names = "mac-address";
};
};
fragment@1 {
target = <&gmac1>;
__overlay__ {
nvmem-cells = <&macaddr_factory_24 0>;
nvmem-cell-names = "mac-address";
};
};
fragment@2 {
target = <&pio>;
__overlay__ {
spi0_flash_pins: spi0-pins {
mux {
function = "spi";
groups = "spi0", "spi0_wp_hold";
};
conf-pu {
pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP";
drive-strength = <8>;
mediatek,pull-up-adv = <0>; /* bias-disable */
};
conf-pd {
pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO";
drive-strength = <8>;
mediatek,pull-up-adv = <0>; /* bias-disable */
};
};
};
};
fragment@3 {
target = <&spi0>;
__overlay__ {
pinctrl-names = "default";
pinctrl-0 = <&spi0_flash_pins>;
status = "okay";
spi_nand@0 {
compatible = "spi-nand";
#address-cells = <1>;
#size-cells = <1>;
reg = <0>;
spi-max-frequency = <52000000>;
spi-tx-bus-width = <4>;
spi-rx-bus-width = <4>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "bl2";
reg = <0x00000 0x0100000>;
read-only;
};
partition@100000 {
label = "u-boot-env";
reg = <0x100000 0x80000>;
};
factory: partition@180000 {
label = "factory";
reg = <0x180000 0x200000>;
read-only;
compatible = "nvmem-cells";
nvmem-layout {
compatible = "fixed-layout";
#address-cells = <1>;
#size-cells = <1>;
macaddr_factory_24: macaddr@24 {
compatible = "mac-base";
reg = <0x24 0x6>;
#nvmem-cell-cells = <1>;
};
macaddr_factory_2a: macaddr@2a {
compatible = "mac-base";
reg = <0x2a 0x6>;
#nvmem-cell-cells = <1>;
};
};
};
partition@380000 {
label = "fip";
reg = <0x380000 0x200000>;
read-only;
};
partition@580000 {
label = "ubi";
reg = <0x580000 0x7200000>;
};
};
};
};
};
fragment@4 {
target = <&wifi>;
__overlay__ {
mediatek,mtd-eeprom = <&factory 0x0>;
};
};
};

View file

@ -0,0 +1,156 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/*
* Copyright (C) 2023 Tianling Shen <cnsztl@immortalwrt.org>
*/
/dts-v1/;
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include "mt7981.dtsi"
/ {
model = "CMCC RAX3000M";
compatible = "cmcc,rax3000m", "mediatek,mt7981";
aliases {
led-boot = &red_led;
led-failsafe = &red_led;
led-running = &green_led;
led-upgrade = &green_led;
serial0 = &uart0;
};
chosen {
stdout-path = "serial0:115200n8";
};
memory {
reg = <0 0x40000000 0 0x20000000>;
};
gpio-keys {
compatible = "gpio-keys";
button-reset {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&pio 1 GPIO_ACTIVE_LOW>;
};
button-mesh {
label = "mesh";
linux,code = <BTN_9>;
linux,input-type = <EV_SW>;
gpios = <&pio 0 GPIO_ACTIVE_LOW>;
};
};
gpio-leds {
compatible = "gpio-leds";
green_led: led-0 {
label = "green:status";
gpios = <&pio 9 GPIO_ACTIVE_LOW>;
};
led-1 {
label = "blue:status";
gpios = <&pio 12 GPIO_ACTIVE_LOW>;
};
red_led: led-2 {
label = "red:status";
gpios = <&pio 35 GPIO_ACTIVE_LOW>;
};
};
};
&eth {
status = "okay";
gmac0: mac@0 {
compatible = "mediatek,eth-mac";
reg = <0>;
phy-mode = "2500base-x";
fixed-link {
speed = <2500>;
full-duplex;
pause;
};
};
gmac1: mac@1 {
compatible = "mediatek,eth-mac";
reg = <1>;
phy-mode = "gmii";
phy-handle = <&int_gbe_phy>;
};
};
&mdio_bus {
switch: switch@0 {
compatible = "mediatek,mt7531";
reg = <31>;
reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>;
interrupt-controller;
#interrupt-cells = <1>;
interrupt-parent = <&pio>;
interrupts = <38 IRQ_TYPE_LEVEL_HIGH>;
};
};
&switch {
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
label = "lan3";
};
port@1 {
reg = <1>;
label = "lan2";
};
port@2 {
reg = <2>;
label = "lan1";
};
port@6 {
reg = <6>;
ethernet = <&gmac0>;
phy-mode = "2500base-x";
fixed-link {
speed = <2500>;
full-duplex;
pause;
};
};
};
};
&uart0 {
status = "okay";
};
&usb_phy {
status = "okay";
};
&watchdog {
status = "okay";
};
&wifi {
status = "okay";
};
&xhci {
status = "okay";
};

View file

@ -29,6 +29,7 @@ mediatek_setup_interfaces()
glinet,gl-mt3000)
ucidef_set_interfaces_lan_wan eth1 eth0
;;
cmcc,rax3000m|\
h3c,magic-nx30-pro)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" eth1
;;
@ -91,6 +92,15 @@ mediatek_setup_macs()
wan_mac=$(macaddr_add "$lan_mac" 3)
label_mac=$lan_mac
;;
cmcc,rax3000m)
case "$(cmdline_get_var root)" in
/dev/mmc*)
wan_mac=$(mmc_get_mac_binary factory 0x2a)
lan_mac=$(mmc_get_mac_binary factory 0x24)
label_mac=$wan_mac
;;
esac
;;
glinet,gl-mt6000)
label_mac=$(mmc_get_mac_binary factory 0x0a)
wan_mac=$label_mac

View file

@ -16,6 +16,13 @@ case "$FIRMWARE" in
;;
"mediatek/mt7981_eeprom_mt7976_dbdc.bin")
case "$board" in
cmcc,rax3000m)
case "$(cmdline_get_var root)" in
/dev/mmc*)
caldata_extract_mmc "factory" 0x0 0x1000
;;
esac
;;
ubnt,unifi-6-plus)
caldata_extract_mmc "factory" 0x0 0x1000
;;

View file

@ -35,6 +35,17 @@ case "$board" in
[ "$PHYNBR" = "0" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress
[ "$PHYNBR" = "1" ] && macaddr_setbit_la $(macaddr_add $addr 2) > /sys${DEVPATH}/macaddress
;;
cmcc,rax3000m)
case "$(cmdline_get_var root)" in
/dev/mmc*)
addr=$(mmc_get_mac_binary factory 0xa)
;;
*)
addr=$(mtd_get_mac_binary factory 0xa)
;;
esac
[ "$PHYNBR" = "1" ] && echo "$addr" > /sys${DEVPATH}/macaddress
;;
cudy,wr3000-v1)
addr=$(mtd_get_mac_binary bdinfo 0xde00)
# Originally, phy0 is phy1 mac with LA bit set. However, this would conflict

View file

@ -81,6 +81,18 @@ platform_do_upgrade() {
;;
esac
;;
cmcc,rax3000m)
case "$(cmdline_get_var root)" in
/dev/mmc*)
CI_KERNPART="production"
emmc_do_upgrade "$1"
;;
*)
CI_KERNPART="fit"
nand_do_upgrade "$1"
;;
esac
;;
cudy,wr3000-v1)
default_do_upgrade "$1"
;;
@ -130,7 +142,8 @@ platform_check_image() {
[ "$#" -gt 1 ] && return 1
case "$board" in
bananapi,bpi-r3)
bananapi,bpi-r3|\
cmcc,rax3000m)
[ "$magic" != "d00dfeed" ] && {
echo "Invalid image type."
return 1
@ -148,7 +161,8 @@ platform_check_image() {
platform_copy_config() {
case "$(board_name)" in
bananapi,bpi-r3)
bananapi,bpi-r3|\
cmcc,rax3000m)
case "$(cmdline_get_var root)" in
/dev/mmc*)
emmc_copy_config

View file

@ -204,6 +204,39 @@ define Device/cetron_ct3003
endef
TARGET_DEVICES += cetron_ct3003
define Device/cmcc_rax3000m
DEVICE_VENDOR := CMCC
DEVICE_MODEL := RAX3000M
DEVICE_DTS := mt7981b-cmcc-rax3000m
DEVICE_DTS_OVERLAY := mt7981b-cmcc-rax3000m-emmc mt7981b-cmcc-rax3000m-nand
DEVICE_DTS_DIR := ../dts
DEVICE_DTC_FLAGS := --pad 4096
DEVICE_DTS_LOADADDR := 0x43f00000
DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware kmod-usb3 \
e2fsprogs f2fsck mkf2fs
KERNEL_LOADADDR := 0x44000000
KERNEL := kernel-bin | gzip
KERNEL_INITRAMFS := kernel-bin | lzma | \
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
KERNEL_INITRAMFS_SUFFIX := -recovery.itb
KERNEL_IN_UBI := 1
UBOOTENV_IN_UBI := 1
IMAGES := sysupgrade.itb
IMAGE_SIZE := $$(shell expr 64 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m
IMAGE/sysupgrade.itb := append-kernel | \
fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | \
pad-rootfs | append-metadata
ARTIFACTS := \
emmc-gpt.bin emmc-preloader.bin emmc-bl31-uboot.fip \
nand-preloader.bin nand-bl31-uboot.fip
ARTIFACT/emmc-gpt.bin := mt798x-gpt emmc
ARTIFACT/emmc-preloader.bin := mt7981-bl2 emmc-ddr4
ARTIFACT/emmc-bl31-uboot.fip := mt7981-bl31-uboot cmcc_rax3000m-emmc
ARTIFACT/nand-preloader.bin := mt7981-bl2 spim-nand-ddr4
ARTIFACT/nand-bl31-uboot.fip := mt7981-bl31-uboot cmcc_rax3000m-nand
endef
TARGET_DEVICES += cmcc_rax3000m
define Device/cudy_wr3000-v1
DEVICE_VENDOR := Cudy
DEVICE_MODEL := WR3000

View file

@ -18,12 +18,7 @@ mvebu_setup_interfaces()
cznic,turris-omnia)
ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3 lan4" "eth2"
;;
fortinet,fg-50e)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan5" "eth1 eth2"
;;
iptime,nas1dual)
ucidef_set_interface_lan "eth0 eth1" "dhcp"
;;
fortinet,fg-30e|\
linksys,wrt1200ac|\
linksys,wrt1900ac-v1|\
linksys,wrt1900ac-v2|\
@ -32,6 +27,12 @@ mvebu_setup_interfaces()
linksys,wrt32x)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
;;
fortinet,fg-50e)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan5" "eth1 eth2"
;;
iptime,nas1dual)
ucidef_set_interface_lan "eth0 eth1" "dhcp"
;;
marvell,a385-db-ap)
ucidef_set_interfaces_lan_wan "eth0 eth1" "eth2"
;;

View file

@ -52,6 +52,7 @@ platform_do_upgrade() {
solidrun,clearfog-pro-a1)
legacy_sdcard_do_upgrade "$1"
;;
fortinet,fg-30e|\
fortinet,fg-50e)
fortinet_do_upgrade "$1"
;;

View file

@ -0,0 +1,104 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include "armada-385-fortinet-fg-x0e.dtsi"
/ {
model = "Fortinet FortiGate 30E";
compatible = "fortinet,fg-30e", "marvell,armada385", "marvell,armada380";
memory@0 {
device_type = "memory";
reg = <0x00000000 0x40000000>; /* 1GB */
};
};
&gpio_leds {
led-14 {
label = "amber:speed_wan";
gpios = <&gpio2 2 GPIO_ACTIVE_HIGH>;
color = <LED_COLOR_ID_AMBER>;
linux,default-trigger = "mv88e6xxx-1:00:100Mbps";
};
led-15 {
label = "green:speed_wan";
gpios = <&gpio2 3 GPIO_ACTIVE_HIGH>;
color = <LED_COLOR_ID_GREEN>;
linux,default-trigger = "mv88e6xxx-1:00:1Gbps";
};
};
&pinctrl {
pmx_switch_pins: switch-pins {
marvell,pins = "mpp19";
marvell,function = "gpio";
};
};
&mdio {
pinctrl-names = "default";
pinctrl-0 = <&mdio_pins>, <&pmx_switch_pins>;
/* Marvell 88E6176 */
switch@2 {
compatible = "marvell,mv88e6085";
reg = <0x2>;
reset-gpios = <&gpio0 19 GPIO_ACTIVE_LOW>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
label = "wan";
nvmem-cells = <&macaddr_bdinfo_d880>;
nvmem-cell-names = "mac-address";
mac-address-increment = <1>;
};
port@1 {
reg = <1>;
label = "lan4";
nvmem-cells = <&macaddr_bdinfo_d880>;
nvmem-cell-names = "mac-address";
mac-address-increment = <5>;
};
port@2 {
reg = <2>;
label = "lan3";
nvmem-cells = <&macaddr_bdinfo_d880>;
nvmem-cell-names = "mac-address";
mac-address-increment = <4>;
};
port@3 {
reg = <3>;
label = "lan2";
nvmem-cells = <&macaddr_bdinfo_d880>;
nvmem-cell-names = "mac-address";
mac-address-increment = <3>;
};
port@4 {
reg = <4>;
label = "lan1";
nvmem-cells = <&macaddr_bdinfo_d880>;
nvmem-cell-names = "mac-address";
mac-address-increment = <2>;
};
port@6 {
reg = <6>;
ethernet = <&eth0>;
phy-connection-type = "rgmii-id";
fixed-link {
speed = <1000>;
full-duplex;
};
};
};
};
};

View file

@ -1,215 +1,45 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/leds/common.h>
#include "armada-385.dtsi"
#include "armada-385-fortinet-fg-x0e.dtsi"
/ {
model = "Fortinet FortiGate 50E";
compatible = "fortinet,fg-50e", "marvell,armada385", "marvell,armada380";
aliases {
led-boot = &led_status_green;
led-failsafe = &led_status_red;
led-running = &led_status_green;
led-upgrade = &led_status_green;
label-mac-device = &eth0;
};
chosen {
stdout-path = "serial0:9600n8";
};
memory@0 {
device_type = "memory";
reg = <0x00000000 0x80000000>; /* 2GB */
};
soc {
ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000
MBUS_ID(0x01, 0x1d) 0 0xfff00000 0x100000
MBUS_ID(0x09, 0x19) 0 0xf1100000 0x10000
MBUS_ID(0x09, 0x15) 0 0xf1110000 0x10000
MBUS_ID(0x0c, 0x04) 0 0xf1200000 0x100000>;
};
gpio-keys {
compatible = "gpio-keys";
pinctrl-names = "default";
pinctrl-0 = <&pmx_gpio_keys_pins>;
reset {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&gpio1 22 GPIO_ACTIVE_LOW>;
};
};
gpio-leds {
compatible = "gpio-leds";
pinctrl-names = "default";
pinctrl-0 = <&pmx_gpio_leds_pins>;
led-0 {
label = "red:alarm";
gpios = <&gpio0 30 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_RED>;
function = LED_FUNCTION_ALARM;
};
led-1 {
label = "red:ha";
gpios = <&gpio1 0 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_RED>;
};
led_status_green: led-2 {
label = "green:sta";
gpios = <&gpio1 1 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_STATUS;
};
led-3 {
label = "green:ha";
gpios = <&gpio1 3 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_GREEN>;
};
led-4 {
label = "amber:alarm";
gpios = <&gpio1 13 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_AMBER>;
function = LED_FUNCTION_ALARM;
};
led_status_red: led-5 {
label = "red:sta";
gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_RED>;
function = LED_FUNCTION_STATUS;
};
led-6 {
label = "green:speed_wan1";
gpios = <&gpio2 0 GPIO_ACTIVE_HIGH>;
color = <LED_COLOR_ID_GREEN>;
linux,default-trigger = "f1072004.mdio-mii:00:1Gbps";
};
led-7 {
label = "green:speed_wan2";
gpios = <&gpio2 1 GPIO_ACTIVE_HIGH>;
color = <LED_COLOR_ID_GREEN>;
linux,default-trigger = "f1072004.mdio-mii:01:1Gbps";
};
led-8 {
label = "amber:speed_lan5";
gpios = <&gpio2 2 GPIO_ACTIVE_HIGH>;
color = <LED_COLOR_ID_AMBER>;
linux,default-trigger = "mv88e6xxx-1:00:100Mbps";
};
led-9 {
label = "green:speed_lan5";
gpios = <&gpio2 3 GPIO_ACTIVE_HIGH>;
color = <LED_COLOR_ID_GREEN>;
linux,default-trigger = "mv88e6xxx-1:00:1Gbps";
};
led-10 {
label = "green:speed_lan4";
gpios = <&gpio2 4 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_GREEN>;
linux,default-trigger = "mv88e6xxx-1:01:1Gbps";
};
led-11 {
label = "amber:speed_lan4";
gpios = <&gpio2 5 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_AMBER>;
linux,default-trigger = "mv88e6xxx-1:01:100Mbps";
};
led-12 {
label = "amber:speed_lan3";
gpios = <&gpio2 6 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_AMBER>;
linux,default-trigger = "mv88e6xxx-1:02:100Mbps";
};
led-13 {
label = "green:speed_lan3";
gpios = <&gpio2 7 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_GREEN>;
linux,default-trigger = "mv88e6xxx-1:02:1Gbps";
};
led-14 {
label = "green:speed_lan1";
gpios = <&gpio2 12 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_GREEN>;
linux,default-trigger = "mv88e6xxx-1:04:1Gbps";
};
led-15 {
label = "amber:speed_lan1";
gpios = <&gpio2 13 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_AMBER>;
linux,default-trigger = "mv88e6xxx-1:04:100Mbps";
};
led-16 {
label = "green:speed_lan2";
gpios = <&gpio2 14 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_GREEN>;
linux,default-trigger = "mv88e6xxx-1:03:1Gbps";
};
led-17 {
label = "amber:speed_lan2";
gpios = <&gpio2 15 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_AMBER>;
linux,default-trigger = "mv88e6xxx-1:03:100Mbps";
};
};
reg_usb_vbus: regulator-usb-vbus {
compatible = "fixed-regulator";
regulator-name = "usb-vbus";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
gpio = <&gpio1 21 GPIO_ACTIVE_LOW>;
regulator-always-on;
};
};
&i2c0 {
pinctrl-names = "default";
pinctrl-0 = <&i2c0_pins>;
status = "okay";
gpio2: gpio@24 {
compatible = "nxp,pca9555";
reg = <0x24>;
gpio-controller;
#gpio-cells = <0x2>;
&gpio_leds {
led-14 {
label = "green:speed_wan1";
gpios = <&gpio2 0 GPIO_ACTIVE_HIGH>;
color = <LED_COLOR_ID_GREEN>;
linux,default-trigger = "f1072004.mdio-mii:00:1Gbps";
};
hwmon@28 {
compatible = "nuvoton,nct7802";
reg = <0x28>;
led-15 {
label = "green:speed_wan2";
gpios = <&gpio2 1 GPIO_ACTIVE_HIGH>;
color = <LED_COLOR_ID_GREEN>;
linux,default-trigger = "f1072004.mdio-mii:01:1Gbps";
};
};
&uart0 {
pinctrl-names = "default";
pinctrl-0 = <&uart0_pins>;
status = "okay";
led-16 {
label = "amber:speed_lan5";
gpios = <&gpio2 2 GPIO_ACTIVE_HIGH>;
color = <LED_COLOR_ID_AMBER>;
linux,default-trigger = "mv88e6xxx-1:00:100Mbps";
};
led-17 {
label = "green:speed_lan5";
gpios = <&gpio2 3 GPIO_ACTIVE_HIGH>;
color = <LED_COLOR_ID_GREEN>;
linux,default-trigger = "mv88e6xxx-1:00:1Gbps";
};
};
&pinctrl {
@ -217,48 +47,6 @@
marvell,pins = "mpp19", "mpp20", "mpp23", "mpp34", "mpp41";
marvell,function = "gpio";
};
pmx_gpio_leds_pins: gpio-leds-pins {
marvell,pins = "mpp30", "mpp32", "mpp33", "mpp35",
"mpp45", "mpp47";
marvell,function = "gpio";
};
pmx_usb_pins: usb-pins {
marvell,pins = "mpp53";
marvell,function = "gpio";
};
pmx_gpio_keys_pins: gpio-keys-pins {
marvell,pins = "mpp54";
marvell,function = "gpio";
};
};
&bm {
status = "okay";
};
&bm_bppi {
status = "okay";
};
&eth0 {
pinctrl-names = "default";
pinctrl-0 = <&ge0_rgmii_pins>;
status = "okay";
phy-connection-type = "rgmii-id";
buffer-manager = <&bm>;
bm,pool-long = <0>;
bm,pool-short = <1>;
nvmem-cells = <&macaddr_bdinfo_d880>;
nvmem-cell-names = "mac-address";
fixed-link {
speed = <1000>;
full-duplex;
};
};
&eth1 {
@ -388,120 +176,3 @@
};
};
};
&usb3_0 {
pinctrl-names = "default";
pinctrl-0 = <&pmx_usb_pins>;
status = "okay";
vbus-supply = <&reg_usb_vbus>;
};
&spi1 {
pinctrl-names = "default";
pinctrl-0 = <&spi1_pins>;
status = "okay";
flash@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <50000000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
reg = <0x0 0x1c0000>;
label = "u-boot";
read-only;
};
partition@1c0000 {
reg = <0x1c0000 0x10000>;
label = "firmware-info";
/*
* 0x10 - 0x2f : image name (image1)
* 0x30 - 0x4f : image name (image2)
* 0x170 (1byte): active image (0x0/0x1)
* 0x184 - 0x185: kernel block count (image1)
* 0x18c - 0x18d: rootfs block count (image1)
* 0x194 - 0x195: kernel block count (image2)
* 0x19c - 0x19d: rootfs block count (image2)
* 0x1be (1byte): bit7 -> active flag (image1)?
* 0x1ce (1byte): bit7 -> active flag (image2)?
*
* Note: block size --> 0x200 (512 bytes)
*/
};
partition@1d0000 {
reg = <0x1d0000 0x10000>;
label = "dtb";
read-only;
};
partition@1e0000 {
reg = <0x1e0000 0x10000>;
label = "u-boot-env";
read-only;
};
partition@1f0000 {
reg = <0x1f0000 0x10000>;
label = "board-info";
read-only;
compatible = "nvmem-cells";
#address-cells = <1>;
#size-cells = <1>;
macaddr_bdinfo_d880: macaddr@d880 {
reg = <0xd880 0x6>;
};
};
partition@200000 {
reg = <0x200000 0x600000>;
label = "kernel";
};
partition@800000 {
reg = <0x800000 0x1800000>;
label = "rootfs";
};
partition@2000000 {
reg = <0x2000000 0x600000>;
label = "kn2";
read-only;
};
partition@2600000 {
reg = <0x2600000 0x1800000>;
label = "rfs2";
read-only;
};
partition@3e00000 {
reg = <0x3e00000 0x1200000>;
label = "part1";
read-only;
};
partition@5000000 {
reg = <0x5000000 0x1200000>;
label = "part2";
read-only;
};
partition@6200000 {
reg = <0x6200000 0x1e00000>;
label = "config";
read-only;
};
};
};
};

View file

@ -0,0 +1,338 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/leds/common.h>
#include "armada-385.dtsi"
/ {
aliases {
led-boot = &led_status_green;
led-failsafe = &led_status_red;
led-running = &led_status_green;
led-upgrade = &led_status_green;
label-mac-device = &eth0;
};
chosen {
stdout-path = "serial0:9600n8";
};
soc {
ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000
MBUS_ID(0x01, 0x1d) 0 0xfff00000 0x100000
MBUS_ID(0x09, 0x19) 0 0xf1100000 0x10000
MBUS_ID(0x09, 0x15) 0 0xf1110000 0x10000
MBUS_ID(0x0c, 0x04) 0 0xf1200000 0x100000>;
};
gpio-keys {
compatible = "gpio-keys";
pinctrl-names = "default";
pinctrl-0 = <&pmx_gpio_keys_pins>;
reset {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&gpio1 22 GPIO_ACTIVE_LOW>;
};
};
gpio_leds: gpio-leds {
compatible = "gpio-leds";
pinctrl-names = "default";
pinctrl-0 = <&pmx_gpio_leds_pins>;
led-0 {
label = "red:alarm";
gpios = <&gpio0 30 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_RED>;
function = LED_FUNCTION_ALARM;
};
led-1 {
label = "red:ha";
gpios = <&gpio1 0 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_RED>;
};
led_status_green: led-2 {
label = "green:sta";
gpios = <&gpio1 1 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_STATUS;
};
led-3 {
label = "green:ha";
gpios = <&gpio1 3 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_GREEN>;
};
led-4 {
label = "amber:alarm";
gpios = <&gpio1 13 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_AMBER>;
function = LED_FUNCTION_ALARM;
};
led_status_red: led-5 {
label = "red:sta";
gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_RED>;
function = LED_FUNCTION_STATUS;
};
led-6 {
label = "green:speed_lan4";
gpios = <&gpio2 4 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_GREEN>;
linux,default-trigger = "mv88e6xxx-1:01:1Gbps";
};
led-7 {
label = "amber:speed_lan4";
gpios = <&gpio2 5 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_AMBER>;
linux,default-trigger = "mv88e6xxx-1:01:100Mbps";
};
led-8 {
label = "amber:speed_lan3";
gpios = <&gpio2 6 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_AMBER>;
linux,default-trigger = "mv88e6xxx-1:02:100Mbps";
};
led-9 {
label = "green:speed_lan3";
gpios = <&gpio2 7 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_GREEN>;
linux,default-trigger = "mv88e6xxx-1:02:1Gbps";
};
led-10 {
label = "green:speed_lan1";
gpios = <&gpio2 12 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_GREEN>;
linux,default-trigger = "mv88e6xxx-1:04:1Gbps";
};
led-11 {
label = "amber:speed_lan1";
gpios = <&gpio2 13 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_AMBER>;
linux,default-trigger = "mv88e6xxx-1:04:100Mbps";
};
led-12 {
label = "green:speed_lan2";
gpios = <&gpio2 14 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_GREEN>;
linux,default-trigger = "mv88e6xxx-1:03:1Gbps";
};
led-13 {
label = "amber:speed_lan2";
gpios = <&gpio2 15 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_AMBER>;
linux,default-trigger = "mv88e6xxx-1:03:100Mbps";
};
};
reg_usb_vbus: regulator-usb-vbus {
compatible = "fixed-regulator";
regulator-name = "usb-vbus";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
gpio = <&gpio1 21 GPIO_ACTIVE_LOW>;
regulator-always-on;
};
};
&i2c0 {
pinctrl-names = "default";
pinctrl-0 = <&i2c0_pins>;
status = "okay";
gpio2: gpio@24 {
compatible = "nxp,pca9555";
reg = <0x24>;
gpio-controller;
#gpio-cells = <0x2>;
};
hwmon@28 {
compatible = "nuvoton,nct7802";
reg = <0x28>;
};
};
&uart0 {
pinctrl-names = "default";
pinctrl-0 = <&uart0_pins>;
status = "okay";
};
&pinctrl {
pmx_gpio_leds_pins: gpio-leds-pins {
marvell,pins = "mpp30", "mpp32", "mpp33", "mpp35",
"mpp45", "mpp47";
marvell,function = "gpio";
};
pmx_usb_pins: usb-pins {
marvell,pins = "mpp53";
marvell,function = "gpio";
};
pmx_gpio_keys_pins: gpio-keys-pins {
marvell,pins = "mpp54";
marvell,function = "gpio";
};
};
&bm {
status = "okay";
};
&bm_bppi {
status = "okay";
};
&eth0 {
pinctrl-names = "default";
pinctrl-0 = <&ge0_rgmii_pins>;
status = "okay";
phy-connection-type = "rgmii-id";
buffer-manager = <&bm>;
bm,pool-long = <0>;
bm,pool-short = <1>;
nvmem-cells = <&macaddr_bdinfo_d880>;
nvmem-cell-names = "mac-address";
fixed-link {
speed = <1000>;
full-duplex;
};
};
&usb3_0 {
pinctrl-names = "default";
pinctrl-0 = <&pmx_usb_pins>;
status = "okay";
vbus-supply = <&reg_usb_vbus>;
};
&spi1 {
pinctrl-names = "default";
pinctrl-0 = <&spi1_pins>;
status = "okay";
flash@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <50000000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
reg = <0x0 0x1c0000>;
label = "u-boot";
read-only;
};
partition@1c0000 {
reg = <0x1c0000 0x10000>;
label = "firmware-info";
/*
* 0x10 - 0x2f : image name (image1)
* 0x30 - 0x4f : image name (image2)
* 0x170 (1byte): active image (0x0/0x1)
* 0x184 - 0x185: kernel block count (image1)
* 0x18c - 0x18d: rootfs block count (image1)
* 0x194 - 0x195: kernel block count (image2)
* 0x19c - 0x19d: rootfs block count (image2)
* 0x1be (1byte): bit7 -> active flag (image1)?
* 0x1ce (1byte): bit7 -> active flag (image2)?
*
* Note: block size --> 0x200 (512 bytes)
*/
};
partition@1d0000 {
reg = <0x1d0000 0x10000>;
label = "dtb";
read-only;
};
partition@1e0000 {
reg = <0x1e0000 0x10000>;
label = "u-boot-env";
read-only;
};
partition@1f0000 {
reg = <0x1f0000 0x10000>;
label = "board-info";
read-only;
compatible = "nvmem-cells";
#address-cells = <1>;
#size-cells = <1>;
macaddr_bdinfo_d880: macaddr@d880 {
reg = <0xd880 0x6>;
};
};
partition@200000 {
reg = <0x200000 0x600000>;
label = "kernel";
};
partition@800000 {
reg = <0x800000 0x1800000>;
label = "rootfs";
};
partition@2000000 {
reg = <0x2000000 0x600000>;
label = "kn2";
read-only;
};
partition@2600000 {
reg = <0x2600000 0x1800000>;
label = "rfs2";
read-only;
};
partition@3e00000 {
reg = <0x3e00000 0x1200000>;
label = "part1";
read-only;
};
partition@5000000 {
reg = <0x5000000 0x1200000>;
label = "part2";
read-only;
};
partition@6200000 {
reg = <0x6200000 0x1e00000>;
label = "config";
read-only;
};
};
};
};

View file

@ -95,6 +95,21 @@ define Device/cznic_turris-omnia
endef
TARGET_DEVICES += cznic_turris-omnia
define Device/fortinet_fg-30e
DEVICE_VENDOR := Fortinet
DEVICE_MODEL := FortiGate 30E
SOC := armada-385
KERNEL := kernel-bin | append-dtb
KERNEL_INITRAMFS := kernel-bin | append-dtb | fortigate-header | \
gzip-filename FGT30E
KERNEL_SIZE := 6144k
DEVICE_DTS := armada-385-fortinet-fg-30e
IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | \
sysupgrade-tar rootfs=$$$$@ | append-metadata
DEVICE_PACKAGES := kmod-hwmon-nct7802
endef
TARGET_DEVICES += fortinet_fg-30e
define Device/fortinet_fg-50e
DEVICE_VENDOR := Fortinet
DEVICE_MODEL := FortiGate 50E

View file

@ -0,0 +1,253 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;
#include "ipq8074.dtsi"
#include "ipq8074-hk-cpu.dtsi"
#include "ipq8074-ess.dtsi"
#include <dt-bindings/input/input.h>
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/leds/common.h>
/ {
model = "Netgear WAX630";
compatible = "netgear,wax630", "qcom,ipq8074";
aliases {
serial0 = &blsp1_uart5;
ethernet0 = &dp6_syn;
ethernet1 = &dp4;
label-mac-device = &dp6_syn;
led-boot = &led_system_blue;
led-failsafe = &led_system_red;
led-running = &led_system_green;
led-upgrade = &led_system_blue;
};
chosen {
stdout-path = "serial0:115200n8";
bootargs-append = " root=/dev/ubiblock0_1";
};
keys {
compatible = "gpio-keys";
reset {
label = "reset";
gpios = <&tlmm 54 GPIO_ACTIVE_LOW>;
linux,code = <KEY_RESTART>;
};
};
led-spi {
compatible = "spi-gpio";
#address-cells = <1>;
#size-cells = <0>;
sck-gpios = <&tlmm 18 GPIO_ACTIVE_HIGH>;
mosi-gpios = <&tlmm 19 GPIO_ACTIVE_HIGH>;
led_gpio: led-gpio@0 {
compatible = "fairchild,74hc595";
reg = <0>;
gpio-controller;
#gpio-cells = <2>;
registers-number = <1>;
enable-gpios = <&tlmm 20 GPIO_ACTIVE_HIGH>;
spi-max-frequency = <1000000>;
};
};
leds {
compatible = "gpio-leds";
led_system_red: system-red {
label = "system:red";
gpios = <&tlmm 22 GPIO_ACTIVE_LOW>;
default-state = "off";
};
led_system_green: system-green {
label = "system:green";
gpios = <&tlmm 38 GPIO_ACTIVE_LOW>;
default-state = "off";
};
led_system_blue: system-blue {
label = "system:blue";
gpios = <&tlmm 21 GPIO_ACTIVE_LOW>;
default-state = "off";
};
lan1-green {
label = "lan1:green";
gpios = <&tlmm 26 GPIO_ACTIVE_LOW>;
default-state = "off";
};
lan1-orange {
label = "lan1:orange";
gpios = <&tlmm 27 GPIO_ACTIVE_LOW>;
default-state = "off";
};
lan2-green {
label = "lan2:green";
gpios = <&tlmm 57 GPIO_ACTIVE_LOW>;
default-state = "off";
};
lan2-orange {
label = "lan2:orange";
gpios = <&tlmm 60 GPIO_ACTIVE_LOW>;
default-state = "off";
};
2g-blue {
label = "wlan2g:blue";
gpios = <&tlmm 29 GPIO_ACTIVE_LOW>;
default-state = "off";
};
2g-green {
label = "wlan2g:green";
gpios = <&tlmm 30 GPIO_ACTIVE_LOW>;
default-state = "off";
};
5g-low-blue {
label = "wlan5g_low:blue";
gpios = <&tlmm 33 GPIO_ACTIVE_LOW>;
default-state = "off";
};
5g-low-green {
label = "wlan5g_low:green";
gpios = <&tlmm 34 GPIO_ACTIVE_LOW>;
default-state = "off";
};
5g-high-blue {
label = "wlan5g_high:blue";
gpios = <&tlmm 31 GPIO_ACTIVE_LOW>;
default-state = "off";
};
5g-high-green {
label = "wlan5g_high:green";
gpios = <&tlmm 32 GPIO_ACTIVE_LOW>;
default-state = "off";
};
};
};
&edma {
status = "okay";
};
&switch {
status = "okay";
switch_cpu_bmp = <0x01>;
switch_lan_bmp = <0x3e>;
switch_wan_bmp = <0x40>;
switch_mac_mode = <0x00>;
switch_mac_mode1 = <0xff>;
switch_mac_mode2 = <0x0d>;
bm_tick_mode = <0x00>;
tm_tick_mode = <0x00>;
qcom,port_phyinfo {
port@3 {
port_id = <4>;
phy_address = <3>;
};
port@5 {
port_id = <6>;
phy_address = <28>;
port_mac_sel = "QGMAC_PORT";
};
};
};
&tlmm {
mdio_pins: mdio-pins {
mdc {
pins = "gpio68";
function = "mdc";
drive-strength = <8>;
bias-pull-up;
};
mdio {
pins = "gpio69";
function = "mdio";
drive-strength = <8>;
bias-pull-up;
};
};
};
&mdio {
status = "okay";
pinctrl-0 = <&mdio_pins>;
pinctrl-names = "default";
reset-gpios = <&tlmm 37 GPIO_ACTIVE_LOW>;
qca8075: ethernet-phy@3 {
compatible = "ethernet-phy-ieee802.3-c22";
reg = <3>;
};
qca8081: ethernet-phy@28 {
compatible = "ethernet-phy-id004d.d101";
reg = <28>;
reset-gpios = <&tlmm 25 GPIO_ACTIVE_LOW>;
};
};
&dp4 {
status = "okay";
phy-handle = <&qca8075>;
label = "lan2";
};
&dp6_syn {
status = "okay";
phy-handle = <&qca8081>;
label = "lan1";
};
&qpic_bam {
status = "okay";
};
&qpic_nand {
status = "okay";
nand@0 {
reg = <0>;
nand-ecc-strength = <4>;
nand-ecc-step-size = <512>;
nand-bus-width = <8>;
partitions {
compatible = "qcom,smem-part";
};
};
};
&blsp1_uart5 {
status = "okay";
};
&wifi {
status = "okay";
qcom,ath11k-calibration-variant = "Netgear-WAX630";
};

View file

@ -23,6 +23,16 @@ define Device/UbiFit
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
endef
define Build/wax6xx-netgear-tar
mkdir $@.tmp
mv $@ $@.tmp/nand-ipq807x-apps.img
md5sum $@.tmp/nand-ipq807x-apps.img | cut -c 1-32 > $@.tmp/nand-ipq807x-apps.md5sum
echo $(DEVICE_MODEL) > $@.tmp/metadata.txt
echo $(DEVICE_MODEL)"_V9.9.9.9" > $@.tmp/version
tar -C $@.tmp/ -cf $@ .
rm -rf $@.tmp
endef
define Device/buffalo_wxr-5950ax12
$(call Device/FitImage)
DEVICE_VENDOR := Buffalo
@ -115,6 +125,25 @@ define Device/netgear_rax120v2
endef
TARGET_DEVICES += netgear_rax120v2
define Device/netgear_wax218
$(call Device/FitImage)
$(call Device/UbiFit)
DEVICE_VENDOR := Netgear
DEVICE_MODEL := WAX218
DEVICE_DTS_CONFIG := config@hk07
BLOCKSIZE := 128k
PAGESIZE := 2048
SOC := ipq8072
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
ARTIFACTS := web-ui-factory.fit
ARTIFACT/web-ui-factory.fit := append-image initramfs-uImage.itb | \
ubinize-kernel | qsdk-ipq-factory-nand
endif
DEVICE_PACKAGES := kmod-spi-gpio kmod-spi-bitbang kmod-gpio-nxp-74hc164 \
ipq-wifi-netgear_wax218
endef
TARGET_DEVICES += netgear_wax218
define Device/netgear_wax620
$(call Device/FitImage)
$(call Device/UbiFit)
@ -129,22 +158,20 @@ define Device/netgear_wax620
endef
TARGET_DEVICES += netgear_wax620
define Device/netgear_wax218
define Device/netgear_wax630
$(call Device/FitImage)
$(call Device/UbiFit)
ARTIFACTS := web-ui-factory.fit
DEVICE_VENDOR := Netgear
DEVICE_MODEL := WAX218
DEVICE_DTS_CONFIG := config@hk07
DEVICE_MODEL := WAX630
DEVICE_DTS_CONFIG := config@hk01
BLOCKSIZE := 128k
PAGESIZE := 2048
SOC := ipq8072
ARTIFACT/web-ui-factory.fit := append-image initramfs-uImage.itb | \
ubinize-kernel | qsdk-ipq-factory-nand
DEVICE_PACKAGES := kmod-spi-gpio kmod-spi-bitbang kmod-gpio-nxp-74hc164 \
ipq-wifi-netgear_wax218
SOC := ipq8074
IMAGES := ui-factory.tar factory.ubi sysupgrade.bin
IMAGE/ui-factory.tar := append-ubi | wax6xx-netgear-tar
DEVICE_PACKAGES += kmod-spi-gpio ipq-wifi-netgear_wax630
endef
TARGET_DEVICES += netgear_wax218
TARGET_DEVICES += netgear_wax630
define Device/prpl_haze
$(call Device/FitImage)

View file

@ -12,14 +12,18 @@ edgecore,eap102)
netgear,rax120v2)
ucidef_set_led_netdev "aqr" "AQR" "white:aqr" "lan5"
;;
netgear,wax620)
ucidef_set_led_netdev "lan" "LAN" "lan:green" "lan"
;;
netgear,wax218)
ucidef_set_led_netdev "lan" "LAN" "blue:lan" "lan"
ucidef_set_led_wlan "wlan5g" "WIFI 5GHz" "blue:wlan5g" "phy0radio"
ucidef_set_led_wlan "wlan2g" "WIFI 2.4GHz" "blue:wlan2g" "phy1radio"
;;
netgear,wax620)
ucidef_set_led_netdev "lan" "LAN" "lan:green" "lan"
;;
netgear,wax630)
ucidef_set_led_netdev "lan1" "LAN1" "lan1:green" "lan1"
ucidef_set_led_netdev "lan2" "LAN2" "lan2:green" "lan2"
;;
redmi,ax6|\
xiaomi,ax3600)
ucidef_set_led_netdev "wan" "WAN" "blue:network" "wan"

View file

@ -29,6 +29,9 @@ ipq807x_setup_interfaces()
netgear,wax620)
ucidef_set_interface_lan "lan" "dhcp"
;;
netgear,wax630)
ucidef_set_interface_lan "lan1 lan2" "dhcp"
;;
prpl,haze)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan"
;;

View file

@ -17,6 +17,7 @@ case "$FIRMWARE" in
netgear,rax120v2|\
netgear,wax218|\
netgear,wax620|\
netgear,wax630|\
qnap,301w|\
redmi,ax6|\
xiaomi,ax3600|\

View file

@ -70,7 +70,8 @@ platform_do_upgrade() {
edimax,cax1800|\
netgear,rax120v2|\
netgear,wax218|\
netgear,wax620)
netgear,wax620|\
netgear,wax630)
nand_do_upgrade "$1"
;;
prpl,haze|\

View file

@ -9,8 +9,8 @@ board_config_update
case $board in
friendlyarm,nanopi-r1|\
friendlyarm,nanopi-r1s-h5)
ucidef_set_led_netdev "wan" "WAN" "nanopi:green:wan" "eth0"
ucidef_set_led_netdev "lan" "LAN" "nanopi:green:lan" "eth1"
ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth0"
ucidef_set_led_netdev "lan" "LAN" "green:lan" "eth1"
;;
esac

View file

@ -17,7 +17,7 @@ CONFIG_ARCH_SUNXI=y
CONFIG_ARCH_SUNXI_MC_SMP=y
CONFIG_ARCH_SUSPEND_POSSIBLE=y
CONFIG_ARM=y
# CONFIG_ARM_ALLWINNER_SUN50I_CPUFREQ_NVMEM is not set
CONFIG_ARM_ALLWINNER_SUN50I_CPUFREQ_NVMEM=y
CONFIG_ARM_APPENDED_DTB=y
CONFIG_ARM_ARCH_TIMER=y
CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y

View file

@ -18,7 +18,7 @@ CONFIG_ARCH_SUNXI=y
CONFIG_ARCH_SUNXI_MC_SMP=y
CONFIG_ARCH_SUSPEND_POSSIBLE=y
CONFIG_ARM=y
# CONFIG_ARM_ALLWINNER_SUN50I_CPUFREQ_NVMEM is not set
CONFIG_ARM_ALLWINNER_SUN50I_CPUFREQ_NVMEM=y
CONFIG_ARM_APPENDED_DTB=y
CONFIG_ARM_ARCH_TIMER=y
CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y

View file

@ -39,6 +39,7 @@ tools-y += cmake
tools-y += cpio
tools-y += dosfstools
tools-y += e2fsprogs
tools-y += elfutils
tools-y += expat
tools-y += fakeroot
tools-y += findutils
@ -95,6 +96,7 @@ $(curdir)/cbootimage/compile += $(curdir)/automake/compile
$(curdir)/cmake/compile += $(curdir)/libressl/compile $(curdir)/ninja/compile $(curdir)/expat/compile $(curdir)/xz/compile $(curdir)/zlib/compile $(curdir)/zstd/compile
$(curdir)/dosfstools/compile := $(curdir)/automake/compile
$(curdir)/e2fsprogs/compile := $(curdir)/libtool/compile
$(curdir)/elfutils/compile := $(curdir)/m4/compile $(curdir)/zlib/compile $(curdir)/gnulib/compile
$(curdir)/fakeroot/compile := $(curdir)/libtool/compile
$(curdir)/findutils/compile := $(curdir)/bison/compile
$(curdir)/firmware-utils/compile += $(curdir)/cmake/compile
@ -137,9 +139,7 @@ ifeq ($(HOST_OS),Darwin)
tools-y += bash
else
$(curdir)/dwarves/compile += $(curdir)/elfutils/compile
$(curdir)/elfutils/compile := $(curdir)/m4/compile $(curdir)/zlib/compile
tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_DWARVES),y) += dwarves
tools-y += elfutils
endif
ifneq ($(CONFIG_CCACHE)$(CONFIG_SDK),)

View file

@ -19,16 +19,32 @@ PKG_INSTALL:=1
include $(INCLUDE_DIR)/host-build.mk
ifeq ($(HOST_OS),Darwin)
HOST_CFLAGS += -I/opt/homebrew/include
endif
HOST_CFLAGS += -Wno-error
HOST_CONFIGURE_ARGS += \
--without-libintl-prefix \
--without-libiconv-prefix \
--disable-debuginfod \
--disable-libdebuginfod \
--disable-nls \
--disable-shared \
--enable-static \
--without-lzma \
--without-zstd
HOST_MAKE_FLAGS += \
SUBDIRS="lib libelf libcpu backends libebl libdwelf libdwfl libdw"
ifeq ($(HOST_OS),Darwin)
HOST_CONFIGURE_ARGS += --disable-symbol-versioning
endif
Hooks/HostConfigure/Pre := Host/Gnulib $(Hooks/HostConfigure/Pre)
define Host/Gnulib
cd $(HOST_BUILD_DIR); $(STAGING_DIR_HOST)/bin/gnulib-tool --libtool --source-base=libgnu --import argp obstack fts strchrnul progname tsearch;
ln -sf ../lib/eu-config.h $(HOST_BUILD_DIR)/libgnu/;
endef
define Host/Uninstall
-$(call Host/Compile/Default,uninstall)

View file

@ -0,0 +1,910 @@
--- a/configure.ac
+++ b/configure.ac
@@ -20,6 +20,7 @@ dnl You should have received a copy of
dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
AC_INIT([elfutils],[0.189],[https://sourceware.org/bugzilla],[elfutils],[http://elfutils.org/])
+AC_CONFIG_MACRO_DIRS([m4])
dnl Workaround for older autoconf < 2.64
m4_ifndef([AC_PACKAGE_URL],
[AC_DEFINE([PACKAGE_URL], ["http://elfutils.org/"],
@@ -43,16 +44,17 @@ elif test "x$program_prefix" = "x"; then
fi
AC_CONFIG_AUX_DIR([config])
-AC_CONFIG_FILES([config/Makefile])
+AC_CONFIG_FILES([config/Makefile libgnu/Makefile])
AC_COPYRIGHT([Copyright (C) 1996-2023 The elfutils developers.])
-AC_PREREQ(2.63) dnl Minimum Autoconf version required.
+AC_PREREQ(2.64) dnl Minimum Autoconf version required.
dnl We use GNU make extensions; automake 1.10 defaults to -Wportability.
AM_INIT_AUTOMAKE([gnits 1.11 -Wno-portability dist-bzip2 no-dist-gzip parallel-tests])
AM_MAINTAINER_MODE
AM_SILENT_RULES([yes])
+AC_USE_SYSTEM_EXTENSIONS()
AC_CONFIG_SRCDIR([libelf/libelf.h])
AC_CONFIG_FILES([Makefile])
@@ -89,12 +91,14 @@ AS_IF([test "$use_locks" = yes],
AH_TEMPLATE([USE_LOCKS], [Defined if libraries should be thread-safe.])
m4_version_prereq([2.70], [AC_PROG_CC], [AC_PROG_CC_C99])
+gl_EARLY
+gl_INIT
AC_PROG_CXX
-AC_PROG_RANLIB
AC_PROG_YACC
AC_PROG_LEX([noyywrap])
# Only available since automake 1.12
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
+LT_INIT()
AC_CHECK_TOOL([READELF], [readelf])
AC_CHECK_TOOL([NM], [nm])
@@ -195,7 +199,6 @@ AC_CACHE_CHECK([whether the compiler gen
AC_LINK_IFELSE([AC_LANG_PROGRAM()],[ac_cv_buildid=yes; $READELF -n conftest$EXEEXT | grep -q NT_GNU_BUILD_ID || ac_cv_buildid=no],AC_MSG_FAILURE([unexpected compile failure]))])
if test "$ac_cv_buildid" = "no"; then
AC_MSG_WARN([compiler doesn't generate build-id by default])
- LDFLAGS="$LDFLAGS -Wl,--build-id"
fi
ZRELRO_LDFLAGS="-Wl,-z,relro"
@@ -635,36 +638,6 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],
CFLAGS="$old_CFLAGS"])
AS_IF([test "x$ac_cv_fno_addrsig" = "xyes"], CFLAGS="$CFLAGS -fno-addrsig")
-saved_LIBS="$LIBS"
-AC_SEARCH_LIBS([argp_parse], [argp])
-LIBS="$saved_LIBS"
-case "$ac_cv_search_argp_parse" in
- no) AC_MSG_FAILURE([failed to find argp_parse]) ;;
- -l*) argp_LDADD="$ac_cv_search_argp_parse" ;;
- *) argp_LDADD= ;;
-esac
-AC_SUBST([argp_LDADD])
-
-saved_LIBS="$LIBS"
-AC_SEARCH_LIBS([fts_close], [fts])
-LIBS="$saved_LIBS"
-case "$ac_cv_search_fts_close" in
- no) AC_MSG_FAILURE([failed to find fts_close]) ;;
- -l*) fts_LIBS="$ac_cv_search_fts_close" ;;
- *) fts_LIBS= ;;
-esac
-AC_SUBST([fts_LIBS])
-
-saved_LIBS="$LIBS"
-AC_SEARCH_LIBS([_obstack_free], [obstack])
-LIBS="$saved_LIBS"
-case "$ac_cv_search__obstack_free" in
- no) AC_MSG_FAILURE([failed to find _obstack_free]) ;;
- -l*) obstack_LIBS="$ac_cv_search__obstack_free" ;;
- *) obstack_LIBS= ;;
-esac
-AC_SUBST([obstack_LIBS])
-
dnl The directories with content.
dnl Documentation.
--- a/Makefile.am
+++ b/Makefile.am
@@ -26,11 +26,11 @@ AM_MAKEFLAGS = --no-print-directory
pkginclude_HEADERS = version.h
-SUBDIRS = config lib libelf libcpu backends libebl libdwelf libdwfl libdw \
- libasm debuginfod src po doc tests
+SUBDIRS = libgnu config lib libelf libcpu backends libebl libdwelf libdwfl libdw
EXTRA_DIST = elfutils.spec GPG-KEY NOTES CONTRIBUTING \
- COPYING COPYING-GPLV2 COPYING-LGPLV3
+ COPYING COPYING-GPLV2 COPYING-LGPLV3 \
+ m4/gnulib-cache.m4
# Make sure the test install uses lib64 when $LIB will yield lib64.
# Make sure the test build uses the same compiler, which on e.g. ppc64
--- a/libelf/elf_update.c
+++ b/libelf/elf_update.c
@@ -37,6 +37,33 @@
#include "libelfP.h"
+#include "elf_fill.c"
+
+#ifdef __APPLE__
+static int posix_fallocate(int fd, off_t offset, off_t len)
+{
+ off_t c_test;
+ int ret;
+ if (!__builtin_saddll_overflow(offset, len, &c_test)) {
+ fstore_t store = {F_ALLOCATECONTIG, F_PEOFPOSMODE, 0, offset + len, 0};
+ // Try to get a continuous chunk of disk space
+ ret = fcntl(fd, F_PREALLOCATE, &store);
+ if (ret < 0) {
+ // OK, perhaps we are too fragmented, allocate non-continuous
+ store.fst_flags = F_ALLOCATEALL;
+ ret = fcntl(fd, F_PREALLOCATE, &store);
+ if (ret < 0) {
+ return ret;
+ }
+ }
+ ret = ftruncate(fd, offset + len);
+ } else {
+ // offset+len would overflow.
+ ret = -1;
+ }
+ return ret;
+}
+#endif
static int64_t
write_file (Elf *elf, int64_t size, int change_bo, size_t shnum)
--- a/lib/eu-config.h
+++ b/lib/eu-config.h
@@ -52,14 +52,18 @@
# define rwlock_unlock(lock) ((void) (lock))
#endif /* USE_LOCKS */
-#include <libintl.h>
+#include <gettext.h>
/* gettext helper macros. */
#define N_(Str) Str
#define _(Str) dgettext ("elfutils", Str)
/* Compiler-specific definitions. */
+#ifdef __APPLE__
+#define strong_alias(name, aliasname)
+#else
#define strong_alias(name, aliasname) \
extern __typeof (name) aliasname __attribute__ ((alias (#name)));
+#endif
#ifdef __i386__
# define internal_function __attribute__ ((regparm (3), stdcall))
@@ -70,12 +74,7 @@
#define internal_strong_alias(name, aliasname) \
extern __typeof (name) aliasname __attribute__ ((alias (#name))) internal_function;
-#ifdef HAVE_VISIBILITY
-#define attribute_hidden \
- __attribute__ ((visibility ("hidden")))
-#else
#define attribute_hidden /* empty */
-#endif
#ifdef HAVE_GCC_STRUCT
#define attribute_packed \
@@ -159,7 +158,7 @@ asm (".section predict_data, \"aw\"; .pr
#endif
/* Avoid PLT entries. */
-#ifdef PIC
+#if defined(PIC) && !defined(__APPLE__)
# define INTUSE(name) _INTUSE(name)
# define _INTUSE(name) __##name##_internal
# define INTDEF(name) _INTDEF(name)
--- a/config/eu.am
+++ b/config/eu.am
@@ -31,7 +31,7 @@
##
DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DLOCALEDIR='"${localedir}"'
-AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_srcdir)/lib -I..
+AM_CPPFLAGS = -I$(top_builddir)/libgnu -I$(top_srcdir)/libgnu -I. -I$(srcdir) -I$(top_srcdir)/lib -I..
# Drop the 'u' flag that automake adds by default. It is incompatible
# with deterministic archives.
--- a/libelf/Makefile.am
+++ b/libelf/Makefile.am
@@ -34,9 +34,7 @@ endif
VERSION = 1
-lib_LIBRARIES = libelf.a
-noinst_LIBRARIES = libelf_pic.a
-noinst_DATA = $(noinst_LIBRARIES:_pic.a=.so)
+lib_LTLIBRARIES = libelf.la
include_HEADERS = libelf.h gelf.h nlist.h
noinst_HEADERS = abstract.h common.h exttypes.h gelf_xlate.h libelfP.h \
@@ -51,7 +49,8 @@ endif
pkginclude_HEADERS = elf-knowledge.h
-libelf_a_SOURCES = elf_version.c elf_hash.c elf_error.c elf_fill.c \
+libelf_la_LIBADD = ../libgnu/libgnu.la ../lib/libeu.la -lz $(zstd_LIBS) -lpthread
+libelf_la_SOURCES = elf_version.c elf_hash.c elf_error.c \
elf_begin.c elf_next.c elf_rand.c elf_end.c elf_kind.c \
gelf_getclass.c elf_getbase.c elf_getident.c \
elf32_fsize.c elf64_fsize.c gelf_fsize.c \
@@ -102,37 +101,9 @@ libelf_a_SOURCES = elf_version.c elf_has
elf32_getchdr.c elf64_getchdr.c gelf_getchdr.c \
elf_compress.c elf_compress_gnu.c
-libelf_pic_a_SOURCES =
-am_libelf_pic_a_OBJECTS = $(libelf_a_SOURCES:.c=.os)
-
-libelf_so_DEPS = ../lib/libeu.a
-libelf_so_LDLIBS = $(libelf_so_DEPS) -lz $(zstd_LIBS)
-if USE_LOCKS
-libelf_so_LDLIBS += -lpthread
-endif
-
-libelf_so_LIBS = libelf_pic.a
-libelf.so: $(srcdir)/libelf.map $(libelf_so_LIBS) $(libelf_so_DEPS)
- $(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \
- -Wl,--soname,$@.$(VERSION) \
- -Wl,--version-script,$< \
- $(NO_UNDEFINED) \
- -Wl,--whole-archive $(libelf_so_LIBS) -Wl,--no-whole-archive \
- $(libelf_so_LDLIBS)
- @$(textrel_check)
- $(AM_V_at)ln -fs $@ $@.$(VERSION)
-
-install: install-am libelf.so
+install: install-am
$(mkinstalldirs) $(DESTDIR)$(libdir)
- $(INSTALL_PROGRAM) libelf.so $(DESTDIR)$(libdir)/libelf-$(PACKAGE_VERSION).so
- ln -fs libelf-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libelf.so.$(VERSION)
- ln -fs libelf.so.$(VERSION) $(DESTDIR)$(libdir)/libelf.so
uninstall: uninstall-am
- rm -f $(DESTDIR)$(libdir)/libelf-$(PACKAGE_VERSION).so
- rm -f $(DESTDIR)$(libdir)/libelf.so.$(VERSION)
- rm -f $(DESTDIR)$(libdir)/libelf.so
EXTRA_DIST = libelf.map
-
-CLEANFILES += $(am_libelf_pic_a_OBJECTS) libelf.so libelf.so.$(VERSION)
--- a/backends/i386_auxv.c
+++ b/backends/i386_auxv.c
@@ -48,5 +48,4 @@ EBLHOOK(auxv_info) (GElf_Xword a_type, c
return 1;
}
-__typeof (i386_auxv_info) x86_64_auxv_info
- __attribute__ ((alias ("i386_auxv_info")));
+auxv_info_alias(x86_64)
--- a/backends/ppc_regs.c
+++ b/backends/ppc_regs.c
@@ -204,5 +204,11 @@ ppc_register_info (Ebl *ebl __attribute_
return namelen;
}
-__typeof (ppc_register_info)
- ppc64_register_info __attribute__ ((alias ("ppc_register_info")));
+ssize_t
+ppc64_register_info (Ebl *ebl,
+ int regno, char *name, size_t namelen,
+ const char **prefix, const char **setname,
+ int *bits, int *type)
+{
+ return ppc_register_info(ebl, regno, name, namelen, prefix, setname, bits, type);
+}
--- a/backends/libebl_CPU.h
+++ b/backends/libebl_CPU.h
@@ -97,4 +97,10 @@ dwarf_is_pointer (int tag)
case DW_TAG_reference_type: \
case DW_TAG_rvalue_reference_type
+#define auxv_info_alias(arch) \
+ int EBLHOOK_1(arch, auxv_info) (GElf_Xword a_type, const char **name, const char **format) \
+ { \
+ return EBLHOOK(auxv_info)(a_type, name, format); \
+ }
+
#endif /* libebl_CPU.h */
--- a/backends/ppc_auxv.c
+++ b/backends/ppc_auxv.c
@@ -51,5 +51,4 @@ EBLHOOK(auxv_info) (GElf_Xword a_type, c
return 1;
}
-__typeof (ppc_auxv_info) ppc64_auxv_info
- __attribute__ ((alias ("ppc_auxv_info")));
+auxv_info_alias(ppc64)
--- a/backends/ppc_cfi.c
+++ b/backends/ppc_cfi.c
@@ -72,6 +72,7 @@ ppc_abi_cfi (Ebl *ebl __attribute__ ((un
return 0;
}
-__typeof (ppc_abi_cfi)
- ppc64_abi_cfi
- __attribute__ ((alias ("ppc_abi_cfi")));
+int ppc64_abi_cfi(Ebl *ebl, Dwarf_CIE *abi_info)
+{
+ return ppc_abi_cfi(ebl, abi_info);
+}
--- a/backends/ppc_initreg.c
+++ b/backends/ppc_initreg.c
@@ -68,9 +68,10 @@ ppc_dwarf_to_regno (Ebl *ebl __attribute
abort ();
}
-__typeof (ppc_dwarf_to_regno)
- ppc64_dwarf_to_regno
- __attribute__ ((alias ("ppc_dwarf_to_regno")));
+bool ppc64_dwarf_to_regno (Ebl *ebl, unsigned *regno)
+{
+ return ppc_dwarf_to_regno(ebl, regno);
+}
bool
ppc_set_initial_registers_tid (pid_t tid __attribute__ ((unused)),
@@ -127,6 +128,7 @@ ppc_set_initial_registers_tid (pid_t tid
#endif /* __powerpc__ */
}
-__typeof (ppc_set_initial_registers_tid)
- ppc64_set_initial_registers_tid
- __attribute__ ((alias ("ppc_set_initial_registers_tid")));
+bool ppc64_set_initial_registers_tid(pid_t tid, ebl_tid_registers_t *setfunc, void *arg)
+{
+ return ppc_set_initial_registers_tid(tid, setfunc, arg);
+}
--- a/backends/ppc_attrs.c
+++ b/backends/ppc_attrs.c
@@ -81,6 +81,9 @@ ppc_check_object_attribute (Ebl *ebl __a
return false;
}
-__typeof (ppc_check_object_attribute)
- ppc64_check_object_attribute
- __attribute__ ((alias ("ppc_check_object_attribute")));
+bool ppc64_check_object_attribute(Ebl *ebl,
+ const char *vendor, int tag, uint64_t value,
+ const char **tag_name, const char **value_name)
+{
+ return ppc_check_object_attribute(ebl, vendor, tag, value, tag_name, value_name);
+}
--- a/lib/libeu.h
+++ b/lib/libeu.h
@@ -45,4 +45,11 @@ extern char *xasprintf(const char *fmt,
extern uint32_t crc32 (uint32_t crc, unsigned char *buf, size_t len);
extern int crc32_file (int fd, uint32_t *resp);
+#ifdef __APPLE__
+static inline void tdestroy(void *root __attribute__ ((unused)),
+ void (*freekey)(void *) __attribute__ ((unused)))
+{
+}
+#endif
+
#endif
--- a/libdwfl/libdwflP.h
+++ b/libdwfl/libdwflP.h
@@ -31,6 +31,8 @@
#include <libdwfl.h>
#include <libebl.h>
+#include <libeu.h>
+#include <libgen.h>
#include <assert.h>
#include <dirent.h>
#include <errno.h>
--- /dev/null
+++ b/lib/stdio_ext.h
@@ -0,0 +1,6 @@
+#include <stdio.h>
+#ifndef __APPLE__
+#include_next <stdio_ext.h>
+#else
+#define __fsetlocking(...) 0
+#endif
--- a/libdw/libdwP.h
+++ b/libdw/libdwP.h
@@ -32,8 +32,10 @@
#include <stdbool.h>
#include <pthread.h>
+#include <libeu.h>
#include <libdw.h>
#include <dwarf.h>
+#include <libgen.h>
/* Known location expressions already decoded. */
--- a/libdw/Makefile.am
+++ b/libdw/Makefile.am
@@ -34,14 +34,12 @@ endif
AM_CPPFLAGS += -I$(srcdir)/../libebl -I$(srcdir)/../libelf -I$(srcdir)/../libdwelf -pthread
VERSION = 1
-lib_LIBRARIES = libdw.a
-noinst_LIBRARIES = libdw_pic.a
-noinst_DATA = $(noinst_LIBRARIES:_pic.a=.so)
+lib_LTLIBRARIES = libdw.la
include_HEADERS = dwarf.h
pkginclude_HEADERS = libdw.h known-dwarf.h
-libdw_a_SOURCES = dwarf_begin.c dwarf_begin_elf.c dwarf_end.c dwarf_getelf.c \
+libdw_la_SOURCES = dwarf_begin.c dwarf_begin_elf.c dwarf_end.c dwarf_getelf.c \
dwarf_getpubnames.c dwarf_getabbrev.c dwarf_tag.c \
dwarf_error.c dwarf_nextcu.c dwarf_diename.c dwarf_offdie.c \
dwarf_attr.c dwarf_formstring.c \
@@ -103,50 +101,12 @@ $(srcdir)/known-dwarf.h: $(top_srcdir)/c
mv -f $@.new $@
endif
-libdw_pic_a_SOURCES =
-am_libdw_pic_a_OBJECTS = $(libdw_a_SOURCES:.c=.os)
-
-libdw_so_LIBS = ../libebl/libebl_pic.a ../backends/libebl_backends_pic.a \
- ../libcpu/libcpu_pic.a libdw_pic.a ../libdwelf/libdwelf_pic.a \
- ../libdwfl/libdwfl_pic.a
-libdw_so_DEPS = ../lib/libeu.a ../libelf/libelf.so
-libdw_so_LDLIBS = $(libdw_so_DEPS) -ldl -lz $(argp_LDADD) $(fts_LIBS) $(obstack_LIBS) $(zip_LIBS) -pthread
-libdw.so: $(srcdir)/libdw.map $(libdw_so_LIBS) $(libdw_so_DEPS)
- $(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \
- -Wl,--soname,$@.$(VERSION),--enable-new-dtags \
- -Wl,--version-script,$< \
- $(NO_UNDEFINED) \
- -Wl,--whole-archive $(libdw_so_LIBS) -Wl,--no-whole-archive \
- $(libdw_so_LDLIBS)
- @$(textrel_check)
- $(AM_V_at)ln -fs $@ $@.$(VERSION)
-
-install: install-am libdw.so
- $(mkinstalldirs) $(DESTDIR)$(libdir)
- $(INSTALL_PROGRAM) libdw.so $(DESTDIR)$(libdir)/libdw-$(PACKAGE_VERSION).so
- ln -fs libdw-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libdw.so.$(VERSION)
- ln -fs libdw.so.$(VERSION) $(DESTDIR)$(libdir)/libdw.so
-
-uninstall: uninstall-am
- rm -f $(DESTDIR)$(libdir)/libdw-$(PACKAGE_VERSION).so
- rm -f $(DESTDIR)$(libdir)/libdw.so.$(VERSION)
- rm -f $(DESTDIR)$(libdir)/libdw.so
- rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils
-
-libdwfl_objects = $(shell $(AR) t ../libdwfl/libdwfl.a)
-libdw_a_LIBADD = $(addprefix ../libdwfl/,$(libdwfl_objects))
-
-libdwelf_objects = $(shell $(AR) t ../libdwelf/libdwelf.a)
-libdw_a_LIBADD += $(addprefix ../libdwelf/,$(libdwelf_objects))
-
-libebl_objects = $(shell $(AR) t ../libebl/libebl.a)
-libdw_a_LIBADD += $(addprefix ../libebl/,$(libebl_objects))
-
-backends_objects = $(shell $(AR) t ../backends/libebl_backends.a)
-libdw_a_LIBADD += $(addprefix ../backends/,$(backends_objects))
-
-libcpu_objects = $(shell $(AR) t ../libcpu/libcpu.a)
-libdw_a_LIBADD += $(addprefix ../libcpu/,$(libcpu_objects))
+libdw_la_LIBADD = \
+ ../libdwfl/libdwfl.la \
+ ../libdwelf/libdwelf.la \
+ ../libebl/libebl.la \
+ ../backends/libebl_backends.la \
+ ../libcpu/libcpu.la
noinst_HEADERS = libdwP.h memory-access.h dwarf_abbrev_hash.h \
dwarf_sig8_hash.h cfi.h encoded-value.h
--- a/libasm/Makefile.am
+++ b/libasm/Makefile.am
@@ -32,12 +32,10 @@ AM_CPPFLAGS += -I$(top_srcdir)/libelf -I
VERSION = 1
-lib_LIBRARIES = libasm.a
-noinst_LIBRARIES = libasm_pic.a
-noinst_DATA = $(noinst_LIBRARIES:_pic.a=.so)
+lib_LTLIBRARIES = libasm.la
pkginclude_HEADERS = libasm.h
-libasm_a_SOURCES = asm_begin.c asm_abort.c asm_end.c asm_error.c \
+libasm_la_SOURCES = asm_begin.c asm_abort.c asm_end.c asm_error.c \
asm_getelf.c asm_newscn.c asm_newscn_ingrp.c \
asm_newsubscn.c asm_newsym.c asm_newcomsym.c \
asm_newabssym.c \
@@ -51,38 +49,6 @@ libasm_a_SOURCES = asm_begin.c asm_abort
disasm_begin.c disasm_cb.c disasm_end.c disasm_str.c \
symbolhash.c
-libasm_pic_a_SOURCES =
-am_libasm_pic_a_OBJECTS = $(libasm_a_SOURCES:.c=.os)
-
-libasm_so_DEPS = ../lib/libeu.a ../libebl/libebl_pic.a ../libelf/libelf.so ../libdw/libdw.so
-libasm_so_LDLIBS = $(libasm_so_DEPS)
-if USE_LOCKS
-libasm_so_LDLIBS += -lpthread
-endif
-
-libasm_so_LIBS = libasm_pic.a
-libasm.so: $(srcdir)/libasm.map $(libasm_so_LIBS) $(libasm_so_DEPS)
- $(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \
- -Wl,--soname,$@.$(VERSION) \
- -Wl,--version-script,$< \
- $(NO_UNDEFINED) \
- -Wl,--whole-archive $(libasm_so_LIBS) -Wl,--no-whole-archive \
- $(libasm_so_LDLIBS)
- @$(textrel_check)
- $(AM_V_at)ln -fs $@ $@.$(VERSION)
-
-install: install-am libasm.so
- $(mkinstalldirs) $(DESTDIR)$(libdir)
- $(INSTALL_PROGRAM) libasm.so $(DESTDIR)$(libdir)/libasm-$(PACKAGE_VERSION).so
- ln -fs libasm-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libasm.so.$(VERSION)
- ln -fs libasm.so.$(VERSION) $(DESTDIR)$(libdir)/libasm.so
-
-uninstall: uninstall-am
- rm -f $(DESTDIR)$(libdir)/libasm-$(PACKAGE_VERSION).so
- rm -f $(DESTDIR)$(libdir)/libasm.so.$(VERSION)
- rm -f $(DESTDIR)$(libdir)/libasm.so
- rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils
-
noinst_HEADERS = libasmP.h symbolhash.h
EXTRA_DIST = libasm.map
--- a/libdwfl/Makefile.am
+++ b/libdwfl/Makefile.am
@@ -34,13 +34,11 @@ AM_CPPFLAGS += -I$(srcdir) -I$(srcdir)/.
-I$(srcdir)/../libdw -I$(srcdir)/../libdwelf -I$(builddir)/../debuginfod
VERSION = 1
-noinst_LIBRARIES = libdwfl.a
-noinst_LIBRARIES += libdwfl_pic.a
+noinst_LTLIBRARIES = libdwfl.la
pkginclude_HEADERS = libdwfl.h
-
-libdwfl_a_SOURCES = dwfl_begin.c dwfl_end.c dwfl_error.c dwfl_version.c \
+libdwfl_la_SOURCES = dwfl_begin.c dwfl_end.c dwfl_error.c dwfl_version.c \
dwfl_module.c dwfl_report_elf.c relocate.c \
dwfl_module_build_id.c dwfl_module_report_build_id.c \
derelocate.c offline.c segment.c \
@@ -73,24 +71,14 @@ libdwfl_a_SOURCES = dwfl_begin.c dwfl_en
gzip.c debuginfod-client.c
if BZLIB
-libdwfl_a_SOURCES += bzip2.c
+libdwfl_la_SOURCES += bzip2.c
endif
if LZMA
-libdwfl_a_SOURCES += lzma.c
+libdwfl_la_SOURCES += lzma.c
endif
if ZSTD
-libdwfl_a_SOURCES += zstd.c
+libdwfl_la_SOURCES += zstd.c
endif
-libdwfl = $(libdw)
-libdw = ../libdw/libdw.so
-libelf = ../libelf/libelf.so
-libebl = ../libebl/libebl.a
-libeu = ../lib/libeu.a
-
-libdwfl_pic_a_SOURCES =
-am_libdwfl_pic_a_OBJECTS = $(libdwfl_a_SOURCES:.c=.os)
-
noinst_HEADERS = libdwflP.h
-CLEANFILES += $(am_libdwfl_pic_a_OBJECTS)
--- a/backends/Makefile.am
+++ b/backends/Makefile.am
@@ -34,7 +34,7 @@ endif
AM_CPPFLAGS += -I$(top_srcdir)/libebl -I$(top_srcdir)/libasm \
-I$(top_srcdir)/libelf -I$(top_srcdir)/libdw
-noinst_LIBRARIES = libebl_backends.a libebl_backends_pic.a
+noinst_LTLIBRARIES = libebl_backends.la
modules = i386 sh x86_64 ia64 alpha arm aarch64 sparc ppc ppc64 s390 \
m68k bpf riscv csky loongarch arc
@@ -100,17 +100,13 @@ loongarch_SRCS = loongarch_init.c loonga
arc_SRCS = arc_init.c arc_symbol.c
-libebl_backends_a_SOURCES = $(i386_SRCS) $(sh_SRCS) $(x86_64_SRCS) \
+libebl_backends_la_SOURCES = $(i386_SRCS) $(sh_SRCS) $(x86_64_SRCS) \
$(ia64_SRCS) $(alpha_SRCS) $(arm_SRCS) \
$(aarch64_SRCS) $(sparc_SRCS) $(ppc_SRCS) \
$(ppc64_SRCS) $(s390_SRCS) \
$(m68k_SRCS) $(bpf_SRCS) $(riscv_SRCS) $(csky_SRCS) \
$(loongarch_SRCS) $(arc_SRCS)
-libebl_backends_pic_a_SOURCES =
-am_libebl_backends_pic_a_OBJECTS = $(libebl_backends_a_SOURCES:.c=.os)
noinst_HEADERS = libebl_CPU.h common-reloc.c linux-core-note.c x86_corenote.c
EXTRA_DIST = $(modules:=_reloc.def)
-
-MOSTLYCLEANFILES = $(am_libebl_backends_pic_a_OBJECTS)
--- a/libdwelf/Makefile.am
+++ b/libdwelf/Makefile.am
@@ -34,24 +34,12 @@ AM_CPPFLAGS += -I$(srcdir)/../libelf -I$
-I$(srcdir)/../libdwfl -I$(srcdir)/../libebl
VERSION = 1
-noinst_LIBRARIES = libdwelf.a libdwelf_pic.a
+noinst_LTLIBRARIES = libdwelf.la
pkginclude_HEADERS = libdwelf.h
noinst_HEADERS = libdwelfP.h
-libdwelf_a_SOURCES = dwelf_elf_gnu_debuglink.c dwelf_dwarf_gnu_debugaltlink.c \
+libdwelf_la_SOURCES = dwelf_elf_gnu_debuglink.c dwelf_dwarf_gnu_debugaltlink.c \
dwelf_elf_gnu_build_id.c dwelf_scn_gnu_compressed_size.c \
dwelf_strtab.c dwelf_elf_begin.c \
dwelf_elf_e_machine_string.c
-
-libdwelf = $(libdw)
-
-libdw = ../libdw/libdw.so
-libelf = ../libelf/libelf.so
-libebl = ../libebl/libebl.a
-libeu = ../lib/libeu.a
-
-libdwelf_pic_a_SOURCES =
-am_libdwelf_pic_a_OBJECTS = $(libdwelf_a_SOURCES:.c=.os)
-
-CLEANFILES += $(am_libdwelf_pic_a_OBJECTS)
--- a/libebl/Makefile.am
+++ b/libebl/Makefile.am
@@ -34,9 +34,9 @@ endif
AM_CPPFLAGS += -I$(srcdir)/../libelf -I$(srcdir)/../libdw -I$(srcdir)/../libasm
VERSION = 1
-noinst_LIBRARIES = libebl.a libebl_pic.a
+noinst_LTLIBRARIES = libebl.la
-libebl_a_SOURCES = eblopenbackend.c eblclosebackend.c eblreloctypename.c \
+libebl_la_SOURCES = eblopenbackend.c eblclosebackend.c eblreloctypename.c \
eblsegmenttypename.c eblsectiontypename.c \
eblmachineflagname.c eblsymboltypename.c \
ebldynamictagname.c eblsectionname.c \
@@ -56,9 +56,4 @@ libebl_a_SOURCES = eblopenbackend.c eblc
eblresolvesym.c eblcheckreloctargettype.c \
ebl_data_marker_symbol.c
-libebl_pic_a_SOURCES =
-am_libebl_pic_a_OBJECTS = $(libebl_a_SOURCES:.c=.os)
-
noinst_HEADERS = libebl.h libeblP.h ebl-hooks.h
-
-MOSTLYCLEANFILES = $(am_libebl_pic_a_OBJECTS)
--- a/debuginfod/Makefile.am
+++ b/debuginfod/Makefile.am
@@ -40,23 +40,12 @@ AM_CPPFLAGS += -I$(srcdir) -I$(srcdir)/.
program_prefix=
program_transform_name = s,x,x,
-if BUILD_STATIC
-libasm = ../libasm/libasm.a
-libdw = ../libdw/libdw.a -lz $(zip_LIBS) $(libelf) $(libebl) -ldl -lpthread
-libelf = ../libelf/libelf.a -lz
-if DUMMY_LIBDEBUGINFOD
-libdebuginfod = ./libdebuginfod.a
-else
-libdebuginfod = ./libdebuginfod.a -lpthread $(libcurl_LIBS)
-endif
-else
-libasm = ../libasm/libasm.so
-libdw = ../libdw/libdw.so
-libelf = ../libelf/libelf.so
-libdebuginfod = ./libdebuginfod.so
-endif
-libebl = ../libebl/libebl.a
-libeu = ../lib/libeu.a
+libasm = ../libasm/libasm.la
+libdw = ../libdw/libdw.la -lz $(zip_LIBS) $(libelf) $(libebl) -ldl -lpthread
+libelf = ../libelf/libelf.la
+libdebuginfod = ./libdebuginfod.la
+libebl = ../libebl/libebl.la
+libeu = ../lib/libeu.la
AM_LDFLAGS = -Wl,-rpath-link,../libelf:../libdw:.
@@ -76,14 +65,10 @@ debuginfod_find_SOURCES = debuginfod-fin
debuginfod_find_LDADD = $(libdw) $(libelf) $(libeu) $(libdebuginfod) $(argp_LDADD) $(fts_LIBS)
if LIBDEBUGINFOD
-noinst_LIBRARIES = libdebuginfod.a
-noinst_LIBRARIES += libdebuginfod_pic.a
+libdebuginfod_la_SOURCES = debuginfod-client.c
+noinst_LTLIBRARIES = libdebuginfod.la
endif
-libdebuginfod_a_SOURCES = debuginfod-client.c
-libdebuginfod_pic_a_SOURCES = debuginfod-client.c
-am_libdebuginfod_pic_a_OBJECTS = $(libdebuginfod_a_SOURCES:.c=.os)
-
if DUMMY_LIBDEBUGINFOD
AM_CPPFLAGS += -Wno-unused-parameter
endif
@@ -92,42 +77,7 @@ if LIBDEBUGINFOD
pkginclude_HEADERS = debuginfod.h
endif
-if LIBDEBUGINFOD
-libdebuginfod_so_LIBS = libdebuginfod_pic.a
-if DUMMY_LIBDEBUGINFOD
-libdebuginfod_so_LDLIBS =
-else
-libdebuginfod_so_LDLIBS = -lpthread $(libcurl_LIBS) $(fts_LIBS) $(libelf)
-endif
-$(LIBDEBUGINFOD_SONAME): $(srcdir)/libdebuginfod.map $(libdebuginfod_so_LIBS)
- $(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \
- -Wl,--soname,$(LIBDEBUGINFOD_SONAME) \
- -Wl,--version-script,$< \
- $(NO_UNDEFINED) \
- -Wl,--whole-archive $(libdebuginfod_so_LIBS) -Wl,--no-whole-archive \
- $(libdebuginfod_so_LDLIBS)
- @$(textrel_check)
-
-libdebuginfod.so: $(LIBDEBUGINFOD_SONAME)
- ln -fs $< $@
-
-install: install-am libdebuginfod.so
- $(mkinstalldirs) $(DESTDIR)$(libdir)
- $(INSTALL_PROGRAM) $(LIBDEBUGINFOD_SONAME) \
- $(DESTDIR)$(libdir)/libdebuginfod-$(PACKAGE_VERSION).so
- ln -fs libdebuginfod-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/$(LIBDEBUGINFOD_SONAME)
- ln -fs libdebuginfod-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libdebuginfod.so
-
-uninstall: uninstall-am
- rm -f $(DESTDIR)$(libdir)/libdebuginfod-$(PACKAGE_VERSION).so
- rm -f $(DESTDIR)$(libdir)/$(LIBDEBUGINFOD_SONAME)
- rm -f $(DESTDIR)$(libdir)/libdebuginfod.so
- rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils
-endif
-
EXTRA_DIST = libdebuginfod.map
-MOSTLYCLEANFILES = $(am_libdebuginfod_pic_a_OBJECTS) $(LIBDEBUGINFOD_SONAME)
-CLEANFILES += $(am_libdebuginfod_pic_a_OBJECTS) libdebuginfod.so
# automake std-options override: arrange to pass LD_LIBRARY_PATH
installcheck-binPROGRAMS: $(bin_PROGRAMS)
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -31,9 +31,9 @@ include $(top_srcdir)/config/eu.am
AM_CFLAGS += $(fpic_CFLAGS)
AM_CPPFLAGS += -I$(srcdir)/../libelf
-noinst_LIBRARIES = libeu.a
+noinst_LTLIBRARIES = libeu.la
-libeu_a_SOURCES = xasprintf.c xstrdup.c xstrndup.c xmalloc.c next_prime.c \
+libeu_la_SOURCES = xasprintf.c xstrdup.c xstrndup.c xmalloc.c next_prime.c \
crc32.c crc32_file.c \
color.c error.c printversion.c
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -29,9 +29,9 @@ bin_PROGRAMS = readelf nm size strip elf
elfcmp objdump ranlib strings ar unstrip stack elfcompress \
elfclassify
-noinst_LIBRARIES = libar.a
+noinst_LTLIBRARIES = libar.la
-libar_a_SOURCES = arlib.c arlib2.c arlib-argp.c
+libar_la_SOURCES = arlib.c arlib2.c arlib-argp.c
EXTRA_DIST = arlib.h debugpred.h
@@ -39,17 +39,11 @@ bin_SCRIPTS = make-debug-archive
EXTRA_DIST += make-debug-archive.in
CLEANFILES += make-debug-archive
-if BUILD_STATIC
-libasm = ../libasm/libasm.a
-libdw = ../libdw/libdw.a -lz $(zip_LIBS) $(libelf) -ldl -lpthread
-libelf = ../libelf/libelf.a -lz
-else
-libasm = ../libasm/libasm.so
-libdw = ../libdw/libdw.so
-libelf = ../libelf/libelf.so
-endif
-libebl = ../libebl/libebl.a ../backends/libebl_backends.a ../libcpu/libcpu.a
-libeu = ../lib/libeu.a
+libasm = ../libasm/libasm.la
+libdw = ../libdw/libdw.la -lz $(zip_LIBS) $(libelf) -ldl -lpthread
+libelf = ../libelf/libelf.la
+libebl = ../libebl/libebl.la ../backends/libebl_backends.la ../libcpu/libcpu.la
+libeu = ../lib/libeu.la
if DEMANGLE
demanglelib = -lstdc++
@@ -77,9 +71,9 @@ findtextrel_LDADD = $(libdw) $(libelf) $
addr2line_LDADD = $(libdw) $(libelf) $(libeu) $(argp_LDADD) $(demanglelib)
elfcmp_LDADD = $(libebl) $(libdw) $(libelf) $(libeu) $(argp_LDADD)
objdump_LDADD = $(libasm) $(libebl) $(libdw) $(libelf) $(libeu) $(argp_LDADD)
-ranlib_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) $(obstack_LIBS)
+ranlib_LDADD = libar.la $(libelf) $(libeu) $(argp_LDADD) $(obstack_LIBS)
strings_LDADD = $(libelf) $(libeu) $(argp_LDADD)
-ar_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) $(obstack_LIBS)
+ar_LDADD = libar.la $(libelf) $(libeu) $(argp_LDADD) $(obstack_LIBS)
unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD)
stack_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) $(demanglelib)
elfcompress_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD)
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -662,17 +662,11 @@ installcheck-local:
TESTS_ENVIRONMENT="$(installed_TESTS_ENVIRONMENT)" \
LOG_COMPILER="$(installed_LOG_COMPILER)" check-TESTS
-if BUILD_STATIC
-libdw = ../libdw/libdw.a -lz $(zip_LIBS) $(libelf) $(libebl) -ldl -lpthread
-libelf = ../libelf/libelf.a -lz
-libasm = ../libasm/libasm.a
-else
-libdw = ../libdw/libdw.so
-libelf = ../libelf/libelf.so
-libasm = ../libasm/libasm.so
-endif
-libebl = ../libebl/libebl.a ../backends/libebl_backends.a ../libcpu/libcpu.a
-libeu = ../lib/libeu.a
+libdw = ../libdw/libdw.la -lz $(zip_LIBS) $(libelf) $(libebl) -ldl -lpthread
+libelf = ../libelf/libelf.la
+libasm = ../libasm/libasm.la
+libebl = ../libebl/libebl.la ../backends/libebl_backends.la ../libcpu/libcpu.la
+libeu = ../lib/libeu.la
arextract_LDADD = $(libelf)
arsymtest_LDADD = $(libelf)
--- a/libcpu/Makefile.am
+++ b/libcpu/Makefile.am
@@ -38,19 +38,16 @@ LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAG
LEX_OUTPUT_ROOT = lex.$(<F:lex.l=)
AM_YFLAGS = -p$(<F:parse.y=)
-noinst_LIBRARIES = libcpu.a libcpu_pic.a
+noinst_LTLIBRARIES = libcpu.la
noinst_HEADERS = i386_dis.h i386_mne.h x86_64_dis.h
-libcpu_a_SOURCES = i386_disasm.c x86_64_disasm.c bpf_disasm.c riscv_disasm.c
-
-libcpu_pic_a_SOURCES =
-am_libcpu_pic_a_OBJECTS = $(libcpu_a_SOURCES:.c=.os)
+libcpu_la_SOURCES = i386_disasm.c x86_64_disasm.c bpf_disasm.c riscv_disasm.c
i386_gendis_SOURCES = i386_gendis.c i386_lex.l i386_parse.y
-i386_disasm.o: i386.mnemonics $(srcdir)/i386_dis.h
-x86_64_disasm.o: x86_64.mnemonics $(srcdir)/x86_64_dis.h
+$(libcpu_la_OBJECTS): i386.mnemonics $(srcdir)/i386_dis.h
+$(libcpu_la_OBJECTS): x86_64.mnemonics $(srcdir)/x86_64_dis.h
%_defs: $(srcdir)/defs/i386
$(AM_V_GEN)m4 -D$* -DDISASSEMBLER $< > $@T
@@ -87,20 +84,15 @@ endif
i386_lex_no_Werror = yes
-libeu = ../lib/libeu.a
+libeu = ../lib/libeu.la
i386_lex_CFLAGS = -Wno-unused-label -Wno-unused-function -Wno-sign-compare \
-Wno-implicit-fallthrough
-i386_parse.o: i386_parse.c i386.mnemonics
-i386_lex.o: i386_parse.h
i386_gendis_LDADD = $(libeu) -lm $(obstack_LIBS)
-i386_parse.h: i386_parse.c ;
-
bpf_disasm_CFLAGS = -Wno-format-nonliteral
EXTRA_DIST = defs/i386
-MOSTLYCLEANFILES = $(am_libcpu_pic_a_OBJECTS)
CLEANFILES += $(foreach P,i386 x86_64,$P_defs $P.mnemonics)
MAINTAINERCLEANFILES = $(foreach P,i386 x86_64, $P_dis.h)
--- a/config/libelf.pc.in
+++ b/config/libelf.pc.in
@@ -8,7 +8,7 @@ Description: elfutils libelf library to
Version: @VERSION@
URL: http://elfutils.org/
-Libs: -L${libdir} -lelf
+Libs: -L${libdir} -lelf -lz
Cflags: -I${includedir}
Requires.private: zlib @LIBZSTD@

View file

@ -18,10 +18,11 @@ define Host/Install
$(INSTALL_DATA) $(HOST_BUILD_DIR)/m4/*.m4 $(1)/share/aclocal/
$(INSTALL_DIR) $(1)/share/gnulib
$(CP) $(HOST_BUILD_DIR)/* $(1)/share/gnulib/
ln -sf ../share/gnulib/gnulib-tool $(STAGING_DIR_HOST)/bin/gnulib-tool
endef
define Host/Clean
rm -rf $(STAGING_DIR_HOST)/share/gnulib
rm -rf $(STAGING_DIR_HOST)/bin/gnulib-tool $(STAGING_DIR_HOST)/share/gnulib
endef
$(eval $(call HostBuild))

View file

@ -37,4 +37,52 @@
#define __LITTLE_ENDIAN LITTLE_ENDIAN
#endif
#ifndef __linux__
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define htobe16(x) bswap_16(x)
#define be16toh(x) bswap_16(x)
#define htobe32(x) bswap_32(x)
#define be32toh(x) bswap_32(x)
#define htobe64(x) bswap_64(x)
#define be64toh(x) bswap_64(x)
#define htole16(x) (uint16_t)(x)
#define le16toh(x) (uint16_t)(x)
#define htole32(x) (uint32_t)(x)
#define le32toh(x) (uint32_t)(x)
#define htole64(x) (uint64_t)(x)
#define le64toh(x) (uint64_t)(x)
#else
#define htobe16(x) (uint16_t)(x)
#define be16toh(x) (uint16_t)(x)
#define htobe32(x) (uint32_t)(x)
#define be32toh(x) (uint32_t)(x)
#define htobe64(x) (uint64_t)(x)
#define be64toh(x) (uint64_t)(x)
#define htole16(x) bswap_16(x)
#define le16toh(x) bswap_16(x)
#define htole32(x) bswap_32(x)
#define le32toh(x) bswap_32(x)
#define htole64(x) bswap_64(x)
#define le64toh(x) bswap_64(x)
#endif
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define betoh16(x) bswap_16(x)
#define betoh32(x) bswap_32(x)
#define betoh64(x) bswap_64(x)
#define letoh16(x) (uint16_t)(x)
#define letoh32(x) (uint32_t)(x)
#define letoh64(x) (uint64_t)(x)
#else
#define betoh16(x) (uint16_t)(x)
#define betoh32(x) (uint32_t)(x)
#define betoh64(x) (uint64_t)(x)
#define letoh16(x) bswap_16(x)
#define letoh32(x) bswap_32(x)
#define letoh64(x) bswap_64(x)
#endif
#endif
#endif
#endif