mirror of
git://git.openwrt.org/openwrt/openwrt.git
synced 2026-06-12 01:27:28 -04:00
Compare commits
1 Commits
v25.12.0-r
...
iremap
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e286791b88 |
2
.gitattributes
vendored
2
.gitattributes
vendored
@@ -1,4 +1,2 @@
|
||||
* -text
|
||||
*.patch whitespace=-indent-with-non-tab,-space-before-tab,-tab-in-indent,-trailing-space
|
||||
*.dts text eol=lf
|
||||
*.dts[io] text eol=lf
|
||||
|
||||
10
.github/labeler.yml
vendored
10
.github/labeler.yml
vendored
@@ -54,10 +54,6 @@
|
||||
- "target/linux/d1/**"
|
||||
- "package/boot/uboot-d1/**"
|
||||
- "package/boot/opensbi/**"
|
||||
"target/econet":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/econet/**"
|
||||
"target/gemini":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
@@ -126,12 +122,6 @@
|
||||
- "target/linux/mediatek/**"
|
||||
- "package/boot/arm-trusted-firmware-mediatek/**"
|
||||
- "package/boot/uboot-mediatek/**"
|
||||
"target/microchipsw":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/microchipsw/**"
|
||||
- "package/boot/arm-trusted-firmware-microchipsw/**"
|
||||
- "package/boot/uboot-microchipsw/**"
|
||||
"target/mpc85xx":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
|
||||
6
.github/workflows/formal.yml
vendored
6
.github/workflows/formal.yml
vendored
@@ -5,14 +5,8 @@ on:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Test Formalities
|
||||
uses: openwrt/actions-shared-workflows/.github/workflows/formal.yml@main
|
||||
# with:
|
||||
# # Post formality check summaries to the PR.
|
||||
# # Repo's permissions need to be updated for actions to modify PRs:
|
||||
# # https://docs.github.com/en/rest/issues/comments?apiVersion=2022-11-28#create-an-issue-comment
|
||||
# post_comment: true
|
||||
|
||||
@@ -108,7 +108,6 @@ menu "Global build settings"
|
||||
config CLEAN_IPKG
|
||||
bool
|
||||
prompt "Remove ipkg/opkg status data files in final images"
|
||||
depends on !USE_APK
|
||||
help
|
||||
This removes all ipkg/opkg status data files from the target directory
|
||||
before building the root filesystem.
|
||||
@@ -251,15 +250,6 @@ menu "Global build settings"
|
||||
|
||||
comment "Hardening build options"
|
||||
|
||||
config PKG_FANALYZER
|
||||
bool
|
||||
prompt "Enable gcc fanalyzer"
|
||||
default n
|
||||
help
|
||||
Add -fanalyzer to the CFLAGS. As a result of this option, a static analysis
|
||||
of the program flow is conducted, allowing interprocedural paths to be
|
||||
identified and warnings to be issued if problems are identified.
|
||||
|
||||
config PKG_CHECK_FORMAT_SECURITY
|
||||
bool
|
||||
prompt "Enable gcc format-security"
|
||||
@@ -368,11 +358,9 @@ menu "Global build settings"
|
||||
config PKG_FORTIFY_SOURCE_NONE
|
||||
bool "None"
|
||||
config PKG_FORTIFY_SOURCE_1
|
||||
bool "Conservative Level 1"
|
||||
bool "Conservative"
|
||||
config PKG_FORTIFY_SOURCE_2
|
||||
bool "Aggressive Level 2"
|
||||
config PKG_FORTIFY_SOURCE_3
|
||||
bool "Aggressive Level 3"
|
||||
bool "Aggressive"
|
||||
endchoice
|
||||
|
||||
choice
|
||||
@@ -393,15 +381,6 @@ menu "Global build settings"
|
||||
bool "Full"
|
||||
endchoice
|
||||
|
||||
config PKG_DT_RELR
|
||||
bool "Link with relative relocations (RELR)"
|
||||
depends on (aarch64 || i386 || loongarch64 || x86_64)
|
||||
default y
|
||||
help
|
||||
Link all applications with -Wl,-z,pack-relative-relocs.
|
||||
This will reduce the size of many applications.
|
||||
This is only supported on a limited number of architectures.
|
||||
|
||||
config TARGET_ROOTFS_SECURITY_LABELS
|
||||
bool
|
||||
select KERNEL_SQUASHFS_XATTR
|
||||
|
||||
@@ -18,7 +18,6 @@ menu "Target Images"
|
||||
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_mpc85xx
|
||||
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ramips
|
||||
default TARGET_INITRAMFS_COMPRESSION_ZSTD if TARGET_qualcommax
|
||||
default TARGET_INITRAMFS_COMPRESSION_ZSTD if TARGET_microchipsw
|
||||
default TARGET_INITRAMFS_COMPRESSION_XZ if USES_SEPARATE_INITRAMFS
|
||||
default TARGET_INITRAMFS_COMPRESSION_NONE
|
||||
depends on TARGET_ROOTFS_INITRAMFS
|
||||
@@ -336,7 +335,7 @@ menu "Target Images"
|
||||
int "Root filesystem partition size (in MiB)"
|
||||
depends on USES_ROOTFS_PART || TARGET_ROOTFS_EXT4FS
|
||||
default 232 if TARGET_loongarch64
|
||||
default 448 if TARGET_mediatek || TARGET_microchipsw
|
||||
default 448 if TARGET_mediatek
|
||||
default 104
|
||||
help
|
||||
Select the root filesystem partition size.
|
||||
|
||||
@@ -597,12 +597,14 @@ choice
|
||||
|
||||
config KERNEL_TRANSPARENT_HUGEPAGE_NEVER
|
||||
bool "never"
|
||||
depends on !LINUX_6_6
|
||||
endchoice
|
||||
|
||||
config KERNEL_ARM64_CONTPTE
|
||||
bool "Compile the kernel with Contiguous PTE mappings for user memory"
|
||||
depends on aarch64
|
||||
depends on KERNEL_ARM64
|
||||
depends on KERNEL_TRANSPARENT_HUGEPAGE
|
||||
depends on !LINUX_6_6
|
||||
default y
|
||||
|
||||
config KERNEL_HUGETLBFS
|
||||
@@ -860,6 +862,7 @@ if KERNEL_CGROUPS
|
||||
config KERNEL_CPUSETS_V1
|
||||
bool "Legacy cgroup v1 cpusets controller"
|
||||
depends on KERNEL_CPUSETS
|
||||
depends on !LINUX_6_6
|
||||
default n
|
||||
help
|
||||
Legacy cgroup v1 cpusets controller which has been deprecated by
|
||||
@@ -918,6 +921,7 @@ if KERNEL_CGROUPS
|
||||
bool "Legacy cgroup v1 memory controller"
|
||||
default n
|
||||
depends on KERNEL_MEMCG
|
||||
depends on !LINUX_6_6
|
||||
help
|
||||
Legacy cgroup v1 memory controller which has been deprecated by
|
||||
cgroup v2 implementation. The v1 is there for legacy applications
|
||||
@@ -1181,7 +1185,6 @@ config KERNEL_NET_L3_MASTER_DEV
|
||||
config KERNEL_DCB
|
||||
bool "Data Center Bridging support"
|
||||
default y if TARGET_armsr_armv8
|
||||
default y if TARGET_microchipsw
|
||||
default y if TARGET_x86_64
|
||||
help
|
||||
This enables support for configuring Data Center Bridging (DCB)
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
src-git packages https://git.openwrt.org/feed/packages.git^f1aecb34330f0c92da61919ca8afc109034f867b
|
||||
src-git luci https://git.openwrt.org/project/luci.git^355a432ef90e34a56661dd1d998b203ae8a76283
|
||||
src-git routing https://git.openwrt.org/feed/routing.git^5a276c7e3a647299f0bbf9cd0ee92800f8ba9cf8
|
||||
src-git telephony https://git.openwrt.org/feed/telephony.git^2618106d5846a4a542fdf5809f0d3ed228ce439b
|
||||
src-git video https://github.com/openwrt/video.git^094bf58da6682f895255a35a84349a79dab4bf95
|
||||
src-git packages https://git.openwrt.org/feed/packages.git
|
||||
src-git luci https://git.openwrt.org/project/luci.git
|
||||
src-git routing https://git.openwrt.org/feed/routing.git
|
||||
src-git telephony https://git.openwrt.org/feed/telephony.git
|
||||
src-git video https://github.com/openwrt/video.git
|
||||
#src-git targets https://github.com/openwrt/targets.git
|
||||
#src-git oldpackages http://git.openwrt.org/packages.git
|
||||
#src-link custom /usr/src/openwrt/custom-feed
|
||||
|
||||
@@ -89,8 +89,8 @@ endif
|
||||
define Build/Configure/Default
|
||||
mkdir -p $(CMAKE_BINARY_DIR)
|
||||
(cd $(CMAKE_BINARY_DIR); \
|
||||
CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)" \
|
||||
CXXFLAGS="$(TARGET_CXXFLAGS) $(EXTRA_CXXFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)" \
|
||||
CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \
|
||||
CXXFLAGS="$(TARGET_CXXFLAGS) $(EXTRA_CXXFLAGS)" \
|
||||
LDFLAGS="$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS)" \
|
||||
cmake \
|
||||
--no-warn-unused-cli \
|
||||
@@ -113,7 +113,7 @@ define Build/Configure/Default
|
||||
-DCMAKE_NM="$(CMAKE_NM)" \
|
||||
-DCMAKE_RANLIB="$(CMAKE_RANLIB)" \
|
||||
-DCMAKE_FIND_ROOT_PATH="$(CMAKE_FIND_ROOT_PATH)" \
|
||||
-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
|
||||
-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=BOTH \
|
||||
-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
|
||||
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \
|
||||
-DCMAKE_STRIP=: \
|
||||
|
||||
@@ -159,7 +159,7 @@ $(if $(if $(MIRROR), \
|
||||
( $(3) ) \
|
||||
$(if $(filter-out x,$(MIRROR_HASH)), && ( \
|
||||
file_hash="$$$$($(MKHASH) sha256 "$(DL_DIR)/$(FILE)")"; \
|
||||
[ "$$$$file_hash" = "$(MIRROR_HASH)" ] || [ "$(MIRROR_HASH)" = "skip" ] || { \
|
||||
[ "$$$$file_hash" = "$(MIRROR_HASH)" ] || { \
|
||||
echo "Hash mismatch for file $(FILE): expected $(MIRROR_HASH), got $$$$file_hash"; \
|
||||
false; \
|
||||
}; \
|
||||
@@ -238,7 +238,7 @@ define DownloadMethod/rawgit
|
||||
[ \! -d $(SUBDIR) ] && \
|
||||
git clone $(OPTS) $(URL) $(SUBDIR) && \
|
||||
(cd $(SUBDIR) && git checkout $(SOURCE_VERSION)) && \
|
||||
export TAR_TIMESTAMP=`cd $(SUBDIR) && git log -1 --no-show-signature --format='@%ct'` && \
|
||||
export TAR_TIMESTAMP=`cd $(SUBDIR) && git log -1 --format='@%ct'` && \
|
||||
echo "Generating formal git archive (apply .gitattributes rules)" && \
|
||||
(cd $(SUBDIR) && git config core.abbrev 8 && \
|
||||
git archive --format=tar HEAD --output=../$(SUBDIR).tar.git) && \
|
||||
|
||||
@@ -8,8 +8,6 @@ PKG_ASLR_PIE_REGULAR ?= 0
|
||||
PKG_SSP ?= 1
|
||||
PKG_FORTIFY_SOURCE ?= 1
|
||||
PKG_RELRO ?= 1
|
||||
PKG_DT_RELR ?= 1
|
||||
PKG_FANALYZER ?= 0
|
||||
|
||||
ifdef CONFIG_PKG_CHECK_FORMAT_SECURITY
|
||||
ifeq ($(strip $(PKG_CHECK_FORMAT_SECURITY)),1)
|
||||
@@ -53,11 +51,6 @@ ifdef CONFIG_PKG_FORTIFY_SOURCE_2
|
||||
TARGET_CFLAGS += -D_FORTIFY_SOURCE=2
|
||||
endif
|
||||
endif
|
||||
ifdef CONFIG_PKG_FORTIFY_SOURCE_3
|
||||
ifeq ($(strip $(PKG_FORTIFY_SOURCE)),1)
|
||||
TARGET_CFLAGS += -D_FORTIFY_SOURCE=3
|
||||
endif
|
||||
endif
|
||||
ifdef CONFIG_PKG_RELRO_PARTIAL
|
||||
ifeq ($(strip $(PKG_RELRO)),1)
|
||||
TARGET_CFLAGS += -Wl,-z,relro
|
||||
@@ -71,15 +64,3 @@ ifdef CONFIG_PKG_RELRO_FULL
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef CONFIG_PKG_DT_RELR
|
||||
ifeq ($(strip $(PKG_DT_RELR)),1)
|
||||
TARGET_CFLAGS += -Wl,-z,pack-relative-relocs
|
||||
TARGET_LDFLAGS += -zpack-relative-relocs
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef CONFIG_PKG_FANALYZER
|
||||
ifeq ($(strip $(PKG_FANALYZER)),1)
|
||||
TARGET_CFLAGS += -fanalyzer
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -130,33 +130,6 @@ define Build/append-gl-metadata
|
||||
}
|
||||
endef
|
||||
|
||||
define Build/append-teltonika-metadata
|
||||
echo \
|
||||
'{$(if $(IMAGE_METADATA),$(IMAGE_METADATA)$(comma)) \
|
||||
"metadata_version": "1.1", \
|
||||
"compat_version": "$(call json_quote,$(compat_version))", \
|
||||
"version":"$(call json_quote,$(VERSION_DIST))-$(call json_quote,$(VERSION_NUMBER))-$(call json_quote,$(REVISION))", \
|
||||
"device_code": [".*"], \
|
||||
"hwver": [".*"], \
|
||||
"batch": [".*"], \
|
||||
"serial": [".*"], \
|
||||
$(if $(DEVICE_COMPAT_MESSAGE),"compat_message": "$(call json_quote,$(DEVICE_COMPAT_MESSAGE))"$(comma)) \
|
||||
$(if $(filter-out 1.0,$(compat_version)),"new_supported_devices": \
|
||||
[$(call metadata_devices,$(SUPPORTED_TELTONIKA_DEVICES))]$(comma) \
|
||||
"supported_devices": ["$(call json_quote,$(legacy_supported_message))"]$(comma)) \
|
||||
$(if $(filter 1.0,$(compat_version)),"supported_devices":[$(call metadata_devices,$(SUPPORTED_TELTONIKA_DEVICES))]$(comma)) \
|
||||
"version_wrt": { \
|
||||
"dist": "$(call json_quote,$(VERSION_DIST))", \
|
||||
"version": "$(call json_quote,$(VERSION_NUMBER))", \
|
||||
"revision": "$(call json_quote,$(REVISION))", \
|
||||
"target": "$(call json_quote,$(TARGETID))", \
|
||||
"board": "$(call json_quote,$(if $(BOARD_NAME),$(BOARD_NAME),$(DEVICE_NAME)))" \
|
||||
}, \
|
||||
"hw_support": {}, \
|
||||
"hw_mods": {$(shell i=1; for mod in $(SUPPORTED_TELTONIKA_HW_MODS); do [ $$i -gt 1 ] && echo -n ,; echo -n "\"mod$$i\": \"$$mod\""; i=$$((i+1)); done)} \
|
||||
}' | fwtool -I - $@
|
||||
endef
|
||||
|
||||
define Build/append-rootfs
|
||||
dd if=$(IMAGE_ROOTFS) >> $@
|
||||
endef
|
||||
@@ -430,11 +403,8 @@ define Build/initrd_compression
|
||||
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_ZSTD),.zstd)
|
||||
endef
|
||||
|
||||
define Build/fit-its
|
||||
$(if $(findstring with-rootfs,$(word 3,$(1))), \
|
||||
$(call locked,dd if=$(IMAGE_ROOTFS) of=$(IMAGE_ROOTFS).pagesync bs=4096 conv=sync, \
|
||||
gen-cpio$(if $(TARGET_PER_DEVICE_ROOTFS),.$(ROOTFS_ID/$(DEVICE_NAME)))))
|
||||
$(TOPDIR)/scripts/mkits.sh \
|
||||
define Build/fit
|
||||
$(call locked,$(TOPDIR)/scripts/mkits.sh \
|
||||
-D $(DEVICE_NAME) -o $@.its -k $@ \
|
||||
-C $(word 1,$(1)) \
|
||||
$(if $(word 2,$(1)),\
|
||||
@@ -451,21 +421,12 @@ define Build/fit-its
|
||||
$(if $(DEVICE_DTS_LOADADDR),-s $(DEVICE_DTS_LOADADDR)) \
|
||||
$(if $(DEVICE_DTS_OVERLAY),$(foreach dtso,$(DEVICE_DTS_OVERLAY), -O $(dtso):$(KERNEL_BUILD_DIR)/image-$(dtso).dtbo)) \
|
||||
-c $(if $(DEVICE_DTS_CONFIG),$(DEVICE_DTS_CONFIG),"config-1") \
|
||||
-A $(LINUX_KARCH) -v $(LINUX_VERSION)
|
||||
endef
|
||||
|
||||
define Build/fit-image
|
||||
-A $(LINUX_KARCH) -v $(LINUX_VERSION), gen-cpio$(if $(TARGET_PER_DEVICE_ROOTFS),.$(ROOTFS_ID/$(DEVICE_NAME))))
|
||||
$(call locked,PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage $(if $(findstring external,$(word 3,$(1))),\
|
||||
-E -B 0x1000 $(if $(findstring static,$(word 3,$(1))),-p 0x1000)) -f $@.its $@.new, \
|
||||
gen-cpio$(if $(TARGET_PER_DEVICE_ROOTFS),.$(ROOTFS_ID/$(DEVICE_NAME))))
|
||||
-E -B 0x1000 $(if $(findstring static,$(word 3,$(1))),-p 0x1000)) -f $@.its $@.new)
|
||||
@mv $@.new $@
|
||||
endef
|
||||
|
||||
define Build/fit
|
||||
$(call Build/fit-its,$(1))
|
||||
$(call Build/fit-image,$(1))
|
||||
endef
|
||||
|
||||
define Build/libdeflate-gzip
|
||||
$(STAGING_DIR_HOST)/bin/libdeflate-gzip -f -12 -c $@ $(1) > $@.new
|
||||
@mv $@.new $@
|
||||
@@ -531,7 +492,7 @@ define Build/yaffs-filesystem
|
||||
filesystem_size="filesystem_blocks * 64 * 1024" \
|
||||
filesystem_size_with_reserve="(filesystem_blocks + 2) * 64 * 1024"; \
|
||||
head -c $$filesystem_size_with_reserve /dev/zero | tr "\000" "\377" > $@.img \
|
||||
&& yafut -d $@.img -w -i $@ -o $(if $(findstring v7,$@),bootimage,kernel) -C 1040 -B 64k -E -P -S $(1) \
|
||||
&& yafut -d $@.img -w -i $@ -o kernel -C 1040 -B 64k -E -P -S $(1) \
|
||||
&& truncate -s $$filesystem_size $@.img \
|
||||
&& mv $@.img $@
|
||||
endef
|
||||
@@ -569,11 +530,6 @@ define Build/gl-qsdk-factory
|
||||
$(KDIR_TMP)/$(notdir $(BOOT_SCRIPT))
|
||||
endef
|
||||
|
||||
define Build/kernel-pack-npk
|
||||
$(STAGING_DIR_HOST)/bin/npk_pack_kernel $@ $@.npk
|
||||
mv $@.npk $@
|
||||
endef
|
||||
|
||||
define Build/linksys-image
|
||||
let \
|
||||
size="$$(stat -c%s $@)" \
|
||||
@@ -652,19 +608,6 @@ define Build/openmesh-image
|
||||
"$(call param_get_default,rootfs,$(1),$@)" "rootfs"
|
||||
endef
|
||||
|
||||
define Build/dualboot-datachk-nand-image
|
||||
$(TOPDIR)/scripts/nand-fwupgradecfg-gen.sh \
|
||||
"$(call param_get_default,ce_type,$(1),$(DEVICE_NAME))" \
|
||||
"$@-fwupgrade.cfg" \
|
||||
"$(call param_get_default,kernel,$(1),$(IMAGE_KERNEL))" \
|
||||
"$(call param_get_default,rootfs,$(1),$@)"
|
||||
$(TOPDIR)/scripts/combined-ext-image.sh \
|
||||
"$(call param_get_default,ce_type,$(1),$(DEVICE_NAME))" "$@" \
|
||||
"$@-fwupgrade.cfg" "fwupgrade.cfg" \
|
||||
"$(call param_get_default,kernel,$(1),$(IMAGE_KERNEL))" "kernel" \
|
||||
"$(call param_get_default,rootfs,$(1),$@)" "rootfs"
|
||||
endef
|
||||
|
||||
define Build/pad-extra
|
||||
dd if=/dev/zero bs=$(1) count=1 >> $@
|
||||
endef
|
||||
|
||||
@@ -41,9 +41,6 @@ KDIR=$(KERNEL_BUILD_DIR)
|
||||
KDIR_TMP=$(KDIR)/tmp
|
||||
DTS_DIR:=$(LINUX_DIR)/arch/$(LINUX_KARCH)/boot/dts
|
||||
|
||||
ifeq ($(EXTRA_IMAGE_NAME),)
|
||||
EXTRA_IMAGE_NAME:=$(call qstrip,$(CONFIG_EXTRA_IMAGE_NAME))
|
||||
endif
|
||||
IMG_PREFIX_EXTRA:=$(if $(EXTRA_IMAGE_NAME),$(call sanitize,$(EXTRA_IMAGE_NAME))-)
|
||||
IMG_PREFIX_VERNUM:=$(if $(CONFIG_VERSION_FILENAMES),$(call sanitize,$(VERSION_NUMBER))-)
|
||||
IMG_PREFIX_VERCODE:=$(if $(CONFIG_VERSION_CODE_FILENAMES),$(call sanitize,$(VERSION_CODE))-)
|
||||
@@ -117,7 +114,6 @@ fs-types-$(CONFIG_TARGET_ROOTFS_JFFS2_NAND) += $(addprefix jffs2-nand-,$(NAND_BL
|
||||
fs-types-$(CONFIG_TARGET_ROOTFS_EXT4FS) += ext4
|
||||
fs-types-$(CONFIG_TARGET_ROOTFS_UBIFS) += ubifs
|
||||
fs-types-$(CONFIG_TARGET_ROOTFS_EROFS) += erofs
|
||||
fs-types-$(CONFIG_TARGET_ROOTFS_TARGZ) += targz
|
||||
fs-subtypes-$(CONFIG_TARGET_ROOTFS_JFFS2) += $(addsuffix -raw,$(addprefix jffs2-,$(JFFS2_BLOCKSIZE)))
|
||||
|
||||
TARGET_FILESYSTEMS := $(fs-types-y)
|
||||
@@ -330,12 +326,6 @@ define Image/mkfs/erofs
|
||||
$@ $(call mkfs_target_dir,$(1))
|
||||
endef
|
||||
|
||||
define Image/mkfs/targz
|
||||
$(TAR) -cp --numeric-owner --owner=0 --group=0 --mode=a-s --sort=name \
|
||||
$(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)") \
|
||||
-C $(call mkfs_target_dir,$(1)) . | gzip -9n > $@
|
||||
endef
|
||||
|
||||
define Image/Manifest
|
||||
$(if $(CONFIG_USE_APK), \
|
||||
$(call apk,$(TARGET_DIR_ORIG)) list --quiet --manifest --no-network \
|
||||
@@ -605,6 +595,7 @@ define Device/Check/Common
|
||||
_PROFILE_SET :=
|
||||
endif
|
||||
endif
|
||||
DEVICE_PACKAGES += $$(call extra_packages,$$(DEVICE_PACKAGES))
|
||||
ifdef TARGET_PER_DEVICE_ROOTFS
|
||||
$$(eval $$(call merge_packages,_PACKAGES,$$(DEVICE_PACKAGES) $$(call DEVICE_EXTRA_PACKAGES,$(1))))
|
||||
ROOTFS_ID/$(1) := $$(if $$(_PROFILE_SET),$$(call mkfs_packages_id,$$(_PACKAGES)))
|
||||
|
||||
@@ -25,6 +25,7 @@ ifeq ($(strip $(CONFIG_EXTERNAL_KERNEL_TREE)),"")
|
||||
define Kernel/Prepare/Default
|
||||
$(LINUX_CAT) $(DL_DIR)/$(LINUX_SOURCE) | $(TAR) -C $(KERNEL_BUILD_DIR) $(TAR_OPTIONS)
|
||||
$(Kernel/Patch)
|
||||
$(if $(QUILT),touch $(LINUX_DIR)/.quilt_used)
|
||||
endef
|
||||
else
|
||||
define Kernel/Prepare/Default
|
||||
|
||||
@@ -306,3 +306,4 @@ kernel_patchver_ge=$(call kernel_version_cmp,-ge,$(KERNEL_PATCHVER),$(1))
|
||||
kernel_patchver_eq=$(call kernel_version_cmp,-eq,$(KERNEL_PATCHVER),$(1))
|
||||
kernel_patchver_le=$(call kernel_version_cmp,-le,$(KERNEL_PATCHVER),$(1))
|
||||
kernel_patchver_lt=$(call kernel_version_cmp,-lt,$(KERNEL_PATCHVER),$(1))
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
# Copyright (C) 2022-2023 Enéas Ulir de Queiroz
|
||||
|
||||
ENGINES_DIR=engines-3
|
||||
MODULES_DIR=ossl-modules
|
||||
|
||||
define Package/openssl/module/Default
|
||||
SECTION:=libs
|
||||
@@ -75,6 +74,6 @@ endef
|
||||
# 1 = provider name
|
||||
# 2 = [ package name, defaults to libopenssl-$(1) ]
|
||||
define Package/openssl/add-provider
|
||||
$(call Package/openssl/add-module,provider,$(1),/usr/lib/$(MODULES_DIR),$(2))
|
||||
$(call Package/openssl/add-module,provider,$(1),/usr/lib/ossl-modules,$(2))
|
||||
endef
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ define Package/Default
|
||||
PROVIDES:=
|
||||
EXTRA_DEPENDS:=
|
||||
MAINTAINER:=$(PKG_MAINTAINER)
|
||||
SOURCE:=$(patsubst $(TOPDIR)/%,%,$(if $(__pkg_source_makefile),$(__pkg_source_makefile),$(CURDIR)))
|
||||
SOURCE:=$(patsubst $(TOPDIR)/%,%,$(patsubst $(TOPDIR)/package/%,feeds/base/%,$(CURDIR)))
|
||||
ifneq ($(PKG_VERSION),)
|
||||
ifneq ($(PKG_RELEASE),)
|
||||
VERSION:=$(PKG_VERSION)-r$(PKG_RELEASE)
|
||||
|
||||
@@ -78,196 +78,6 @@ define FixupDependencies
|
||||
$(call AddDependency,$(1),$$(DEPS))
|
||||
endef
|
||||
|
||||
# Format dependencies and extra dependencies
|
||||
#
|
||||
# ABI-version EXTRA_DEPENDS so dependencies can be correctly looked up using the
|
||||
# existing semantics without the ABI specified. This is needed since ABI-
|
||||
# versioned libraries don't provide `${package_name}=${package_version}`, so
|
||||
# that same library but with different ABI versions can be installed side by
|
||||
# side.
|
||||
#
|
||||
# Remove duplicate dependencies when EXTRA_DEPENDS specifies a versioned one
|
||||
# that is already in DEPENDS.
|
||||
#
|
||||
# 1: list of dependencies
|
||||
# 2: list of extra dependencies
|
||||
define FormatDepends
|
||||
$(strip
|
||||
$(eval _COMMA_SEP := __COMMA_SEP__)
|
||||
$(eval _SPACE_SEP := __SPACE_SEP__)
|
||||
$(eval _DEPENDS := $(1))
|
||||
$(eval _EXTRA_DEPENDS_ABI := )
|
||||
$(eval _DEP_ITEMS := $(subst $(_COMMA_SEP),$(space),$(subst $(space),$(_SPACE_SEP),$(subst $(comma),$(_COMMA_SEP),$(2)))))
|
||||
|
||||
$(foreach dep,$(_DEP_ITEMS),
|
||||
$(eval _EXTRA_DEP := )
|
||||
$(eval _CUR_DEP := $(subst $(_SPACE_SEP),$(space),$(strip $(dep))))
|
||||
$(eval _PKG_NAME := $(word 1,$(_CUR_DEP)))
|
||||
$(if $(findstring $(paren_left), $(_PKG_NAME)),
|
||||
$(error "Unsupported extra dependency format: no space before '(': $(_CUR_DEP)"))
|
||||
)
|
||||
$(eval _ABI_SUFFIX := $(call GetABISuffix,$(_PKG_NAME)))
|
||||
$(eval _PKG_NAME_ABI := $(_PKG_NAME)$(_ABI_SUFFIX))
|
||||
$(eval _VERSION_CONSTRAINT := $(word 2,$(_CUR_DEP)))
|
||||
$(if $(_VERSION_CONSTRAINT),
|
||||
$(eval _EXTRA_DEP := $(_PKG_NAME_ABI) $(_VERSION_CONSTRAINT)),
|
||||
$(error "Extra dependencies must have version constraints. $(_PKG_NAME) seems to be unversioned.")
|
||||
)
|
||||
$(if $(and $(_EXTRA_DEPENDS_ABI),$(_EXTRA_DEP)),
|
||||
$(eval _EXTRA_DEPENDS_ABI := $(_EXTRA_DEPENDS_ABI)$(comma)$(_EXTRA_DEP)),
|
||||
$(eval _EXTRA_DEPENDS_ABI := $(_EXTRA_DEP))
|
||||
)
|
||||
$(if $(_DEPENDS),
|
||||
$(eval _DEPENDS := $(filter-out $(_PKG_NAME_ABI),$(_DEPENDS)))
|
||||
)
|
||||
)
|
||||
|
||||
$(eval _DEPENDS := $(call mergelist,$(_DEPENDS)))
|
||||
$(_EXTRA_DEPENDS_ABI)$(if $(_DEPENDS),$(comma) $(_DEPENDS))
|
||||
)
|
||||
endef
|
||||
|
||||
# Format provide and add ABI and version if it's not a virtual provide marked
|
||||
# with an @.
|
||||
#
|
||||
# Same as for the base package name, if ABI version is set, provide both
|
||||
# unversioned provide and one with ABI version and version.
|
||||
#
|
||||
# 1: provide name
|
||||
# 2: provide version
|
||||
# 3: (optional) ABI version
|
||||
define AddProvide
|
||||
$(strip
|
||||
$(if $(filter @%,$(1)),
|
||||
$(patsubst @%,%,$(1)),
|
||||
$(if $(3),
|
||||
$(1) $(1)$(call FormatABISuffix,$(1),$(3))=$(2),
|
||||
$(1)=$(2)
|
||||
)
|
||||
)
|
||||
)
|
||||
endef
|
||||
|
||||
# Remove virtual provides prefix and self. apk doesn't like it when packages
|
||||
# specify a redundant provide pointing to self.
|
||||
#
|
||||
# 1: package name
|
||||
# 2: list of provides
|
||||
define SanitizeProvides
|
||||
$(filter-out $(1),$(patsubst @%,%,$(2)))
|
||||
endef
|
||||
|
||||
# Format provides both for apk and control
|
||||
#
|
||||
# - If ABI version is defined:
|
||||
# - package is named `${package_name}${ABI_version}`
|
||||
# if a `package_name` ends in a number, the `ABI_version` will be prefixed
|
||||
# with a - sign, e.g.: libsqlite3-0
|
||||
# - package implicitly provides
|
||||
# `${package_name}${ABI_version}=${package_version}`
|
||||
# this implies that only one version of a package per ABI can be installed
|
||||
# at the same time
|
||||
# - additionally provide `${package_name}` so multiple packages can be looked
|
||||
# up by its base name
|
||||
# - for each `provides`:
|
||||
# - provide `${provide}${ABI_version}=${package_version}`
|
||||
# this implies that only one version of a provide can be installed at the
|
||||
# same time
|
||||
# - if a `provide` ends in a number, the `ABI_version` will be prefixed with
|
||||
# a - sign, e.g.: provide1-0
|
||||
# - additionally provide `${provide}` so multiple packages can be looked up
|
||||
# by its base name
|
||||
#
|
||||
# - else if ABI version is _not_ defined
|
||||
# - package is named `${package_name}`
|
||||
# - package implicitly provides `${package_name}=${package_version}`
|
||||
# this implies that only one version of a package can be installed at the
|
||||
# same time
|
||||
# - for each `provides`, provide `${provide}=${package_version}` this implies
|
||||
# that only one version of a provide can be installed at the same time
|
||||
#
|
||||
# - Both with and without an ABI, if a provide starts with an @, treat it as a
|
||||
# virtual provide, that doesn't own the name by not appending version.
|
||||
# Multiple packages with the same virtual provides can be installed
|
||||
# side-by-side.
|
||||
#
|
||||
# - apk doesn't like it when packages specify a redundant provide pointing to
|
||||
# self. Filter it out, but keep virtual self provides, in the form of
|
||||
# @(kmod-)?${package_name}-any.
|
||||
#
|
||||
# - Packages implicitly add a virtual @${package_name}-any provide in Package,
|
||||
# which implies that kmods, which are also packages, will have a virtual
|
||||
# @kmod-${package_name}-any provide.
|
||||
#
|
||||
# - Aside from the two aforementioned implicit provides, packages are expected
|
||||
# to manage their provides themselves.
|
||||
#
|
||||
# - When multiple variants inside the same package have the same provide, a
|
||||
# default variant must be set using DEFAULT_VARIANT:=1.
|
||||
#
|
||||
# - Cross-package provides must be virtual and a default variant must be set. If
|
||||
# different packages provide the same versioned (i.e. non-virtual) provide the
|
||||
# package with a higher version will be preferred, which results in unintended
|
||||
# behavior, because the order might change with package updates.
|
||||
#
|
||||
# Example:
|
||||
# - both uclient-fetch and wget provide wget
|
||||
# - wget doesn't have a default variant called wget that would provide an
|
||||
# implicit @wget-any
|
||||
# - add wget to PROVIDES for both wget-ssl and wget-nossl variants so they
|
||||
# can't be installed at the same time
|
||||
# - add @wget-any to both packages so packages outside of wget can provide
|
||||
# it
|
||||
# - uclient-fetch has only one variant
|
||||
# - add @wget-any to PROVIDES
|
||||
# - mark uclient-fetch as the default variant using DEFAULT_VARIANT:=1
|
||||
# - switch wget consumer that don't depend on a specific version like apk to
|
||||
# depend on @wget-any
|
||||
#
|
||||
# - Alternatives don't affect the packaging.
|
||||
#
|
||||
# 1: package name
|
||||
# 2: package version
|
||||
# 3: ABI version
|
||||
# 4: list of provides
|
||||
define FormatProvides
|
||||
$(strip \
|
||||
$(if $(call FormatABISuffix,$(1),$(3)), \
|
||||
$(1) $(foreach provide, \
|
||||
$(filter-out $(1),$(4)), \
|
||||
$(call AddProvide,$(provide),$(2),$(3)) \
|
||||
), \
|
||||
$(foreach provide, \
|
||||
$(filter-out $(1),$(4)), \
|
||||
$(call AddProvide,$(provide),$(2)) \
|
||||
) \
|
||||
) \
|
||||
)
|
||||
endef
|
||||
|
||||
# Get apk provider priority
|
||||
#
|
||||
# - if a package is marked as a default variant, set it to 100.
|
||||
#
|
||||
# - if a package has an ABI version defined, set it to 10.
|
||||
# The enables packages with an ABI version to be installed by their base name
|
||||
# instead of a name and an ABI version, e.g.:
|
||||
# libfoo3, where 3 is the ABI version can be installed by just libfoo.
|
||||
# This affects manual installation only, as the dependency resolution takes
|
||||
# care of ABI versions.
|
||||
#
|
||||
# - otherwise return nothing, i.e. package will have the default priority 0.
|
||||
#
|
||||
# 1: Default variant
|
||||
# 2: ABI version
|
||||
define GetProviderPriority
|
||||
$(strip
|
||||
$(if $(1),100,
|
||||
$(if $(2),10)
|
||||
)
|
||||
)
|
||||
endef
|
||||
|
||||
ifneq ($(PKG_NAME),toolchain)
|
||||
define CheckDependencies
|
||||
@( \
|
||||
@@ -381,33 +191,17 @@ endif
|
||||
$(STAGING_DIR_ROOT)/stamp/.$(1)_installed: $(PKG_BUILD_DIR)/.pkgdir/$(1).installed
|
||||
mkdir -p $(STAGING_DIR_ROOT)/stamp
|
||||
$(if $(ABI_VERSION),echo '$(ABI_VERSION)' | cmp -s - $(PKG_INFO_DIR)/$(1).version || { \
|
||||
mkdir -p $(PKG_INFO_DIR); \
|
||||
echo '$(ABI_VERSION)' > $(PKG_INFO_DIR)/$(1).version; \
|
||||
$(foreach pkg,$(call SanitizeProvides,$(1),$(PROVIDES)), \
|
||||
$(foreach pkg,$(filter-out $(1),$(PROVIDES)), \
|
||||
cp $(PKG_INFO_DIR)/$(1).version $(PKG_INFO_DIR)/$(pkg).version; \
|
||||
) \
|
||||
} )
|
||||
$(call locked,$(CP) $(PKG_BUILD_DIR)/.pkgdir/$(1)/. $(STAGING_DIR_ROOT)/,root-copy)
|
||||
touch $$@
|
||||
|
||||
Package/$(1)/DEPENDS := $$(foreach dep,$$(filter-out @%,$$(IDEPEND_$(1))),$$(dep)$$(call GetABISuffix,$$(dep)))
|
||||
Package/$(1)/DEPENDS := $$(call mergelist,$$(foreach dep,$$(filter-out @%,$$(IDEPEND_$(1))),$$(dep)$$(call GetABISuffix,$$(dep))))
|
||||
ifneq ($$(EXTRA_DEPENDS),)
|
||||
ifeq ($(CONFIG_USE_APK),)
|
||||
Package/$(1)/DEPENDS := $$(call mergelist,$$(Package/$(1)/DEPENDS))
|
||||
Package/$(1)/DEPENDS := $$(EXTRA_DEPENDS)$$(if $$(Package/$(1)/DEPENDS),$$(comma) $$(Package/$(1)/DEPENDS))
|
||||
else
|
||||
Package/$(1)/DEPENDS := $$(call FormatDepends,$$(Package/$(1)/DEPENDS),$$(EXTRA_DEPENDS))
|
||||
endif
|
||||
else
|
||||
Package/$(1)/DEPENDS := $$(call mergelist,$$(Package/$(1)/DEPENDS))
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_USE_APK),)
|
||||
Package/$(1)/PROVIDES := $$(patsubst @%,%,$(PROVIDES))
|
||||
Package/$(1)/PROVIDES := $$(filter-out $(1)$$(ABIV_$(1)),$$(Package/$(1)/PROVIDES)$$(if $$(ABIV_$(1)), $(1) $$(foreach provide,$$(Package/$(1)/PROVIDES),$$(provide)$$(ABIV_$(1)))))
|
||||
else
|
||||
Package/$(1)/PROVIDES := $$(call FormatProvides,$(1),$(VERSION),$(ABI_VERSION),$(PROVIDES))
|
||||
Package/$(1)/PRIORITY := $$(call GetProviderPriority,$(DEFAULT_VARIANT),$(ABI_VERSION))
|
||||
Package/$(1)/DEPENDS := $$(EXTRA_DEPENDS)$$(if $$(Package/$(1)/DEPENDS),$$(comma) $$(Package/$(1)/DEPENDS))
|
||||
endif
|
||||
|
||||
$(_define) Package/$(1)/CONTROL
|
||||
@@ -415,7 +209,7 @@ Package: $(1)$$(ABIV_$(1))
|
||||
Version: $(VERSION)
|
||||
$$(call addfield,Depends,$$(Package/$(1)/DEPENDS)
|
||||
)$$(call addfield,Conflicts,$$(call mergelist,$(CONFLICTS))
|
||||
)$$(call addfield,Provides,$$(call mergelist,$$(Package/$(1)/PROVIDES))
|
||||
)$$(call addfield,Provides,$$(call mergelist,$$(filter-out $(1)$$(ABIV_$(1)),$(PROVIDES)$$(if $$(ABIV_$(1)), $(1) $(foreach provide,$(PROVIDES),$(provide)$$(ABIV_$(1))))))
|
||||
)$$(call addfield,Alternatives,$$(call mergelist,$(ALTERNATIVES))
|
||||
)$$(call addfield,Source,$(SOURCE)
|
||||
)$$(call addfield,SourceName,$(PKG_NAME)
|
||||
@@ -438,7 +232,6 @@ $(_endef)
|
||||
$$(PACK_$(1)) : export DESCRIPTION=$$(Package/$(1)/description)
|
||||
$$(PACK_$(1)) : export PATH=$$(TARGET_PATH_PKG)
|
||||
$$(PACK_$(1)) : export PKG_SOURCE_DATE_EPOCH:=$(PKG_SOURCE_DATE_EPOCH)
|
||||
$$(PACK_$(1)) : export SOURCE_DATE_EPOCH:=$(PKG_SOURCE_DATE_EPOCH)
|
||||
$(PKG_INFO_DIR)/$(1).provides $$(PACK_$(1)): $(STAMP_BUILT) $(INCLUDE_DIR)/package-pack.mk
|
||||
rm -rf $$(IDIR_$(1))
|
||||
ifeq ($$(CONFIG_USE_APK),)
|
||||
@@ -459,7 +252,7 @@ endif
|
||||
fi; \
|
||||
done; $(Package/$(1)/extra_provides) \
|
||||
) | sort -u > $(PKG_INFO_DIR)/$(1).provides
|
||||
$(if $(PROVIDES),@for pkg in $(call SanitizeProvides,$(1),$(PROVIDES)); do cp $(PKG_INFO_DIR)/$(1).provides $(PKG_INFO_DIR)/$$$$pkg.provides; done)
|
||||
$(if $(PROVIDES),@for pkg in $(filter-out $(1),$(PROVIDES)); do cp $(PKG_INFO_DIR)/$(1).provides $(PKG_INFO_DIR)/$$$$pkg.provides; done)
|
||||
$(CheckDependencies)
|
||||
|
||||
$(RSTRIP) $$(IDIR_$(1))
|
||||
@@ -486,7 +279,7 @@ endif
|
||||
)
|
||||
endif
|
||||
|
||||
$(INSTALL_DIR) $$(PDIR_$(1))
|
||||
$(INSTALL_DIR) $$(PDIR_$(1))/tmp
|
||||
|
||||
ifeq ($(CONFIG_USE_APK),)
|
||||
mkdir -p $$(IDIR_$(1))/CONTROL
|
||||
@@ -526,24 +319,24 @@ else
|
||||
echo "[ -s "\$$$${IPKG_INSTROOT}/lib/functions.sh" ] || exit 0"; \
|
||||
echo ". \$$$${IPKG_INSTROOT}/lib/functions.sh"; \
|
||||
echo 'export root="$$$${IPKG_INSTROOT}"'; \
|
||||
echo 'export pkgname="$(1)$$(ABIV_$(1))"'; \
|
||||
echo 'export pkgname="$(1)"'; \
|
||||
echo "add_group_and_user"; \
|
||||
echo "default_postinst"; \
|
||||
[ ! -f $$(ADIR_$(1))/postinst-pkg ] || sed '/^\s*#!/d' "$$(ADIR_$(1))/postinst-pkg"; \
|
||||
[ ! -f $$(ADIR_$(1))/postinst-pkg ] || sed -z 's/^\s*#!/#!/' "$$(ADIR_$(1))/postinst-pkg"; \
|
||||
) > $$(ADIR_$(1))/post-install;
|
||||
|
||||
ifdef Package/$(1)/preinst
|
||||
( \
|
||||
echo "#!/bin/sh"; \
|
||||
echo 'export PKG_UPGRADE=1'; \
|
||||
[ ! -f $$(ADIR_$(1))/preinst ] || sed '/^\s*#!/d' "$$(ADIR_$(1))/preinst"; \
|
||||
[ ! -f $$(ADIR_$(1))/preinst ] || sed -z 's/^\s*#!/#!/' "$$(ADIR_$(1))/preinst"; \
|
||||
) > $$(ADIR_$(1))/pre-upgrade;
|
||||
endif
|
||||
|
||||
( \
|
||||
echo "#!/bin/sh"; \
|
||||
echo 'export PKG_UPGRADE=1'; \
|
||||
[ ! -f $$(ADIR_$(1))/post-install ] || sed '/^\s*#!/d' "$$(ADIR_$(1))/post-install"; \
|
||||
[ ! -f $$(ADIR_$(1))/post-install ] || sed -z 's/^\s*#!/#!/' "$$(ADIR_$(1))/post-install"; \
|
||||
) > $$(ADIR_$(1))/post-upgrade;
|
||||
|
||||
( \
|
||||
@@ -551,34 +344,34 @@ else
|
||||
echo "[ -s "\$$$${IPKG_INSTROOT}/lib/functions.sh" ] || exit 0"; \
|
||||
echo ". \$$$${IPKG_INSTROOT}/lib/functions.sh"; \
|
||||
echo 'export root="$$$${IPKG_INSTROOT}"'; \
|
||||
echo 'export pkgname="$(1)$$(ABIV_$(1))"'; \
|
||||
echo 'export pkgname="$(1)"'; \
|
||||
echo "default_prerm"; \
|
||||
[ ! -f $$(ADIR_$(1))/prerm-pkg ] || sed '/^\s*#!/d' "$$(ADIR_$(1))/prerm-pkg"; \
|
||||
[ ! -f $$(ADIR_$(1))/prerm-pkg ] || sed -z 's/^\s*#!/#!/' "$$(ADIR_$(1))/prerm-pkg"; \
|
||||
) > $$(ADIR_$(1))/pre-deinstall;
|
||||
|
||||
[ ! -f $$(ADIR_$(1))/postrm ] || sed -zi 's/^\s*#!/#!/' "$$(ADIR_$(1))/postrm";
|
||||
|
||||
if [ -n "$(USERID)" ]; then echo $(USERID) > $$(IDIR_$(1))/lib/apk/packages/$(1)$$(ABIV_$(1)).rusers; fi;
|
||||
if [ -n "$(ALTERNATIVES)" ]; then echo $(ALTERNATIVES) > $$(IDIR_$(1))/lib/apk/packages/$(1)$$(ABIV_$(1)).alternatives; fi;
|
||||
(cd $$(IDIR_$(1)) && find . -type f,l -printf "/%P\n" | sort > $(TMP_DIR)/$(1).list && mv $(TMP_DIR)/$(1).list $$(IDIR_$(1))/lib/apk/packages/$(1)$$(ABIV_$(1)).list)
|
||||
if [ -n "$(USERID)" ]; then echo $(USERID) > $$(IDIR_$(1))/lib/apk/packages/$(1).rusers; fi;
|
||||
if [ -n "$(ALTERNATIVES)" ]; then echo $(ALTERNATIVES) > $$(IDIR_$(1))/lib/apk/packages/$(1).alternatives; fi;
|
||||
(cd $$(IDIR_$(1)) && find . -type f,l -printf "/%P\n" | sort > $$(IDIR_$(1))/lib/apk/packages/$(1).list)
|
||||
# Move conffiles to IDIR and build conffiles_static with csums
|
||||
if [ -f $$(ADIR_$(1))/conffiles ]; then \
|
||||
mv -f $$(ADIR_$(1))/conffiles $$(IDIR_$(1))/lib/apk/packages/$(1)$$(ABIV_$(1)).conffiles; \
|
||||
for file in $$$$(cat $$(IDIR_$(1))/lib/apk/packages/$(1)$$(ABIV_$(1)).conffiles); do \
|
||||
mv -f $$(ADIR_$(1))/conffiles $$(IDIR_$(1))/lib/apk/packages/$(1).conffiles; \
|
||||
for file in $$$$(cat $$(IDIR_$(1))/lib/apk/packages/$(1).conffiles); do \
|
||||
[ -f $$(IDIR_$(1))/$$$$file ] || continue; \
|
||||
csum=$$$$($(MKHASH) sha256 $$(IDIR_$(1))/$$$$file); \
|
||||
echo $$$$file $$$$csum >> $$(IDIR_$(1))/lib/apk/packages/$(1)$$(ABIV_$(1)).conffiles_static; \
|
||||
echo $$$$file $$$$csum >> $$(IDIR_$(1))/lib/apk/packages/$(1).conffiles_static; \
|
||||
done; \
|
||||
fi
|
||||
|
||||
# Some package (base-files) manually append stuff to conffiles
|
||||
# Append stuff from it and delete the CONTROL directory since everything else should be migrated
|
||||
if [ -f $$(IDIR_$(1))/CONTROL/conffiles ]; then \
|
||||
echo $$$$(IDIR_$(1))/CONTROL/conffiles >> $$(IDIR_$(1))/lib/apk/packages/$(1)$$(ABIV_$(1)).conffiles; \
|
||||
echo $$$$(IDIR_$(1))/CONTROL/conffiles >> $$(IDIR_$(1))/lib/apk/packages/$(1).conffiles; \
|
||||
for file in $$$$(cat $$(IDIR_$(1))/CONTROL/conffiles); do \
|
||||
[ -f $$(IDIR_$(1))/$$$$file ] || continue; \
|
||||
csum=$$$$($(MKHASH) sha256 $$(IDIR_$(1))/$$$$file); \
|
||||
echo $$$$file $$$$csum >> $$(IDIR_$(1))/lib/apk/packages/$(1)$$(ABIV_$(1)).conffiles_static; \
|
||||
echo $$$$file $$$$csum >> $$(IDIR_$(1))/lib/apk/packages/$(1).conffiles_static; \
|
||||
done; \
|
||||
rm -rf $$(IDIR_$(1))/CONTROL/conffiles; \
|
||||
fi
|
||||
@@ -600,12 +393,22 @@ else
|
||||
--info "origin:$(SOURCE)" \
|
||||
--info "url:$(URL)" \
|
||||
--info "maintainer:$(MAINTAINER)" \
|
||||
$$(if $$(Package/$(1)/PROVIDES),--info "provides:$$(Package/$(1)/PROVIDES)") \
|
||||
$$(if $$(Package/$(1)/PRIORITY),--info "provider-priority:$$(Package/$(1)/PRIORITY)") \
|
||||
--info "provides:$$(foreach prov,\
|
||||
$$(filter-out $(1)$$(ABIV_$(1)), \
|
||||
$(PROVIDES)$$(if $$(ABIV_$(1)), \
|
||||
$(1)=$(VERSION) $(foreach provide, \
|
||||
$(PROVIDES), \
|
||||
$(provide)$$(ABIV_$(1))=$(VERSION) \
|
||||
) \
|
||||
) \
|
||||
), \
|
||||
$$(prov) )" \
|
||||
$(if $(DEFAULT_VARIANT),--info "provider-priority:100",$(if $(PROVIDES),--info "provider-priority:1")) \
|
||||
$$(APK_SCRIPTS_$(1)) \
|
||||
--info "depends:$$(foreach depends,$$(subst $$(comma),$$(space),$$(subst $$(space),,$$(subst $$(paren_right),,$$(subst $$(paren_left),,$$(Package/$(1)/DEPENDS))))),$$(depends))" \
|
||||
--files "$$(IDIR_$(1))" \
|
||||
--output "$$(PACK_$(1))"
|
||||
--output "$$(PACK_$(1))" \
|
||||
--sign "$(BUILD_KEY_APK_SEC)"
|
||||
endif
|
||||
|
||||
@[ -f $$(PACK_$(1)) ]
|
||||
|
||||
@@ -134,35 +134,6 @@ endef
|
||||
|
||||
PKG_INSTALL_STAMP:=$(PKG_INFO_DIR)/$(PKG_DIR_NAME).$(if $(BUILD_VARIANT),$(BUILD_VARIANT),default).install
|
||||
|
||||
# Normalize package SOURCE entry to pack reproducible package
|
||||
# If we are packing a package with OpenWrt buildroot:
|
||||
# - Replace package/... with feeds/base/...
|
||||
# If we are packing a package with SDK:
|
||||
# - Replace feeds/.*_root/... with feeds/.*/... and remove
|
||||
# the intermediate directory to reflect what the symbolic link
|
||||
# points to.
|
||||
# Example:
|
||||
# Feed link: feeds/base_root/package -> feeds/base
|
||||
# Package: feeds/base_root/package/system/uci -> feeds/base/system/uci
|
||||
ifeq ($(DUMP),)
|
||||
__pkg_base_path:=$(patsubst $(TOPDIR)/%,%,$(CURDIR))
|
||||
__pkg_provider_path:=$(word 1,$(subst /, ,$(__pkg_base_path)))
|
||||
ifeq ($(__pkg_provider_path), feeds)
|
||||
__pkg_feed_path:=$(word 2,$(subst /, ,$(__pkg_base_path)))
|
||||
__pkg_feed_name:=$(patsubst %_root,%,$(__pkg_feed_path))
|
||||
ifneq (__pkg_feed_path, __pkg_feed_name)
|
||||
__pkg_feed_realpath:=$(realpath $(TOPDIR)/feeds/$(__pkg_feed_name))
|
||||
__pkg_feed_dir:=$(patsubst $(TOPDIR)/feeds/$(__pkg_feed_path)/%,%,$(__pkg_feed_realpath))
|
||||
__pkg_path:=$(patsubst feeds/$(__pkg_feed_path)/$(__pkg_feed_dir)/%,%,$(__pkg_base_path))
|
||||
else
|
||||
__pkg_path:=$(patsubst feeds/$(__pkg_feed_path)/%,%,$(__pkg_base_path))
|
||||
endif
|
||||
__pkg_source_makefile:=$(TOPDIR)/feeds/$(__pkg_feed_name)/$(__pkg_path)
|
||||
else ifeq ($(__pkg_provider_path), package)
|
||||
__pkg_source_makefile:=$(TOPDIR)/feeds/base/$(patsubst package/%,%,$(__pkg_base_path))
|
||||
endif
|
||||
endif
|
||||
|
||||
include $(INCLUDE_DIR)/package-defaults.mk
|
||||
include $(INCLUDE_DIR)/package-dumpinfo.mk
|
||||
include $(INCLUDE_DIR)/package-pack.mk
|
||||
@@ -332,13 +303,6 @@ define BuildPackage
|
||||
$(eval $(Package/Default))
|
||||
$(eval $(Package/$(1)))
|
||||
|
||||
# Add an implicit self-provide. apk can't handle self provides, be it
|
||||
# versioned or virtual, so opt for a suffix instead. This allows several
|
||||
# variants to provide the same virtual package without adding extra provides
|
||||
# to the default one, e.g. wget implicitly provides wget-any and is marked as
|
||||
# default, so wget-ssl can explicitly provide @wget-any as well.
|
||||
$(eval PROVIDES:=$(strip @$(1)-any $(PROVIDES)))
|
||||
|
||||
ifdef DESCRIPTION
|
||||
$$(error DESCRIPTION:= is obsolete, use Package/PKG_NAME/description)
|
||||
endif
|
||||
|
||||
@@ -9,11 +9,11 @@ SHELL:=sh
|
||||
PKG_NAME:=Build dependency
|
||||
|
||||
$(eval $(call TestHostCommand,true, \
|
||||
Please install 'coreutils', \
|
||||
Please install GNU 'coreutils', \
|
||||
$(TRUE)))
|
||||
|
||||
$(eval $(call TestHostCommand,false, \
|
||||
Please install 'coreutils', \
|
||||
Please install GNU 'coreutils', \
|
||||
$(FALSE); [ $$$$$$$$? = 1 ] && $(TRUE)))
|
||||
|
||||
# Required for the toolchain
|
||||
@@ -178,16 +178,15 @@ $(eval $(call SetupHostCommand,bzip2,Please install 'bzip2', \
|
||||
$(eval $(call SetupHostCommand,wget,Please install GNU 'wget', \
|
||||
wget --version | grep GNU))
|
||||
|
||||
$(eval $(call SetupHostCommand,install,Please install 'install', \
|
||||
$(eval $(call SetupHostCommand,install,Please install GNU 'install', \
|
||||
$(TOPDIR)/staging_dir/host/bin/ginstall --version | grep GNU, \
|
||||
install --version | grep 'GNU\|uutils', \
|
||||
install --version | grep GNU, \
|
||||
ginstall --version | grep GNU))
|
||||
|
||||
$(eval $(call SetupHostCommand,perl,Please install Perl 5.x, \
|
||||
perl --version | grep "perl.*v5"))
|
||||
|
||||
$(eval $(call SetupHostCommand,python,Please install Python >= 3.7, \
|
||||
python3.13 -V 2>&1 | grep 'Python 3', \
|
||||
python3.12 -V 2>&1 | grep 'Python 3', \
|
||||
python3.11 -V 2>&1 | grep 'Python 3', \
|
||||
python3.10 -V 2>&1 | grep 'Python 3', \
|
||||
@@ -197,7 +196,6 @@ $(eval $(call SetupHostCommand,python,Please install Python >= 3.7, \
|
||||
python3 -V 2>&1 | grep -E 'Python 3\.([7-9]|[0-9][0-9])\.?'))
|
||||
|
||||
$(eval $(call SetupHostCommand,python3,Please install Python >= 3.7, \
|
||||
python3.13 -V 2>&1 | grep 'Python 3', \
|
||||
python3.12 -V 2>&1 | grep 'Python 3', \
|
||||
python3.11 -V 2>&1 | grep 'Python 3', \
|
||||
python3.10 -V 2>&1 | grep 'Python 3', \
|
||||
@@ -239,7 +237,7 @@ endif
|
||||
|
||||
$(STAGING_DIR_HOST)/bin/mkhash: $(SCRIPT_DIR)/mkhash.c
|
||||
mkdir -p $(dir $@)
|
||||
$(STAGING_DIR_HOST)/bin/gcc -O2 -I$(TOPDIR)/tools/include -o $@ $<
|
||||
$(CC) -O2 -I$(TOPDIR)/tools/include -o $@ $<
|
||||
|
||||
$(STAGING_DIR_HOST)/bin/xxd: $(SCRIPT_DIR)/xxdi.pl
|
||||
$(LN) $< $@
|
||||
|
||||
@@ -71,7 +71,7 @@ endef
|
||||
# 4: optional link library test (example -lncurses)
|
||||
define RequireCHeader
|
||||
define Require/$(1)
|
||||
echo 'int main(int argc, char **argv) { $(3); return 0; }' | $(STAGING_DIR_HOST)/bin/gcc -include $(1) -x c -o $(TMP_DIR)/a.out - $(4)
|
||||
echo 'int main(int argc, char **argv) { $(3); return 0; }' | gcc -include $(1) -x c -o $(TMP_DIR)/a.out - $(4)
|
||||
endef
|
||||
|
||||
$$(eval $$(call Require,$(1),$(2)))
|
||||
|
||||
@@ -103,7 +103,6 @@ define Kernel/Patch/Default
|
||||
$(call PatchDir,$(LINUX_DIR),$(GENERIC_PATCH_DIR),generic/)
|
||||
$(call PatchDir,$(LINUX_DIR),$(GENERIC_HACK_DIR),generic-hack/)
|
||||
$(call PatchDir,$(LINUX_DIR),$(PATCH_DIR),platform/)
|
||||
$(if $(QUILT),touch $(LINUX_DIR)/.quilt_used)
|
||||
endef
|
||||
|
||||
define Quilt/RefreshDir
|
||||
|
||||
@@ -78,7 +78,6 @@ define prepare_rootfs
|
||||
cd $(1); \
|
||||
if [ -n "$(CONFIG_USE_APK)" ]; then \
|
||||
IPKG_POSTINST_PATH=./lib/apk/db/*.post-install; \
|
||||
$(STAGING_DIR_HOST)/bin/gzip -d ./lib/apk/db/scripts.tar; \
|
||||
$(STAGING_DIR_HOST)/bin/tar -C ./lib/apk/db/ -xf ./lib/apk/db/scripts.tar --wildcards "*.post-install"; \
|
||||
else \
|
||||
IPKG_POSTINST_PATH=./usr/lib/opkg/info/*.postinst; \
|
||||
@@ -92,7 +91,6 @@ define prepare_rootfs
|
||||
fi; \
|
||||
[ -n "$(CONFIG_USE_APK)" ] && $(STAGING_DIR_HOST)/bin/tar --delete -f ./lib/apk/db/scripts.tar $$(basename $$script); \
|
||||
done; \
|
||||
[ -n "$(CONFIG_USE_APK)" ] && $(STAGING_DIR_HOST)/bin/gzip -f -9n -S ".gz" ./lib/apk/db/scripts.tar; \
|
||||
if [ -z "$(CONFIG_USE_APK)" ]; then \
|
||||
$(if $(IB),,awk -i inplace \
|
||||
'/^Status:/ { \
|
||||
|
||||
@@ -105,6 +105,13 @@ DEFAULT_PACKAGES += $(DEFAULT_PACKAGES.$(DEVICE_TYPE))
|
||||
##
|
||||
filter_packages = $(filter-out -% $(patsubst -%,%,$(filter -%,$(1))),$(1))
|
||||
|
||||
##@
|
||||
# @brief Append extra package dependencies.
|
||||
#
|
||||
# @param 1: Package list.
|
||||
##
|
||||
extra_packages = $(if $(filter wpad wpad-% nas,$(1)),iwinfo)
|
||||
|
||||
define ProfileDefault
|
||||
NAME:=
|
||||
PRIORITY:=
|
||||
@@ -121,7 +128,7 @@ define Profile
|
||||
echo "Target-Profile: $(1)"; \
|
||||
$(if $(PRIORITY), echo "Target-Profile-Priority: $(PRIORITY)"; ) \
|
||||
echo "Target-Profile-Name: $(NAME)"; \
|
||||
echo "Target-Profile-Packages: $(PACKAGES)"; \
|
||||
echo "Target-Profile-Packages: $(PACKAGES) $(call extra_packages,$(DEFAULT_PACKAGES) $(PACKAGES))"; \
|
||||
echo "Target-Profile-Description:"; \
|
||||
echo "$$$$$$$$$(call shvar,Profile/$(1)/Description)"; \
|
||||
echo "@@"; \
|
||||
@@ -379,7 +386,7 @@ define BuildTargets/DumpCurrent
|
||||
echo "$$$$DESCRIPTION"; \
|
||||
echo '@@'; \
|
||||
$(if $(DEFAULT_PROFILE),echo 'Target-Default-Profile: $(DEFAULT_PROFILE)';) \
|
||||
echo 'Default-Packages: $(DEFAULT_PACKAGES)'; \
|
||||
echo 'Default-Packages: $(DEFAULT_PACKAGES) $(call extra_packages,$(DEFAULT_PACKAGES))'; \
|
||||
$(DUMPINFO)
|
||||
$(if $(CUR_SUBTARGET),$(SUBMAKE) -r --no-print-directory -C image -s DUMP=1 SUBTARGET=$(CUR_SUBTARGET))
|
||||
$(if $(SUBTARGET),,@$(foreach SUBTARGET,$(SUBTARGETS),$(SUBMAKE) --no-print-directory -s DUMP=1 SUBTARGET=$(SUBTARGET); ))
|
||||
|
||||
@@ -78,7 +78,7 @@ _ignore = $(foreach p,$(IGNORE_PACKAGES),--ignore $(p))
|
||||
prepare-tmpinfo: FORCE
|
||||
@+$(MAKE) -r -s $(STAGING_DIR_HOST)/.prereq-build $(PREP_MK)
|
||||
mkdir -p tmp/info feeds
|
||||
[ -e $(TOPDIR)/feeds/base ] || ln -sf ../package $(TOPDIR)/feeds/base
|
||||
[ -e $(TOPDIR)/feeds/base ] || ln -sf $(TOPDIR)/package $(TOPDIR)/feeds/base
|
||||
$(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f include/scan.mk SCAN_TARGET="packageinfo" SCAN_DIR="package" SCAN_NAME="package" SCAN_DEPTH=5 SCAN_EXTRA=""
|
||||
$(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f include/scan.mk SCAN_TARGET="targetinfo" SCAN_DIR="target/linux" SCAN_NAME="target" SCAN_DEPTH=3 SCAN_EXTRA="" SCAN_MAKEOPTS="TARGET_BUILD=1"
|
||||
for type in package target; do \
|
||||
@@ -201,7 +201,7 @@ else
|
||||
DOWNLOAD_DIRS = package/download
|
||||
endif
|
||||
|
||||
download: .config FORCE $(if $(wildcard $(STAGING_DIR_HOST)/bin/flock),,tools/flock/compile) $(if $(wildcard $(STAGING_DIR_HOST)/bin/zstd),,tools/zstd/compile)
|
||||
download: .config FORCE $(if $(wildcard $(STAGING_DIR_HOST)/bin/flock),,tools/flock/compile)
|
||||
@+$(foreach dir,$(DOWNLOAD_DIRS),$(SUBMAKE) $(dir);)
|
||||
|
||||
clean dirclean: .config
|
||||
|
||||
@@ -27,13 +27,13 @@ PKG_CONFIG_DEPENDS += \
|
||||
sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1))))
|
||||
|
||||
VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER))
|
||||
VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),25.12.0-rc5)
|
||||
VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),SNAPSHOT)
|
||||
|
||||
VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE))
|
||||
VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r32673-482ba7230a)
|
||||
VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION))
|
||||
|
||||
VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO))
|
||||
VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/25.12.0-rc5)
|
||||
VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/snapshots)
|
||||
|
||||
VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST))
|
||||
VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt)
|
||||
|
||||
@@ -70,8 +70,7 @@ ifneq ($(CONFIG_USE_APK),)
|
||||
(cd $(PACKAGE_DIR_ALL) && $(STAGING_DIR_HOST)/bin/apk mkndx \
|
||||
--root $(TOPDIR) \
|
||||
--keys-dir $(TOPDIR) \
|
||||
--allow-untrusted \
|
||||
$(if $(CONFIG_SIGNED_PACKAGES),--sign $(BUILD_KEY_APK_SEC),) \
|
||||
--sign $(BUILD_KEY_APK_SEC) \
|
||||
--output packages.adb \
|
||||
*.apk; \
|
||||
)
|
||||
@@ -101,7 +100,6 @@ ifneq ($(CONFIG_USE_APK),)
|
||||
$(foreach pkg,$(shell cat $(PACKAGE_INSTALL_FILES) 2>/dev/null),$(pkg)$(call GetABISuffix,$(pkg))))
|
||||
$(call apk,$(TARGET_DIR)) add --no-cache --initdb --no-scripts --arch $(ARCH_PACKAGES) \
|
||||
--repositories-file /dev/null --repository file://$(PACKAGE_DIR_ALL)/packages.adb \
|
||||
$(if $(CONFIG_SIGNED_PACKAGES),,--allow-untrusted) \
|
||||
$$(cat $(TMP_DIR)/apk_install_list) \
|
||||
"base-files=$(shell cat $(TMP_DIR)/base-files.version)" \
|
||||
"libc=$(shell cat $(TMP_DIR)/libc.version)" \
|
||||
@@ -129,15 +127,13 @@ $(curdir)/index: FORCE
|
||||
@echo Generating package index...
|
||||
ifneq ($(CONFIG_USE_APK),)
|
||||
@for d in $(PACKAGE_SUBDIRS); do \
|
||||
set -e; \
|
||||
mkdir -p $$d; \
|
||||
cd $$d || continue; \
|
||||
ls *.apk >/dev/null 2>&1 || continue; \
|
||||
$(STAGING_DIR_HOST)/bin/apk mkndx \
|
||||
--root $(TOPDIR) \
|
||||
--keys-dir $(TOPDIR) \
|
||||
--allow-untrusted \
|
||||
$(if $(CONFIG_SIGNED_PACKAGES),--sign $(BUILD_KEY_APK_SEC),) \
|
||||
--sign $(BUILD_KEY_APK_SEC) \
|
||||
--output packages.adb \
|
||||
*.apk; \
|
||||
$(STAGING_DIR_HOST)/bin/apk adbdump --format json packages.adb | \
|
||||
@@ -173,7 +169,6 @@ ifdef CONFIG_JSON_CYCLONEDX_SBOM
|
||||
); done
|
||||
endif
|
||||
endif
|
||||
$(call sha256sums,$(OUTPUT_DIR)/packages/$(ARCH_PACKAGES),1)
|
||||
|
||||
$(curdir)/flags-install:= -j1
|
||||
|
||||
|
||||
@@ -1,22 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
REAL_CFG=$1
|
||||
CFG=$1
|
||||
|
||||
[ -n "$REAL_CFG" ] || REAL_CFG=/etc/board.json
|
||||
[ -n "$CFG" ] || CFG=/etc/board.json
|
||||
|
||||
if [ -d "/etc/board.d/" ] && [ ! -s "$REAL_CFG" ]; then
|
||||
# Use temp file to prevent incomplete file on power-cut, CFG is used by the sourced script to read/write the file
|
||||
CFG="$(dirname "$REAL_CFG")/.$(basename "$REAL_CFG").tmp"
|
||||
rm -f "$CFG" || exit
|
||||
[ -d "/etc/board.d/" -a ! -s "$CFG" ] && {
|
||||
for a in $(ls /etc/board.d/*); do
|
||||
[ -s "$a" ] || continue
|
||||
(. "$a")
|
||||
[ -s $a ] || continue;
|
||||
$(. $a)
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
if [ -s "$CFG" ]; then
|
||||
mv "$CFG" "$REAL_CFG" || exit
|
||||
else
|
||||
rm -f "$CFG"
|
||||
exit 1
|
||||
fi
|
||||
[ -s "$CFG" ] || return 1
|
||||
|
||||
@@ -44,15 +44,14 @@ generate_static_network() {
|
||||
set network.loopback.device='lo'
|
||||
set network.loopback.proto='static'
|
||||
add_list network.loopback.ipaddr='127.0.0.1/8'
|
||||
delete network.globals
|
||||
set network.globals='globals'
|
||||
set network.globals.dhcp_default_duid='auto'
|
||||
EOF
|
||||
[ -e /proc/sys/net/ipv6 ] && {
|
||||
uci -q batch <<-EOF
|
||||
set network.globals.ula_prefix='auto'
|
||||
EOF
|
||||
}
|
||||
[ -e /proc/sys/net/ipv6 ] && {
|
||||
uci -q batch <<-EOF
|
||||
delete network.globals
|
||||
set network.globals='globals'
|
||||
set network.globals.ula_prefix='auto'
|
||||
EOF
|
||||
}
|
||||
|
||||
if json_is_a dsl object; then
|
||||
json_select dsl
|
||||
|
||||
@@ -10,13 +10,10 @@ uci_apply_defaults() {
|
||||
cd /etc/uci-defaults || return 0
|
||||
files="$(ls)"
|
||||
[ -z "$files" ] && return 0
|
||||
applied=""
|
||||
for file in $files; do
|
||||
( . "./$(basename $file)" ) && applied="$applied $file"
|
||||
( . "./$(basename $file)" ) && rm -f "$file"
|
||||
done
|
||||
uci commit
|
||||
sync
|
||||
rm -f $applied
|
||||
}
|
||||
|
||||
boot() {
|
||||
|
||||
@@ -1,39 +1,61 @@
|
||||
unset FAILSAFE
|
||||
[ -e /tmp/.failsafe ] && export FAILSAFE=1
|
||||
|
||||
[ -f /etc/banner ] && cat /etc/banner
|
||||
[ -n "$FAILSAFE" ] && [ -f /etc/banner.failsafe ] && cat /etc/banner.failsafe
|
||||
[ -n "$FAILSAFE" ] && cat /etc/banner.failsafe
|
||||
|
||||
if grep -Fsq '/ overlay ro,' /proc/mounts ; then
|
||||
cat << EOF
|
||||
|
||||
=== WARNING! ======================================
|
||||
Your JFFS2-partition seems full and overlayfs is
|
||||
mounted as READ-ONLY!
|
||||
Please try to remove files from /overlay/upper/...
|
||||
and reboot!
|
||||
---------------------------------------------------
|
||||
|
||||
EOF
|
||||
fi
|
||||
grep -Fsq '/ overlay ro,' /proc/mounts && {
|
||||
echo 'Your JFFS2-partition seems full and overlayfs is mounted read-only.'
|
||||
echo 'Please try to remove files from /overlay/upper/... and reboot!'
|
||||
}
|
||||
|
||||
export PATH="%PATH%"
|
||||
HOME=$(grep -E "^${USER:-root}:" /etc/passwd | cut -d ":" -f 6)
|
||||
HOME=${HOME:-/root}
|
||||
export HOME
|
||||
export HOME=$(grep -e "^${USER:-root}:" /etc/passwd | cut -d ":" -f 6)
|
||||
export HOME=${HOME:-/root}
|
||||
export PS1='\u@\h:\w\$ '
|
||||
export ENV=/etc/shinit
|
||||
|
||||
case "$TERM" in
|
||||
xterm*|rxvt*)
|
||||
export PS1='\[\e]0;\u@\h: \w\a\]'"$PS1"
|
||||
;;
|
||||
export PS1='\[\e]0;\u@\h: \w\a\]'$PS1
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "$FAILSAFE" ] ; then
|
||||
for FILE in /etc/profile.d/*.sh ; do
|
||||
[ -f "${FILE%.sh}.hush" ] && continue
|
||||
[ -f "$FILE" ] && . "$FILE"
|
||||
[ -n "$FAILSAFE" ] || {
|
||||
for FILE in /etc/profile.d/*.sh; do
|
||||
[ -e "$FILE" ] && . "$FILE"
|
||||
done
|
||||
unset FILE
|
||||
}
|
||||
|
||||
if ( grep -qs '^root::' /etc/shadow && \
|
||||
[ -z "$FAILSAFE" ] )
|
||||
then
|
||||
cat << EOF
|
||||
=== WARNING! =====================================
|
||||
There is no root password defined on this device!
|
||||
Use the "passwd" command to set up a new password
|
||||
in order to prevent unauthorized SSH logins.
|
||||
--------------------------------------------------
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [ -x /usr/bin/apk ]; then
|
||||
cat << EOF
|
||||
|
||||
OpenWrt recently switched to the "apk" package manager!
|
||||
|
||||
OPKG Command APK Equivalent Description
|
||||
------------------------------------------------------------------
|
||||
opkg install <pkg> apk add <pkg> Install a package
|
||||
opkg remove <pkg> apk del <pkg> Remove a package
|
||||
opkg upgrade apk upgrade Upgrade all packages
|
||||
opkg files <pkg> apk info -L <pkg> List package contents
|
||||
opkg list-installed apk info List installed packages
|
||||
opkg update apk update Update package lists
|
||||
opkg search <pkg> apk search <pkg> Search for packages
|
||||
------------------------------------------------------------------
|
||||
|
||||
For more https://openwrt.org/docs/guide-user/additional-software/opkg-to-apk-cheatsheet
|
||||
|
||||
EOF
|
||||
fi
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
if grep -Esq '^root::' /etc/shadow ; then
|
||||
cat << EOF
|
||||
|
||||
=== WARNING! =====================================
|
||||
There is no root password defined on this device!
|
||||
Use the "passwd" command to set up a new password
|
||||
in order to prevent unauthorized SSH logins.
|
||||
--------------------------------------------------
|
||||
|
||||
EOF
|
||||
fi
|
||||
@@ -1,21 +0,0 @@
|
||||
if [ -x /usr/bin/apk ] ; then
|
||||
cat << EOF
|
||||
|
||||
OpenWrt recently switched to the "apk" package manager!
|
||||
|
||||
OPKG Command APK Equivalent Description
|
||||
------------------------------------------------------------------
|
||||
opkg install <pkg> apk add <pkg> Install a package
|
||||
opkg remove <pkg> apk del <pkg> Remove a package
|
||||
opkg upgrade apk upgrade Upgrade all packages
|
||||
opkg files <pkg> apk info -L <pkg> List package contents
|
||||
opkg list-installed apk info List installed packages
|
||||
opkg update apk update Update package lists
|
||||
opkg search <pkg> apk search <pkg> Search for packages
|
||||
------------------------------------------------------------------
|
||||
|
||||
For more information visit:
|
||||
https://openwrt.org/docs/guide-user/additional-software/opkg-to-apk-cheatsheet
|
||||
|
||||
EOF
|
||||
fi
|
||||
@@ -1,9 +0,0 @@
|
||||
[ "$(uci -q get network.globals.dhcp_default_duid || echo "auto")" != "auto" ] && exit 0
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
# DUID-UUID - RFC6355
|
||||
set network.globals.dhcp_default_duid="$(printf '%s%s' '0004' $(cat /proc/sys/kernel/random/uuid | sed -e 's/-//g'))"
|
||||
commit network
|
||||
EOF
|
||||
|
||||
exit 0
|
||||
@@ -1,6 +0,0 @@
|
||||
zonename="$(uci -q get system.@system[0].zonename)"
|
||||
case "$zonename" in
|
||||
*[[:space:]]*) uci set system.@system[0].zonename="${zonename// /_}" ;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
@@ -382,7 +382,7 @@ default_postinst() {
|
||||
uci commit
|
||||
fi
|
||||
|
||||
rm -f /tmp/luci-indexcache.*
|
||||
rm -f /tmp/luci-indexcache
|
||||
fi
|
||||
|
||||
if [ -f "$root/usr/lib/opkg/info/${pkgname}.postinst-pkg" ]; then
|
||||
|
||||
@@ -24,17 +24,6 @@ __network_ifstatus() {
|
||||
eval "$__tmp"
|
||||
}
|
||||
|
||||
# determine the IAID of the given logical interface
|
||||
# 1: destination variable
|
||||
# 2: interface
|
||||
network_generate_iface_iaid() {
|
||||
local __iaid
|
||||
|
||||
__iaid=$(printf '%s' "$2" | md5sum | cut -c 1-8)
|
||||
|
||||
export "$1=$__iaid"
|
||||
}
|
||||
|
||||
# determine first IPv4 address of given logical interface
|
||||
# 1: destination variable
|
||||
# 2: interface
|
||||
|
||||
@@ -771,27 +771,6 @@ ucidef_add_wlan() {
|
||||
ucidef_wlan_idx="$((ucidef_wlan_idx + 1))"
|
||||
}
|
||||
|
||||
ucidef_set_interface_netdev_range() {
|
||||
local interface="$1"
|
||||
local base_netdev="$2"
|
||||
local start="$3"
|
||||
local stop="$4"
|
||||
local netdevs
|
||||
local i
|
||||
|
||||
if [ "$stop" -ge "$start" ]; then
|
||||
i="$start"
|
||||
netdevs="$base_netdev$i"
|
||||
|
||||
while [ "$i" -lt "$stop" ]; do
|
||||
i=$((i + 1))
|
||||
netdevs="$netdevs $base_netdev$i"
|
||||
done
|
||||
|
||||
ucidef_set_interface "$interface" device "$netdevs"
|
||||
fi
|
||||
}
|
||||
|
||||
board_config_update() {
|
||||
json_init
|
||||
[ -f ${CFG} ] && json_load "$(cat ${CFG})"
|
||||
|
||||
@@ -5,14 +5,6 @@
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
config EXTRA_IMAGE_NAME
|
||||
string
|
||||
prompt "Extra image filename" if IMAGEOPT
|
||||
default ""
|
||||
help
|
||||
Add this to the output image filenames, to distinguish between
|
||||
different builds for the same hardware type.
|
||||
|
||||
config TARGET_DEFAULT_LAN_IP_FROM_PREINIT
|
||||
bool "Use preinit IP configuration as default LAN IP" if IMAGEOPT
|
||||
default n
|
||||
@@ -198,7 +190,7 @@ if VERSIONOPT
|
||||
config VERSION_REPO
|
||||
string
|
||||
prompt "Release repository"
|
||||
default "https://downloads.openwrt.org/releases/25.12.0-rc5"
|
||||
default "https://downloads.openwrt.org/snapshots"
|
||||
help
|
||||
This is the repository address embedded in the image, it defaults
|
||||
to the trunk snapshot repo; the url may contain the following placeholders:
|
||||
@@ -280,7 +272,7 @@ if VERSIONOPT
|
||||
config VERSION_CODE_FILENAMES
|
||||
bool
|
||||
prompt "Revision code in filenames"
|
||||
default n
|
||||
default y
|
||||
help
|
||||
Enable this to include the revision identifier or the configured
|
||||
version code into the firmware image, SDK- and Image Builder archive
|
||||
|
||||
@@ -29,8 +29,6 @@ define Trusted-Firmware-A/Default
|
||||
HIDDEN:=y
|
||||
BOOT_DEVICE:=
|
||||
DDR3_FLYBY:=
|
||||
DDR3_FREQ_1866:=
|
||||
DDR4_4BG_MODE:=
|
||||
DDR_TYPE:=
|
||||
NAND_TYPE:=
|
||||
BOARD_QFN:=
|
||||
@@ -39,7 +37,6 @@ define Trusted-Firmware-A/Default
|
||||
USE_UBI:=
|
||||
FIP_OFFSET:=
|
||||
FIP_SIZE:=
|
||||
SPIM_CTRL:=
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7622-nor-1ddr
|
||||
@@ -140,14 +137,6 @@ define Trusted-Firmware-A/mt7622-sdmmc-2ddr
|
||||
DDR3_FLYBY:=1
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7981-nor-ddr4
|
||||
NAME:=MediaTek MT7981 (SPI-NOR, DDR4)
|
||||
BOOT_DEVICE:=nor
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7981
|
||||
DDR_TYPE:=ddr4
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7981-ram-ddr4
|
||||
NAME:=MediaTek MT7981 (RAM, DDR4)
|
||||
BOOT_DEVICE:=ram
|
||||
@@ -167,14 +156,6 @@ define Trusted-Firmware-A/mt7981-emmc-ddr4
|
||||
DDR_TYPE:=ddr4
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7981-sdmmc-ddr4
|
||||
NAME:=MediaTek MT7981 (SD card, DDR4)
|
||||
BOOT_DEVICE:=sdmmc
|
||||
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
|
||||
@@ -197,12 +178,19 @@ define Trusted-Firmware-A/mt7981-ram-ddr3
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7981
|
||||
DDR_TYPE:=ddr3
|
||||
DDR3_FREQ_1866:=1
|
||||
RAM_BOOT_UART_DL:=1
|
||||
HIDDEN:=
|
||||
DEFAULT:=TARGET_mediatek_filogic
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7981-nor-ddr4
|
||||
NAME:=MediaTek MT7981 (SPI-NOR, DDR4)
|
||||
BOOT_DEVICE:=nor
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7981
|
||||
DDR_TYPE:=ddr4
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7981-emmc-ddr3
|
||||
NAME:=MediaTek MT7981 (eMMC, DDR3)
|
||||
BOOT_DEVICE:=emmc
|
||||
@@ -211,15 +199,6 @@ define Trusted-Firmware-A/mt7981-emmc-ddr3
|
||||
DDR_TYPE:=ddr3
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7981-emmc-ddr3-1866mhz
|
||||
NAME:=MediaTek MT7981 (eMMC, DDR3 1866 MHz)
|
||||
BOOT_DEVICE:=emmc
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7981
|
||||
DDR_TYPE:=ddr3
|
||||
DDR3_FREQ_1866:=1
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7981-sdmmc-ddr3
|
||||
NAME:=MediaTek MT7981 (SD card, DDR3)
|
||||
BOOT_DEVICE:=sdmmc
|
||||
@@ -244,26 +223,8 @@ define Trusted-Firmware-A/mt7981-spim-nand-ddr3
|
||||
DDR_TYPE:=ddr3
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7981-spim-nand-ddr3-1866mhz
|
||||
NAME:=MediaTek MT7981 (SPI-NAND via SPIM, DDR3 1866 MHz)
|
||||
BOOT_DEVICE:=spim-nand
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7981
|
||||
DDR_TYPE:=ddr3
|
||||
DDR3_FREQ_1866:=1
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7981-spim-nand-ubi-ddr4
|
||||
NAME:=MediaTek MT7981 (SPI-NAND via SPIM, DDR4)
|
||||
BOOT_DEVICE:=spim-nand
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7981
|
||||
DDR_TYPE:=ddr4
|
||||
USE_UBI:=1
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7981-cudy-ddr3
|
||||
NAME:=Cudy (SPI-NAND via SPIM, DDR3)
|
||||
define Trusted-Firmware-A/mt7981-cudy-tr3000-v1
|
||||
NAME:=Cudy TR3000 v1 (SPI-NAND via SPIM, DDR3)
|
||||
BOOT_DEVICE:=spim-nand
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7981
|
||||
@@ -283,6 +244,15 @@ define Trusted-Firmware-A/mt7986-ram-ddr4
|
||||
DEFAULT:=TARGET_mediatek_filogic
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7981-spim-nand-ubi-ddr4
|
||||
NAME:=MediaTek MT7981 (SPI-NAND via SPIM, DDR4)
|
||||
BOOT_DEVICE:=spim-nand
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7981
|
||||
DDR_TYPE:=ddr4
|
||||
USE_UBI:=1
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7986-nor-ddr4
|
||||
NAME:=MediaTek MT7986 (SPI-NOR, DDR4)
|
||||
BOOT_DEVICE:=nor
|
||||
@@ -403,79 +373,6 @@ define Trusted-Firmware-A/mt7986-spim-nand-ubi-ddr3
|
||||
USE_UBI:=1
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7987-emmc-comb
|
||||
NAME:=MediaTek MT7987 (eMMC)
|
||||
BOOT_DEVICE:=emmc
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7987
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7987-emmc-ddr4-4bg
|
||||
NAME:=MediaTek MT7987 (eMMC, DDR4 4GB)
|
||||
BOOT_DEVICE:=emmc
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7987
|
||||
DDR4_4BG_MODE:=1
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7987-nor-comb
|
||||
NAME:=MediaTek MT7987 (NOR)
|
||||
BOOT_DEVICE:=nor
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7987
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7987-sdmmc-comb
|
||||
NAME:=MediaTek MT7987 (SD card)
|
||||
BOOT_DEVICE:=sdmmc
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7987
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7987-sdmmc-ddr4-4bg
|
||||
NAME:=MediaTek MT7987 (SD card, DDR4 4GB)
|
||||
BOOT_DEVICE:=sdmmc
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7987
|
||||
DDR4_4BG_MODE:=1
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7987-spim-nand0
|
||||
NAME:=MediaTek MT7987 (SPI-NAND via SPIM)
|
||||
BOOT_DEVICE:=spim-nand
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7987
|
||||
SPIM_CTRL:=0
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7987-spim-nand0-ubi-comb
|
||||
NAME:=MediaTek MT7987 (SPI-NAND via SPIM, UBI)
|
||||
BOOT_DEVICE:=spim-nand
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7987
|
||||
USE_UBI:=1
|
||||
SPIM_CTRL:=0
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7987-spim-nand2-ubi-comb
|
||||
NAME:=MediaTek MT7987 (SPI-NAND via SPIM, UBI)
|
||||
BOOT_DEVICE:=spim-nand
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7987
|
||||
USE_UBI:=1
|
||||
SPIM_CTRL:=2
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7987-ram-comb
|
||||
NAME:=MediaTek MT7987 (RAM)
|
||||
BOOT_DEVICE:=ram
|
||||
BUILD_SUBTARGET:=filogic
|
||||
PLAT:=mt7987
|
||||
RAM_BOOT_UART_DL:=1
|
||||
HIDDEN:=
|
||||
DEFAULT:=TARGET_mediatek_filogic
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/mt7988-nor-ddr3
|
||||
NAME:=MediaTek MT7988 (SPI-NOR, DDR3)
|
||||
BOOT_DEVICE:=nor
|
||||
@@ -660,19 +557,16 @@ TFA_TARGETS:= \
|
||||
mt7622-sdmmc-2ddr \
|
||||
mt7981-ram-ddr3 \
|
||||
mt7981-emmc-ddr3 \
|
||||
mt7981-emmc-ddr3-1866mhz \
|
||||
mt7981-nor-ddr3 \
|
||||
mt7981-nor-ddr4 \
|
||||
mt7981-sdmmc-ddr3 \
|
||||
mt7981-snand-ddr3 \
|
||||
mt7981-spim-nand-ddr3 \
|
||||
mt7981-spim-nand-ddr3-1866mhz \
|
||||
mt7981-spim-nand-ubi-ddr4 \
|
||||
mt7981-ram-ddr4 \
|
||||
mt7981-emmc-ddr4 \
|
||||
mt7981-sdmmc-ddr4 \
|
||||
mt7981-spim-nand-ddr4 \
|
||||
mt7981-cudy-ddr3 \
|
||||
mt7981-cudy-tr3000-v1 \
|
||||
mt7986-ram-ddr3 \
|
||||
mt7986-emmc-ddr3 \
|
||||
mt7986-nor-ddr3 \
|
||||
@@ -688,15 +582,6 @@ TFA_TARGETS:= \
|
||||
mt7986-spim-nand-ddr4 \
|
||||
mt7986-spim-nand-ubi-ddr4 \
|
||||
mt7986-spim-nand-4k-ddr4 \
|
||||
mt7987-emmc-comb \
|
||||
mt7987-emmc-ddr4-4bg \
|
||||
mt7987-nor-comb \
|
||||
mt7987-sdmmc-comb \
|
||||
mt7987-sdmmc-ddr4-4bg \
|
||||
mt7987-spim-nand0 \
|
||||
mt7987-spim-nand0-ubi-comb \
|
||||
mt7987-spim-nand2-ubi-comb \
|
||||
mt7987-ram-comb \
|
||||
mt7988-emmc-ddr3 \
|
||||
mt7988-nor-ddr3 \
|
||||
mt7988-sdmmc-ddr3 \
|
||||
@@ -726,8 +611,6 @@ TFA_MAKE_FLAGS += \
|
||||
$(if $(NAND_TYPE),NAND_TYPE=$(NAND_TYPE)) \
|
||||
HAVE_DRAM_OBJ_FILE=yes \
|
||||
$(if $(DDR3_FLYBY),DDR3_FLYBY=1) \
|
||||
$(if $(DDR3_FREQ_1866),DDR3_FREQ_1866=1) \
|
||||
$(if $(DDR4_4BG_MODE),DDR4_4BG_MODE=1) \
|
||||
$(if $(DRAM_USE_COMB),DRAM_USE_COMB=1) \
|
||||
$(if $(RAM_BOOT_UART_DL),RAM_BOOT_UART_DL=1) \
|
||||
$(if $(USE_UBI),UBI=1 $(if $(findstring mt7622,$(PLAT)),OVERRIDE_UBI_START_ADDR=0x80000)) \
|
||||
@@ -735,7 +618,6 @@ TFA_MAKE_FLAGS += \
|
||||
$(if $(USE_UBI),UBI=1 $(if $(findstring mt7986,$(PLAT)),OVERRIDE_UBI_START_ADDR=0x200000)) \
|
||||
$(if $(FIP_OFFSET),OVERRIDE_FIP_BASE=$(FIP_OFFSET)) \
|
||||
$(if $(FIP_SIZE),OVERRIDE_FIP_SIZE=$(FIP_SIZE)) \
|
||||
$(if $(SPIM_CTRL),SPIM_CTRL=$(SPIM_CTRL)) \
|
||||
$(if $(RAM_BOOT_UART_DL),bl2,all)
|
||||
|
||||
define Package/trusted-firmware-a-ram/install
|
||||
@@ -748,7 +630,6 @@ Package/trusted-firmware-a-mt7981-ram-ddr3/install = $(Package/trusted-firmware-
|
||||
Package/trusted-firmware-a-mt7981-ram-ddr4/install = $(Package/trusted-firmware-a-ram/install)
|
||||
Package/trusted-firmware-a-mt7986-ram-ddr3/install = $(Package/trusted-firmware-a-ram/install)
|
||||
Package/trusted-firmware-a-mt7986-ram-ddr4/install = $(Package/trusted-firmware-a-ram/install)
|
||||
Package/trusted-firmware-a-mt7987-ram-comb/install = $(Package/trusted-firmware-a-ram/install)
|
||||
Package/trusted-firmware-a-mt7988-ram-comb/install = $(Package/trusted-firmware-a-ram/install)
|
||||
Package/trusted-firmware-a-mt7988-ram-ddr4/install = $(Package/trusted-firmware-a-ram/install)
|
||||
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
From fd057aba83aea8458986e11c81dbb75a69468b84 Mon Sep 17 00:00:00 2001
|
||||
From: Mikhail Zhilkin <csharper2005@gmail.com>
|
||||
Date: Wed, 13 Aug 2025 22:46:54 +0300
|
||||
Subject: arm-trusted-firmware-mediatek: add FudanMicro manufacturer
|
||||
|
||||
Add FudanMicro manufacturer.
|
||||
|
||||
Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
|
||||
---
|
||||
|
||||
--- a/plat/mediatek/apsoc_common/drivers/spi_nand/mtk_spi_nand.c
|
||||
+++ b/plat/mediatek/apsoc_common/drivers/spi_nand/mtk_spi_nand.c
|
||||
@@ -21,6 +21,7 @@
|
||||
#define SPI_NAND_MAX_ID_LEN 4U
|
||||
#define DELAY_US_400MS 400000U
|
||||
#define ETRON_ID 0xD5U
|
||||
+#define FUDAN_ID 0xA1U
|
||||
#define GIGADEVICE_ID 0xC8U
|
||||
#define MACRONIX_ID 0xC2U
|
||||
#define MICRON_ID 0x2CU
|
||||
@@ -146,7 +147,8 @@ static int spi_nand_quad_enable(uint8_t
|
||||
if (manufacturer_id != MACRONIX_ID &&
|
||||
manufacturer_id != GIGADEVICE_ID &&
|
||||
manufacturer_id != ETRON_ID &&
|
||||
- manufacturer_id != FORESEE_ID) {
|
||||
+ manufacturer_id != FORESEE_ID &&
|
||||
+ manufacturer_id != FUDAN_ID) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -543,6 +545,10 @@ static int spi_nand_check_pp(struct para
|
||||
INFO("PP COPY %d CRC read: 0x%x, compute: 0x%x\n",
|
||||
i, crc, crc_compute);
|
||||
|
||||
+ // FUDAN integrity CRC (bytes 254-255) is reversed
|
||||
+ if (crc != crc_compute)
|
||||
+ crc = htobe16(pp->integrity_crc);
|
||||
+
|
||||
if (crc != crc_compute) {
|
||||
ret = -EBADMSG;
|
||||
continue;
|
||||
@@ -1,128 +0,0 @@
|
||||
From e2e43103c00b5f7ccedbdbdece0f622cb420b4a5 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Fri, 3 Oct 2025 12:53:10 +0100
|
||||
Subject: [PATCH] mt7987: make SPI controller configurable
|
||||
|
||||
Allow selecting the SPI controller used for SPIM-NAND or SPI-NOR boot
|
||||
devices (either SPI0 or SPI2).
|
||||
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
---
|
||||
plat/mediatek/apsoc_common/Config.in | 1 +
|
||||
plat/mediatek/mt7987/Config.in | 29 +++++++++++++++++++++
|
||||
plat/mediatek/mt7987/bl2/bl2.mk | 12 +++++++++
|
||||
plat/mediatek/mt7987/bl2/bl2_dev_spi_nand.c | 10 ++++++-
|
||||
plat/mediatek/mt7987/platform.mk | 4 +--
|
||||
5 files changed, 53 insertions(+), 3 deletions(-)
|
||||
create mode 100644 plat/mediatek/mt7987/Config.in
|
||||
|
||||
--- a/plat/mediatek/apsoc_common/Config.in
|
||||
+++ b/plat/mediatek/apsoc_common/Config.in
|
||||
@@ -783,6 +783,7 @@ config ENABLE_BL31_RUNTIME_LOG
|
||||
default 1
|
||||
depends on _ENABLE_BL31_RUNTIME_LOG
|
||||
|
||||
+source "plat/mediatek/mt7987/Config.in"
|
||||
source "plat/mediatek/mt7988/Config.in"
|
||||
|
||||
endmenu # Platform configurations
|
||||
--- /dev/null
|
||||
+++ b/plat/mediatek/mt7987/Config.in
|
||||
@@ -0,0 +1,29 @@
|
||||
+# SPDX-License-Identifier: BSD-3-Clause
|
||||
+#
|
||||
+# Copyright (c) 2025 Daniel Golle <daniel@makrotopia.org>
|
||||
+#
|
||||
+# MT7987 platform-specific configurations
|
||||
+#
|
||||
+
|
||||
+if _PLAT_MT7987
|
||||
+
|
||||
+choice
|
||||
+ prompt "SPI controller"
|
||||
+ depends on (_BOOT_DEVICE_SPIM_NAND || _BOOT_DEVICE_SPI_NOR)
|
||||
+ default _SPIM_CTRL_0 if _BOOT_DEVICE_SPIM_NAND
|
||||
+ default _SPIM_CTRL_2 if _BOOT_DEVICE_SPI_NOR
|
||||
+
|
||||
+ config _SPIM_CTRL_0
|
||||
+ bool "0"
|
||||
+
|
||||
+ config _SPIM_CTRL_2
|
||||
+ bool "2"
|
||||
+
|
||||
+endchoice
|
||||
+
|
||||
+config SPIM_CTRL
|
||||
+ int
|
||||
+ default 0 if _SPIM_CTRL_0
|
||||
+ default 2 if _SPIM_CTRL_2
|
||||
+
|
||||
+endif # _PLAT_MT7987
|
||||
--- a/plat/mediatek/mt7987/bl2/bl2.mk
|
||||
+++ b/plat/mediatek/mt7987/bl2/bl2.mk
|
||||
@@ -91,7 +91,11 @@ endif # END OF BOOT_DEVICE = ram
|
||||
ifeq ($(BOOT_DEVICE),nor)
|
||||
$(eval $(call BL2_BOOT_NOR))
|
||||
BL2_SOURCES += $(MTK_PLAT_SOC)/bl2/bl2_dev_spi_nor.c
|
||||
+ifeq ($(SPIM_CTRL),0)
|
||||
+DTS_NAME := mt7987-spi0
|
||||
+else
|
||||
DTS_NAME := mt7987-spi2
|
||||
+endif
|
||||
endif # END OF BOOTDEVICE = nor
|
||||
|
||||
ifeq ($(BOOT_DEVICE),emmc)
|
||||
@@ -112,10 +116,18 @@ ifeq ($(BOOT_DEVICE),spim-nand)
|
||||
$(eval $(call BL2_BOOT_SPI_NAND,0,0))
|
||||
BL2_SOURCES += $(MTK_PLAT_SOC)/bl2/bl2_dev_spi_nand.c
|
||||
NAND_TYPE ?= spim:2k+64
|
||||
+ifeq ($(SPIM_CTRL),2)
|
||||
+DTS_NAME := mt7987-spi2
|
||||
+else
|
||||
DTS_NAME := mt7987-spi0
|
||||
+endif
|
||||
$(eval $(call BL2_BOOT_NAND_TYPE_CHECK,$(NAND_TYPE),spim:2k+64 spim:2k+128 spim:4k+256))
|
||||
endif # END OF BOOTDEVICE = spim-nand
|
||||
|
||||
+ifneq ($(SPIM_CTRL),)
|
||||
+BL2_CPPFLAGS += -DSPIM_CTRL=$(SPIM_CTRL)
|
||||
+endif
|
||||
+
|
||||
ifeq ($(BROM_HEADER_TYPE),)
|
||||
$(error BOOT_DEVICE has invalid value. Please re-check.)
|
||||
endif
|
||||
--- a/plat/mediatek/mt7987/bl2/bl2_dev_spi_nand.c
|
||||
+++ b/plat/mediatek/mt7987/bl2/bl2_dev_spi_nand.c
|
||||
@@ -12,10 +12,18 @@
|
||||
|
||||
#define MTK_QSPI_SRC_CLK CB_MPLL_D2
|
||||
|
||||
+#if SPIM_CTRL == 0
|
||||
+#define SELECTED_SPIM SPIM0
|
||||
+#elif SPIM_CTRL == 2
|
||||
+#define SELECTED_SPIM SPIM2
|
||||
+#else
|
||||
+#error "Invalid SPI controller selection"
|
||||
+#endif
|
||||
+
|
||||
uint32_t mtk_plat_get_qspi_src_clk(void)
|
||||
{
|
||||
/* config GPIO pinmux to spi mode */
|
||||
- mtk_spi_gpio_init(SPIM0);
|
||||
+ mtk_spi_gpio_init(SELECTED_SPIM);
|
||||
|
||||
/* select 208M clk */
|
||||
mtk_spi_source_clock_select(MTK_QSPI_SRC_CLK);
|
||||
--- a/plat/mediatek/mt7987/platform.mk
|
||||
+++ b/plat/mediatek/mt7987/platform.mk
|
||||
@@ -56,8 +56,8 @@ include make_helpers/dep.mk
|
||||
|
||||
$(call GEN_DEP_RULES,bl2,emicfg bl2_boot_ram bl2_boot_nand_nmbm bl2_dev_mmc bl2_plat_init bl2_plat_setup mt7987_gpio dtb)
|
||||
$(call MAKE_DEP,bl2,emicfg,DDR4_4BG_MODE DRAM_DEBUG_LOG DDR3_FREQ_2133 DDR3_FREQ_1866 DDR4_FREQ_3200 DDR4_FREQ_2666)
|
||||
-$(call MAKE_DEP,bl2,bl2_plat_init,BL2_COMPRESS)
|
||||
-$(call MAKE_DEP,bl2,bl2_plat_setup,BOOT_DEVICE TRUSTED_BOARD_BOOT BL32_TZRAM_BASE BL32_TZRAM_SIZE BL32_LOAD_OFFSET)
|
||||
+$(call MAKE_DEP,bl2,bl2_plat_init,BL2_COMPRESS SPIM_CTRL)
|
||||
+$(call MAKE_DEP,bl2,bl2_plat_setup,BOOT_DEVICE TRUSTED_BOARD_BOOT BL32_TZRAM_BASE BL32_TZRAM_SIZE BL32_LOAD_OFFSET SPIM_CTRL)
|
||||
$(call MAKE_DEP,bl2,bl2_dev_mmc,BOOT_DEVICE)
|
||||
$(call MAKE_DEP,bl2,bl2_boot_ram,RAM_BOOT_DEBUGGER_HOOK RAM_BOOT_UART_DL)
|
||||
$(call MAKE_DEP,bl2,bl2_boot_nand_nmbm,NMBM_MAX_RATIO NMBM_MAX_RESERVED_BLOCKS NMBM_DEFAULT_LOG_LEVEL)
|
||||
@@ -1,24 +0,0 @@
|
||||
From 0a09912eb336bee788443b919ea5b99b195f5a91 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Sat, 4 Oct 2025 22:13:49 +0100
|
||||
Subject: [PATCH] hack: mt7987: mmc: use 4-bit bus-width for eMMC
|
||||
|
||||
The BananaPi R4 Lite has broken DAT5 signal of the MMC bus, which
|
||||
results in 8-bit buswidth not working well for the eMMC.
|
||||
Reduce to 4-bit buswidth fixes it (and makes all other boards with
|
||||
eMMC a tiny bit slower to boot, but it's in the milliseconds).
|
||||
---
|
||||
plat/mediatek/mt7987/bl2/bl2_dev_mmc.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/plat/mediatek/mt7987/bl2/bl2_dev_mmc.c
|
||||
+++ b/plat/mediatek/mt7987/bl2/bl2_dev_mmc.c
|
||||
@@ -74,7 +74,7 @@ static const struct mt7987_msdc_conf {
|
||||
{
|
||||
.base = MSDC0_BASE,
|
||||
.top_base = MSDC0_TOP_BASE,
|
||||
- .bus_width = MMC_BUS_WIDTH_8,
|
||||
+ .bus_width = MMC_BUS_WIDTH_4,
|
||||
.type = MMC_IS_EMMC,
|
||||
.src_clk = 200000000,
|
||||
.dev_comp = &mt7987_msdc_compat,
|
||||
@@ -1,27 +0,0 @@
|
||||
From 6725bb3c2aa9330f37a591e1e539badf67021b47 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Sat, 4 Oct 2025 23:59:54 +0100
|
||||
Subject: [PATCH] hack: mt7987: bl2: move FIP offset to 0x100000
|
||||
|
||||
There is no use in allocating more than 2MB to the factory partition.
|
||||
After all, even for WiFi 7 tri-band devices the calibration data is
|
||||
still in the kilobytes range.
|
||||
Move FIP offset to 0x100000 to not waste so much space on small NOR
|
||||
flash.
|
||||
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
---
|
||||
plat/mediatek/mt7987/bl2/bl2_dev_spi_nor.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/plat/mediatek/mt7987/bl2/bl2_dev_spi_nor.c
|
||||
+++ b/plat/mediatek/mt7987/bl2/bl2_dev_spi_nor.c
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <stdint.h>
|
||||
#include <boot_spi.h>
|
||||
|
||||
-#define FIP_BASE 0x250000
|
||||
+#define FIP_BASE 0x100000
|
||||
#define FIP_SIZE 0x80000
|
||||
|
||||
#define MTK_QSPI_SRC_CLK CB_MPLL_D2
|
||||
@@ -1,78 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=arm-trusted-firmware-microchipsw
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=https://github.com/microchip-ung/arm-trusted-firmware.git
|
||||
PKG_SOURCE_DATE:=2026-01-07
|
||||
PKG_SOURCE_VERSION:=7696c9aaaae7c677f4c373a61a1289cba7f824aa
|
||||
PKG_MIRROR_HASH:=331548d7c73896bd5e4438c0ec9c71bbe58d3bf9a29350496ad94c382e922b9c
|
||||
|
||||
PKG_BUILD_DEPENDS:=ruby/host
|
||||
PKG_MAINTAINER:=Robert Marko <robert.marko@sartura.hr>
|
||||
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
include $(INCLUDE_DIR)/trusted-firmware-a.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Trusted-Firmware-A/Default
|
||||
BUILD_TARGET:=microchipsw
|
||||
TFA_IMAGE:=fip.bin fwu_fip.bin fwu.html
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/ev23x71a
|
||||
NAME:=Microchip EV23X71A
|
||||
BUILD_SUBTARGET:=lan969x
|
||||
BUILD_DEVICES:=microchip_ev23x71a
|
||||
PLAT:=lan969x_a0
|
||||
DEPENDS:=+u-boot-ev23x71a
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/tactical-1000
|
||||
NAME:=Novarq Tactical 1000
|
||||
BUILD_SUBTARGET:=lan969x
|
||||
BUILD_DEVICES:=novarq_tactical-1000
|
||||
PLAT:=novarq_tactical_1000_v3
|
||||
DEPENDS:=+u-boot-tactical-1000
|
||||
endef
|
||||
|
||||
TFA_TARGETS:= \
|
||||
ev23x71a \
|
||||
tactical-1000
|
||||
|
||||
MBEDTLS_NAME:=mbedtls
|
||||
MBEDTLS_RELEASE:=2.28.10
|
||||
MBEDTLS_SOURCE:=$(MBEDTLS_NAME)-$(MBEDTLS_RELEASE).tar.zst
|
||||
|
||||
define Download/mbedtls
|
||||
FILE:=$(MBEDTLS_SOURCE)
|
||||
PROTO:=git
|
||||
URL:=https://github.com/Mbed-TLS/mbedtls.git
|
||||
SOURCE_VERSION:=2fc8413bfcb51354c8e679141b17b3f1a5942561
|
||||
MIRROR_HASH:=40b94a76572ad1ca89738929ab81d6024f678f22691eb3bd633c076ac18a334a
|
||||
SUBDIR:=$(MBEDTLS_NAME)
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
# Download mbedtls
|
||||
$(eval $(call Download,mbedtls))
|
||||
|
||||
$(call Build/Prepare/Default,)
|
||||
|
||||
$(TAR) -C $(PKG_BUILD_DIR) -xf $(DL_DIR)/$(MBEDTLS_SOURCE)
|
||||
endef
|
||||
|
||||
TFA_MAKE_FLAGS += \
|
||||
MBEDTLS_DIR=$(PKG_BUILD_DIR)/$(MBEDTLS_NAME) \
|
||||
BL33=$(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-u-boot.bin \
|
||||
KEY_ALG=ecdsa GENERATE_COT=1 TRUSTED_BOARD_BOOT=1 \
|
||||
all fip fwu_fip
|
||||
|
||||
define Package/trusted-firmware-a/install
|
||||
$(INSTALL_DIR) $(STAGING_DIR_IMAGE)
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/build/$(PLAT)/release/fip.bin $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-fip.bin
|
||||
$(CP) $(patsubst %,$(PKG_BUILD_DIR)/build/$(PLAT)/release/%,$(TFA_IMAGE)) $(1)/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage/Trusted-Firmware-A))
|
||||
@@ -1,171 +0,0 @@
|
||||
From 190202583edb9dcab5ca49638169d08a332f0fdf Mon Sep 17 00:00:00 2001
|
||||
From: Robert Marko <robert.marko@sartura.hr>
|
||||
Date: Sun, 2 Nov 2025 16:57:45 +0100
|
||||
Subject: [PATCH] microchip: lan969x: add Novarq Tactical 1000 v3
|
||||
|
||||
Add support for Novarq Tactical 1000 v3 board as a separate platform since
|
||||
it uses 2GB of RAM and requires a different RAM configuration.
|
||||
|
||||
Signed-off-by: Robert Marko <robert.marko@sartura.hr>
|
||||
---
|
||||
.../fdts/lan969x-tactical-1000-v3-ddr.dtsi | 90 +++++++++++++++++++
|
||||
.../novarq_tactical_1000_v3_tb_fw_config.dts | 30 +++++++
|
||||
.../novarq_tactical_1000_v3/platform.mk | 12 +++
|
||||
scripts/fwu/fwu.js | 2 +-
|
||||
4 files changed, 133 insertions(+), 1 deletion(-)
|
||||
create mode 100644 plat/microchip/lan969x/fdts/lan969x-tactical-1000-v3-ddr.dtsi
|
||||
create mode 100644 plat/microchip/lan969x/novarq_tactical_1000_v3/fdts/novarq_tactical_1000_v3_tb_fw_config.dts
|
||||
create mode 100644 plat/microchip/lan969x/novarq_tactical_1000_v3/platform.mk
|
||||
|
||||
--- /dev/null
|
||||
+++ b/plat/microchip/lan969x/fdts/lan969x-tactical-1000-v3-ddr.dtsi
|
||||
@@ -0,0 +1,90 @@
|
||||
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
|
||||
+/*
|
||||
+ * Copyright (C) 2022 Microchip Technology Inc. and its subsidiaries.
|
||||
+ *
|
||||
+ */
|
||||
+
|
||||
+&ddr {
|
||||
+ microchip,mem-name = "lan969x_tactical_1000_2gb 2025-11-02-13:03:23 7391dfb-dirty";
|
||||
+ microchip,mem-speed = <2400>;
|
||||
+ microchip,mem-size = <0x80000000>;
|
||||
+ microchip,mem-bus-width = <16>;
|
||||
+
|
||||
+ microchip,main-reg = <
|
||||
+ 0x00001091 /* crcparctl1 */
|
||||
+ 0x00000001 /* dbictl */
|
||||
+ 0x00000040 /* dfimisc */
|
||||
+ 0x0391820f /* dfitmg0 */
|
||||
+ 0x00040201 /* dfitmg1 */
|
||||
+ 0x40400003 /* dfiupd0 */
|
||||
+ 0x004000ff /* dfiupd1 */
|
||||
+ 0x003f7f40 /* ecccfg0 */
|
||||
+ 0x00020248 /* init0 */
|
||||
+ 0x00e80000 /* init1 */
|
||||
+ 0x0c340101 /* init3 */
|
||||
+ 0x10180200 /* init4 */
|
||||
+ 0x00110000 /* init5 */
|
||||
+ 0x00000402 /* init6 */
|
||||
+ 0x00000c19 /* init7 */
|
||||
+ 0x81040010 /* mstr */
|
||||
+ 0x00000000 /* pccfg */
|
||||
+ 0x00000000 /* pwrctl */
|
||||
+ 0x00210020 /* rfshctl0 */
|
||||
+ 0x00000000 /* rfshctl3 */
|
||||
+ >;
|
||||
+
|
||||
+ microchip,timing-reg = <
|
||||
+ 0x17131413 /* dramtmg0 */
|
||||
+ 0x0007051b /* dramtmg1 */
|
||||
+ 0x1a000010 /* dramtmg12 */
|
||||
+ 0x090b0512 /* dramtmg2 */
|
||||
+ 0x0000400c /* dramtmg3 */
|
||||
+ 0x08040409 /* dramtmg4 */
|
||||
+ 0x07070404 /* dramtmg5 */
|
||||
+ 0x07060c0b /* dramtmg8 */
|
||||
+ 0x0003040d /* dramtmg9 */
|
||||
+ 0x07000610 /* odtcfg */
|
||||
+ 0x0049014b /* rfshtmg */
|
||||
+ >;
|
||||
+
|
||||
+ microchip,mapping-reg = <
|
||||
+ 0x0000001f /* addrmap0 */
|
||||
+ 0x003f0909 /* addrmap1 */
|
||||
+ 0x00000700 /* addrmap2 */
|
||||
+ 0x00000000 /* addrmap3 */
|
||||
+ 0x00001f1f /* addrmap4 */
|
||||
+ 0x07070707 /* addrmap5 */
|
||||
+ 0x07070707 /* addrmap6 */
|
||||
+ 0x00000f07 /* addrmap7 */
|
||||
+ 0x00003f01 /* addrmap8 */
|
||||
+ >;
|
||||
+
|
||||
+ microchip,phy-reg = <
|
||||
+ 0x0000040c /* dcr */
|
||||
+ 0x0064401b /* dsgcr */
|
||||
+ 0x8000b0cf /* dtcr0 */
|
||||
+ 0x00010a37 /* dtcr1 */
|
||||
+ 0x00c01884 /* dxccr */
|
||||
+ 0x000010ba /* pgcr2 */
|
||||
+ 0x00000000 /* schcr1 */
|
||||
+ 0x00079900 /* zq0pr */
|
||||
+ 0x10077900 /* zq1pr */
|
||||
+ 0x00000000 /* zq2pr */
|
||||
+ 0x00058f00 /* zqcr */
|
||||
+ >;
|
||||
+
|
||||
+ microchip,phy_timing-reg = <
|
||||
+ 0x0827100a /* dtpr0 */
|
||||
+ 0x28250018 /* dtpr1 */
|
||||
+ 0x000702a1 /* dtpr2 */
|
||||
+ 0x03000101 /* dtpr3 */
|
||||
+ 0x02950808 /* dtpr4 */
|
||||
+ 0x00361009 /* dtpr5 */
|
||||
+ 0x4ae25710 /* ptr0 */
|
||||
+ 0x74f4950e /* ptr1 */
|
||||
+ 0x00083def /* ptr2 */
|
||||
+ 0x2a192000 /* ptr3 */
|
||||
+ 0x1003a000 /* ptr4 */
|
||||
+ >;
|
||||
+
|
||||
+};
|
||||
--- /dev/null
|
||||
+++ b/plat/microchip/lan969x/novarq_tactical_1000_v3/fdts/novarq_tactical_1000_v3_tb_fw_config.dts
|
||||
@@ -0,0 +1,30 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2022, Microchip Technology Inc. and its subsidiaries.
|
||||
+ *
|
||||
+ * SPDX-License-Identifier: BSD-3-Clause
|
||||
+ */
|
||||
+
|
||||
+/dts-v1/;
|
||||
+
|
||||
+#include "lan969x.dtsi"
|
||||
+#include "lan969x-tactical-1000-v3-ddr.dtsi"
|
||||
+
|
||||
+&emmc_clk {
|
||||
+ clock-frequency = <100000000>;
|
||||
+};
|
||||
+
|
||||
+&sdmmc0 {
|
||||
+ status = "okay";
|
||||
+ bus-width = <8>;
|
||||
+};
|
||||
+
|
||||
+&qspi0 {
|
||||
+ status = "okay";
|
||||
+ spi-flash@0 {
|
||||
+ compatible = "jedec,spi-nor";
|
||||
+ reg = <0>;
|
||||
+ spi-max-frequency = <100000000>;
|
||||
+ spi-tx-bus-width = <4>;
|
||||
+ spi-rx-bus-width = <4>;
|
||||
+ };
|
||||
+};
|
||||
--- /dev/null
|
||||
+++ b/plat/microchip/lan969x/novarq_tactical_1000_v3/platform.mk
|
||||
@@ -0,0 +1,12 @@
|
||||
+#
|
||||
+# Copyright (c) 2021, Microchip Technology Inc. and its subsidiaries.
|
||||
+#
|
||||
+# SPDX-License-Identifier: BSD-3-Clause
|
||||
+#
|
||||
+
|
||||
+include plat/microchip/lan969x/common/common.mk
|
||||
+
|
||||
+# This is used in lan969x code
|
||||
+$(eval $(call add_define,LAN969X_ASIC))
|
||||
+# This is used in common drivers
|
||||
+$(eval $(call add_define,LAN966X_ASIC))
|
||||
--- a/scripts/fwu/fwu.js
|
||||
+++ b/scripts/fwu/fwu.js
|
||||
@@ -91,7 +91,7 @@ const platforms = [
|
||||
"ddr_diag": ddr_diag_regs_lan969x,
|
||||
"ddr_regs": ddr_regs_lan969x,
|
||||
"ddr_speed": lan969x_speeds,
|
||||
- "bl2u_compat": ["lan969x_a0", "lan969x_svb"],
|
||||
+ "bl2u_compat": ["lan969x_a0", "lan969x_svb", "novarq_tactical_1000_v3"],
|
||||
},
|
||||
];
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
From 40166fd8d88f33c621d3cca0b936f31816f3fe2e Mon Sep 17 00:00:00 2001
|
||||
From: Robert Marko <robert.marko@sartura.hr>
|
||||
Date: Mon, 12 Jan 2026 14:40:23 +0100
|
||||
Subject: [PATCH] cert_create: add LibreSSL 3.9+ compatibility
|
||||
|
||||
LibreSSL 3.9+ has dropped the whole support for X509V3 extensions.
|
||||
|
||||
Generated by Gemini 3 Pro.
|
||||
|
||||
Signed-off-by: Robert Marko <robert.marko@sartura.hr>
|
||||
---
|
||||
tools/cert_create/src/ext.c | 26 ++++++++++++++++++++++----
|
||||
1 file changed, 22 insertions(+), 4 deletions(-)
|
||||
|
||||
--- a/tools/cert_create/src/ext.c
|
||||
+++ b/tools/cert_create/src/ext.c
|
||||
@@ -51,15 +51,18 @@ int ext_init(void)
|
||||
{
|
||||
cmd_opt_t cmd_opt;
|
||||
ext_t *ext;
|
||||
+#if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x40200000L
|
||||
X509V3_EXT_METHOD *m;
|
||||
- int nid, ret;
|
||||
+ int ret, nid;
|
||||
+#endif
|
||||
unsigned int i;
|
||||
|
||||
extensions = malloc((num_def_extensions * sizeof(def_extensions[0]))
|
||||
#ifdef PDEF_EXTS
|
||||
+ (num_pdef_extensions * sizeof(pdef_extensions[0]))
|
||||
#endif
|
||||
- );
|
||||
+ );
|
||||
+
|
||||
if (extensions == NULL) {
|
||||
ERROR("%s:%d Failed to allocate memory.\n", __func__, __LINE__);
|
||||
return 1;
|
||||
@@ -69,7 +72,7 @@ int ext_init(void)
|
||||
(num_def_extensions * sizeof(def_extensions[0])));
|
||||
#ifdef PDEF_EXTS
|
||||
memcpy(&extensions[num_def_extensions], &pdef_extensions[0],
|
||||
- (num_pdef_extensions * sizeof(pdef_extensions[0])));
|
||||
+ (num_pdef_extensions * sizeof(pdef_extensions[0])));
|
||||
num_extensions = num_def_extensions + num_pdef_extensions;
|
||||
#else
|
||||
num_extensions = num_def_extensions;
|
||||
@@ -86,11 +89,15 @@ int ext_init(void)
|
||||
cmd_opt.help_msg = ext->help_msg;
|
||||
cmd_opt_add(&cmd_opt);
|
||||
}
|
||||
+
|
||||
/* Register the extension OID in OpenSSL */
|
||||
if (ext->oid == NULL) {
|
||||
continue;
|
||||
}
|
||||
+
|
||||
+#if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x40200000L
|
||||
nid = OBJ_create(ext->oid, ext->sn, ext->ln);
|
||||
+
|
||||
if (ext->alias) {
|
||||
X509V3_EXT_add_alias(nid, ext->alias);
|
||||
} else {
|
||||
@@ -117,7 +124,16 @@ int ext_init(void)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
+#else
|
||||
+ /*
|
||||
+ * LibreSSL 4.2.0+ removed X509V3_EXT_add/alias.
|
||||
+ * We still register the OID, but ignore the returned NID
|
||||
+ * as we skip method registration.
|
||||
+ */
|
||||
+ OBJ_create(ext->oid, ext->sn, ext->ln);
|
||||
+#endif
|
||||
}
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -323,12 +339,14 @@ void ext_cleanup(void)
|
||||
for (i = 0; i < num_extensions; i++) {
|
||||
if (extensions[i].arg != NULL) {
|
||||
void *ptr = (void *)extensions[i].arg;
|
||||
-
|
||||
extensions[i].arg = NULL;
|
||||
free(ptr);
|
||||
}
|
||||
}
|
||||
free(extensions);
|
||||
+
|
||||
+#if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x40200000L
|
||||
X509V3_EXT_cleanup();
|
||||
+#endif
|
||||
}
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
From 11ff8b5e67830d5a09f39e8c1f000b0ddcf8e88f Mon Sep 17 00:00:00 2001
|
||||
From: Robert Marko <robert.marko@sartura.hr>
|
||||
Date: Mon, 12 Jan 2026 15:16:07 +0100
|
||||
Subject: [PATCH] cert_create: pass pthread in LDFLAGS
|
||||
|
||||
OpenWrt-s LibreSSL is linked against pthread, so we have to make sure to
|
||||
pass -lpthread in LDFLAGS to avoid:
|
||||
/usr/bin/ld: /openwrt/staging_dir/host/lib/libcrypto.a(libcrypto_la-crypto_init.o): in function `OPENSSL_init_crypto':
|
||||
crypto_init.c:(.text+0x67): undefined reference to `pthread_once'
|
||||
/usr/bin/ld: /openwrt/staging_dir/host/lib/libcrypto.a(libcrypto_la-err.o): in function `ERR_load_ERR_strings':
|
||||
err.c:(.text+0x812): undefined reference to `pthread_once'
|
||||
/usr/bin/ld: /openwrt/staging_dir/host/lib/libcrypto.a(libcrypto_la-conf_sap.o): in function `OpenSSL_config':
|
||||
conf_sap.c:(.text+0xc0): undefined reference to `pthread_once'
|
||||
/usr/bin/ld: /openwrt/staging_dir/host/lib/libcrypto.a(libcrypto_la-conf_sap.o): in function `OpenSSL_no_config':
|
||||
conf_sap.c:(.text+0x107): undefined reference to `pthread_once'
|
||||
/usr/bin/ld: /openwrt/staging_dir/host/lib/libcrypto.a(libcrypto_la-err_all.o): in function `ERR_load_crypto_strings':
|
||||
err_all.c:(.text+0xa3): undefined reference to `pthread_once'
|
||||
collect2: error: ld returned 1 exit status
|
||||
make[4]: *** [Makefile:93: cert_create] Error 1
|
||||
|
||||
Signed-off-by: Robert Marko <robert.marko@sartura.hr>
|
||||
---
|
||||
tools/cert_create/Makefile | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/tools/cert_create/Makefile
|
||||
+++ b/tools/cert_create/Makefile
|
||||
@@ -79,7 +79,7 @@ INC_DIR += -I ./include -I ${PLAT_INCLUD
|
||||
# located under the main project directory (i.e.: ${OPENSSL_DIR}, not
|
||||
# ${OPENSSL_DIR}/lib/).
|
||||
LIB_DIR := -L ${OPENSSL_DIR}/lib -L ${OPENSSL_DIR}
|
||||
-LIB := -lssl -lcrypto
|
||||
+LIB := -lssl -lcrypto -pthread
|
||||
|
||||
HOSTCC ?= gcc
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
From f78f934710394822a36bd74043ed93a812c1c690 Mon Sep 17 00:00:00 2001
|
||||
From: Robert Marko <robert.marko@sartura.hr>
|
||||
Date: Mon, 12 Jan 2026 15:36:35 +0100
|
||||
Subject: [PATCH] microchip: lan969x: do not rely on Ruby shebang
|
||||
|
||||
Host Ruby build in the staging dir must be used, so we cannot rely on the
|
||||
shebang as that will fail.
|
||||
|
||||
So, call the script via Ruby executable instead.
|
||||
|
||||
Signed-off-by: Robert Marko <robert.marko@sartura.hr>
|
||||
---
|
||||
plat/microchip/lan969x/common/common.mk | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/plat/microchip/lan969x/common/common.mk
|
||||
+++ b/plat/microchip/lan969x/common/common.mk
|
||||
@@ -218,9 +218,9 @@ FWU_HTML := ${BUILD_PLAT}/fwu.html
|
||||
FWU_JS := ${BUILD_PLAT}/fwu_app.js
|
||||
|
||||
${FWU_JS}: ${BUILD_PLAT}/${FWU_FIP_NAME}
|
||||
- ./plat/microchip/scripts/mkjs.rb -p ${PLAT} -o ${FWU_JS} $<
|
||||
+ $(Q)ruby ./plat/microchip/scripts/mkjs.rb -p ${PLAT} -o ${FWU_JS} $<
|
||||
|
||||
${FWU_HTML}: ${FWU_JS}
|
||||
- ./plat/microchip/scripts/html_inline.rb -i ${BUILD_PLAT} ./scripts/fwu/serial.html > ${FWU_HTML}
|
||||
+ $(Q)ruby ./plat/microchip/scripts/html_inline.rb -i ${BUILD_PLAT} ./scripts/fwu/serial.html > ${FWU_HTML}
|
||||
|
||||
all: ${FWU_HTML}
|
||||
@@ -7,10 +7,11 @@
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_VERSION:=2.13
|
||||
PKG_VERSION:=2.12.1
|
||||
PKG_RELEASE:=1
|
||||
PKG_LTS:=1
|
||||
|
||||
PKG_HASH:=afb5c408392fcec840bd30de9b02a236b0108142024f9853b542b596b0d894e3
|
||||
PKG_HASH:=c0d432a851da452d927561feaf45f569c1cde57985782beadfe29e616e260440
|
||||
|
||||
PKG_MAINTAINER:=Sarah Maedel <openwrt@tbspace.de>
|
||||
|
||||
@@ -33,11 +34,6 @@ define Trusted-Firmware-A/rk3399
|
||||
PLAT:=rk3399
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/rk3576
|
||||
BUILD_SUBTARGET:=armv8
|
||||
PLAT:=rk3576
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/rk3588
|
||||
BUILD_SUBTARGET:=armv8
|
||||
PLAT:=rk3588
|
||||
@@ -46,12 +42,11 @@ endef
|
||||
TFA_TARGETS:= \
|
||||
rk3328 \
|
||||
rk3399 \
|
||||
rk3576 \
|
||||
rk3588
|
||||
|
||||
ifeq ($(BUILD_VARIANT),rk3399)
|
||||
M0_GCC_NAME:=arm-gnu-toolchain
|
||||
M0_GCC_RELEASE:=12.3.rel1
|
||||
M0_GCC_NAME:=gcc-arm
|
||||
M0_GCC_RELEASE:=11.2-2022.02
|
||||
M0_GCC_VERSION:=$(HOST_ARCH)-arm-none-eabi
|
||||
M0_GCC_SOURCE:=$(M0_GCC_NAME)-$(M0_GCC_RELEASE)-$(M0_GCC_VERSION).tar.xz
|
||||
|
||||
@@ -59,9 +54,9 @@ ifeq ($(BUILD_VARIANT),rk3399)
|
||||
FILE:=$(M0_GCC_SOURCE)
|
||||
URL:=https://developer.arm.com/-/media/Files/downloads/gnu/$(M0_GCC_RELEASE)/binrel
|
||||
ifeq ($(HOST_ARCH),aarch64)
|
||||
HASH:=14c0487d5753f6071d24e568881f7c7e67f80dd83165dec5164b3731394af431
|
||||
HASH:=ef1d82e5894e3908cb7ed49c5485b5b95deefa32872f79c2b5f6f5447cabf55f
|
||||
else
|
||||
HASH:=12a2815644318ebcceaf84beabb665d0924b6e79e21048452c5331a56332b309
|
||||
HASH:=8c5acd5ae567c0100245b0556941c237369f210bceb196edfe5a2e7532c60326
|
||||
endif
|
||||
endef
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_VERSION:=2.13
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=2.12
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_HASH:=afb5c408392fcec840bd30de9b02a236b0108142024f9853b542b596b0d894e3
|
||||
PKG_HASH:=b4c047493cac1152203e1ba121ae57267e4899b7bf56eb365e22a933342d31c9
|
||||
PKG_MAINTAINER:=Thomas Richard <thomas.richard@bootlin.com>
|
||||
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
From 33573ea6842198cfdb5b3fdd320db9e2045855e9 Mon Sep 17 00:00:00 2001
|
||||
From: Valentin Caron <valentin.caron@foss.st.com>
|
||||
Date: Wed, 11 Dec 2024 11:20:04 +0100
|
||||
Subject: [PATCH] fix(stm32mp1-fdts): re-enable RTC clock
|
||||
|
||||
On STM32MP15 ST boards, RTC clock configuration by OPTEE is not ready
|
||||
yet. Re-enable it temporary to get LSE as clock source of RTC.
|
||||
|
||||
Signed-off-by: Valentin Caron <valentin.caron@foss.st.com>
|
||||
Change-Id: Ib6071229552e456faffb4fdfc8db9808140d54a7
|
||||
---
|
||||
fdts/stm32mp157c-ed1.dts | 2 ++
|
||||
fdts/stm32mp15xx-dkx.dtsi | 2 ++
|
||||
2 files changed, 4 insertions(+)
|
||||
|
||||
--- a/fdts/stm32mp157c-ed1.dts
|
||||
+++ b/fdts/stm32mp157c-ed1.dts
|
||||
@@ -194,6 +194,7 @@
|
||||
CLK_MPU_PLL1P
|
||||
CLK_AXI_PLL2P
|
||||
CLK_MCU_PLL3P
|
||||
+ CLK_RTC_LSE
|
||||
CLK_MCO1_DISABLED
|
||||
CLK_MCO2_DISABLED
|
||||
CLK_CKPER_HSE
|
||||
@@ -242,6 +243,7 @@
|
||||
DIV(DIV_APB3, 1)
|
||||
DIV(DIV_APB4, 1)
|
||||
DIV(DIV_APB5, 2)
|
||||
+ DIV(DIV_RTC, 23)
|
||||
DIV(DIV_MCO1, 0)
|
||||
DIV(DIV_MCO2, 0)
|
||||
>;
|
||||
--- a/fdts/stm32mp15xx-dkx.dtsi
|
||||
+++ b/fdts/stm32mp15xx-dkx.dtsi
|
||||
@@ -198,6 +198,7 @@
|
||||
CLK_MPU_PLL1P
|
||||
CLK_AXI_PLL2P
|
||||
CLK_MCU_PLL3P
|
||||
+ CLK_RTC_LSE
|
||||
CLK_MCO1_DISABLED
|
||||
CLK_MCO2_DISABLED
|
||||
CLK_CKPER_HSE
|
||||
@@ -246,6 +247,7 @@
|
||||
DIV(DIV_APB3, 1)
|
||||
DIV(DIV_APB4, 1)
|
||||
DIV(DIV_APB5, 2)
|
||||
+ DIV(DIV_RTC, 23)
|
||||
DIV(DIV_MCO1, 0)
|
||||
DIV(DIV_MCO2, 0)
|
||||
>;
|
||||
@@ -7,10 +7,10 @@
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_VERSION:=4.8.0
|
||||
PKG_VERSION:=4.7.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_HASH:=5222cd553f5edb69ae4ec7cb99b2bfec2c47a47c0be1865b49744701918e8b4d
|
||||
PKG_HASH:=976b9c184678516038d4e79766608e81d10bf136f76fd0db2dc48f90f994fbd9
|
||||
PKG_MAINTAINER:=Thomas Richard <thomas.richard@bootlin.com>
|
||||
|
||||
OPTEE_USE_INTREE_DTC:=1
|
||||
|
||||
@@ -9,9 +9,9 @@ PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/rockchip-linux/rkbin.git
|
||||
PKG_SOURCE_DATE:=2025-06-13
|
||||
PKG_SOURCE_VERSION:=74213af1e952c4683d2e35952507133b61394862
|
||||
PKG_MIRROR_HASH:=4b801b1301ae297f660340617b5f398b23a3f0b43bc7f0ef42c21f0f43eb8990
|
||||
PKG_SOURCE_DATE:=2024-02-22
|
||||
PKG_SOURCE_VERSION:=a2a0b89b6c8c612dca5ed9ed8a68db8a07f68bc0
|
||||
PKG_MIRROR_HASH:=39f15e5f8fac02026065b6747b355b93f4e06202783ae448c43607763211597c
|
||||
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
|
||||
@@ -27,91 +27,78 @@ endef
|
||||
|
||||
define Trusted-Firmware-A/rk3308
|
||||
BUILD_SUBTARGET:=armv8
|
||||
ATF:=rk33/rk3308_bl31_v2.27.elf
|
||||
TPL:=rk33/rk3308_ddr_589MHz_uart2_m1_v2.10.bin
|
||||
ATF:=rk33/rk3308_bl31_v2.26.elf
|
||||
TPL:=rk33/rk3308_ddr_589MHz_uart2_m1_v2.07.bin
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/rk3308-tpl-rock-pi-s
|
||||
NAME:=Radxa ROCK Pi S board
|
||||
define Trusted-Firmware-A/rk3308-rock-pi-s
|
||||
NAME:=Radxa ROCK Pi S
|
||||
BUILD_SUBTARGET:=armv8
|
||||
TPL:=rk33/rk3308_ddr_589MHz_uart0_m0_v2.10.bin
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/rk3528
|
||||
BUILD_SUBTARGET:=armv8
|
||||
ATF:=rk35/rk3528_bl31_v1.20.elf
|
||||
TPL:=rk35/rk3528_ddr_1056MHz_v1.11.bin
|
||||
ATF:=rk33/rk3308_bl31_v2.26.elf
|
||||
TPL:=rk33/rk3308_ddr_589MHz_uart0_m0_v2.07.bin
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/rk3566
|
||||
BUILD_SUBTARGET:=armv8
|
||||
ATF:=rk35/rk3568_bl31_v1.45.elf
|
||||
TPL:=rk35/rk3566_ddr_1056MHz_v1.23.bin
|
||||
ATF:=rk35/rk3568_bl31_v1.44.elf
|
||||
TPL:=rk35/rk3566_ddr_1056MHz_v1.21.bin
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/rk3568
|
||||
BUILD_SUBTARGET:=armv8
|
||||
ATF:=rk35/rk3568_bl31_v1.45.elf
|
||||
TPL:=rk35/rk3568_ddr_1560MHz_v1.23.bin
|
||||
ATF:=rk35/rk3568_bl31_v1.44.elf
|
||||
TPL:=rk35/rk3568_ddr_1560MHz_v1.21.bin
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/rk3568-tpl-e25
|
||||
define Trusted-Firmware-A/rk3568-e25
|
||||
NAME:=Radxa E25 board
|
||||
BUILD_SUBTARGET:=armv8
|
||||
TPL:=rk35/rk3568_ddr_1560MHz_uart2_m0_115200_v1.23.bin
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/rk3576-tpl
|
||||
NAME:=Rockchip RK3576 SoCs
|
||||
BUILD_SUBTARGET:=armv8
|
||||
TPL:=rk35/rk3576_ddr_lp4_2112MHz_lp5_2736MHz_v1.09.bin
|
||||
ATF:=rk35/rk3568_bl31_v1.44.elf
|
||||
TPL:=rk35/rk3568_ddr_1560MHz_uart2_m0_115200_v1.21.bin
|
||||
endef
|
||||
|
||||
define Trusted-Firmware-A/rk3588-tpl
|
||||
NAME:=Rockchip RK3588 SoCs
|
||||
BUILD_SUBTARGET:=armv8
|
||||
TPL:=rk35/rk3588_ddr_lp4_2112MHz_lp5_2400MHz_v1.19.bin
|
||||
TPL:=rk35/rk3588_ddr_lp4_2112MHz_lp5_2400MHz_v1.16.bin
|
||||
endef
|
||||
|
||||
TFA_TARGETS:= \
|
||||
rk3308 \
|
||||
rk3308-tpl-rock-pi-s \
|
||||
rk3528 \
|
||||
rk3308-rock-pi-s \
|
||||
rk3566 \
|
||||
rk3568 \
|
||||
rk3568-tpl-e25 \
|
||||
rk3576-tpl \
|
||||
rk3568-e25 \
|
||||
rk3588-tpl
|
||||
|
||||
ifeq ($(BUILD_VARIANT),rk3308-tpl-rock-pi-s)
|
||||
ifeq ($(BUILD_VARIANT),rk3308-rock-pi-s)
|
||||
TPL_FILE:=rk3308_ddr_589MHz_uart0_m0_v2.07.bin
|
||||
define Download/rk3308-tpl-rock-pi-s
|
||||
FILE:=$(notdir $(TPL))
|
||||
URL_FILE:=$(TPL)
|
||||
URL:=https://github.com/radxa/rkbin/raw/2b54df9d062ef91a9fffbc85472b070c9220c4cf/bin/
|
||||
HASH:=45af030ed2cb322cc5a91c32350130fc1f1ea9508794fa4b5d309eadf70e3d04
|
||||
FILE:=$(TPL_FILE)
|
||||
URL:=https://github.com/radxa/rkbin/raw/5696fab20dcac57c1458f72dc7604ba60e553adf/bin/rk33/
|
||||
HASH:=8a1a42df23cccb86a2dabc14a5c0e9227d64a51b9b83e9968ef5af3b30787f7d
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
$(eval $(call Download,rk3308-tpl-rock-pi-s))
|
||||
$(call Build/Prepare/Default)
|
||||
|
||||
$(CP) $(DL_DIR)/$(notdir $(TPL)) $(PKG_BUILD_DIR)/bin/$(TPL)
|
||||
$(CP) $(DL_DIR)/$(TPL_FILE) $(PKG_BUILD_DIR)/bin/rk33/
|
||||
endef
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_VARIANT),rk3568-tpl-e25)
|
||||
ifeq ($(BUILD_VARIANT),rk3568-e25)
|
||||
TPL_FILE:=rk3568_ddr_1560MHz_uart2_m0_115200_v1.21.bin
|
||||
define Download/rk3568-tpl-e25
|
||||
FILE:=$(notdir $(TPL))
|
||||
URL_FILE:=$(TPL)
|
||||
URL:=https://github.com/radxa/rkbin/raw/2e77c53ab0279585b09ecdaa54fe3e2bf80f9475/bin/
|
||||
HASH:=1bb9f92a6515a70b91c0f8bd3aa4dc31432afc4317b9408f82c43ca63cb10ab6
|
||||
FILE:=$(TPL_FILE)
|
||||
URL:=https://github.com/radxa/rkbin/raw/5696fab20dcac57c1458f72dc7604ba60e553adf/bin/rk35/
|
||||
HASH:=1815f9649dc5661a3ef184b052da39286e51453a66f6ff53cc3e345d65dfabd4
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
$(eval $(call Download,rk3568-tpl-e25))
|
||||
$(call Build/Prepare/Default)
|
||||
|
||||
$(CP) $(DL_DIR)/$(notdir $(TPL)) $(PKG_BUILD_DIR)/bin/$(TPL)
|
||||
$(CP) $(DL_DIR)/$(TPL_FILE) $(PKG_BUILD_DIR)/bin/rk35/
|
||||
endef
|
||||
endif
|
||||
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_VERSION:=2025.10
|
||||
PKG_HASH:=b4f032848e56cc8f213ad59f9132c084dbbb632bc29176d024e58220e0efdf4a
|
||||
PKG_BUILD_DEPENDS:=arm-trusted-firmware-tools/host
|
||||
|
||||
UBOOT_USE_INTREE_DTC:=1
|
||||
|
||||
include $(INCLUDE_DIR)/u-boot.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
define U-Boot/Default
|
||||
BUILD_TARGET:=airoha
|
||||
FIP_COMPRESS:=1
|
||||
endef
|
||||
|
||||
define U-Boot/an7581_rfb
|
||||
NAME:=AN7581 Reference Board
|
||||
UBOOT_CONFIG:=an7581_evb
|
||||
BUILD_DEVICES:=airoha_an7581-evb
|
||||
BUILD_SUBTARGET:=an7581
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_IMAGE:=an7581-bl2.bin
|
||||
BL31_IMAGE:=an7581-bl31.bin
|
||||
endef
|
||||
|
||||
define U-Boot/an7583_rfb
|
||||
NAME:=AN7583 Reference Board
|
||||
UBOOT_CONFIG:=an7583_evb
|
||||
BUILD_DEVICES:=airoha_an7583-evb
|
||||
BUILD_SUBTARGET:=an7583
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_IMAGE:=an7583-bl2.bin
|
||||
BL31_IMAGE:=an7583-bl31.bin
|
||||
endef
|
||||
|
||||
UBOOT_TARGETS := \
|
||||
an7581_rfb \
|
||||
an7583_rfb
|
||||
|
||||
UBOOT_CUSTOMIZE_CONFIG := \
|
||||
--disable TOOLS_KWBIMAGE \
|
||||
--disable TOOLS_LIBCRYPTO \
|
||||
--disable TOOLS_MKEFICAPSULE \
|
||||
--enable SERIAL_RX_BUFFER \
|
||||
--set-val SERIAL_RX_BUFFER_SIZE 256
|
||||
|
||||
define Build/fip-image-bl2
|
||||
$(STAGING_DIR_HOST)/bin/fiptool create \
|
||||
--tb-fw files/$(BL2_IMAGE) \
|
||||
$(PKG_BUILD_DIR)/bl2.fip
|
||||
endef
|
||||
|
||||
define Build/fip-image
|
||||
$(if $(FIP_COMPRESS), $(STAGING_DIR_HOST)/bin/lzma e \
|
||||
$(PKG_BUILD_DIR)/u-boot.bin \
|
||||
$(PKG_BUILD_DIR)/u-boot.bin.lzma)
|
||||
$(if $(FIP_COMPRESS), $(STAGING_DIR_HOST)/bin/lzma e \
|
||||
files/$(BL31_IMAGE) \
|
||||
$(PKG_BUILD_DIR)/bl31.bin.lzma)
|
||||
$(STAGING_DIR_HOST)/bin/fiptool create \
|
||||
--soc-fw $(PKG_BUILD_DIR)/bl31.bin$(if $(FIP_COMPRESS),.lzma) \
|
||||
--nt-fw $(PKG_BUILD_DIR)/u-boot.bin$(if $(FIP_COMPRESS),.lzma) \
|
||||
$(PKG_BUILD_DIR)/u-boot.fip
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
$(call Build/Configure/U-Boot)
|
||||
sed -i 's/CONFIG_TOOLS_LIBCRYPTO=y/# CONFIG_TOOLS_LIBCRYPTO is not set/' $(PKG_BUILD_DIR)/.config
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(call Build/Compile/U-Boot)
|
||||
ifeq ($(UBOOT_IMAGE),u-boot.fip)
|
||||
$(call Build/fip-image-bl2)
|
||||
$(call Build/fip-image)
|
||||
endif
|
||||
endef
|
||||
|
||||
# don't stage files to bindir, let target/linux/airoha/image/*.mk do that
|
||||
define Package/u-boot/install
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(STAGING_DIR_IMAGE)
|
||||
ifeq ($(UBOOT_IMAGE),u-boot.fip)
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/bl2.fip $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-bl2.fip
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/u-boot.fip $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-bl31-u-boot.fip
|
||||
endif
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage/U-Boot))
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,315 +0,0 @@
|
||||
From f45ae9019afb838979792e4237e344003151fbf7 Mon Sep 17 00:00:00 2001
|
||||
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
Date: Sun, 12 Nov 2023 20:57:52 +0300
|
||||
Subject: [PATCH 1/5] mtd: spinand: Use the spi-mem dirmap API
|
||||
|
||||
Make use of the spi-mem direct mapping API to let advanced controllers
|
||||
optimize read/write operations when they support direct mapping.
|
||||
|
||||
Based on a linux commit 981d1aa0697c ("mtd: spinand: Use the spi-mem dirmap API")
|
||||
created by Boris Brezillon <bbrezillon@kernel.org> with additional
|
||||
fixes taken from Linux 6.10.
|
||||
|
||||
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
|
||||
---
|
||||
drivers/mtd/nand/spi/core.c | 185 +++++++++++++++++-------------------
|
||||
include/linux/mtd/spinand.h | 7 ++
|
||||
2 files changed, 95 insertions(+), 97 deletions(-)
|
||||
|
||||
--- a/drivers/mtd/nand/spi/core.c
|
||||
+++ b/drivers/mtd/nand/spi/core.c
|
||||
@@ -41,21 +41,6 @@ struct spinand_plat {
|
||||
/* SPI NAND index visible in MTD names */
|
||||
static int spi_nand_idx;
|
||||
|
||||
-static void spinand_cache_op_adjust_colum(struct spinand_device *spinand,
|
||||
- const struct nand_page_io_req *req,
|
||||
- u16 *column)
|
||||
-{
|
||||
- struct nand_device *nand = spinand_to_nand(spinand);
|
||||
- unsigned int shift;
|
||||
-
|
||||
- if (nand->memorg.planes_per_lun < 2)
|
||||
- return;
|
||||
-
|
||||
- /* The plane number is passed in MSB just above the column address */
|
||||
- shift = fls(nand->memorg.pagesize);
|
||||
- *column |= req->pos.plane << shift;
|
||||
-}
|
||||
-
|
||||
static int spinand_read_reg_op(struct spinand_device *spinand, u8 reg, u8 *val)
|
||||
{
|
||||
struct spi_mem_op op = SPINAND_GET_FEATURE_OP(reg,
|
||||
@@ -249,27 +234,21 @@ static int spinand_load_page_op(struct spinand_device *spinand,
|
||||
static int spinand_read_from_cache_op(struct spinand_device *spinand,
|
||||
const struct nand_page_io_req *req)
|
||||
{
|
||||
- struct spi_mem_op op = *spinand->op_templates.read_cache;
|
||||
struct nand_device *nand = spinand_to_nand(spinand);
|
||||
struct mtd_info *mtd = nanddev_to_mtd(nand);
|
||||
- struct nand_page_io_req adjreq = *req;
|
||||
+ struct spi_mem_dirmap_desc *rdesc;
|
||||
unsigned int nbytes = 0;
|
||||
void *buf = NULL;
|
||||
u16 column = 0;
|
||||
- int ret;
|
||||
+ ssize_t ret;
|
||||
|
||||
if (req->datalen) {
|
||||
- adjreq.datalen = nanddev_page_size(nand);
|
||||
- adjreq.dataoffs = 0;
|
||||
- adjreq.databuf.in = spinand->databuf;
|
||||
buf = spinand->databuf;
|
||||
- nbytes = adjreq.datalen;
|
||||
+ nbytes = nanddev_page_size(nand);
|
||||
+ column = 0;
|
||||
}
|
||||
|
||||
if (req->ooblen) {
|
||||
- adjreq.ooblen = nanddev_per_page_oobsize(nand);
|
||||
- adjreq.ooboffs = 0;
|
||||
- adjreq.oobbuf.in = spinand->oobbuf;
|
||||
nbytes += nanddev_per_page_oobsize(nand);
|
||||
if (!buf) {
|
||||
buf = spinand->oobbuf;
|
||||
@@ -277,28 +256,19 @@ static int spinand_read_from_cache_op(struct spinand_device *spinand,
|
||||
}
|
||||
}
|
||||
|
||||
- spinand_cache_op_adjust_colum(spinand, &adjreq, &column);
|
||||
- op.addr.val = column;
|
||||
+ rdesc = spinand->dirmaps[req->pos.plane].rdesc;
|
||||
|
||||
- /*
|
||||
- * Some controllers are limited in term of max RX data size. In this
|
||||
- * case, just repeat the READ_CACHE operation after updating the
|
||||
- * column.
|
||||
- */
|
||||
while (nbytes) {
|
||||
- op.data.buf.in = buf;
|
||||
- op.data.nbytes = nbytes;
|
||||
- ret = spi_mem_adjust_op_size(spinand->slave, &op);
|
||||
- if (ret)
|
||||
+ ret = spi_mem_dirmap_read(rdesc, column, nbytes, buf);
|
||||
+ if (ret < 0)
|
||||
return ret;
|
||||
|
||||
- ret = spi_mem_exec_op(spinand->slave, &op);
|
||||
- if (ret)
|
||||
- return ret;
|
||||
+ if (!ret || ret > nbytes)
|
||||
+ return -EIO;
|
||||
|
||||
- buf += op.data.nbytes;
|
||||
- nbytes -= op.data.nbytes;
|
||||
- op.addr.val += op.data.nbytes;
|
||||
+ nbytes -= ret;
|
||||
+ column += ret;
|
||||
+ buf += ret;
|
||||
}
|
||||
|
||||
if (req->datalen)
|
||||
@@ -322,14 +292,12 @@ static int spinand_read_from_cache_op(struct spinand_device *spinand,
|
||||
static int spinand_write_to_cache_op(struct spinand_device *spinand,
|
||||
const struct nand_page_io_req *req)
|
||||
{
|
||||
- struct spi_mem_op op = *spinand->op_templates.write_cache;
|
||||
struct nand_device *nand = spinand_to_nand(spinand);
|
||||
struct mtd_info *mtd = nanddev_to_mtd(nand);
|
||||
- struct nand_page_io_req adjreq = *req;
|
||||
- unsigned int nbytes = 0;
|
||||
- void *buf = NULL;
|
||||
- u16 column = 0;
|
||||
- int ret;
|
||||
+ struct spi_mem_dirmap_desc *wdesc;
|
||||
+ unsigned int nbytes, column = 0;
|
||||
+ void *buf = spinand->databuf;
|
||||
+ ssize_t ret;
|
||||
|
||||
/*
|
||||
* Looks like PROGRAM LOAD (AKA write cache) does not necessarily reset
|
||||
@@ -338,19 +306,12 @@ static int spinand_write_to_cache_op(struct spinand_device *spinand,
|
||||
* the data portion of the page, otherwise we might corrupt the BBM or
|
||||
* user data previously programmed in OOB area.
|
||||
*/
|
||||
- memset(spinand->databuf, 0xff,
|
||||
- nanddev_page_size(nand) +
|
||||
- nanddev_per_page_oobsize(nand));
|
||||
+ nbytes = nanddev_page_size(nand) + nanddev_per_page_oobsize(nand);
|
||||
+ memset(spinand->databuf, 0xff, nbytes);
|
||||
|
||||
- if (req->datalen) {
|
||||
+ if (req->datalen)
|
||||
memcpy(spinand->databuf + req->dataoffs, req->databuf.out,
|
||||
req->datalen);
|
||||
- adjreq.dataoffs = 0;
|
||||
- adjreq.datalen = nanddev_page_size(nand);
|
||||
- adjreq.databuf.out = spinand->databuf;
|
||||
- nbytes = adjreq.datalen;
|
||||
- buf = spinand->databuf;
|
||||
- }
|
||||
|
||||
if (req->ooblen) {
|
||||
if (req->mode == MTD_OPS_AUTO_OOB)
|
||||
@@ -361,52 +322,21 @@ static int spinand_write_to_cache_op(struct spinand_device *spinand,
|
||||
else
|
||||
memcpy(spinand->oobbuf + req->ooboffs, req->oobbuf.out,
|
||||
req->ooblen);
|
||||
-
|
||||
- adjreq.ooblen = nanddev_per_page_oobsize(nand);
|
||||
- adjreq.ooboffs = 0;
|
||||
- nbytes += nanddev_per_page_oobsize(nand);
|
||||
- if (!buf) {
|
||||
- buf = spinand->oobbuf;
|
||||
- column = nanddev_page_size(nand);
|
||||
- }
|
||||
}
|
||||
|
||||
- spinand_cache_op_adjust_colum(spinand, &adjreq, &column);
|
||||
-
|
||||
- op = *spinand->op_templates.write_cache;
|
||||
- op.addr.val = column;
|
||||
+ wdesc = spinand->dirmaps[req->pos.plane].wdesc;
|
||||
|
||||
- /*
|
||||
- * Some controllers are limited in term of max TX data size. In this
|
||||
- * case, split the operation into one LOAD CACHE and one or more
|
||||
- * LOAD RANDOM CACHE.
|
||||
- */
|
||||
while (nbytes) {
|
||||
- op.data.buf.out = buf;
|
||||
- op.data.nbytes = nbytes;
|
||||
-
|
||||
- ret = spi_mem_adjust_op_size(spinand->slave, &op);
|
||||
- if (ret)
|
||||
- return ret;
|
||||
-
|
||||
- ret = spi_mem_exec_op(spinand->slave, &op);
|
||||
- if (ret)
|
||||
+ ret = spi_mem_dirmap_write(wdesc, column, nbytes, buf);
|
||||
+ if (ret < 0)
|
||||
return ret;
|
||||
|
||||
- buf += op.data.nbytes;
|
||||
- nbytes -= op.data.nbytes;
|
||||
- op.addr.val += op.data.nbytes;
|
||||
+ if (!ret || ret > nbytes)
|
||||
+ return -EIO;
|
||||
|
||||
- /*
|
||||
- * We need to use the RANDOM LOAD CACHE operation if there's
|
||||
- * more than one iteration, because the LOAD operation resets
|
||||
- * the cache to 0xff.
|
||||
- */
|
||||
- if (nbytes) {
|
||||
- column = op.addr.val;
|
||||
- op = *spinand->op_templates.update_cache;
|
||||
- op.addr.val = column;
|
||||
- }
|
||||
+ nbytes -= ret;
|
||||
+ column += ret;
|
||||
+ buf += ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -819,6 +749,59 @@ static int spinand_mtd_block_isreserved(struct mtd_info *mtd, loff_t offs)
|
||||
return ret;
|
||||
}
|
||||
|
||||
+static int spinand_create_dirmap(struct spinand_device *spinand,
|
||||
+ unsigned int plane)
|
||||
+{
|
||||
+ struct nand_device *nand = spinand_to_nand(spinand);
|
||||
+ struct spi_mem_dirmap_info info = {
|
||||
+ .length = nanddev_page_size(nand) +
|
||||
+ nanddev_per_page_oobsize(nand),
|
||||
+ };
|
||||
+ struct spi_mem_dirmap_desc *desc;
|
||||
+
|
||||
+ /* The plane number is passed in MSB just above the column address */
|
||||
+ info.offset = plane << fls(nand->memorg.pagesize);
|
||||
+
|
||||
+ info.op_tmpl = *spinand->op_templates.update_cache;
|
||||
+ desc = spi_mem_dirmap_create(spinand->slave, &info);
|
||||
+ if (IS_ERR(desc))
|
||||
+ return PTR_ERR(desc);
|
||||
+
|
||||
+ spinand->dirmaps[plane].wdesc = desc;
|
||||
+
|
||||
+ info.op_tmpl = *spinand->op_templates.read_cache;
|
||||
+ desc = spi_mem_dirmap_create(spinand->slave, &info);
|
||||
+ if (IS_ERR(desc)) {
|
||||
+ spi_mem_dirmap_destroy(spinand->dirmaps[plane].wdesc);
|
||||
+ return PTR_ERR(desc);
|
||||
+ }
|
||||
+
|
||||
+ spinand->dirmaps[plane].rdesc = desc;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int spinand_create_dirmaps(struct spinand_device *spinand)
|
||||
+{
|
||||
+ struct nand_device *nand = spinand_to_nand(spinand);
|
||||
+ int i, ret;
|
||||
+
|
||||
+ spinand->dirmaps = devm_kzalloc(spinand->slave->dev,
|
||||
+ sizeof(*spinand->dirmaps) *
|
||||
+ nand->memorg.planes_per_lun,
|
||||
+ GFP_KERNEL);
|
||||
+ if (!spinand->dirmaps)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ for (i = 0; i < nand->memorg.planes_per_lun; i++) {
|
||||
+ ret = spinand_create_dirmap(spinand, i);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static const struct nand_ops spinand_ops = {
|
||||
.erase = spinand_erase,
|
||||
.markbad = spinand_markbad,
|
||||
@@ -1134,6 +1117,14 @@ static int spinand_init(struct spinand_device *spinand)
|
||||
goto err_free_bufs;
|
||||
}
|
||||
|
||||
+ ret = spinand_create_dirmaps(spinand);
|
||||
+ if (ret) {
|
||||
+ dev_err(spinand->slave->dev,
|
||||
+ "Failed to create direct mappings for read/write operations (err = %d)\n",
|
||||
+ ret);
|
||||
+ goto err_manuf_cleanup;
|
||||
+ }
|
||||
+
|
||||
/* After power up, all blocks are locked, so unlock them here. */
|
||||
for (i = 0; i < nand->memorg.ntargets; i++) {
|
||||
ret = spinand_select_target(spinand, i);
|
||||
diff --git a/include/linux/mtd/spinand.h b/include/linux/mtd/spinand.h
|
||||
index 6fe6fd520a4..163269313f6 100644
|
||||
--- a/include/linux/mtd/spinand.h
|
||||
+++ b/include/linux/mtd/spinand.h
|
||||
@@ -363,6 +363,11 @@ struct spinand_info {
|
||||
__VA_ARGS__ \
|
||||
}
|
||||
|
||||
+struct spinand_dirmap {
|
||||
+ struct spi_mem_dirmap_desc *wdesc;
|
||||
+ struct spi_mem_dirmap_desc *rdesc;
|
||||
+};
|
||||
+
|
||||
/**
|
||||
* struct spinand_device - SPI NAND device instance
|
||||
* @base: NAND device instance
|
||||
@@ -406,6 +411,8 @@ struct spinand_device {
|
||||
const struct spi_mem_op *update_cache;
|
||||
} op_templates;
|
||||
|
||||
+ struct spinand_dirmap *dirmaps;
|
||||
+
|
||||
int (*select_target)(struct spinand_device *spinand,
|
||||
unsigned int target);
|
||||
unsigned int cur_target;
|
||||
@@ -1,46 +0,0 @@
|
||||
From 1e29cf13c183ee457ed70055f5cbff60ff56a726 Mon Sep 17 00:00:00 2001
|
||||
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
Date: Sat, 7 Jun 2025 07:18:12 +0300
|
||||
Subject: [PATCH 2/5] spi: airoha: remove unnecessary operation adjust_op_size
|
||||
|
||||
This operation is not needed because airoha_snand_write_data() and
|
||||
airoha_snand_read_data() will properly handle data transfers above
|
||||
SPI_MAX_TRANSFER_SIZE.
|
||||
|
||||
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
---
|
||||
drivers/spi/airoha_snfi_spi.c | 16 ----------------
|
||||
1 file changed, 16 deletions(-)
|
||||
|
||||
--- a/drivers/spi/airoha_snfi_spi.c
|
||||
+++ b/drivers/spi/airoha_snfi_spi.c
|
||||
@@ -525,21 +525,6 @@ static int airoha_snand_nfi_config(struct airoha_snand_priv *priv)
|
||||
SPI_NFI_CUS_SEC_SIZE, val);
|
||||
}
|
||||
|
||||
-static int airoha_snand_adjust_op_size(struct spi_slave *slave,
|
||||
- struct spi_mem_op *op)
|
||||
-{
|
||||
- size_t max_len;
|
||||
-
|
||||
- max_len = 1 + op->addr.nbytes + op->dummy.nbytes;
|
||||
- if (max_len >= 160)
|
||||
- return -EOPNOTSUPP;
|
||||
-
|
||||
- if (op->data.nbytes > 160 - max_len)
|
||||
- op->data.nbytes = 160 - max_len;
|
||||
-
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
static bool airoha_snand_supports_op(struct spi_slave *slave,
|
||||
const struct spi_mem_op *op)
|
||||
{
|
||||
@@ -691,7 +676,6 @@ static int airoha_snand_nfi_setup(struct spi_slave *slave,
|
||||
}
|
||||
|
||||
static const struct spi_controller_mem_ops airoha_snand_mem_ops = {
|
||||
- .adjust_op_size = airoha_snand_adjust_op_size,
|
||||
.supports_op = airoha_snand_supports_op,
|
||||
.exec_op = airoha_snand_exec_op,
|
||||
};
|
||||
@@ -1,257 +0,0 @@
|
||||
From fe8c32af9d8c8ff8875efece82001680fc300ad5 Mon Sep 17 00:00:00 2001
|
||||
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
Date: Sat, 7 Jun 2025 09:09:38 +0300
|
||||
Subject: [PATCH 3/5] spi: airoha: add support of dual/quad wires spi modes
|
||||
to exec_op() handler
|
||||
|
||||
Booting without this patch and disabled dirmap support results in
|
||||
|
||||
[ 2.980719] spi-nand spi0.0: Micron SPI NAND was found.
|
||||
[ 2.986040] spi-nand spi0.0: 256 MiB, block size: 128 KiB, page size: 2048, OOB size: 128
|
||||
[ 2.994709] 2 fixed-partitions partitions found on MTD device spi0.0
|
||||
[ 3.001075] Creating 2 MTD partitions on "spi0.0":
|
||||
[ 3.005862] 0x000000000000-0x000000020000 : "bl2"
|
||||
[ 3.011272] 0x000000020000-0x000010000000 : "ubi"
|
||||
...
|
||||
[ 6.195594] ubi0: attaching mtd1
|
||||
[ 13.338398] ubi0: scanning is finished
|
||||
[ 13.342188] ubi0 error: ubi_read_volume_table: the layout volume was not found
|
||||
[ 13.349784] ubi0 error: ubi_attach_mtd_dev: failed to attach mtd1, error -22
|
||||
[ 13.356897] UBI error: cannot attach mtd1
|
||||
|
||||
If dirmap is disabled or not supported in the spi driver, the dirmap requests
|
||||
will be executed via exec_op() handler. Thus, if the hardware supports
|
||||
dual/quad spi modes, then corresponding requests will be sent to exec_op()
|
||||
handler. Current driver does not support such requests, so error is arrised.
|
||||
As result the flash can't be read/write.
|
||||
|
||||
This patch adds support of dual and quad wires spi modes to exec_op() handler.
|
||||
|
||||
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
---
|
||||
drivers/spi/airoha_snfi_spi.c | 143 +++++++++++++++++++++++++++-------
|
||||
1 file changed, 117 insertions(+), 26 deletions(-)
|
||||
|
||||
--- a/drivers/spi/airoha_snfi_spi.c
|
||||
+++ b/drivers/spi/airoha_snfi_spi.c
|
||||
@@ -186,6 +186,14 @@
|
||||
#define SPI_NAND_OP_RESET 0xff
|
||||
#define SPI_NAND_OP_DIE_SELECT 0xc2
|
||||
|
||||
+/* SNAND FIFO commands */
|
||||
+#define SNAND_FIFO_TX_BUSWIDTH_SINGLE 0x08
|
||||
+#define SNAND_FIFO_TX_BUSWIDTH_DUAL 0x09
|
||||
+#define SNAND_FIFO_TX_BUSWIDTH_QUAD 0x0a
|
||||
+#define SNAND_FIFO_RX_BUSWIDTH_SINGLE 0x0c
|
||||
+#define SNAND_FIFO_RX_BUSWIDTH_DUAL 0x0e
|
||||
+#define SNAND_FIFO_RX_BUSWIDTH_QUAD 0x0f
|
||||
+
|
||||
#define SPI_NAND_CACHE_SIZE (SZ_4K + SZ_256)
|
||||
#define SPI_MAX_TRANSFER_SIZE 511
|
||||
|
||||
@@ -380,10 +388,26 @@ static int airoha_snand_set_mode(struct airoha_snand_priv *priv,
|
||||
return regmap_write(priv->regmap_ctrl, REG_SPI_CTRL_DUMMY, 0);
|
||||
}
|
||||
|
||||
-static int airoha_snand_write_data(struct airoha_snand_priv *priv, u8 cmd,
|
||||
- const u8 *data, int len)
|
||||
+static int airoha_snand_write_data(struct airoha_snand_priv *priv,
|
||||
+ const u8 *data, int len, int buswidth)
|
||||
{
|
||||
int i, data_len;
|
||||
+ u8 cmd;
|
||||
+
|
||||
+ switch (buswidth) {
|
||||
+ case 0:
|
||||
+ case 1:
|
||||
+ cmd = SNAND_FIFO_TX_BUSWIDTH_SINGLE;
|
||||
+ break;
|
||||
+ case 2:
|
||||
+ cmd = SNAND_FIFO_TX_BUSWIDTH_DUAL;
|
||||
+ break;
|
||||
+ case 4:
|
||||
+ cmd = SNAND_FIFO_TX_BUSWIDTH_QUAD;
|
||||
+ break;
|
||||
+ default:
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
|
||||
for (i = 0; i < len; i += data_len) {
|
||||
int err;
|
||||
@@ -402,16 +426,32 @@ static int airoha_snand_write_data(struct airoha_snand_priv *priv, u8 cmd,
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int airoha_snand_read_data(struct airoha_snand_priv *priv, u8 *data,
|
||||
- int len)
|
||||
+static int airoha_snand_read_data(struct airoha_snand_priv *priv,
|
||||
+ u8 *data, int len, int buswidth)
|
||||
{
|
||||
int i, data_len;
|
||||
+ u8 cmd;
|
||||
+
|
||||
+ switch (buswidth) {
|
||||
+ case 0:
|
||||
+ case 1:
|
||||
+ cmd = SNAND_FIFO_RX_BUSWIDTH_SINGLE;
|
||||
+ break;
|
||||
+ case 2:
|
||||
+ cmd = SNAND_FIFO_RX_BUSWIDTH_DUAL;
|
||||
+ break;
|
||||
+ case 4:
|
||||
+ cmd = SNAND_FIFO_RX_BUSWIDTH_QUAD;
|
||||
+ break;
|
||||
+ default:
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
|
||||
for (i = 0; i < len; i += data_len) {
|
||||
int err;
|
||||
|
||||
data_len = min(len - i, SPI_MAX_TRANSFER_SIZE);
|
||||
- err = airoha_snand_set_fifo_op(priv, 0xc, data_len);
|
||||
+ err = airoha_snand_set_fifo_op(priv, cmd, data_len);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@@ -525,6 +565,38 @@ static int airoha_snand_nfi_config(struct airoha_snand_priv *priv)
|
||||
SPI_NFI_CUS_SEC_SIZE, val);
|
||||
}
|
||||
|
||||
+static bool airoha_snand_is_page_ops(const struct spi_mem_op *op)
|
||||
+{
|
||||
+ if (op->addr.nbytes != 2)
|
||||
+ return false;
|
||||
+
|
||||
+ if (op->addr.buswidth != 1 && op->addr.buswidth != 2 &&
|
||||
+ op->addr.buswidth != 4)
|
||||
+ return false;
|
||||
+
|
||||
+ switch (op->data.dir) {
|
||||
+ case SPI_MEM_DATA_IN:
|
||||
+ if (op->dummy.nbytes * BITS_PER_BYTE / op->dummy.buswidth > 0xf)
|
||||
+ return false;
|
||||
+
|
||||
+ /* quad in / quad out */
|
||||
+ if (op->addr.buswidth == 4)
|
||||
+ return op->data.buswidth == 4;
|
||||
+
|
||||
+ if (op->addr.buswidth == 2)
|
||||
+ return op->data.buswidth == 2;
|
||||
+
|
||||
+ /* standard spi */
|
||||
+ return op->data.buswidth == 4 || op->data.buswidth == 2 ||
|
||||
+ op->data.buswidth == 1;
|
||||
+ case SPI_MEM_DATA_OUT:
|
||||
+ return !op->dummy.nbytes && op->addr.buswidth == 1 &&
|
||||
+ (op->data.buswidth == 4 || op->data.buswidth == 1);
|
||||
+ default:
|
||||
+ return false;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static bool airoha_snand_supports_op(struct spi_slave *slave,
|
||||
const struct spi_mem_op *op)
|
||||
{
|
||||
@@ -534,6 +606,9 @@ static bool airoha_snand_supports_op(struct spi_slave *slave,
|
||||
if (op->cmd.buswidth != 1)
|
||||
return false;
|
||||
|
||||
+ if (airoha_snand_is_page_ops(op))
|
||||
+ return true;
|
||||
+
|
||||
return (!op->addr.nbytes || op->addr.buswidth == 1) &&
|
||||
(!op->dummy.nbytes || op->dummy.buswidth == 1) &&
|
||||
(!op->data.nbytes || op->data.buswidth == 1);
|
||||
@@ -542,13 +617,29 @@ static bool airoha_snand_supports_op(struct spi_slave *slave,
|
||||
static int airoha_snand_exec_op(struct spi_slave *slave,
|
||||
const struct spi_mem_op *op)
|
||||
{
|
||||
- u8 data[8], cmd, opcode = op->cmd.opcode;
|
||||
struct udevice *bus = slave->dev->parent;
|
||||
struct airoha_snand_priv *priv;
|
||||
+ int op_len, addr_len, dummy_len;
|
||||
+ u8 buf[20], *data;
|
||||
int i, err;
|
||||
|
||||
priv = dev_get_priv(bus);
|
||||
|
||||
+ op_len = op->cmd.nbytes;
|
||||
+ addr_len = op->addr.nbytes;
|
||||
+ dummy_len = op->dummy.nbytes;
|
||||
+
|
||||
+ if (op_len + dummy_len + addr_len > sizeof(buf))
|
||||
+ return -EIO;
|
||||
+
|
||||
+ data = buf;
|
||||
+ for (i = 0; i < op_len; i++)
|
||||
+ *data++ = op->cmd.opcode >> (8 * (op_len - i - 1));
|
||||
+ for (i = 0; i < addr_len; i++)
|
||||
+ *data++ = op->addr.val >> (8 * (addr_len - i - 1));
|
||||
+ for (i = 0; i < dummy_len; i++)
|
||||
+ *data++ = 0xff;
|
||||
+
|
||||
/* switch to manual mode */
|
||||
err = airoha_snand_set_mode(priv, SPI_MODE_MANUAL);
|
||||
if (err < 0)
|
||||
@@ -559,40 +650,40 @@ static int airoha_snand_exec_op(struct spi_slave *slave,
|
||||
return err;
|
||||
|
||||
/* opcode */
|
||||
- err = airoha_snand_write_data(priv, 0x8, &opcode, sizeof(opcode));
|
||||
+ data = buf;
|
||||
+ err = airoha_snand_write_data(priv, data, op_len,
|
||||
+ op->cmd.buswidth);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/* addr part */
|
||||
- cmd = opcode == SPI_NAND_OP_GET_FEATURE ? 0x11 : 0x8;
|
||||
- put_unaligned_be64(op->addr.val, data);
|
||||
-
|
||||
- for (i = ARRAY_SIZE(data) - op->addr.nbytes;
|
||||
- i < ARRAY_SIZE(data); i++) {
|
||||
- err = airoha_snand_write_data(priv, cmd, &data[i],
|
||||
- sizeof(data[0]));
|
||||
+ data += op_len;
|
||||
+ if (addr_len) {
|
||||
+ err = airoha_snand_write_data(priv, data, addr_len,
|
||||
+ op->addr.buswidth);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
/* dummy */
|
||||
- data[0] = 0xff;
|
||||
- for (i = 0; i < op->dummy.nbytes; i++) {
|
||||
- err = airoha_snand_write_data(priv, 0x8, &data[0],
|
||||
- sizeof(data[0]));
|
||||
+ data += addr_len;
|
||||
+ if (dummy_len) {
|
||||
+ err = airoha_snand_write_data(priv, data, dummy_len,
|
||||
+ op->dummy.buswidth);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
/* data */
|
||||
- if (op->data.dir == SPI_MEM_DATA_IN) {
|
||||
- err = airoha_snand_read_data(priv, op->data.buf.in,
|
||||
- op->data.nbytes);
|
||||
- if (err)
|
||||
- return err;
|
||||
- } else {
|
||||
- err = airoha_snand_write_data(priv, 0x8, op->data.buf.out,
|
||||
- op->data.nbytes);
|
||||
+ if (op->data.nbytes) {
|
||||
+ if (op->data.dir == SPI_MEM_DATA_IN)
|
||||
+ err = airoha_snand_read_data(priv, op->data.buf.in,
|
||||
+ op->data.nbytes,
|
||||
+ op->data.buswidth);
|
||||
+ else
|
||||
+ err = airoha_snand_write_data(priv, op->data.buf.out,
|
||||
+ op->data.nbytes,
|
||||
+ op->data.buswidth);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
@@ -1,373 +0,0 @@
|
||||
From f1fe2f174f26eb98af35862caea083439e08a344 Mon Sep 17 00:00:00 2001
|
||||
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
Date: Sun, 8 Jun 2025 05:30:22 +0300
|
||||
Subject: [PATCH 4/5] spi: airoha: add dma support
|
||||
|
||||
This patch speed up cache reading/writing/updating opearions.
|
||||
It was tested on en7523/an7581 and some other Airoha chips.
|
||||
|
||||
It will speed up
|
||||
* page reading/writing without oob
|
||||
* page reading/writing with oob
|
||||
* oob reading/writing (significant for UBI scanning)
|
||||
|
||||
The only know issue appears in a very specific conditions for en7523 family
|
||||
chips only.
|
||||
|
||||
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
---
|
||||
drivers/spi/airoha_snfi_spi.c | 309 ++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 309 insertions(+)
|
||||
|
||||
--- a/drivers/spi/airoha_snfi_spi.c
|
||||
+++ b/drivers/spi/airoha_snfi_spi.c
|
||||
@@ -141,12 +141,14 @@
|
||||
#define SPI_NFI_CUS_SEC_SIZE_EN BIT(16)
|
||||
|
||||
#define REG_SPI_NFI_RD_CTL2 0x0510
|
||||
+
|
||||
#define REG_SPI_NFI_RD_CTL3 0x0514
|
||||
|
||||
#define REG_SPI_NFI_PG_CTL1 0x0524
|
||||
#define SPI_NFI_PG_LOAD_CMD GENMASK(15, 8)
|
||||
|
||||
#define REG_SPI_NFI_PG_CTL2 0x0528
|
||||
+
|
||||
#define REG_SPI_NFI_NOR_PROG_ADDR 0x052c
|
||||
#define REG_SPI_NFI_NOR_RD_ADDR 0x0534
|
||||
|
||||
@@ -219,6 +221,8 @@ struct airoha_snand_priv {
|
||||
u8 sec_num;
|
||||
u8 spare_size;
|
||||
} nfi_cfg;
|
||||
+
|
||||
+ u8 *txrx_buf;
|
||||
};
|
||||
|
||||
static int airoha_snand_set_fifo_op(struct airoha_snand_priv *priv,
|
||||
@@ -614,6 +618,302 @@ static bool airoha_snand_supports_op(struct spi_slave *slave,
|
||||
(!op->data.nbytes || op->data.buswidth == 1);
|
||||
}
|
||||
|
||||
+static int airoha_snand_dirmap_create(struct spi_mem_dirmap_desc *desc)
|
||||
+{
|
||||
+ struct spi_slave *slave = desc->slave;
|
||||
+ struct udevice *bus = slave->dev->parent;
|
||||
+ struct airoha_snand_priv *priv = dev_get_priv(bus);
|
||||
+
|
||||
+ if (!priv->txrx_buf)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ if (desc->info.offset + desc->info.length > U32_MAX)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ if (!airoha_snand_supports_op(desc->slave, &desc->info.op_tmpl))
|
||||
+ return -EOPNOTSUPP;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static ssize_t airoha_snand_dirmap_read(struct spi_mem_dirmap_desc *desc,
|
||||
+ u64 offs, size_t len, void *buf)
|
||||
+{
|
||||
+ struct spi_mem_op *op = &desc->info.op_tmpl;
|
||||
+ struct spi_slave *slave = desc->slave;
|
||||
+ struct udevice *bus = slave->dev->parent;
|
||||
+ struct airoha_snand_priv *priv = dev_get_priv(bus);
|
||||
+ u8 *txrx_buf = priv->txrx_buf;
|
||||
+ dma_addr_t dma_addr;
|
||||
+ u32 val, rd_mode;
|
||||
+ int err;
|
||||
+
|
||||
+ switch (op->cmd.opcode) {
|
||||
+ case SPI_NAND_OP_READ_FROM_CACHE_DUAL:
|
||||
+ rd_mode = 1;
|
||||
+ break;
|
||||
+ case SPI_NAND_OP_READ_FROM_CACHE_QUAD:
|
||||
+ rd_mode = 2;
|
||||
+ break;
|
||||
+ default:
|
||||
+ rd_mode = 0;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ err = airoha_snand_set_mode(priv, SPI_MODE_DMA);
|
||||
+ if (err < 0)
|
||||
+ return err;
|
||||
+
|
||||
+ err = airoha_snand_nfi_config(priv);
|
||||
+ if (err)
|
||||
+ goto error_dma_mode_off;
|
||||
+
|
||||
+ dma_addr = dma_map_single(txrx_buf, SPI_NAND_CACHE_SIZE,
|
||||
+ DMA_FROM_DEVICE);
|
||||
+
|
||||
+ /* set dma addr */
|
||||
+ err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_STRADDR,
|
||||
+ dma_addr);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ /* set cust sec size */
|
||||
+ val = priv->nfi_cfg.sec_size * priv->nfi_cfg.sec_num;
|
||||
+ val = FIELD_PREP(SPI_NFI_READ_DATA_BYTE_NUM, val);
|
||||
+ err = regmap_update_bits(priv->regmap_nfi,
|
||||
+ REG_SPI_NFI_SNF_MISC_CTL2,
|
||||
+ SPI_NFI_READ_DATA_BYTE_NUM, val);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ /* set read command */
|
||||
+ err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_RD_CTL2,
|
||||
+ op->cmd.opcode);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ /* set read mode */
|
||||
+ err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_SNF_MISC_CTL,
|
||||
+ FIELD_PREP(SPI_NFI_DATA_READ_WR_MODE, rd_mode));
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ /* set read addr: zero page offset + descriptor read offset */
|
||||
+ err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_RD_CTL3,
|
||||
+ desc->info.offset);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ /* set nfi read */
|
||||
+ err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_CNFG,
|
||||
+ SPI_NFI_OPMODE,
|
||||
+ FIELD_PREP(SPI_NFI_OPMODE, 6));
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ err = regmap_set_bits(priv->regmap_nfi, REG_SPI_NFI_CNFG,
|
||||
+ SPI_NFI_READ_MODE | SPI_NFI_DMA_MODE);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_CMD, 0x0);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ /* trigger dma reading */
|
||||
+ err = regmap_clear_bits(priv->regmap_nfi, REG_SPI_NFI_CON,
|
||||
+ SPI_NFI_RD_TRIG);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ err = regmap_set_bits(priv->regmap_nfi, REG_SPI_NFI_CON,
|
||||
+ SPI_NFI_RD_TRIG);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ err = regmap_read_poll_timeout(priv->regmap_nfi,
|
||||
+ REG_SPI_NFI_SNF_STA_CTL1, val,
|
||||
+ (val & SPI_NFI_READ_FROM_CACHE_DONE),
|
||||
+ 0, 1 * MSEC_PER_SEC);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ /*
|
||||
+ * SPI_NFI_READ_FROM_CACHE_DONE bit must be written at the end
|
||||
+ * of dirmap_read operation even if it is already set.
|
||||
+ */
|
||||
+ err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_SNF_STA_CTL1,
|
||||
+ SPI_NFI_READ_FROM_CACHE_DONE,
|
||||
+ SPI_NFI_READ_FROM_CACHE_DONE);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ err = regmap_read_poll_timeout(priv->regmap_nfi, REG_SPI_NFI_INTR,
|
||||
+ val, (val & SPI_NFI_AHB_DONE), 0,
|
||||
+ 1 * MSEC_PER_SEC);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ /* DMA read need delay for data ready from controller to DRAM */
|
||||
+ udelay(1);
|
||||
+
|
||||
+ dma_unmap_single(dma_addr, SPI_NAND_CACHE_SIZE, DMA_FROM_DEVICE);
|
||||
+
|
||||
+ err = airoha_snand_set_mode(priv, SPI_MODE_MANUAL);
|
||||
+ if (err < 0)
|
||||
+ return err;
|
||||
+
|
||||
+ memcpy(buf, txrx_buf + offs, len);
|
||||
+
|
||||
+ return len;
|
||||
+
|
||||
+error_dma_unmap:
|
||||
+ dma_unmap_single(dma_addr, SPI_NAND_CACHE_SIZE, DMA_FROM_DEVICE);
|
||||
+error_dma_mode_off:
|
||||
+ airoha_snand_set_mode(priv, SPI_MODE_MANUAL);
|
||||
+ return err;
|
||||
+}
|
||||
+
|
||||
+static ssize_t airoha_snand_dirmap_write(struct spi_mem_dirmap_desc *desc,
|
||||
+ u64 offs, size_t len, const void *buf)
|
||||
+{
|
||||
+ struct spi_slave *slave = desc->slave;
|
||||
+ struct udevice *bus = slave->dev->parent;
|
||||
+ struct airoha_snand_priv *priv = dev_get_priv(bus);
|
||||
+ u8 *txrx_buf = priv->txrx_buf;
|
||||
+ dma_addr_t dma_addr;
|
||||
+ u32 wr_mode, val, opcode;
|
||||
+ int err;
|
||||
+
|
||||
+ opcode = desc->info.op_tmpl.cmd.opcode;
|
||||
+ switch (opcode) {
|
||||
+ case SPI_NAND_OP_PROGRAM_LOAD_SINGLE:
|
||||
+ case SPI_NAND_OP_PROGRAM_LOAD_RAMDOM_SINGLE:
|
||||
+ wr_mode = 0;
|
||||
+ break;
|
||||
+ case SPI_NAND_OP_PROGRAM_LOAD_QUAD:
|
||||
+ case SPI_NAND_OP_PROGRAM_LOAD_RAMDON_QUAD:
|
||||
+ wr_mode = 2;
|
||||
+ break;
|
||||
+ default:
|
||||
+ /* unknown opcode */
|
||||
+ return -EOPNOTSUPP;
|
||||
+ }
|
||||
+
|
||||
+ memcpy(txrx_buf + offs, buf, len);
|
||||
+
|
||||
+ err = airoha_snand_set_mode(priv, SPI_MODE_DMA);
|
||||
+ if (err < 0)
|
||||
+ return err;
|
||||
+
|
||||
+ err = airoha_snand_nfi_config(priv);
|
||||
+ if (err)
|
||||
+ goto error_dma_mode_off;
|
||||
+
|
||||
+ dma_addr = dma_map_single(txrx_buf, SPI_NAND_CACHE_SIZE,
|
||||
+ DMA_TO_DEVICE);
|
||||
+
|
||||
+ /* set dma addr */
|
||||
+ err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_STRADDR,
|
||||
+ dma_addr);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ val = FIELD_PREP(SPI_NFI_PROG_LOAD_BYTE_NUM,
|
||||
+ priv->nfi_cfg.sec_size * priv->nfi_cfg.sec_num);
|
||||
+ err = regmap_update_bits(priv->regmap_nfi,
|
||||
+ REG_SPI_NFI_SNF_MISC_CTL2,
|
||||
+ SPI_NFI_PROG_LOAD_BYTE_NUM, val);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ /* set write command */
|
||||
+ err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_PG_CTL1,
|
||||
+ FIELD_PREP(SPI_NFI_PG_LOAD_CMD, opcode));
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ /* set write mode */
|
||||
+ err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_SNF_MISC_CTL,
|
||||
+ FIELD_PREP(SPI_NFI_DATA_READ_WR_MODE, wr_mode));
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ /* set write addr: zero page offset + descriptor write offset */
|
||||
+ err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_PG_CTL2,
|
||||
+ desc->info.offset);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ err = regmap_clear_bits(priv->regmap_nfi, REG_SPI_NFI_CNFG,
|
||||
+ SPI_NFI_READ_MODE);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_CNFG,
|
||||
+ SPI_NFI_OPMODE,
|
||||
+ FIELD_PREP(SPI_NFI_OPMODE, 3));
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ err = regmap_set_bits(priv->regmap_nfi, REG_SPI_NFI_CNFG,
|
||||
+ SPI_NFI_DMA_MODE);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_CMD, 0x80);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ /* trigger dma writing */
|
||||
+ err = regmap_clear_bits(priv->regmap_nfi, REG_SPI_NFI_CON,
|
||||
+ SPI_NFI_WR_TRIG);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ err = regmap_set_bits(priv->regmap_nfi, REG_SPI_NFI_CON,
|
||||
+ SPI_NFI_WR_TRIG);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ err = regmap_read_poll_timeout(priv->regmap_nfi, REG_SPI_NFI_INTR,
|
||||
+ val, (val & SPI_NFI_AHB_DONE), 0,
|
||||
+ 1 * MSEC_PER_SEC);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ err = regmap_read_poll_timeout(priv->regmap_nfi,
|
||||
+ REG_SPI_NFI_SNF_STA_CTL1, val,
|
||||
+ (val & SPI_NFI_LOAD_TO_CACHE_DONE),
|
||||
+ 0, 1 * MSEC_PER_SEC);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ /*
|
||||
+ * SPI_NFI_LOAD_TO_CACHE_DONE bit must be written at the end
|
||||
+ * of dirmap_write operation even if it is already set.
|
||||
+ */
|
||||
+ err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_SNF_STA_CTL1,
|
||||
+ SPI_NFI_LOAD_TO_CACHE_DONE,
|
||||
+ SPI_NFI_LOAD_TO_CACHE_DONE);
|
||||
+ if (err)
|
||||
+ goto error_dma_unmap;
|
||||
+
|
||||
+ dma_unmap_single(dma_addr, SPI_NAND_CACHE_SIZE, DMA_TO_DEVICE);
|
||||
+
|
||||
+ err = airoha_snand_set_mode(priv, SPI_MODE_MANUAL);
|
||||
+ if (err < 0)
|
||||
+ return err;
|
||||
+
|
||||
+ return len;
|
||||
+
|
||||
+error_dma_unmap:
|
||||
+ dma_unmap_single(dma_addr, SPI_NAND_CACHE_SIZE, DMA_TO_DEVICE);
|
||||
+error_dma_mode_off:
|
||||
+ airoha_snand_set_mode(priv, SPI_MODE_MANUAL);
|
||||
+ return err;
|
||||
+}
|
||||
+
|
||||
static int airoha_snand_exec_op(struct spi_slave *slave,
|
||||
const struct spi_mem_op *op)
|
||||
{
|
||||
@@ -696,6 +996,12 @@ static int airoha_snand_probe(struct udevice *dev)
|
||||
struct airoha_snand_priv *priv = dev_get_priv(dev);
|
||||
int ret;
|
||||
|
||||
+ priv->txrx_buf = memalign(ARCH_DMA_MINALIGN, SPI_NAND_CACHE_SIZE);
|
||||
+ if (!priv->txrx_buf) {
|
||||
+ dev_err(dev, "failed to alloacate memory for dirmap\n");
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
ret = regmap_init_mem_index(dev_ofnode(dev), &priv->regmap_ctrl, 0);
|
||||
if (ret) {
|
||||
dev_err(dev, "failed to init spi ctrl regmap\n");
|
||||
@@ -769,6 +1075,9 @@ static int airoha_snand_nfi_setup(struct spi_slave *slave,
|
||||
static const struct spi_controller_mem_ops airoha_snand_mem_ops = {
|
||||
.supports_op = airoha_snand_supports_op,
|
||||
.exec_op = airoha_snand_exec_op,
|
||||
+ .dirmap_create = airoha_snand_dirmap_create,
|
||||
+ .dirmap_read = airoha_snand_dirmap_read,
|
||||
+ .dirmap_write = airoha_snand_dirmap_write,
|
||||
};
|
||||
|
||||
static const struct dm_spi_ops airoha_snfi_spi_ops = {
|
||||
@@ -1,89 +0,0 @@
|
||||
From 2ebbccfa053993d0fe90bee523020a8f796e8988 Mon Sep 17 00:00:00 2001
|
||||
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
Date: Sun, 8 Jun 2025 05:30:22 +0300
|
||||
Subject: [PATCH 5/5] spi: airoha: support of dualio/quadio flash reading
|
||||
commands
|
||||
|
||||
Airoha snfi spi controller supports acceleration of DUAL/QUAD
|
||||
operations, but does not supports DUAL_IO/QUAD_IO operations.
|
||||
Luckily DUAL/QUAD operations do the same as DUAL_IO/QUAD_IO ones,
|
||||
so we can issue corresponding DUAL/QUAD operation instead of
|
||||
DUAL_IO/QUAD_IO one.
|
||||
|
||||
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
---
|
||||
drivers/spi/airoha_snfi_spi.c | 27 +++++++++++++++++++++------
|
||||
1 file changed, 21 insertions(+), 6 deletions(-)
|
||||
|
||||
--- a/drivers/spi/airoha_snfi_spi.c
|
||||
+++ b/drivers/spi/airoha_snfi_spi.c
|
||||
@@ -141,6 +141,7 @@
|
||||
#define SPI_NFI_CUS_SEC_SIZE_EN BIT(16)
|
||||
|
||||
#define REG_SPI_NFI_RD_CTL2 0x0510
|
||||
+#define SPI_NFI_DATA_READ_CMD GENMASK(7, 0)
|
||||
|
||||
#define REG_SPI_NFI_RD_CTL3 0x0514
|
||||
|
||||
@@ -175,7 +176,9 @@
|
||||
#define SPI_NAND_OP_READ_FROM_CACHE_SINGLE 0x03
|
||||
#define SPI_NAND_OP_READ_FROM_CACHE_SINGLE_FAST 0x0b
|
||||
#define SPI_NAND_OP_READ_FROM_CACHE_DUAL 0x3b
|
||||
+#define SPI_NAND_OP_READ_FROM_CACHE_DUALIO 0xbb
|
||||
#define SPI_NAND_OP_READ_FROM_CACHE_QUAD 0x6b
|
||||
+#define SPI_NAND_OP_READ_FROM_CACHE_QUADIO 0xeb
|
||||
#define SPI_NAND_OP_WRITE_ENABLE 0x06
|
||||
#define SPI_NAND_OP_WRITE_DISABLE 0x04
|
||||
#define SPI_NAND_OP_PROGRAM_LOAD_SINGLE 0x02
|
||||
@@ -639,25 +642,37 @@ static int airoha_snand_dirmap_create(struct spi_mem_dirmap_desc *desc)
|
||||
static ssize_t airoha_snand_dirmap_read(struct spi_mem_dirmap_desc *desc,
|
||||
u64 offs, size_t len, void *buf)
|
||||
{
|
||||
- struct spi_mem_op *op = &desc->info.op_tmpl;
|
||||
struct spi_slave *slave = desc->slave;
|
||||
struct udevice *bus = slave->dev->parent;
|
||||
struct airoha_snand_priv *priv = dev_get_priv(bus);
|
||||
u8 *txrx_buf = priv->txrx_buf;
|
||||
dma_addr_t dma_addr;
|
||||
- u32 val, rd_mode;
|
||||
+ u32 val, rd_mode, opcode;
|
||||
int err;
|
||||
|
||||
- switch (op->cmd.opcode) {
|
||||
+ /*
|
||||
+ * DUALIO and QUADIO opcodes are not supported by the spi controller,
|
||||
+ * replace them with supported opcodes.
|
||||
+ */
|
||||
+ opcode = desc->info.op_tmpl.cmd.opcode;
|
||||
+ switch (opcode) {
|
||||
+ case SPI_NAND_OP_READ_FROM_CACHE_SINGLE:
|
||||
+ case SPI_NAND_OP_READ_FROM_CACHE_SINGLE_FAST:
|
||||
+ rd_mode = 0;
|
||||
+ break;
|
||||
case SPI_NAND_OP_READ_FROM_CACHE_DUAL:
|
||||
+ case SPI_NAND_OP_READ_FROM_CACHE_DUALIO:
|
||||
+ opcode = SPI_NAND_OP_READ_FROM_CACHE_DUAL;
|
||||
rd_mode = 1;
|
||||
break;
|
||||
case SPI_NAND_OP_READ_FROM_CACHE_QUAD:
|
||||
+ case SPI_NAND_OP_READ_FROM_CACHE_QUADIO:
|
||||
+ opcode = SPI_NAND_OP_READ_FROM_CACHE_QUAD;
|
||||
rd_mode = 2;
|
||||
break;
|
||||
default:
|
||||
- rd_mode = 0;
|
||||
- break;
|
||||
+ /* unknown opcode */
|
||||
+ return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
err = airoha_snand_set_mode(priv, SPI_MODE_DMA);
|
||||
@@ -688,7 +703,7 @@ static ssize_t airoha_snand_dirmap_read(struct spi_mem_dirmap_desc *desc,
|
||||
|
||||
/* set read command */
|
||||
err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_RD_CTL2,
|
||||
- op->cmd.opcode);
|
||||
+ FIELD_PREP(SPI_NFI_DATA_READ_CMD, opcode));
|
||||
if (err)
|
||||
goto error_dma_unmap;
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
From 073de6579cf8c7599d925852bb0fc7fa50378dd3 Mon Sep 17 00:00:00 2001
|
||||
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
Date: Thu, 14 Aug 2025 18:00:32 +0300
|
||||
Subject: [PATCH 1/4] spi: airoha: avoid setting of page/oob sizes in
|
||||
REG_SPI_NFI_PAGEFMT
|
||||
|
||||
spi-airoha-snfi uses custom sector size in REG_SPI_NFI_SECCUS_SIZE
|
||||
register, so setting of page/oob sizes in REG_SPI_NFI_PAGEFMT is not
|
||||
required.
|
||||
|
||||
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
---
|
||||
drivers/spi/airoha_snfi_spi.c | 38 -----------------------------------
|
||||
1 file changed, 38 deletions(-)
|
||||
|
||||
--- a/drivers/spi/airoha_snfi_spi.c
|
||||
+++ b/drivers/spi/airoha_snfi_spi.c
|
||||
@@ -514,44 +514,6 @@ static int airoha_snand_nfi_config(struct airoha_snand_priv *priv)
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
- /* page format */
|
||||
- switch (priv->nfi_cfg.spare_size) {
|
||||
- case 26:
|
||||
- val = FIELD_PREP(SPI_NFI_SPARE_SIZE, 0x1);
|
||||
- break;
|
||||
- case 27:
|
||||
- val = FIELD_PREP(SPI_NFI_SPARE_SIZE, 0x2);
|
||||
- break;
|
||||
- case 28:
|
||||
- val = FIELD_PREP(SPI_NFI_SPARE_SIZE, 0x3);
|
||||
- break;
|
||||
- default:
|
||||
- val = FIELD_PREP(SPI_NFI_SPARE_SIZE, 0x0);
|
||||
- break;
|
||||
- }
|
||||
-
|
||||
- err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_PAGEFMT,
|
||||
- SPI_NFI_SPARE_SIZE, val);
|
||||
- if (err)
|
||||
- return err;
|
||||
-
|
||||
- switch (priv->nfi_cfg.page_size) {
|
||||
- case 2048:
|
||||
- val = FIELD_PREP(SPI_NFI_PAGE_SIZE, 0x1);
|
||||
- break;
|
||||
- case 4096:
|
||||
- val = FIELD_PREP(SPI_NFI_PAGE_SIZE, 0x2);
|
||||
- break;
|
||||
- default:
|
||||
- val = FIELD_PREP(SPI_NFI_PAGE_SIZE, 0x0);
|
||||
- break;
|
||||
- }
|
||||
-
|
||||
- err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_PAGEFMT,
|
||||
- SPI_NFI_PAGE_SIZE, val);
|
||||
- if (err)
|
||||
- return err;
|
||||
-
|
||||
/* sec num */
|
||||
val = FIELD_PREP(SPI_NFI_SEC_NUM, priv->nfi_cfg.sec_num);
|
||||
err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_CON,
|
||||
@@ -1,195 +0,0 @@
|
||||
From 3bd6ca4ddaae4f0a667a9359c8092d2271006687 Mon Sep 17 00:00:00 2001
|
||||
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
Date: Thu, 14 Aug 2025 18:49:34 +0300
|
||||
Subject: [PATCH 2/4] spi: airoha: reduce the number of modification of
|
||||
REG_SPI_NFI_CNFG and REG_SPI_NFI_SECCUS_SIZE registers
|
||||
|
||||
This just reduce the number of modification of REG_SPI_NFI_CNFG and
|
||||
REG_SPI_NFI_SECCUS_SIZE registers during dirmap operation.
|
||||
|
||||
This patch is a necessary step to avoid usage of flash specific
|
||||
parameters.
|
||||
|
||||
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
---
|
||||
drivers/spi/airoha_snfi_spi.c | 134 +++++++++++++++++++++++++---------
|
||||
1 file changed, 101 insertions(+), 33 deletions(-)
|
||||
|
||||
--- a/drivers/spi/airoha_snfi_spi.c
|
||||
+++ b/drivers/spi/airoha_snfi_spi.c
|
||||
@@ -641,7 +641,47 @@ static ssize_t airoha_snand_dirmap_read(struct spi_mem_dirmap_desc *desc,
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
- err = airoha_snand_nfi_config(priv);
|
||||
+ /* NFI reset */
|
||||
+ err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_CON,
|
||||
+ SPI_NFI_FIFO_FLUSH | SPI_NFI_RST);
|
||||
+ if (err)
|
||||
+ goto error_dma_mode_off;
|
||||
+
|
||||
+ /* NFI configure:
|
||||
+ * - No AutoFDM (custom sector size (SECCUS) register will be used)
|
||||
+ * - No SoC's hardware ECC (flash internal ECC will be used)
|
||||
+ * - Use burst mode (faster, but requires 16 byte alignment for addresses)
|
||||
+ * - Setup for reading (SPI_NFI_READ_MODE)
|
||||
+ * - Setup reading command: FIELD_PREP(SPI_NFI_OPMODE, 6)
|
||||
+ * - Use DMA instead of PIO for data reading
|
||||
+ * - Use AHB bus for DMA transfer
|
||||
+ */
|
||||
+ err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_CNFG,
|
||||
+ SPI_NFI_DMA_MODE |
|
||||
+ SPI_NFI_READ_MODE |
|
||||
+ SPI_NFI_DMA_BURST_EN |
|
||||
+ SPI_NFI_HW_ECC_EN |
|
||||
+ SPI_NFI_AUTO_FDM_EN |
|
||||
+ SPI_NFI_OPMODE,
|
||||
+ SPI_NFI_DMA_MODE |
|
||||
+ SPI_NFI_READ_MODE |
|
||||
+ SPI_NFI_DMA_BURST_EN |
|
||||
+ FIELD_PREP(SPI_NFI_OPMODE, 6));
|
||||
+
|
||||
+ /* Set number of sector will be read */
|
||||
+ val = FIELD_PREP(SPI_NFI_SEC_NUM, priv->nfi_cfg.sec_num);
|
||||
+ err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_CON,
|
||||
+ SPI_NFI_SEC_NUM, val);
|
||||
+ if (err)
|
||||
+ goto error_dma_mode_off;
|
||||
+
|
||||
+ /* Set custom sector size */
|
||||
+ val = priv->nfi_cfg.sec_size;
|
||||
+ err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_SECCUS_SIZE,
|
||||
+ SPI_NFI_CUS_SEC_SIZE |
|
||||
+ SPI_NFI_CUS_SEC_SIZE_EN,
|
||||
+ FIELD_PREP(SPI_NFI_CUS_SEC_SIZE, val) |
|
||||
+ SPI_NFI_CUS_SEC_SIZE_EN);
|
||||
if (err)
|
||||
goto error_dma_mode_off;
|
||||
|
||||
@@ -654,7 +694,14 @@ static ssize_t airoha_snand_dirmap_read(struct spi_mem_dirmap_desc *desc,
|
||||
if (err)
|
||||
goto error_dma_unmap;
|
||||
|
||||
- /* set cust sec size */
|
||||
+ /*
|
||||
+ * Setup transfer length
|
||||
+ * ---------------------
|
||||
+ * The following rule MUST be met:
|
||||
+ * transfer_length =
|
||||
+ * = NFI_SNF_MISC_CTL2.read_data_byte_number =
|
||||
+ * = NFI_CON.sector_number * NFI_SECCUS.custom_sector_size
|
||||
+ */
|
||||
val = priv->nfi_cfg.sec_size * priv->nfi_cfg.sec_num;
|
||||
val = FIELD_PREP(SPI_NFI_READ_DATA_BYTE_NUM, val);
|
||||
err = regmap_update_bits(priv->regmap_nfi,
|
||||
@@ -681,18 +728,6 @@ static ssize_t airoha_snand_dirmap_read(struct spi_mem_dirmap_desc *desc,
|
||||
if (err)
|
||||
goto error_dma_unmap;
|
||||
|
||||
- /* set nfi read */
|
||||
- err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_CNFG,
|
||||
- SPI_NFI_OPMODE,
|
||||
- FIELD_PREP(SPI_NFI_OPMODE, 6));
|
||||
- if (err)
|
||||
- goto error_dma_unmap;
|
||||
-
|
||||
- err = regmap_set_bits(priv->regmap_nfi, REG_SPI_NFI_CNFG,
|
||||
- SPI_NFI_READ_MODE | SPI_NFI_DMA_MODE);
|
||||
- if (err)
|
||||
- goto error_dma_unmap;
|
||||
-
|
||||
err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_CMD, 0x0);
|
||||
if (err)
|
||||
goto error_dma_unmap;
|
||||
@@ -783,7 +818,48 @@ static ssize_t airoha_snand_dirmap_write(struct spi_mem_dirmap_desc *desc,
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
- err = airoha_snand_nfi_config(priv);
|
||||
+ /* NFI reset */
|
||||
+ err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_CON,
|
||||
+ SPI_NFI_FIFO_FLUSH | SPI_NFI_RST);
|
||||
+ if (err)
|
||||
+ goto error_dma_mode_off;
|
||||
+
|
||||
+ /*
|
||||
+ * NFI configure:
|
||||
+ * - No AutoFDM (custom sector size (SECCUS) register will be used)
|
||||
+ * - No SoC's hardware ECC (flash internal ECC will be used)
|
||||
+ * - Use burst mode (faster, but requires 16 byte alignment for addresses)
|
||||
+ * - Setup for writing (SPI_NFI_READ_MODE bit is cleared)
|
||||
+ * - Setup writing command: FIELD_PREP(SPI_NFI_OPMODE, 3)
|
||||
+ * - Use DMA instead of PIO for data writing
|
||||
+ */
|
||||
+ err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_CNFG,
|
||||
+ SPI_NFI_DMA_MODE |
|
||||
+ SPI_NFI_READ_MODE |
|
||||
+ SPI_NFI_DMA_BURST_EN |
|
||||
+ SPI_NFI_HW_ECC_EN |
|
||||
+ SPI_NFI_AUTO_FDM_EN |
|
||||
+ SPI_NFI_OPMODE,
|
||||
+ SPI_NFI_DMA_MODE |
|
||||
+ SPI_NFI_DMA_BURST_EN |
|
||||
+ FIELD_PREP(SPI_NFI_OPMODE, 3));
|
||||
+ if (err)
|
||||
+ goto error_dma_mode_off;
|
||||
+
|
||||
+ /* Set number of sector will be written */
|
||||
+ val = FIELD_PREP(SPI_NFI_SEC_NUM, priv->nfi_cfg.sec_num);
|
||||
+ err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_CON,
|
||||
+ SPI_NFI_SEC_NUM, val);
|
||||
+ if (err)
|
||||
+ goto error_dma_mode_off;
|
||||
+
|
||||
+ /* Set custom sector size */
|
||||
+ val = priv->nfi_cfg.sec_size;
|
||||
+ err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_SECCUS_SIZE,
|
||||
+ SPI_NFI_CUS_SEC_SIZE |
|
||||
+ SPI_NFI_CUS_SEC_SIZE_EN,
|
||||
+ FIELD_PREP(SPI_NFI_CUS_SEC_SIZE, val) |
|
||||
+ SPI_NFI_CUS_SEC_SIZE_EN);
|
||||
if (err)
|
||||
goto error_dma_mode_off;
|
||||
|
||||
@@ -796,8 +872,16 @@ static ssize_t airoha_snand_dirmap_write(struct spi_mem_dirmap_desc *desc,
|
||||
if (err)
|
||||
goto error_dma_unmap;
|
||||
|
||||
- val = FIELD_PREP(SPI_NFI_PROG_LOAD_BYTE_NUM,
|
||||
- priv->nfi_cfg.sec_size * priv->nfi_cfg.sec_num);
|
||||
+ /*
|
||||
+ * Setup transfer length
|
||||
+ * ---------------------
|
||||
+ * The following rule MUST be met:
|
||||
+ * transfer_length =
|
||||
+ * = NFI_SNF_MISC_CTL2.write_data_byte_number =
|
||||
+ * = NFI_CON.sector_number * NFI_SECCUS.custom_sector_size
|
||||
+ */
|
||||
+ val = priv->nfi_cfg.sec_size * priv->nfi_cfg.sec_num;
|
||||
+ val = FIELD_PREP(SPI_NFI_PROG_LOAD_BYTE_NUM, val);
|
||||
err = regmap_update_bits(priv->regmap_nfi,
|
||||
REG_SPI_NFI_SNF_MISC_CTL2,
|
||||
SPI_NFI_PROG_LOAD_BYTE_NUM, val);
|
||||
@@ -822,22 +906,6 @@ static ssize_t airoha_snand_dirmap_write(struct spi_mem_dirmap_desc *desc,
|
||||
if (err)
|
||||
goto error_dma_unmap;
|
||||
|
||||
- err = regmap_clear_bits(priv->regmap_nfi, REG_SPI_NFI_CNFG,
|
||||
- SPI_NFI_READ_MODE);
|
||||
- if (err)
|
||||
- goto error_dma_unmap;
|
||||
-
|
||||
- err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_CNFG,
|
||||
- SPI_NFI_OPMODE,
|
||||
- FIELD_PREP(SPI_NFI_OPMODE, 3));
|
||||
- if (err)
|
||||
- goto error_dma_unmap;
|
||||
-
|
||||
- err = regmap_set_bits(priv->regmap_nfi, REG_SPI_NFI_CNFG,
|
||||
- SPI_NFI_DMA_MODE);
|
||||
- if (err)
|
||||
- goto error_dma_unmap;
|
||||
-
|
||||
err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_CMD, 0x80);
|
||||
if (err)
|
||||
goto error_dma_unmap;
|
||||
@@ -1,135 +0,0 @@
|
||||
From 8e6cba428ce48005b5b8be64c2a08c98d04865e9 Mon Sep 17 00:00:00 2001
|
||||
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
Date: Thu, 14 Aug 2025 22:47:17 +0300
|
||||
Subject: [PATCH 3/4] spi: airoha: set custom sector size equal to flash page
|
||||
size
|
||||
|
||||
Set custom sector size equal to flash page size including oob. Thus we
|
||||
will always read a single sector. The maximum custom sector size is
|
||||
8187, so all possible flash sector sizes are supported.
|
||||
|
||||
This patch is a necessary step to avoid usage of flash specific
|
||||
parameters.
|
||||
|
||||
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
---
|
||||
drivers/spi/airoha_snfi_spi.c | 35 +++++++++++++++++++----------------
|
||||
1 file changed, 19 insertions(+), 16 deletions(-)
|
||||
|
||||
--- a/drivers/spi/airoha_snfi_spi.c
|
||||
+++ b/drivers/spi/airoha_snfi_spi.c
|
||||
@@ -515,7 +515,7 @@ static int airoha_snand_nfi_config(struct airoha_snand_priv *priv)
|
||||
return err;
|
||||
|
||||
/* sec num */
|
||||
- val = FIELD_PREP(SPI_NFI_SEC_NUM, priv->nfi_cfg.sec_num);
|
||||
+ val = FIELD_PREP(SPI_NFI_SEC_NUM, 1);
|
||||
err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_CON,
|
||||
SPI_NFI_SEC_NUM, val);
|
||||
if (err)
|
||||
@@ -528,7 +528,8 @@ static int airoha_snand_nfi_config(struct airoha_snand_priv *priv)
|
||||
return err;
|
||||
|
||||
/* set cust sec size */
|
||||
- val = FIELD_PREP(SPI_NFI_CUS_SEC_SIZE, priv->nfi_cfg.sec_size);
|
||||
+ val = FIELD_PREP(SPI_NFI_CUS_SEC_SIZE,
|
||||
+ priv->nfi_cfg.sec_size * priv->nfi_cfg.sec_num);
|
||||
return regmap_update_bits(priv->regmap_nfi,
|
||||
REG_SPI_NFI_SECCUS_SIZE,
|
||||
SPI_NFI_CUS_SEC_SIZE, val);
|
||||
@@ -610,8 +611,11 @@ static ssize_t airoha_snand_dirmap_read(struct spi_mem_dirmap_desc *desc,
|
||||
u8 *txrx_buf = priv->txrx_buf;
|
||||
dma_addr_t dma_addr;
|
||||
u32 val, rd_mode, opcode;
|
||||
+ size_t bytes;
|
||||
int err;
|
||||
|
||||
+ bytes = priv->nfi_cfg.sec_num * priv->nfi_cfg.sec_size;
|
||||
+
|
||||
/*
|
||||
* DUALIO and QUADIO opcodes are not supported by the spi controller,
|
||||
* replace them with supported opcodes.
|
||||
@@ -669,18 +673,17 @@ static ssize_t airoha_snand_dirmap_read(struct spi_mem_dirmap_desc *desc,
|
||||
FIELD_PREP(SPI_NFI_OPMODE, 6));
|
||||
|
||||
/* Set number of sector will be read */
|
||||
- val = FIELD_PREP(SPI_NFI_SEC_NUM, priv->nfi_cfg.sec_num);
|
||||
err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_CON,
|
||||
- SPI_NFI_SEC_NUM, val);
|
||||
+ SPI_NFI_SEC_NUM,
|
||||
+ FIELD_PREP(SPI_NFI_SEC_NUM, 1));
|
||||
if (err)
|
||||
goto error_dma_mode_off;
|
||||
|
||||
/* Set custom sector size */
|
||||
- val = priv->nfi_cfg.sec_size;
|
||||
err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_SECCUS_SIZE,
|
||||
SPI_NFI_CUS_SEC_SIZE |
|
||||
SPI_NFI_CUS_SEC_SIZE_EN,
|
||||
- FIELD_PREP(SPI_NFI_CUS_SEC_SIZE, val) |
|
||||
+ FIELD_PREP(SPI_NFI_CUS_SEC_SIZE, bytes) |
|
||||
SPI_NFI_CUS_SEC_SIZE_EN);
|
||||
if (err)
|
||||
goto error_dma_mode_off;
|
||||
@@ -702,11 +705,10 @@ static ssize_t airoha_snand_dirmap_read(struct spi_mem_dirmap_desc *desc,
|
||||
* = NFI_SNF_MISC_CTL2.read_data_byte_number =
|
||||
* = NFI_CON.sector_number * NFI_SECCUS.custom_sector_size
|
||||
*/
|
||||
- val = priv->nfi_cfg.sec_size * priv->nfi_cfg.sec_num;
|
||||
- val = FIELD_PREP(SPI_NFI_READ_DATA_BYTE_NUM, val);
|
||||
err = regmap_update_bits(priv->regmap_nfi,
|
||||
REG_SPI_NFI_SNF_MISC_CTL2,
|
||||
- SPI_NFI_READ_DATA_BYTE_NUM, val);
|
||||
+ SPI_NFI_READ_DATA_BYTE_NUM,
|
||||
+ FIELD_PREP(SPI_NFI_READ_DATA_BYTE_NUM, bytes));
|
||||
if (err)
|
||||
goto error_dma_unmap;
|
||||
|
||||
@@ -795,8 +797,11 @@ static ssize_t airoha_snand_dirmap_write(struct spi_mem_dirmap_desc *desc,
|
||||
u8 *txrx_buf = priv->txrx_buf;
|
||||
dma_addr_t dma_addr;
|
||||
u32 wr_mode, val, opcode;
|
||||
+ size_t bytes;
|
||||
int err;
|
||||
|
||||
+ bytes = priv->nfi_cfg.sec_num * priv->nfi_cfg.sec_size;
|
||||
+
|
||||
opcode = desc->info.op_tmpl.cmd.opcode;
|
||||
switch (opcode) {
|
||||
case SPI_NAND_OP_PROGRAM_LOAD_SINGLE:
|
||||
@@ -847,18 +852,17 @@ static ssize_t airoha_snand_dirmap_write(struct spi_mem_dirmap_desc *desc,
|
||||
goto error_dma_mode_off;
|
||||
|
||||
/* Set number of sector will be written */
|
||||
- val = FIELD_PREP(SPI_NFI_SEC_NUM, priv->nfi_cfg.sec_num);
|
||||
err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_CON,
|
||||
- SPI_NFI_SEC_NUM, val);
|
||||
+ SPI_NFI_SEC_NUM,
|
||||
+ FIELD_PREP(SPI_NFI_SEC_NUM, 1));
|
||||
if (err)
|
||||
goto error_dma_mode_off;
|
||||
|
||||
/* Set custom sector size */
|
||||
- val = priv->nfi_cfg.sec_size;
|
||||
err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_SECCUS_SIZE,
|
||||
SPI_NFI_CUS_SEC_SIZE |
|
||||
SPI_NFI_CUS_SEC_SIZE_EN,
|
||||
- FIELD_PREP(SPI_NFI_CUS_SEC_SIZE, val) |
|
||||
+ FIELD_PREP(SPI_NFI_CUS_SEC_SIZE, bytes) |
|
||||
SPI_NFI_CUS_SEC_SIZE_EN);
|
||||
if (err)
|
||||
goto error_dma_mode_off;
|
||||
@@ -880,11 +884,10 @@ static ssize_t airoha_snand_dirmap_write(struct spi_mem_dirmap_desc *desc,
|
||||
* = NFI_SNF_MISC_CTL2.write_data_byte_number =
|
||||
* = NFI_CON.sector_number * NFI_SECCUS.custom_sector_size
|
||||
*/
|
||||
- val = priv->nfi_cfg.sec_size * priv->nfi_cfg.sec_num;
|
||||
- val = FIELD_PREP(SPI_NFI_PROG_LOAD_BYTE_NUM, val);
|
||||
err = regmap_update_bits(priv->regmap_nfi,
|
||||
REG_SPI_NFI_SNF_MISC_CTL2,
|
||||
- SPI_NFI_PROG_LOAD_BYTE_NUM, val);
|
||||
+ SPI_NFI_PROG_LOAD_BYTE_NUM,
|
||||
+ FIELD_PREP(SPI_NFI_PROG_LOAD_BYTE_NUM, bytes));
|
||||
if (err)
|
||||
goto error_dma_unmap;
|
||||
|
||||
@@ -1,170 +0,0 @@
|
||||
From f015b0211a36bf818023c82ab44644631987d23c Mon Sep 17 00:00:00 2001
|
||||
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
Date: Thu, 14 Aug 2025 23:56:24 +0300
|
||||
Subject: [PATCH 4/4] spi: airoha: avoid usage of flash specific parameters
|
||||
|
||||
The spinand driver do 3 type of dirmap requests:
|
||||
* read/write whole flash page without oob
|
||||
(offs = 0, len = page_size)
|
||||
* read/write whole flash page including oob
|
||||
(offs = 0, len = page_size + oob_size)
|
||||
* read/write oob area only
|
||||
(offs = page_size, len = oob_size)
|
||||
|
||||
The trick is:
|
||||
* read/write a single "sector"
|
||||
* set a custom sector size equal to offs + len. It's a bit safer to
|
||||
round up "sector size" value 64.
|
||||
* set the transfer length equal to custom sector size
|
||||
|
||||
And it works!
|
||||
|
||||
Thus we can find all data directly from dirmap request, so flash specific
|
||||
parameters is not needed anymore. Also
|
||||
* airoha_snand_nfi_config(),
|
||||
* airoha_snand_nfi_setup()
|
||||
functions becomes unnecessary.
|
||||
|
||||
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
---
|
||||
drivers/spi/airoha_snfi_spi.c | 94 ++---------------------------------
|
||||
1 file changed, 4 insertions(+), 90 deletions(-)
|
||||
|
||||
--- a/drivers/spi/airoha_snfi_spi.c
|
||||
+++ b/drivers/spi/airoha_snfi_spi.c
|
||||
@@ -218,13 +218,6 @@ struct airoha_snand_priv {
|
||||
struct regmap *regmap_nfi;
|
||||
struct clk *spi_clk;
|
||||
|
||||
- struct {
|
||||
- size_t page_size;
|
||||
- size_t sec_size;
|
||||
- u8 sec_num;
|
||||
- u8 spare_size;
|
||||
- } nfi_cfg;
|
||||
-
|
||||
u8 *txrx_buf;
|
||||
};
|
||||
|
||||
@@ -486,55 +479,6 @@ static int airoha_snand_nfi_init(struct airoha_snand_priv *priv)
|
||||
SPI_NFI_ALL_IRQ_EN, SPI_NFI_AHB_DONE_EN);
|
||||
}
|
||||
|
||||
-static int airoha_snand_nfi_config(struct airoha_snand_priv *priv)
|
||||
-{
|
||||
- int err;
|
||||
- u32 val;
|
||||
-
|
||||
- err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_CON,
|
||||
- SPI_NFI_FIFO_FLUSH | SPI_NFI_RST);
|
||||
- if (err)
|
||||
- return err;
|
||||
-
|
||||
- /* auto FDM */
|
||||
- err = regmap_clear_bits(priv->regmap_nfi, REG_SPI_NFI_CNFG,
|
||||
- SPI_NFI_AUTO_FDM_EN);
|
||||
- if (err)
|
||||
- return err;
|
||||
-
|
||||
- /* HW ECC */
|
||||
- err = regmap_clear_bits(priv->regmap_nfi, REG_SPI_NFI_CNFG,
|
||||
- SPI_NFI_HW_ECC_EN);
|
||||
- if (err)
|
||||
- return err;
|
||||
-
|
||||
- /* DMA Burst */
|
||||
- err = regmap_set_bits(priv->regmap_nfi, REG_SPI_NFI_CNFG,
|
||||
- SPI_NFI_DMA_BURST_EN);
|
||||
- if (err)
|
||||
- return err;
|
||||
-
|
||||
- /* sec num */
|
||||
- val = FIELD_PREP(SPI_NFI_SEC_NUM, 1);
|
||||
- err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_CON,
|
||||
- SPI_NFI_SEC_NUM, val);
|
||||
- if (err)
|
||||
- return err;
|
||||
-
|
||||
- /* enable cust sec size */
|
||||
- err = regmap_set_bits(priv->regmap_nfi, REG_SPI_NFI_SECCUS_SIZE,
|
||||
- SPI_NFI_CUS_SEC_SIZE_EN);
|
||||
- if (err)
|
||||
- return err;
|
||||
-
|
||||
- /* set cust sec size */
|
||||
- val = FIELD_PREP(SPI_NFI_CUS_SEC_SIZE,
|
||||
- priv->nfi_cfg.sec_size * priv->nfi_cfg.sec_num);
|
||||
- return regmap_update_bits(priv->regmap_nfi,
|
||||
- REG_SPI_NFI_SECCUS_SIZE,
|
||||
- SPI_NFI_CUS_SEC_SIZE, val);
|
||||
-}
|
||||
-
|
||||
static bool airoha_snand_is_page_ops(const struct spi_mem_op *op)
|
||||
{
|
||||
if (op->addr.nbytes != 2)
|
||||
@@ -614,7 +558,8 @@ static ssize_t airoha_snand_dirmap_read(struct spi_mem_dirmap_desc *desc,
|
||||
size_t bytes;
|
||||
int err;
|
||||
|
||||
- bytes = priv->nfi_cfg.sec_num * priv->nfi_cfg.sec_size;
|
||||
+ /* minimum oob size is 64 */
|
||||
+ bytes = round_up(offs + len, 64);
|
||||
|
||||
/*
|
||||
* DUALIO and QUADIO opcodes are not supported by the spi controller,
|
||||
@@ -800,7 +745,8 @@ static ssize_t airoha_snand_dirmap_write(struct spi_mem_dirmap_desc *desc,
|
||||
size_t bytes;
|
||||
int err;
|
||||
|
||||
- bytes = priv->nfi_cfg.sec_num * priv->nfi_cfg.sec_size;
|
||||
+ /* minimum oob size is 64 */
|
||||
+ bytes = round_up(offs + len, 64);
|
||||
|
||||
opcode = desc->info.op_tmpl.cmd.opcode;
|
||||
switch (opcode) {
|
||||
@@ -1089,37 +1035,6 @@ static int airoha_snand_nfi_set_mode(struct udevice *bus, uint mode)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int airoha_snand_nfi_setup(struct spi_slave *slave,
|
||||
- const struct spinand_info *spinand_info)
|
||||
-{
|
||||
- struct udevice *bus = slave->dev->parent;
|
||||
- struct airoha_snand_priv *priv;
|
||||
- u32 sec_size, sec_num;
|
||||
- int pagesize, oobsize;
|
||||
-
|
||||
- priv = dev_get_priv(bus);
|
||||
-
|
||||
- pagesize = spinand_info->memorg.pagesize;
|
||||
- oobsize = spinand_info->memorg.oobsize;
|
||||
-
|
||||
- if (pagesize == 2 * 1024)
|
||||
- sec_num = 4;
|
||||
- else if (pagesize == 4 * 1024)
|
||||
- sec_num = 8;
|
||||
- else
|
||||
- sec_num = 1;
|
||||
-
|
||||
- sec_size = (pagesize + oobsize) / sec_num;
|
||||
-
|
||||
- /* init default value */
|
||||
- priv->nfi_cfg.sec_size = sec_size;
|
||||
- priv->nfi_cfg.sec_num = sec_num;
|
||||
- priv->nfi_cfg.page_size = round_down(sec_size * sec_num, 1024);
|
||||
- priv->nfi_cfg.spare_size = 16;
|
||||
-
|
||||
- return airoha_snand_nfi_config(priv);
|
||||
-}
|
||||
-
|
||||
static const struct spi_controller_mem_ops airoha_snand_mem_ops = {
|
||||
.supports_op = airoha_snand_supports_op,
|
||||
.exec_op = airoha_snand_exec_op,
|
||||
@@ -1132,7 +1047,6 @@ static const struct dm_spi_ops airoha_snfi_spi_ops = {
|
||||
.mem_ops = &airoha_snand_mem_ops,
|
||||
.set_speed = airoha_snand_nfi_set_speed,
|
||||
.set_mode = airoha_snand_nfi_set_mode,
|
||||
- .setup_for_spinand = airoha_snand_nfi_setup,
|
||||
};
|
||||
|
||||
static const struct udevice_id airoha_snand_ids[] = {
|
||||
@@ -1,729 +0,0 @@
|
||||
From 0ee8053a17e6f4d6dbde0828e775309cba38c171 Mon Sep 17 00:00:00 2001
|
||||
From: Christian Marangi <ansuelsmth@gmail.com>
|
||||
Date: Tue, 29 Apr 2025 13:06:59 +0200
|
||||
Subject: [PATCH 1/3] airoha: add support for Airoha AN7583 SoC
|
||||
|
||||
Add support for Airoha AN7583 SoC. This adds the Kconfig and Makefile
|
||||
entry for the SoC, DTSI and initial config for it. Also add the code for
|
||||
CPU and RAM initialization. Everything is mostly based on AN7581 that
|
||||
share lots of common piece.
|
||||
|
||||
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
||||
---
|
||||
arch/arm/dts/an7583-evb.dts | 67 +++++
|
||||
arch/arm/dts/an7583.dtsi | 387 +++++++++++++++++++++++++++
|
||||
arch/arm/mach-airoha/Kconfig | 14 +
|
||||
arch/arm/mach-airoha/Makefile | 1 +
|
||||
arch/arm/mach-airoha/an7583/Makefile | 3 +
|
||||
arch/arm/mach-airoha/an7583/init.c | 47 ++++
|
||||
board/airoha/an7583/MAINTAINERS | 5 +
|
||||
board/airoha/an7583/Makefile | 3 +
|
||||
board/airoha/an7583/an7583_rfb.c | 16 ++
|
||||
configs/an7583_evb_defconfig | 81 ++++++
|
||||
include/configs/an7583.h | 19 ++
|
||||
11 files changed, 643 insertions(+)
|
||||
create mode 100644 arch/arm/dts/an7583-evb.dts
|
||||
create mode 100644 arch/arm/dts/an7583.dtsi
|
||||
create mode 100644 arch/arm/mach-airoha/an7583/Makefile
|
||||
create mode 100644 arch/arm/mach-airoha/an7583/init.c
|
||||
create mode 100644 board/airoha/an7583/MAINTAINERS
|
||||
create mode 100644 board/airoha/an7583/Makefile
|
||||
create mode 100644 board/airoha/an7583/an7583_rfb.c
|
||||
create mode 100644 configs/an7583_evb_defconfig
|
||||
create mode 100644 include/configs/an7583.h
|
||||
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/dts/an7583-evb.dts
|
||||
@@ -0,0 +1,67 @@
|
||||
+// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
|
||||
+/dts-v1/;
|
||||
+
|
||||
+/* Bootloader installs ATF here */
|
||||
+/memreserve/ 0x80000000 0x200000;
|
||||
+
|
||||
+#include <dt-bindings/leds/common.h>
|
||||
+#include <dt-bindings/gpio/gpio.h>
|
||||
+#include <dt-bindings/input/input.h>
|
||||
+#include "an7583.dtsi"
|
||||
+
|
||||
+/ {
|
||||
+ model = "Airoha AN7583 Evaluation Board";
|
||||
+ compatible = "airoha,an7583-evb", "airoha,an7583", "airoha,en7583";
|
||||
+
|
||||
+ aliases {
|
||||
+ serial0 = &uart1;
|
||||
+ };
|
||||
+
|
||||
+ chosen {
|
||||
+ bootargs = "console=ttyS0,115200 earlycon";
|
||||
+ stdout-path = "serial0:115200n8";
|
||||
+ linux,usable-memory-range = <0x0 0x80200000 0x0 0x1fe00000>;
|
||||
+ };
|
||||
+
|
||||
+ /* When running as a first-stage bootloader this isn't filled in automatically */
|
||||
+ memory@80000000 {
|
||||
+ device_type = "memory";
|
||||
+ reg = <0x0 0x80000000 0x0 0x20000000>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&an7583_pinctrl {
|
||||
+ pcie0_rst_pins: pcie0-rst-pins {
|
||||
+ conf {
|
||||
+ pins = "pcie_reset0";
|
||||
+ drive-open-drain = <1>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ pcie1_rst_pins: pcie1-rst-pins {
|
||||
+ conf {
|
||||
+ pins = "pcie_reset1";
|
||||
+ drive-open-drain = <1>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&pcie0 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pcie0_rst_pins>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&pcie1 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pcie1_rst_pins>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&i2c0 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&snfi {
|
||||
+ status = "okay";
|
||||
+};
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/dts/an7583.dtsi
|
||||
@@ -0,0 +1,387 @@
|
||||
+// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
|
||||
+
|
||||
+#include <dt-bindings/interrupt-controller/irq.h>
|
||||
+#include <dt-bindings/interrupt-controller/arm-gic.h>
|
||||
+#include <dt-bindings/clock/en7523-clk.h>
|
||||
+#include <dt-bindings/reset/airoha,an7583-reset.h>
|
||||
+#include <dt-bindings/leds/common.h>
|
||||
+#include <dt-bindings/thermal/thermal.h>
|
||||
+
|
||||
+/ {
|
||||
+ interrupt-parent = <&gic>;
|
||||
+ #address-cells = <2>;
|
||||
+ #size-cells = <2>;
|
||||
+
|
||||
+ reserved-memory {
|
||||
+ #address-cells = <2>;
|
||||
+ #size-cells = <2>;
|
||||
+ ranges;
|
||||
+
|
||||
+ atf-reserved-memory@80000000 {
|
||||
+ no-map;
|
||||
+ reg = <0x0 0x80000000 0x0 0x40000>;
|
||||
+ };
|
||||
+
|
||||
+ npu-binary@84000000 {
|
||||
+ no-map;
|
||||
+ reg = <0x0 0x84000000 0x0 0xa00000>;
|
||||
+ };
|
||||
+
|
||||
+ npu-flag@84b0000 {
|
||||
+ no-map;
|
||||
+ reg = <0x0 0x84b00000 0x0 0x100000>;
|
||||
+ };
|
||||
+
|
||||
+ npu-pkt@85000000 {
|
||||
+ no-map;
|
||||
+ reg = <0x0 0x85000000 0x0 0x1a00000>;
|
||||
+ };
|
||||
+
|
||||
+ npu-phyaddr@86b00000 {
|
||||
+ no-map;
|
||||
+ reg = <0x0 0x86b00000 0x0 0x100000>;
|
||||
+ };
|
||||
+
|
||||
+ npu-rxdesc@86d00000 {
|
||||
+ no-map;
|
||||
+ reg = <0x0 0x86d00000 0x0 0x100000>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ psci {
|
||||
+ compatible = "arm,psci-1.0";
|
||||
+ method = "smc";
|
||||
+ };
|
||||
+
|
||||
+ cpus {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+
|
||||
+ cpu-map {
|
||||
+ cluster0 {
|
||||
+ core0 {
|
||||
+ cpu = <&cpu0>;
|
||||
+ };
|
||||
+
|
||||
+ core1 {
|
||||
+ cpu = <&cpu1>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ cpu0: cpu@0 {
|
||||
+ device_type = "cpu";
|
||||
+ compatible = "arm,cortex-a53";
|
||||
+ reg = <0x0>;
|
||||
+ enable-method = "psci";
|
||||
+ next-level-cache = <&l2>;
|
||||
+ #cooling-cells = <2>;
|
||||
+ };
|
||||
+
|
||||
+ cpu1: cpu@1 {
|
||||
+ device_type = "cpu";
|
||||
+ compatible = "arm,cortex-a53";
|
||||
+ reg = <0x1>;
|
||||
+ enable-method = "psci";
|
||||
+ next-level-cache = <&l2>;
|
||||
+ #cooling-cells = <2>;
|
||||
+ };
|
||||
+
|
||||
+ l2: l2-cache {
|
||||
+ compatible = "cache";
|
||||
+ cache-size = <0x80000>;
|
||||
+ cache-line-size = <64>;
|
||||
+ cache-level = <2>;
|
||||
+ cache-unified;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ timer {
|
||||
+ compatible = "arm,armv8-timer";
|
||||
+ interrupt-parent = <&gic>;
|
||||
+ interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW>,
|
||||
+ <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW>,
|
||||
+ <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW>,
|
||||
+ <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>;
|
||||
+ };
|
||||
+
|
||||
+ soc {
|
||||
+ compatible = "simple-bus";
|
||||
+ #address-cells = <2>;
|
||||
+ #size-cells = <2>;
|
||||
+ ranges;
|
||||
+
|
||||
+ gic: interrupt-controller@9000000 {
|
||||
+ compatible = "arm,gic-v3";
|
||||
+ interrupt-controller;
|
||||
+ #interrupt-cells = <3>;
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+ reg = <0x0 0x09000000 0x0 0x20000>,
|
||||
+ <0x0 0x09080000 0x0 0x80000>,
|
||||
+ <0x0 0x09400000 0x0 0x2000>,
|
||||
+ <0x0 0x09500000 0x0 0x2000>,
|
||||
+ <0x0 0x09600000 0x0 0x20000>;
|
||||
+ interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_LOW>;
|
||||
+ };
|
||||
+
|
||||
+ chip_scu: syscon@1fa20000 {
|
||||
+ compatible = "airoha,en7581-chip-scu", "syscon";
|
||||
+ reg = <0x0 0x1fa20000 0x0 0x388>;
|
||||
+ };
|
||||
+
|
||||
+ syscon@1fbe3400 {
|
||||
+ compatible = "airoha,en7581-pbus-csr", "syscon";
|
||||
+ reg = <0x0 0x1fbe3400 0x0 0xff>;
|
||||
+ };
|
||||
+
|
||||
+ system-controller@1fa20000 {
|
||||
+ compatible = "syscon", "simple-mfd";
|
||||
+ reg = <0x0 0x1fb00000 0x0 0x970>;
|
||||
+
|
||||
+ scuclk: scuclk {
|
||||
+ compatible = "airoha,an7583-scu";
|
||||
+ #clock-cells = <1>;
|
||||
+ #reset-cells = <1>;
|
||||
+ };
|
||||
+
|
||||
+ mdio_0: mdio-0 {
|
||||
+ compatible = "airoha,an7583-mdio";
|
||||
+ resets = <&scuclk AN7583_MDIO0>;
|
||||
+
|
||||
+ airoha,bus-id = <0>;
|
||||
+ };
|
||||
+
|
||||
+ mdio_1: mdio-1 {
|
||||
+ compatible = "airoha,an7583-mdio";
|
||||
+ resets = <&scuclk AN7583_MDIO1>;
|
||||
+
|
||||
+ airoha,bus-id = <1>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ system-controller@1fbf0200 {
|
||||
+ compatible = "syscon", "simple-mfd";
|
||||
+ reg = <0x0 0x1fbf0200 0x0 0xc0>;
|
||||
+
|
||||
+ an7583_pinctrl: pinctrl {
|
||||
+ compatible = "airoha,en7583-pinctrl";
|
||||
+
|
||||
+ interrupt-parent = <&gic>;
|
||||
+ interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+
|
||||
+ gpio-controller;
|
||||
+ #gpio-cells = <2>;
|
||||
+
|
||||
+ interrupt-controller;
|
||||
+ #interrupt-cells = <2>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ i2cclock: i2cclock@0 {
|
||||
+ #clock-cells = <0>;
|
||||
+ compatible = "fixed-clock";
|
||||
+
|
||||
+ /* 20 MHz */
|
||||
+ clock-frequency = <20000000>;
|
||||
+ };
|
||||
+
|
||||
+ i2c0: i2c0@1fbf8000 {
|
||||
+ compatible = "mediatek,mt7621-i2c";
|
||||
+ reg = <0x0 0x1fbf8000 0x0 0x100>;
|
||||
+
|
||||
+ clocks = <&i2cclock>;
|
||||
+
|
||||
+ /* 100 kHz */
|
||||
+ clock-frequency = <100000>;
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+
|
||||
+ status = "disable";
|
||||
+ };
|
||||
+
|
||||
+ i2c1: i2c1@1fbf8100 {
|
||||
+ compatible = "mediatek,mt7621-i2c";
|
||||
+ reg = <0x0 0x1fbf8100 0x0 0x100>;
|
||||
+
|
||||
+ clocks = <&i2cclock>;
|
||||
+
|
||||
+ /* 100 kHz */
|
||||
+ clock-frequency = <100000>;
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+
|
||||
+ status = "disable";
|
||||
+ };
|
||||
+
|
||||
+ snfi: spi@1fa10000 {
|
||||
+ compatible = "airoha,en7581-snand";
|
||||
+ reg = <0x0 0x1fa10000 0x0 0x140>,
|
||||
+ <0x0 0x1fa11000 0x0 0x600>;
|
||||
+
|
||||
+ clocks = <&scuclk EN7523_CLK_SPI>;
|
||||
+ clock-names = "spi";
|
||||
+
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+
|
||||
+ status = "disabled";
|
||||
+
|
||||
+ spi_nand: nand@0 {
|
||||
+ compatible = "spi-nand";
|
||||
+ reg = <0>;
|
||||
+ spi-max-frequency = <50000000>;
|
||||
+ spi-tx-bus-width = <1>;
|
||||
+ spi-rx-bus-width = <2>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ uart1: serial@1fbf0000 {
|
||||
+ compatible = "ns16550";
|
||||
+ reg = <0x0 0x1fbf0000 0x0 0x30>;
|
||||
+ reg-io-width = <4>;
|
||||
+ reg-shift = <2>;
|
||||
+ interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ clock-frequency = <1843200>;
|
||||
+ bootph-all;
|
||||
+ };
|
||||
+
|
||||
+ uart2: serial@1fbf0300 {
|
||||
+ compatible = "airoha,en7523-uart";
|
||||
+ reg = <0x0 0x1fbf0300 0x0 0x30>;
|
||||
+ reg-io-width = <4>;
|
||||
+ reg-shift = <2>;
|
||||
+ interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ clock-frequency = <7372800>;
|
||||
+
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ hsuart3: serial@1fbe1000 {
|
||||
+ compatible = "airoha,en7523-uart";
|
||||
+ reg = <0x0 0x1fbe1000 0x0 0x40>;
|
||||
+ reg-io-width = <4>;
|
||||
+ reg-shift = <2>;
|
||||
+ interrupts = <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ clock-frequency = <7372800>;
|
||||
+
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ uart4: serial@1fbf0600 {
|
||||
+ compatible = "airoha,en7523-uart";
|
||||
+ reg = <0x0 0x1fbf0600 0x0 0x30>;
|
||||
+ reg-io-width = <4>;
|
||||
+ reg-shift = <2>;
|
||||
+ interrupts = <GIC_SPI 61 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ clock-frequency = <7372800>;
|
||||
+
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ uart5: serial@1fbf0700 {
|
||||
+ compatible = "airoha,en7523-uart";
|
||||
+ reg = <0x0 0x1fbf0700 0x0 0x30>;
|
||||
+ reg-io-width = <4>;
|
||||
+ reg-shift = <2>;
|
||||
+ interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ clock-frequency = <7372800>;
|
||||
+
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ pciephy: phy@1fa5a000 {
|
||||
+ compatible = "airoha,en7581-pcie-phy";
|
||||
+ reg = <0x0 0x1fa5a000 0x0 0xfff>,
|
||||
+ <0x0 0x1fa5b000 0x0 0xfff>,
|
||||
+ <0x0 0x1fa5c000 0x0 0xfff>,
|
||||
+ <0x0 0x1fc10044 0x0 0x4>,
|
||||
+ <0x0 0x1fc30044 0x0 0x4>,
|
||||
+ <0x0 0x1fc15030 0x0 0x104>;
|
||||
+ reg-names = "csr-2l", "pma0", "pma1",
|
||||
+ "p0-xr-dtime", "p1-xr-dtime",
|
||||
+ "rx-aeq";
|
||||
+ #phy-cells = <0>;
|
||||
+ };
|
||||
+
|
||||
+ pcie0: pcie@1fc00000 {
|
||||
+ compatible = "airoha,an7583-pcie";
|
||||
+ device_type = "pci";
|
||||
+ linux,pci-domain = <0>;
|
||||
+ #address-cells = <3>;
|
||||
+ #size-cells = <2>;
|
||||
+
|
||||
+ reg = <0x0 0x1fc20000 0x0 0x1670>;
|
||||
+ reg-names = "pcie-mac";
|
||||
+
|
||||
+ clocks = <&scuclk EN7523_CLK_PCIE>;
|
||||
+ clock-names = "sys-ck";
|
||||
+
|
||||
+ phys = <&pciephy>;
|
||||
+ phy-names = "pcie-phy";
|
||||
+
|
||||
+ ranges = <0x02000000 0 0x20000000 0x0 0x20000000 0 0x4000000>;
|
||||
+
|
||||
+ resets = <&scuclk AN7583_PCIE0_RST>,
|
||||
+ <&scuclk AN7583_PCIE1_RST>;
|
||||
+ reset-names = "phy-lane0", "phy-lane1";
|
||||
+
|
||||
+ interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ bus-range = <0x00 0xff>;
|
||||
+ #interrupt-cells = <1>;
|
||||
+ interrupt-map-mask = <0 0 0 7>;
|
||||
+ interrupt-map = <0 0 0 1 &pcie_intc0 0>,
|
||||
+ <0 0 0 2 &pcie_intc0 1>,
|
||||
+ <0 0 0 3 &pcie_intc0 2>,
|
||||
+ <0 0 0 4 &pcie_intc0 3>;
|
||||
+
|
||||
+ status = "disabled";
|
||||
+
|
||||
+ pcie_intc0: interrupt-controller {
|
||||
+ interrupt-controller;
|
||||
+ #address-cells = <0>;
|
||||
+ #interrupt-cells = <1>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ pcie1: pcie@1fc20000 {
|
||||
+ compatible = "airoha,an7583-pcie";
|
||||
+ device_type = "pci";
|
||||
+ linux,pci-domain = <1>;
|
||||
+ #address-cells = <3>;
|
||||
+ #size-cells = <2>;
|
||||
+
|
||||
+ reg = <0x0 0x1fa92000 0x0 0x1670>;
|
||||
+ reg-names = "pcie-mac";
|
||||
+
|
||||
+ clocks = <&scuclk EN7523_CLK_PCIE>;
|
||||
+ clock-names = "sys-ck";
|
||||
+
|
||||
+ phys = <&pciephy>;
|
||||
+ phy-names = "pcie-phy";
|
||||
+
|
||||
+ ranges = <0x02000000 0 0x24000000 0x0 0x24000000 0 0x4000000>;
|
||||
+
|
||||
+ resets = <&scuclk AN7583_PCIE0_RST>,
|
||||
+ <&scuclk AN7583_PCIE1_RST>;
|
||||
+ reset-names = "phy-lane0", "phy-lane1";
|
||||
+
|
||||
+ interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ bus-range = <0x00 0xff>;
|
||||
+ #interrupt-cells = <1>;
|
||||
+ interrupt-map-mask = <0 0 0 7>;
|
||||
+ interrupt-map = <0 0 0 1 &pcie_intc1 0>,
|
||||
+ <0 0 0 2 &pcie_intc1 1>,
|
||||
+ <0 0 0 3 &pcie_intc1 2>,
|
||||
+ <0 0 0 4 &pcie_intc1 3>;
|
||||
+
|
||||
+ status = "disabled";
|
||||
+
|
||||
+ pcie_intc1: interrupt-controller {
|
||||
+ interrupt-controller;
|
||||
+ #address-cells = <0>;
|
||||
+ #interrupt-cells = <1>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
--- a/arch/arm/mach-airoha/Kconfig
|
||||
+++ b/arch/arm/mach-airoha/Kconfig
|
||||
@@ -17,16 +17,30 @@ config TARGET_AN7581
|
||||
Peripherals include Gigabit Ethernet, switch, USB3.0 and OTG, PCIe,
|
||||
I2S, PCM, S/PDIF, UART, SPI, I2C, IR TX/RX, and PWM.
|
||||
|
||||
+config TARGET_AN7583
|
||||
+ bool "Airoha AN7583 SoC"
|
||||
+ select ARM64
|
||||
+ help
|
||||
+ The Airoha AN7583 is a ARM-based SoC with a quad-core Cortex-A7
|
||||
+ including NEON and GPU, Mali-450 graphics, several DDR3 options,
|
||||
+ crypto engine, built-in Wi-Fi / Bluetooth combo chip, JPEG decoder,
|
||||
+ video interfaces supporting HDMI and MIPI, and video codec support.
|
||||
+ Peripherals include Gigabit Ethernet, switch, USB3.0 and OTG, PCIe,
|
||||
+ I2S, PCM, S/PDIF, UART, SPI, I2C, IR TX/RX, and PWM.
|
||||
+
|
||||
endchoice
|
||||
|
||||
config SYS_SOC
|
||||
default "an7581" if TARGET_AN7581
|
||||
+ default "an7583" if TARGET_AN7583
|
||||
|
||||
config SYS_BOARD
|
||||
default "an7581" if TARGET_AN7581
|
||||
+ default "an7583" if TARGET_AN7583
|
||||
|
||||
config SYS_CONFIG_NAME
|
||||
default "an7581" if TARGET_AN7581
|
||||
+ default "an7583" if TARGET_AN7583
|
||||
|
||||
endif
|
||||
|
||||
--- a/arch/arm/mach-airoha/Makefile
|
||||
+++ b/arch/arm/mach-airoha/Makefile
|
||||
@@ -3,3 +3,4 @@
|
||||
obj-y += cpu.o
|
||||
|
||||
obj-$(CONFIG_TARGET_AN7581) += an7581/
|
||||
+obj-$(CONFIG_TARGET_AN7583) += an7583/
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/mach-airoha/an7583/Makefile
|
||||
@@ -0,0 +1,3 @@
|
||||
+# SPDX-License-Identifier: GPL-2.0
|
||||
+
|
||||
+obj-y += init.o
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/mach-airoha/an7583/init.c
|
||||
@@ -0,0 +1,47 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+
|
||||
+#include <fdtdec.h>
|
||||
+#include <init.h>
|
||||
+#include <asm/armv8/mmu.h>
|
||||
+#include <asm/system.h>
|
||||
+
|
||||
+int print_cpuinfo(void)
|
||||
+{
|
||||
+ printf("CPU: Airoha AN7583\n");
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int dram_init(void)
|
||||
+{
|
||||
+ return fdtdec_setup_mem_size_base();
|
||||
+}
|
||||
+
|
||||
+int dram_init_banksize(void)
|
||||
+{
|
||||
+ return fdtdec_setup_memory_banksize();
|
||||
+}
|
||||
+
|
||||
+void reset_cpu(ulong addr)
|
||||
+{
|
||||
+ psci_system_reset();
|
||||
+}
|
||||
+
|
||||
+static struct mm_region an7583_mem_map[] = {
|
||||
+ {
|
||||
+ /* DDR */
|
||||
+ .virt = 0x80000000UL,
|
||||
+ .phys = 0x80000000UL,
|
||||
+ .size = 0x80000000UL,
|
||||
+ .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_OUTER_SHARE,
|
||||
+ }, {
|
||||
+ .virt = 0x00000000UL,
|
||||
+ .phys = 0x00000000UL,
|
||||
+ .size = 0x20000000UL,
|
||||
+ .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
|
||||
+ PTE_BLOCK_NON_SHARE |
|
||||
+ PTE_BLOCK_PXN | PTE_BLOCK_UXN
|
||||
+ }, {
|
||||
+ 0,
|
||||
+ }
|
||||
+};
|
||||
+struct mm_region *mem_map = an7583_mem_map;
|
||||
--- /dev/null
|
||||
+++ b/board/airoha/an7583/MAINTAINERS
|
||||
@@ -0,0 +1,5 @@
|
||||
+AN7581
|
||||
+M: Christian Marangi <ansuelsmth@gmail.com>
|
||||
+S: Maintained
|
||||
+N: airoha
|
||||
+N: an7583
|
||||
--- /dev/null
|
||||
+++ b/board/airoha/an7583/Makefile
|
||||
@@ -0,0 +1,3 @@
|
||||
+# SPDX-License-Identifier: GPL-2.0
|
||||
+
|
||||
+obj-y += an7583_rfb.o
|
||||
--- /dev/null
|
||||
+++ b/board/airoha/an7583/an7583_rfb.c
|
||||
@@ -0,0 +1,16 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Author: Christian Marangi <ansuelsmth@gmail.com>
|
||||
+ */
|
||||
+
|
||||
+#include <asm/global_data.h>
|
||||
+
|
||||
+DECLARE_GLOBAL_DATA_PTR;
|
||||
+
|
||||
+int board_init(void)
|
||||
+{
|
||||
+ /* address of boot parameters */
|
||||
+ gd->bd->bi_boot_params = CFG_SYS_SDRAM_BASE + 0x100;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
--- /dev/null
|
||||
+++ b/configs/an7583_evb_defconfig
|
||||
@@ -0,0 +1,81 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_ARCH_AIROHA=y
|
||||
+CONFIG_TARGET_AN7583=y
|
||||
+CONFIG_TEXT_BASE=0x81E00000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_ENV_SIZE=0x4000
|
||||
+CONFIG_ENV_OFFSET=0x7c000
|
||||
+CONFIG_DM_GPIO=y
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="an7583-evb"
|
||||
+CONFIG_DM_RESET=y
|
||||
+CONFIG_SYS_LOAD_ADDR=0x81800000
|
||||
+CONFIG_BUILD_TARGET="u-boot.bin"
|
||||
+# CONFIG_EFI_LOADER is not set
|
||||
+CONFIG_FIT=y
|
||||
+CONFIG_FIT_VERBOSE=y
|
||||
+CONFIG_BOOTDELAY=3
|
||||
+CONFIG_DEFAULT_FDT_FILE="an7583-evb"
|
||||
+CONFIG_SYS_PBSIZE=1049
|
||||
+CONFIG_SYS_CONSOLE_IS_IN_ENV=y
|
||||
+# CONFIG_DISPLAY_BOARDINFO is not set
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_PROMPT="U-Boot> "
|
||||
+CONFIG_SYS_MAXARGS=8
|
||||
+CONFIG_CMD_BOOTZ=y
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+# CONFIG_CMD_ELF is not set
|
||||
+# CONFIG_CMD_XIMG is not set
|
||||
+CONFIG_CMD_BIND=y
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_MMC=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_SF_TEST=y
|
||||
+CONFIG_CMD_SPI=y
|
||||
+# CONFIG_CMD_SETEXPR is not set
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_EXT4=y
|
||||
+CONFIG_CMD_FAT=y
|
||||
+CONFIG_CMD_FS_GENERIC=y
|
||||
+CONFIG_CMD_MTDPARTS=y
|
||||
+CONFIG_CMD_LOG=y
|
||||
+CONFIG_ENV_OVERWRITE=y
|
||||
+CONFIG_ENV_IS_IN_MMC=y
|
||||
+CONFIG_ENV_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_DMA=y
|
||||
+CONFIG_LED=y
|
||||
+CONFIG_LED_GPIO=y
|
||||
+CONFIG_MMC_HS200_SUPPORT=y
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_MTD_SPI_NAND=y
|
||||
+CONFIG_DM_SPI_FLASH=y
|
||||
+CONFIG_SPI_FLASH_EON=y
|
||||
+CONFIG_SPI_FLASH_GIGADEVICE=y
|
||||
+CONFIG_SPI_FLASH_ISSI=y
|
||||
+CONFIG_SPI_FLASH_MACRONIX=y
|
||||
+CONFIG_SPI_FLASH_SPANSION=y
|
||||
+CONFIG_SPI_FLASH_STMICRO=y
|
||||
+CONFIG_SPI_FLASH_WINBOND=y
|
||||
+CONFIG_SPI_FLASH_MTD=y
|
||||
+CONFIG_PHYLIB=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCONF=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_DM_REGULATOR=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_RAM=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_SYS_NS16550=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_DM_SPI=y
|
||||
+CONFIG_SHA512=y
|
||||
+CONFIG_AIROHA_ETH=y
|
||||
+CONFIG_MMC_MTK=y
|
||||
+CONFIG_AIROHA_SNFI_SPI=y
|
||||
--- /dev/null
|
||||
+++ b/include/configs/an7583.h
|
||||
@@ -0,0 +1,19 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0 */
|
||||
+/*
|
||||
+ * Configuration for Airoha AN7583
|
||||
+ */
|
||||
+
|
||||
+#ifndef __AN7583_H
|
||||
+#define __AN7583_H
|
||||
+
|
||||
+#include <linux/sizes.h>
|
||||
+
|
||||
+#define CFG_SYS_UBOOT_BASE CONFIG_TEXT_BASE
|
||||
+
|
||||
+#define CFG_SYS_INIT_RAM_ADDR CONFIG_TEXT_BASE
|
||||
+#define CFG_SYS_INIT_RAM_SIZE SZ_2M
|
||||
+
|
||||
+/* DRAM */
|
||||
+#define CFG_SYS_SDRAM_BASE 0x80000000
|
||||
+
|
||||
+#endif
|
||||
@@ -1,171 +0,0 @@
|
||||
From 62ab067847b30d73d4f661bdc99e9f32ff03f338 Mon Sep 17 00:00:00 2001
|
||||
From: Christian Marangi <ansuelsmth@gmail.com>
|
||||
Date: Tue, 29 Apr 2025 13:19:11 +0200
|
||||
Subject: [PATCH] clk: airoha: add support for Airoha AN7583 SoC clock
|
||||
|
||||
Add support for Airoha AN7583 SoC clock that implement more base values
|
||||
for clocks compared to AN7581.
|
||||
|
||||
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
||||
---
|
||||
drivers/clk/airoha/clk-airoha.c | 131 ++++++++++++++++++++++++++++++++
|
||||
1 file changed, 131 insertions(+)
|
||||
|
||||
--- a/drivers/clk/airoha/clk-airoha.c
|
||||
+++ b/drivers/clk/airoha/clk-airoha.c
|
||||
@@ -73,6 +73,14 @@ static const u32 bus7581_base[] = { 6000
|
||||
static const u32 npu7581_base[] = { 800000000, 750000000, 720000000, 600000000 };
|
||||
static const u32 crypto_base[] = { 540000000, 480000000 };
|
||||
static const u32 emmc7581_base[] = { 200000000, 150000000 };
|
||||
+/* AN7583 */
|
||||
+static const u32 gsw7583_base[] = { 540672000, 270336000, 400000000, 200000000 };
|
||||
+static const u32 emi7583_base[] = { 540672000, 480000000, 400000000, 300000000 };
|
||||
+static const u32 bus7583_base[] = { 600000000, 540672000, 480000000, 400000000 };
|
||||
+static const u32 spi7583_base[] = { 100000000, 12500000 };
|
||||
+static const u32 npu7583_base[] = { 666000000, 800000000, 720000000, 600000000 };
|
||||
+static const u32 crypto7583_base[] = { 540672000, 400000000 };
|
||||
+static const u32 emmc7583_base[] = { 150000000, 200000000 };
|
||||
|
||||
static const struct airoha_clk_desc en7581_base_clks[EN7581_MAX_CLKS] = {
|
||||
[EN7523_CLK_GSW] = {
|
||||
@@ -186,6 +194,121 @@ static const struct airoha_clk_desc en75
|
||||
}
|
||||
};
|
||||
|
||||
+static const struct airoha_clk_desc an7583_base_clks[EN7581_MAX_CLKS] = {
|
||||
+ [EN7523_CLK_GSW] = {
|
||||
+ .id = EN7523_CLK_GSW,
|
||||
+ .name = "gsw",
|
||||
+
|
||||
+ .base_reg = REG_GSW_CLK_DIV_SEL,
|
||||
+ .base_bits = 2,
|
||||
+ .base_shift = 8,
|
||||
+ .base_values = gsw7583_base,
|
||||
+ .n_base_values = ARRAY_SIZE(gsw7583_base),
|
||||
+
|
||||
+ .div_bits = 3,
|
||||
+ .div_shift = 0,
|
||||
+ .div_step = 1,
|
||||
+ .div_offset = 1,
|
||||
+ },
|
||||
+ [EN7523_CLK_EMI] = {
|
||||
+ .id = EN7523_CLK_EMI,
|
||||
+ .name = "emi",
|
||||
+
|
||||
+ .base_reg = REG_EMI_CLK_DIV_SEL,
|
||||
+ .base_bits = 2,
|
||||
+ .base_shift = 8,
|
||||
+ .base_values = emi7583_base,
|
||||
+ .n_base_values = ARRAY_SIZE(emi7583_base),
|
||||
+
|
||||
+ .div_bits = 3,
|
||||
+ .div_shift = 0,
|
||||
+ .div_step = 1,
|
||||
+ .div_offset = 1,
|
||||
+ },
|
||||
+ [EN7523_CLK_BUS] = {
|
||||
+ .id = EN7523_CLK_BUS,
|
||||
+ .name = "bus",
|
||||
+
|
||||
+ .base_reg = REG_BUS_CLK_DIV_SEL,
|
||||
+ .base_bits = 2,
|
||||
+ .base_shift = 8,
|
||||
+ .base_values = bus7583_base,
|
||||
+ .n_base_values = ARRAY_SIZE(bus7583_base),
|
||||
+
|
||||
+ .div_bits = 3,
|
||||
+ .div_shift = 0,
|
||||
+ .div_step = 1,
|
||||
+ .div_offset = 1,
|
||||
+ },
|
||||
+ [EN7523_CLK_SLIC] = {
|
||||
+ .id = EN7523_CLK_SLIC,
|
||||
+ .name = "slic",
|
||||
+
|
||||
+ .base_reg = REG_SPI_CLK_FREQ_SEL,
|
||||
+ .base_bits = 1,
|
||||
+ .base_shift = 0,
|
||||
+ .base_values = slic_base,
|
||||
+ .n_base_values = ARRAY_SIZE(slic_base),
|
||||
+
|
||||
+ .div_reg = REG_SPI_CLK_DIV_SEL,
|
||||
+ .div_bits = 5,
|
||||
+ .div_shift = 24,
|
||||
+ .div_val0 = 20,
|
||||
+ .div_step = 2,
|
||||
+ },
|
||||
+ [EN7523_CLK_SPI] = {
|
||||
+ .id = EN7523_CLK_SPI,
|
||||
+ .name = "spi",
|
||||
+
|
||||
+ .base_reg = REG_SPI_CLK_FREQ_SEL,
|
||||
+ .base_bits = 1,
|
||||
+ .base_shift = 1,
|
||||
+ .base_values = spi7583_base,
|
||||
+ .n_base_values = ARRAY_SIZE(spi7583_base),
|
||||
+
|
||||
+ .div_reg = REG_SPI_CLK_DIV_SEL,
|
||||
+ .div_bits = 5,
|
||||
+ .div_shift = 8,
|
||||
+ .div_val0 = 40,
|
||||
+ .div_step = 2,
|
||||
+ },
|
||||
+ [EN7523_CLK_NPU] = {
|
||||
+ .id = EN7523_CLK_NPU,
|
||||
+ .name = "npu",
|
||||
+
|
||||
+ .base_reg = REG_NPU_CLK_DIV_SEL,
|
||||
+ .base_bits = 2,
|
||||
+ .base_shift = 9,
|
||||
+ .base_values = npu7583_base,
|
||||
+ .n_base_values = ARRAY_SIZE(npu7583_base),
|
||||
+
|
||||
+ .div_bits = 3,
|
||||
+ .div_shift = 0,
|
||||
+ .div_step = 1,
|
||||
+ .div_offset = 1,
|
||||
+ },
|
||||
+ [EN7523_CLK_CRYPTO] = {
|
||||
+ .id = EN7523_CLK_CRYPTO,
|
||||
+ .name = "crypto",
|
||||
+
|
||||
+ .base_reg = REG_CRYPTO_CLKSRC2,
|
||||
+ .base_bits = 1,
|
||||
+ .base_shift = 0,
|
||||
+ .base_values = crypto7583_base,
|
||||
+ .n_base_values = ARRAY_SIZE(crypto7583_base),
|
||||
+ },
|
||||
+ [EN7581_CLK_EMMC] = {
|
||||
+ .id = EN7581_CLK_EMMC,
|
||||
+ .name = "emmc",
|
||||
+
|
||||
+ .base_reg = REG_CRYPTO_CLKSRC2,
|
||||
+ .base_bits = 1,
|
||||
+ .base_shift = 13,
|
||||
+ .base_values = emmc7583_base,
|
||||
+ .n_base_values = ARRAY_SIZE(emmc7583_base),
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
static u32 airoha_clk_get_base_rate(const struct airoha_clk_desc *desc, u32 val)
|
||||
{
|
||||
if (!desc->base_bits)
|
||||
@@ -436,10 +559,18 @@ static const struct airoha_clk_soc_data
|
||||
.descs = en7581_base_clks,
|
||||
};
|
||||
|
||||
+static const struct airoha_clk_soc_data an7583_data = {
|
||||
+ .num_clocks = ARRAY_SIZE(an7583_base_clks),
|
||||
+ .descs = an7583_base_clks,
|
||||
+};
|
||||
+
|
||||
static const struct udevice_id airoha_clk_ids[] = {
|
||||
{ .compatible = "airoha,en7581-scu",
|
||||
.data = (ulong)&en7581_data,
|
||||
},
|
||||
+ { .compatible = "airoha,an7583-scu",
|
||||
+ .data = (ulong)&an7583_data,
|
||||
+ },
|
||||
{ }
|
||||
};
|
||||
|
||||
@@ -1,90 +0,0 @@
|
||||
From 7daf0565460e548eb766a0bcc171c34e02dd6eba Mon Sep 17 00:00:00 2001
|
||||
From: Christian Marangi <ansuelsmth@gmail.com>
|
||||
Date: Mon, 19 May 2025 14:22:55 +0200
|
||||
Subject: [PATCH 3/6] reset: airoha: convert to regmap API
|
||||
|
||||
In preparation for support for Airoha AN7583, convert the driver to
|
||||
regmap API. This is needed as Airoha AN7583 will use syscon to access
|
||||
reset registers.
|
||||
|
||||
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
||||
---
|
||||
drivers/reset/reset-airoha.c | 35 ++++++++++++++++++-----------------
|
||||
1 file changed, 18 insertions(+), 17 deletions(-)
|
||||
|
||||
--- a/drivers/reset/reset-airoha.c
|
||||
+++ b/drivers/reset/reset-airoha.c
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <dm.h>
|
||||
#include <linux/io.h>
|
||||
#include <reset-uclass.h>
|
||||
+#include <regmap.h>
|
||||
|
||||
#include <dt-bindings/reset/airoha,en7581-reset.h>
|
||||
|
||||
@@ -21,7 +22,7 @@
|
||||
struct airoha_reset_priv {
|
||||
const u16 *bank_ofs;
|
||||
const u16 *idx_map;
|
||||
- void __iomem *base;
|
||||
+ struct regmap *map;
|
||||
};
|
||||
|
||||
static const u16 en7581_rst_ofs[] = {
|
||||
@@ -90,17 +91,11 @@ static const u16 en7581_rst_map[] = {
|
||||
static int airoha_reset_update(struct airoha_reset_priv *priv,
|
||||
unsigned long id, bool assert)
|
||||
{
|
||||
- void __iomem *addr = priv->base + priv->bank_ofs[id / RST_NR_PER_BANK];
|
||||
- u32 val;
|
||||
-
|
||||
- val = readl(addr);
|
||||
- if (assert)
|
||||
- val |= BIT(id % RST_NR_PER_BANK);
|
||||
- else
|
||||
- val &= ~BIT(id % RST_NR_PER_BANK);
|
||||
- writel(val, addr);
|
||||
+ u16 offset = priv->bank_ofs[id / RST_NR_PER_BANK];
|
||||
|
||||
- return 0;
|
||||
+ return regmap_update_bits(priv->map, offset,
|
||||
+ BIT(id % RST_NR_PER_BANK),
|
||||
+ assert ? BIT(id % RST_NR_PER_BANK) : 0);
|
||||
}
|
||||
|
||||
static int airoha_reset_assert(struct reset_ctl *reset_ctl)
|
||||
@@ -123,11 +118,16 @@ static int airoha_reset_status(struct re
|
||||
{
|
||||
struct airoha_reset_priv *priv = dev_get_priv(reset_ctl->dev);
|
||||
int id = reset_ctl->id;
|
||||
- void __iomem *addr;
|
||||
+ u16 offset;
|
||||
+ u32 val;
|
||||
+ int ret;
|
||||
|
||||
- addr = priv->base + priv->bank_ofs[id / RST_NR_PER_BANK];
|
||||
+ offset = priv->bank_ofs[id / RST_NR_PER_BANK];
|
||||
+ ret = regmap_read(priv->map, offset, &val);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
|
||||
- return !!(readl(addr) & BIT(id % RST_NR_PER_BANK));
|
||||
+ return !!(val & BIT(id % RST_NR_PER_BANK));
|
||||
}
|
||||
|
||||
static int airoha_reset_xlate(struct reset_ctl *reset_ctl,
|
||||
@@ -153,10 +153,11 @@ static struct reset_ops airoha_reset_ops
|
||||
static int airoha_reset_probe(struct udevice *dev)
|
||||
{
|
||||
struct airoha_reset_priv *priv = dev_get_priv(dev);
|
||||
+ int ret;
|
||||
|
||||
- priv->base = dev_remap_addr(dev);
|
||||
- if (!priv->base)
|
||||
- return -ENOMEM;
|
||||
+ ret = regmap_init_mem(dev_ofnode(dev), &priv->map);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
|
||||
priv->bank_ofs = en7581_rst_ofs;
|
||||
priv->idx_map = en7581_rst_map;
|
||||
@@ -1,226 +0,0 @@
|
||||
From 23031ad51d55361be507b83307f55995e0204188 Mon Sep 17 00:00:00 2001
|
||||
From: Christian Marangi <ansuelsmth@gmail.com>
|
||||
Date: Tue, 29 Apr 2025 13:33:35 +0200
|
||||
Subject: [PATCH 4/6] reset: airoha: Add support for Airoha AN7583 reset
|
||||
|
||||
Adapt the Airoha reset driver to support Airoha AN7583 node structure.
|
||||
In AN7583 the register is exposed by the parent syscon hence a different
|
||||
logic needs to be applied. Also the reset line differ from AN7581 hence
|
||||
a dedicated table is needed.
|
||||
|
||||
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
||||
---
|
||||
drivers/reset/reset-airoha.c | 94 ++++++++++++++++++-
|
||||
.../dt-bindings/reset/airoha,an7583-reset.h | 61 ++++++++++++
|
||||
2 files changed, 153 insertions(+), 2 deletions(-)
|
||||
create mode 100644 include/dt-bindings/reset/airoha,an7583-reset.h
|
||||
|
||||
--- a/drivers/reset/reset-airoha.c
|
||||
+++ b/drivers/reset/reset-airoha.c
|
||||
@@ -11,8 +11,10 @@
|
||||
#include <linux/io.h>
|
||||
#include <reset-uclass.h>
|
||||
#include <regmap.h>
|
||||
+#include <syscon.h>
|
||||
|
||||
#include <dt-bindings/reset/airoha,en7581-reset.h>
|
||||
+#include <dt-bindings/reset/airoha,an7583-reset.h>
|
||||
|
||||
#define RST_NR_PER_BANK 32
|
||||
|
||||
@@ -22,6 +24,7 @@
|
||||
struct airoha_reset_priv {
|
||||
const u16 *bank_ofs;
|
||||
const u16 *idx_map;
|
||||
+ int num_rsts;
|
||||
struct regmap *map;
|
||||
};
|
||||
|
||||
@@ -88,6 +91,59 @@ static const u16 en7581_rst_map[] = {
|
||||
[EN7581_XPON_MAC_RST] = RST_NR_PER_BANK + 31,
|
||||
};
|
||||
|
||||
+static const u16 an7583_rst_map[] = {
|
||||
+ /* RST_CTRL2 */
|
||||
+ [AN7583_XPON_PHY_RST] = 0,
|
||||
+ [AN7583_GPON_OLT_RST] = 1,
|
||||
+ [AN7583_CPU_TIMER2_RST] = 2,
|
||||
+ [AN7583_HSUART_RST] = 3,
|
||||
+ [AN7583_UART4_RST] = 4,
|
||||
+ [AN7583_UART5_RST] = 5,
|
||||
+ [AN7583_I2C2_RST] = 6,
|
||||
+ [AN7583_XSI_MAC_RST] = 7,
|
||||
+ [AN7583_XSI_PHY_RST] = 8,
|
||||
+ [AN7583_NPU_RST] = 9,
|
||||
+ [AN7583_TRNG_MSTART_RST] = 12,
|
||||
+ [AN7583_DUAL_HSI0_RST] = 13,
|
||||
+ [AN7583_DUAL_HSI1_RST] = 14,
|
||||
+ [AN7583_DUAL_HSI0_MAC_RST] = 16,
|
||||
+ [AN7583_DUAL_HSI1_MAC_RST] = 17,
|
||||
+ [AN7583_WDMA_RST] = 19,
|
||||
+ [AN7583_WOE0_RST] = 20,
|
||||
+ [AN7583_HSDMA_RST] = 22,
|
||||
+ [AN7583_TDMA_RST] = 24,
|
||||
+ [AN7583_EMMC_RST] = 25,
|
||||
+ [AN7583_SOE_RST] = 26,
|
||||
+ [AN7583_XFP_MAC_RST] = 28,
|
||||
+ [AN7583_MDIO0] = 30,
|
||||
+ [AN7583_MDIO1] = 31,
|
||||
+ /* RST_CTRL1 */
|
||||
+ [AN7583_PCM1_ZSI_ISI_RST] = RST_NR_PER_BANK + 0,
|
||||
+ [AN7583_FE_PDMA_RST] = RST_NR_PER_BANK + 1,
|
||||
+ [AN7583_FE_QDMA_RST] = RST_NR_PER_BANK + 2,
|
||||
+ [AN7583_PCM_SPIWP_RST] = RST_NR_PER_BANK + 4,
|
||||
+ [AN7583_CRYPTO_RST] = RST_NR_PER_BANK + 6,
|
||||
+ [AN7583_TIMER_RST] = RST_NR_PER_BANK + 8,
|
||||
+ [AN7583_PCM1_RST] = RST_NR_PER_BANK + 11,
|
||||
+ [AN7583_UART_RST] = RST_NR_PER_BANK + 12,
|
||||
+ [AN7583_GPIO_RST] = RST_NR_PER_BANK + 13,
|
||||
+ [AN7583_GDMA_RST] = RST_NR_PER_BANK + 14,
|
||||
+ [AN7583_I2C_MASTER_RST] = RST_NR_PER_BANK + 16,
|
||||
+ [AN7583_PCM2_ZSI_ISI_RST] = RST_NR_PER_BANK + 17,
|
||||
+ [AN7583_SFC_RST] = RST_NR_PER_BANK + 18,
|
||||
+ [AN7583_UART2_RST] = RST_NR_PER_BANK + 19,
|
||||
+ [AN7583_GDMP_RST] = RST_NR_PER_BANK + 20,
|
||||
+ [AN7583_FE_RST] = RST_NR_PER_BANK + 21,
|
||||
+ [AN7583_USB_HOST_P0_RST] = RST_NR_PER_BANK + 22,
|
||||
+ [AN7583_GSW_RST] = RST_NR_PER_BANK + 23,
|
||||
+ [AN7583_SFC2_PCM_RST] = RST_NR_PER_BANK + 25,
|
||||
+ [AN7583_PCIE0_RST] = RST_NR_PER_BANK + 26,
|
||||
+ [AN7583_PCIE1_RST] = RST_NR_PER_BANK + 27,
|
||||
+ [AN7583_CPU_TIMER_RST] = RST_NR_PER_BANK + 28,
|
||||
+ [AN7583_PCIE_HB_RST] = RST_NR_PER_BANK + 29,
|
||||
+ [AN7583_XPON_MAC_RST] = RST_NR_PER_BANK + 31,
|
||||
+};
|
||||
+
|
||||
static int airoha_reset_update(struct airoha_reset_priv *priv,
|
||||
unsigned long id, bool assert)
|
||||
{
|
||||
@@ -135,7 +191,7 @@ static int airoha_reset_xlate(struct reset_ctl *reset_ctl,
|
||||
{
|
||||
struct airoha_reset_priv *priv = dev_get_priv(reset_ctl->dev);
|
||||
|
||||
- if (args->args[0] >= ARRAY_SIZE(en7581_rst_map))
|
||||
+ if (args->args[0] >= priv->num_rsts)
|
||||
return -EINVAL;
|
||||
|
||||
reset_ctl->id = priv->idx_map[args->args[0]];
|
||||
@@ -150,7 +206,7 @@ static struct reset_ops airoha_reset_ops = {
|
||||
.rst_status = airoha_reset_status,
|
||||
};
|
||||
|
||||
-static int airoha_reset_probe(struct udevice *dev)
|
||||
+static int an7581_reset_probe(struct udevice *dev)
|
||||
{
|
||||
struct airoha_reset_priv *priv = dev_get_priv(dev);
|
||||
int ret;
|
||||
@@ -161,10 +217,44 @@ static int airoha_reset_probe(struct udevice *dev)
|
||||
|
||||
priv->bank_ofs = en7581_rst_ofs;
|
||||
priv->idx_map = en7581_rst_map;
|
||||
+ priv->num_rsts = ARRAY_SIZE(en7581_rst_map);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int an7583_reset_probe(struct udevice *dev)
|
||||
+{
|
||||
+ struct airoha_reset_priv *priv = dev_get_priv(dev);
|
||||
+ ofnode pnode, scu_node = dev_ofnode(dev);
|
||||
+
|
||||
+ pnode = ofnode_get_parent(scu_node);
|
||||
+ if (!ofnode_valid(pnode))
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ priv->map = syscon_node_to_regmap(pnode);
|
||||
+ if (IS_ERR(priv->map))
|
||||
+ return PTR_ERR(priv->map);
|
||||
+
|
||||
+ priv->bank_ofs = en7581_rst_ofs;
|
||||
+ priv->idx_map = an7583_rst_map;
|
||||
+ priv->num_rsts = ARRAY_SIZE(an7583_rst_map);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int airoha_reset_probe(struct udevice *dev)
|
||||
+{
|
||||
+ if (ofnode_device_is_compatible(dev_ofnode(dev),
|
||||
+ "airoha,en7581-scu"))
|
||||
+ return an7581_reset_probe(dev);
|
||||
+
|
||||
+ if (ofnode_device_is_compatible(dev_ofnode(dev),
|
||||
+ "airoha,an7583-scu"))
|
||||
+ return an7583_reset_probe(dev);
|
||||
+
|
||||
+ return -ENODEV;
|
||||
+}
|
||||
+
|
||||
U_BOOT_DRIVER(airoha_reset) = {
|
||||
.name = "airoha-reset",
|
||||
.id = UCLASS_RESET,
|
||||
--- /dev/null
|
||||
+++ b/include/dt-bindings/reset/airoha,an7583-reset.h
|
||||
@@ -0,0 +1,61 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0-only
|
||||
+/*
|
||||
+ * Copyright (c) 2024 AIROHA Inc
|
||||
+ * Author: Christian Marangi <ansuelsmth@gmail.com>
|
||||
+ */
|
||||
+
|
||||
+#ifndef __DT_BINDINGS_RESET_CONTROLLER_AIROHA_AN7583_H_
|
||||
+#define __DT_BINDINGS_RESET_CONTROLLER_AIROHA_AN7583_H_
|
||||
+
|
||||
+/* RST_CTRL2 */
|
||||
+#define AN7583_XPON_PHY_RST 0
|
||||
+#define AN7583_GPON_OLT_RST 1
|
||||
+#define AN7583_CPU_TIMER2_RST 2
|
||||
+#define AN7583_HSUART_RST 3
|
||||
+#define AN7583_UART4_RST 4
|
||||
+#define AN7583_UART5_RST 5
|
||||
+#define AN7583_I2C2_RST 6
|
||||
+#define AN7583_XSI_MAC_RST 7
|
||||
+#define AN7583_XSI_PHY_RST 8
|
||||
+#define AN7583_NPU_RST 9
|
||||
+#define AN7583_TRNG_MSTART_RST 10
|
||||
+#define AN7583_DUAL_HSI0_RST 11
|
||||
+#define AN7583_DUAL_HSI1_RST 12
|
||||
+#define AN7583_DUAL_HSI0_MAC_RST 13
|
||||
+#define AN7583_DUAL_HSI1_MAC_RST 14
|
||||
+#define AN7583_WDMA_RST 15
|
||||
+#define AN7583_WOE0_RST 16
|
||||
+#define AN7583_HSDMA_RST 17
|
||||
+#define AN7583_TDMA_RST 18
|
||||
+#define AN7583_EMMC_RST 19
|
||||
+#define AN7583_SOE_RST 20
|
||||
+#define AN7583_XFP_MAC_RST 21
|
||||
+#define AN7583_MDIO0 22
|
||||
+#define AN7583_MDIO1 23
|
||||
+/* RST_CTRL1 */
|
||||
+#define AN7583_PCM1_ZSI_ISI_RST 24
|
||||
+#define AN7583_FE_PDMA_RST 25
|
||||
+#define AN7583_FE_QDMA_RST 26
|
||||
+#define AN7583_PCM_SPIWP_RST 27
|
||||
+#define AN7583_CRYPTO_RST 28
|
||||
+#define AN7583_TIMER_RST 29
|
||||
+#define AN7583_PCM1_RST 30
|
||||
+#define AN7583_UART_RST 31
|
||||
+#define AN7583_GPIO_RST 32
|
||||
+#define AN7583_GDMA_RST 33
|
||||
+#define AN7583_I2C_MASTER_RST 34
|
||||
+#define AN7583_PCM2_ZSI_ISI_RST 35
|
||||
+#define AN7583_SFC_RST 36
|
||||
+#define AN7583_UART2_RST 37
|
||||
+#define AN7583_GDMP_RST 38
|
||||
+#define AN7583_FE_RST 39
|
||||
+#define AN7583_USB_HOST_P0_RST 40
|
||||
+#define AN7583_GSW_RST 41
|
||||
+#define AN7583_SFC2_PCM_RST 42
|
||||
+#define AN7583_PCIE0_RST 43
|
||||
+#define AN7583_PCIE1_RST 44
|
||||
+#define AN7583_CPU_TIMER_RST 45
|
||||
+#define AN7583_PCIE_HB_RST 46
|
||||
+#define AN7583_XPON_MAC_RST 47
|
||||
+
|
||||
+#endif /* __DT_BINDINGS_RESET_CONTROLLER_AIROHA_AN7583_H_ */
|
||||
|
||||
@@ -1,278 +0,0 @@
|
||||
From dfdc7309ba22f6a6b6c581acfe95a222108bd760 Mon Sep 17 00:00:00 2001
|
||||
From: Christian Marangi <ansuelsmth@gmail.com>
|
||||
Date: Mon, 19 May 2025 14:29:53 +0200
|
||||
Subject: [PATCH] net: airoha: add support for Airoha AN7583
|
||||
|
||||
Add support for Ethernet controller present in Airoha AN7583. This
|
||||
follow the same implementation of Airoha AN7581 with the only difference
|
||||
of having a different reset number and a different logic to reach the
|
||||
SCU node.
|
||||
|
||||
Generalize the driver for these 2 part to account for these minor
|
||||
difference.
|
||||
|
||||
The switch init part also required some care as the Switch Internal PHY
|
||||
enable BMCR_PDOWN by default and tweak to GEPHY_CONN_CFG is also needed.
|
||||
|
||||
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
||||
---
|
||||
drivers/net/airoha_eth.c | 168 ++++++++++++++++++++++++++++++++++-----
|
||||
1 file changed, 147 insertions(+), 21 deletions(-)
|
||||
|
||||
--- a/drivers/net/airoha_eth.c
|
||||
+++ b/drivers/net/airoha_eth.c
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/iopoll.h>
|
||||
+#include <linux/mii.h>
|
||||
#include <linux/time.h>
|
||||
|
||||
#define AIROHA_MAX_NUM_GDM_PORTS 1
|
||||
@@ -27,6 +28,11 @@
|
||||
#define AIROHA_MAX_NUM_RSTS 3
|
||||
#define AIROHA_MAX_NUM_XSI_RSTS 4
|
||||
|
||||
+#define AIROHA_MAX_NUM_SWITCH_PORT 4
|
||||
+#define AIROHA_MAX_PBUS_TRY 10
|
||||
+#define AIROHA_PBUS_SLEEP 100
|
||||
+#define AIROHA_PBUS_C22_MASK 0x800000
|
||||
+
|
||||
#define AIROHA_MAX_PACKET_SIZE 2048
|
||||
#define AIROHA_NUM_TX_RING 1
|
||||
#define AIROHA_NUM_RX_RING 1
|
||||
@@ -77,6 +83,19 @@
|
||||
#define SWITCH_PHY_PRE_EN BIT(15)
|
||||
#define SWITCH_PHY_END_ADDR GENMASK(12, 8)
|
||||
#define SWITCH_PHY_ST_ADDR GENMASK(4, 0)
|
||||
+#define SWITCH_GEPHY_CONN_CFG 0x7c14
|
||||
+#define SWITCH_DPHY_CKIN_SEL BIT(31)
|
||||
+#define SWITCH_PHY_CORE_REG_CLK_SEL BIT(30)
|
||||
+#define SWITCH_ETHER_AFE_PWD GENMASK(28, 24)
|
||||
+#define SWITCH_PBUS_PHY_IAC 0x7c20
|
||||
+#define SWITCH_PBUS_PHY_START BIT(31)
|
||||
+#define SWITCH_PBUS_PHY_CMD BIT(30)
|
||||
+#define SWITCH_PBUS_PHY_CMD_READ FIELD_PREP(SWITCH_PBUS_PHY_CMD, 0x0)
|
||||
+#define SWITCH_PBUS_PHY_CMD_WRITE FIELD_PREP(SWITCH_PBUS_PHY_CMD, 0x1)
|
||||
+#define SWITCH_PBUS_PHY_PORTADDR GENMASK(28, 24)
|
||||
+#define SWITCH_PBUS_PHY_REGADDR GENMASK(23, 0)
|
||||
+#define SWITCH_PBUS_PHY_IAWD 0x7c24
|
||||
+#define SWITCH_PBUS_PHY_IARD 0x7c28
|
||||
|
||||
/* FE */
|
||||
#define PSE_BASE 0x0100
|
||||
@@ -312,6 +331,26 @@ struct airoha_eth {
|
||||
struct airoha_gdm_port *ports[AIROHA_MAX_NUM_GDM_PORTS];
|
||||
};
|
||||
|
||||
+struct airoha_eth_soc_data {
|
||||
+ int num_xsi_rsts;
|
||||
+ const char * const *xsi_rsts_names;
|
||||
+ ofnode (*get_scu_node)(struct udevice *dev);
|
||||
+ const char *switch_compatible;
|
||||
+};
|
||||
+
|
||||
+static const char * const en7581_xsi_rsts_names[] = {
|
||||
+ "hsi0-mac",
|
||||
+ "hsi1-mac",
|
||||
+ "hsi-mac",
|
||||
+ "xfp-mac",
|
||||
+};
|
||||
+
|
||||
+static const char * const an7583_xsi_rsts_names[] = {
|
||||
+ "hsi0-mac",
|
||||
+ "hsi1-mac",
|
||||
+ "xfp-mac",
|
||||
+};
|
||||
+
|
||||
static u32 airoha_rr(void __iomem *base, u32 offset)
|
||||
{
|
||||
return readl(base + offset);
|
||||
@@ -352,8 +391,12 @@ static u32 airoha_rmw(void __iomem *base, u32 offset, u32 mask, u32 val)
|
||||
#define airoha_qdma_clear(qdma, offset, val) \
|
||||
airoha_rmw((qdma)->regs, (offset), (val), 0)
|
||||
|
||||
+#define airoha_switch_rr(eth, offset) \
|
||||
+ airoha_rr((eth)->switch_regs, (offset))
|
||||
#define airoha_switch_wr(eth, offset, val) \
|
||||
airoha_wr((eth)->switch_regs, (offset), (val))
|
||||
+#define airoha_switch_rmw(eth, offset, mask, val) \
|
||||
+ airoha_rmw((eth)->switch_regs, (offset), (mask), (val))
|
||||
|
||||
static inline dma_addr_t dma_map_unaligned(void *vaddr, size_t len,
|
||||
enum dma_data_direction dir)
|
||||
@@ -682,10 +725,12 @@ static int airoha_hw_init(struct udevice *dev,
|
||||
|
||||
static int airoha_switch_init(struct udevice *dev, struct airoha_eth *eth)
|
||||
{
|
||||
+ struct airoha_eth_soc_data *data = (void *)dev_get_driver_data(dev);
|
||||
ofnode switch_node;
|
||||
fdt_addr_t addr;
|
||||
|
||||
- switch_node = ofnode_by_compatible(ofnode_null(), "airoha,en7581-switch");
|
||||
+ switch_node = ofnode_by_compatible(ofnode_null(),
|
||||
+ data->switch_compatible);
|
||||
if (!ofnode_valid(switch_node))
|
||||
return -EINVAL;
|
||||
|
||||
@@ -717,17 +762,71 @@ static int airoha_switch_init(struct udevice *dev, struct airoha_eth *eth)
|
||||
FIELD_PREP(SWITCH_PHY_END_ADDR, 0xc) |
|
||||
FIELD_PREP(SWITCH_PHY_ST_ADDR, 0x8));
|
||||
|
||||
+ /* AN7583 require tweak to GEPHY_CONN_CFG and clear PHY BMCR_PDOWN */
|
||||
+ if (!strcmp(data->switch_compatible, "airoha,an7583-switch")) {
|
||||
+ int i;
|
||||
+
|
||||
+ airoha_switch_rmw(eth, SWITCH_GEPHY_CONN_CFG,
|
||||
+ SWITCH_DPHY_CKIN_SEL |
|
||||
+ SWITCH_PHY_CORE_REG_CLK_SEL |
|
||||
+ SWITCH_ETHER_AFE_PWD,
|
||||
+ SWITCH_DPHY_CKIN_SEL |
|
||||
+ SWITCH_PHY_CORE_REG_CLK_SEL |
|
||||
+ FIELD_PREP(SWITCH_ETHER_AFE_PWD, 0));
|
||||
+
|
||||
+ /* Disable BMCR_PDOWN for every PHY */
|
||||
+ for (i = 0; i < AIROHA_MAX_NUM_SWITCH_PORT; i++) {
|
||||
+ int try;
|
||||
+ u32 val;
|
||||
+
|
||||
+ airoha_switch_wr(eth, SWITCH_PBUS_PHY_IAC,
|
||||
+ SWITCH_PBUS_PHY_START |
|
||||
+ SWITCH_PBUS_PHY_CMD_READ |
|
||||
+ FIELD_PREP(SWITCH_PBUS_PHY_PORTADDR, i) |
|
||||
+ FIELD_PREP(SWITCH_PBUS_PHY_REGADDR,
|
||||
+ AIROHA_PBUS_C22_MASK | MII_BMCR));
|
||||
+
|
||||
+ for (try = 0; try < AIROHA_MAX_PBUS_TRY; try++) {
|
||||
+ val = airoha_switch_rr(eth, SWITCH_PBUS_PHY_IAC);
|
||||
+ if (!(val & SWITCH_PBUS_PHY_START))
|
||||
+ break;
|
||||
+
|
||||
+ udelay(AIROHA_PBUS_SLEEP);
|
||||
+ }
|
||||
+
|
||||
+ val = airoha_switch_rr(eth, SWITCH_PBUS_PHY_IARD);
|
||||
+ val &= ~BMCR_PDOWN;
|
||||
+
|
||||
+ airoha_switch_wr(eth, SWITCH_PBUS_PHY_IAWD, val);
|
||||
+ airoha_switch_wr(eth, SWITCH_PBUS_PHY_IAC,
|
||||
+ SWITCH_PBUS_PHY_START |
|
||||
+ SWITCH_PBUS_PHY_CMD_WRITE |
|
||||
+ FIELD_PREP(SWITCH_PBUS_PHY_PORTADDR, i) |
|
||||
+ FIELD_PREP(SWITCH_PBUS_PHY_REGADDR,
|
||||
+ AIROHA_PBUS_C22_MASK | MII_BMCR));
|
||||
+
|
||||
+ for (try = 0; try < AIROHA_MAX_PBUS_TRY; try++) {
|
||||
+ val = airoha_switch_rr(eth, SWITCH_PBUS_PHY_IAC);
|
||||
+ if (!(val & SWITCH_PBUS_PHY_START))
|
||||
+ break;
|
||||
+
|
||||
+ udelay(AIROHA_PBUS_SLEEP);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int airoha_eth_probe(struct udevice *dev)
|
||||
{
|
||||
+ struct airoha_eth_soc_data *data = (void *)dev_get_driver_data(dev);
|
||||
struct airoha_eth *eth = dev_get_priv(dev);
|
||||
struct regmap *scu_regmap;
|
||||
ofnode scu_node;
|
||||
- int ret;
|
||||
+ int i, ret;
|
||||
|
||||
- scu_node = ofnode_by_compatible(ofnode_null(), "airoha,en7581-scu");
|
||||
+ scu_node = data->get_scu_node(dev);
|
||||
if (!ofnode_valid(scu_node))
|
||||
return -EINVAL;
|
||||
|
||||
@@ -751,11 +850,11 @@ static int airoha_eth_probe(struct udevice *dev)
|
||||
return -ENOMEM;
|
||||
eth->rsts.count = AIROHA_MAX_NUM_RSTS;
|
||||
|
||||
- eth->xsi_rsts.resets = devm_kcalloc(dev, AIROHA_MAX_NUM_XSI_RSTS,
|
||||
+ eth->xsi_rsts.resets = devm_kcalloc(dev, data->num_xsi_rsts,
|
||||
sizeof(struct reset_ctl), GFP_KERNEL);
|
||||
if (!eth->xsi_rsts.resets)
|
||||
return -ENOMEM;
|
||||
- eth->xsi_rsts.count = AIROHA_MAX_NUM_XSI_RSTS;
|
||||
+ eth->xsi_rsts.count = data->num_xsi_rsts;
|
||||
|
||||
ret = reset_get_by_name(dev, "fe", ð->rsts.resets[0]);
|
||||
if (ret)
|
||||
@@ -769,21 +868,12 @@ static int airoha_eth_probe(struct udevice *dev)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
- ret = reset_get_by_name(dev, "hsi0-mac", ð->xsi_rsts.resets[0]);
|
||||
- if (ret)
|
||||
- return ret;
|
||||
-
|
||||
- ret = reset_get_by_name(dev, "hsi1-mac", ð->xsi_rsts.resets[1]);
|
||||
- if (ret)
|
||||
- return ret;
|
||||
-
|
||||
- ret = reset_get_by_name(dev, "hsi-mac", ð->xsi_rsts.resets[2]);
|
||||
- if (ret)
|
||||
- return ret;
|
||||
-
|
||||
- ret = reset_get_by_name(dev, "xfp-mac", ð->xsi_rsts.resets[3]);
|
||||
- if (ret)
|
||||
- return ret;
|
||||
+ for (i = 0; i < data->num_xsi_rsts; i++) {
|
||||
+ ret = reset_get_by_name(dev, data->xsi_rsts_names[i],
|
||||
+ ð->xsi_rsts.resets[i]);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ }
|
||||
|
||||
ret = airoha_hw_init(dev, eth);
|
||||
if (ret)
|
||||
@@ -971,8 +1061,43 @@ static int arht_eth_write_hwaddr(struct udevice *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static ofnode en7581_get_scu_node(struct udevice *dev)
|
||||
+{
|
||||
+ return ofnode_by_compatible(ofnode_null(), "airoha,en7581-scu");
|
||||
+}
|
||||
+
|
||||
+static ofnode an7583_get_scu_node(struct udevice *dev)
|
||||
+{
|
||||
+ ofnode scu_node;
|
||||
+
|
||||
+ scu_node = ofnode_by_compatible(ofnode_null(), "airoha,an7583-scu");
|
||||
+ if (!ofnode_valid(scu_node))
|
||||
+ return scu_node;
|
||||
+
|
||||
+ return ofnode_get_parent(scu_node);
|
||||
+}
|
||||
+
|
||||
+static const struct airoha_eth_soc_data en7581_data = {
|
||||
+ .xsi_rsts_names = en7581_xsi_rsts_names,
|
||||
+ .num_xsi_rsts = ARRAY_SIZE(en7581_xsi_rsts_names),
|
||||
+ .get_scu_node = en7581_get_scu_node,
|
||||
+ .switch_compatible = "airoha,en7581-switch",
|
||||
+};
|
||||
+
|
||||
+static const struct airoha_eth_soc_data an7583_data = {
|
||||
+ .xsi_rsts_names = an7583_xsi_rsts_names,
|
||||
+ .num_xsi_rsts = ARRAY_SIZE(an7583_xsi_rsts_names),
|
||||
+ .get_scu_node = an7583_get_scu_node,
|
||||
+ .switch_compatible = "airoha,an7583-switch",
|
||||
+};
|
||||
+
|
||||
static const struct udevice_id airoha_eth_ids[] = {
|
||||
- { .compatible = "airoha,en7581-eth" },
|
||||
+ { .compatible = "airoha,en7581-eth",
|
||||
+ .data = (ulong)&en7581_data,
|
||||
+ },
|
||||
+ { .compatible = "airoha,an7583-eth",
|
||||
+ .data = (ulong)&an7583_data,
|
||||
+ },
|
||||
{ }
|
||||
};
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
From 613d695d0939cbbe6b66933267e3a4be263e1c7b Mon Sep 17 00:00:00 2001
|
||||
From: Christian Marangi <ansuelsmth@gmail.com>
|
||||
Date: Mon, 19 May 2025 14:31:59 +0200
|
||||
Subject: [PATCH 2/4] airoha: add Ethernet node in AN7583 dtsi
|
||||
|
||||
Add Ethernet node in AN7583 dtsi to add support for the integrated
|
||||
Ethernet Controller.
|
||||
|
||||
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
||||
---
|
||||
arch/arm/dts/an7583.dtsi | 23 +++++++++++++++++++++++
|
||||
1 file changed, 23 insertions(+)
|
||||
|
||||
--- a/arch/arm/dts/an7583.dtsi
|
||||
+++ b/arch/arm/dts/an7583.dtsi
|
||||
@@ -130,6 +130,29 @@
|
||||
reg = <0x0 0x1fa20000 0x0 0x388>;
|
||||
};
|
||||
|
||||
+ eth: ethernet@1fb50000 {
|
||||
+ compatible = "airoha,an7583-eth";
|
||||
+ reg = <0 0x1fb50000 0 0x2600>,
|
||||
+ <0 0x1fb54000 0 0x2000>,
|
||||
+ <0 0x1fb56000 0 0x2000>;
|
||||
+ reg-names = "fe", "qdma0", "qdma1";
|
||||
+
|
||||
+ resets = <&scuclk AN7583_FE_RST>,
|
||||
+ <&scuclk AN7583_FE_PDMA_RST>,
|
||||
+ <&scuclk AN7583_FE_QDMA_RST>,
|
||||
+ <&scuclk AN7583_DUAL_HSI0_MAC_RST>,
|
||||
+ <&scuclk AN7583_DUAL_HSI1_MAC_RST>,
|
||||
+ <&scuclk AN7583_XFP_MAC_RST>;
|
||||
+ reset-names = "fe", "pdma", "qdma",
|
||||
+ "hsi0-mac", "hsi1-mac",
|
||||
+ "xfp-mac";
|
||||
+ };
|
||||
+
|
||||
+ switch: switch@1fb58000 {
|
||||
+ compatible = "airoha,an7583-switch";
|
||||
+ reg = <0 0x1fb58000 0 0x8000>;
|
||||
+ };
|
||||
+
|
||||
syscon@1fbe3400 {
|
||||
compatible = "airoha,en7581-pbus-csr", "syscon";
|
||||
reg = <0x0 0x1fbe3400 0x0 0xff>;
|
||||
@@ -1,65 +0,0 @@
|
||||
From 1a3039c1e3a194b3f1e72b4506f8bdcd5b10fbbf Mon Sep 17 00:00:00 2001
|
||||
From: Christian Marangi <ansuelsmth@gmail.com>
|
||||
Date: Mon, 19 May 2025 14:52:26 +0200
|
||||
Subject: [PATCH] airoha: add MMC node for Airoha AN7583
|
||||
|
||||
Add MMC node for Airoha AN7583. These follow the same node of Airoha
|
||||
AN7581.
|
||||
|
||||
Similar to Airoha AN7581, add the fixed regulator and fixed clock for
|
||||
MMC.
|
||||
|
||||
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
||||
---
|
||||
arch/arm/dts/an7583.dtsi | 33 +++++++++++++++++++++++++++++++++
|
||||
1 file changed, 33 insertions(+)
|
||||
|
||||
--- a/arch/arm/dts/an7583.dtsi
|
||||
+++ b/arch/arm/dts/an7583.dtsi
|
||||
@@ -105,6 +105,21 @@
|
||||
<GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>;
|
||||
};
|
||||
|
||||
+ clk25m: oscillator {
|
||||
+ compatible = "fixed-clock";
|
||||
+ #clock-cells = <0>;
|
||||
+ clock-frequency = <25000000>;
|
||||
+ clock-output-names = "clkxtal";
|
||||
+ };
|
||||
+
|
||||
+ vmmc_3v3: regulator-vmmc-3v3 {
|
||||
+ compatible = "regulator-fixed";
|
||||
+ regulator-name = "vmmc";
|
||||
+ regulator-min-microvolt = <3300000>;
|
||||
+ regulator-max-microvolt = <3300000>;
|
||||
+ regulator-always-on;
|
||||
+ };
|
||||
+
|
||||
soc {
|
||||
compatible = "simple-bus";
|
||||
#address-cells = <2>;
|
||||
@@ -259,6 +274,24 @@
|
||||
};
|
||||
};
|
||||
|
||||
+ mmc0: mmc@1fa0e000 {
|
||||
+ compatible = "mediatek,mt7622-mmc";
|
||||
+ reg = <0x0 0x1fa0e000 0x0 0x1000>,
|
||||
+ <0x0 0x1fa0c000 0x0 0x60>;
|
||||
+ interrupts = <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ clocks = <&scuclk EN7581_CLK_EMMC>, <&clk25m>;
|
||||
+ clock-names = "source", "hclk";
|
||||
+ bus-width = <4>;
|
||||
+ max-frequency = <52000000>;
|
||||
+ vmmc-supply = <&vmmc_3v3>;
|
||||
+ disable-wp;
|
||||
+ cap-mmc-highspeed;
|
||||
+ non-removable;
|
||||
+
|
||||
+ assigned-clocks = <&scuclk EN7581_CLK_EMMC>;
|
||||
+ assigned-clock-rates = <200000000>;
|
||||
+ };
|
||||
+
|
||||
uart1: serial@1fbf0000 {
|
||||
compatible = "ns16550";
|
||||
reg = <0x0 0x1fbf0000 0x0 0x30>;
|
||||
@@ -1,93 +0,0 @@
|
||||
From e7b7bd119b68fe9106a1c9a45a7eba811fc40ce0 Mon Sep 17 00:00:00 2001
|
||||
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
Date: Fri, 3 Oct 2025 20:12:06 +0300
|
||||
Subject: [PATCH v2 1/2] net: airoha: simplify rx/free packet logic a bit
|
||||
|
||||
The commit 997786bbf473 ("drivers/net/airoha_eth: fix stalling in package
|
||||
receiving") can be improved. Instead of returning previous descriptor
|
||||
it's possible:
|
||||
* do nothing in even descriptor case
|
||||
* return 2 descriptor to the queue (current and previous) in the odd
|
||||
descriptor case.
|
||||
|
||||
This patch:
|
||||
* implements above approach
|
||||
* remove logic not required within new approach
|
||||
* adds note that PKTBUFSRX must be even and larger than 7
|
||||
for reliable driver operations
|
||||
|
||||
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
---
|
||||
drivers/net/airoha_eth.c | 40 +++++++++++++++++++++-------------------
|
||||
1 file changed, 21 insertions(+), 19 deletions(-)
|
||||
|
||||
--- a/drivers/net/airoha_eth.c
|
||||
+++ b/drivers/net/airoha_eth.c
|
||||
@@ -492,14 +492,10 @@ static int airoha_qdma_init_rx_queue(struct airoha_queue *q,
|
||||
RX_RING_SIZE_MASK,
|
||||
FIELD_PREP(RX_RING_SIZE_MASK, ndesc));
|
||||
|
||||
- /*
|
||||
- * See arht_eth_free_pkt() for the reasons used to fill
|
||||
- * REG_RX_CPU_IDX(qid) register.
|
||||
- */
|
||||
airoha_qdma_rmw(qdma, REG_RX_RING_SIZE(qid), RX_RING_THR_MASK,
|
||||
FIELD_PREP(RX_RING_THR_MASK, 0));
|
||||
airoha_qdma_rmw(qdma, REG_RX_CPU_IDX(qid), RX_RING_CPU_IDX_MASK,
|
||||
- FIELD_PREP(RX_RING_CPU_IDX_MASK, q->ndesc - 3));
|
||||
+ FIELD_PREP(RX_RING_CPU_IDX_MASK, q->ndesc - 1));
|
||||
airoha_qdma_rmw(qdma, REG_RX_DMA_IDX(qid), RX_RING_DMA_IDX_MASK,
|
||||
FIELD_PREP(RX_RING_DMA_IDX_MASK, q->head));
|
||||
|
||||
@@ -1010,7 +1006,6 @@ static int arht_eth_free_pkt(struct udevice *dev, uchar *packet, int length)
|
||||
struct airoha_qdma *qdma = ð->qdma[0];
|
||||
struct airoha_queue *q;
|
||||
int qid;
|
||||
- u16 prev, pprev;
|
||||
|
||||
if (!packet)
|
||||
return 0;
|
||||
@@ -1020,22 +1015,29 @@ static int arht_eth_free_pkt(struct udevice *dev, uchar *packet, int length)
|
||||
|
||||
/*
|
||||
* Due to cpu cache issue the airoha_qdma_reset_rx_desc() function
|
||||
- * will always touch 2 descriptors:
|
||||
- * - if current descriptor is even, then the previous and the one
|
||||
- * before previous descriptors will be touched (previous cacheline)
|
||||
- * - if current descriptor is odd, then only current and previous
|
||||
- * descriptors will be touched (current cacheline)
|
||||
+ * will always touch 2 descriptors placed on the same cacheline:
|
||||
+ * - if current descriptor is even, then current and next
|
||||
+ * descriptors will be touched
|
||||
+ * - if current descriptor is odd, then current and previous
|
||||
+ * descriptors will be touched
|
||||
*
|
||||
- * Thus, to prevent possible destroying of rx queue, only (q->ndesc - 2)
|
||||
- * descriptors might be used for packet receiving.
|
||||
+ * Thus, to prevent possible destroying of rx queue, we should:
|
||||
+ * - do nothing in the even descriptor case,
|
||||
+ * - utilize 2 descriptors (current and previous one) in the
|
||||
+ * odd descriptor case.
|
||||
+ *
|
||||
+ * WARNING: Observations shows that PKTBUFSRX must be even and
|
||||
+ * larger than 7 for reliable driver operations.
|
||||
*/
|
||||
- prev = (q->head + q->ndesc - 1) % q->ndesc;
|
||||
- pprev = (q->head + q->ndesc - 2) % q->ndesc;
|
||||
- q->head = (q->head + 1) % q->ndesc;
|
||||
+ if (q->head & 0x01) {
|
||||
+ airoha_qdma_reset_rx_desc(q, q->head - 1);
|
||||
+ airoha_qdma_reset_rx_desc(q, q->head);
|
||||
|
||||
- airoha_qdma_reset_rx_desc(q, prev);
|
||||
- airoha_qdma_rmw(qdma, REG_RX_CPU_IDX(qid), RX_RING_CPU_IDX_MASK,
|
||||
- FIELD_PREP(RX_RING_CPU_IDX_MASK, pprev));
|
||||
+ airoha_qdma_rmw(qdma, REG_RX_CPU_IDX(qid), RX_RING_CPU_IDX_MASK,
|
||||
+ FIELD_PREP(RX_RING_CPU_IDX_MASK, q->head));
|
||||
+ }
|
||||
+
|
||||
+ q->head = (q->head + 1) % q->ndesc;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
From 75d82c8878b2ffff489fbc7a5c0381f8f6484ec2 Mon Sep 17 00:00:00 2001
|
||||
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
Date: Fri, 3 Oct 2025 05:28:41 +0300
|
||||
Subject: [PATCH 5/5] net: airoha: increase the number of rx network buffers
|
||||
|
||||
According to commit 997786bbf473 ("drivers/net/airoha_eth: fix stalling
|
||||
in package receiving") the minimal possible value of SYS_RX_ETH_BUFFER
|
||||
is 4. Unfortunately it's too small for reliable ping.
|
||||
|
||||
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
---
|
||||
configs/an7581_evb_defconfig | 1 +
|
||||
configs/an7583_evb_defconfig | 1 +
|
||||
2 files changed, 2 insertions(+)
|
||||
|
||||
--- a/configs/an7581_evb_defconfig
|
||||
+++ b/configs/an7581_evb_defconfig
|
||||
@@ -43,6 +43,7 @@ CONFIG_ENV_IS_IN_MMC=y
|
||||
CONFIG_ENV_RELOC_GD_ENV_ADDR=y
|
||||
CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_SYS_RX_ETH_BUFFER=8
|
||||
CONFIG_REGMAP=y
|
||||
CONFIG_SYSCON=y
|
||||
CONFIG_CLK=y
|
||||
--- a/configs/an7583_evb_defconfig
|
||||
+++ b/configs/an7583_evb_defconfig
|
||||
@@ -44,6 +44,7 @@ CONFIG_ENV_IS_IN_MMC=y
|
||||
CONFIG_ENV_RELOC_GD_ENV_ADDR=y
|
||||
CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_SYS_RX_ETH_BUFFER=8
|
||||
CONFIG_REGMAP=y
|
||||
CONFIG_SYSCON=y
|
||||
CONFIG_CLK=y
|
||||
@@ -1,109 +0,0 @@
|
||||
From 28a72d957b897e7f7212c11f99052a32b0f6abc4 Mon Sep 17 00:00:00 2001
|
||||
From: Christian Marangi <ansuelsmth@gmail.com>
|
||||
Date: Wed, 28 May 2025 03:10:53 +0200
|
||||
Subject: [PATCH 1/2] airoha: enable UBI support and define default partition
|
||||
|
||||
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
||||
---
|
||||
arch/arm/dts/an7581-u-boot.dtsi | 16 ++++++++++++++++
|
||||
arch/arm/dts/an7583-evb.dts | 22 ++++++++++++++++++++++
|
||||
configs/an7581_evb_defconfig | 16 ++++++++++++++++
|
||||
configs/an7583_evb_defconfig | 16 ++++++++++++++++
|
||||
4 files changed, 70 insertions(+)
|
||||
|
||||
--- a/arch/arm/dts/an7581-u-boot.dtsi
|
||||
+++ b/arch/arm/dts/an7581-u-boot.dtsi
|
||||
@@ -76,6 +76,22 @@
|
||||
spi-max-frequency = <50000000>;
|
||||
spi-tx-bus-width = <1>;
|
||||
spi-rx-bus-width = <2>;
|
||||
+
|
||||
+ partitions {
|
||||
+ compatible = "fixed-partitions";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+
|
||||
+ bl2@0 {
|
||||
+ label = "bl2";
|
||||
+ reg = <0x0 0x20000>;
|
||||
+ };
|
||||
+
|
||||
+ ubi@20000 {
|
||||
+ label = "ubi";
|
||||
+ reg = <0x20000 0x0>;
|
||||
+ };
|
||||
+ };
|
||||
};
|
||||
};
|
||||
|
||||
--- a/arch/arm/dts/an7583-evb.dts
|
||||
+++ b/arch/arm/dts/an7583-evb.dts
|
||||
@@ -46,6 +46,24 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&spi_nand {
|
||||
+ partitions {
|
||||
+ compatible = "fixed-partitions";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+
|
||||
+ bl2@0 {
|
||||
+ label = "bl2";
|
||||
+ reg = <0x0 0x20000>;
|
||||
+ };
|
||||
+
|
||||
+ ubi@20000 {
|
||||
+ label = "ubi";
|
||||
+ reg = <0x20000 0x0>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
&pcie0 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pcie0_rst_pins>;
|
||||
--- a/configs/an7581_evb_defconfig
|
||||
+++ b/configs/an7581_evb_defconfig
|
||||
@@ -78,3 +78,19 @@ CONFIG_SPI=y
|
||||
CONFIG_DM_SPI=y
|
||||
CONFIG_AIROHA_SNFI_SPI=y
|
||||
CONFIG_SHA512=y
|
||||
+CONFIG_CMD_UBI=y
|
||||
+# CONFIG_CMD_UBI_RENAME is not set
|
||||
+CONFIG_CMD_UBIFS=y
|
||||
+CONFIG_ENV_IS_IN_UBI=y
|
||||
+CONFIG_ENV_UBI_PART="ubi"
|
||||
+CONFIG_ENV_UBI_VOLUME="ubootenv"
|
||||
+CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2"
|
||||
+CONFIG_ENV_UBI_VID_OFFSET=0
|
||||
+CONFIG_MTD_UBI=y
|
||||
+CONFIG_MTD_UBI_MODULE=y
|
||||
+CONFIG_MTD_UBI_WL_THRESHOLD=4096
|
||||
+CONFIG_MTD_UBI_BEB_LIMIT=20
|
||||
+# CONFIG_MTD_UBI_FASTMAP is not set
|
||||
+CONFIG_UBI_BLOCK=y
|
||||
+# CONFIG_UBIFS_SILENCE_MSG is not set
|
||||
+# CONFIG_UBIFS_SILENCE_DEBUG_DUMP is not set
|
||||
--- a/configs/an7583_evb_defconfig
|
||||
+++ b/configs/an7583_evb_defconfig
|
||||
@@ -80,3 +80,19 @@ CONFIG_SHA512=y
|
||||
CONFIG_AIROHA_ETH=y
|
||||
CONFIG_MMC_MTK=y
|
||||
CONFIG_AIROHA_SNFI_SPI=y
|
||||
+CONFIG_CMD_UBI=y
|
||||
+# CONFIG_CMD_UBI_RENAME is not set
|
||||
+CONFIG_CMD_UBIFS=y
|
||||
+CONFIG_ENV_IS_IN_UBI=y
|
||||
+CONFIG_ENV_UBI_PART="ubi"
|
||||
+CONFIG_ENV_UBI_VOLUME="ubootenv"
|
||||
+CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2"
|
||||
+CONFIG_ENV_UBI_VID_OFFSET=0
|
||||
+CONFIG_MTD_UBI=y
|
||||
+CONFIG_MTD_UBI_MODULE=y
|
||||
+CONFIG_MTD_UBI_WL_THRESHOLD=4096
|
||||
+CONFIG_MTD_UBI_BEB_LIMIT=20
|
||||
+# CONFIG_MTD_UBI_FASTMAP is not set
|
||||
+CONFIG_UBI_BLOCK=y
|
||||
+# CONFIG_UBIFS_SILENCE_MSG is not set
|
||||
+# CONFIG_UBIFS_SILENCE_DEBUG_DUMP is not set
|
||||
@@ -1,45 +0,0 @@
|
||||
From f85e675d7be222d88246bfdb42a1faac92f1eb63 Mon Sep 17 00:00:00 2001
|
||||
From: Christian Marangi <ansuelsmth@gmail.com>
|
||||
Date: Wed, 28 May 2025 03:18:32 +0200
|
||||
Subject: [PATCH 2/2] airoha: add default configuration
|
||||
|
||||
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
||||
---
|
||||
configs/an7581_evb_defconfig | 2 ++
|
||||
configs/an7583_evb_defconfig | 2 ++
|
||||
defenvs/an7581_rfb_env | 4 ++++
|
||||
defenvs/an7583_rfb_env | 4 ++++
|
||||
4 files changed, 12 insertions(+)
|
||||
create mode 100644 defenvs/an7581_rfb_env
|
||||
create mode 100644 defenvs/an7583_rfb_env
|
||||
|
||||
--- a/configs/an7581_evb_defconfig
|
||||
+++ b/configs/an7581_evb_defconfig
|
||||
@@ -94,3 +94,5 @@ CONFIG_MTD_UBI_BEB_LIMIT=20
|
||||
CONFIG_UBI_BLOCK=y
|
||||
# CONFIG_UBIFS_SILENCE_MSG is not set
|
||||
# CONFIG_UBIFS_SILENCE_DEBUG_DUMP is not set
|
||||
+CONFIG_ENV_USE_DEFAULT_ENV_TEXT_FILE=y
|
||||
+CONFIG_ENV_DEFAULT_ENV_TEXT_FILE="defenvs/an7581_rfb_env"
|
||||
--- a/configs/an7583_evb_defconfig
|
||||
+++ b/configs/an7583_evb_defconfig
|
||||
@@ -96,3 +96,5 @@ CONFIG_MTD_UBI_BEB_LIMIT=20
|
||||
CONFIG_UBI_BLOCK=y
|
||||
# CONFIG_UBIFS_SILENCE_MSG is not set
|
||||
# CONFIG_UBIFS_SILENCE_DEBUG_DUMP is not set
|
||||
+CONFIG_ENV_USE_DEFAULT_ENV_TEXT_FILE=y
|
||||
+CONFIG_ENV_DEFAULT_ENV_TEXT_FILE="defenvs/an7583_rfb_env"
|
||||
--- /dev/null
|
||||
+++ b/defenvs/an7581_rfb_env
|
||||
@@ -0,0 +1,4 @@
|
||||
+loadaddr=0x81800000
|
||||
+ipaddr=192.168.1.1
|
||||
+serverip=192.168.1.10
|
||||
+bootargs=ubi.mtd=ubi root=/dev/ubiblock0_5 rootwait
|
||||
--- /dev/null
|
||||
+++ b/defenvs/an7583_rfb_env
|
||||
@@ -0,0 +1,4 @@
|
||||
+loadaddr=0x81800000
|
||||
+ipaddr=192.168.1.1
|
||||
+serverip=192.168.1.10
|
||||
+bootargs=ubi.mtd=ubi root=/dev/ubiblock0_5 rootwait
|
||||
@@ -1,40 +0,0 @@
|
||||
From 10bd131a6a365965ce868419933fd7936e91c635 Mon Sep 17 00:00:00 2001
|
||||
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
Date: Mon, 13 Oct 2025 20:48:00 +0300
|
||||
Subject: [PATCH 2/3] arm: airoha: disable environment inside mtd partition
|
||||
|
||||
When booting on en7581_evb board equipped with spinand flash, a u-boot
|
||||
panic occurs. The panic is caused by the absence any available mtd
|
||||
partition.
|
||||
|
||||
Disable CONFIG_ENV_IS_IN_MTD to avoid an issue. The environment will
|
||||
be stored in the EMMC or in UBI, so actually CONFIG_ENV_IS_IN_MTD is
|
||||
not needed.
|
||||
|
||||
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
---
|
||||
configs/an7581_evb_defconfig | 1 +
|
||||
configs/an7583_evb_defconfig | 1 +
|
||||
2 files changed, 2 insertions(+)
|
||||
|
||||
--- a/configs/an7581_evb_defconfig
|
||||
+++ b/configs/an7581_evb_defconfig
|
||||
@@ -40,6 +40,7 @@ CONFIG_CMD_LOG=y
|
||||
CONFIG_OF_UPSTREAM=y
|
||||
CONFIG_ENV_OVERWRITE=y
|
||||
CONFIG_ENV_IS_IN_MMC=y
|
||||
+# CONFIG_ENV_IS_IN_MTD is not set
|
||||
CONFIG_ENV_RELOC_GD_ENV_ADDR=y
|
||||
CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
CONFIG_NET_RANDOM_ETHADDR=y
|
||||
--- a/configs/an7583_evb_defconfig
|
||||
+++ b/configs/an7583_evb_defconfig
|
||||
@@ -41,6 +41,7 @@ CONFIG_CMD_MTDPARTS=y
|
||||
CONFIG_CMD_LOG=y
|
||||
CONFIG_ENV_OVERWRITE=y
|
||||
CONFIG_ENV_IS_IN_MMC=y
|
||||
+# CONFIG_ENV_IS_IN_MTD is not set
|
||||
CONFIG_ENV_RELOC_GD_ENV_ADDR=y
|
||||
CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
CONFIG_NET_RANDOM_ETHADDR=y
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
From 6c4a07ecf211b56eb28fe2dbd8e324b2fdecb84a Mon Sep 17 00:00:00 2001
|
||||
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
Date: Mon, 13 Oct 2025 20:44:24 +0300
|
||||
Subject: [PATCH 1/3] arm: airoha: dts: enable spi support for en7581_evb board
|
||||
|
||||
spinand flashes are inaccessible without this patch
|
||||
|
||||
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
---
|
||||
arch/arm/dts/en7581-evb-u-boot.dtsi | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
--- a/arch/arm/dts/en7581-evb-u-boot.dtsi
|
||||
+++ b/arch/arm/dts/en7581-evb-u-boot.dtsi
|
||||
@@ -9,3 +9,7 @@
|
||||
};
|
||||
|
||||
#include "an7581-u-boot.dtsi"
|
||||
+
|
||||
+&snfi {
|
||||
+ status = "okay";
|
||||
+};
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
From bee36b6f42792556e123f331ece80f8d5a40e8cd Mon Sep 17 00:00:00 2001
|
||||
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
Date: Mon, 13 Oct 2025 20:56:31 +0300
|
||||
Subject: [PATCH 3/3] arm: airoha: enable position independent code
|
||||
|
||||
This slightly increase the code, but makes debugging a bit easy
|
||||
|
||||
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
---
|
||||
configs/an7581_evb_defconfig | 1 +
|
||||
configs/an7583_evb_defconfig | 1 +
|
||||
2 files changed, 2 insertions(+)
|
||||
|
||||
--- a/configs/an7581_evb_defconfig
|
||||
+++ b/configs/an7581_evb_defconfig
|
||||
@@ -1,5 +1,6 @@
|
||||
CONFIG_ARM=y
|
||||
CONFIG_ARCH_AIROHA=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
CONFIG_TEXT_BASE=0x81E00000
|
||||
CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
CONFIG_NR_DRAM_BANKS=1
|
||||
--- a/configs/an7583_evb_defconfig
|
||||
+++ b/configs/an7583_evb_defconfig
|
||||
@@ -1,5 +1,6 @@
|
||||
CONFIG_ARM=y
|
||||
CONFIG_ARCH_AIROHA=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
CONFIG_TARGET_AN7583=y
|
||||
CONFIG_TEXT_BASE=0x81E00000
|
||||
CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_VERSION:=2025.10
|
||||
PKG_HASH:=b4f032848e56cc8f213ad59f9132c084dbbb632bc29176d024e58220e0efdf4a
|
||||
PKG_VERSION:=2025.04
|
||||
PKG_HASH:=439d3bef296effd54130be6a731c5b118be7fddd7fcc663ccbc5fb18294d8718
|
||||
|
||||
UBOOT_USE_INTREE_DTC:=1
|
||||
|
||||
@@ -19,19 +19,12 @@ define U-Boot/Default
|
||||
endef
|
||||
|
||||
define U-Boot/ar9344_nec_aterm
|
||||
NAME:=NEC Aterm series (AR9344, GbE)
|
||||
NAME:=NEC Aterm series (AR9344)
|
||||
BUILD_SUBTARGET:= tiny
|
||||
BUILD_DEVICES:=nec_wg600hp nec_wr8750n nec_wr9500n
|
||||
UBOOT_CONFIG:=nec_ar9344_aterm
|
||||
endef
|
||||
|
||||
define U-Boot/ar9344_nec_aterm_fe
|
||||
NAME:=NEC Aterm series (AR9344, FE)
|
||||
BUILD_SUBTARGET:= tiny
|
||||
BUILD_DEVICES:=nec_wf1200hp nec_wf1200hp2
|
||||
UBOOT_CONFIG:=nec_ar9344_aterm_fe
|
||||
endef
|
||||
|
||||
define U-Boot/qca9558_nec_aterm
|
||||
NAME:=NEC Aterm series (QCA9558)
|
||||
BUILD_SUBTARGET:= generic
|
||||
@@ -39,7 +32,7 @@ define U-Boot/qca9558_nec_aterm
|
||||
UBOOT_CONFIG:=nec_qca9558_aterm
|
||||
endef
|
||||
|
||||
UBOOT_TARGETS := ar9344_nec_aterm ar9344_nec_aterm_fe qca9558_nec_aterm
|
||||
UBOOT_TARGETS := ar9344_nec_aterm qca9558_nec_aterm
|
||||
|
||||
# don't stage files to bindir, let target/linux/ath79/image/*.mk do that
|
||||
define Package/u-boot/install
|
||||
|
||||
@@ -5,26 +5,24 @@ Subject: [PATCH] ath79: add support for NEC AR9344 Aterm series
|
||||
|
||||
---
|
||||
arch/mips/dts/Makefile | 1 +
|
||||
arch/mips/dts/nec,ar9344-aterm.dts | 35 ++++++++++++++
|
||||
arch/mips/mach-ath79/Kconfig | 5 ++
|
||||
board/nec/ar9344_aterm/Kconfig | 33 +++++++++++++
|
||||
arch/mips/dts/nec,ar9344-aterm.dts | 35 +++++++++++++++
|
||||
arch/mips/mach-ath79/Kconfig | 5 +++
|
||||
board/nec/ar9344_aterm/Kconfig | 30 +++++++++++++
|
||||
board/nec/ar9344_aterm/Makefile | 3 ++
|
||||
board/nec/ar9344_aterm/ar9344_aterm.c | 70 +++++++++++++++++++++++++++
|
||||
configs/nec_ar9344_aterm_defconfig | 61 +++++++++++++++++++++++
|
||||
configs/nec_ar9344_aterm_fe_defconfig | 62 ++++++++++++++++++++++++
|
||||
include/configs/nec_ar9344_aterm.h | 28 +++++++++++
|
||||
9 files changed, 298 insertions(+)
|
||||
board/nec/ar9344_aterm/ar9344_aterm.c | 59 ++++++++++++++++++++++++++
|
||||
configs/nec_ar9344_aterm_defconfig | 61 +++++++++++++++++++++++++++
|
||||
include/configs/nec_ar9344_aterm.h | 28 ++++++++++++
|
||||
8 files changed, 222 insertions(+)
|
||||
create mode 100644 arch/mips/dts/nec,ar9344-aterm.dts
|
||||
create mode 100644 board/nec/ar9344_aterm/Kconfig
|
||||
create mode 100644 board/nec/ar9344_aterm/Makefile
|
||||
create mode 100644 board/nec/ar9344_aterm/ar9344_aterm.c
|
||||
create mode 100644 configs/nec_ar9344_aterm_defconfig
|
||||
create mode 100644 configs/nec_ar9344_aterm_fe_defconfig
|
||||
create mode 100644 include/configs/nec_ar9344_aterm.h
|
||||
|
||||
--- a/arch/mips/dts/Makefile
|
||||
+++ b/arch/mips/dts/Makefile
|
||||
@@ -23,6 +23,7 @@ dtb-$(CONFIG_BOARD_GARDENA_SMART_GATEWAY
|
||||
@@ -24,6 +24,7 @@ dtb-$(CONFIG_BOARD_GARDENA_SMART_GATEWAY
|
||||
dtb-$(CONFIG_BOARD_LINKIT_SMART_7688) += linkit-smart-7688.dtb
|
||||
dtb-$(CONFIG_TARGET_OCTEON_EBB7304) += mrvl,octeon-ebb7304.dtb
|
||||
dtb-$(CONFIG_TARGET_OCTEON_NIC23) += mrvl,octeon-nic23.dtb
|
||||
@@ -93,7 +91,7 @@ Subject: [PATCH] ath79: add support for NEC AR9344 Aterm series
|
||||
endmenu
|
||||
--- /dev/null
|
||||
+++ b/board/nec/ar9344_aterm/Kconfig
|
||||
@@ -0,0 +1,33 @@
|
||||
@@ -0,0 +1,30 @@
|
||||
+if BOARD_NEC_AR9344_ATERM
|
||||
+
|
||||
+config SYS_VENDOR
|
||||
@@ -123,9 +121,6 @@ Subject: [PATCH] ath79: add support for NEC AR9344 Aterm series
|
||||
+config SYS_ICACHE_LINE_SIZE
|
||||
+ default 32
|
||||
+
|
||||
+config BOARD_NEC_AR9344_ATERM_FE
|
||||
+ bool "Aterm devices based on AR9344 with FE ports"
|
||||
+
|
||||
+endif
|
||||
--- /dev/null
|
||||
+++ b/board/nec/ar9344_aterm/Makefile
|
||||
@@ -135,7 +130,7 @@ Subject: [PATCH] ath79: add support for NEC AR9344 Aterm series
|
||||
+obj-y = ar9344_aterm.o
|
||||
--- /dev/null
|
||||
+++ b/board/nec/ar9344_aterm/ar9344_aterm.c
|
||||
@@ -0,0 +1,70 @@
|
||||
@@ -0,0 +1,59 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0+
|
||||
+/*
|
||||
+ * Copyright (C) 2024 INAGAKI Hiroshi <musashino.open@gmail.com>
|
||||
@@ -161,27 +156,16 @@ Subject: [PATCH] ath79: add support for NEC AR9344 Aterm series
|
||||
+ writel(0x2, regs + AR934X_GPIO_REG_FUNC);
|
||||
+
|
||||
+ /* Configure default GPIO OE/SET regs */
|
||||
+#if defined(CONFIG_BOARD_NEC_AR9344_ATERM_FE)
|
||||
+ writel(0x39b1f, regs + AR71XX_GPIO_REG_OE);
|
||||
+ writel(0x040000, regs + AR71XX_GPIO_REG_SET);
|
||||
+#else
|
||||
+ writel(0x3db1f, regs + AR71XX_GPIO_REG_OE);
|
||||
+ writel(0x142000, regs + AR71XX_GPIO_REG_SET);
|
||||
+#endif
|
||||
+
|
||||
+ /* Configure pin multiplexing */
|
||||
+ writel(0x00000000, regs + AR934X_GPIO_REG_OUT_FUNC0);
|
||||
+ writel(0x0b0a0900, regs + AR934X_GPIO_REG_OUT_FUNC1);
|
||||
+ writel(0x00180000, regs + AR934X_GPIO_REG_OUT_FUNC2);
|
||||
+ writel(0x2f2e0000, regs + AR934X_GPIO_REG_OUT_FUNC4);
|
||||
+
|
||||
+#if defined(CONFIG_BOARD_NEC_AR9344_ATERM_FE)
|
||||
+ writel(0x002b2a00, regs + AR934X_GPIO_REG_OUT_FUNC3);
|
||||
+ writel(0x002c2d00, regs + AR934X_GPIO_REG_OUT_FUNC5);
|
||||
+#else
|
||||
+ writel(0x00000000, regs + AR934X_GPIO_REG_OUT_FUNC3);
|
||||
+ writel(0x2f2e0000, regs + AR934X_GPIO_REG_OUT_FUNC4);
|
||||
+ writel(0x00000000, regs + AR934X_GPIO_REG_OUT_FUNC5);
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
+#ifdef CONFIG_DEBUG_UART_BOARD_INIT
|
||||
@@ -271,71 +255,6 @@ Subject: [PATCH] ath79: add support for NEC AR9344 Aterm series
|
||||
+CONFIG_SYS_NS16550=y
|
||||
+# CONFIG_GZIP is not set
|
||||
--- /dev/null
|
||||
+++ b/configs/nec_ar9344_aterm_fe_defconfig
|
||||
@@ -0,0 +1,62 @@
|
||||
+CONFIG_MIPS=y
|
||||
+CONFIG_SYS_MALLOC_LEN=0x40000
|
||||
+CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
|
||||
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xbd007fff
|
||||
+CONFIG_ENV_SIZE=0x1000
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="nec,ar9344-aterm"
|
||||
+CONFIG_SYS_LOAD_ADDR=0x83000000
|
||||
+CONFIG_ARCH_ATH79=y
|
||||
+CONFIG_BOARD_NEC_AR9344_ATERM=y
|
||||
+CONFIG_BOARD_NEC_AR9344_ATERM_FE=y
|
||||
+CONFIG_SYS_MIPS_TIMER_FREQ=280000000
|
||||
+CONFIG_MIPS_RELOCATION_TABLE_SIZE=0x4000
|
||||
+# CONFIG_LOCALVERSION_AUTO is not set
|
||||
+CONFIG_TIMESTAMP=y
|
||||
+CONFIG_BOOTDELAY=3
|
||||
+# CONFIG_ARCH_FIXUP_FDT_MEMORY is not set
|
||||
+CONFIG_USE_BOOTARGS=y
|
||||
+CONFIG_BOOTARGS="console=ttyS0,115200"
|
||||
+CONFIG_USE_BOOTCOMMAND=y
|
||||
+CONFIG_BOOTCOMMAND="bootm 0x9f040000"
|
||||
+# CONFIG_DISPLAY_BOARDINFO is not set
|
||||
+CONFIG_BOARD_EARLY_INIT_F=y
|
||||
+CONFIG_SYS_MALLOC_BOOTPARAMS=y
|
||||
+# CONFIG_CMDLINE_EDITING is not set
|
||||
+# CONFIG_AUTO_COMPLETE is not set
|
||||
+# CONFIG_SYS_LONGHELP is not set
|
||||
+CONFIG_SYS_MAXARGS=32
|
||||
+# CONFIG_SYS_XTRACE is not set
|
||||
+# CONFIG_CMD_BDI is not set
|
||||
+# CONFIG_CMD_CONSOLE is not set
|
||||
+# CONFIG_BOOTM_PLAN9 is not set
|
||||
+# CONFIG_BOOTM_RTEMS is not set
|
||||
+# CONFIG_BOOTM_VXWORKS is not set
|
||||
+# CONFIG_CMD_ELF is not set
|
||||
+# CONFIG_CMD_FDT is not set
|
||||
+# CONFIG_CMD_RUN is not set
|
||||
+# CONFIG_CMD_XIMG is not set
|
||||
+# CONFIG_CMD_EXPORTENV is not set
|
||||
+# CONFIG_CMD_IMPORTENV is not set
|
||||
+# CONFIG_CMD_EDITENV is not set
|
||||
+# CONFIG_CMD_SAVEENV is not set
|
||||
+# CONFIG_CMD_ENV_EXISTS is not set
|
||||
+# CONFIG_CMD_CRC32 is not set
|
||||
+# CONFIG_CMD_DM is not set
|
||||
+# CONFIG_CMD_LOADS is not set
|
||||
+# CONFIG_CMD_ECHO is not set
|
||||
+# CONFIG_CMD_ITEST is not set
|
||||
+# CONFIG_CMD_SOURCE is not set
|
||||
+# CONFIG_CMD_SETEXPR is not set
|
||||
+# CONFIG_CMD_SLEEP is not set
|
||||
+# CONFIG_ISO_PARTITION is not set
|
||||
+# CONFIG_OF_TAG_MIGRATE is not set
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_NO_NET=y
|
||||
+CONFIG_CLK=y
|
||||
+# CONFIG_GPIO is not set
|
||||
+# CONFIG_I2C is not set
|
||||
+# CONFIG_INPUT is not set
|
||||
+# CONFIG_POWER is not set
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_SYS_NS16550=y
|
||||
+# CONFIG_GZIP is not set
|
||||
--- /dev/null
|
||||
+++ b/include/configs/nec_ar9344_aterm.h
|
||||
@@ -0,0 +1,28 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0+ */
|
||||
|
||||
@@ -23,7 +23,7 @@ mips: ath79: cleanup defconfig for NEC QCA9558 Aterm series
|
||||
|
||||
--- a/arch/mips/dts/Makefile
|
||||
+++ b/arch/mips/dts/Makefile
|
||||
@@ -24,6 +24,7 @@ dtb-$(CONFIG_BOARD_LINKIT_SMART_7688) +=
|
||||
@@ -25,6 +25,7 @@ dtb-$(CONFIG_BOARD_LINKIT_SMART_7688) +=
|
||||
dtb-$(CONFIG_TARGET_OCTEON_EBB7304) += mrvl,octeon-ebb7304.dtb
|
||||
dtb-$(CONFIG_TARGET_OCTEON_NIC23) += mrvl,octeon-nic23.dtb
|
||||
dtb-$(CONFIG_BOARD_NEC_AR9344_ATERM) += nec,ar9344-aterm.dtb
|
||||
|
||||
@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_VERSION:=2024.01
|
||||
PKG_HASH:=b99611f1ed237bf3541bdc8434b68c96a6e05967061f992443cb30aabebef5b3
|
||||
PKG_RELEASE:=2
|
||||
PKG_RELEASE:=$(AUTORELEASE)
|
||||
|
||||
include $(INCLUDE_DIR)/u-boot.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_VERSION:=2024.04
|
||||
PKG_HASH:=18a853fe39fad7ad03a90cc2d4275aeaed6da69735defac3492b80508843dd4a
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=$(AUTORELEASE)
|
||||
|
||||
include $(INCLUDE_DIR)/u-boot.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
From a63456b9191fae2fe49f4b121e025792022e3950 Mon Sep 17 00:00:00 2001
|
||||
From: Markus Volk <f_l_k@t-online.de>
|
||||
Date: Wed, 30 Oct 2024 06:07:16 +0100
|
||||
Subject: [PATCH] scripts/dtc/pylibfdt/libfdt.i_shipped: Use SWIG_AppendOutput
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Swig has changed language specific AppendOutput functions. The helper
|
||||
macro SWIG_AppendOutput remains unchanged. Use that instead
|
||||
of SWIG_Python_AppendOutput, which would require an extra parameter
|
||||
since swig 4.3.0.
|
||||
|
||||
/home/flk/poky/build-test/tmp/work/qemux86_64-poky-linux/u-boot/2024.10/git/arch/x86/cpu/u-boot-64.lds
|
||||
| scripts/dtc/pylibfdt/libfdt_wrap.c: In function ‘_wrap_fdt_next_node’:
|
||||
| scripts/dtc/pylibfdt/libfdt_wrap.c:5581:17: error: too few arguments to function ‘SWIG_Python_AppendOutput’
|
||||
| 5581 | resultobj = SWIG_Python_AppendOutput(resultobj, val);
|
||||
| | ^~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Signed-off-by: Markus Volk <f_l_k@t-online.de>
|
||||
Reported-by: Rudi Heitbaum <rudi@heitbaum.com>
|
||||
Link: https://github.com/dgibson/dtc/pull/154
|
||||
---
|
||||
scripts/dtc/pylibfdt/libfdt.i_shipped | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/scripts/dtc/pylibfdt/libfdt.i_shipped b/scripts/dtc/pylibfdt/libfdt.i_shipped
|
||||
index 56cc5d48f4f9..e4659489a96a 100644
|
||||
--- a/scripts/dtc/pylibfdt/libfdt.i_shipped
|
||||
+++ b/scripts/dtc/pylibfdt/libfdt.i_shipped
|
||||
@@ -1037,7 +1037,7 @@ typedef uint32_t fdt32_t;
|
||||
fdt_string(fdt1, fdt32_to_cpu($1->nameoff)));
|
||||
buff = PyByteArray_FromStringAndSize(
|
||||
(const char *)($1 + 1), fdt32_to_cpu($1->len));
|
||||
- resultobj = SWIG_Python_AppendOutput(resultobj, buff);
|
||||
+ resultobj = SWIG_AppendOutput(resultobj, buff);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1076,7 +1076,7 @@ typedef uint32_t fdt32_t;
|
||||
|
||||
%typemap(argout) int *depth {
|
||||
PyObject *val = Py_BuildValue("i", *arg$argnum);
|
||||
- resultobj = SWIG_Python_AppendOutput(resultobj, val);
|
||||
+ resultobj = SWIG_AppendOutput(resultobj, val);
|
||||
}
|
||||
|
||||
%apply int *depth { int *depth };
|
||||
@@ -1092,7 +1092,7 @@ typedef uint32_t fdt32_t;
|
||||
if (PyTuple_GET_SIZE(resultobj) == 0)
|
||||
resultobj = val;
|
||||
else
|
||||
- resultobj = SWIG_Python_AppendOutput(resultobj, val);
|
||||
+ resultobj = SWIG_AppendOutput(resultobj, val);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,11 +25,6 @@ define U-Boot/dns320l
|
||||
BUILD_DEVICES:=dlink_dns320l
|
||||
endef
|
||||
|
||||
define U-Boot/dns325
|
||||
NAME:=D-Link DNS-325 A1
|
||||
BUILD_DEVICES:=dlink_dns-325-a1
|
||||
endef
|
||||
|
||||
define U-Boot/dockstar
|
||||
NAME:=Seagate DockStar
|
||||
BUILD_DEVICES:=seagate_dockstar
|
||||
@@ -117,7 +112,6 @@ endef
|
||||
|
||||
UBOOT_TARGETS := \
|
||||
dns320l \
|
||||
dns325 \
|
||||
dockstar dockstar_second_stage \
|
||||
goflexhome \
|
||||
ib62x0 ib62x0_second_stage \
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
From e7e650e8bdb09ac46da017250394f8c589df10bb Mon Sep 17 00:00:00 2001
|
||||
From: Tom Rini <trini@konsulko.com>
|
||||
Date: Mon, 14 Sep 2020 15:48:47 -0400
|
||||
Subject: [PATCH] arm: kirkwood: dns325: Correct CONFIG_NR_DRAM_BANKS parameter
|
||||
|
||||
Testing on a DNS-325 NAS has shown that in order for the device to work
|
||||
we need to set CONFIG_NR_DRAM_BANKS to 1 and not 2.
|
||||
|
||||
Tested-by: Dmitry N. Kolesnikov <dk.diklab@gmail.com>
|
||||
Reported-by: Dmitry N. Kolesnikov <dk.diklab@gmail.com>
|
||||
Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
|
||||
Signed-off-by: Tom Rini <trini@konsulko.com>
|
||||
---
|
||||
configs/dns325_defconfig | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/configs/dns325_defconfig
|
||||
+++ b/configs/dns325_defconfig
|
||||
@@ -6,7 +6,7 @@ CONFIG_SYS_TEXT_BASE=0x600000
|
||||
CONFIG_TARGET_DNS325=y
|
||||
CONFIG_ENV_SIZE=0x20000
|
||||
CONFIG_ENV_OFFSET=0xE0000
|
||||
-CONFIG_NR_DRAM_BANKS=2
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
CONFIG_IDENT_STRING="\nD-Link DNS-325"
|
||||
# CONFIG_SYS_MALLOC_F is not set
|
||||
CONFIG_BOOTDELAY=3
|
||||
@@ -1,65 +0,0 @@
|
||||
--- a/configs/dns325_defconfig
|
||||
+++ b/configs/dns325_defconfig
|
||||
@@ -27,7 +27,7 @@ CONFIG_CMD_FAT=y
|
||||
CONFIG_CMD_JFFS2=y
|
||||
CONFIG_CMD_MTDPARTS=y
|
||||
CONFIG_MTDIDS_DEFAULT="nand0=orion_nand"
|
||||
-CONFIG_MTDPARTS_DEFAULT="mtdparts=orion_nand:896k(u-boot),128k(u-boot-env),5m(kernel),-(rootfs)"
|
||||
+CONFIG_MTDPARTS_DEFAULT="mtdparts=orion_nand:0xe0000@0x0(u-boot),0x20000@0xe0000(u-boot-env),-@0x100000(ubi)"
|
||||
CONFIG_CMD_UBI=y
|
||||
CONFIG_ISO_PARTITION=y
|
||||
CONFIG_OF_CONTROL=y
|
||||
--- a/include/configs/dns325.h
|
||||
+++ b/include/configs/dns325.h
|
||||
@@ -66,46 +66,12 @@
|
||||
*/
|
||||
|
||||
#define CONFIG_EXTRA_ENV_SETTINGS \
|
||||
- "stdin=serial\0" \
|
||||
- "stdout=serial\0" \
|
||||
- "stderr=serial\0" \
|
||||
- "loadaddr=0x800000\0" \
|
||||
- "autoload=no\0" \
|
||||
- "console=ttyS0,115200\0" \
|
||||
- "mtdparts="CONFIG_MTDPARTS_DEFAULT \
|
||||
- "optargs=\0" \
|
||||
- "bootenv=uEnv.txt\0" \
|
||||
- "importbootenv=echo Importing environment ...; " \
|
||||
- "env import -t ${loadaddr} ${filesize}\0" \
|
||||
- "loadbootenv=fatload usb 0 ${loadaddr} ${bootenv}\0" \
|
||||
- "setbootargs=setenv bootargs console=${console} " \
|
||||
- "${optargs} " \
|
||||
- "${mtdparts} " \
|
||||
- "root=${bootenvroot} " \
|
||||
- "rootfstype=${bootenvrootfstype}\0" \
|
||||
- "subbootcmd=run setbootargs; " \
|
||||
- "if run bootenvloadimage; then " \
|
||||
- "bootm ${loadaddr};" \
|
||||
- "fi;\0" \
|
||||
- "nandroot=ubi0:rootfs ubi.mtd=rootfs\0" \
|
||||
- "nandrootfstype=ubifs\0" \
|
||||
- "nandloadimage=nand read ${loadaddr} kernel\0" \
|
||||
- "setnandbootenv=echo Booting from nand ...; " \
|
||||
- "setenv bootenvroot ${nandroot}; " \
|
||||
- "setenv bootenvrootfstype ${nandrootfstype}; " \
|
||||
- "setenv bootenvloadimage ${nandloadimage}\0"
|
||||
+ "mtdids="CONFIG_MTDIDS_DEFAULT "\0" \
|
||||
+ "mtdparts="CONFIG_MTDPARTS_DEFAULT "\0"
|
||||
|
||||
#define CONFIG_BOOTCOMMAND \
|
||||
- "if test -n ${bootenv} && usb start; then " \
|
||||
- "if run loadbootenv; then " \
|
||||
- "echo Loaded environment ${bootenv} from usb;" \
|
||||
- "run importbootenv;" \
|
||||
- "fi;" \
|
||||
- "if test -n ${bootenvcmd}; then " \
|
||||
- "echo Running bootenvcmd ...;" \
|
||||
- "run bootenvcmd;" \
|
||||
- "fi;" \
|
||||
- "fi;" \
|
||||
- "run setnandbootenv subbootcmd;"
|
||||
+ "ubi part ubi; " \
|
||||
+ "ubi read 0x800000 kernel; " \
|
||||
+ "bootm 0x800000"
|
||||
|
||||
#endif /* _CONFIG_DNS325_H */
|
||||
@@ -214,23 +214,3 @@
|
||||
+CONFIG_FIT_VERBOSE=y
|
||||
CONFIG_LZMA=y
|
||||
+CONFIG_LZO=y
|
||||
--- a/configs/dns325_defconfig
|
||||
+++ b/configs/dns325_defconfig
|
||||
@@ -48,3 +48,8 @@ CONFIG_USB=y
|
||||
CONFIG_DM_USB=y
|
||||
CONFIG_USB_EHCI_HCD=y
|
||||
CONFIG_USB_STORAGE=y
|
||||
+CONFIG_CMD_BOOTZ=y
|
||||
+CONFIG_FIT=y
|
||||
+CONFIG_FIT_VERBOSE=y
|
||||
+CONFIG_LZMA=y
|
||||
+CONFIG_LZO=y
|
||||
--- a/include/configs/dns325.h
|
||||
+++ b/include/configs/dns325.h
|
||||
@@ -74,4 +74,6 @@
|
||||
"ubi read 0x800000 kernel; " \
|
||||
"bootm 0x800000"
|
||||
|
||||
+#include "openwrt-kirkwood-common.h"
|
||||
+
|
||||
#endif /* _CONFIG_DNS325_H */
|
||||
|
||||
@@ -151,9 +151,6 @@ UBOOT_TARGETS := \
|
||||
fsl_ls1021a-twr-sdboot \
|
||||
fsl_ls1021a-iot-sdboot
|
||||
|
||||
UBOOT_CUSTOMIZE_CONFIG := \
|
||||
--disable TOOLS_MKEFICAPSULE
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(STAGING_DIR_IMAGE)
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/$(UBOOT_IMAGE) \
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_VERSION:=2025.10
|
||||
PKG_HASH:=b4f032848e56cc8f213ad59f9132c084dbbb632bc29176d024e58220e0efdf4a
|
||||
PKG_VERSION:=2025.07
|
||||
PKG_HASH:=0f933f6c5a426895bf306e93e6ac53c60870e4b54cda56d95211bec99e63bec7
|
||||
PKG_BUILD_DEPENDS:=!(TARGET_ramips||TARGET_mediatek_mt7623):arm-trusted-firmware-tools/host
|
||||
|
||||
UBOOT_USE_INTREE_DTC:=1
|
||||
@@ -231,18 +231,6 @@ define U-Boot/mt7981_abt_asr3000
|
||||
DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3
|
||||
endef
|
||||
|
||||
define U-Boot/mt7981_bazis-ax3000wm
|
||||
NAME:=BAZIS AX3000WM
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=bazis_ax3000wm
|
||||
UBOOT_CONFIG:=mt7981_bazis_ax3000wm
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=spim-nand
|
||||
BL2_SOC:=mt7981
|
||||
BL2_DDRTYPE:=ddr3
|
||||
DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3
|
||||
endef
|
||||
|
||||
define U-Boot/mt7981_cmcc_a10
|
||||
NAME:=CMCC A10
|
||||
BUILD_SUBTARGET:=filogic
|
||||
@@ -255,19 +243,7 @@ define U-Boot/mt7981_cmcc_a10
|
||||
DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3
|
||||
endef
|
||||
|
||||
define U-Boot/mt7981_cmcc_rax3000m-emmc-ddr3
|
||||
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:=ddr3-1866mhz
|
||||
DEPENDS:=+trusted-firmware-a-mt7981-emmc-ddr3-1866mhz
|
||||
endef
|
||||
|
||||
define U-Boot/mt7981_cmcc_rax3000m-emmc-ddr4
|
||||
define U-Boot/mt7981_cmcc_rax3000m-emmc
|
||||
NAME:=CMCC RAX3000M
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=cmcc_rax3000m
|
||||
@@ -279,19 +255,7 @@ define U-Boot/mt7981_cmcc_rax3000m-emmc-ddr4
|
||||
DEPENDS:=+trusted-firmware-a-mt7981-emmc-ddr4
|
||||
endef
|
||||
|
||||
define U-Boot/mt7981_cmcc_rax3000m-nand-ddr3
|
||||
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:=ddr3-1866mhz
|
||||
DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3-1866mhz
|
||||
endef
|
||||
|
||||
define U-Boot/mt7981_cmcc_rax3000m-nand-ddr4
|
||||
define U-Boot/mt7981_cmcc_rax3000m-nand
|
||||
NAME:=CMCC RAX3000M
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=cmcc_rax3000m
|
||||
@@ -303,38 +267,15 @@ define U-Boot/mt7981_cmcc_rax3000m-nand-ddr4
|
||||
DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr4
|
||||
endef
|
||||
|
||||
define U-Boot/mt7981_comfast_cf-wr632ax
|
||||
NAME:=COMFAST CF-WR632AX
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=comfast_cf-wr632ax-ubootmod
|
||||
UBOOT_CONFIG:=mt7981_comfast_cf-wr632ax
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=spim-nand
|
||||
BL2_SOC:=mt7981
|
||||
BL2_DDRTYPE:=ddr3
|
||||
DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3
|
||||
endef
|
||||
|
||||
define U-Boot/mt7981_cudy_tr3000-v1
|
||||
NAME:=Cudy TR3000 v1
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=cudy_tr3000-v1-ubootmod
|
||||
UBOOT_CONFIG:=mt7981_cudy_tr3000-v1
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=cudy-ddr3
|
||||
BL2_BOOTDEV:=cudy-tr3000-v1
|
||||
BL2_SOC:=mt7981
|
||||
DEPENDS:=+trusted-firmware-a-mt7981-cudy-ddr3
|
||||
endef
|
||||
|
||||
define U-Boot/mt7981_cudy_wbr3000uax-v1
|
||||
NAME:=Cudy WBR3000UAX v1
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=cudy_wbr3000uax-v1-ubootmod
|
||||
UBOOT_CONFIG:=mt7981_cudy_wbr3000uax-v1
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=cudy-ddr3
|
||||
BL2_SOC:=mt7981
|
||||
DEPENDS:=+trusted-firmware-a-mt7981-cudy-ddr3
|
||||
DEPENDS:=+trusted-firmware-a-mt7981-cudy-tr3000-v1
|
||||
endef
|
||||
|
||||
define U-Boot/mt7981_glinet_gl-mt2500
|
||||
@@ -385,18 +326,6 @@ define U-Boot/mt7981_h3c_magic-nx30-pro
|
||||
DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3
|
||||
endef
|
||||
|
||||
define U-Boot/mt7981_imou_hx21
|
||||
NAME:=Imou HX21
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=imou_hx21
|
||||
UBOOT_CONFIG:=mt7981_imou_hx21
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=spim-nand
|
||||
BL2_SOC:=mt7981
|
||||
BL2_DDRTYPE:=ddr3
|
||||
DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3
|
||||
endef
|
||||
|
||||
define U-Boot/mt7981_jcg_q30-pro
|
||||
NAME:=JCG Q30 PRO
|
||||
BUILD_SUBTARGET:=filogic
|
||||
@@ -409,30 +338,6 @@ define U-Boot/mt7981_jcg_q30-pro
|
||||
DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3
|
||||
endef
|
||||
|
||||
define U-Boot/mt7981_konka_komi-a31
|
||||
NAME:=Konka KOMI A31
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=konka_komi-a31
|
||||
UBOOT_CONFIG:=mt7981_konka_komi-a31
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=spim-nand
|
||||
BL2_SOC:=mt7981
|
||||
BL2_DDRTYPE:=ddr3
|
||||
DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3
|
||||
endef
|
||||
|
||||
define U-Boot/mt7981_netis_nx30v2
|
||||
NAME:=Netis NX30V2
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=netis_nx30v2
|
||||
UBOOT_CONFIG:=mt7981_netis_nx30v2
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=spim-nand
|
||||
BL2_SOC:=mt7981
|
||||
BL2_DDRTYPE:=ddr3
|
||||
DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3
|
||||
endef
|
||||
|
||||
define U-Boot/mt7981_netis_nx31
|
||||
NAME:=netis NX31
|
||||
BUILD_SUBTARGET:=filogic
|
||||
@@ -445,18 +350,6 @@ define U-Boot/mt7981_netis_nx31
|
||||
DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3
|
||||
endef
|
||||
|
||||
define U-Boot/mt7981_netis_nx32u
|
||||
NAME:=netis NX32U
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=netis_nx32u
|
||||
UBOOT_CONFIG:=mt7981_netis_nx32u
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=spim-nand
|
||||
BL2_SOC:=mt7981
|
||||
BL2_DDRTYPE:=ddr3
|
||||
DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3
|
||||
endef
|
||||
|
||||
define U-Boot/mt7981_nokia_ea0326gmp
|
||||
NAME:=Nokia EA0326GMP
|
||||
BUILD_SUBTARGET:=filogic
|
||||
@@ -639,18 +532,6 @@ define U-Boot/mt7986_rfb
|
||||
DEPENDS:=+trusted-firmware-a-mt7986-sdmmc-ddr4
|
||||
endef
|
||||
|
||||
define U-Boot/mt7986_acer_predator-w6x
|
||||
NAME:=Acer Predator Connect W6x
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=acer_predator-w6x-ubootmod
|
||||
UBOOT_CONFIG:=mt7986_acer_predator-w6x
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=spim-nand
|
||||
BL2_SOC:=mt7986
|
||||
BL2_DDRTYPE:=ddr4
|
||||
DEPENDS:=+trusted-firmware-a-mt7986-spim-nand-ddr4
|
||||
endef
|
||||
|
||||
define U-Boot/mt7986_bananapi_bpi-r3-emmc
|
||||
NAME:=BananaPi BPi-R3
|
||||
BUILD_SUBTARGET:=filogic
|
||||
@@ -856,66 +737,6 @@ define U-Boot/mt7986_zyxel_ex5601-t0
|
||||
DEPENDS:=+trusted-firmware-a-mt7986-spim-nand-4k-ddr4
|
||||
endef
|
||||
|
||||
define U-Boot/mt7987_bananapi_bpi-r4-lite-emmc
|
||||
NAME:=BananaPi BPi-R4 Lite
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=bananapi_bpi-r4-lite
|
||||
UBOOT_CONFIG:=mt7987a_bpi-r4-lite-emmc
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=emmc
|
||||
BL2_SOC:=mt7987
|
||||
BL2_DDRTYPE:=comb
|
||||
DEPENDS:=+trusted-firmware-a-mt7987-emmc-comb
|
||||
endef
|
||||
|
||||
define U-Boot/mt7987_bananapi_bpi-r4-lite-sdmmc
|
||||
NAME:=BananaPi BPi-R4 Lite
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=bananapi_bpi-r4-lite
|
||||
UBOOT_CONFIG:=mt7987a_bpi-r4-lite-sd
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=sdmmc
|
||||
BL2_SOC:=mt7987
|
||||
BL2_DDRTYPE:=comb
|
||||
DEPENDS:=+trusted-firmware-a-mt7987-sdmmc-comb
|
||||
endef
|
||||
|
||||
define U-Boot/mt7987_bananapi_bpi-r4-lite-snand
|
||||
NAME:=BananaPi BPi-R4 Lite
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=bananapi_bpi-r4-lite
|
||||
UBOOT_CONFIG:=mt7987a_bpi-r4-lite-snand
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=spim-nand2-ubi
|
||||
BL2_SOC:=mt7987
|
||||
BL2_DDRTYPE:=comb
|
||||
DEPENDS:=+trusted-firmware-a-mt7987-spim-nand2-ubi-comb
|
||||
endef
|
||||
|
||||
define U-Boot/mt7987_bananapi_bpi-r4-lite-nor
|
||||
NAME:=BananaPi BPi-R4 Lite
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=bananapi_bpi-r4-lite
|
||||
UBOOT_CONFIG:=mt7987a_bpi-r4-lite-nor
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=nor
|
||||
BL2_SOC:=mt7987
|
||||
BL2_DDRTYPE:=comb
|
||||
DEPENDS:=+trusted-firmware-a-mt7987-nor-comb
|
||||
FIP_COMPRESS:=1
|
||||
endef
|
||||
|
||||
define U-Boot/mt7987_routerich_be7200
|
||||
NAME:=Routerich BE7200
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=routerich_be7200
|
||||
UBOOT_CONFIG:=mt7987a_routerich_be7200
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=spim-nand0
|
||||
BL2_SOC:=mt7987
|
||||
DEPENDS:=+trusted-firmware-a-mt7987-spim-nand0
|
||||
endef
|
||||
|
||||
define U-Boot/mt7988_arcadyan_mozart
|
||||
NAME:=Arcadyan Mozart
|
||||
BUILD_SUBTARGET:=filogic
|
||||
@@ -1012,42 +833,6 @@ define U-Boot/mt7988_bananapi_bpi-r4-poe-snand
|
||||
DEPENDS:=+trusted-firmware-a-mt7988-spim-nand-ubi-comb
|
||||
endef
|
||||
|
||||
define U-Boot/mt7987_rfb-emmc
|
||||
NAME:=MT7987 Reference Board
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=mediatek_mt7987a-rfb
|
||||
UBOOT_CONFIG:=mt7987_emmc_rfb
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=sdmmc
|
||||
BL2_SOC:=mt7987
|
||||
BL2_DDRTYPE:=comb
|
||||
DEPENDS:=+trusted-firmware-a-mt7987-emmc-comb
|
||||
endef
|
||||
|
||||
define U-Boot/mt7987_rfb-spim-nand
|
||||
NAME:=MT7987 Reference Board
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=mediatek_mt7987a-rfb
|
||||
UBOOT_CONFIG:=mt7987_rfb
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=spim-nand0-ubi
|
||||
BL2_SOC:=mt7987
|
||||
BL2_DDRTYPE:=comb
|
||||
DEPENDS:=+trusted-firmware-a-mt7987-spim-nand0-ubi-comb
|
||||
endef
|
||||
|
||||
define U-Boot/mt7987_rfb-sd
|
||||
NAME:=MT7987 Reference Board
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=mediatek_mt7987a-rfb
|
||||
UBOOT_CONFIG:=mt7987_sd_rfb
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=sdmmc
|
||||
BL2_SOC:=mt7987
|
||||
BL2_DDRTYPE:=comb
|
||||
DEPENDS:=+trusted-firmware-a-mt7987-sdmmc-comb
|
||||
endef
|
||||
|
||||
define U-Boot/mt7988_rfb-spim-nand
|
||||
NAME:=MT7988 Reference Board
|
||||
BUILD_SUBTARGET:=filogic
|
||||
@@ -1130,26 +915,17 @@ UBOOT_TARGETS := \
|
||||
mt7628_ravpower_rp-wd009 \
|
||||
mt7629_rfb \
|
||||
mt7981_abt_asr3000 \
|
||||
mt7981_bazis-ax3000wm \
|
||||
mt7981_cmcc_a10 \
|
||||
mt7981_cmcc_rax3000m-emmc-ddr3 \
|
||||
mt7981_cmcc_rax3000m-emmc-ddr4 \
|
||||
mt7981_cmcc_rax3000m-nand-ddr3 \
|
||||
mt7981_cmcc_rax3000m-nand-ddr4 \
|
||||
mt7981_comfast_cf-wr632ax \
|
||||
mt7981_cmcc_rax3000m-emmc \
|
||||
mt7981_cmcc_rax3000m-nand \
|
||||
mt7981_cudy_tr3000-v1 \
|
||||
mt7981_cudy_wbr3000uax-v1 \
|
||||
mt7981_gatonetworks_gdsp \
|
||||
mt7981_glinet_gl-mt2500 \
|
||||
mt7981_glinet_gl-x3000 \
|
||||
mt7981_glinet_gl-xe3000 \
|
||||
mt7981_h3c_magic-nx30-pro \
|
||||
mt7981_imou_hx21 \
|
||||
mt7981_jcg_q30-pro \
|
||||
mt7981_konka_komi-a31 \
|
||||
mt7981_netis_nx30v2 \
|
||||
mt7981_netis_nx31 \
|
||||
mt7981_netis_nx32u \
|
||||
mt7981_nokia_ea0326gmp \
|
||||
mt7981_openwrt_one-snand \
|
||||
mt7981_openwrt_one-nor \
|
||||
@@ -1163,7 +939,6 @@ UBOOT_TARGETS := \
|
||||
mt7981_snr_snr-cpe-ax2 \
|
||||
mt7981_xiaomi_mi-router-ax3000t \
|
||||
mt7981_xiaomi_mi-router-wr30u \
|
||||
mt7986_acer_predator-w6x \
|
||||
mt7986_bananapi_bpi-r3-emmc \
|
||||
mt7986_bananapi_bpi-r3-sdmmc \
|
||||
mt7986_bananapi_bpi-r3-snand \
|
||||
@@ -1182,14 +957,6 @@ UBOOT_TARGETS := \
|
||||
mt7986_xiaomi_redmi-router-ax6000 \
|
||||
mt7986_zyxel_ex5601-t0 \
|
||||
mt7986_rfb \
|
||||
mt7987_bananapi_bpi-r4-lite-emmc \
|
||||
mt7987_bananapi_bpi-r4-lite-sdmmc \
|
||||
mt7987_bananapi_bpi-r4-lite-snand \
|
||||
mt7987_bananapi_bpi-r4-lite-nor \
|
||||
mt7987_rfb-emmc \
|
||||
mt7987_rfb-sd \
|
||||
mt7987_rfb-spim-nand \
|
||||
mt7987_routerich_be7200 \
|
||||
mt7988_arcadyan_mozart \
|
||||
mt7988_asus_zenwifi-bt8 \
|
||||
mt7988_bananapi_bpi-r4-emmc \
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
From fe37fb8214e40ea64cf03453d112527b629fb08a Mon Sep 17 00:00:00 2001
|
||||
From: Christian Marangi <ansuelsmth@gmail.com>
|
||||
Date: Sat, 7 Jun 2025 23:11:21 +0200
|
||||
Subject: [PATCH] mtd: spinand: winbond: add Winbond W25N04KV flash support
|
||||
|
||||
Add Winbond W25N04KV flash support that use a different value to detect
|
||||
ECC bitflip.
|
||||
|
||||
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
||||
---
|
||||
drivers/mtd/nand/spi/winbond.c | 13 +++++++++++++
|
||||
1 file changed, 13 insertions(+)
|
||||
|
||||
--- a/drivers/mtd/nand/spi/winbond.c
|
||||
+++ b/drivers/mtd/nand/spi/winbond.c
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <linux/device.h>
|
||||
#include <linux/kernel.h>
|
||||
#endif
|
||||
+#include <linux/bitfield.h>
|
||||
#include <linux/bug.h>
|
||||
#include <linux/mtd/spinand.h>
|
||||
|
||||
@@ -18,6 +19,8 @@
|
||||
|
||||
#define WINBOND_CFG_BUF_READ BIT(3)
|
||||
|
||||
+#define W25N04KV_STATUS_ECC_5_8_BITFLIPS GENMASK(5, 4)
|
||||
+
|
||||
static SPINAND_OP_VARIANTS(read_cache_variants,
|
||||
SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0),
|
||||
SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0),
|
||||
@@ -121,6 +124,7 @@ static int w25n02kv_ecc_get_status(struc
|
||||
return -EBADMSG;
|
||||
|
||||
case STATUS_ECC_HAS_BITFLIPS:
|
||||
+ case W25N04KV_STATUS_ECC_5_8_BITFLIPS:
|
||||
/*
|
||||
* Let's try to retrieve the real maximum number of bitflips
|
||||
* in order to avoid forcing the wear-leveling layer to move
|
||||
@@ -169,6 +173,15 @@ static const struct spinand_info winbond
|
||||
NAND_ECCREQ(8, 512),
|
||||
SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
|
||||
&write_cache_variants,
|
||||
+ &update_cache_variants),
|
||||
+ 0,
|
||||
+ SPINAND_ECCINFO(&w25n02kv_ooblayout, w25n02kv_ecc_get_status)),
|
||||
+ SPINAND_INFO("W25N04KV",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xaa, 0x23),
|
||||
+ NAND_MEMORG(1, 2048, 128, 64, 4096, 40, 2, 1, 1),
|
||||
+ NAND_ECCREQ(8, 512),
|
||||
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
|
||||
+ &write_cache_variants,
|
||||
&update_cache_variants),
|
||||
0,
|
||||
SPINAND_ECCINFO(&w25n02kv_ooblayout, w25n02kv_ecc_get_status)),
|
||||
@@ -0,0 +1,245 @@
|
||||
From 506ceddffdc40acf709822b678b986e2e22c5056 Mon Sep 17 00:00:00 2001
|
||||
From: Chuanhong Guo <gch981213@gmail.com>
|
||||
Date: Wed, 1 May 2024 15:45:23 +0800
|
||||
Subject: [PATCH] mtd/spinand: gigadevice: sync supported chips with linux 6.9
|
||||
|
||||
Adding support for:
|
||||
GD5F1GQ4RExxG
|
||||
GD5F2GQ4UExxG
|
||||
GD5F2GQ4RExxG
|
||||
GD5F1GQ5RExxG
|
||||
GD5F2GQ5UExxG
|
||||
GD5F2GQ5RExxG
|
||||
GD5F4GQ6UExxG
|
||||
GD5F4GQ6RExxG
|
||||
GD5F1GM7UExxG
|
||||
GD5F1GM7RExxG
|
||||
GD5F2GM7UExxG
|
||||
GD5F2GM7RExxG
|
||||
GD5F4GM8UExxG
|
||||
GD5F4GM8RExxG
|
||||
GD5F2GQ5xExxH
|
||||
GD5F1GQ5RExxH
|
||||
GD5F1GQ4RExxH
|
||||
|
||||
Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
|
||||
---
|
||||
drivers/mtd/nand/spi/gigadevice.c | 188 +++++++++++++++++++++++++++++-
|
||||
1 file changed, 187 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/mtd/nand/spi/gigadevice.c
|
||||
+++ b/drivers/mtd/nand/spi/gigadevice.c
|
||||
@@ -43,6 +43,22 @@ static SPINAND_OP_VARIANTS(read_cache_va
|
||||
SPINAND_PAGE_READ_FROM_CACHE_OP_3A(true, 0, 1, NULL, 0),
|
||||
SPINAND_PAGE_READ_FROM_CACHE_OP_3A(false, 0, 0, NULL, 0));
|
||||
|
||||
+static SPINAND_OP_VARIANTS(read_cache_variants_1gq5,
|
||||
+ SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0),
|
||||
+ SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0),
|
||||
+ SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0),
|
||||
+ SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0),
|
||||
+ SPINAND_PAGE_READ_FROM_CACHE_OP(true, 0, 1, NULL, 0),
|
||||
+ SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0));
|
||||
+
|
||||
+static SPINAND_OP_VARIANTS(read_cache_variants_2gq5,
|
||||
+ SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 4, NULL, 0),
|
||||
+ SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0),
|
||||
+ SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 2, NULL, 0),
|
||||
+ SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0),
|
||||
+ SPINAND_PAGE_READ_FROM_CACHE_OP(true, 0, 1, NULL, 0),
|
||||
+ SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0));
|
||||
+
|
||||
static SPINAND_OP_VARIANTS(write_cache_variants,
|
||||
SPINAND_PROG_LOAD_X4(true, 0, NULL, 0),
|
||||
SPINAND_PROG_LOAD(true, 0, NULL, 0));
|
||||
@@ -329,6 +345,36 @@ static const struct spinand_info gigadev
|
||||
SPINAND_HAS_QE_BIT,
|
||||
SPINAND_ECCINFO(&gd5fxgqx_variant2_ooblayout,
|
||||
gd5fxgq4uexxg_ecc_get_status)),
|
||||
+ SPINAND_INFO("GD5F1GQ4RExxG",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0xc1),
|
||||
+ NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1),
|
||||
+ NAND_ECCREQ(8, 512),
|
||||
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
|
||||
+ &write_cache_variants,
|
||||
+ &update_cache_variants),
|
||||
+ SPINAND_HAS_QE_BIT,
|
||||
+ SPINAND_ECCINFO(&gd5fxgqx_variant2_ooblayout,
|
||||
+ gd5fxgq4uexxg_ecc_get_status)),
|
||||
+ SPINAND_INFO("GD5F2GQ4UExxG",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0xd2),
|
||||
+ NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1),
|
||||
+ NAND_ECCREQ(8, 512),
|
||||
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
|
||||
+ &write_cache_variants,
|
||||
+ &update_cache_variants),
|
||||
+ SPINAND_HAS_QE_BIT,
|
||||
+ SPINAND_ECCINFO(&gd5fxgqx_variant2_ooblayout,
|
||||
+ gd5fxgq4uexxg_ecc_get_status)),
|
||||
+ SPINAND_INFO("GD5F2GQ4RExxG",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0xc2),
|
||||
+ NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1),
|
||||
+ NAND_ECCREQ(8, 512),
|
||||
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
|
||||
+ &write_cache_variants,
|
||||
+ &update_cache_variants),
|
||||
+ SPINAND_HAS_QE_BIT,
|
||||
+ SPINAND_ECCINFO(&gd5fxgqx_variant2_ooblayout,
|
||||
+ gd5fxgq4uexxg_ecc_get_status)),
|
||||
SPINAND_INFO("GD5F1GQ4UFxxG",
|
||||
SPINAND_ID(SPINAND_READID_METHOD_OPCODE, 0xb1, 0x48),
|
||||
NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1),
|
||||
@@ -343,12 +389,152 @@ static const struct spinand_info gigadev
|
||||
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x51),
|
||||
NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1),
|
||||
NAND_ECCREQ(4, 512),
|
||||
- SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
|
||||
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants_1gq5,
|
||||
&write_cache_variants,
|
||||
&update_cache_variants),
|
||||
SPINAND_HAS_QE_BIT,
|
||||
SPINAND_ECCINFO(&gd5fxgqx_variant2_ooblayout,
|
||||
gd5fxgq5xexxg_ecc_get_status)),
|
||||
+ SPINAND_INFO("GD5F1GQ5RExxG",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x41),
|
||||
+ NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1),
|
||||
+ NAND_ECCREQ(4, 512),
|
||||
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants_1gq5,
|
||||
+ &write_cache_variants,
|
||||
+ &update_cache_variants),
|
||||
+ SPINAND_HAS_QE_BIT,
|
||||
+ SPINAND_ECCINFO(&gd5fxgqx_variant2_ooblayout,
|
||||
+ gd5fxgq5xexxg_ecc_get_status)),
|
||||
+ SPINAND_INFO("GD5F2GQ5UExxG",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x52),
|
||||
+ NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1),
|
||||
+ NAND_ECCREQ(4, 512),
|
||||
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants_2gq5,
|
||||
+ &write_cache_variants,
|
||||
+ &update_cache_variants),
|
||||
+ SPINAND_HAS_QE_BIT,
|
||||
+ SPINAND_ECCINFO(&gd5fxgqx_variant2_ooblayout,
|
||||
+ gd5fxgq5xexxg_ecc_get_status)),
|
||||
+ SPINAND_INFO("GD5F2GQ5RExxG",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x42),
|
||||
+ NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1),
|
||||
+ NAND_ECCREQ(4, 512),
|
||||
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants_2gq5,
|
||||
+ &write_cache_variants,
|
||||
+ &update_cache_variants),
|
||||
+ SPINAND_HAS_QE_BIT,
|
||||
+ SPINAND_ECCINFO(&gd5fxgqx_variant2_ooblayout,
|
||||
+ gd5fxgq5xexxg_ecc_get_status)),
|
||||
+ SPINAND_INFO("GD5F4GQ6UExxG",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x55),
|
||||
+ NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 2, 1),
|
||||
+ NAND_ECCREQ(4, 512),
|
||||
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants_2gq5,
|
||||
+ &write_cache_variants,
|
||||
+ &update_cache_variants),
|
||||
+ SPINAND_HAS_QE_BIT,
|
||||
+ SPINAND_ECCINFO(&gd5fxgqx_variant2_ooblayout,
|
||||
+ gd5fxgq5xexxg_ecc_get_status)),
|
||||
+ SPINAND_INFO("GD5F4GQ6RExxG",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x45),
|
||||
+ NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 2, 1),
|
||||
+ NAND_ECCREQ(4, 512),
|
||||
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants_2gq5,
|
||||
+ &write_cache_variants,
|
||||
+ &update_cache_variants),
|
||||
+ SPINAND_HAS_QE_BIT,
|
||||
+ SPINAND_ECCINFO(&gd5fxgqx_variant2_ooblayout,
|
||||
+ gd5fxgq5xexxg_ecc_get_status)),
|
||||
+ SPINAND_INFO("GD5F1GM7UExxG",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x91),
|
||||
+ NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1),
|
||||
+ NAND_ECCREQ(8, 512),
|
||||
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants_1gq5,
|
||||
+ &write_cache_variants,
|
||||
+ &update_cache_variants),
|
||||
+ SPINAND_HAS_QE_BIT,
|
||||
+ SPINAND_ECCINFO(&gd5fxgqx_variant2_ooblayout,
|
||||
+ gd5fxgq4uexxg_ecc_get_status)),
|
||||
+ SPINAND_INFO("GD5F1GM7RExxG",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x81),
|
||||
+ NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1),
|
||||
+ NAND_ECCREQ(8, 512),
|
||||
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants_1gq5,
|
||||
+ &write_cache_variants,
|
||||
+ &update_cache_variants),
|
||||
+ SPINAND_HAS_QE_BIT,
|
||||
+ SPINAND_ECCINFO(&gd5fxgqx_variant2_ooblayout,
|
||||
+ gd5fxgq4uexxg_ecc_get_status)),
|
||||
+ SPINAND_INFO("GD5F2GM7UExxG",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x92),
|
||||
+ NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1),
|
||||
+ NAND_ECCREQ(8, 512),
|
||||
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants_1gq5,
|
||||
+ &write_cache_variants,
|
||||
+ &update_cache_variants),
|
||||
+ SPINAND_HAS_QE_BIT,
|
||||
+ SPINAND_ECCINFO(&gd5fxgqx_variant2_ooblayout,
|
||||
+ gd5fxgq4uexxg_ecc_get_status)),
|
||||
+ SPINAND_INFO("GD5F2GM7RExxG",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x82),
|
||||
+ NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1),
|
||||
+ NAND_ECCREQ(8, 512),
|
||||
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants_1gq5,
|
||||
+ &write_cache_variants,
|
||||
+ &update_cache_variants),
|
||||
+ SPINAND_HAS_QE_BIT,
|
||||
+ SPINAND_ECCINFO(&gd5fxgqx_variant2_ooblayout,
|
||||
+ gd5fxgq4uexxg_ecc_get_status)),
|
||||
+ SPINAND_INFO("GD5F4GM8UExxG",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x95),
|
||||
+ NAND_MEMORG(1, 2048, 128, 64, 4096, 80, 1, 1, 1),
|
||||
+ NAND_ECCREQ(8, 512),
|
||||
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants_1gq5,
|
||||
+ &write_cache_variants,
|
||||
+ &update_cache_variants),
|
||||
+ SPINAND_HAS_QE_BIT,
|
||||
+ SPINAND_ECCINFO(&gd5fxgqx_variant2_ooblayout,
|
||||
+ gd5fxgq4uexxg_ecc_get_status)),
|
||||
+ SPINAND_INFO("GD5F4GM8RExxG",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x85),
|
||||
+ NAND_MEMORG(1, 2048, 128, 64, 4096, 80, 1, 1, 1),
|
||||
+ NAND_ECCREQ(8, 512),
|
||||
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants_1gq5,
|
||||
+ &write_cache_variants,
|
||||
+ &update_cache_variants),
|
||||
+ SPINAND_HAS_QE_BIT,
|
||||
+ SPINAND_ECCINFO(&gd5fxgqx_variant2_ooblayout,
|
||||
+ gd5fxgq4uexxg_ecc_get_status)),
|
||||
+ SPINAND_INFO("GD5F2GQ5xExxH",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x22),
|
||||
+ NAND_MEMORG(1, 2048, 64, 64, 2048, 40, 1, 1, 1),
|
||||
+ NAND_ECCREQ(4, 512),
|
||||
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants_2gq5,
|
||||
+ &write_cache_variants,
|
||||
+ &update_cache_variants),
|
||||
+ SPINAND_HAS_QE_BIT,
|
||||
+ SPINAND_ECCINFO(&gd5fxgqx_variant2_ooblayout,
|
||||
+ gd5fxgq4uexxg_ecc_get_status)),
|
||||
+ SPINAND_INFO("GD5F1GQ5RExxH",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x21),
|
||||
+ NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
|
||||
+ NAND_ECCREQ(4, 512),
|
||||
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants_1gq5,
|
||||
+ &write_cache_variants,
|
||||
+ &update_cache_variants),
|
||||
+ SPINAND_HAS_QE_BIT,
|
||||
+ SPINAND_ECCINFO(&gd5fxgqx_variant2_ooblayout,
|
||||
+ gd5fxgq4uexxg_ecc_get_status)),
|
||||
+ SPINAND_INFO("GD5F1GQ4RExxH",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xc9),
|
||||
+ NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
|
||||
+ NAND_ECCREQ(4, 512),
|
||||
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants_1gq5,
|
||||
+ &write_cache_variants,
|
||||
+ &update_cache_variants),
|
||||
+ SPINAND_HAS_QE_BIT,
|
||||
+ SPINAND_ECCINFO(&gd5fxgqx_variant2_ooblayout,
|
||||
+ gd5fxgq4uexxg_ecc_get_status)),
|
||||
};
|
||||
|
||||
static const struct spinand_manufacturer_ops gigadevice_spinand_manuf_ops = {
|
||||
@@ -0,0 +1,26 @@
|
||||
From dc495442ba610b190775122a31f958ad74229262 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Tue, 8 Jul 2025 17:53:48 +0800
|
||||
Subject: [PATCH] net: mediatek: correct the AN8855 TPID value in port
|
||||
isolation settings
|
||||
|
||||
The TPID value should be 0x9100 instead of 0x8100 according to the
|
||||
datasheet.
|
||||
|
||||
Fixes: cedafee9ff3 (net: mediatek: add support for Airoha AN8855 ethernet switch)
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
drivers/net/mtk_eth/an8855.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/net/mtk_eth/an8855.c
|
||||
+++ b/drivers/net/mtk_eth/an8855.c
|
||||
@@ -909,7 +909,7 @@ static void an8855_port_isolation(struct
|
||||
|
||||
/* Set port mode to user port */
|
||||
an8855_reg_write(priv, AN8855_PVC(i),
|
||||
- (0x8100 << AN8855_STAG_VPID_S) |
|
||||
+ (0x9100 << AN8855_STAG_VPID_S) |
|
||||
(VLAN_ATTR_USER << AN8855_VLAN_ATTR_S));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
From 6e15d3f91aa698798578d39a6d9e292fcc5c577f Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Fri, 23 May 2025 17:25:55 +0800
|
||||
Subject: [PATCH] serial: mediatek: fix register names and offsets
|
||||
|
||||
Fix UART register names and offsets according to the programming
|
||||
guide to allow implementing some enhanced features.
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
drivers/serial/serial_mtk.c | 17 ++++++++++++-----
|
||||
1 file changed, 12 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/drivers/serial/serial_mtk.c
|
||||
+++ b/drivers/serial/serial_mtk.c
|
||||
@@ -30,16 +30,23 @@ struct mtk_serial_regs {
|
||||
u32 mcr;
|
||||
u32 lsr;
|
||||
u32 msr;
|
||||
- u32 spr;
|
||||
- u32 mdr1;
|
||||
+ u32 scr;
|
||||
+ u32 autobaud_en;
|
||||
u32 highspeed;
|
||||
u32 sample_count;
|
||||
u32 sample_point;
|
||||
+ u32 autobaud_reg;
|
||||
+ u32 ratefix_ad;
|
||||
+ u32 autobaud_sample;
|
||||
+ u32 guard;
|
||||
+ u32 escape_dat;
|
||||
+ u32 escape_en;
|
||||
+ u32 sleep_en;
|
||||
+ u32 dma_en;
|
||||
+ u32 rxtri_ad;
|
||||
u32 fracdiv_l;
|
||||
u32 fracdiv_m;
|
||||
- u32 escape_en;
|
||||
- u32 guard;
|
||||
- u32 rx_sel;
|
||||
+ u32 fcr_rd;
|
||||
};
|
||||
|
||||
#define thr rbr
|
||||
@@ -0,0 +1,81 @@
|
||||
From 6952209ef220138189dd261d06441e1b2d50e994 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Fri, 23 May 2025 17:26:02 +0800
|
||||
Subject: [PATCH] serial: mediatek: enable baudrate accuracy compensation
|
||||
|
||||
The high-speed UART from MediaTek supports baudrate accuracy
|
||||
compensation when using high-speed mode 3.
|
||||
|
||||
This is done by calculating the first digit of the fraction part of
|
||||
sample count value. The fraction value will be then used as the
|
||||
reference to insert 0 to 10 sample cycle(s) to one frame (assume
|
||||
that frame format is 8n1, i.e. 10 bits per frame).
|
||||
|
||||
The fracdiv_[l/m] registers are used to determine whether a bit in one frame
|
||||
should be inserted with one sample cycle.
|
||||
|
||||
With typical 40MHz source clock, the actual baudrates with/without
|
||||
accuracy compensation are:
|
||||
|
||||
Ideal w/o compensation w/ compensation
|
||||
======== ================ ===============
|
||||
9600 9603 9600
|
||||
115200 114942 115207
|
||||
921600 930232 921659
|
||||
3000000 3076923 3007519
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
drivers/serial/serial_mtk.c | 24 +++++++++++++++++++++---
|
||||
1 file changed, 21 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/drivers/serial/serial_mtk.c
|
||||
+++ b/drivers/serial/serial_mtk.c
|
||||
@@ -99,10 +99,18 @@ struct mtk_serial_priv {
|
||||
bool upstream_highspeed_logic;
|
||||
};
|
||||
|
||||
+static const unsigned short fraction_l_mapping[] = {
|
||||
+ 0, 1, 0x5, 0x15, 0x55, 0x57, 0x57, 0x77, 0x7F, 0xFF, 0xFF
|
||||
+};
|
||||
+
|
||||
+static const unsigned short fraction_m_mapping[] = {
|
||||
+ 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 3
|
||||
+};
|
||||
+
|
||||
static void _mtk_serial_setbrg(struct mtk_serial_priv *priv, int baud,
|
||||
uint clk_rate)
|
||||
{
|
||||
- u32 quot, realbaud, samplecount = 1;
|
||||
+ u32 quot, realbaud, samplecount = 1, fraction, frac_l = 0, frac_m = 0;
|
||||
|
||||
/* Special case for low baud clock */
|
||||
if (baud <= 115200 && clk_rate == 12000000) {
|
||||
@@ -147,7 +155,13 @@ use_hs3:
|
||||
writel(3, &priv->regs->highspeed);
|
||||
|
||||
quot = DIV_ROUND_UP(clk_rate, 256 * baud);
|
||||
- samplecount = DIV_ROUND_CLOSEST(clk_rate, quot * baud);
|
||||
+ samplecount = clk_rate / (quot * baud);
|
||||
+
|
||||
+ fraction = ((clk_rate * 100) / quot / baud) % 100;
|
||||
+ fraction = DIV_ROUND_CLOSEST(fraction, 10);
|
||||
+
|
||||
+ frac_l = fraction_l_mapping[fraction];
|
||||
+ frac_m = fraction_m_mapping[fraction];
|
||||
}
|
||||
|
||||
set_baud:
|
||||
@@ -159,7 +173,11 @@ set_baud:
|
||||
|
||||
/* set highspeed mode sample count & point */
|
||||
writel(samplecount - 1, &priv->regs->sample_count);
|
||||
- writel((samplecount - 2) >> 1, &priv->regs->sample_point);
|
||||
+ writel((samplecount >> 1) - 1, &priv->regs->sample_point);
|
||||
+
|
||||
+ /* set baudrate fraction compensation */
|
||||
+ writel(frac_l, &priv->regs->fracdiv_l);
|
||||
+ writel(frac_m, &priv->regs->fracdiv_m);
|
||||
}
|
||||
|
||||
static int _mtk_serial_putc(struct mtk_serial_priv *priv, const char ch)
|
||||
@@ -0,0 +1,114 @@
|
||||
From 1bf212129768d65a47145209c65bf37b6082d718 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Tue, 6 May 2025 16:12:20 +0800
|
||||
Subject: [PATCH] clk: mediatek: add dummy clk enable/disable ops for
|
||||
apmixedsys clocks
|
||||
|
||||
Starting from commit ac30d90f336 (clk: Ensure the parent clocks are enabled
|
||||
while reparenting), MediaTek filogic platforms will crash on booting when
|
||||
initializing mmc devices.
|
||||
|
||||
The root cause is that to simplify the code, we reused the topckgen ops for
|
||||
apmixedsys clocks as they share the get_rate with topckgen clocks while the
|
||||
clk enable/disable ops are not available for apmixedsys clocks.
|
||||
|
||||
Now that a clock will be enabled first before reparenting, we have to add
|
||||
dummy enable/disable ops for apmixedsys to avoid unexpected behavior when
|
||||
apmixedsys clocks are the parent clock of the to-be-reparenting clocks.
|
||||
|
||||
Fixes: 40746bf429d (clk: mediatek: add clock driver support for MediaTek MT7981 SoC)
|
||||
Fixes: 37d5a9a29dc (clk: mediatek: add clock driver support for MediaTek MT7986 SoC)
|
||||
Fixes: ece4e5804f5 (clk: mediatek: add clock driver support for MediaTek MT7987 SoC)
|
||||
Fixes: 421436981a2 (clk: mediatek: add clock driver support for MediaTek MT7988 SoC)
|
||||
Signed-off-by: Sam Shih <sam.shih@mediatek.com>
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
drivers/clk/mediatek/clk-mt7981.c | 2 +-
|
||||
drivers/clk/mediatek/clk-mt7986.c | 2 +-
|
||||
drivers/clk/mediatek/clk-mt7987.c | 2 +-
|
||||
drivers/clk/mediatek/clk-mt7988.c | 2 +-
|
||||
drivers/clk/mediatek/clk-mtk.c | 11 +++++++++++
|
||||
drivers/clk/mediatek/clk-mtk.h | 1 +
|
||||
6 files changed, 16 insertions(+), 4 deletions(-)
|
||||
|
||||
--- a/drivers/clk/mediatek/clk-mt7981.c
|
||||
+++ b/drivers/clk/mediatek/clk-mt7981.c
|
||||
@@ -566,7 +566,7 @@ U_BOOT_DRIVER(mtk_clk_apmixedsys) = {
|
||||
.of_match = mt7981_fixed_pll_compat,
|
||||
.probe = mt7981_fixed_pll_probe,
|
||||
.priv_auto = sizeof(struct mtk_clk_priv),
|
||||
- .ops = &mtk_clk_topckgen_ops,
|
||||
+ .ops = &mtk_clk_fixed_pll_ops,
|
||||
.flags = DM_FLAG_PRE_RELOC,
|
||||
};
|
||||
|
||||
--- a/drivers/clk/mediatek/clk-mt7986.c
|
||||
+++ b/drivers/clk/mediatek/clk-mt7986.c
|
||||
@@ -573,7 +573,7 @@ U_BOOT_DRIVER(mtk_clk_apmixedsys) = {
|
||||
.of_match = mt7986_fixed_pll_compat,
|
||||
.probe = mt7986_fixed_pll_probe,
|
||||
.priv_auto = sizeof(struct mtk_clk_priv),
|
||||
- .ops = &mtk_clk_topckgen_ops,
|
||||
+ .ops = &mtk_clk_fixed_pll_ops,
|
||||
.flags = DM_FLAG_PRE_RELOC,
|
||||
};
|
||||
|
||||
--- a/drivers/clk/mediatek/clk-mt7987.c
|
||||
+++ b/drivers/clk/mediatek/clk-mt7987.c
|
||||
@@ -67,7 +67,7 @@ U_BOOT_DRIVER(mtk_clk_apmixedsys) = {
|
||||
.of_match = mt7987_fixed_pll_compat,
|
||||
.probe = mt7987_fixed_pll_probe,
|
||||
.priv_auto = sizeof(struct mtk_clk_priv),
|
||||
- .ops = &mtk_clk_topckgen_ops,
|
||||
+ .ops = &mtk_clk_fixed_pll_ops,
|
||||
.flags = DM_FLAG_PRE_RELOC,
|
||||
};
|
||||
|
||||
--- a/drivers/clk/mediatek/clk-mt7988.c
|
||||
+++ b/drivers/clk/mediatek/clk-mt7988.c
|
||||
@@ -830,7 +830,7 @@ U_BOOT_DRIVER(mtk_clk_apmixedsys) = {
|
||||
.of_match = mt7988_fixed_pll_compat,
|
||||
.probe = mt7988_fixed_pll_probe,
|
||||
.priv_auto = sizeof(struct mtk_clk_priv),
|
||||
- .ops = &mtk_clk_topckgen_ops,
|
||||
+ .ops = &mtk_clk_fixed_pll_ops,
|
||||
.flags = DM_FLAG_PRE_RELOC,
|
||||
};
|
||||
|
||||
--- a/drivers/clk/mediatek/clk-mtk.c
|
||||
+++ b/drivers/clk/mediatek/clk-mtk.c
|
||||
@@ -47,6 +47,11 @@ static int mtk_clk_get_id(struct clk *cl
|
||||
return id;
|
||||
}
|
||||
|
||||
+static int mtk_dummy_enable(struct clk *clk)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static int mtk_gate_enable(void __iomem *base, const struct mtk_gate *gate)
|
||||
{
|
||||
u32 bit = BIT(gate->shift);
|
||||
@@ -752,6 +757,12 @@ const struct clk_ops mtk_clk_apmixedsys_
|
||||
.get_rate = mtk_apmixedsys_get_rate,
|
||||
};
|
||||
|
||||
+const struct clk_ops mtk_clk_fixed_pll_ops = {
|
||||
+ .enable = mtk_dummy_enable,
|
||||
+ .disable = mtk_dummy_enable,
|
||||
+ .get_rate = mtk_topckgen_get_rate,
|
||||
+};
|
||||
+
|
||||
const struct clk_ops mtk_clk_topckgen_ops = {
|
||||
.enable = mtk_clk_mux_enable,
|
||||
.disable = mtk_clk_mux_disable,
|
||||
--- a/drivers/clk/mediatek/clk-mtk.h
|
||||
+++ b/drivers/clk/mediatek/clk-mtk.h
|
||||
@@ -283,6 +283,7 @@ struct mtk_cg_priv {
|
||||
};
|
||||
|
||||
extern const struct clk_ops mtk_clk_apmixedsys_ops;
|
||||
+extern const struct clk_ops mtk_clk_fixed_pll_ops;
|
||||
extern const struct clk_ops mtk_clk_topckgen_ops;
|
||||
extern const struct clk_ops mtk_clk_infrasys_ops;
|
||||
extern const struct clk_ops mtk_clk_gate_ops;
|
||||
@@ -0,0 +1,55 @@
|
||||
From 0ffd456516b5f0c126c9705d6b2368a45ee2353f Mon Sep 17 00:00:00 2001
|
||||
From: Christian Marangi <ansuelsmth@gmail.com>
|
||||
Date: Sun, 29 Jun 2025 15:21:18 +0200
|
||||
Subject: [PATCH] env: Fix possible out-of-bound access in env_do_env_set
|
||||
|
||||
It was discovered that env_do_env_set() currently suffer from a long
|
||||
time of a possible out-of-bound access for the argv array handling.
|
||||
|
||||
The BUG is present in the function env_do_env_set() line:
|
||||
|
||||
name = argv[1];
|
||||
|
||||
where the function at this point assume the argv at index 1 is always
|
||||
present and can't be NULL. Aside from the fact that it's always
|
||||
better to validate argv entry with the argc variable, situation where
|
||||
the argv[1] is NULL is actually possible and not an error condition.
|
||||
|
||||
A example of where an out-of-bound access is triggered is with the
|
||||
command "askenv - Press ENTER to ...".
|
||||
This is a common pattern for bootmenu entry to ask the user input after
|
||||
a bootmenu command succeeded.
|
||||
|
||||
In the context of such command, the while loop before "name = argv[1];"
|
||||
parse the "-" char as an option arg and increment the argv pointer by
|
||||
one (to make the rest of the logic code ignore the option argv) and
|
||||
decrement argc value.
|
||||
|
||||
The while loop logic is correct but at the "name = argv[1];" line, the
|
||||
argv have only one element left (the "-" char) and accessing argv[1]
|
||||
(aka the secong element from argv pointer) cause an out-of-bound access
|
||||
(making the bootloader eventually crash with strchr searching in invalid
|
||||
data)
|
||||
|
||||
To better handle this and prevent the out-of-bound access, actually
|
||||
check the argv entry left (with the use of the argc variable) and exit
|
||||
early before doing any kind of array access.
|
||||
|
||||
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
||||
---
|
||||
env/common.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
--- a/env/common.c
|
||||
+++ b/env/common.c
|
||||
@@ -82,6 +82,10 @@ int env_do_env_set(int flag, int argc, c
|
||||
}
|
||||
}
|
||||
debug("Final value for argc=%d\n", argc);
|
||||
+ /* Exit early if we don't have an env to apply */
|
||||
+ if (argc < 2)
|
||||
+ return 0;
|
||||
+
|
||||
name = argv[1];
|
||||
|
||||
if (strchr(name, '=')) {
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user