From 4b950bc5f440d389baaed3918d43efcd0a750f7f Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Thu, 18 May 2023 12:06:00 +0200 Subject: [PATCH 01/33] libxml2: update to 2.11.3 Changelog: - https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.10.4 - https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.11.0 - https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.11.1 - https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.11.2 - https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.11.3 Fixes: CVE-2023-28484 CVE-2023-29469 Signed-off-by: Nick Hainke --- package/libs/libxml2/Makefile | 6 +++--- package/libs/libxml2/patches/010-iconv.patch | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package/libs/libxml2/Makefile b/package/libs/libxml2/Makefile index e93d1c06bd..5a7de0d8a1 100644 --- a/package/libs/libxml2/Makefile +++ b/package/libs/libxml2/Makefile @@ -1,12 +1,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libxml2 -PKG_VERSION:=2.10.3 -PKG_RELEASE:=2 +PKG_VERSION:=2.11.3 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNOME/libxml2/$(basename $(PKG_VERSION)) -PKG_HASH:=5d2cc3d78bec3dbe212a9d7fa629ada25a7da928af432c93060ff5c17ee28a9c +PKG_HASH:=f1acae1664bda006cd81bfc238238217043d586d06659d5c0e3d1bcebe040870 PKG_LICENSE:=MIT PKG_LICENSE_FILES:=COPYING diff --git a/package/libs/libxml2/patches/010-iconv.patch b/package/libs/libxml2/patches/010-iconv.patch index e35b7ce939..92b09685c5 100644 --- a/package/libs/libxml2/patches/010-iconv.patch +++ b/package/libs/libxml2/patches/010-iconv.patch @@ -1,6 +1,6 @@ --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -496,6 +496,9 @@ if(LIBXML2_WITH_PROGRAMS) +@@ -469,6 +469,9 @@ if(LIBXML2_WITH_PROGRAMS) add_executable(LibXml2::${PROGRAM} ALIAS ${PROGRAM}) target_compile_definitions(${PROGRAM} PRIVATE SYSCONFDIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}") target_link_libraries(${PROGRAM} LibXml2) From ec4d63ffb34337761ccecb4c6f1fc91a4409a95e Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Wed, 17 May 2023 22:33:36 +0200 Subject: [PATCH 02/33] nu801: add kmod-leds-uleds to MR26 + MR18 support for MR18 and MR26 was developped before the userspace nu801 was integrated with x86's MX100 into OpenWrt. The initial nu801 + kmod-leds-uleds caused build-bot errors. The solution that worked for the MX100 was to include the kmod-leds-uleds to the device platform module. Thankfully, the MR26 and MR18 can just add the uleds package to the DEVICE_PACKAGES variable. Signed-off-by: Christian Lamparter --- target/linux/ath79/image/nand.mk | 2 +- target/linux/bcm53xx/image/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/ath79/image/nand.mk b/target/linux/ath79/image/nand.mk index 4f34521a50..d1bd4feb1f 100644 --- a/target/linux/ath79/image/nand.mk +++ b/target/linux/ath79/image/nand.mk @@ -272,7 +272,7 @@ define Device/meraki_mr18 SOC := qca9557 DEVICE_VENDOR := Meraki DEVICE_MODEL := MR18 - DEVICE_PACKAGES := kmod-spi-gpio nu801 + DEVICE_PACKAGES := kmod-leds-uleds kmod-spi-gpio nu801 KERNEL_SIZE := 8m BLOCKSIZE := 128k PAGESIZE := 2048 diff --git a/target/linux/bcm53xx/image/Makefile b/target/linux/bcm53xx/image/Makefile index 1cb08effce..defa68e59f 100644 --- a/target/linux/bcm53xx/image/Makefile +++ b/target/linux/bcm53xx/image/Makefile @@ -351,7 +351,7 @@ define Device/meraki_mr26 DEVICE_VENDOR := Meraki DEVICE_MODEL := MR26 DEVICE_PACKAGES := $(B43) kmod-i2c-bcm-iproc kmod-eeprom-at24 \ - kmod-hwmon-ina2xx nu801 + kmod-hwmon-ina2xx kmod-leds-uleds nu801 DEVICE_DTS := bcm53015-meraki-mr26 # resize the initramfs to fit the size of the existing part.safe. KERNEL_LOADADDR := 0x00008000 From 6d41da8b7e37db64599643c3ae4998397209322a Mon Sep 17 00:00:00 2001 From: Tim Harvey Date: Thu, 23 Feb 2023 15:24:18 -0800 Subject: [PATCH 03/33] imx: kernel: add USB storage boot support Enable BLK_DEV_SD and USB_STORAGE so that rootfs can be on a USB Mass Storage device. This adds 23KiB to the compressed kernel size Signed-off-by: Tim Harvey --- target/linux/imx/config-5.15 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/linux/imx/config-5.15 b/target/linux/imx/config-5.15 index 90b8c285fd..73d0b3fe78 100644 --- a/target/linux/imx/config-5.15 +++ b/target/linux/imx/config-5.15 @@ -41,6 +41,7 @@ CONFIG_ATAGS=y CONFIG_AUTO_ZRELADDR=y CONFIG_BINFMT_FLAT_ARGVP_ENVP_ON_STACK=y CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_DEV_SD=y CONFIG_BLK_PM=y CONFIG_CACHE_L2X0=y CONFIG_CLKSRC_IMX_GPT=y @@ -420,6 +421,7 @@ CONFIG_USB_MXS_PHY=y CONFIG_USB_OTG=y CONFIG_USB_PHY=y CONFIG_USB_ROLE_SWITCH=y +CONFIG_USB_STORAGE=y CONFIG_USB_SUPPORT=y CONFIG_USB_ULPI_BUS=y CONFIG_USE_OF=y From 39e60394103368dc24f010ceda5667ef058ba2ba Mon Sep 17 00:00:00 2001 From: Tim Harvey Date: Thu, 23 Feb 2023 15:23:42 -0800 Subject: [PATCH 04/33] octeontx: kernel: add USB storage boot support Enable BLK_DEV_SD and USB_STORAGE so that rootfs can be on a USB Mass Storage device. This increases the kernel Image by 66KiB Signed-off-by: Tim Harvey --- target/linux/octeontx/config-5.15 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/linux/octeontx/config-5.15 b/target/linux/octeontx/config-5.15 index 40cab28f60..c2ad7e7ab9 100644 --- a/target/linux/octeontx/config-5.15 +++ b/target/linux/octeontx/config-5.15 @@ -59,6 +59,7 @@ CONFIG_BLK_DEV_BSG=y CONFIG_BLK_DEV_BSGLIB=y CONFIG_BLK_DEV_BSG_COMMON=y CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_DEV_SD=y CONFIG_BLK_MQ_PCI=y CONFIG_BLK_MQ_VIRTIO=y CONFIG_BLK_PM=y @@ -401,6 +402,7 @@ CONFIG_UNMAP_KERNEL_AT_EL0=y CONFIG_USB=y CONFIG_USB_COMMON=y CONFIG_USB_PCI=y +CONFIG_USB_STORAGE=y CONFIG_USB_SUPPORT=y # CONFIG_USB_UHCI_HCD is not set CONFIG_USB_XHCI_HCD=y From 7519b35881149427c48d2c81a6c154ef3471d566 Mon Sep 17 00:00:00 2001 From: Tim Harvey Date: Wed, 22 Mar 2023 09:02:52 -0700 Subject: [PATCH 05/33] scripts/gen_image_generic.sh: allow passing in partition offset Allow passing in an optional offset (PARTOFFSET) for the first partition. If not specified this will default to 256K (512 blocks) as it has before. For example if you want to start partition data at a 16M offset instead of 256K, specify 'PARTOFFSET=16M'. Signed-off-by: Tim Harvey --- scripts/gen_image_generic.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/gen_image_generic.sh b/scripts/gen_image_generic.sh index ef13624402..5c88dcea80 100755 --- a/scripts/gen_image_generic.sh +++ b/scripts/gen_image_generic.sh @@ -19,7 +19,7 @@ head=16 sect=63 # create partition table -set $(ptgen -o "$OUTPUT" -h $head -s $sect ${GUID:+-g} -p "${KERNELSIZE}m" -p "${ROOTFSSIZE}m" ${ALIGN:+-l $ALIGN} ${SIGNATURE:+-S 0x$SIGNATURE} ${GUID:+-G $GUID}) +set $(ptgen -o "$OUTPUT" -h $head -s $sect ${GUID:+-g} -p "${KERNELSIZE}m${PARTOFFSET:+@$PARTOFFSET}" -p "${ROOTFSSIZE}m" ${ALIGN:+-l $ALIGN} ${SIGNATURE:+-S 0x$SIGNATURE} ${GUID:+-G $GUID}) KERNELOFFSET="$(($1 / 512))" KERNELSIZE="$2" From 92fec5360988bb761481ffdcb10514493f203321 Mon Sep 17 00:00:00 2001 From: Tomasz Maciej Nowak Date: Wed, 10 May 2023 19:07:07 +0200 Subject: [PATCH 06/33] download: create immutable subversion checkout archive On each generation of the archive check sum will differ, because when checking out subversion repository, current date is used for directories creation. Force tar to assign creation date of the last revision for all items inside archive. Signed-off-by: Tomasz Maciej Nowak --- include/download.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/download.mk b/include/download.mk index 34d31653b1..9ab0b6c08f 100644 --- a/include/download.mk +++ b/include/download.mk @@ -187,7 +187,7 @@ define DownloadMethod/svn svn export --non-interactive --trust-server-cert -r$(VERSION) $(URL) $(SUBDIR) || \ svn export --non-interactive -r$(VERSION) $(URL) $(SUBDIR) ) && \ echo "Packing checkout..." && \ - export TAR_TIMESTAMP="" && \ + export TAR_TIMESTAMP="`svn info -r$(VERSION) --show-item last-changed-date $(URL)`" && \ $(call dl_tar_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \ mv $(TMP_DIR)/dl/$(FILE) $(DL_DIR)/ && \ rm -rf $(SUBDIR); \ From bf12aac46435373f0ef3baaa5046046d2f51aa2f Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Thu, 23 Mar 2023 23:06:13 +0900 Subject: [PATCH 07/33] mvebu: cortexa9: enable Ethernet PHY LED trigger To use :: trigger for LEDs, enable PHY LED trigger (CONFIG_LED_TRIGGER_PHY). Signed-off-by: INAGAKI Hiroshi --- target/linux/mvebu/cortexa9/config-5.15 | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/mvebu/cortexa9/config-5.15 b/target/linux/mvebu/cortexa9/config-5.15 index b737c44d42..88a2f14c02 100644 --- a/target/linux/mvebu/cortexa9/config-5.15 +++ b/target/linux/mvebu/cortexa9/config-5.15 @@ -1,2 +1,3 @@ +CONFIG_LED_TRIGGER_PHY=y CONFIG_PHY_MVEBU_A38X_COMPHY=y CONFIG_RTC_DRV_MV=y From 4fffa0f6af7944d630687657958c9d872cf67285 Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Thu, 23 Mar 2023 23:06:14 +0900 Subject: [PATCH 08/33] mvebu: use PHY LED trigger for speed LEDs on FortiGate 50E Use :: trigger instead of netdev(link) trigger for Fortinet FortiGate 50E, to indicate link speed on the each phys. 1000 Mbps: Green 100 Mbps : Amber 10 Mbps : (turn off) Fixes: 102dc5a62506 ("mvebu: add support for Fortinet FortiGate 50E") Signed-off-by: INAGAKI Hiroshi --- .../mvebu/cortexa9/base-files/etc/board.d/01_leds | 9 --------- .../arch/arm/boot/dts/armada-385-fortinet-fg-50e.dts | 12 ++++++++++++ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/target/linux/mvebu/cortexa9/base-files/etc/board.d/01_leds b/target/linux/mvebu/cortexa9/base-files/etc/board.d/01_leds index bfc589e6c0..2b045d0945 100644 --- a/target/linux/mvebu/cortexa9/base-files/etc/board.d/01_leds +++ b/target/linux/mvebu/cortexa9/base-files/etc/board.d/01_leds @@ -15,15 +15,6 @@ ctera,c200-v2) ucidef_set_led_usbport "usb2" "USB2" "green:usb-2" "usb1-port1" "usb2-port1" ucidef_set_led_usbport "usb3" "USB3" "green:usb-1" "usb1-port2" "usb2-port2" ;; -fortinet,fg-50e) - ucidef_set_led_netdev "wan1_link" "WAN1 Link" "green:speed_wan1" "eth1" "link" - ucidef_set_led_netdev "wan2_link" "WAN2 Link" "green:speed_wan2" "eth2" "link" - ucidef_set_led_netdev "lan1_link" "LAN1 Link" "green:speed_lan1" "lan1" "link" - ucidef_set_led_netdev "lan2_link" "LAN2 Link" "green:speed_lan2" "lan2" "link" - ucidef_set_led_netdev "lan3_link" "LAN3 Link" "green:speed_lan3" "lan3" "link" - ucidef_set_led_netdev "lan4_link" "LAN4 Link" "green:speed_lan4" "lan4" "link" - ucidef_set_led_netdev "lan5_link" "LAN5 Link" "green:speed_lan5" "lan5" "link" - ;; kobol,helios4) ucidef_set_led_usbport "USB" "USB" "helios4:green:usb" "usb1-port1" "usb2-port1" "usb3-port1" "usb4-port1" "usb5-port1" ;; diff --git a/target/linux/mvebu/files/arch/arm/boot/dts/armada-385-fortinet-fg-50e.dts b/target/linux/mvebu/files/arch/arm/boot/dts/armada-385-fortinet-fg-50e.dts index 506e01f0ff..61d2da1755 100644 --- a/target/linux/mvebu/files/arch/arm/boot/dts/armada-385-fortinet-fg-50e.dts +++ b/target/linux/mvebu/files/arch/arm/boot/dts/armada-385-fortinet-fg-50e.dts @@ -97,72 +97,84 @@ label = "green:speed_wan1"; gpios = <&gpio2 0 GPIO_ACTIVE_HIGH>; color = ; + linux,default-trigger = "f1072004.mdio-mii:00:1Gbps"; }; led-7 { label = "green:speed_wan2"; gpios = <&gpio2 1 GPIO_ACTIVE_HIGH>; color = ; + linux,default-trigger = "f1072004.mdio-mii:01:1Gbps"; }; led-8 { label = "amber:speed_lan5"; gpios = <&gpio2 2 GPIO_ACTIVE_HIGH>; color = ; + linux,default-trigger = "mv88e6xxx-1:00:100Mbps"; }; led-9 { label = "green:speed_lan5"; gpios = <&gpio2 3 GPIO_ACTIVE_HIGH>; color = ; + linux,default-trigger = "mv88e6xxx-1:00:1Gbps"; }; led-10 { label = "green:speed_lan4"; gpios = <&gpio2 4 GPIO_ACTIVE_LOW>; color = ; + linux,default-trigger = "mv88e6xxx-1:01:1Gbps"; }; led-11 { label = "amber:speed_lan4"; gpios = <&gpio2 5 GPIO_ACTIVE_LOW>; color = ; + linux,default-trigger = "mv88e6xxx-1:01:100Mbps"; }; led-12 { label = "amber:speed_lan3"; gpios = <&gpio2 6 GPIO_ACTIVE_LOW>; color = ; + linux,default-trigger = "mv88e6xxx-1:02:100Mbps"; }; led-13 { label = "green:speed_lan3"; gpios = <&gpio2 7 GPIO_ACTIVE_LOW>; color = ; + linux,default-trigger = "mv88e6xxx-1:02:1Gbps"; }; led-14 { label = "green:speed_lan1"; gpios = <&gpio2 12 GPIO_ACTIVE_LOW>; color = ; + linux,default-trigger = "mv88e6xxx-1:04:1Gbps"; }; led-15 { label = "amber:speed_lan1"; gpios = <&gpio2 13 GPIO_ACTIVE_LOW>; color = ; + linux,default-trigger = "mv88e6xxx-1:04:100Mbps"; }; led-16 { label = "green:speed_lan2"; gpios = <&gpio2 14 GPIO_ACTIVE_LOW>; color = ; + linux,default-trigger = "mv88e6xxx-1:03:1Gbps"; }; led-17 { label = "amber:speed_lan2"; gpios = <&gpio2 15 GPIO_ACTIVE_LOW>; color = ; + linux,default-trigger = "mv88e6xxx-1:03:100Mbps"; }; }; From 8217f02a1c5e2396f083793575de2e79811842e8 Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Wed, 17 May 2023 22:02:40 +0200 Subject: [PATCH 09/33] ipq-wifi: drop upstreamed board-2.bin The BDFs for the: Aruba AP-365 Devolo Magic 2 WiFi next Edgecore ECW5410 Edgecore OAP100 Extreme Networks WS-AP3915i GL.iNet GL-A1300 GL.iNet GL-AP1300 GL.iNet GL-S1300 Linksys EA8300 Linksys WHW03v2 Nokia Wi4A AC400i P&W R619AC Pakedge WR-1 Qxwlan E2600AC C1 Sony NCP-HG100/Cellular Teltonika RUTX10 ZTE MF18A were upstreamed to the ath10k-firmware repository and landed in linux-firmware.git. Furthermore the BDFs for the: 8devices Habanero 8devices Jalapeno Qxwlan E2600AC C2 have been updated. Signed-off-by: Christian Lamparter --- package/firmware/ipq-wifi/Makefile | 42 --------------------------- target/linux/ipq40xx/image/generic.mk | 30 +++++++------------ target/linux/ipq806x/image/generic.mk | 2 +- 3 files changed, 11 insertions(+), 63 deletions(-) diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index 396a4c50b5..b3bec858ef 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -28,37 +28,16 @@ endef # ALLWIFIBOARDS:= \ - 8dev_habanero \ - 8dev_jalapeno \ - aruba_ap-365 \ buffalo_wxr-5950ax12 \ - devolo_magic-2-wifi-next \ dynalink_dl-wrx36 \ edgecore_eap102 \ - edgecore_ecw5410 \ - edgecore_oap100 \ edimax_cax1800 \ - extreme-networks_ws-ap3915i \ - glinet_gl-a1300 \ - glinet_gl-ap1300 \ - glinet_gl-s1300 \ - linksys_ea8300 \ - linksys_whw03v2 \ netgear_wax218 \ - nokia_ac400i \ - p2w_r619ac \ - pakedge_wr-1 \ qnap_301w \ - qxwlan_e2600ac-c1 \ - qxwlan_e2600ac-c2 \ redmi_ax6 \ - sony_ncp-hg100-cellular \ - teltonika_rutx \ wallys_dr40x9 \ xiaomi_ax3600 \ xiaomi_ax9000 \ - zte_mf18a \ - zte_mf289f \ zyxel_nbg7815 ALLWIFIPACKAGES:=$(foreach BOARD,$(ALLWIFIBOARDS),ipq-wifi-$(BOARD)) @@ -133,37 +112,16 @@ endef # Place files in this directory as board-. # Add $(eval $(call generate-ipq-wifi-package,,)) -$(eval $(call generate-ipq-wifi-package,8dev_habanero,8devices Habanero)) -$(eval $(call generate-ipq-wifi-package,8dev_jalapeno,8devices Jalapeno)) -$(eval $(call generate-ipq-wifi-package,aruba_ap-365,Aruba AP-365)) $(eval $(call generate-ipq-wifi-package,buffalo_wxr-5950ax12,Buffalo WXR-5950AX12)) -$(eval $(call generate-ipq-wifi-package,devolo_magic-2-wifi-next,devolo Magic 2 WiFi next)) $(eval $(call generate-ipq-wifi-package,dynalink_dl-wrx36,Dynalink DL-WRX36)) $(eval $(call generate-ipq-wifi-package,edgecore_eap102,Edgecore EAP102)) -$(eval $(call generate-ipq-wifi-package,edgecore_ecw5410,Edgecore ECW5410)) -$(eval $(call generate-ipq-wifi-package,edgecore_oap100,Edgecore OAP100)) $(eval $(call generate-ipq-wifi-package,edimax_cax1800,Edimax CAX1800)) -$(eval $(call generate-ipq-wifi-package,extreme-networks_ws-ap3915i,Edgecore OAP100)) -$(eval $(call generate-ipq-wifi-package,glinet_gl-a1300,GL.iNet GL-A1300)) -$(eval $(call generate-ipq-wifi-package,glinet_gl-ap1300,GL.iNet GL-AP1300)) -$(eval $(call generate-ipq-wifi-package,glinet_gl-s1300,GL.iNet GL-S1300)) -$(eval $(call generate-ipq-wifi-package,linksys_ea8300,Linksys EA8300)) -$(eval $(call generate-ipq-wifi-package,linksys_whw03v2,Linksys WHW03 V2)) $(eval $(call generate-ipq-wifi-package,netgear_wax218,Netgear WAX218)) -$(eval $(call generate-ipq-wifi-package,nokia_ac400i,Nokia AC400i)) -$(eval $(call generate-ipq-wifi-package,p2w_r619ac,P&W R619AC)) -$(eval $(call generate-ipq-wifi-package,pakedge_wr-1,Pakedge WR-1)) $(eval $(call generate-ipq-wifi-package,qnap_301w,QNAP 301w)) -$(eval $(call generate-ipq-wifi-package,qxwlan_e2600ac-c1,Qxwlan E2600AC C1)) -$(eval $(call generate-ipq-wifi-package,qxwlan_e2600ac-c2,Qxwlan E2600AC C2)) $(eval $(call generate-ipq-wifi-package,redmi_ax6,Redmi AX6)) -$(eval $(call generate-ipq-wifi-package,sony_ncp-hg100-cellular,Sony NCP-HG100/Cellular)) -$(eval $(call generate-ipq-wifi-package,teltonika_rutx,Teltonika RUTX)) $(eval $(call generate-ipq-wifi-package,wallys_dr40x9,Wallys DR40X9)) $(eval $(call generate-ipq-wifi-package,xiaomi_ax3600,Xiaomi AX3600)) $(eval $(call generate-ipq-wifi-package,xiaomi_ax9000,Xiaomi AX9000)) -$(eval $(call generate-ipq-wifi-package,zte_mf18a,ZTE MF18A)) -$(eval $(call generate-ipq-wifi-package,zte_mf289f,ZTE MF289F)) $(eval $(call generate-ipq-wifi-package,zyxel_nbg7815,Zyxel NBG7815)) $(foreach PACKAGE,$(ALLWIFIPACKAGES),$(eval $(call BuildPackage,$(PACKAGE)))) diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk index adce4fe0f2..c8b8ec936b 100644 --- a/target/linux/ipq40xx/image/generic.mk +++ b/target/linux/ipq40xx/image/generic.mk @@ -132,7 +132,6 @@ define Device/8dev_habanero-dvk IMAGE_SIZE := 30976k SOC := qcom-ipq4019 IMAGE/sysupgrade.bin := append-kernel | pad-to 64k | append-rootfs | pad-rootfs | check-size | append-metadata - DEVICE_PACKAGES := ipq-wifi-8dev_habanero endef TARGET_DEVICES += 8dev_habanero-dvk @@ -142,7 +141,6 @@ define Device/8dev_jalapeno-common BLOCKSIZE := 128k PAGESIZE := 2048 SOC := qcom-ipq4018 - DEVICE_PACKAGES := ipq-wifi-8dev_jalapeno endef define Device/8dev_jalapeno @@ -188,7 +186,7 @@ TARGET_DEVICES += aruba_ap-303h define Device/aruba_ap-365 $(call Device/aruba_glenmorangie) DEVICE_MODEL := AP-365 - DEVICE_PACKAGES := kmod-hwmon-ad7418 ipq-wifi-aruba_ap-365 + DEVICE_PACKAGES := kmod-hwmon-ad7418 endef TARGET_DEVICES += aruba_ap-365 @@ -388,7 +386,6 @@ define Device/devolo_magic-2-wifi-next IMAGE_SIZE := 26624k IMAGES := sysupgrade.bin IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata - DEVICE_PACKAGES := ipq-wifi-devolo_magic-2-wifi-next DEFAULT := n endef # Missing DSA Setup @@ -443,7 +440,7 @@ define Device/edgecore_oap100 PAGESIZE := 2048 IMAGES := sysupgrade.bin DEVICE_DTS_CONFIG := config@ap.dk07.1-c1 - DEVICE_PACKAGES := ipq-wifi-edgecore_oap100 kmod-usb-acm kmod-usb-net kmod-usb-net-cdc-qmi uqmi + DEVICE_PACKAGES := kmod-usb-acm kmod-usb-net kmod-usb-net-cdc-qmi uqmi endef # Missing DSA Setup #TARGET_DEVICES += edgecore_oap100 @@ -540,7 +537,6 @@ define Device/extreme-networks_ws-ap3915i SOC := qcom-ipq4029 BLOCKSIZE := 128k IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | check-size | append-metadata - DEVICE_PACKAGES := ipq-wifi-extreme-networks_ws-ap3915i endef TARGET_DEVICES += extreme-networks_ws-ap3915i @@ -572,7 +568,6 @@ define Device/glinet_gl-a1300 BLOCKSIZE := 128k PAGESIZE := 2048 IMAGE_SIZE := 131072k - DEVICE_PACKAGE := ipq-wifi-glinet_gl-a1300 endef TARGET_DEVICES += glinet_gl-a1300 @@ -587,7 +582,7 @@ define Device/glinet_gl-ap1300 PAGESIZE := 2048 IMAGE_SIZE := 131072k KERNEL_INSTALL := 1 - DEVICE_PACKAGES := ipq-wifi-glinet_gl-ap1300 kmod-usb-net-qmi-wwan kmod-usb-serial-option uqmi + DEVICE_PACKAGES := kmod-usb-net-qmi-wwan kmod-usb-serial-option uqmi endef TARGET_DEVICES += glinet_gl-ap1300 @@ -630,7 +625,7 @@ define Device/glinet_gl-s1300 IMAGE_SIZE := 26624k IMAGES := sysupgrade.bin IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata - DEVICE_PACKAGES := ipq-wifi-glinet_gl-s1300 kmod-fs-ext4 kmod-mmc kmod-spi-dev + DEVICE_PACKAGES := kmod-fs-ext4 kmod-mmc kmod-spi-dev endef # Missing DSA Setup #TARGET_DEVICES += glinet_gl-s1300 @@ -697,7 +692,7 @@ define Device/linksys_ea8300 UBINIZE_OPTS := -E 5 # EOD marks to "hide" factory sig at EOF IMAGES += factory.bin IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | linksys-image type=EA8300 - DEVICE_PACKAGES := ath10k-firmware-qca9888-ct ipq-wifi-linksys_ea8300 kmod-usb-ledtrig-usbport + DEVICE_PACKAGES := ath10k-firmware-qca9888-ct kmod-usb-ledtrig-usbport endef TARGET_DEVICES += linksys_ea8300 @@ -731,7 +726,7 @@ define Device/linksys_whw03v2 UBINIZE_OPTS := -E 5 # EOD marks to "hide" factory sig at EOF IMAGES += factory.bin IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | linksys-image type=WHW03v2 - DEVICE_PACKAGES := ath10k-firmware-qca9888-ct ipq-wifi-linksys_whw03v2 kmod-leds-pca963x kmod-spi-dev kmod-bluetooth + DEVICE_PACKAGES := ath10k-firmware-qca9888-ct kmod-leds-pca963x kmod-spi-dev kmod-bluetooth endef TARGET_DEVICES += linksys_whw03v2 @@ -935,7 +930,6 @@ define Device/p2w_r619ac DEVICE_DTS_CONFIG := config@10 BLOCKSIZE := 128k PAGESIZE := 2048 - DEVICE_PACKAGES := ipq-wifi-p2w_r619ac endef define Device/p2w_r619ac-64m @@ -957,7 +951,6 @@ define Device/pakedge_wr-1 DEVICE_VENDOR := Pakedge DEVICE_MODEL := WR-1 DEVICE_DTS_CONFIG := config@ap.dk01.1-c1 - DEVICE_PACKAGES := ipq-wifi-pakedge_wr-1 SOC := qcom-ipq4018 BLOCKSIZE := 64k IMAGE_SIZE := 31232k @@ -1039,7 +1032,6 @@ define Device/qxwlan_e2600ac-c1 KERNEL_SIZE := 4096k IMAGE_SIZE := 31232k IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata - DEVICE_PACKAGES := ipq-wifi-qxwlan_e2600ac-c1 DEFAULT := n endef # Missing DSA Setup @@ -1055,7 +1047,6 @@ define Device/qxwlan_e2600ac-c2 KERNEL_INSTALL := 1 BLOCKSIZE := 128k PAGESIZE := 2048 - DEVICE_PACKAGES := ipq-wifi-qxwlan_e2600ac-c2 endef # Missing DSA Setup #TARGET_DEVICES += qxwlan_e2600ac-c2 @@ -1068,8 +1059,7 @@ define Device/sony_ncp-hg100-cellular SOC := qcom-ipq4019 KERNEL_SIZE := 8192k IMAGE_SIZE := 128m - DEVICE_PACKAGES := e2fsprogs ipq-wifi-sony_ncp-hg100-cellular \ - kmod-fs-ext4 uqmi + DEVICE_PACKAGES := e2fsprogs kmod-fs-ext4 uqmi endef TARGET_DEVICES += sony_ncp-hg100-cellular @@ -1085,7 +1075,7 @@ define Device/teltonika_rutx10 PAGESIZE := 2048 FILESYSTEMS := squashfs IMAGE/factory.ubi := append-ubi | qsdk-ipq-factory-nand | append-rutx-metadata - DEVICE_PACKAGES := ipq-wifi-teltonika_rutx kmod-bluetooth + DEVICE_PACKAGES := kmod-bluetooth endef # Missing DSA Setup #TARGET_DEVICES += teltonika_rutx10 @@ -1141,7 +1131,7 @@ define Device/zte_mf18a BLOCKSIZE := 128k PAGESIZE := 2048 KERNEL_IN_UBI := 1 - DEVICE_PACKAGES := ath10k-firmware-qca99x0-ct ipq-wifi-zte_mf18a + DEVICE_PACKAGES := ath10k-firmware-qca99x0-ct endef TARGET_DEVICES += zte_mf18a @@ -1165,7 +1155,7 @@ TARGET_DEVICES += zte_mf286d define Device/zte_mf289f $(call Device/zte_mf28x_common) DEVICE_MODEL := MF289F - DEVICE_PACKAGES += ipq-wifi-zte_mf289f ath10k-firmware-qca9984-ct + DEVICE_PACKAGES += ath10k-firmware-qca9984-ct endef TARGET_DEVICES += zte_mf289f diff --git a/target/linux/ipq806x/image/generic.mk b/target/linux/ipq806x/image/generic.mk index 3e9b366c39..8382c77bdc 100644 --- a/target/linux/ipq806x/image/generic.mk +++ b/target/linux/ipq806x/image/generic.mk @@ -345,7 +345,7 @@ define Device/nokia_ac400i BLOCKSIZE := 128k PAGESIZE := 2048 BOARD_NAME := ac400i - DEVICE_PACKAGES := ath10k-firmware-qca9984-ct ipq-wifi-nokia-ac400i + DEVICE_PACKAGES := ath10k-firmware-qca9984-ct endef TARGET_DEVICES += nokia_ac400i From c07038da27cefa5a93e433909b9aca594386ddc1 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Tue, 16 May 2023 12:38:53 +0800 Subject: [PATCH 10/33] kernel: add MODULE_ALLOW_BTF_MISMATCH option BTF mismatch can occur for a separately-built module even when the ABI is otherwise compatible and nothing else would prevent successfully loading. Add a new config to control how mismatches are handled. By default, preserve the current behavior of refusing to load the module. If MODULE_ALLOW_BTF_MISMATCH is enabled, load the module but ignore its BTF information. Signed-off-by: Tianling Shen --- config/Config-kernel.in | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/config/Config-kernel.in b/config/Config-kernel.in index 3a2189d63a..6c5e6a967a 100644 --- a/config/Config-kernel.in +++ b/config/Config-kernel.in @@ -373,6 +373,16 @@ config KERNEL_DEBUG_INFO_BTF Required to run BPF CO-RE applications. +config KERNEL_MODULE_ALLOW_BTF_MISMATCH + bool "Allow loading modules with non-matching BTF type info" + depends on KERNEL_DEBUG_INFO_BTF + help + For modules whose split BTF does not match vmlinux, load without + BTF rather than refusing to load. The default behavior with + module BTF enabled is to reject modules with such mismatches; + this option will still load module BTF where possible but ignore + it when a mismatch is found. + config KERNEL_DEBUG_INFO_REDUCED bool "Reduce debugging information" default y From d343a15314195023c7c77884c86df4629f1bfa76 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Sat, 13 May 2023 21:00:59 +0800 Subject: [PATCH 11/33] ramips: enable variable sector size erasure for all subtarget Make use of minor sector size (4k) on supported flash chips to improve spi read/write performance. Tested on ramips/mt7628: Motorola MWR03 Signed-off-by: Shiji Yang --- target/linux/ramips/mt76x8/config-5.15 | 1 + target/linux/ramips/rt288x/config-5.15 | 1 + target/linux/ramips/rt305x/config-5.15 | 2 +- target/linux/ramips/rt3883/config-5.15 | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/target/linux/ramips/mt76x8/config-5.15 b/target/linux/ramips/mt76x8/config-5.15 index 5a82edfb10..7248aa6633 100644 --- a/target/linux/ramips/mt76x8/config-5.15 +++ b/target/linux/ramips/mt76x8/config-5.15 @@ -116,6 +116,7 @@ CONFIG_MTD_CMDLINE_PARTS=y CONFIG_MTD_PARSER_TRX=y CONFIG_MTD_PHYSMAP=y CONFIG_MTD_SPI_NOR=y +CONFIG_MTD_SPI_NOR_USE_VARIABLE_ERASE=y CONFIG_MTD_SPLIT_TPLINK_FW=y CONFIG_MTD_SPLIT_UIMAGE_FW=y CONFIG_MTD_VIRT_CONCAT=y diff --git a/target/linux/ramips/rt288x/config-5.15 b/target/linux/ramips/rt288x/config-5.15 index 19a71d67ea..0e4afe367e 100644 --- a/target/linux/ramips/rt288x/config-5.15 +++ b/target/linux/ramips/rt288x/config-5.15 @@ -103,6 +103,7 @@ CONFIG_MODULES_USE_ELF_REL=y CONFIG_MTD_CMDLINE_PARTS=y CONFIG_MTD_PHYSMAP=y CONFIG_MTD_SPI_NOR=y +CONFIG_MTD_SPI_NOR_USE_VARIABLE_ERASE=y CONFIG_MTD_SPLIT_LZMA_FW=y CONFIG_MTD_SPLIT_UIMAGE_FW=y CONFIG_MTD_SPLIT_WRGG_FW=y diff --git a/target/linux/ramips/rt305x/config-5.15 b/target/linux/ramips/rt305x/config-5.15 index 2c2fc37a63..fccc7370a5 100644 --- a/target/linux/ramips/rt305x/config-5.15 +++ b/target/linux/ramips/rt305x/config-5.15 @@ -106,7 +106,7 @@ CONFIG_MODULES_USE_ELF_REL=y CONFIG_MTD_CMDLINE_PARTS=y CONFIG_MTD_PHYSMAP=y CONFIG_MTD_SPI_NOR=y -CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y +CONFIG_MTD_SPI_NOR_USE_VARIABLE_ERASE=y CONFIG_MTD_SPLIT_JIMAGE_FW=y CONFIG_MTD_SPLIT_SEAMA_FW=y CONFIG_MTD_SPLIT_UIMAGE_FW=y diff --git a/target/linux/ramips/rt3883/config-5.15 b/target/linux/ramips/rt3883/config-5.15 index 70d8797306..3d412e8b9d 100644 --- a/target/linux/ramips/rt3883/config-5.15 +++ b/target/linux/ramips/rt3883/config-5.15 @@ -104,7 +104,7 @@ CONFIG_MODULES_USE_ELF_REL=y CONFIG_MTD_CMDLINE_PARTS=y CONFIG_MTD_PHYSMAP=y CONFIG_MTD_SPI_NOR=y -CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y +CONFIG_MTD_SPI_NOR_USE_VARIABLE_ERASE=y CONFIG_MTD_SPLIT_SEAMA_FW=y CONFIG_MTD_SPLIT_UIMAGE_FW=y CONFIG_NEED_DMA_MAP_STATE=y From 09a0efbe835428eaf436b17ae6709f0b22e48c5a Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Sat, 13 May 2023 21:01:00 +0800 Subject: [PATCH 12/33] ramips: set default BLOCKSIZE to 64k for nor flash devices In kernel 5.15, the default erase sector size of the nor flash has been switched from 4k to 64k. This may cause the configuration not be preserved across upgrades. To avoid this issue, change the default BLOCKSIZE to 64k. Signed-off-by: Shiji Yang --- target/linux/ramips/image/Makefile | 3 +-- target/linux/ramips/image/mt7620.mk | 20 -------------------- target/linux/ramips/image/mt7621.mk | 6 ------ target/linux/ramips/image/mt76x8.mk | 4 ---- target/linux/ramips/image/rt288x.mk | 8 +------- target/linux/ramips/image/rt305x.mk | 25 ------------------------- target/linux/ramips/image/rt3883.mk | 10 ---------- 7 files changed, 2 insertions(+), 74 deletions(-) diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile index baa930e684..c080456e7a 100644 --- a/target/linux/ramips/image/Makefile +++ b/target/linux/ramips/image/Makefile @@ -172,6 +172,7 @@ endef define Device/Default PROFILES = Default + BLOCKSIZE := 64k KERNEL := $(KERNEL_DTB) | uImage lzma KERNEL_LOADADDR := $(loadaddr-y) LZMA_TEXT_START := 0x81800000 @@ -185,7 +186,6 @@ define Device/Default endef define Device/netgear_sercomm_nor - BLOCKSIZE := 64k DEVICE_VENDOR := NETGEAR IMAGES += factory.img IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | \ @@ -197,7 +197,6 @@ define Device/netgear_sercomm_nor endef define Device/seama - BLOCKSIZE := 64k SEAMA_MTDBLOCK := 2 IMAGES += factory.bin diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk index de84b232c1..621162c970 100644 --- a/target/linux/ramips/image/mt7620.mk +++ b/target/linux/ramips/image/mt7620.mk @@ -79,7 +79,6 @@ define Device/ampedwireless_b1200ex SOC := mt7620a DEVICE_VENDOR := Amped Wireless DEVICE_MODEL := B1200EX - BLOCKSIZE := 4k IMAGE_SIZE := 7744k IMAGE/sysupgrade.bin := append-kernel | append-rootfs | \ edimax-header -s CSYS -m RN10 -f 0x70000 -S 0x01100000 | pad-rootfs | \ @@ -198,7 +197,6 @@ TARGET_DEVICES += comfast_cf-wr800n define Device/dlink_dch-m225 $(Device/seama) SOC := mt7620a - BLOCKSIZE := 4k SEAMA_SIGNATURE := wapn22_dlink.2013gui_dap1320b IMAGE_SIZE := 6848k DEVICE_VENDOR := D-Link @@ -384,7 +382,6 @@ define Device/edimax_br-6478ac-v2 DEVICE_VENDOR := Edimax DEVICE_MODEL := BR-6478AC DEVICE_VARIANT := V2 - BLOCKSIZE := 64k IMAGE_SIZE := 7744k IMAGE/sysupgrade.bin := append-kernel | append-rootfs | \ edimax-header -s CSYS -m RN68 -f 0x70000 -S 0x01100000 | pad-rootfs | \ @@ -398,7 +395,6 @@ define Device/edimax_ew-7476rpc SOC := mt7620a DEVICE_VENDOR := Edimax DEVICE_MODEL := EW-7476RPC - BLOCKSIZE := 4k IMAGE_SIZE := 7744k IMAGE/sysupgrade.bin := append-kernel | append-rootfs | \ edimax-header -s CSYS -m RN79 -f 0x70000 -S 0x01100000 | pad-rootfs | \ @@ -411,7 +407,6 @@ define Device/edimax_ew-7478ac SOC := mt7620a DEVICE_VENDOR := Edimax DEVICE_MODEL := EW-7478AC - BLOCKSIZE := 4k IMAGE_SIZE := 7744k IMAGE/sysupgrade.bin := append-kernel | append-rootfs | \ edimax-header -s CSYS -m RN70 -f 0x70000 -S 0x01100000 | pad-rootfs | \ @@ -424,7 +419,6 @@ define Device/edimax_ew-7478apc SOC := mt7620a DEVICE_VENDOR := Edimax DEVICE_MODEL := EW-7478APC - BLOCKSIZE := 4k IMAGE_SIZE := 7744k IMAGE/sysupgrade.bin := append-kernel | append-rootfs | \ edimax-header -s CSYS -m RN75 -f 0x70000 -S 0x01100000 | pad-rootfs | \ @@ -449,7 +443,6 @@ TARGET_DEVICES += elecom_wrh-300cr define Device/engenius_epg600 $(Device/uimage-lzma-loader) SOC := mt7620a - BLOCKSIZE := 4k IMAGE_SIZE := 15616k IMAGES += factory.dlf IMAGE/factory.dlf := $$(sysupgrade_bin) | check-size | \ @@ -463,7 +456,6 @@ TARGET_DEVICES += engenius_epg600 define Device/engenius_esr600 SOC := mt7620a - BLOCKSIZE := 64k IMAGE_SIZE := 15616k IMAGES += factory.dlf IMAGE/factory.dlf := $$(sysupgrade_bin) | check-size | \ @@ -760,7 +752,6 @@ TARGET_DEVICES += microduino_microwrt define Device/netcore_nw5212 SOC := mt7620a IMAGE_SIZE := 16064k - BLOCKSIZE := 4k DEVICE_VENDOR := Netcore DEVICE_MODEL := NW5212 DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci @@ -771,7 +762,6 @@ define Device/netgear_ex2700 SOC := mt7620a NETGEAR_HW_ID := 29764623+4+0+32+2x2+0 NETGEAR_BOARD_ID := EX2700 - BLOCKSIZE := 4k IMAGE_SIZE := 3776k IMAGES += factory.bin KERNEL := $(KERNEL_DTB) | uImage lzma | pad-offset 64k 64 | \ @@ -787,7 +777,6 @@ TARGET_DEVICES += netgear_ex2700 define Device/netgear_ex3700 SOC := mt7620a NETGEAR_BOARD_ID := U12H319T00_NETGEAR - BLOCKSIZE := 4k IMAGE_SIZE := 7744k IMAGES += factory.chk IMAGE/factory.chk := $$(sysupgrade_bin) | check-size | netgear-chk @@ -801,7 +790,6 @@ TARGET_DEVICES += netgear_ex3700 define Device/netgear_ex6120 SOC := mt7620a NETGEAR_BOARD_ID := U12H319T30_NETGEAR - BLOCKSIZE := 4k IMAGE_SIZE := 7744k IMAGES += factory.chk IMAGE/factory.chk := $$(sysupgrade_bin) | check-size | netgear-chk @@ -814,7 +802,6 @@ TARGET_DEVICES += netgear_ex6120 define Device/netgear_ex6130 SOC := mt7620a NETGEAR_BOARD_ID := U12H319T50_NETGEAR - BLOCKSIZE := 4k IMAGE_SIZE := 7744k IMAGES += factory.chk IMAGE/factory.chk := $$(sysupgrade_bin) | check-size | netgear-chk @@ -827,7 +814,6 @@ TARGET_DEVICES += netgear_ex6130 define Device/netgear_jwnr2010-v5 $(Device/netgear_sercomm_nor) SOC := mt7620n - BLOCKSIZE := 4k IMAGE_SIZE := 3840k DEVICE_MODEL := JWNR2010 DEVICE_VARIANT := v5 @@ -843,7 +829,6 @@ TARGET_DEVICES += netgear_jwnr2010-v5 define Device/netgear_pr2000 $(Device/netgear_sercomm_nor) SOC := mt7620n - BLOCKSIZE := 4k IMAGE_SIZE := 15488k DEVICE_MODEL := PR2000 DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci @@ -860,7 +845,6 @@ define Device/netgear_wn3000rp-v3 IMAGE_SIZE := 7872k NETGEAR_HW_ID := 29764836+8+0+32+2x2+0 NETGEAR_BOARD_ID := WN3000RPv3 - BLOCKSIZE := 4k IMAGES += factory.bin KERNEL := $(KERNEL_DTB) | uImage lzma | pad-offset 64k 64 | \ append-uImage-fakehdr filesystem @@ -877,7 +861,6 @@ define Device/netgear_wn3100rp-v2 IMAGE_SIZE := 7872k NETGEAR_HW_ID := 29764883+8+0+32+2x2+0 NETGEAR_BOARD_ID := WN3100RPv2 - BLOCKSIZE := 4k IMAGES += factory.bin KERNEL := $(KERNEL_DTB) | uImage lzma | pad-offset 64k 64 | \ append-uImage-fakehdr filesystem @@ -901,7 +884,6 @@ TARGET_DEVICES += netis_wf2770 define Device/nexx_wt3020-4m SOC := mt7620n - BLOCKSIZE := 4k IMAGE_SIZE := 3776k IMAGES += factory.bin IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | \ @@ -1107,7 +1089,6 @@ TARGET_DEVICES += sercomm_na930 define Device/sitecom_wlr-4100-v1-002 SOC := mt7620a - BLOCKSIZE := 4k IMAGE_SIZE := 7744k IMAGES += factory.dlf IMAGE/factory.dlf := $$(sysupgrade_bin) | check-size | \ @@ -1244,7 +1225,6 @@ TARGET_DEVICES += trendnet_tew-810dr define Device/vonets_var11n-300 SOC := mt7620n IMAGE_SIZE := 3776k - BLOCKSIZE := 4k DEVICE_VENDOR := Vonets DEVICE_MODEL := VAR11N-300 DEFAULT := n diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 7c2152a981..56b4d173fb 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -217,7 +217,6 @@ define Device/arcadyan_we420223-99 IMAGE_SIZE := 32128k KERNEL_SIZE := 4352k UBINIZE_OPTS := -E 5 - BLOCKSIZE := 64k PAGESIZE := 1 SUBPAGESIZE := 1 VID_HDR_OFFSET := 64 @@ -258,7 +257,6 @@ define Device/asus_rp-ac56 DEVICE_VENDOR := ASUS DEVICE_MODEL := RP-AC56 IMAGE_SIZE := 16000k - BLOCKSIZE := 64k DEVICE_PACKAGES := kmod-mt7603 kmod-mt76x2 \ kmod-i2c-ralink kmod-sound-mt7620 -uboot-envtools IMAGES += factory.bin @@ -1409,7 +1407,6 @@ TARGET_DEVICES += jcg_y2 define Device/keenetic_kn-3010 $(Device/dsa-migration) $(Device/uimage-lzma-loader) - BLOCKSIZE := 64k IMAGE_SIZE := 31488k DEVICE_VENDOR := Keenetic DEVICE_MODEL := KN-3010 @@ -1558,7 +1555,6 @@ TARGET_DEVICES += mediatek_ap-mt7621a-v60 define Device/mediatek_mt7621-eval-board $(Device/dsa-migration) - BLOCKSIZE := 64k IMAGE_SIZE := 15104k DEVICE_VENDOR := MediaTek DEVICE_MODEL := MT7621 EVB @@ -1583,7 +1579,6 @@ TARGET_DEVICES += mercusys_mr70x-v1 define Device/MikroTik $(Device/dsa-migration) DEVICE_VENDOR := MikroTik - BLOCKSIZE := 64k IMAGE_SIZE := 16128k DEVICE_PACKAGES := kmod-usb3 -uboot-envtools KERNEL_NAME := vmlinuz @@ -2500,7 +2495,6 @@ TARGET_DEVICES += wavlink_wl-wn533a8 define Device/wavlink_ws-wn572hp3-4g $(Device/dsa-migration) - BLOCKSIZE := 64k DEVICE_VENDOR := Wavlink DEVICE_MODEL := WS-WN572HP3 DEVICE_VARIANT := 4G diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk index fd16606f3f..22db5c1382 100644 --- a/target/linux/ramips/image/mt76x8.mk +++ b/target/linux/ramips/image/mt76x8.mk @@ -50,7 +50,6 @@ endef TARGET_DEVICES += asus_rt-ac1200 define Device/asus_rt-ac1200-v2 - BLOCKSIZE := 64k IMAGE_SIZE := 16064k DEVICE_VENDOR := ASUS DEVICE_MODEL := RT-AC1200 @@ -323,7 +322,6 @@ endef TARGET_DEVICES += jotale_js76x8-32m define Device/keenetic_kn-1613 - BLOCKSIZE := 64k IMAGE_SIZE := 31488k DEVICE_VENDOR := Keenetic DEVICE_MODEL := KN-1613 @@ -381,7 +379,6 @@ endef TARGET_DEVICES += mediatek_linkit-smart-7688 define Device/mediatek_mt7628an-eval-board - BLOCKSIZE := 64k IMAGE_SIZE := 7872k DEVICE_VENDOR := MediaTek DEVICE_MODEL := MT7628 EVB @@ -1040,7 +1037,6 @@ TARGET_DEVICES += zbtlink_zbt-we1226 define Device/zyxel_keenetic-extra-ii IMAGE_SIZE := 29824k - BLOCKSIZE := 64k DEVICE_VENDOR := ZyXEL DEVICE_MODEL := Keenetic Extra II DEVICE_PACKAGES := kmod-mt76x2 kmod-usb2 kmod-usb-ohci \ diff --git a/target/linux/ramips/image/rt288x.mk b/target/linux/ramips/image/rt288x.mk index 5e69e291d2..3d2d0c7ae0 100644 --- a/target/linux/ramips/image/rt288x.mk +++ b/target/linux/ramips/image/rt288x.mk @@ -12,11 +12,10 @@ define Build/gemtek-header endef define Device/airlink101_ar670w - BLOCKSIZE := 64k DEVICE_VENDOR := Airlink DEVICE_MODEL := AR670W IMAGE_SIZE := 3840k - KERNEL := $(KERNEL_DTB) | pad-to $$(BLOCKSIZE) + KERNEL := $(KERNEL_DTB) | pad-to $$$$(BLOCKSIZE) IMAGES += factory.bin IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | \ wrg-header wrgn16a_airlink_ar670w @@ -38,7 +37,6 @@ endef TARGET_DEVICES += airlink101_ar725w define Device/asus_rt-n15 - BLOCKSIZE := 64k IMAGE_SIZE := 3776k DEVICE_VENDOR := ASUS DEVICE_MODEL := RT-N15 @@ -60,7 +58,6 @@ endef TARGET_DEVICES += belkin_f5d8235-v1 define Device/buffalo_wli-tx4-ag300n - BLOCKSIZE := 64k IMAGE_SIZE := 3776k DEVICE_VENDOR := Buffalo DEVICE_MODEL := WLI-TX4-AG300N @@ -71,7 +68,6 @@ endef TARGET_DEVICES += buffalo_wli-tx4-ag300n define Device/buffalo_wzr-agl300nh - BLOCKSIZE := 64k IMAGE_SIZE := 3776k DEVICE_VENDOR := Buffalo DEVICE_MODEL := WZR-AGL300NH @@ -82,7 +78,6 @@ endef TARGET_DEVICES += buffalo_wzr-agl300nh define Device/dlink_dap-1522-a1 - BLOCKSIZE := 64k IMAGE_SIZE := 3712k DEVICE_VENDOR := D-Link DEVICE_MODEL := DAP-1522 @@ -98,7 +93,6 @@ endef TARGET_DEVICES += dlink_dap-1522-a1 define Device/ralink_v11st-fe - BLOCKSIZE := 64k IMAGE_SIZE := 3776k DEVICE_VENDOR := Ralink DEVICE_MODEL := V11ST-FE diff --git a/target/linux/ramips/image/rt305x.mk b/target/linux/ramips/image/rt305x.mk index 92cc9094a8..83658cffa2 100644 --- a/target/linux/ramips/image/rt305x.mk +++ b/target/linux/ramips/image/rt305x.mk @@ -67,7 +67,6 @@ TARGET_DEVICES += accton_wr6202 define Device/airlive_air3gii SOC := rt5350 - BLOCKSIZE := 64k IMAGE_SIZE := 3776k DEVICE_VENDOR := AirLive DEVICE_MODEL := Air3GII @@ -174,7 +173,6 @@ TARGET_DEVICES += argus_atp-52b define Device/asiarf_awapn2403 SOC := rt3052 - BLOCKSIZE := 4k IMAGE_SIZE := 3776k DEVICE_VENDOR := AsiaRF DEVICE_MODEL := AWAPN2403 @@ -208,7 +206,6 @@ TARGET_DEVICES += asiarf_awm002-evb-8m define Device/asus_rt-g32-b1 SOC := rt3050 - BLOCKSIZE := 4k IMAGE_SIZE := 3776k DEVICE_VENDOR := ASUS DEVICE_MODEL := RT-G32 @@ -220,7 +217,6 @@ TARGET_DEVICES += asus_rt-g32-b1 define Device/asus_rt-n10-plus SOC := rt3050 - BLOCKSIZE := 64k IMAGE_SIZE := 3776k DEVICE_VENDOR := ASUS DEVICE_MODEL := RT-N10+ @@ -241,7 +237,6 @@ TARGET_DEVICES += asus_rt-n13u define Device/asus_wl-330n SOC := rt3050 - BLOCKSIZE := 4k IMAGE_SIZE := 3776k DEVICE_VENDOR := ASUS DEVICE_MODEL := WL-330N @@ -252,7 +247,6 @@ TARGET_DEVICES += asus_wl-330n define Device/asus_wl-330n3g SOC := rt3050 - BLOCKSIZE := 4k IMAGE_SIZE := 3776k DEVICE_VENDOR := ASUS DEVICE_MODEL := WL-330N3G @@ -305,7 +299,6 @@ TARGET_DEVICES += belkin_f7c027 define Device/buffalo_whr-g300n SOC := rt3052 - BLOCKSIZE := 64k IMAGE_SIZE := 3712k DEVICE_VENDOR := Buffalo DEVICE_MODEL := WHR-G300N @@ -371,7 +364,6 @@ TARGET_DEVICES += dlink_dir-300-b1 define Device/dlink_dir-300-b7 SOC := rt5350 - BLOCKSIZE := 4k IMAGE_SIZE := 7872k DEVICE_VENDOR := D-Link DEVICE_MODEL := DIR-300 @@ -407,7 +399,6 @@ TARGET_DEVICES += dlink_dir-600-b1 define Device/dlink_dir-610-a1 $(Device/seama) SOC := rt5350 - BLOCKSIZE := 4k SEAMA_SIGNATURE := wrgn59_dlob.hans_dir610 KERNEL := $(KERNEL_DTB) IMAGE_SIZE := 3776k @@ -436,7 +427,6 @@ TARGET_DEVICES += dlink_dir-615-d define Device/dlink_dir-615-h1 $(Device/uimage-lzma-loader) SOC := rt3352 - BLOCKSIZE := 4k IMAGES += factory.bin IMAGE_SIZE := 3776k IMAGE/factory.bin := $$(sysupgrade_bin) | senao-header -r 0x218 -p 0x30 -t 3 @@ -525,7 +515,6 @@ TARGET_DEVICES += edimax_3g-6200nl define Device/engenius_esr-9753 SOC := rt3052 - BLOCKSIZE := 64k IMAGE_SIZE := 3776k DEVICE_VENDOR := EnGenius DEVICE_MODEL := ESR-9753 @@ -549,7 +538,6 @@ TARGET_DEVICES += fon_fonera-20n define Device/hame_mpr-a1 SOC := rt5350 - BLOCKSIZE := 4k IMAGE_SIZE := 3776k UIMAGE_NAME:= Linux Kernel Image DEVICE_VENDOR := HAME @@ -609,7 +597,6 @@ TARGET_DEVICES += hootoo_ht-tm02 define Device/huawei_d105 SOC := rt3050 - BLOCKSIZE := 64k IMAGE_SIZE := 3776k DEVICE_VENDOR := Huawei DEVICE_MODEL := D105 @@ -810,7 +797,6 @@ TARGET_DEVICES += omnima_miniembwifi define Device/petatel_psr-680w SOC := rt3052 - BLOCKSIZE := 64k IMAGE_SIZE := 3776k DEVICE_VENDOR := Petatel DEVICE_MODEL := PSR-680W Wireless 3G Router @@ -821,7 +807,6 @@ TARGET_DEVICES += petatel_psr-680w define Device/planex_mzk-dp150n SOC := rt5350 - BLOCKSIZE := 64k IMAGE_SIZE := 3776k DEVICE_VENDOR := Planex DEVICE_MODEL := MZK-DP150N @@ -943,7 +928,6 @@ TARGET_DEVICES += prolink_pwh2004 define Device/ralink_v22rw-2x2 SOC := rt3052 - BLOCKSIZE := 64k IMAGE_SIZE := 3776k DEVICE_VENDOR := Ralink DEVICE_MODEL := AP-RT3052-V22RW-2X2 @@ -954,7 +938,6 @@ TARGET_DEVICES += ralink_v22rw-2x2 define Device/sitecom_wl-351 SOC := rt3052 - BLOCKSIZE := 64k IMAGE_SIZE := 3776k DEVICE_VENDOR := Sitecom DEVICE_MODEL := WL-351 v1 @@ -966,7 +949,6 @@ TARGET_DEVICES += sitecom_wl-351 define Device/skyline_sl-r7205 SOC := rt3052 - BLOCKSIZE := 64k IMAGE_SIZE := 3776k DEVICE_VENDOR := Skyline DEVICE_MODEL := SL-R7205 Wireless 3G Router @@ -977,7 +959,6 @@ TARGET_DEVICES += skyline_sl-r7205 define Device/sparklan_wcr-150gn SOC := rt3050 - BLOCKSIZE := 64k IMAGE_SIZE := 3776k DEVICE_VENDOR := Sparklan DEVICE_MODEL := WCR-150GN @@ -997,7 +978,6 @@ TARGET_DEVICES += teltonika_rut5xx define Device/tenda_3g150b SOC := rt5350 - BLOCKSIZE := 4k IMAGE_SIZE := 3776k UIMAGE_NAME:= Linux Kernel Image DEVICE_VENDOR := Tenda @@ -1045,7 +1025,6 @@ TARGET_DEVICES += tenda_w306r-v2 define Device/trendnet_tew-638apb-v2 SOC := rt3050 - BLOCKSIZE := 64k IMAGE_SIZE := 3776k IMAGE/sysupgrade.bin := $$(sysupgrade_bin) | umedia-header 0x026382 | \ check-size | append-metadata @@ -1103,7 +1082,6 @@ TARGET_DEVICES += unbranded_wr512-3gn-8m define Device/unbranded_xdx-rn502j SOC := rt3052 - BLOCKSIZE := 64k IMAGE_SIZE := 3776k DEVICE_VENDOR := Unbranded DEVICE_MODEL := XDX-RN502J @@ -1114,7 +1092,6 @@ TARGET_DEVICES += unbranded_xdx-rn502j define Device/upvel_ur-326n4g SOC := rt3052 - BLOCKSIZE := 64k IMAGE_SIZE := 3776k DEVICE_VENDOR := UPVEL DEVICE_MODEL := UR-326N4G @@ -1197,7 +1174,6 @@ TARGET_DEVICES += zte_mf283plus define Device/zyxel_keenetic SOC := rt3052 - BLOCKSIZE := 64k IMAGE_SIZE := 7872k DEVICE_VENDOR := ZyXEL DEVICE_MODEL := Keenetic @@ -1238,7 +1214,6 @@ TARGET_DEVICES += zyxel_keenetic-start define Device/zyxel_nbg-419n SOC := rt3052 - BLOCKSIZE := 64k IMAGE_SIZE := 3776k DEVICE_VENDOR := ZyXEL DEVICE_MODEL := NBG-419N diff --git a/target/linux/ramips/image/rt3883.mk b/target/linux/ramips/image/rt3883.mk index 3335dbc810..0d12aa0a40 100644 --- a/target/linux/ramips/image/rt3883.mk +++ b/target/linux/ramips/image/rt3883.mk @@ -7,7 +7,6 @@ endef define Device/asus_rt-n56u SOC := rt3662 - BLOCKSIZE := 64k IMAGE_SIZE := 7872k IMAGE/sysupgrade.bin += | mkrtn56uimg -s DEVICE_VENDOR := ASUS @@ -20,7 +19,6 @@ TARGET_DEVICES += asus_rt-n56u define Device/belkin_f9k1109v1 $(Device/uimage-lzma-loader) SOC := rt3883 - BLOCKSIZE := 64k DEVICE_VENDOR := Belkin DEVICE_MODEL := F9K1109 DEVICE_VARIANT := Version 1.0 @@ -34,7 +32,6 @@ TARGET_DEVICES += belkin_f9k1109v1 define Device/dlink_dir-645 $(Device/seama-lzma-loader) SOC := rt3662 - BLOCKSIZE := 4k IMAGE_SIZE := 7872k SEAMA_SIGNATURE := wrgn39_dlob.hans_dir645 DEVICE_VENDOR := D-Link @@ -46,7 +43,6 @@ TARGET_DEVICES += dlink_dir-645 define Device/edimax_br-6475nd SOC := rt3662 - BLOCKSIZE := 64k IMAGE_SIZE := 7744k IMAGE/sysupgrade.bin := append-kernel | append-rootfs | \ edimax-header -s CSYS -m RN54 -f 0x70000 -S 0x01100000 | pad-rootfs | \ @@ -60,7 +56,6 @@ TARGET_DEVICES += edimax_br-6475nd define Device/engenius_esr600h $(Device/uimage-lzma-loader) SOC := rt3662 - BLOCKSIZE := 4k IMAGE_SIZE := 7872k IMAGES += factory.dlf IMAGE/factory.dlf := $$(sysupgrade_bin) | check-size | \ @@ -73,7 +68,6 @@ TARGET_DEVICES += engenius_esr600h define Device/loewe_wmdr-143n SOC := rt3662 - BLOCKSIZE := 64k IMAGE_SIZE := 7872k DEVICE_VENDOR := Loewe DEVICE_MODEL := WMDR-143N @@ -83,7 +77,6 @@ TARGET_DEVICES += loewe_wmdr-143n define Device/omnima_hpm SOC := rt3662 - BLOCKSIZE := 64k IMAGE_SIZE := 16064k DEVICE_VENDOR := Omnima DEVICE_MODEL := HPM @@ -108,7 +101,6 @@ TARGET_DEVICES += samsung_cy-swr1100 define Device/sitecom_wlr-6000 $(Device/uimage-lzma-loader) SOC := rt3883 - BLOCKSIZE := 4k IMAGE_SIZE := 7244k IMAGES += factory.dlf IMAGE/factory.dlf := $$(sysupgrade_bin) | check-size | \ @@ -122,7 +114,6 @@ TARGET_DEVICES += sitecom_wlr-6000 define Device/trendnet_tew-691gr SOC := rt3883 - BLOCKSIZE := 64k IMAGE_SIZE := 7872k IMAGES += factory.bin IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | umedia-header 0x026910 @@ -134,7 +125,6 @@ TARGET_DEVICES += trendnet_tew-691gr define Device/trendnet_tew-692gr SOC := rt3883 - BLOCKSIZE := 64k IMAGE_SIZE := 7872k IMAGES += factory.bin IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | umedia-header 0x026920 From b09a83808a3a4f6ff2ff0cf1f12fdc4193357896 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Sat, 13 May 2023 21:01:00 +0800 Subject: [PATCH 13/33] ramips: add basic common recipe for nand flash devices These same codes are repeated for many devices now, it's better to move them to shared definition. This commit also add the missing KERNEL_SIZE of the ZyXEL NR7101 and ZyXEL LTE3301-PLUS. Signed-off-by: Shiji Yang --- target/linux/ramips/image/mt7621.mk | 254 +++++----------------------- 1 file changed, 47 insertions(+), 207 deletions(-) diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 56b4d173fb..2697f84bf7 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -148,6 +148,15 @@ define Device/dsa-migration DEVICE_COMPAT_MESSAGE := Config cannot be migrated from swconfig to DSA endef +define Device/nand + $(Device/dsa-migration) + BLOCKSIZE := 128k + KERNEL_SIZE := 4096k + PAGESIZE := 2048 + UBINIZE_OPTS := -E 5 + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef + define Device/adslr_g7 $(Device/dsa-migration) IMAGE_SIZE := 16064k @@ -181,17 +190,12 @@ endef TARGET_DEVICES += alfa-network_quad-e4g define Device/ampedwireless_ally_common - $(Device/dsa-migration) + $(Device/nand) DEVICE_VENDOR := Amped Wireless DEVICE_PACKAGES := kmod-mt7615-firmware IMAGE_SIZE := 32768k - KERNEL_SIZE := 4096k - BLOCKSIZE := 128k - PAGESIZE := 2048 - UBINIZE_OPTS := -E 5 KERNEL_INITRAMFS := $(KERNEL_DTB) | uImage lzma -n 'flashable-initramfs' |\ edimax-header -s CSYS -m RN68 -f 0x001c0000 -S 0x01100000 - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata endef define Device/ampedwireless_ally-r1900k @@ -295,16 +299,11 @@ endef TARGET_DEVICES += asus_rt-ac57u-v1 define Device/asus_rt-ac65p - $(Device/dsa-migration) + $(Device/nand) DEVICE_VENDOR := ASUS DEVICE_MODEL := RT-AC65P IMAGE_SIZE := 51200k - UBINIZE_OPTS := -E 5 - BLOCKSIZE := 128k - PAGESIZE := 2048 - KERNEL_SIZE := 4096k IMAGES += factory.bin - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \ check-size DEVICE_PACKAGES := kmod-usb3 kmod-mt7615-firmware @@ -312,16 +311,11 @@ endef TARGET_DEVICES += asus_rt-ac65p define Device/asus_rt-ac85p - $(Device/dsa-migration) + $(Device/nand) DEVICE_VENDOR := ASUS DEVICE_MODEL := RT-AC85P IMAGE_SIZE := 51200k - UBINIZE_OPTS := -E 5 - BLOCKSIZE := 128k - PAGESIZE := 2048 - KERNEL_SIZE := 4096k IMAGES += factory.bin - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \ check-size DEVICE_PACKAGES := kmod-usb3 kmod-mt7615-firmware @@ -341,18 +335,13 @@ endef TARGET_DEVICES += asus_rt-n56u-b1 define Device/asus_rt-ax53u - $(Device/dsa-migration) + $(Device/nand) DEVICE_VENDOR := ASUS DEVICE_MODEL := RT-AX53U DEVICE_ALT0_VENDOR := ASUS DEVICE_ALT0_MODEL := RT-AX1800U IMAGE_SIZE := 51200k - UBINIZE_OPTS := -E 5 - BLOCKSIZE := 128k - PAGESIZE := 2048 - KERNEL_SIZE := 4096k IMAGES += factory.bin - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \ check-size DEVICE_PACKAGES := kmod-mt7915-firmware kmod-usb3 kmod-usb-ledtrig-usbport @@ -360,7 +349,7 @@ endef TARGET_DEVICES += asus_rt-ax53u define Device/asus_rt-ax54 - $(Device/dsa-migration) + $(Device/nand) DEVICE_VENDOR := ASUS DEVICE_MODEL := RT-AX54 DEVICE_ALT0_VENDOR := ASUS @@ -370,12 +359,7 @@ define Device/asus_rt-ax54 DEVICE_ALT2_VENDOR := ASUS DEVICE_ALT2_MODEL := RT-AX1800S IMAGE_SIZE := 51200k - UBINIZE_OPTS := -E 5 - BLOCKSIZE := 128k - PAGESIZE := 2048 - KERNEL_SIZE := 4096k IMAGES += factory.bin - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \ check-size DEVICE_PACKAGES := kmod-mt7915-firmware @@ -383,22 +367,18 @@ endef TARGET_DEVICES += asus_rt-ax54 define Device/beeline_smartbox-flash - $(Device/dsa-migration) + $(Device/nand) $(Device/uimage-lzma-loader) DEVICE_VENDOR := Beeline DEVICE_MODEL := SmartBox Flash IMAGE_SIZE := 32768k KERNEL_SIZE := 4352k - UBINIZE_OPTS := -E 5 - BLOCKSIZE := 128k - PAGESIZE := 2048 KERNEL := kernel-bin | append-dtb | lzma | loader-kernel | \ uImage none | arcadyan-trx 0x746f435d | pad-to $$(KERNEL_SIZE) KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | loader-kernel | \ uImage none IMAGES += factory.trx IMAGE/factory.trx := append-kernel | append-ubi | check-size - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata DEVICE_PACKAGES := kmod-usb3 kmod-mt7615-firmware uencrypt-mbedtls endef TARGET_DEVICES += beeline_smartbox-flash @@ -429,21 +409,16 @@ endef TARGET_DEVICES += beeline_smartbox-turbo define Device/belkin_rt1800 - $(Device/dsa-migration) - BLOCKSIZE := 128k - PAGESIZE := 2048 - KERNEL_SIZE := 4096k + $(Device/nand) IMAGE_SIZE := 49152k DEVICE_VENDOR := Belkin DEVICE_MODEL := RT1800 DEVICE_PACKAGES := kmod-mt7915-firmware kmod-usb3 - UBINIZE_OPTS := -E 5 KERNEL_LOADADDR := 0x82000000 KERNEL := kernel-bin | relocate-kernel 0x80001000 | lzma | \ fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb | \ append-squashfs4-fakeroot IMAGES += factory.bin - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | \ append-ubi | check-size | belkin-header RT18 1 9.9.9 endef @@ -580,20 +555,16 @@ endef TARGET_DEVICES += dlink_dap-1620-b1 define Device/dlink_dap-x1860-a1 - $(Device/dsa-migration) + $(Device/nand) IMAGE_SIZE := 53248k DEVICE_VENDOR := D-Link DEVICE_MODEL := DAP-X1860 DEVICE_VARIANT := A1 - UBINIZE_OPTS := -E 5 - BLOCKSIZE := 128k - PAGESIZE := 2048 KERNEL_SIZE := 8192k KERNEL_LOADADDR := 0x82000000 KERNEL := kernel-bin | relocate-kernel 0x80001000 | lzma | \ fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb IMAGES += factory.bin - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \ check-size | elx-header 011b0060 8844A2D168B45A2D DEVICE_PACKAGES := kmod-mt7915-firmware rssileds -uboot-envtools @@ -623,18 +594,13 @@ define Device/dlink_dir-8xx-r1 endef define Device/dlink_dir-xx60-a1 - $(Device/dsa-migration) - BLOCKSIZE := 128k - PAGESIZE := 2048 - KERNEL_SIZE := 4096k + $(Device/nand) IMAGE_SIZE := 40960k - UBINIZE_OPTS := -E 5 DEVICE_VENDOR := D-Link DEVICE_PACKAGES := kmod-mt7615-firmware kmod-usb3 \ kmod-usb-ledtrig-usbport -uboot-envtools KERNEL := $$(KERNEL) | uimage-sgehdr IMAGES += factory.bin - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \ check-size endef @@ -1035,17 +1001,13 @@ endef TARGET_DEVICES += hanyang_hyc-g920 define Device/h3c_tx180x - $(Device/dsa-migration) - BLOCKSIZE := 128k - PAGESIZE := 2048 + $(Device/nand) KERNEL_SIZE := 8192k IMAGE_SIZE := 120832k - UBINIZE_OPTS := -E 5 KERNEL_LOADADDR := 0x82000000 KERNEL_INITRAMFS := kernel-bin | relocate-kernel 0x80001000 | lzma | \ fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb KERNEL := $$(KERNEL_INITRAMFS) | h3c-blank-header - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata DEVICE_VENDOR := H3C DEVICE_PACKAGES := kmod-mt7915-firmware endef @@ -1069,12 +1031,8 @@ endef TARGET_DEVICES += h3c_tx1806 define Device/haier-sim_wr1800k - $(Device/dsa-migration) - BLOCKSIZE := 128k - PAGESIZE := 2048 - KERNEL_SIZE := 4096k + $(Device/nand) IMAGE_SIZE := 125440k - UBINIZE_OPTS := -E 5 KERNEL_LOADADDR := 0x82000000 KERNEL := kernel-bin | relocate-kernel 0x80001000 | lzma | \ fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb @@ -1083,7 +1041,6 @@ ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) ARTIFACT/initramfs-factory.bin := append-image-stage initramfs-kernel.bin | \ haier-sim_wr1800k-factory endif - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata DEVICE_PACKAGES := kmod-mt7915-firmware endef @@ -1105,15 +1062,10 @@ endef TARGET_DEVICES += hilink_hlk-7621a-evb define Device/hiwifi_hc5962 - $(Device/dsa-migration) + $(Device/nand) $(Device/uimage-lzma-loader) - BLOCKSIZE := 128k - PAGESIZE := 2048 - KERNEL_SIZE := 4096k - UBINIZE_OPTS := -E 5 IMAGE_SIZE := 32768k IMAGES += factory.bin - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \ check-size DEVICE_VENDOR := HiWiFi @@ -1167,16 +1119,11 @@ endef TARGET_DEVICES += iodata_wn-ax1167gr define Device/iodata_nand - $(Device/dsa-migration) + $(Device/nand) DEVICE_VENDOR := I-O DATA - BLOCKSIZE := 128k - PAGESIZE := 2048 - UBINIZE_OPTS := -E 5 - KERNEL_SIZE := 4096k IMAGE_SIZE := 51200k LOADER_TYPE := bin KERNEL := kernel-bin | append-dtb | lzma | loader-kernel | lzma | uImage lzma - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata endef # The OEM webinterface expects an kernel with initramfs which has the uImage @@ -1277,16 +1224,11 @@ endef TARGET_DEVICES += iptime_a3004ns-dual define Device/iptime_a3004t - $(Device/dsa-migration) + $(Device/nand) $(Device/uimage-lzma-loader) - BLOCKSIZE := 128k - PAGESIZE := 2048 FILESYSTEMS := squashfs - KERNEL_SIZE := 4096k IMAGE_SIZE := 129280k UIMAGE_NAME := a3004t - UBINIZE_OPTS := -E 5 - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata DEVICE_VENDOR := ipTIME DEVICE_MODEL := A3004T DEVICE_PACKAGES := kmod-mt7615-firmware kmod-usb3 -uboot-envtools @@ -1326,17 +1268,12 @@ endef TARGET_DEVICES += iptime_a8004t define Device/iptime_ax2004m - $(Device/dsa-migration) - BLOCKSIZE := 128k - PAGESIZE := 2048 - KERNEL_SIZE := 4096k + $(Device/nand) IMAGE_SIZE := 121344k - UBINIZE_OPTS := -E 5 KERNEL_LOADADDR := 0x82000000 KERNEL := kernel-bin | relocate-kernel 0x80001000 | lzma | \ fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb IMAGES += recovery.bin - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata IMAGE/recovery.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \ check-size | iptime-crc32 ax2004m DEVICE_VENDOR := ipTIME @@ -1346,14 +1283,9 @@ endef TARGET_DEVICES += iptime_ax2004m define Device/iptime_t5004 - $(Device/dsa-migration) - BLOCKSIZE := 128k - PAGESIZE := 2048 - KERNEL_SIZE := 4096k + $(Device/nand) IMAGE_SIZE := 129280k - UBINIZE_OPTS := -E 5 UIMAGE_NAME := t5004 - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata DEVICE_VENDOR := ipTIME DEVICE_MODEL := T5004 DEVICE_PACKAGES := -wpad-basic-mbedtls -uboot-envtools @@ -1374,15 +1306,10 @@ endef TARGET_DEVICES += jcg_jhr-ac876m define Device/jcg_q20 - $(Device/dsa-migration) + $(Device/nand) $(Device/uimage-lzma-loader) - BLOCKSIZE := 128k - PAGESIZE := 2048 - UBINIZE_OPTS := -E 5 - KERNEL_SIZE := 4096k IMAGE_SIZE := 91136k IMAGES += factory.bin - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \ check-size DEVICE_VENDOR := JCG @@ -1431,18 +1358,13 @@ endef TARGET_DEVICES += lenovo_newifi-d1 define Device/linksys_e5600 - $(Device/dsa-migration) + $(Device/nand) $(Device/uimage-lzma-loader) - BLOCKSIZE := 128k - PAGESIZE := 2048 - KERNEL_SIZE := 4096k IMAGE_SIZE := 26624k DEVICE_VENDOR := Linksys DEVICE_MODEL := E5600 DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7663-firmware-ap - UBINIZE_OPTS := -E 5 IMAGES += factory.bin - IMAGE/sysupgrade.bin := sysupgrade-tar | check-size | append-metadata IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | \ append-ubi | check-size | gemtek-trailer endef @@ -1458,17 +1380,12 @@ endef TARGET_DEVICES += linksys_e7350 define Device/linksys_ea7xxx - $(Device/dsa-migration) + $(Device/nand) $(Device/uimage-lzma-loader) - BLOCKSIZE := 128k - PAGESIZE := 2048 - KERNEL_SIZE := 4096k IMAGE_SIZE := 36864k DEVICE_VENDOR := Linksys DEVICE_PACKAGES := kmod-usb3 kmod-mt7615-firmware - UBINIZE_OPTS := -E 5 IMAGES := sysupgrade.bin factory.bin - IMAGE/sysupgrade.bin := sysupgrade-tar | check-size | append-metadata IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | \ append-ubi | check-size | linksys-image type=$$$$(LINKSYS_HWNAME) endef @@ -1651,22 +1568,18 @@ endef TARGET_DEVICES += mtc_wr1201 define Device/mts_wg430223 - $(Device/dsa-migration) + $(Device/nand) $(Device/uimage-lzma-loader) DEVICE_VENDOR := MTS DEVICE_MODEL := WG430223 IMAGE_SIZE := 32768k KERNEL_SIZE := 4352k - UBINIZE_OPTS := -E 5 - BLOCKSIZE := 128k - PAGESIZE := 2048 KERNEL := kernel-bin | append-dtb | lzma | loader-kernel | \ uImage none | arcadyan-trx 0x53485231 | pad-to $$(KERNEL_SIZE) KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | loader-kernel | \ uImage none IMAGES += factory.trx IMAGE/factory.trx := append-kernel | append-ubi | check-size - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata DEVICE_PACKAGES := kmod-mt7615-firmware uencrypt-mbedtls endef TARGET_DEVICES += mts_wg430223 @@ -1685,17 +1598,12 @@ endef TARGET_DEVICES += netgear_ex6150 define Device/netgear_sercomm_nand - $(Device/dsa-migration) + $(Device/nand) $(Device/uimage-lzma-loader) - BLOCKSIZE := 128k - PAGESIZE := 2048 - KERNEL_SIZE := 4096k - UBINIZE_OPTS := -E 5 IMAGES += factory.img kernel.bin rootfs.bin IMAGE/factory.img := pad-extra 2048k | append-kernel | pad-to 6144k | \ append-ubi | pad-to $$$$(BLOCKSIZE) | sercom-footer | pad-to 128 | \ zip $$$$(SERCOMM_HWNAME).bin | sercom-seal - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata IMAGE/kernel.bin := append-kernel IMAGE/rootfs.bin := append-ubi | check-size DEVICE_VENDOR := NETGEAR @@ -1846,17 +1754,13 @@ endef TARGET_DEVICES += netgear_wac124 define Device/netgear_wax202 - $(Device/dsa-migration) + $(Device/nand) DEVICE_VENDOR := NETGEAR DEVICE_MODEL := WAX202 DEVICE_PACKAGES := kmod-mt7915-firmware -uboot-envtools NETGEAR_ENC_MODEL := WAX202 NETGEAR_ENC_REGION := US - BLOCKSIZE := 128k - PAGESIZE := 2048 - UBINIZE_OPTS := -E 5 IMAGE_SIZE := 38912k - KERNEL_SIZE := 4096k KERNEL_LOADADDR := 0x82000000 KERNEL := kernel-bin | relocate-kernel 0x80001000 | lzma | \ fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb | \ @@ -1864,7 +1768,6 @@ define Device/netgear_wax202 IMAGES += factory.img IMAGE/factory.img := append-kernel | pad-to $$(KERNEL_SIZE) | \ append-ubi | check-size | netgear-encrypted-factory - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata endef TARGET_DEVICES += netgear_wax202 @@ -1887,18 +1790,13 @@ endef TARGET_DEVICES += netgear_wndr3700-v5 define Device/netis_wf2881 - $(Device/dsa-migration) + $(Device/nand) $(Device/uimage-lzma-loader) - BLOCKSIZE := 128k - PAGESIZE := 2048 FILESYSTEMS := squashfs - KERNEL_SIZE := 4096k IMAGE_SIZE := 129280k - UBINIZE_OPTS := -E 5 UIMAGE_NAME := WF2881_0.0.00 KERNEL_INITRAMFS := $$(KERNEL) | netis-tail WF2881 IMAGES += factory.bin - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | \ check-size DEVICE_VENDOR := NETIS @@ -1942,14 +1840,9 @@ endef TARGET_DEVICES += planex_vr500 define Device/raisecom_msg1500-x-00 - $(Device/dsa-migration) + $(Device/nand) $(Device/uimage-lzma-loader) - BLOCKSIZE := 128k - PAGESIZE := 2048 - KERNEL_SIZE := 4096k IMAGE_SIZE := 129280k - UBINIZE_OPTS := -E 5 - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata DEVICE_VENDOR := RAISECOM DEVICE_MODEL := MSG1500 DEVICE_VARIANT := X.00 @@ -1996,13 +1889,8 @@ endef TARGET_DEVICES += samknows_whitebox-v8 define Device/sercomm_na502 - $(Device/uimage-lzma-loader) - BLOCKSIZE := 128k - PAGESIZE := 2048 + $(Device/nand) IMAGE_SIZE := 20480k - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata - UBINIZE_OPTS := -E 5 - KERNEL_SIZE := 4096k DEVICE_VENDOR := SERCOMM DEVICE_MODEL := NA502 DEVICE_PACKAGES := kmod-mt76x2 kmod-mt7603 kmod-usb3 -uboot-envtools @@ -2010,13 +1898,8 @@ endef TARGET_DEVICES += sercomm_na502 define Device/sercomm_na502s - $(Device/uimage-lzma-loader) - BLOCKSIZE := 128k - PAGESIZE := 2048 + $(Device/nand) IMAGE_SIZE := 20971520 - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata - UBINIZE_OPTS := -E 5 - KERNEL_SIZE := 4096k DEVICE_VENDOR := SERCOMM DEVICE_MODEL := NA502S DEVICE_PACKAGES := kmod-mt76x2 kmod-mt7603 kmod-usb3 kmod-usb-serial \ @@ -2232,12 +2115,8 @@ endef TARGET_DEVICES += tplink_eap615-wall-v1 define Device/tplink_ec330-g5u-v1 - $(Device/dsa-migration) + $(Device/nand) LOADER := bin - BLOCKSIZE := 128k - PAGESIZE := 2048 - UBINIZE_OPTS := -E 5 - KERNEL_SIZE := 4096k IMAGE_SIZE := 49152k DEVICE_VENDOR := TP-Link DEVICE_MODEL := EC330-G5u @@ -2254,24 +2133,19 @@ define Device/tplink_ec330-g5u-v1 IMAGES += factory.bin IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | \ append-ubi | check-size - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata | check-size endef TARGET_DEVICES += tplink_ec330-g5u-v1 define Device/tplink_er605-v2 - $(Device/dsa-migration) + $(Device/nand) DEVICE_VENDOR := TP-Link DEVICE_MODEL := ER605 DEVICE_VARIANT := v2 DEVICE_PACKAGES := -wpad-basic-mbedtls kmod-usb3 -uboot-envtools - BLOCKSIZE := 128k - PAGESIZE := 2048 - KERNEL_SIZE := 4096k KERNEL_IN_UBI := 1 KERNEL_LOADADDR := 0x82000000 KERNEL := kernel-bin | relocate-kernel 0x80001000 | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb IMAGES += sysupgrade.tar - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata IMAGE_SIZE := 127744k endef TARGET_DEVICES += tplink_er605-v2 @@ -2550,17 +2424,12 @@ endef TARGET_DEVICES += winstars_ws-wn583a6 define Device/xiaomi_nand_separate - $(Device/dsa-migration) + $(Device/nand) $(Device/uimage-lzma-loader) DEVICE_VENDOR := Xiaomi - BLOCKSIZE := 128k - PAGESIZE := 2048 - KERNEL_SIZE := 4096k - UBINIZE_OPTS := -E 5 IMAGES += kernel1.bin rootfs0.bin IMAGE/kernel1.bin := append-kernel IMAGE/rootfs0.bin := append-ubi | check-size - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata endef define Device/xiaomi_mi-router-3g @@ -2586,17 +2455,12 @@ endef TARGET_DEVICES += xiaomi_mi-router-3g-v2 define Device/xiaomi_mi-router-3-pro - $(Device/dsa-migration) + $(Device/nand) $(Device/uimage-lzma-loader) - BLOCKSIZE := 128k - PAGESIZE := 2048 - KERNEL_SIZE:= 4096k - UBINIZE_OPTS := -E 5 IMAGE_SIZE := 255488k DEVICE_VENDOR := Xiaomi DEVICE_MODEL := Mi Router 3 Pro IMAGES += factory.bin - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \ check-size DEVICE_PACKAGES := kmod-mt7615-firmware kmod-usb3 kmod-usb-ledtrig-usbport @@ -2644,16 +2508,11 @@ endef TARGET_DEVICES += xiaomi_mi-router-ac2100 define Device/xiaomi_mi-router-cr660x - $(Device/dsa-migration) + $(Device/nand) $(Device/uimage-lzma-loader) DEVICE_VENDOR := Xiaomi - BLOCKSIZE := 128k - PAGESIZE := 2048 - KERNEL_SIZE := 4096k - UBINIZE_OPTS := -E 5 IMAGE_SIZE := 128512k IMAGES += firmware.bin - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata IMAGE/firmware.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \ check-size DEVICE_PACKAGES += kmod-mt7915-firmware @@ -2879,12 +2738,10 @@ endef TARGET_DEVICES += zio_freezio define Device/zyxel_lte3301-plus - $(Device/dsa-migration) - BLOCKSIZE := 128k - PAGESIZE := 2048 - UBINIZE_OPTS := -E 5 + $(Device/nand) DEVICE_VENDOR := ZyXEL DEVICE_MODEL := LTE3301-PLUS + KERNEL_SIZE := 31488k DEVICE_PACKAGES := kmod-mt7615-firmware kmod-usb3 kmod-usb-ledtrig-usbport \ kmod-usb-net-qmi-wwan kmod-usb-serial-option uqmi KERNEL := $(KERNEL_DTB) | uImage lzma | \ @@ -2892,38 +2749,30 @@ define Device/zyxel_lte3301-plus KERNEL_INITRAMFS := $(KERNEL_DTB) | uImage lzma | \ zytrx-header $$(DEVICE_MODEL) 9.99(ABQU.1)$$(VERSION_DIST)-recovery KERNEL_INITRAMFS_SUFFIX := -recovery.bin - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata endef TARGET_DEVICES += zyxel_lte3301-plus define Device/zyxel_nr7101 - $(Device/dsa-migration) - BLOCKSIZE := 128k - PAGESIZE := 2048 - UBINIZE_OPTS := -E 5 + $(Device/nand) DEVICE_VENDOR := ZyXEL DEVICE_MODEL := NR7101 + KERNEL_SIZE := 31488k DEVICE_PACKAGES := kmod-mt7603 kmod-usb3 kmod-usb-net-qmi-wwan kmod-usb-serial-option uqmi KERNEL := $(KERNEL_DTB) | uImage lzma | zytrx-header $$(DEVICE_MODEL) $$(VERSION_DIST)-$$(REVISION) KERNEL_INITRAMFS := $(KERNEL_DTB) | uImage lzma | zytrx-header $$(DEVICE_MODEL) 9.99(ABUV.9)$$(VERSION_DIST)-recovery KERNEL_INITRAMFS_SUFFIX := -recovery.bin - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata endef TARGET_DEVICES += zyxel_nr7101 define Device/zyxel_nwa-ax - $(Device/dsa-migration) + $(Device/nand) DEVICE_VENDOR := ZyXEL - BLOCKSIZE := 128k - PAGESIZE := 2048 KERNEL_SIZE := 8192k - UBINIZE_OPTS := -E 5 DEVICE_PACKAGES := kmod-mt7915-firmware zyxel-bootconfig KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb IMAGES += factory.bin ramboot-factory.bin IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | zyxel-nwa-fit IMAGE/ramboot-factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata endef define Device/zyxel_nwa50ax @@ -2939,33 +2788,24 @@ endef TARGET_DEVICES += zyxel_nwa55axe define Device/zyxel_wap6805 - $(Device/dsa-migration) + $(Device/nand) $(Device/uimage-lzma-loader) - BLOCKSIZE := 128k - PAGESIZE := 2048 - KERNEL_SIZE := 4096k - UBINIZE_OPTS := -E 5 IMAGE_SIZE := 32448k DEVICE_VENDOR := ZyXEL DEVICE_MODEL := WAP6805 DEVICE_PACKAGES := kmod-mt7603 kmod-mt7621-qtn-rgmii -uboot-envtools KERNEL := $$(KERNEL/lzma-loader) | uImage none | uimage-padhdr 160 - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata endef TARGET_DEVICES += zyxel_wap6805 define Device/zyxel_wsm20 - $(Device/dsa-migration) - BLOCKSIZE := 128k - PAGESIZE := 2048 + $(Device/nand) KERNEL_SIZE := 8192k IMAGE_SIZE := 41943040 - UBINIZE_OPTS := -E 5 DEVICE_VENDOR := ZyXEL DEVICE_MODEL := WSM20 DEVICE_PACKAGES := kmod-mt7915-firmware KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb | znet-header V1.00(ABZF.0)C0 KERNEL_INITRAMFS := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb | znet-header V1.00(ABZF.0)C0 - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata endef TARGET_DEVICES += zyxel_wsm20 From 507480a92c0bc8c26f8f0edeaf35719ea8089c11 Mon Sep 17 00:00:00 2001 From: John Thomson Date: Sat, 24 Dec 2022 22:57:34 +1000 Subject: [PATCH 14/33] kernel: modules: split smbfs-common from cifs This kernel config symbol is a shared library used for both CIFS and the in-tree SMB_SERVER. Split it out into kmod-fs-smbfs-common from kmod-fs-cifs, and depend on it, so that later in-tree ksmbd may also depend on it. Signed-off-by: John Thomson --- package/kernel/linux/modules/fs.mk | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/package/kernel/linux/modules/fs.mk b/package/kernel/linux/modules/fs.mk index 77d8d6c98b..c3c56864b7 100644 --- a/package/kernel/linux/modules/fs.mk +++ b/package/kernel/linux/modules/fs.mk @@ -83,21 +83,36 @@ endef $(eval $(call KernelPackage,fs-btrfs)) +define KernelPackage/fs-smbfs-common + SUBMENU:=$(FS_MENU) + TITLE:=SMBFS common dependencies support + HIDDEN:=1 + KCONFIG:=CONFIG_SMBFS_COMMON + FILES:= \ + $(LINUX_DIR)/fs/smbfs_common/cifs_arc4.ko \ + $(LINUX_DIR)/fs/smbfs_common/cifs_md4.ko +endef + +define KernelPackage/fs-smbfs-common/description + Kernel module dependency for CIFS or SMB_SERVER support +endef + +$(eval $(call KernelPackage,fs-smbfs-common)) + + define KernelPackage/fs-cifs SUBMENU:=$(FS_MENU) TITLE:=CIFS support KCONFIG:= \ - CONFIG_SMBFS_COMMON \ CONFIG_CIFS \ CONFIG_CIFS_DFS_UPCALL=n \ CONFIG_CIFS_UPCALL=n FILES:= \ - $(LINUX_DIR)/fs/smbfs_common/cifs_arc4.ko \ - $(LINUX_DIR)/fs/smbfs_common/cifs_md4.ko \ $(LINUX_DIR)/fs/cifs/cifs.ko AUTOLOAD:=$(call AutoLoad,30,cifs) $(call AddDepends/nls) DEPENDS+= \ + +kmod-fs-smbfs-common \ +kmod-crypto-md5 \ +kmod-crypto-sha256 \ +kmod-crypto-sha512 \ From a666a2dffc993e96dcebee7ad2aec72c3e876db5 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Wed, 18 May 2022 20:11:38 -0700 Subject: [PATCH 15/33] linux/modules: add ksmbd support for 5.15 5.15 is the first version to come with ksmbd. Use it instead of the module as the linux one is better maintained. Signed-off-by: Rosen Penev --- package/kernel/linux/modules/fs.mk | 37 ++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/package/kernel/linux/modules/fs.mk b/package/kernel/linux/modules/fs.mk index c3c56864b7..1dddebfed7 100644 --- a/package/kernel/linux/modules/fs.mk +++ b/package/kernel/linux/modules/fs.mk @@ -345,6 +345,43 @@ endef $(eval $(call KernelPackage,fs-jfs)) + +define KernelPackage/fs-ksmbd + SUBMENU:=$(FS_MENU) + TITLE:=SMB kernel server support + DEPENDS:= \ + +kmod-nls-base \ + +kmod-nls-utf8 \ + +kmod-crypto-md4 \ + +kmod-crypto-md5 \ + +kmod-crypto-hmac \ + +kmod-crypto-ecb \ + +kmod-crypto-des \ + +kmod-crypto-sha256 \ + +kmod-crypto-cmac \ + +kmod-crypto-sha512 \ + +kmod-crypto-aead \ + +kmod-crypto-ccm \ + +kmod-crypto-gcm \ + +kmod-asn1-decoder \ + +kmod-oid-registry \ + +kmod-fs-smbfs-common + KCONFIG:= \ + CONFIG_SMB_SERVER \ + CONFIG_SMB_SERVER_SMBDIRECT=n \ + CONFIG_SMB_SERVER_CHECK_CAP_NET_ADMIN=n \ + CONFIG_SMB_SERVER_KERBEROS5=n + FILES:=$(LINUX_DIR)/fs/ksmbd/ksmbd.ko + AUTOLOAD:=$(call AutoLoad,41,ksmbd) +endef + +define KernelPackage/fs-ksmbd/description + Kernel module for SMB kernel server support +endef + +$(eval $(call KernelPackage,fs-ksmbd)) + + define KernelPackage/fs-minix SUBMENU:=$(FS_MENU) TITLE:=Minix filesystem support From 13fec6830684d7711018060651d37fd25df832d6 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Fri, 12 May 2023 08:43:31 -0700 Subject: [PATCH 16/33] ksmbd: remove In tree ksmbd is available with 5.15 and is better updated. Signed-off-by: Rosen Penev --- package/kernel/ksmbd/Makefile | 73 ------------------- .../ksmbd/patches/01-keep_kmod_metadata.patch | 11 --- 2 files changed, 84 deletions(-) delete mode 100644 package/kernel/ksmbd/Makefile delete mode 100644 package/kernel/ksmbd/patches/01-keep_kmod_metadata.patch diff --git a/package/kernel/ksmbd/Makefile b/package/kernel/ksmbd/Makefile deleted file mode 100644 index 674e816186..0000000000 --- a/package/kernel/ksmbd/Makefile +++ /dev/null @@ -1,73 +0,0 @@ -include $(TOPDIR)/rules.mk - -PKG_NAME:=ksmbd -PKG_VERSION:=3.4.8 -PKG_RELEASE:=1 - -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=https://github.com/cifsd-team/ksmbd/releases/download/$(PKG_VERSION) -PKG_HASH:=209bfba4dc5c50007942a3ec24f86a7f7c628618ac07f79c62e3404dc247d495 - -PKG_LICENSE:=GPL-2.0-or-later -PKG_LICENSE_FILES:=COPYING - -include $(INCLUDE_DIR)/kernel.mk -include $(INCLUDE_DIR)/package.mk - -TAR_OPTIONS+= --strip-components 1 -TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS) - -define KernelPackage/fs-ksmbd - SUBMENU:=Filesystems - TITLE:=SMB kernel server support - URL:=https://github.com/cifsd-team/cifsd - FILES:=$(PKG_BUILD_DIR)/ksmbd.ko - DEPENDS:= \ - +kmod-nls-base \ - +kmod-nls-utf8 \ - +kmod-crypto-md4 \ - +kmod-crypto-md5 \ - +kmod-crypto-hmac \ - +kmod-crypto-ecb \ - +kmod-crypto-des \ - +kmod-crypto-sha256 \ - +kmod-crypto-cmac \ - +kmod-crypto-sha512 \ - +kmod-crypto-aead \ - +kmod-crypto-ccm \ - +kmod-crypto-gcm \ - +kmod-asn1-decoder \ - +kmod-oid-registry -endef - -# The last two DEPENDS are hacks in order to get CONFIG_ASN1 and CONFIG_OID_REGISTRY -# which it seems can't be selected independently. Some bug in either base or upstream. - -define KernelPackage/fs-ksmbd/description - Ksmbd is an In-kernel SMBv(1)2/3 fileserver. - It's an implementation of the SMB protocol in kernel space for sharing files and IPC services over network. -endef - -define KernelPackage/fs-ksmbd/config -config KSMBD_SMB_INSECURE_SERVER - bool "Support for insecure SMB1/CIFS and SMB2.0 protocols" - depends on PACKAGE_kmod-fs-ksmbd - help - This enables deprecated insecure protocols dialects: SMB1/CIFS and SMB2.0. - default y -endef - -ifeq ($(CONFIG_KSMBD_SMB_INSECURE_SERVER),y) -PKG_EXTRA_KCONFIG:=CONFIG_SMB_INSECURE_SERVER=y -EXTRA_CFLAGS += -DCONFIG_SMB_INSECURE_SERVER=1 -endif - -define Build/Compile - $(KERNEL_MAKE) M="$(PKG_BUILD_DIR)" \ - EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \ - $(PKG_EXTRA_KCONFIG) \ - CONFIG_SMB_SERVER=m \ - modules -endef - -$(eval $(call KernelPackage,fs-ksmbd)) diff --git a/package/kernel/ksmbd/patches/01-keep_kmod_metadata.patch b/package/kernel/ksmbd/patches/01-keep_kmod_metadata.patch deleted file mode 100644 index b2c6687d06..0000000000 --- a/package/kernel/ksmbd/patches/01-keep_kmod_metadata.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/glob.h -+++ b/glob.h -@@ -7,6 +7,8 @@ - #ifndef __KSMBD_GLOB_H - #define __KSMBD_GLOB_H - -+#undef CONFIG_MODULE_STRIPPED -+ - #include - - #include "unicode.h" From 628a410ed149ca2bf17abd3159e44acc2920743e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= Date: Wed, 17 May 2023 16:58:19 +0200 Subject: [PATCH 17/33] util-linux: update to 2.39 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Release Notes: https://cdn.kernel.org/pub/linux/utils/util-linux/v2.39/v2.39-ReleaseNotes Remove upstreamed: 030-meson-don-t-use-run.patch 040-meson-fix-cpu_set_t-test.patch 050-meson-fix-environ-search.patch 060-meson-add-_GNU_SOURCE-for-sighandler_t.patch 070-meson-fix-isnan-check.patch 080-meson-fix-tzname-check.patch 090-meson-libpam.patch 100-meson-make-libcap-ng-dependent-on-setpriv.patch 120-meson-get-the-project-version-from-the-version-gen-s.patch 130-meson-fix-error-in-processing-version-for-pc-files.patch New: 0001-test_enosys-add-support-for-mips.patch Signed-off-by: Thomas Weißschuh [Refresh patches] Signed-off-by: Hauke Mehrtens --- package/utils/util-linux/Makefile | 8 ++--- ...001-test_enosys-add-support-for-mips.patch | 24 +++++++++++++ .../patches/030-meson-don-t-use-run.patch | 34 ------------------- .../040-meson-fix-cpu_set_t-test.patch | 23 ------------- .../050-meson-fix-environ-search.patch | 23 ------------- ...son-add-_GNU_SOURCE-for-sighandler_t.patch | 23 ------------- .../patches/070-meson-fix-isnan-check.patch | 24 ------------- .../patches/080-meson-fix-tzname-check.patch | 23 ------------- .../util-linux/patches/090-meson-libpam.patch | 18 ---------- ...-make-libcap-ng-dependent-on-setpriv.patch | 31 ----------------- ...oject-version-from-the-version-gen-s.patch | 20 ----------- ...r-in-processing-version-for-pc-files.patch | 26 -------------- .../util-linux/patches/200-meson-no-po.patch | 2 +- 13 files changed, 29 insertions(+), 250 deletions(-) create mode 100644 package/utils/util-linux/patches/0001-test_enosys-add-support-for-mips.patch delete mode 100644 package/utils/util-linux/patches/030-meson-don-t-use-run.patch delete mode 100644 package/utils/util-linux/patches/040-meson-fix-cpu_set_t-test.patch delete mode 100644 package/utils/util-linux/patches/050-meson-fix-environ-search.patch delete mode 100644 package/utils/util-linux/patches/060-meson-add-_GNU_SOURCE-for-sighandler_t.patch delete mode 100644 package/utils/util-linux/patches/070-meson-fix-isnan-check.patch delete mode 100644 package/utils/util-linux/patches/080-meson-fix-tzname-check.patch delete mode 100644 package/utils/util-linux/patches/090-meson-libpam.patch delete mode 100644 package/utils/util-linux/patches/100-meson-make-libcap-ng-dependent-on-setpriv.patch delete mode 100644 package/utils/util-linux/patches/120-meson-get-the-project-version-from-the-version-gen-s.patch delete mode 100644 package/utils/util-linux/patches/130-meson-fix-error-in-processing-version-for-pc-files.patch diff --git a/package/utils/util-linux/Makefile b/package/utils/util-linux/Makefile index 1ae6bb7b2d..e14d816a42 100644 --- a/package/utils/util-linux/Makefile +++ b/package/utils/util-linux/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=util-linux -PKG_VERSION:=2.38.1 -PKG_RELEASE:=2 +PKG_VERSION:=2.39 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_SOURCE_URL:=@KERNEL/linux/utils/$(PKG_NAME)/v2.38 -PKG_HASH:=60492a19b44e6cf9a3ddff68325b333b8b52b6c59ce3ebd6a0ecaa4c5117e84f +PKG_SOURCE_URL:=@KERNEL/linux/utils/$(PKG_NAME)/v2.39 +PKG_HASH:=32b30a336cda903182ed61feb3e9b908b762a5e66fe14e43efb88d37162075cb PKG_CPE_ID:=cpe:/a:kernel:util-linux PKG_LICENSE:=GPL-2.0-only diff --git a/package/utils/util-linux/patches/0001-test_enosys-add-support-for-mips.patch b/package/utils/util-linux/patches/0001-test_enosys-add-support-for-mips.patch new file mode 100644 index 0000000000..602ffe67e7 --- /dev/null +++ b/package/utils/util-linux/patches/0001-test_enosys-add-support-for-mips.patch @@ -0,0 +1,24 @@ +From 2558932c65524d953e4c86d7fda2282a582aa5ec Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= +Date: Wed, 17 May 2023 16:50:47 +0200 +Subject: [PATCH] test_enosys: add support for mips +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Thomas Weißschuh +--- + tests/helpers/test_enosys.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/tests/helpers/test_enosys.c ++++ b/tests/helpers/test_enosys.c +@@ -53,6 +53,8 @@ + # else + # define SECCOMP_ARCH_NATIVE AUDIT_ARCH_PPC64LE + # endif ++#elif __mips__ ++# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_MIPS + #else + # error Unknown target architecture + #endif diff --git a/package/utils/util-linux/patches/030-meson-don-t-use-run.patch b/package/utils/util-linux/patches/030-meson-don-t-use-run.patch deleted file mode 100644 index 7803dd7725..0000000000 --- a/package/utils/util-linux/patches/030-meson-don-t-use-run.patch +++ /dev/null @@ -1,34 +0,0 @@ -From e25db9169450d3d5fb43656a2eae5c08999310f4 Mon Sep 17 00:00:00 2001 -From: Rosen Penev -Date: Fri, 29 Apr 2022 16:56:54 -0700 -Subject: [PATCH 2/7] meson: don't use run - -Fixes cross compilation. run is not needed anyway. - -Signed-off-by: Rosen Penev ---- - meson.build | 6 ++---- - 1 file changed, 2 insertions(+), 4 deletions(-) - ---- a/meson.build -+++ b/meson.build -@@ -577,8 +577,7 @@ int main(void) { - return tzname ? 0 : 1; - } - '''.format(have ? 1 : 0) --result = cc.run(code, name : 'using tzname[]') --have = result.compiled() and result.returncode() == 0 -+have = cc.compiles(code, name : 'using tzname[]') - conf.set('HAVE_TZNAME', have ? 1 : false) - - socket_libs = [] -@@ -641,8 +640,7 @@ int main(void) { - return (*__progname != 0); - } - ''' --result = cc.run(code, name : 'using __progname') --have = result.compiled() and result.returncode() == 0 -+have = cc.compiles(code, name : 'using __progname') - conf.set('HAVE___PROGNAME', have ? 1 : false) - - build_plymouth_support = get_option('build-plymouth-support') diff --git a/package/utils/util-linux/patches/040-meson-fix-cpu_set_t-test.patch b/package/utils/util-linux/patches/040-meson-fix-cpu_set_t-test.patch deleted file mode 100644 index bdbfc4bfe0..0000000000 --- a/package/utils/util-linux/patches/040-meson-fix-cpu_set_t-test.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 4194bb5b35e9b5f3296bf17b7cabcc5cb1632ba3 Mon Sep 17 00:00:00 2001 -From: Rosen Penev -Date: Fri, 29 Apr 2022 16:55:15 -0700 -Subject: [PATCH 3/7] meson: fix cpu_set_t test - -_GNU_SOURCE is needed here. - -Signed-off-by: Rosen Penev ---- - meson.build | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/meson.build -+++ b/meson.build -@@ -379,7 +379,7 @@ endforeach - have = cc.has_header('sched.h') - conf.set10('HAVE_DECL_CPU_ALLOC', have) - # We get -1 if the size cannot be determined --have_cpu_set_t = cc.sizeof('cpu_set_t', prefix : '#include ') > 0 -+have_cpu_set_t = cc.sizeof('cpu_set_t', prefix : '#define _GNU_SOURCE\n#include ') > 0 - conf.set('HAVE_CPU_SET_T', have_cpu_set_t ? 1 : false) - - have = cc.has_header_symbol('stdlib.h', 'environ') diff --git a/package/utils/util-linux/patches/050-meson-fix-environ-search.patch b/package/utils/util-linux/patches/050-meson-fix-environ-search.patch deleted file mode 100644 index 2cd02e5b47..0000000000 --- a/package/utils/util-linux/patches/050-meson-fix-environ-search.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 1e9e2b9fe365cc4a0025d44dc0a9c54bfffe9058 Mon Sep 17 00:00:00 2001 -From: Rosen Penev -Date: Fri, 29 Apr 2022 18:16:17 -0700 -Subject: [PATCH 4/7] meson: fix environ search - -musl has it defined in unistd.h and hidden behind _GNU_SOURCE. - -Signed-off-by: Rosen Penev ---- - meson.build | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/meson.build -+++ b/meson.build -@@ -382,7 +382,7 @@ conf.set10('HAVE_DECL_CPU_ALLOC', have) - have_cpu_set_t = cc.sizeof('cpu_set_t', prefix : '#define _GNU_SOURCE\n#include ') > 0 - conf.set('HAVE_CPU_SET_T', have_cpu_set_t ? 1 : false) - --have = cc.has_header_symbol('stdlib.h', 'environ') -+have = cc.has_header_symbol('unistd.h', 'environ', prefix : '#define _GNU_SOURCE') - conf.set10('HAVE_ENVIRON_DECL', have) - - have = cc.has_header_symbol('signal.h', 'sighandler_t') diff --git a/package/utils/util-linux/patches/060-meson-add-_GNU_SOURCE-for-sighandler_t.patch b/package/utils/util-linux/patches/060-meson-add-_GNU_SOURCE-for-sighandler_t.patch deleted file mode 100644 index 7f9137f8bc..0000000000 --- a/package/utils/util-linux/patches/060-meson-add-_GNU_SOURCE-for-sighandler_t.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 5d7557eb3827664b2b78145373907f2a6994bdf9 Mon Sep 17 00:00:00 2001 -From: Rosen Penev -Date: Fri, 29 Apr 2022 18:17:52 -0700 -Subject: [PATCH 5/7] meson: add _GNU_SOURCE for sighandler_t - -musl requires it. - -Signed-off-by: Rosen Penev ---- - meson.build | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/meson.build -+++ b/meson.build -@@ -385,7 +385,7 @@ conf.set('HAVE_CPU_SET_T', have_cpu_set_ - have = cc.has_header_symbol('unistd.h', 'environ', prefix : '#define _GNU_SOURCE') - conf.set10('HAVE_ENVIRON_DECL', have) - --have = cc.has_header_symbol('signal.h', 'sighandler_t') -+have = cc.has_header_symbol('signal.h', 'sighandler_t', prefix : '#define _GNU_SOURCE') - conf.set('HAVE_SIGHANDLER_T', have ? 1 : false) - - have = cc.has_header_symbol('string.h', 'strsignal') diff --git a/package/utils/util-linux/patches/070-meson-fix-isnan-check.patch b/package/utils/util-linux/patches/070-meson-fix-isnan-check.patch deleted file mode 100644 index a0b104f801..0000000000 --- a/package/utils/util-linux/patches/070-meson-fix-isnan-check.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 777652585924034deeba98ae3192f26bc32bb661 Mon Sep 17 00:00:00 2001 -From: Rosen Penev -Date: Fri, 29 Apr 2022 18:19:53 -0700 -Subject: [PATCH 6/7] meson: fix isnan check - -musl only has isnan as a macro, not as a function. Handle the former -case. - -Signed-off-by: Rosen Penev ---- - meson.build | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/meson.build -+++ b/meson.build -@@ -622,7 +622,7 @@ rtas_libs = cc.find_library('rtas', requ - conf.set('HAVE_LIBRTAS', rtas_libs.found() ? 1 : false) - - math_libs = [] --if not cc.has_function('isnan') -+if not cc.has_header_symbol('math.h', 'isnan') - lib = cc.find_library('m', required : true) - if (cc.has_function('isnan', dependencies : lib) and - cc.has_function('__isnan', dependencies : lib)) diff --git a/package/utils/util-linux/patches/080-meson-fix-tzname-check.patch b/package/utils/util-linux/patches/080-meson-fix-tzname-check.patch deleted file mode 100644 index f5d53c4d36..0000000000 --- a/package/utils/util-linux/patches/080-meson-fix-tzname-check.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 9a6b2618b46a859388139d1eb18f876886786659 Mon Sep 17 00:00:00 2001 -From: Rosen Penev -Date: Fri, 29 Apr 2022 19:00:53 -0700 -Subject: [PATCH] meson: fix tzname check - -tzname is not a type but a variable. sizeof only works on types. - -Signed-off-by: Rosen Penev ---- - meson.build | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/meson.build -+++ b/meson.build -@@ -565,7 +565,7 @@ have = cc.has_member('struct tm', 'tm_zo - prefix : '#include ') - conf.set('HAVE_STRUCT_TM_TM_ZONE', have ? 1 : false) - --have = cc.sizeof('tzname', prefix : '#include ') > 0 -+have = cc.has_header_symbol('time.h', 'tzname') - conf.set('HAVE_DECL_TZNAME', have ? 1 : false) - - code = ''' diff --git a/package/utils/util-linux/patches/090-meson-libpam.patch b/package/utils/util-linux/patches/090-meson-libpam.patch deleted file mode 100644 index c9a91b9937..0000000000 --- a/package/utils/util-linux/patches/090-meson-libpam.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- a/meson.build -+++ b/meson.build -@@ -299,10 +299,14 @@ conf.set('HAVE_LIBUDEV', lib_udev.found( - - lib_crypt = cc.find_library('crypt') - --lib_pam = cc.find_library('pam') -+req_libpam = not (get_option('build-login').disabled() or get_option('build-chfn-chsh').disabled() -+ or get_option('build-su').disabled() or get_option('build-runuser').disabled()) -+lib_pam = cc.find_library('pam', required : req_libpam) - if lib_pam.found() - lib_pam_misc = cc.find_library('pam_misc') - lib_pam = [lib_pam, lib_pam_misc] -+else -+ lib_pam_misc = declare_dependency() - endif - - lib_cryptsetup = dependency( diff --git a/package/utils/util-linux/patches/100-meson-make-libcap-ng-dependent-on-setpriv.patch b/package/utils/util-linux/patches/100-meson-make-libcap-ng-dependent-on-setpriv.patch deleted file mode 100644 index d8b1199004..0000000000 --- a/package/utils/util-linux/patches/100-meson-make-libcap-ng-dependent-on-setpriv.patch +++ /dev/null @@ -1,31 +0,0 @@ -From cd23a4336f49ba6a12ade557a09589f2a7c966f4 Mon Sep 17 00:00:00 2001 -From: Rosen Penev -Date: Mon, 2 May 2022 16:18:33 -0700 -Subject: [PATCH] meson: make libcap-ng dependent on setpriv - -Signed-off-by: Rosen Penev ---- - meson.build | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - ---- a/meson.build -+++ b/meson.build -@@ -334,7 +334,8 @@ have = cc.has_function( - conf.set('HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY', have ? 1 : false) - - lib_cap_ng = dependency( -- 'libcap-ng') -+ 'libcap-ng', -+ required : get_option('build-setpriv')) - - lib_selinux = dependency( - 'libselinux', -@@ -1754,7 +1755,7 @@ if opt and not is_disabler(exe) - exes += exe - endif - --opt = not get_option('build-setpriv').disabled() -+opt = not get_option('build-setpriv').disabled() and lib_cap_ng.found() - exe = executable( - 'setpriv', - setpriv_sources, diff --git a/package/utils/util-linux/patches/120-meson-get-the-project-version-from-the-version-gen-s.patch b/package/utils/util-linux/patches/120-meson-get-the-project-version-from-the-version-gen-s.patch deleted file mode 100644 index 8529c8268e..0000000000 --- a/package/utils/util-linux/patches/120-meson-get-the-project-version-from-the-version-gen-s.patch +++ /dev/null @@ -1,20 +0,0 @@ -From e0c1a86bf88b568a7afe8ebaea1b9f84afb892c2 Mon Sep 17 00:00:00 2001 -From: Eli Schwartz -Date: Wed, 4 May 2022 23:52:31 -0400 -Subject: [PATCH] meson: get the project version from the version-gen script - -This matches autotools and ensures that the version number is actually -reliable. ---- - meson.build | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/meson.build -+++ b/meson.build -@@ -1,5 +1,5 @@ - project('util-linux', 'c', -- version : '2.37', -+ version : run_command('tools/git-version-gen', check: true).stdout(), - license : 'GPLv2+') - - pkgconfig = import('pkgconfig') diff --git a/package/utils/util-linux/patches/130-meson-fix-error-in-processing-version-for-pc-files.patch b/package/utils/util-linux/patches/130-meson-fix-error-in-processing-version-for-pc-files.patch deleted file mode 100644 index 75e88682e3..0000000000 --- a/package/utils/util-linux/patches/130-meson-fix-error-in-processing-version-for-pc-files.patch +++ /dev/null @@ -1,26 +0,0 @@ -From dc307e1cbf73f6dbf72bb049c19d332774cdb4e7 Mon Sep 17 00:00:00 2001 -From: Eli Schwartz -Date: Thu, 5 May 2022 00:16:15 -0400 -Subject: [PATCH] meson: fix error in processing version for pc files - -This awk command was copied verbatim from configure.ac, which included -non-awk syntax because configure.ac cannot contain [ literals. - -Rewrite these autoconf quadrigraphs as their actual values, for meson. - -Fixes always setting the micro version to "0". ---- - meson.build | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/meson.build -+++ b/meson.build -@@ -41,7 +41,7 @@ conf.set_quoted('PACKAGE_VERSION', meson - - codes = [''' {print $1} ''', - ''' {sub("-.*","",$2); print $2} ''', -- ''' {sub("-.*","",$3); print $3 ~ /^@<:@0-9@:>@+$/ ? $3 : 0} '''] -+ ''' {sub("-.*","",$3); print $3 ~ /^[0-9]+$/ ? $3 : 0} '''] - pc_version = [] - foreach code : codes - res = run_command('bash', '-c', diff --git a/package/utils/util-linux/patches/200-meson-no-po.patch b/package/utils/util-linux/patches/200-meson-no-po.patch index d626036bb2..4d94f6b89a 100644 --- a/package/utils/util-linux/patches/200-meson-no-po.patch +++ b/package/utils/util-linux/patches/200-meson-no-po.patch @@ -1,6 +1,6 @@ --- a/meson.build +++ b/meson.build -@@ -774,7 +774,6 @@ subdir('disk-utils') +@@ -874,7 +874,6 @@ subdir('disk-utils') subdir('misc-utils') subdir('text-utils') subdir('term-utils') From 43af3c94be51f086a6f8831a0b46bb3e250c75ac Mon Sep 17 00:00:00 2001 From: Tim Harvey Date: Fri, 17 Feb 2023 14:03:45 -0800 Subject: [PATCH 18/33] imx: image: ventana: use squashfs rootfs for non NAND devices In order to support squashfs+ext4 define rootfstype=squashfs and use P2 as P1 is boot filesystem. Signed-off-by: Tim Harvey --- target/linux/imx/image/bootscript-ventana | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/imx/image/bootscript-ventana b/target/linux/imx/image/bootscript-ventana index 734f74a30c..44a425d348 100644 --- a/target/linux/imx/image/bootscript-ventana +++ b/target/linux/imx/image/bootscript-ventana @@ -44,7 +44,7 @@ if itest.s "x${dtype}" == "xnand" ; then setenv root "ubi0:ubi ubi.mtd=2 rootfstype=squashfs,ubifs" else setenv fsload "${fs}load ${dtype} ${disk}:1" - part uuid ${dtype} ${disk}:1 uuid + part uuid ${dtype} ${disk}:2 uuid if test -z "${uuid}"; then # fallback to bootdev if test -n "$bootdev" ; then @@ -60,7 +60,7 @@ else else setenv root "root=PARTUUID=${uuid}" fi - setenv root "$root rootfstype=${fs} rootwait rw" + setenv root "$root rootfstype=squashfs rootwait" fi setenv bootargs "${bootargs}" "${root}" "${video}" "${extra}" From 1f5f17798a33ce9d8aca9f2f0c6192046e5c5807 Mon Sep 17 00:00:00 2001 From: Tim Harvey Date: Fri, 17 Feb 2023 14:03:46 -0800 Subject: [PATCH 19/33] imx: image: ventana: add blkdev compressed disk image Add a ventana-img.gz compressed disk image to support squashfs+ext4 on a block storage device such as USB/MMC/SATA. The Ventana bootloader expects the bootscript to be boot/6x_bootscript-ventana therefore we must create a bootfs that matches this. Signed-off-by: Tim Harvey --- target/linux/imx/image/cortexa9.mk | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/target/linux/imx/image/cortexa9.mk b/target/linux/imx/image/cortexa9.mk index 78079aa746..2edbbaac47 100644 --- a/target/linux/imx/image/cortexa9.mk +++ b/target/linux/imx/image/cortexa9.mk @@ -52,6 +52,29 @@ define Build/apalis-emmc $(Build/imx-combined-image-clean) endef +define Build/ventana-img + rm -rf $@.boot + mkdir -p $@.boot/boot + $(CP) $(IMAGE_KERNEL) $@.boot/boot/uImage + $(foreach dts,$(DEVICE_DTS), \ + $(CP) \ + $(DTS_DIR)/$(dts).dtb \ + $@.boot/boot/; + ) + mkimage -A arm -O linux -T script -C none -a 0 -e 0 \ + -n '$(DEVICE_ID) OpenWrt bootscript' \ + -d bootscript-$(DEVICE_NAME) \ + $@.boot/boot/6x_bootscript-ventana + cp $@ $@.fs + + $(SCRIPT_DIR)/gen_image_generic.sh $@ \ + $(CONFIG_TARGET_KERNEL_PARTSIZE) \ + $@.boot \ + $(CONFIG_TARGET_ROOTFS_PARTSIZE) \ + $@.fs \ + 1024 + $(Build/imx-combined-image-clean) +endef define Device/Default PROFILES := Default @@ -99,10 +122,11 @@ define Device/gateworks_ventana kmod-sound-soc-imx-sgtl5000 kmod-can kmod-can-flexcan kmod-can-raw \ kmod-hwmon-gsc kmod-leds-gpio kmod-pps-gpio kobs-ng KERNEL += | boot-overlay - IMAGES := nand.ubi bootfs.tar.gz dtb + IMAGES := img.gz nand.ubi bootfs.tar.gz dtb IMAGE/nand.ubi := append-ubi IMAGE/bootfs.tar.gz := bootfs.tar.gz IMAGE/dtb := install-dtb + IMAGE/img.gz := append-rootfs | pad-extra 128k | ventana-img | gzip UBINIZE_PARTS = boot=$$(KDIR_KERNEL_IMAGE).boot.ubifs=15 PAGESIZE := 2048 BLOCKSIZE := 128k From 1465691319bf9fb20869945c8f7bb5e43da1cf3c Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Thu, 18 May 2023 17:08:54 +0200 Subject: [PATCH 20/33] ipq806x: remove dangling ipq-wifi-edgecore_ecw5410 should have been part of the ipq-wifi update. Fixes: 8217f02a1c5e ("ipq-wifi: drop upstreamed board-2.bin") Signed-off-by: Christian Lamparter --- target/linux/ipq806x/image/generic.mk | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/linux/ipq806x/image/generic.mk b/target/linux/ipq806x/image/generic.mk index 8382c77bdc..b83999dd00 100644 --- a/target/linux/ipq806x/image/generic.mk +++ b/target/linux/ipq806x/image/generic.mk @@ -141,8 +141,7 @@ define Device/edgecore_ecw5410 BLOCKSIZE := 128k PAGESIZE := 2048 DEVICE_DTS_CONFIG := config@v2.0-ap160 - DEVICE_PACKAGES := ath10k-firmware-qca9984-ct \ - ipq-wifi-edgecore_ecw5410 + DEVICE_PACKAGES := ath10k-firmware-qca9984-ct endef TARGET_DEVICES += edgecore_ecw5410 From 23845fa10bc135bfc7fd4380948b5965b9d20cb5 Mon Sep 17 00:00:00 2001 From: Tim Harvey Date: Mon, 27 Feb 2023 16:56:25 -0800 Subject: [PATCH 21/33] gpio-button-hotplug: do not error on interrupt attached keys The Linux gpio-keys driver bindings allow for GPIO attached or interrupt attached keys. Currently if an interrupt attached key is encountered gpio_keys_button_probe() will fail due to not being able to get a gpio descriptor: gpio-keys: probe of gpio-keys failed with error -2 Skip the failure in the case of interrupt attached keys to resolve this. Signed-off-by: Tim Harvey --- .../kernel/gpio-button-hotplug/src/gpio-button-hotplug.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c index 2b39ec8f3b..522085bb2f 100644 --- a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c +++ b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c @@ -506,6 +506,13 @@ static int gpio_keys_button_probe(struct platform_device *pdev, goto out; } + if (button->irq) { + dev_err(dev, "skipping button %s (only gpio buttons supported)\n", + button->desc); + bdata->b = &pdata->buttons[i]; + continue; + } + if (gpio_is_valid(button->gpio)) { /* legacy platform data... but is it the lookup table? */ bdata->gpiod = devm_gpiod_get_index(dev, desc, i, From 1a5cb37dd3a09b4ce58c8c7708ad0aff87c86569 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Sat, 13 May 2023 12:16:21 +0800 Subject: [PATCH 22/33] uboot-rockchip: cleanup redudant variables Instead of adding these common variables again and again simply create a shared set for each SoC. Signed-off-by: Tianling Shen --- package/boot/uboot-rockchip/Makefile | 42 +++++++++++++--------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/package/boot/uboot-rockchip/Makefile b/package/boot/uboot-rockchip/Makefile index c6fc525d9b..f27a3e0638 100644 --- a/package/boot/uboot-rockchip/Makefile +++ b/package/boot/uboot-rockchip/Makefile @@ -24,58 +24,54 @@ endef # RK3328 boards -define U-Boot/nanopi-r2s-rk3328 +define U-Boot/rk3328/Default BUILD_SUBTARGET:=armv8 - NAME:=NanoPi R2S - BUILD_DEVICES:= \ - friendlyarm_nanopi-r2s - DEPENDS:=+PACKAGE_u-boot-nanopi-r2s-rk3328:arm-trusted-firmware-rockchip - PKG_BUILD_DEPENDS:=arm-trusted-firmware-rockchip + DEPENDS:=+PACKAGE_u-boot-$(1):arm-trusted-firmware-rockchip ATF:=rk3328_bl31.elf OF_PLATDATA:=$(1) endef +define U-Boot/nanopi-r2s-rk3328 + $(U-Boot/rk3328/Default) + NAME:=NanoPi R2S + BUILD_DEVICES:= \ + friendlyarm_nanopi-r2s +endef + define U-Boot/roc-cc-rk3328 - BUILD_SUBTARGET:=armv8 + $(U-Boot/rk3328/Default) NAME:=ROC-RK3328-CC BUILD_DEVICES:= \ firefly_roc-rk3328-cc - DEPENDS:=+PACKAGE_u-boot-roc-cc-rk3328:arm-trusted-firmware-rockchip - PKG_BUILD_DEPENDS:=arm-trusted-firmware-rockchip - ATF:=rk3328_bl31.elf - OF_PLATDATA:=$(1) endef # RK3399 boards -define U-Boot/nanopi-r4s-rk3399 +define U-Boot/rk3399/Default BUILD_SUBTARGET:=armv8 + DEPENDS:=+PACKAGE_u-boot-$(1):arm-trusted-firmware-rockchip + ATF:=rk3399_bl31.elf +endef + +define U-Boot/nanopi-r4s-rk3399 + $(U-Boot/rk3399/Default) NAME:=NanoPi R4S BUILD_DEVICES:= \ friendlyarm_nanopi-r4s - DEPENDS:=+PACKAGE_u-boot-nanopi-r4s-rk3399:arm-trusted-firmware-rockchip - PKG_BUILD_DEPENDS:=arm-trusted-firmware-rockchip - ATF:=rk3399_bl31.elf endef define U-Boot/rock-pi-4-rk3399 - BUILD_SUBTARGET:=armv8 + $(U-Boot/rk3399/Default) NAME:=Rock Pi 4 BUILD_DEVICES:= \ radxa_rock-pi-4a - DEPENDS:=+PACKAGE_u-boot-rock-pi-4-rk3399:arm-trusted-firmware-rockchip - PKG_BUILD_DEPENDS:=arm-trusted-firmware-rockchip - ATF:=rk3399_bl31.elf endef define U-Boot/rockpro64-rk3399 - BUILD_SUBTARGET:=armv8 + $(U-Boot/rk3399/Default) NAME:=RockPro64 BUILD_DEVICES:= \ pine64_rockpro64 - DEPENDS:=+PACKAGE_u-boot-rockpro64-rk3399:arm-trusted-firmware-rockchip - PKG_BUILD_DEPENDS:=arm-trusted-firmware-rockchip - ATF:=rk3399_bl31.elf endef UBOOT_TARGETS := \ From e35c7ab51fd161724924321f0590a9e26cb24aa7 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Sat, 13 May 2023 12:19:52 +0800 Subject: [PATCH 23/33] rockchip: merge bootscript The bootscript for nanopi r2s/r4s only changes the serial address, so make it auto detected in mmc bootscript rather than creating more (redudant) files. Signed-off-by: Tianling Shen --- target/linux/rockchip/image/armv8.mk | 6 +++--- target/linux/rockchip/image/mmc.bootscript | 10 +++++++++- target/linux/rockchip/image/nanopi-r2s.bootscript | 7 ------- target/linux/rockchip/image/nanopi-r4s.bootscript | 7 ------- 4 files changed, 12 insertions(+), 18 deletions(-) delete mode 100644 target/linux/rockchip/image/nanopi-r2s.bootscript delete mode 100644 target/linux/rockchip/image/nanopi-r4s.bootscript diff --git a/target/linux/rockchip/image/armv8.mk b/target/linux/rockchip/image/armv8.mk index 86e7cec979..f441f9b087 100644 --- a/target/linux/rockchip/image/armv8.mk +++ b/target/linux/rockchip/image/armv8.mk @@ -11,7 +11,7 @@ define Device/firefly_roc-rk3328-cc SOC := rk3328 DEVICE_DTS := rockchip/rk3328-roc-cc UBOOT_DEVICE_NAME := roc-cc-rk3328 - IMAGE/sysupgrade.img.gz := boot-common | boot-script nanopi-r2s | pine64-img | gzip | append-metadata + IMAGE/sysupgrade.img.gz := boot-common | boot-script | pine64-img | gzip | append-metadata endef TARGET_DEVICES += firefly_roc-rk3328-cc @@ -20,7 +20,7 @@ define Device/friendlyarm_nanopi-r2s DEVICE_MODEL := NanoPi R2S SOC := rk3328 UBOOT_DEVICE_NAME := nanopi-r2s-rk3328 - IMAGE/sysupgrade.img.gz := boot-common | boot-script nanopi-r2s | pine64-img | gzip | append-metadata + IMAGE/sysupgrade.img.gz := boot-common | boot-script | pine64-img | gzip | append-metadata DEVICE_PACKAGES := kmod-usb-net-rtl8152 endef TARGET_DEVICES += friendlyarm_nanopi-r2s @@ -31,7 +31,7 @@ define Device/friendlyarm_nanopi-r4s DEVICE_VARIANT := 4GB LPDDR4 SOC := rk3399 UBOOT_DEVICE_NAME := nanopi-r4s-rk3399 - IMAGE/sysupgrade.img.gz := boot-common | boot-script nanopi-r4s | pine64-img | gzip | append-metadata + IMAGE/sysupgrade.img.gz := boot-common | boot-script | pine64-img | gzip | append-metadata DEVICE_PACKAGES := kmod-r8169 endef TARGET_DEVICES += friendlyarm_nanopi-r4s diff --git a/target/linux/rockchip/image/mmc.bootscript b/target/linux/rockchip/image/mmc.bootscript index 9269fda9cf..60b59e1b6b 100644 --- a/target/linux/rockchip/image/mmc.bootscript +++ b/target/linux/rockchip/image/mmc.bootscript @@ -1,6 +1,14 @@ part uuid mmc ${devnum}:2 uuid -setenv bootargs "console=ttyS2,1500000 console=tty1 earlycon=uart8250,mmio32,0xff1a0000 root=PARTUUID=${uuid} rw rootwait" +if test $stdout = 'serial@fe660000' ; +then serial_addr=',0xfe660000'; +elif test $stdout = 'serial@ff130000' ; +then serial_addr=',0xff130000'; +elif test $stdout = 'serial@ff1a0000' ; +then serial_addr=',0xff1a0000'; +fi; + +setenv bootargs "console=ttyS2,1500000 console=tty1 earlycon=uart8250,mmio32${serial_addr} swiotlb=1 root=PARTUUID=${uuid} rw rootwait"; load mmc ${devnum}:1 ${kernel_addr_r} kernel.img diff --git a/target/linux/rockchip/image/nanopi-r2s.bootscript b/target/linux/rockchip/image/nanopi-r2s.bootscript deleted file mode 100644 index 8f961d3732..0000000000 --- a/target/linux/rockchip/image/nanopi-r2s.bootscript +++ /dev/null @@ -1,7 +0,0 @@ -part uuid mmc ${devnum}:2 uuid - -setenv bootargs "console=ttyS2,1500000 earlycon=uart8250,mmio32,0xff130000 root=PARTUUID=${uuid} rw rootwait" - -load mmc ${devnum}:1 ${kernel_addr_r} kernel.img - -bootm ${kernel_addr_r} diff --git a/target/linux/rockchip/image/nanopi-r4s.bootscript b/target/linux/rockchip/image/nanopi-r4s.bootscript deleted file mode 100644 index 1e53200027..0000000000 --- a/target/linux/rockchip/image/nanopi-r4s.bootscript +++ /dev/null @@ -1,7 +0,0 @@ -part uuid mmc ${devnum}:2 uuid - -setenv bootargs "console=ttyS2,1500000 earlycon=uart8250,mmio32,0xff1a0000 root=PARTUUID=${uuid} rw rootwait" - -load mmc ${devnum}:1 ${kernel_addr_r} kernel.img - -bootm ${kernel_addr_r} From afff2feb28baecaaf368002d819fb63973cf778a Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Sat, 13 May 2023 12:34:45 +0800 Subject: [PATCH 24/33] rockchip: move UBOOT_DEVICE_NAME to default Simplify variable usage. Signed-off-by: Tianling Shen --- target/linux/rockchip/image/Makefile | 1 + target/linux/rockchip/image/armv8.mk | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/target/linux/rockchip/image/Makefile b/target/linux/rockchip/image/Makefile index e232166e51..3b118201b6 100644 --- a/target/linux/rockchip/image/Makefile +++ b/target/linux/rockchip/image/Makefile @@ -50,6 +50,7 @@ define Device/Default KERNEL = kernel-bin | lzma | fit lzma $$(DTS_DIR)/$$(DEVICE_DTS).dtb IMAGES := sysupgrade.img.gz DEVICE_DTS = rockchip/$$(SOC)-$(lastword $(subst _, ,$(1))) + UBOOT_DEVICE_NAME = $(lastword $(subst _, ,$(1)))-$$(SOC) endef include $(SUBTARGET).mk diff --git a/target/linux/rockchip/image/armv8.mk b/target/linux/rockchip/image/armv8.mk index f441f9b087..72e5832f06 100644 --- a/target/linux/rockchip/image/armv8.mk +++ b/target/linux/rockchip/image/armv8.mk @@ -19,7 +19,6 @@ define Device/friendlyarm_nanopi-r2s DEVICE_VENDOR := FriendlyARM DEVICE_MODEL := NanoPi R2S SOC := rk3328 - UBOOT_DEVICE_NAME := nanopi-r2s-rk3328 IMAGE/sysupgrade.img.gz := boot-common | boot-script | pine64-img | gzip | append-metadata DEVICE_PACKAGES := kmod-usb-net-rtl8152 endef @@ -30,7 +29,6 @@ define Device/friendlyarm_nanopi-r4s DEVICE_MODEL := NanoPi R4S DEVICE_VARIANT := 4GB LPDDR4 SOC := rk3399 - UBOOT_DEVICE_NAME := nanopi-r4s-rk3399 IMAGE/sysupgrade.img.gz := boot-common | boot-script | pine64-img | gzip | append-metadata DEVICE_PACKAGES := kmod-r8169 endef @@ -40,7 +38,6 @@ define Device/pine64_rockpro64 DEVICE_VENDOR := Pine64 DEVICE_MODEL := RockPro64 SOC := rk3399 - UBOOT_DEVICE_NAME := rockpro64-rk3399 IMAGE/sysupgrade.img.gz := boot-common | boot-script | pine64-img | gzip | append-metadata endef TARGET_DEVICES += pine64_rockpro64 From 64afcbad3d69147b07dff2462e5645f2c193dee5 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Sat, 13 May 2023 13:54:38 +0800 Subject: [PATCH 25/33] kernel: backport Motorcomm YT8521/YT8531 support It will be used on NanoPi R2C and OrangePi R1 Plus LTS board. Signed-off-by: Tianling Shen --- ...2c-Add-driver-for-Sony-IMX477-sensor.patch | 2 +- ...vicetree-Add-documentation-for-imx37.patch | 2 +- ...a-i2c-Add-IMX519-CMOS-sensor-binding.patch | 2 +- ....0-net-mii-add-mii_bmcr_encode_fixed.patch | 55 + ...or-Motorcomm-yt8521-gigabit-ethernet.patch | 1724 +++++++++++++++++ ...fix-yt8521-duplicated-argument-to-or.patch | 49 + ...net-phy-add-Motorcomm-YT8531S-phy-id.patch | 140 ++ ...fix-the-spelling-problem-of-Sentinel.patch | 26 + ...nge-the-phy-id-of-yt8521-and-yt8531s.patch | 29 + ...-for-Motorcomm-yt8521-yt8531-gigabit.patch | 107 + ...support-for-Motorcomm-yt8521-gigabit.patch | 343 ++++ ...upport-for-Motorcomm-yt8531s-gigabit.patch | 100 + ...or-Motorcomm-yt8531-gigabit-ethernet.patch | 302 +++ ...motorcomm-uninitialized-variables-in.patch | 34 + ...d-driver-for-OCOTP-in-Sunplus-SP7021.patch | 2 +- ...hdog-add-realtek-otto-watchdog-timer.patch | 2 +- target/linux/rockchip/armv8/config-5.15 | 1 + 17 files changed, 2915 insertions(+), 5 deletions(-) create mode 100644 target/linux/generic/backport-5.15/790-v6.0-net-mii-add-mii_bmcr_encode_fixed.patch create mode 100644 target/linux/generic/backport-5.15/791-v6.2-01-net-phy-Add-driver-for-Motorcomm-yt8521-gigabit-ethernet.patch create mode 100644 target/linux/generic/backport-5.15/791-v6.2-02-net-phy-fix-yt8521-duplicated-argument-to-or.patch create mode 100644 target/linux/generic/backport-5.15/791-v6.2-03-net-phy-add-Motorcomm-YT8531S-phy-id.patch create mode 100644 target/linux/generic/backport-5.15/791-v6.3-04-net-phy-fix-the-spelling-problem-of-Sentinel.patch create mode 100644 target/linux/generic/backport-5.15/791-v6.3-05-net-phy-motorcomm-change-the-phy-id-of-yt8521-and-yt8531s.patch create mode 100644 target/linux/generic/backport-5.15/791-v6.3-06-net-phy-Add-BIT-macro-for-Motorcomm-yt8521-yt8531-gigabit.patch create mode 100644 target/linux/generic/backport-5.15/791-v6.3-07-net-phy-Add-dts-support-for-Motorcomm-yt8521-gigabit.patch create mode 100644 target/linux/generic/backport-5.15/791-v6.3-08-net-phy-Add-dts-support-for-Motorcomm-yt8531s-gigabit.patch create mode 100644 target/linux/generic/backport-5.15/791-v6.3-09-net-phy-Add-driver-for-Motorcomm-yt8531-gigabit-ethernet.patch create mode 100644 target/linux/generic/backport-5.15/791-v6.3-10-net-phy-motorcomm-uninitialized-variables-in.patch diff --git a/target/linux/bcm27xx/patches-5.15/950-0281-media-i2c-Add-driver-for-Sony-IMX477-sensor.patch b/target/linux/bcm27xx/patches-5.15/950-0281-media-i2c-Add-driver-for-Sony-IMX477-sensor.patch index bbf071cb01..e756fa2fff 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0281-media-i2c-Add-driver-for-Sony-IMX477-sensor.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0281-media-i2c-Add-driver-for-Sony-IMX477-sensor.patch @@ -25,7 +25,7 @@ Signed-off-by: Naushir Patuck --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -17537,6 +17537,14 @@ T: git git://linuxtv.org/media_tree.git +@@ -17538,6 +17538,14 @@ T: git git://linuxtv.org/media_tree.git F: Documentation/devicetree/bindings/media/i2c/sony,imx412.yaml F: drivers/media/i2c/imx412.c diff --git a/target/linux/bcm27xx/patches-5.15/950-0413-Documentation-devicetree-Add-documentation-for-imx37.patch b/target/linux/bcm27xx/patches-5.15/950-0413-Documentation-devicetree-Add-documentation-for-imx37.patch index f006899069..27fd0e5793 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0413-Documentation-devicetree-Add-documentation-for-imx37.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0413-Documentation-devicetree-Add-documentation-for-imx37.patch @@ -132,7 +132,7 @@ Signed-off-by: David Plowman +... --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -17551,6 +17551,7 @@ M: Raspberry Pi Kernel Maintenance +... --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -17555,6 +17555,14 @@ F: Documentation/devicetree/bindings/med +@@ -17556,6 +17556,14 @@ F: Documentation/devicetree/bindings/med F: Documentation/devicetree/bindings/media/i2c/imx477.yaml F: drivers/media/i2c/imx477.c diff --git a/target/linux/generic/backport-5.15/790-v6.0-net-mii-add-mii_bmcr_encode_fixed.patch b/target/linux/generic/backport-5.15/790-v6.0-net-mii-add-mii_bmcr_encode_fixed.patch new file mode 100644 index 0000000000..87d7ff6154 --- /dev/null +++ b/target/linux/generic/backport-5.15/790-v6.0-net-mii-add-mii_bmcr_encode_fixed.patch @@ -0,0 +1,55 @@ +From bdb6cfe7512f7a214815a3092f0be50963dcacbc Mon Sep 17 00:00:00 2001 +From: "Russell King (Oracle)" +Date: Sat, 18 Jun 2022 11:28:32 +0100 +Subject: [PATCH] net: mii: add mii_bmcr_encode_fixed() + +Add a function to encode a fixed speed/duplex to a BMCR value. + +Signed-off-by: Russell King (Oracle) +Signed-off-by: David S. Miller +--- + include/linux/mii.h | 35 +++++++++++++++++++++++++++++++++++ + 1 file changed, 35 insertions(+) + +--- a/include/linux/mii.h ++++ b/include/linux/mii.h +@@ -595,4 +595,39 @@ static inline u8 mii_resolve_flowctrl_fd + return cap; + } + ++/** ++ * mii_bmcr_encode_fixed - encode fixed speed/duplex settings to a BMCR value ++ * @speed: a SPEED_* value ++ * @duplex: a DUPLEX_* value ++ * ++ * Encode the speed and duplex to a BMCR value. 2500, 1000, 100 and 10 Mbps are ++ * supported. 2500Mbps is encoded to 1000Mbps. Other speeds are encoded as 10 ++ * Mbps. Unknown duplex values are encoded to half-duplex. ++ */ ++static inline u16 mii_bmcr_encode_fixed(int speed, int duplex) ++{ ++ u16 bmcr; ++ ++ switch (speed) { ++ case SPEED_2500: ++ case SPEED_1000: ++ bmcr = BMCR_SPEED1000; ++ break; ++ ++ case SPEED_100: ++ bmcr = BMCR_SPEED100; ++ break; ++ ++ case SPEED_10: ++ default: ++ bmcr = BMCR_SPEED10; ++ break; ++ } ++ ++ if (duplex == DUPLEX_FULL) ++ bmcr |= BMCR_FULLDPLX; ++ ++ return bmcr; ++} ++ + #endif /* __LINUX_MII_H__ */ diff --git a/target/linux/generic/backport-5.15/791-v6.2-01-net-phy-Add-driver-for-Motorcomm-yt8521-gigabit-ethernet.patch b/target/linux/generic/backport-5.15/791-v6.2-01-net-phy-Add-driver-for-Motorcomm-yt8521-gigabit-ethernet.patch new file mode 100644 index 0000000000..57137c34fc --- /dev/null +++ b/target/linux/generic/backport-5.15/791-v6.2-01-net-phy-Add-driver-for-Motorcomm-yt8521-gigabit-ethernet.patch @@ -0,0 +1,1724 @@ +From 70479a40954cf353e87a486997a3477108c75aa9 Mon Sep 17 00:00:00 2001 +From: Frank +Date: Fri, 28 Oct 2022 17:26:21 +0800 +Subject: [PATCH] net: phy: Add driver for Motorcomm yt8521 gigabit ethernet + phy + +Add a driver for the motorcomm yt8521 gigabit ethernet phy. We have verified + the driver on StarFive VisionFive development board, which is developed by + Shanghai StarFive Technology Co., Ltd.. On the board, yt8521 gigabit ethernet + phy works in utp mode, RGMII interface, supports 1000M/100M/10M speeds, and + wol(magic package). + +Signed-off-by: Frank +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + MAINTAINERS | 1 + + drivers/net/phy/Kconfig | 2 +- + drivers/net/phy/motorcomm.c | 1635 ++++++++++++++++++++++++++++++++++- + 3 files changed, 1635 insertions(+), 3 deletions(-) + +--- a/MAINTAINERS ++++ b/MAINTAINERS +@@ -12697,6 +12697,7 @@ F: include/uapi/linux/meye.h + + MOTORCOMM PHY DRIVER + M: Peter Geis ++M: Frank + L: netdev@vger.kernel.org + S: Maintained + F: drivers/net/phy/motorcomm.c +--- a/drivers/net/phy/Kconfig ++++ b/drivers/net/phy/Kconfig +@@ -245,7 +245,7 @@ config MOTORCOMM_PHY + tristate "Motorcomm PHYs" + help + Enables support for Motorcomm network PHYs. +- Currently supports the YT8511 gigabit PHY. ++ Currently supports the YT8511, YT8521 Gigabit Ethernet PHYs. + + config NATIONAL_PHY + tristate "National Semiconductor PHYs" +--- a/drivers/net/phy/motorcomm.c ++++ b/drivers/net/phy/motorcomm.c +@@ -1,15 +1,106 @@ + // SPDX-License-Identifier: GPL-2.0+ + /* +- * Driver for Motorcomm PHYs ++ * Motorcomm 8511/8521 PHY driver. + * + * Author: Peter Geis ++ * Author: Frank + */ + ++#include + #include + #include + #include + + #define PHY_ID_YT8511 0x0000010a ++#define PHY_ID_YT8521 0x0000011A ++ ++/* YT8521 Register Overview ++ * UTP Register space | FIBER Register space ++ * ------------------------------------------------------------ ++ * | UTP MII | FIBER MII | ++ * | UTP MMD | | ++ * | UTP Extended | FIBER Extended | ++ * ------------------------------------------------------------ ++ * | Common Extended | ++ * ------------------------------------------------------------ ++ */ ++ ++/* 0x10 ~ 0x15 , 0x1E and 0x1F are common MII registers of yt phy */ ++ ++/* Specific Function Control Register */ ++#define YTPHY_SPECIFIC_FUNCTION_CONTROL_REG 0x10 ++ ++/* 2b00 Manual MDI configuration ++ * 2b01 Manual MDIX configuration ++ * 2b10 Reserved ++ * 2b11 Enable automatic crossover for all modes *default* ++ */ ++#define YTPHY_SFCR_MDI_CROSSOVER_MODE_MASK (BIT(6) | BIT(5)) ++#define YTPHY_SFCR_CROSSOVER_EN BIT(3) ++#define YTPHY_SFCR_SQE_TEST_EN BIT(2) ++#define YTPHY_SFCR_POLARITY_REVERSAL_EN BIT(1) ++#define YTPHY_SFCR_JABBER_DIS BIT(0) ++ ++/* Specific Status Register */ ++#define YTPHY_SPECIFIC_STATUS_REG 0x11 ++#define YTPHY_SSR_SPEED_MODE_OFFSET 14 ++ ++#define YTPHY_SSR_SPEED_MODE_MASK (BIT(15) | BIT(14)) ++#define YTPHY_SSR_SPEED_10M 0x0 ++#define YTPHY_SSR_SPEED_100M 0x1 ++#define YTPHY_SSR_SPEED_1000M 0x2 ++#define YTPHY_SSR_DUPLEX_OFFSET 13 ++#define YTPHY_SSR_DUPLEX BIT(13) ++#define YTPHY_SSR_PAGE_RECEIVED BIT(12) ++#define YTPHY_SSR_SPEED_DUPLEX_RESOLVED BIT(11) ++#define YTPHY_SSR_LINK BIT(10) ++#define YTPHY_SSR_MDIX_CROSSOVER BIT(6) ++#define YTPHY_SSR_DOWNGRADE BIT(5) ++#define YTPHY_SSR_TRANSMIT_PAUSE BIT(3) ++#define YTPHY_SSR_RECEIVE_PAUSE BIT(2) ++#define YTPHY_SSR_POLARITY BIT(1) ++#define YTPHY_SSR_JABBER BIT(0) ++ ++/* Interrupt enable Register */ ++#define YTPHY_INTERRUPT_ENABLE_REG 0x12 ++#define YTPHY_IER_WOL BIT(6) ++ ++/* Interrupt Status Register */ ++#define YTPHY_INTERRUPT_STATUS_REG 0x13 ++#define YTPHY_ISR_AUTONEG_ERR BIT(15) ++#define YTPHY_ISR_SPEED_CHANGED BIT(14) ++#define YTPHY_ISR_DUPLEX_CHANGED BIT(13) ++#define YTPHY_ISR_PAGE_RECEIVED BIT(12) ++#define YTPHY_ISR_LINK_FAILED BIT(11) ++#define YTPHY_ISR_LINK_SUCCESSED BIT(10) ++#define YTPHY_ISR_WOL BIT(6) ++#define YTPHY_ISR_WIRESPEED_DOWNGRADE BIT(5) ++#define YTPHY_ISR_SERDES_LINK_FAILED BIT(3) ++#define YTPHY_ISR_SERDES_LINK_SUCCESSED BIT(2) ++#define YTPHY_ISR_POLARITY_CHANGED BIT(1) ++#define YTPHY_ISR_JABBER_HAPPENED BIT(0) ++ ++/* Speed Auto Downgrade Control Register */ ++#define YTPHY_SPEED_AUTO_DOWNGRADE_CONTROL_REG 0x14 ++#define YTPHY_SADCR_SPEED_DOWNGRADE_EN BIT(5) ++ ++/* If these bits are set to 3, the PHY attempts five times ( 3(set value) + ++ * additional 2) before downgrading, default 0x3 ++ */ ++#define YTPHY_SADCR_SPEED_RETRY_LIMIT (0x3 << 2) ++ ++/* Rx Error Counter Register */ ++#define YTPHY_RX_ERROR_COUNTER_REG 0x15 ++ ++/* Extended Register's Address Offset Register */ ++#define YTPHY_PAGE_SELECT 0x1E ++ ++/* Extended Register's Data Register */ ++#define YTPHY_PAGE_DATA 0x1F ++ ++/* FIBER Auto-Negotiation link partner ability */ ++#define YTPHY_FLPA_PAUSE (0x3 << 7) ++#define YTPHY_FLPA_ASYM_PAUSE (0x2 << 7) + + #define YT8511_PAGE_SELECT 0x1e + #define YT8511_PAGE 0x1f +@@ -38,6 +129,352 @@ + #define YT8511_DELAY_FE_TX_EN (0xf << 12) + #define YT8511_DELAY_FE_TX_DIS (0x2 << 12) + ++/* Extended register is different from MMD Register and MII Register. ++ * We can use ytphy_read_ext/ytphy_write_ext/ytphy_modify_ext function to ++ * operate extended register. ++ * Extended Register start ++ */ ++ ++/* Phy gmii clock gating Register */ ++#define YT8521_CLOCK_GATING_REG 0xC ++#define YT8521_CGR_RX_CLK_EN BIT(12) ++ ++#define YT8521_EXTREG_SLEEP_CONTROL1_REG 0x27 ++#define YT8521_ESC1R_SLEEP_SW BIT(15) ++#define YT8521_ESC1R_PLLON_SLP BIT(14) ++ ++/* Phy fiber Link timer cfg2 Register */ ++#define YT8521_LINK_TIMER_CFG2_REG 0xA5 ++#define YT8521_LTCR_EN_AUTOSEN BIT(15) ++ ++/* 0xA000, 0xA001, 0xA003 ,and 0xA006 ~ 0xA00A are common ext registers ++ * of yt8521 phy. There is no need to switch reg space when operating these ++ * registers. ++ */ ++ ++#define YT8521_REG_SPACE_SELECT_REG 0xA000 ++#define YT8521_RSSR_SPACE_MASK BIT(1) ++#define YT8521_RSSR_FIBER_SPACE (0x1 << 1) ++#define YT8521_RSSR_UTP_SPACE (0x0 << 1) ++#define YT8521_RSSR_TO_BE_ARBITRATED (0xFF) ++ ++#define YT8521_CHIP_CONFIG_REG 0xA001 ++#define YT8521_CCR_SW_RST BIT(15) ++ ++#define YT8521_CCR_MODE_SEL_MASK (BIT(2) | BIT(1) | BIT(0)) ++#define YT8521_CCR_MODE_UTP_TO_RGMII 0 ++#define YT8521_CCR_MODE_FIBER_TO_RGMII 1 ++#define YT8521_CCR_MODE_UTP_FIBER_TO_RGMII 2 ++#define YT8521_CCR_MODE_UTP_TO_SGMII 3 ++#define YT8521_CCR_MODE_SGPHY_TO_RGMAC 4 ++#define YT8521_CCR_MODE_SGMAC_TO_RGPHY 5 ++#define YT8521_CCR_MODE_UTP_TO_FIBER_AUTO 6 ++#define YT8521_CCR_MODE_UTP_TO_FIBER_FORCE 7 ++ ++/* 3 phy polling modes,poll mode combines utp and fiber mode*/ ++#define YT8521_MODE_FIBER 0x1 ++#define YT8521_MODE_UTP 0x2 ++#define YT8521_MODE_POLL 0x3 ++ ++#define YT8521_RGMII_CONFIG1_REG 0xA003 ++ ++/* TX Gig-E Delay is bits 3:0, default 0x1 ++ * TX Fast-E Delay is bits 7:4, default 0xf ++ * RX Delay is bits 13:10, default 0x0 ++ * Delay = 150ps * N ++ * On = 2250ps, off = 0ps ++ */ ++#define YT8521_RC1R_RX_DELAY_MASK (0xF << 10) ++#define YT8521_RC1R_RX_DELAY_EN (0xF << 10) ++#define YT8521_RC1R_RX_DELAY_DIS (0x0 << 10) ++#define YT8521_RC1R_FE_TX_DELAY_MASK (0xF << 4) ++#define YT8521_RC1R_FE_TX_DELAY_EN (0xF << 4) ++#define YT8521_RC1R_FE_TX_DELAY_DIS (0x0 << 4) ++#define YT8521_RC1R_GE_TX_DELAY_MASK (0xF << 0) ++#define YT8521_RC1R_GE_TX_DELAY_EN (0xF << 0) ++#define YT8521_RC1R_GE_TX_DELAY_DIS (0x0 << 0) ++ ++#define YTPHY_MISC_CONFIG_REG 0xA006 ++#define YTPHY_MCR_FIBER_SPEED_MASK BIT(0) ++#define YTPHY_MCR_FIBER_1000BX (0x1 << 0) ++#define YTPHY_MCR_FIBER_100FX (0x0 << 0) ++ ++/* WOL MAC ADDR: MACADDR2(highest), MACADDR1(middle), MACADDR0(lowest) */ ++#define YTPHY_WOL_MACADDR2_REG 0xA007 ++#define YTPHY_WOL_MACADDR1_REG 0xA008 ++#define YTPHY_WOL_MACADDR0_REG 0xA009 ++ ++#define YTPHY_WOL_CONFIG_REG 0xA00A ++#define YTPHY_WCR_INTR_SEL BIT(6) ++#define YTPHY_WCR_ENABLE BIT(3) ++ ++/* 2b00 84ms ++ * 2b01 168ms *default* ++ * 2b10 336ms ++ * 2b11 672ms ++ */ ++#define YTPHY_WCR_PULSE_WIDTH_MASK (BIT(2) | BIT(1)) ++#define YTPHY_WCR_PULSE_WIDTH_672MS (BIT(2) | BIT(1)) ++ ++/* 1b0 Interrupt and WOL events is level triggered and active LOW *default* ++ * 1b1 Interrupt and WOL events is pulse triggered and active LOW ++ */ ++#define YTPHY_WCR_TYPE_PULSE BIT(0) ++ ++/* Extended Register end */ ++ ++struct yt8521_priv { ++ /* combo_advertising is used for case of YT8521 in combo mode, ++ * this means that yt8521 may work in utp or fiber mode which depends ++ * on which media is connected (YT8521_RSSR_TO_BE_ARBITRATED). ++ */ ++ __ETHTOOL_DECLARE_LINK_MODE_MASK(combo_advertising); ++ ++ /* YT8521_MODE_FIBER / YT8521_MODE_UTP / YT8521_MODE_POLL*/ ++ u8 polling_mode; ++ u8 strap_mode; /* 8 working modes */ ++ /* current reg page of yt8521 phy: ++ * YT8521_RSSR_UTP_SPACE ++ * YT8521_RSSR_FIBER_SPACE ++ * YT8521_RSSR_TO_BE_ARBITRATED ++ */ ++ u8 reg_page; ++}; ++ ++/** ++ * ytphy_read_ext() - read a PHY's extended register ++ * @phydev: a pointer to a &struct phy_device ++ * @regnum: register number to read ++ * ++ * NOTE:The caller must have taken the MDIO bus lock. ++ * ++ * returns the value of regnum reg or negative error code ++ */ ++static int ytphy_read_ext(struct phy_device *phydev, u16 regnum) ++{ ++ int ret; ++ ++ ret = __phy_write(phydev, YTPHY_PAGE_SELECT, regnum); ++ if (ret < 0) ++ return ret; ++ ++ return __phy_read(phydev, YTPHY_PAGE_DATA); ++} ++ ++/** ++ * ytphy_read_ext_with_lock() - read a PHY's extended register ++ * @phydev: a pointer to a &struct phy_device ++ * @regnum: register number to read ++ * ++ * returns the value of regnum reg or negative error code ++ */ ++static int ytphy_read_ext_with_lock(struct phy_device *phydev, u16 regnum) ++{ ++ int ret; ++ ++ phy_lock_mdio_bus(phydev); ++ ret = ytphy_read_ext(phydev, regnum); ++ phy_unlock_mdio_bus(phydev); ++ ++ return ret; ++} ++ ++/** ++ * ytphy_write_ext() - write a PHY's extended register ++ * @phydev: a pointer to a &struct phy_device ++ * @regnum: register number to write ++ * @val: value to write to @regnum ++ * ++ * NOTE:The caller must have taken the MDIO bus lock. ++ * ++ * returns 0 or negative error code ++ */ ++static int ytphy_write_ext(struct phy_device *phydev, u16 regnum, u16 val) ++{ ++ int ret; ++ ++ ret = __phy_write(phydev, YTPHY_PAGE_SELECT, regnum); ++ if (ret < 0) ++ return ret; ++ ++ return __phy_write(phydev, YTPHY_PAGE_DATA, val); ++} ++ ++/** ++ * ytphy_write_ext_with_lock() - write a PHY's extended register ++ * @phydev: a pointer to a &struct phy_device ++ * @regnum: register number to write ++ * @val: value to write to @regnum ++ * ++ * returns 0 or negative error code ++ */ ++static int ytphy_write_ext_with_lock(struct phy_device *phydev, u16 regnum, ++ u16 val) ++{ ++ int ret; ++ ++ phy_lock_mdio_bus(phydev); ++ ret = ytphy_write_ext(phydev, regnum, val); ++ phy_unlock_mdio_bus(phydev); ++ ++ return ret; ++} ++ ++/** ++ * ytphy_modify_ext() - bits modify a PHY's extended register ++ * @phydev: a pointer to a &struct phy_device ++ * @regnum: register number to write ++ * @mask: bit mask of bits to clear ++ * @set: bit mask of bits to set ++ * ++ * NOTE: Convenience function which allows a PHY's extended register to be ++ * modified as new register value = (old register value & ~mask) | set. ++ * The caller must have taken the MDIO bus lock. ++ * ++ * returns 0 or negative error code ++ */ ++static int ytphy_modify_ext(struct phy_device *phydev, u16 regnum, u16 mask, ++ u16 set) ++{ ++ int ret; ++ ++ ret = __phy_write(phydev, YTPHY_PAGE_SELECT, regnum); ++ if (ret < 0) ++ return ret; ++ ++ return __phy_modify(phydev, YTPHY_PAGE_DATA, mask, set); ++} ++ ++/** ++ * ytphy_modify_ext_with_lock() - bits modify a PHY's extended register ++ * @phydev: a pointer to a &struct phy_device ++ * @regnum: register number to write ++ * @mask: bit mask of bits to clear ++ * @set: bit mask of bits to set ++ * ++ * NOTE: Convenience function which allows a PHY's extended register to be ++ * modified as new register value = (old register value & ~mask) | set. ++ * ++ * returns 0 or negative error code ++ */ ++static int ytphy_modify_ext_with_lock(struct phy_device *phydev, u16 regnum, ++ u16 mask, u16 set) ++{ ++ int ret; ++ ++ phy_lock_mdio_bus(phydev); ++ ret = ytphy_modify_ext(phydev, regnum, mask, set); ++ phy_unlock_mdio_bus(phydev); ++ ++ return ret; ++} ++ ++/** ++ * ytphy_get_wol() - report whether wake-on-lan is enabled ++ * @phydev: a pointer to a &struct phy_device ++ * @wol: a pointer to a &struct ethtool_wolinfo ++ * ++ * NOTE: YTPHY_WOL_CONFIG_REG is common ext reg. ++ */ ++static void ytphy_get_wol(struct phy_device *phydev, ++ struct ethtool_wolinfo *wol) ++{ ++ int wol_config; ++ ++ wol->supported = WAKE_MAGIC; ++ wol->wolopts = 0; ++ ++ wol_config = ytphy_read_ext_with_lock(phydev, YTPHY_WOL_CONFIG_REG); ++ if (wol_config < 0) ++ return; ++ ++ if (wol_config & YTPHY_WCR_ENABLE) ++ wol->wolopts |= WAKE_MAGIC; ++} ++ ++/** ++ * ytphy_set_wol() - turn wake-on-lan on or off ++ * @phydev: a pointer to a &struct phy_device ++ * @wol: a pointer to a &struct ethtool_wolinfo ++ * ++ * NOTE: YTPHY_WOL_CONFIG_REG, YTPHY_WOL_MACADDR2_REG, YTPHY_WOL_MACADDR1_REG ++ * and YTPHY_WOL_MACADDR0_REG are common ext reg. The ++ * YTPHY_INTERRUPT_ENABLE_REG of UTP is special, fiber also use this register. ++ * ++ * returns 0 or negative errno code ++ */ ++static int ytphy_set_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol) ++{ ++ struct net_device *p_attached_dev; ++ const u16 mac_addr_reg[] = { ++ YTPHY_WOL_MACADDR2_REG, ++ YTPHY_WOL_MACADDR1_REG, ++ YTPHY_WOL_MACADDR0_REG, ++ }; ++ const u8 *mac_addr; ++ int old_page; ++ int ret = 0; ++ u16 mask; ++ u16 val; ++ u8 i; ++ ++ if (wol->wolopts & WAKE_MAGIC) { ++ p_attached_dev = phydev->attached_dev; ++ if (!p_attached_dev) ++ return -ENODEV; ++ ++ mac_addr = (const u8 *)p_attached_dev->dev_addr; ++ if (!is_valid_ether_addr(mac_addr)) ++ return -EINVAL; ++ ++ /* lock mdio bus then switch to utp reg space */ ++ old_page = phy_select_page(phydev, YT8521_RSSR_UTP_SPACE); ++ if (old_page < 0) ++ goto err_restore_page; ++ ++ /* Store the device address for the magic packet */ ++ for (i = 0; i < 3; i++) { ++ ret = ytphy_write_ext(phydev, mac_addr_reg[i], ++ ((mac_addr[i * 2] << 8)) | ++ (mac_addr[i * 2 + 1])); ++ if (ret < 0) ++ goto err_restore_page; ++ } ++ ++ /* Enable WOL feature */ ++ mask = YTPHY_WCR_PULSE_WIDTH_MASK | YTPHY_WCR_INTR_SEL; ++ val = YTPHY_WCR_ENABLE | YTPHY_WCR_INTR_SEL; ++ val |= YTPHY_WCR_TYPE_PULSE | YTPHY_WCR_PULSE_WIDTH_672MS; ++ ret = ytphy_modify_ext(phydev, YTPHY_WOL_CONFIG_REG, mask, val); ++ if (ret < 0) ++ goto err_restore_page; ++ ++ /* Enable WOL interrupt */ ++ ret = __phy_modify(phydev, YTPHY_INTERRUPT_ENABLE_REG, 0, ++ YTPHY_IER_WOL); ++ if (ret < 0) ++ goto err_restore_page; ++ ++ } else { ++ old_page = phy_select_page(phydev, YT8521_RSSR_UTP_SPACE); ++ if (old_page < 0) ++ goto err_restore_page; ++ ++ /* Disable WOL feature */ ++ mask = YTPHY_WCR_ENABLE | YTPHY_WCR_INTR_SEL; ++ ret = ytphy_modify_ext(phydev, YTPHY_WOL_CONFIG_REG, mask, 0); ++ ++ /* Disable WOL interrupt */ ++ ret = __phy_modify(phydev, YTPHY_INTERRUPT_ENABLE_REG, ++ YTPHY_IER_WOL, 0); ++ if (ret < 0) ++ goto err_restore_page; ++ } ++ ++err_restore_page: ++ return phy_restore_page(phydev, old_page, ret); ++} ++ + static int yt8511_read_page(struct phy_device *phydev) + { + return __phy_read(phydev, YT8511_PAGE_SELECT); +@@ -111,6 +548,1181 @@ err_restore_page: + return phy_restore_page(phydev, oldpage, ret); + } + ++/** ++ * yt8521_read_page() - read reg page ++ * @phydev: a pointer to a &struct phy_device ++ * ++ * returns current reg space of yt8521 (YT8521_RSSR_FIBER_SPACE/ ++ * YT8521_RSSR_UTP_SPACE) or negative errno code ++ */ ++static int yt8521_read_page(struct phy_device *phydev) ++{ ++ int old_page; ++ ++ old_page = ytphy_read_ext(phydev, YT8521_REG_SPACE_SELECT_REG); ++ if (old_page < 0) ++ return old_page; ++ ++ if ((old_page & YT8521_RSSR_SPACE_MASK) == YT8521_RSSR_FIBER_SPACE) ++ return YT8521_RSSR_FIBER_SPACE; ++ ++ return YT8521_RSSR_UTP_SPACE; ++}; ++ ++/** ++ * yt8521_write_page() - write reg page ++ * @phydev: a pointer to a &struct phy_device ++ * @page: The reg page(YT8521_RSSR_FIBER_SPACE/YT8521_RSSR_UTP_SPACE) to write. ++ * ++ * returns 0 or negative errno code ++ */ ++static int yt8521_write_page(struct phy_device *phydev, int page) ++{ ++ int mask = YT8521_RSSR_SPACE_MASK; ++ int set; ++ ++ if ((page & YT8521_RSSR_SPACE_MASK) == YT8521_RSSR_FIBER_SPACE) ++ set = YT8521_RSSR_FIBER_SPACE; ++ else ++ set = YT8521_RSSR_UTP_SPACE; ++ ++ return ytphy_modify_ext(phydev, YT8521_REG_SPACE_SELECT_REG, mask, set); ++}; ++ ++/** ++ * yt8521_probe() - read chip config then set suitable polling_mode ++ * @phydev: a pointer to a &struct phy_device ++ * ++ * returns 0 or negative errno code ++ */ ++static int yt8521_probe(struct phy_device *phydev) ++{ ++ struct device *dev = &phydev->mdio.dev; ++ struct yt8521_priv *priv; ++ int chip_config; ++ int ret; ++ ++ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); ++ if (!priv) ++ return -ENOMEM; ++ ++ phydev->priv = priv; ++ ++ chip_config = ytphy_read_ext_with_lock(phydev, YT8521_CHIP_CONFIG_REG); ++ if (chip_config < 0) ++ return chip_config; ++ ++ priv->strap_mode = chip_config & YT8521_CCR_MODE_SEL_MASK; ++ switch (priv->strap_mode) { ++ case YT8521_CCR_MODE_FIBER_TO_RGMII: ++ case YT8521_CCR_MODE_SGPHY_TO_RGMAC: ++ case YT8521_CCR_MODE_SGMAC_TO_RGPHY: ++ priv->polling_mode = YT8521_MODE_FIBER; ++ priv->reg_page = YT8521_RSSR_FIBER_SPACE; ++ phydev->port = PORT_FIBRE; ++ break; ++ case YT8521_CCR_MODE_UTP_FIBER_TO_RGMII: ++ case YT8521_CCR_MODE_UTP_TO_FIBER_AUTO: ++ case YT8521_CCR_MODE_UTP_TO_FIBER_FORCE: ++ priv->polling_mode = YT8521_MODE_POLL; ++ priv->reg_page = YT8521_RSSR_TO_BE_ARBITRATED; ++ phydev->port = PORT_NONE; ++ break; ++ case YT8521_CCR_MODE_UTP_TO_SGMII: ++ case YT8521_CCR_MODE_UTP_TO_RGMII: ++ priv->polling_mode = YT8521_MODE_UTP; ++ priv->reg_page = YT8521_RSSR_UTP_SPACE; ++ phydev->port = PORT_TP; ++ break; ++ } ++ /* set default reg space */ ++ if (priv->reg_page != YT8521_RSSR_TO_BE_ARBITRATED) { ++ ret = ytphy_write_ext_with_lock(phydev, ++ YT8521_REG_SPACE_SELECT_REG, ++ priv->reg_page); ++ if (ret < 0) ++ return ret; ++ } ++ ++ return 0; ++} ++ ++/** ++ * ytphy_utp_read_lpa() - read LPA then setup lp_advertising for utp ++ * @phydev: a pointer to a &struct phy_device ++ * ++ * NOTE:The caller must have taken the MDIO bus lock. ++ * ++ * returns 0 or negative errno code ++ */ ++static int ytphy_utp_read_lpa(struct phy_device *phydev) ++{ ++ int lpa, lpagb; ++ ++ if (phydev->autoneg == AUTONEG_ENABLE) { ++ if (!phydev->autoneg_complete) { ++ mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, ++ 0); ++ mii_lpa_mod_linkmode_lpa_t(phydev->lp_advertising, 0); ++ return 0; ++ } ++ ++ if (phydev->is_gigabit_capable) { ++ lpagb = __phy_read(phydev, MII_STAT1000); ++ if (lpagb < 0) ++ return lpagb; ++ ++ if (lpagb & LPA_1000MSFAIL) { ++ int adv = __phy_read(phydev, MII_CTRL1000); ++ ++ if (adv < 0) ++ return adv; ++ ++ if (adv & CTL1000_ENABLE_MASTER) ++ phydev_err(phydev, "Master/Slave resolution failed, maybe conflicting manual settings?\n"); ++ else ++ phydev_err(phydev, "Master/Slave resolution failed\n"); ++ return -ENOLINK; ++ } ++ ++ mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, ++ lpagb); ++ } ++ ++ lpa = __phy_read(phydev, MII_LPA); ++ if (lpa < 0) ++ return lpa; ++ ++ mii_lpa_mod_linkmode_lpa_t(phydev->lp_advertising, lpa); ++ } else { ++ linkmode_zero(phydev->lp_advertising); ++ } ++ ++ return 0; ++} ++ ++/** ++ * yt8521_adjust_status() - update speed and duplex to phydev. when in fiber ++ * mode, adjust speed and duplex. ++ * @phydev: a pointer to a &struct phy_device ++ * @status: yt8521 status read from YTPHY_SPECIFIC_STATUS_REG ++ * @is_utp: false(yt8521 work in fiber mode) or true(yt8521 work in utp mode) ++ * ++ * NOTE:The caller must have taken the MDIO bus lock. ++ * ++ * returns 0 ++ */ ++static int yt8521_adjust_status(struct phy_device *phydev, int status, ++ bool is_utp) ++{ ++ int speed_mode, duplex; ++ int speed; ++ int err; ++ int lpa; ++ ++ if (is_utp) ++ duplex = (status & YTPHY_SSR_DUPLEX) >> YTPHY_SSR_DUPLEX_OFFSET; ++ else ++ duplex = DUPLEX_FULL; /* for fiber, it always DUPLEX_FULL */ ++ ++ speed_mode = (status & YTPHY_SSR_SPEED_MODE_MASK) >> ++ YTPHY_SSR_SPEED_MODE_OFFSET; ++ ++ switch (speed_mode) { ++ case YTPHY_SSR_SPEED_10M: ++ if (is_utp) ++ speed = SPEED_10; ++ else ++ /* for fiber, it will never run here, default to ++ * SPEED_UNKNOWN ++ */ ++ speed = SPEED_UNKNOWN; ++ break; ++ case YTPHY_SSR_SPEED_100M: ++ speed = SPEED_100; ++ break; ++ case YTPHY_SSR_SPEED_1000M: ++ speed = SPEED_1000; ++ break; ++ default: ++ speed = SPEED_UNKNOWN; ++ break; ++ } ++ ++ phydev->speed = speed; ++ phydev->duplex = duplex; ++ ++ if (is_utp) { ++ err = ytphy_utp_read_lpa(phydev); ++ if (err < 0) ++ return err; ++ ++ phy_resolve_aneg_pause(phydev); ++ } else { ++ lpa = __phy_read(phydev, MII_LPA); ++ if (lpa < 0) ++ return lpa; ++ ++ /* only support 1000baseX Full */ ++ linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseX_Full_BIT, ++ phydev->lp_advertising, lpa & LPA_1000XFULL); ++ ++ if (!(lpa & YTPHY_FLPA_PAUSE)) { ++ phydev->pause = 0; ++ phydev->asym_pause = 0; ++ } else if ((lpa & YTPHY_FLPA_ASYM_PAUSE)) { ++ phydev->pause = 1; ++ phydev->asym_pause = 1; ++ } else { ++ phydev->pause = 1; ++ phydev->asym_pause = 0; ++ } ++ } ++ ++ return 0; ++} ++ ++/** ++ * yt8521_read_status_paged() - determines the speed and duplex of one page ++ * @phydev: a pointer to a &struct phy_device ++ * @page: The reg page(YT8521_RSSR_FIBER_SPACE/YT8521_RSSR_UTP_SPACE) to ++ * operate. ++ * ++ * returns 1 (utp or fiber link),0 (no link) or negative errno code ++ */ ++static int yt8521_read_status_paged(struct phy_device *phydev, int page) ++{ ++ int fiber_latch_val; ++ int fiber_curr_val; ++ int old_page; ++ int ret = 0; ++ int status; ++ int link; ++ ++ linkmode_zero(phydev->lp_advertising); ++ phydev->duplex = DUPLEX_UNKNOWN; ++ phydev->speed = SPEED_UNKNOWN; ++ phydev->asym_pause = 0; ++ phydev->pause = 0; ++ ++ /* YT8521 has two reg space (utp/fiber) for linkup with utp/fiber ++ * respectively. but for utp/fiber combo mode, reg space should be ++ * arbitrated based on media priority. by default, utp takes ++ * priority. reg space should be properly set before read ++ * YTPHY_SPECIFIC_STATUS_REG. ++ */ ++ ++ page &= YT8521_RSSR_SPACE_MASK; ++ old_page = phy_select_page(phydev, page); ++ if (old_page < 0) ++ goto err_restore_page; ++ ++ /* Read YTPHY_SPECIFIC_STATUS_REG, which indicates the speed and duplex ++ * of the PHY is actually using. ++ */ ++ ret = __phy_read(phydev, YTPHY_SPECIFIC_STATUS_REG); ++ if (ret < 0) ++ goto err_restore_page; ++ ++ status = ret; ++ link = !!(status & YTPHY_SSR_LINK); ++ ++ /* When PHY is in fiber mode, speed transferred from 1000Mbps to ++ * 100Mbps,there is not link down from YTPHY_SPECIFIC_STATUS_REG, so ++ * we need check MII_BMSR to identify such case. ++ */ ++ if (page == YT8521_RSSR_FIBER_SPACE) { ++ ret = __phy_read(phydev, MII_BMSR); ++ if (ret < 0) ++ goto err_restore_page; ++ ++ fiber_latch_val = ret; ++ ret = __phy_read(phydev, MII_BMSR); ++ if (ret < 0) ++ goto err_restore_page; ++ ++ fiber_curr_val = ret; ++ if (link && fiber_latch_val != fiber_curr_val) { ++ link = 0; ++ phydev_info(phydev, ++ "%s, fiber link down detect, latch = %04x, curr = %04x\n", ++ __func__, fiber_latch_val, fiber_curr_val); ++ } ++ } else { ++ /* Read autonegotiation status */ ++ ret = __phy_read(phydev, MII_BMSR); ++ if (ret < 0) ++ goto err_restore_page; ++ ++ phydev->autoneg_complete = ret & BMSR_ANEGCOMPLETE ? 1 : 0; ++ } ++ ++ if (link) { ++ if (page == YT8521_RSSR_UTP_SPACE) ++ yt8521_adjust_status(phydev, status, true); ++ else ++ yt8521_adjust_status(phydev, status, false); ++ } ++ return phy_restore_page(phydev, old_page, link); ++ ++err_restore_page: ++ return phy_restore_page(phydev, old_page, ret); ++} ++ ++/** ++ * yt8521_read_status() - determines the negotiated speed and duplex ++ * @phydev: a pointer to a &struct phy_device ++ * ++ * returns 0 or negative errno code ++ */ ++static int yt8521_read_status(struct phy_device *phydev) ++{ ++ struct yt8521_priv *priv = phydev->priv; ++ int link_fiber = 0; ++ int link_utp; ++ int link; ++ int ret; ++ ++ if (priv->reg_page != YT8521_RSSR_TO_BE_ARBITRATED) { ++ link = yt8521_read_status_paged(phydev, priv->reg_page); ++ if (link < 0) ++ return link; ++ } else { ++ /* when page is YT8521_RSSR_TO_BE_ARBITRATED, arbitration is ++ * needed. by default, utp is higher priority. ++ */ ++ ++ link_utp = yt8521_read_status_paged(phydev, ++ YT8521_RSSR_UTP_SPACE); ++ if (link_utp < 0) ++ return link_utp; ++ ++ if (!link_utp) { ++ link_fiber = yt8521_read_status_paged(phydev, ++ YT8521_RSSR_FIBER_SPACE); ++ if (link_fiber < 0) ++ return link_fiber; ++ } ++ ++ link = link_utp || link_fiber; ++ } ++ ++ if (link) { ++ if (phydev->link == 0) { ++ /* arbitrate reg space based on linkup media type. */ ++ if (priv->polling_mode == YT8521_MODE_POLL && ++ priv->reg_page == YT8521_RSSR_TO_BE_ARBITRATED) { ++ if (link_fiber) ++ priv->reg_page = ++ YT8521_RSSR_FIBER_SPACE; ++ else ++ priv->reg_page = YT8521_RSSR_UTP_SPACE; ++ ++ ret = ytphy_write_ext_with_lock(phydev, ++ YT8521_REG_SPACE_SELECT_REG, ++ priv->reg_page); ++ if (ret < 0) ++ return ret; ++ ++ phydev->port = link_fiber ? PORT_FIBRE : PORT_TP; ++ ++ phydev_info(phydev, "%s, link up, media: %s\n", ++ __func__, ++ (phydev->port == PORT_TP) ? ++ "UTP" : "Fiber"); ++ } ++ } ++ phydev->link = 1; ++ } else { ++ if (phydev->link == 1) { ++ phydev_info(phydev, "%s, link down, media: %s\n", ++ __func__, (phydev->port == PORT_TP) ? ++ "UTP" : "Fiber"); ++ ++ /* When in YT8521_MODE_POLL mode, need prepare for next ++ * arbitration. ++ */ ++ if (priv->polling_mode == YT8521_MODE_POLL) { ++ priv->reg_page = YT8521_RSSR_TO_BE_ARBITRATED; ++ phydev->port = PORT_NONE; ++ } ++ } ++ ++ phydev->link = 0; ++ } ++ ++ return 0; ++} ++ ++/** ++ * yt8521_modify_bmcr_paged - bits modify a PHY's BMCR register of one page ++ * @phydev: the phy_device struct ++ * @page: The reg page(YT8521_RSSR_FIBER_SPACE/YT8521_RSSR_UTP_SPACE) to operate ++ * @mask: bit mask of bits to clear ++ * @set: bit mask of bits to set ++ * ++ * NOTE: Convenience function which allows a PHY's BMCR register to be ++ * modified as new register value = (old register value & ~mask) | set. ++ * YT8521 has two space (utp/fiber) and three mode (utp/fiber/poll), each space ++ * has MII_BMCR. poll mode combines utp and faber,so need do both. ++ * If it is reset, it will wait for completion. ++ * ++ * returns 0 or negative errno code ++ */ ++static int yt8521_modify_bmcr_paged(struct phy_device *phydev, int page, ++ u16 mask, u16 set) ++{ ++ int max_cnt = 500; /* the max wait time of reset ~ 500 ms */ ++ int old_page; ++ int ret = 0; ++ ++ old_page = phy_select_page(phydev, page & YT8521_RSSR_SPACE_MASK); ++ if (old_page < 0) ++ goto err_restore_page; ++ ++ ret = __phy_modify(phydev, MII_BMCR, mask, set); ++ if (ret < 0) ++ goto err_restore_page; ++ ++ /* If it is reset, need to wait for the reset to complete */ ++ if (set == BMCR_RESET) { ++ while (max_cnt--) { ++ usleep_range(1000, 1100); ++ ret = __phy_read(phydev, MII_BMCR); ++ if (ret < 0) ++ goto err_restore_page; ++ ++ if (!(ret & BMCR_RESET)) ++ return phy_restore_page(phydev, old_page, 0); ++ } ++ } ++ ++err_restore_page: ++ return phy_restore_page(phydev, old_page, ret); ++} ++ ++/** ++ * yt8521_modify_utp_fiber_bmcr - bits modify a PHY's BMCR register ++ * @phydev: the phy_device struct ++ * @mask: bit mask of bits to clear ++ * @set: bit mask of bits to set ++ * ++ * NOTE: Convenience function which allows a PHY's BMCR register to be ++ * modified as new register value = (old register value & ~mask) | set. ++ * YT8521 has two space (utp/fiber) and three mode (utp/fiber/poll), each space ++ * has MII_BMCR. poll mode combines utp and faber,so need do both. ++ * ++ * returns 0 or negative errno code ++ */ ++static int yt8521_modify_utp_fiber_bmcr(struct phy_device *phydev, u16 mask, ++ u16 set) ++{ ++ struct yt8521_priv *priv = phydev->priv; ++ int ret; ++ ++ if (priv->reg_page != YT8521_RSSR_TO_BE_ARBITRATED) { ++ ret = yt8521_modify_bmcr_paged(phydev, priv->reg_page, mask, ++ set); ++ if (ret < 0) ++ return ret; ++ } else { ++ ret = yt8521_modify_bmcr_paged(phydev, YT8521_RSSR_UTP_SPACE, ++ mask, set); ++ if (ret < 0) ++ return ret; ++ ++ ret = yt8521_modify_bmcr_paged(phydev, YT8521_RSSR_FIBER_SPACE, ++ mask, set); ++ if (ret < 0) ++ return ret; ++ } ++ return 0; ++} ++ ++/** ++ * yt8521_soft_reset() - called to issue a PHY software reset ++ * @phydev: a pointer to a &struct phy_device ++ * ++ * returns 0 or negative errno code ++ */ ++static int yt8521_soft_reset(struct phy_device *phydev) ++{ ++ return yt8521_modify_utp_fiber_bmcr(phydev, 0, BMCR_RESET); ++} ++ ++/** ++ * yt8521_suspend() - suspend the hardware ++ * @phydev: a pointer to a &struct phy_device ++ * ++ * returns 0 or negative errno code ++ */ ++static int yt8521_suspend(struct phy_device *phydev) ++{ ++ int wol_config; ++ ++ /* YTPHY_WOL_CONFIG_REG is common ext reg */ ++ wol_config = ytphy_read_ext_with_lock(phydev, YTPHY_WOL_CONFIG_REG); ++ if (wol_config < 0) ++ return wol_config; ++ ++ /* if wol enable, do nothing */ ++ if (wol_config & YTPHY_WCR_ENABLE) ++ return 0; ++ ++ return yt8521_modify_utp_fiber_bmcr(phydev, 0, BMCR_PDOWN); ++} ++ ++/** ++ * yt8521_resume() - resume the hardware ++ * @phydev: a pointer to a &struct phy_device ++ * ++ * returns 0 or negative errno code ++ */ ++static int yt8521_resume(struct phy_device *phydev) ++{ ++ int ret; ++ int wol_config; ++ ++ /* disable auto sleep */ ++ ret = ytphy_modify_ext_with_lock(phydev, ++ YT8521_EXTREG_SLEEP_CONTROL1_REG, ++ YT8521_ESC1R_SLEEP_SW, 0); ++ if (ret < 0) ++ return ret; ++ ++ wol_config = ytphy_read_ext_with_lock(phydev, YTPHY_WOL_CONFIG_REG); ++ if (wol_config < 0) ++ return wol_config; ++ ++ /* if wol enable, do nothing */ ++ if (wol_config & YTPHY_WCR_ENABLE) ++ return 0; ++ ++ return yt8521_modify_utp_fiber_bmcr(phydev, BMCR_PDOWN, 0); ++} ++ ++/** ++ * yt8521_config_init() - called to initialize the PHY ++ * @phydev: a pointer to a &struct phy_device ++ * ++ * returns 0 or negative errno code ++ */ ++static int yt8521_config_init(struct phy_device *phydev) ++{ ++ int old_page; ++ int ret = 0; ++ u16 val; ++ ++ old_page = phy_select_page(phydev, YT8521_RSSR_UTP_SPACE); ++ if (old_page < 0) ++ goto err_restore_page; ++ ++ switch (phydev->interface) { ++ case PHY_INTERFACE_MODE_RGMII: ++ val = YT8521_RC1R_GE_TX_DELAY_DIS | YT8521_RC1R_GE_TX_DELAY_DIS; ++ val |= YT8521_RC1R_RX_DELAY_DIS; ++ break; ++ case PHY_INTERFACE_MODE_RGMII_RXID: ++ val = YT8521_RC1R_GE_TX_DELAY_DIS | YT8521_RC1R_GE_TX_DELAY_DIS; ++ val |= YT8521_RC1R_RX_DELAY_EN; ++ break; ++ case PHY_INTERFACE_MODE_RGMII_TXID: ++ val = YT8521_RC1R_GE_TX_DELAY_EN | YT8521_RC1R_GE_TX_DELAY_EN; ++ val |= YT8521_RC1R_RX_DELAY_DIS; ++ break; ++ case PHY_INTERFACE_MODE_RGMII_ID: ++ val = YT8521_RC1R_GE_TX_DELAY_EN | YT8521_RC1R_GE_TX_DELAY_EN; ++ val |= YT8521_RC1R_RX_DELAY_EN; ++ break; ++ case PHY_INTERFACE_MODE_SGMII: ++ break; ++ default: /* do not support other modes */ ++ ret = -EOPNOTSUPP; ++ goto err_restore_page; ++ } ++ ++ /* set rgmii delay mode */ ++ if (phydev->interface != PHY_INTERFACE_MODE_SGMII) { ++ ret = ytphy_modify_ext(phydev, YT8521_RGMII_CONFIG1_REG, ++ (YT8521_RC1R_RX_DELAY_MASK | ++ YT8521_RC1R_FE_TX_DELAY_MASK | ++ YT8521_RC1R_GE_TX_DELAY_MASK), ++ val); ++ if (ret < 0) ++ goto err_restore_page; ++ } ++ ++ /* disable auto sleep */ ++ ret = ytphy_modify_ext(phydev, YT8521_EXTREG_SLEEP_CONTROL1_REG, ++ YT8521_ESC1R_SLEEP_SW, 0); ++ if (ret < 0) ++ goto err_restore_page; ++ ++ /* enable RXC clock when no wire plug */ ++ ret = ytphy_modify_ext(phydev, YT8521_CLOCK_GATING_REG, ++ YT8521_CGR_RX_CLK_EN, 0); ++ if (ret < 0) ++ goto err_restore_page; ++ ++err_restore_page: ++ return phy_restore_page(phydev, old_page, ret); ++} ++ ++/** ++ * yt8521_prepare_fiber_features() - A small helper function that setup ++ * fiber's features. ++ * @phydev: a pointer to a &struct phy_device ++ * @dst: a pointer to store fiber's features ++ */ ++static void yt8521_prepare_fiber_features(struct phy_device *phydev, ++ unsigned long *dst) ++{ ++ linkmode_set_bit(ETHTOOL_LINK_MODE_100baseFX_Full_BIT, dst); ++ linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseX_Full_BIT, dst); ++ linkmode_set_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, dst); ++ linkmode_set_bit(ETHTOOL_LINK_MODE_FIBRE_BIT, dst); ++} ++ ++/** ++ * yt8521_fiber_setup_forced - configures/forces speed from @phydev ++ * @phydev: target phy_device struct ++ * ++ * NOTE:The caller must have taken the MDIO bus lock. ++ * ++ * returns 0 or negative errno code ++ */ ++static int yt8521_fiber_setup_forced(struct phy_device *phydev) ++{ ++ u16 val; ++ int ret; ++ ++ if (phydev->speed == SPEED_1000) ++ val = YTPHY_MCR_FIBER_1000BX; ++ else if (phydev->speed == SPEED_100) ++ val = YTPHY_MCR_FIBER_100FX; ++ else ++ return -EINVAL; ++ ++ ret = __phy_modify(phydev, MII_BMCR, BMCR_ANENABLE, 0); ++ if (ret < 0) ++ return ret; ++ ++ /* disable Fiber auto sensing */ ++ ret = ytphy_modify_ext(phydev, YT8521_LINK_TIMER_CFG2_REG, ++ YT8521_LTCR_EN_AUTOSEN, 0); ++ if (ret < 0) ++ return ret; ++ ++ ret = ytphy_modify_ext(phydev, YTPHY_MISC_CONFIG_REG, ++ YTPHY_MCR_FIBER_SPEED_MASK, val); ++ if (ret < 0) ++ return ret; ++ ++ return ytphy_modify_ext(phydev, YT8521_CHIP_CONFIG_REG, ++ YT8521_CCR_SW_RST, 0); ++} ++ ++/** ++ * ytphy_check_and_restart_aneg - Enable and restart auto-negotiation ++ * @phydev: target phy_device struct ++ * @restart: whether aneg restart is requested ++ * ++ * NOTE:The caller must have taken the MDIO bus lock. ++ * ++ * returns 0 or negative errno code ++ */ ++static int ytphy_check_and_restart_aneg(struct phy_device *phydev, bool restart) ++{ ++ int ret; ++ ++ if (!restart) { ++ /* Advertisement hasn't changed, but maybe aneg was never on to ++ * begin with? Or maybe phy was isolated? ++ */ ++ ret = __phy_read(phydev, MII_BMCR); ++ if (ret < 0) ++ return ret; ++ ++ if (!(ret & BMCR_ANENABLE) || (ret & BMCR_ISOLATE)) ++ restart = true; ++ } ++ /* Enable and Restart Autonegotiation ++ * Don't isolate the PHY if we're negotiating ++ */ ++ if (restart) ++ return __phy_modify(phydev, MII_BMCR, BMCR_ISOLATE, ++ BMCR_ANENABLE | BMCR_ANRESTART); ++ ++ return 0; ++} ++ ++/** ++ * yt8521_fiber_config_aneg - restart auto-negotiation or write ++ * YTPHY_MISC_CONFIG_REG. ++ * @phydev: target phy_device struct ++ * ++ * NOTE:The caller must have taken the MDIO bus lock. ++ * ++ * returns 0 or negative errno code ++ */ ++static int yt8521_fiber_config_aneg(struct phy_device *phydev) ++{ ++ int err, changed = 0; ++ int bmcr; ++ u16 adv; ++ ++ if (phydev->autoneg != AUTONEG_ENABLE) ++ return yt8521_fiber_setup_forced(phydev); ++ ++ /* enable Fiber auto sensing */ ++ err = ytphy_modify_ext(phydev, YT8521_LINK_TIMER_CFG2_REG, ++ 0, YT8521_LTCR_EN_AUTOSEN); ++ if (err < 0) ++ return err; ++ ++ err = ytphy_modify_ext(phydev, YT8521_CHIP_CONFIG_REG, ++ YT8521_CCR_SW_RST, 0); ++ if (err < 0) ++ return err; ++ ++ bmcr = __phy_read(phydev, MII_BMCR); ++ if (bmcr < 0) ++ return bmcr; ++ ++ /* When it is coming from fiber forced mode, add bmcr power down ++ * and power up to let aneg work fine. ++ */ ++ if (!(bmcr & BMCR_ANENABLE)) { ++ __phy_modify(phydev, MII_BMCR, 0, BMCR_PDOWN); ++ usleep_range(1000, 1100); ++ __phy_modify(phydev, MII_BMCR, BMCR_PDOWN, 0); ++ } ++ ++ adv = linkmode_adv_to_mii_adv_x(phydev->advertising, ++ ETHTOOL_LINK_MODE_1000baseX_Full_BIT); ++ ++ /* Setup fiber advertisement */ ++ err = __phy_modify_changed(phydev, MII_ADVERTISE, ++ ADVERTISE_1000XHALF | ADVERTISE_1000XFULL | ++ ADVERTISE_1000XPAUSE | ++ ADVERTISE_1000XPSE_ASYM, ++ adv); ++ if (err < 0) ++ return err; ++ ++ if (err > 0) ++ changed = 1; ++ ++ return ytphy_check_and_restart_aneg(phydev, changed); ++} ++ ++/** ++ * ytphy_setup_master_slave ++ * @phydev: target phy_device struct ++ * ++ * NOTE: The caller must have taken the MDIO bus lock. ++ * ++ * returns 0 or negative errno code ++ */ ++static int ytphy_setup_master_slave(struct phy_device *phydev) ++{ ++ u16 ctl = 0; ++ ++ if (!phydev->is_gigabit_capable) ++ return 0; ++ ++ switch (phydev->master_slave_set) { ++ case MASTER_SLAVE_CFG_MASTER_PREFERRED: ++ ctl |= CTL1000_PREFER_MASTER; ++ break; ++ case MASTER_SLAVE_CFG_SLAVE_PREFERRED: ++ break; ++ case MASTER_SLAVE_CFG_MASTER_FORCE: ++ ctl |= CTL1000_AS_MASTER; ++ fallthrough; ++ case MASTER_SLAVE_CFG_SLAVE_FORCE: ++ ctl |= CTL1000_ENABLE_MASTER; ++ break; ++ case MASTER_SLAVE_CFG_UNKNOWN: ++ case MASTER_SLAVE_CFG_UNSUPPORTED: ++ return 0; ++ default: ++ phydev_warn(phydev, "Unsupported Master/Slave mode\n"); ++ return -EOPNOTSUPP; ++ } ++ ++ return __phy_modify_changed(phydev, MII_CTRL1000, ++ (CTL1000_ENABLE_MASTER | CTL1000_AS_MASTER | ++ CTL1000_PREFER_MASTER), ctl); ++} ++ ++/** ++ * ytphy_utp_config_advert - sanitize and advertise auto-negotiation parameters ++ * @phydev: target phy_device struct ++ * ++ * NOTE: Writes MII_ADVERTISE with the appropriate values, ++ * after sanitizing the values to make sure we only advertise ++ * what is supported. Returns < 0 on error, 0 if the PHY's advertisement ++ * hasn't changed, and > 0 if it has changed. ++ * The caller must have taken the MDIO bus lock. ++ * ++ * returns 0 or negative errno code ++ */ ++static int ytphy_utp_config_advert(struct phy_device *phydev) ++{ ++ int err, bmsr, changed = 0; ++ u32 adv; ++ ++ /* Only allow advertising what this PHY supports */ ++ linkmode_and(phydev->advertising, phydev->advertising, ++ phydev->supported); ++ ++ adv = linkmode_adv_to_mii_adv_t(phydev->advertising); ++ ++ /* Setup standard advertisement */ ++ err = __phy_modify_changed(phydev, MII_ADVERTISE, ++ ADVERTISE_ALL | ADVERTISE_100BASE4 | ++ ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM, ++ adv); ++ if (err < 0) ++ return err; ++ if (err > 0) ++ changed = 1; ++ ++ bmsr = __phy_read(phydev, MII_BMSR); ++ if (bmsr < 0) ++ return bmsr; ++ ++ /* Per 802.3-2008, Section 22.2.4.2.16 Extended status all ++ * 1000Mbits/sec capable PHYs shall have the BMSR_ESTATEN bit set to a ++ * logical 1. ++ */ ++ if (!(bmsr & BMSR_ESTATEN)) ++ return changed; ++ ++ adv = linkmode_adv_to_mii_ctrl1000_t(phydev->advertising); ++ ++ err = __phy_modify_changed(phydev, MII_CTRL1000, ++ ADVERTISE_1000FULL | ADVERTISE_1000HALF, ++ adv); ++ if (err < 0) ++ return err; ++ if (err > 0) ++ changed = 1; ++ ++ return changed; ++} ++ ++/** ++ * ytphy_utp_config_aneg - restart auto-negotiation or write BMCR ++ * @phydev: target phy_device struct ++ * @changed: whether autoneg is requested ++ * ++ * NOTE: If auto-negotiation is enabled, we configure the ++ * advertising, and then restart auto-negotiation. If it is not ++ * enabled, then we write the BMCR. ++ * The caller must have taken the MDIO bus lock. ++ * ++ * returns 0 or negative errno code ++ */ ++static int ytphy_utp_config_aneg(struct phy_device *phydev, bool changed) ++{ ++ int err; ++ u16 ctl; ++ ++ err = ytphy_setup_master_slave(phydev); ++ if (err < 0) ++ return err; ++ else if (err) ++ changed = true; ++ ++ if (phydev->autoneg != AUTONEG_ENABLE) { ++ /* configures/forces speed/duplex from @phydev */ ++ ++ ctl = mii_bmcr_encode_fixed(phydev->speed, phydev->duplex); ++ ++ return __phy_modify(phydev, MII_BMCR, ~(BMCR_LOOPBACK | ++ BMCR_ISOLATE | BMCR_PDOWN), ctl); ++ } ++ ++ err = ytphy_utp_config_advert(phydev); ++ if (err < 0) /* error */ ++ return err; ++ else if (err) ++ changed = true; ++ ++ return ytphy_check_and_restart_aneg(phydev, changed); ++} ++ ++/** ++ * yt8521_config_aneg_paged() - switch reg space then call genphy_config_aneg ++ * of one page ++ * @phydev: a pointer to a &struct phy_device ++ * @page: The reg page(YT8521_RSSR_FIBER_SPACE/YT8521_RSSR_UTP_SPACE) to ++ * operate. ++ * ++ * returns 0 or negative errno code ++ */ ++static int yt8521_config_aneg_paged(struct phy_device *phydev, int page) ++{ ++ __ETHTOOL_DECLARE_LINK_MODE_MASK(fiber_supported); ++ struct yt8521_priv *priv = phydev->priv; ++ int old_page; ++ int ret = 0; ++ ++ page &= YT8521_RSSR_SPACE_MASK; ++ ++ old_page = phy_select_page(phydev, page); ++ if (old_page < 0) ++ goto err_restore_page; ++ ++ /* If reg_page is YT8521_RSSR_TO_BE_ARBITRATED, ++ * phydev->advertising should be updated. ++ */ ++ if (priv->reg_page == YT8521_RSSR_TO_BE_ARBITRATED) { ++ linkmode_zero(fiber_supported); ++ yt8521_prepare_fiber_features(phydev, fiber_supported); ++ ++ /* prepare fiber_supported, then setup advertising. */ ++ if (page == YT8521_RSSR_FIBER_SPACE) { ++ linkmode_set_bit(ETHTOOL_LINK_MODE_Pause_BIT, ++ fiber_supported); ++ linkmode_set_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, ++ fiber_supported); ++ linkmode_and(phydev->advertising, ++ priv->combo_advertising, fiber_supported); ++ } else { ++ /* ETHTOOL_LINK_MODE_Autoneg_BIT is also used in utp */ ++ linkmode_clear_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, ++ fiber_supported); ++ linkmode_andnot(phydev->advertising, ++ priv->combo_advertising, ++ fiber_supported); ++ } ++ } ++ ++ if (page == YT8521_RSSR_FIBER_SPACE) ++ ret = yt8521_fiber_config_aneg(phydev); ++ else ++ ret = ytphy_utp_config_aneg(phydev, false); ++ ++err_restore_page: ++ return phy_restore_page(phydev, old_page, ret); ++} ++ ++/** ++ * yt8521_config_aneg() - change reg space then call yt8521_config_aneg_paged ++ * @phydev: a pointer to a &struct phy_device ++ * ++ * returns 0 or negative errno code ++ */ ++static int yt8521_config_aneg(struct phy_device *phydev) ++{ ++ struct yt8521_priv *priv = phydev->priv; ++ int ret; ++ ++ if (priv->reg_page != YT8521_RSSR_TO_BE_ARBITRATED) { ++ ret = yt8521_config_aneg_paged(phydev, priv->reg_page); ++ if (ret < 0) ++ return ret; ++ } else { ++ /* If reg_page is YT8521_RSSR_TO_BE_ARBITRATED, ++ * phydev->advertising need to be saved at first run. ++ * Because it contains the advertising which supported by both ++ * mac and yt8521(utp and fiber). ++ */ ++ if (linkmode_empty(priv->combo_advertising)) { ++ linkmode_copy(priv->combo_advertising, ++ phydev->advertising); ++ } ++ ++ ret = yt8521_config_aneg_paged(phydev, YT8521_RSSR_UTP_SPACE); ++ if (ret < 0) ++ return ret; ++ ++ ret = yt8521_config_aneg_paged(phydev, YT8521_RSSR_FIBER_SPACE); ++ if (ret < 0) ++ return ret; ++ ++ /* we don't known which will be link, so restore ++ * phydev->advertising as default value. ++ */ ++ linkmode_copy(phydev->advertising, priv->combo_advertising); ++ } ++ return 0; ++} ++ ++/** ++ * yt8521_aneg_done_paged() - determines the auto negotiation result of one ++ * page. ++ * @phydev: a pointer to a &struct phy_device ++ * @page: The reg page(YT8521_RSSR_FIBER_SPACE/YT8521_RSSR_UTP_SPACE) to ++ * operate. ++ * ++ * returns 0(no link)or 1(fiber or utp link) or negative errno code ++ */ ++static int yt8521_aneg_done_paged(struct phy_device *phydev, int page) ++{ ++ int old_page; ++ int ret = 0; ++ int link; ++ ++ old_page = phy_select_page(phydev, page & YT8521_RSSR_SPACE_MASK); ++ if (old_page < 0) ++ goto err_restore_page; ++ ++ ret = __phy_read(phydev, YTPHY_SPECIFIC_STATUS_REG); ++ if (ret < 0) ++ goto err_restore_page; ++ ++ link = !!(ret & YTPHY_SSR_LINK); ++ ret = link; ++ ++err_restore_page: ++ return phy_restore_page(phydev, old_page, ret); ++} ++ ++/** ++ * yt8521_aneg_done() - determines the auto negotiation result ++ * @phydev: a pointer to a &struct phy_device ++ * ++ * returns 0(no link)or 1(fiber or utp link) or negative errno code ++ */ ++static int yt8521_aneg_done(struct phy_device *phydev) ++{ ++ struct yt8521_priv *priv = phydev->priv; ++ int link_fiber = 0; ++ int link_utp; ++ int link; ++ ++ if (priv->reg_page != YT8521_RSSR_TO_BE_ARBITRATED) { ++ link = yt8521_aneg_done_paged(phydev, priv->reg_page); ++ } else { ++ link_utp = yt8521_aneg_done_paged(phydev, ++ YT8521_RSSR_UTP_SPACE); ++ if (link_utp < 0) ++ return link_utp; ++ ++ if (!link_utp) { ++ link_fiber = yt8521_aneg_done_paged(phydev, ++ YT8521_RSSR_FIBER_SPACE); ++ if (link_fiber < 0) ++ return link_fiber; ++ } ++ link = link_fiber || link_utp; ++ phydev_info(phydev, "%s, link_fiber: %d, link_utp: %d\n", ++ __func__, link_fiber, link_utp); ++ } ++ ++ return link; ++} ++ ++/** ++ * ytphy_utp_read_abilities - read PHY abilities from Clause 22 registers ++ * @phydev: target phy_device struct ++ * ++ * NOTE: Reads the PHY's abilities and populates ++ * phydev->supported accordingly. ++ * The caller must have taken the MDIO bus lock. ++ * ++ * returns 0 or negative errno code ++ */ ++static int ytphy_utp_read_abilities(struct phy_device *phydev) ++{ ++ int val; ++ ++ linkmode_set_bit_array(phy_basic_ports_array, ++ ARRAY_SIZE(phy_basic_ports_array), ++ phydev->supported); ++ ++ val = __phy_read(phydev, MII_BMSR); ++ if (val < 0) ++ return val; ++ ++ linkmode_mod_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, phydev->supported, ++ val & BMSR_ANEGCAPABLE); ++ ++ linkmode_mod_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, phydev->supported, ++ val & BMSR_100FULL); ++ linkmode_mod_bit(ETHTOOL_LINK_MODE_100baseT_Half_BIT, phydev->supported, ++ val & BMSR_100HALF); ++ linkmode_mod_bit(ETHTOOL_LINK_MODE_10baseT_Full_BIT, phydev->supported, ++ val & BMSR_10FULL); ++ linkmode_mod_bit(ETHTOOL_LINK_MODE_10baseT_Half_BIT, phydev->supported, ++ val & BMSR_10HALF); ++ ++ if (val & BMSR_ESTATEN) { ++ val = __phy_read(phydev, MII_ESTATUS); ++ if (val < 0) ++ return val; ++ ++ linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, ++ phydev->supported, val & ESTATUS_1000_TFULL); ++ linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT, ++ phydev->supported, val & ESTATUS_1000_THALF); ++ linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseX_Full_BIT, ++ phydev->supported, val & ESTATUS_1000_XFULL); ++ } ++ ++ return 0; ++} ++ ++/** ++ * yt8521_get_features_paged() - read supported link modes for one page ++ * @phydev: a pointer to a &struct phy_device ++ * @page: The reg page(YT8521_RSSR_FIBER_SPACE/YT8521_RSSR_UTP_SPACE) to ++ * operate. ++ * ++ * returns 0 or negative errno code ++ */ ++static int yt8521_get_features_paged(struct phy_device *phydev, int page) ++{ ++ int old_page; ++ int ret = 0; ++ ++ page &= YT8521_RSSR_SPACE_MASK; ++ old_page = phy_select_page(phydev, page); ++ if (old_page < 0) ++ goto err_restore_page; ++ ++ if (page == YT8521_RSSR_FIBER_SPACE) { ++ linkmode_zero(phydev->supported); ++ yt8521_prepare_fiber_features(phydev, phydev->supported); ++ } else { ++ ret = ytphy_utp_read_abilities(phydev); ++ if (ret < 0) ++ goto err_restore_page; ++ } ++ ++err_restore_page: ++ return phy_restore_page(phydev, old_page, ret); ++} ++ ++/** ++ * yt8521_get_features - switch reg space then call yt8521_get_features_paged ++ * @phydev: target phy_device struct ++ * ++ * returns 0 or negative errno code ++ */ ++static int yt8521_get_features(struct phy_device *phydev) ++{ ++ struct yt8521_priv *priv = phydev->priv; ++ int ret; ++ ++ if (priv->reg_page != YT8521_RSSR_TO_BE_ARBITRATED) { ++ ret = yt8521_get_features_paged(phydev, priv->reg_page); ++ } else { ++ ret = yt8521_get_features_paged(phydev, ++ YT8521_RSSR_UTP_SPACE); ++ if (ret < 0) ++ return ret; ++ ++ /* add fiber's features to phydev->supported */ ++ yt8521_prepare_fiber_features(phydev, phydev->supported); ++ } ++ return ret; ++} ++ + static struct phy_driver motorcomm_phy_drvs[] = { + { + PHY_ID_MATCH_EXACT(PHY_ID_YT8511), +@@ -121,16 +1733,35 @@ static struct phy_driver motorcomm_phy_d + .read_page = yt8511_read_page, + .write_page = yt8511_write_page, + }, ++ { ++ PHY_ID_MATCH_EXACT(PHY_ID_YT8521), ++ .name = "YT8521 Gigabit Ethernet", ++ .get_features = yt8521_get_features, ++ .probe = yt8521_probe, ++ .read_page = yt8521_read_page, ++ .write_page = yt8521_write_page, ++ .get_wol = ytphy_get_wol, ++ .set_wol = ytphy_set_wol, ++ .config_aneg = yt8521_config_aneg, ++ .aneg_done = yt8521_aneg_done, ++ .config_init = yt8521_config_init, ++ .read_status = yt8521_read_status, ++ .soft_reset = yt8521_soft_reset, ++ .suspend = yt8521_suspend, ++ .resume = yt8521_resume, ++ }, + }; + + module_phy_driver(motorcomm_phy_drvs); + +-MODULE_DESCRIPTION("Motorcomm PHY driver"); ++MODULE_DESCRIPTION("Motorcomm 8511/8521 PHY driver"); + MODULE_AUTHOR("Peter Geis"); ++MODULE_AUTHOR("Frank"); + MODULE_LICENSE("GPL"); + + static const struct mdio_device_id __maybe_unused motorcomm_tbl[] = { + { PHY_ID_MATCH_EXACT(PHY_ID_YT8511) }, ++ { PHY_ID_MATCH_EXACT(PHY_ID_YT8521) }, + { /* sentinal */ } + }; + diff --git a/target/linux/generic/backport-5.15/791-v6.2-02-net-phy-fix-yt8521-duplicated-argument-to-or.patch b/target/linux/generic/backport-5.15/791-v6.2-02-net-phy-fix-yt8521-duplicated-argument-to-or.patch new file mode 100644 index 0000000000..cce71c8d84 --- /dev/null +++ b/target/linux/generic/backport-5.15/791-v6.2-02-net-phy-fix-yt8521-duplicated-argument-to-or.patch @@ -0,0 +1,49 @@ +From 4e0243e7128c9b25ea2739136076a95d6adaba5e Mon Sep 17 00:00:00 2001 +From: Frank +Date: Fri, 4 Nov 2022 16:44:41 +0800 +Subject: [PATCH] net: phy: fix yt8521 duplicated argument to & or | + +cocci warnings: (new ones prefixed by >>) +>> drivers/net/phy/motorcomm.c:1122:8-35: duplicated argument to & or | + drivers/net/phy/motorcomm.c:1126:8-35: duplicated argument to & or | + drivers/net/phy/motorcomm.c:1130:8-34: duplicated argument to & or | + drivers/net/phy/motorcomm.c:1134:8-34: duplicated argument to & or | + + The second YT8521_RC1R_GE_TX_DELAY_xx should be YT8521_RC1R_FE_TX_DELAY_xx. + +Fixes: 70479a40954c ("net: phy: Add driver for Motorcomm yt8521 gigabit ethernet phy") +Reported-by: kernel test robot +Reported-by: Julia Lawall +Signed-off-by: Frank +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/phy/motorcomm.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/drivers/net/phy/motorcomm.c ++++ b/drivers/net/phy/motorcomm.c +@@ -1119,19 +1119,19 @@ static int yt8521_config_init(struct phy + + switch (phydev->interface) { + case PHY_INTERFACE_MODE_RGMII: +- val = YT8521_RC1R_GE_TX_DELAY_DIS | YT8521_RC1R_GE_TX_DELAY_DIS; ++ val = YT8521_RC1R_GE_TX_DELAY_DIS | YT8521_RC1R_FE_TX_DELAY_DIS; + val |= YT8521_RC1R_RX_DELAY_DIS; + break; + case PHY_INTERFACE_MODE_RGMII_RXID: +- val = YT8521_RC1R_GE_TX_DELAY_DIS | YT8521_RC1R_GE_TX_DELAY_DIS; ++ val = YT8521_RC1R_GE_TX_DELAY_DIS | YT8521_RC1R_FE_TX_DELAY_DIS; + val |= YT8521_RC1R_RX_DELAY_EN; + break; + case PHY_INTERFACE_MODE_RGMII_TXID: +- val = YT8521_RC1R_GE_TX_DELAY_EN | YT8521_RC1R_GE_TX_DELAY_EN; ++ val = YT8521_RC1R_GE_TX_DELAY_EN | YT8521_RC1R_FE_TX_DELAY_EN; + val |= YT8521_RC1R_RX_DELAY_DIS; + break; + case PHY_INTERFACE_MODE_RGMII_ID: +- val = YT8521_RC1R_GE_TX_DELAY_EN | YT8521_RC1R_GE_TX_DELAY_EN; ++ val = YT8521_RC1R_GE_TX_DELAY_EN | YT8521_RC1R_FE_TX_DELAY_EN; + val |= YT8521_RC1R_RX_DELAY_EN; + break; + case PHY_INTERFACE_MODE_SGMII: diff --git a/target/linux/generic/backport-5.15/791-v6.2-03-net-phy-add-Motorcomm-YT8531S-phy-id.patch b/target/linux/generic/backport-5.15/791-v6.2-03-net-phy-add-Motorcomm-YT8531S-phy-id.patch new file mode 100644 index 0000000000..da60c63905 --- /dev/null +++ b/target/linux/generic/backport-5.15/791-v6.2-03-net-phy-add-Motorcomm-YT8531S-phy-id.patch @@ -0,0 +1,140 @@ +From 813abcd98fb1b2cccf850cdfa092a4bfc50b2363 Mon Sep 17 00:00:00 2001 +From: Frank +Date: Tue, 22 Nov 2022 16:42:32 +0800 +Subject: [PATCH] net: phy: add Motorcomm YT8531S phy id. + +We added patch for motorcomm.c to support YT8531S. This patch has +been tested on AM335x platform which has one YT8531S interface +card and passed all test cases. +The tested cases indluding: YT8531S UTP function with support of +10M/100M/1000M; YT8531S Fiber function with support of 100M/1000M; +and YT8531S Combo function that supports auto detection of media type. + +Since most functions of YT8531S are similar to YT8521 and we reuse some +codes for YT8521 in the patch file. + +Signed-off-by: Frank +Signed-off-by: David S. Miller +--- + drivers/net/phy/Kconfig | 2 +- + drivers/net/phy/motorcomm.c | 52 +++++++++++++++++++++++++++++++++---- + 2 files changed, 48 insertions(+), 6 deletions(-) + +--- a/drivers/net/phy/Kconfig ++++ b/drivers/net/phy/Kconfig +@@ -245,7 +245,7 @@ config MOTORCOMM_PHY + tristate "Motorcomm PHYs" + help + Enables support for Motorcomm network PHYs. +- Currently supports the YT8511, YT8521 Gigabit Ethernet PHYs. ++ Currently supports the YT8511, YT8521, YT8531S Gigabit Ethernet PHYs. + + config NATIONAL_PHY + tristate "National Semiconductor PHYs" +--- a/drivers/net/phy/motorcomm.c ++++ b/drivers/net/phy/motorcomm.c +@@ -1,6 +1,6 @@ + // SPDX-License-Identifier: GPL-2.0+ + /* +- * Motorcomm 8511/8521 PHY driver. ++ * Motorcomm 8511/8521/8531S PHY driver. + * + * Author: Peter Geis + * Author: Frank +@@ -12,9 +12,10 @@ + #include + + #define PHY_ID_YT8511 0x0000010a +-#define PHY_ID_YT8521 0x0000011A ++#define PHY_ID_YT8521 0x0000011A ++#define PHY_ID_YT8531S 0x4F51E91A + +-/* YT8521 Register Overview ++/* YT8521/YT8531S Register Overview + * UTP Register space | FIBER Register space + * ------------------------------------------------------------ + * | UTP MII | FIBER MII | +@@ -147,7 +148,7 @@ + #define YT8521_LINK_TIMER_CFG2_REG 0xA5 + #define YT8521_LTCR_EN_AUTOSEN BIT(15) + +-/* 0xA000, 0xA001, 0xA003 ,and 0xA006 ~ 0xA00A are common ext registers ++/* 0xA000, 0xA001, 0xA003, 0xA006 ~ 0xA00A and 0xA012 are common ext registers + * of yt8521 phy. There is no need to switch reg space when operating these + * registers. + */ +@@ -221,6 +222,9 @@ + */ + #define YTPHY_WCR_TYPE_PULSE BIT(0) + ++#define YT8531S_SYNCE_CFG_REG 0xA012 ++#define YT8531S_SCR_SYNCE_ENABLE BIT(6) ++ + /* Extended Register end */ + + struct yt8521_priv { +@@ -648,6 +652,26 @@ static int yt8521_probe(struct phy_devic + } + + /** ++ * yt8531s_probe() - read chip config then set suitable polling_mode ++ * @phydev: a pointer to a &struct phy_device ++ * ++ * returns 0 or negative errno code ++ */ ++static int yt8531s_probe(struct phy_device *phydev) ++{ ++ int ret; ++ ++ /* Disable SyncE clock output by default */ ++ ret = ytphy_modify_ext_with_lock(phydev, YT8531S_SYNCE_CFG_REG, ++ YT8531S_SCR_SYNCE_ENABLE, 0); ++ if (ret < 0) ++ return ret; ++ ++ /* same as yt8521_probe */ ++ return yt8521_probe(phydev); ++} ++ ++/** + * ytphy_utp_read_lpa() - read LPA then setup lp_advertising for utp + * @phydev: a pointer to a &struct phy_device + * +@@ -1750,11 +1774,28 @@ static struct phy_driver motorcomm_phy_d + .suspend = yt8521_suspend, + .resume = yt8521_resume, + }, ++ { ++ PHY_ID_MATCH_EXACT(PHY_ID_YT8531S), ++ .name = "YT8531S Gigabit Ethernet", ++ .get_features = yt8521_get_features, ++ .probe = yt8531s_probe, ++ .read_page = yt8521_read_page, ++ .write_page = yt8521_write_page, ++ .get_wol = ytphy_get_wol, ++ .set_wol = ytphy_set_wol, ++ .config_aneg = yt8521_config_aneg, ++ .aneg_done = yt8521_aneg_done, ++ .config_init = yt8521_config_init, ++ .read_status = yt8521_read_status, ++ .soft_reset = yt8521_soft_reset, ++ .suspend = yt8521_suspend, ++ .resume = yt8521_resume, ++ }, + }; + + module_phy_driver(motorcomm_phy_drvs); + +-MODULE_DESCRIPTION("Motorcomm 8511/8521 PHY driver"); ++MODULE_DESCRIPTION("Motorcomm 8511/8521/8531S PHY driver"); + MODULE_AUTHOR("Peter Geis"); + MODULE_AUTHOR("Frank"); + MODULE_LICENSE("GPL"); +@@ -1762,6 +1803,7 @@ MODULE_LICENSE("GPL"); + static const struct mdio_device_id __maybe_unused motorcomm_tbl[] = { + { PHY_ID_MATCH_EXACT(PHY_ID_YT8511) }, + { PHY_ID_MATCH_EXACT(PHY_ID_YT8521) }, ++ { PHY_ID_MATCH_EXACT(PHY_ID_YT8531S) }, + { /* sentinal */ } + }; + diff --git a/target/linux/generic/backport-5.15/791-v6.3-04-net-phy-fix-the-spelling-problem-of-Sentinel.patch b/target/linux/generic/backport-5.15/791-v6.3-04-net-phy-fix-the-spelling-problem-of-Sentinel.patch new file mode 100644 index 0000000000..94fc32aadb --- /dev/null +++ b/target/linux/generic/backport-5.15/791-v6.3-04-net-phy-fix-the-spelling-problem-of-Sentinel.patch @@ -0,0 +1,26 @@ +From 4104a713204d62aca482eebb0c6226d82a0721eb Mon Sep 17 00:00:00 2001 +From: Frank Sae +Date: Sat, 28 Jan 2023 14:35:57 +0800 +Subject: [PATCH] net: phy: fix the spelling problem of Sentinel + +CHECK: 'sentinal' may be misspelled - perhaps 'sentinel'? + +Signed-off-by: Frank Sae +Reviewed-by: Andrew Lunn +Link: https://lore.kernel.org/r/20230128063558.5850-1-Frank.Sae@motor-comm.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/phy/motorcomm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/phy/motorcomm.c ++++ b/drivers/net/phy/motorcomm.c +@@ -1804,7 +1804,7 @@ static const struct mdio_device_id __may + { PHY_ID_MATCH_EXACT(PHY_ID_YT8511) }, + { PHY_ID_MATCH_EXACT(PHY_ID_YT8521) }, + { PHY_ID_MATCH_EXACT(PHY_ID_YT8531S) }, +- { /* sentinal */ } ++ { /* sentinel */ } + }; + + MODULE_DEVICE_TABLE(mdio, motorcomm_tbl); diff --git a/target/linux/generic/backport-5.15/791-v6.3-05-net-phy-motorcomm-change-the-phy-id-of-yt8521-and-yt8531s.patch b/target/linux/generic/backport-5.15/791-v6.3-05-net-phy-motorcomm-change-the-phy-id-of-yt8521-and-yt8531s.patch new file mode 100644 index 0000000000..076fa82d26 --- /dev/null +++ b/target/linux/generic/backport-5.15/791-v6.3-05-net-phy-motorcomm-change-the-phy-id-of-yt8521-and-yt8531s.patch @@ -0,0 +1,29 @@ +From 3c1dc22162d673d595855d24f95200ed2643f88f Mon Sep 17 00:00:00 2001 +From: Frank Sae +Date: Sat, 28 Jan 2023 14:35:58 +0800 +Subject: [PATCH] net: phy: motorcomm: change the phy id of yt8521 and yt8531s + to lowercase + +The phy id is usually defined in lower case. + +Signed-off-by: Frank Sae +Reviewed-by: Andrew Lunn +Link: https://lore.kernel.org/r/20230128063558.5850-2-Frank.Sae@motor-comm.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/phy/motorcomm.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/net/phy/motorcomm.c ++++ b/drivers/net/phy/motorcomm.c +@@ -12,8 +12,8 @@ + #include + + #define PHY_ID_YT8511 0x0000010a +-#define PHY_ID_YT8521 0x0000011A +-#define PHY_ID_YT8531S 0x4F51E91A ++#define PHY_ID_YT8521 0x0000011a ++#define PHY_ID_YT8531S 0x4f51e91a + + /* YT8521/YT8531S Register Overview + * UTP Register space | FIBER Register space diff --git a/target/linux/generic/backport-5.15/791-v6.3-06-net-phy-Add-BIT-macro-for-Motorcomm-yt8521-yt8531-gigabit.patch b/target/linux/generic/backport-5.15/791-v6.3-06-net-phy-Add-BIT-macro-for-Motorcomm-yt8521-yt8531-gigabit.patch new file mode 100644 index 0000000000..ba9a6ab4cc --- /dev/null +++ b/target/linux/generic/backport-5.15/791-v6.3-06-net-phy-Add-BIT-macro-for-Motorcomm-yt8521-yt8531-gigabit.patch @@ -0,0 +1,107 @@ +From 4869a146cd60fc8115230f0a45e15e534c531922 Mon Sep 17 00:00:00 2001 +From: Frank Sae +Date: Thu, 2 Feb 2023 11:00:34 +0800 +Subject: [PATCH] net: phy: Add BIT macro for Motorcomm yt8521/yt8531 gigabit + ethernet phy + +Add BIT macro for Motorcomm yt8521/yt8531 gigabit ethernet phy. + This is a preparatory patch. Add BIT macro for 0xA012 reg, and + supplement for 0xA001 and 0xA003 reg. These will be used to support dts. + +Signed-off-by: Frank Sae +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/phy/motorcomm.c | 55 ++++++++++++++++++++++++++++++++++--- + 1 file changed, 51 insertions(+), 4 deletions(-) + +--- a/drivers/net/phy/motorcomm.c ++++ b/drivers/net/phy/motorcomm.c +@@ -161,6 +161,11 @@ + + #define YT8521_CHIP_CONFIG_REG 0xA001 + #define YT8521_CCR_SW_RST BIT(15) ++/* 1b0 disable 1.9ns rxc clock delay *default* ++ * 1b1 enable 1.9ns rxc clock delay ++ */ ++#define YT8521_CCR_RXC_DLY_EN BIT(8) ++#define YT8521_CCR_RXC_DLY_1_900_NS 1900 + + #define YT8521_CCR_MODE_SEL_MASK (BIT(2) | BIT(1) | BIT(0)) + #define YT8521_CCR_MODE_UTP_TO_RGMII 0 +@@ -178,22 +183,41 @@ + #define YT8521_MODE_POLL 0x3 + + #define YT8521_RGMII_CONFIG1_REG 0xA003 +- ++/* 1b0 use original tx_clk_rgmii *default* ++ * 1b1 use inverted tx_clk_rgmii. ++ */ ++#define YT8521_RC1R_TX_CLK_SEL_INVERTED BIT(14) + /* TX Gig-E Delay is bits 3:0, default 0x1 + * TX Fast-E Delay is bits 7:4, default 0xf + * RX Delay is bits 13:10, default 0x0 + * Delay = 150ps * N + * On = 2250ps, off = 0ps + */ +-#define YT8521_RC1R_RX_DELAY_MASK (0xF << 10) ++#define YT8521_RC1R_RX_DELAY_MASK GENMASK(13, 10) + #define YT8521_RC1R_RX_DELAY_EN (0xF << 10) + #define YT8521_RC1R_RX_DELAY_DIS (0x0 << 10) +-#define YT8521_RC1R_FE_TX_DELAY_MASK (0xF << 4) ++#define YT8521_RC1R_FE_TX_DELAY_MASK GENMASK(7, 4) + #define YT8521_RC1R_FE_TX_DELAY_EN (0xF << 4) + #define YT8521_RC1R_FE_TX_DELAY_DIS (0x0 << 4) +-#define YT8521_RC1R_GE_TX_DELAY_MASK (0xF << 0) ++#define YT8521_RC1R_GE_TX_DELAY_MASK GENMASK(3, 0) + #define YT8521_RC1R_GE_TX_DELAY_EN (0xF << 0) + #define YT8521_RC1R_GE_TX_DELAY_DIS (0x0 << 0) ++#define YT8521_RC1R_RGMII_0_000_NS 0 ++#define YT8521_RC1R_RGMII_0_150_NS 1 ++#define YT8521_RC1R_RGMII_0_300_NS 2 ++#define YT8521_RC1R_RGMII_0_450_NS 3 ++#define YT8521_RC1R_RGMII_0_600_NS 4 ++#define YT8521_RC1R_RGMII_0_750_NS 5 ++#define YT8521_RC1R_RGMII_0_900_NS 6 ++#define YT8521_RC1R_RGMII_1_050_NS 7 ++#define YT8521_RC1R_RGMII_1_200_NS 8 ++#define YT8521_RC1R_RGMII_1_350_NS 9 ++#define YT8521_RC1R_RGMII_1_500_NS 10 ++#define YT8521_RC1R_RGMII_1_650_NS 11 ++#define YT8521_RC1R_RGMII_1_800_NS 12 ++#define YT8521_RC1R_RGMII_1_950_NS 13 ++#define YT8521_RC1R_RGMII_2_100_NS 14 ++#define YT8521_RC1R_RGMII_2_250_NS 15 + + #define YTPHY_MISC_CONFIG_REG 0xA006 + #define YTPHY_MCR_FIBER_SPEED_MASK BIT(0) +@@ -222,6 +246,29 @@ + */ + #define YTPHY_WCR_TYPE_PULSE BIT(0) + ++#define YTPHY_SYNCE_CFG_REG 0xA012 ++#define YT8521_SCR_SYNCE_ENABLE BIT(5) ++/* 1b0 output 25m clock ++ * 1b1 output 125m clock *default* ++ */ ++#define YT8521_SCR_CLK_FRE_SEL_125M BIT(3) ++#define YT8521_SCR_CLK_SRC_MASK GENMASK(2, 1) ++#define YT8521_SCR_CLK_SRC_PLL_125M 0 ++#define YT8521_SCR_CLK_SRC_UTP_RX 1 ++#define YT8521_SCR_CLK_SRC_SDS_RX 2 ++#define YT8521_SCR_CLK_SRC_REF_25M 3 ++#define YT8531_SCR_SYNCE_ENABLE BIT(6) ++/* 1b0 output 25m clock *default* ++ * 1b1 output 125m clock ++ */ ++#define YT8531_SCR_CLK_FRE_SEL_125M BIT(4) ++#define YT8531_SCR_CLK_SRC_MASK GENMASK(3, 1) ++#define YT8531_SCR_CLK_SRC_PLL_125M 0 ++#define YT8531_SCR_CLK_SRC_UTP_RX 1 ++#define YT8531_SCR_CLK_SRC_SDS_RX 2 ++#define YT8531_SCR_CLK_SRC_CLOCK_FROM_DIGITAL 3 ++#define YT8531_SCR_CLK_SRC_REF_25M 4 ++#define YT8531_SCR_CLK_SRC_SSC_25M 5 + #define YT8531S_SYNCE_CFG_REG 0xA012 + #define YT8531S_SCR_SYNCE_ENABLE BIT(6) + diff --git a/target/linux/generic/backport-5.15/791-v6.3-07-net-phy-Add-dts-support-for-Motorcomm-yt8521-gigabit.patch b/target/linux/generic/backport-5.15/791-v6.3-07-net-phy-Add-dts-support-for-Motorcomm-yt8521-gigabit.patch new file mode 100644 index 0000000000..6d89fae84c --- /dev/null +++ b/target/linux/generic/backport-5.15/791-v6.3-07-net-phy-Add-dts-support-for-Motorcomm-yt8521-gigabit.patch @@ -0,0 +1,343 @@ +From a6e68f0f8769f79c67cdcfb6302feecd36197dec Mon Sep 17 00:00:00 2001 +From: Frank Sae +Date: Thu, 2 Feb 2023 11:00:35 +0800 +Subject: [PATCH] net: phy: Add dts support for Motorcomm yt8521 gigabit + ethernet phy + +Add dts support for Motorcomm yt8521 gigabit ethernet phy. + Add ytphy_rgmii_clk_delay_config function to support dst config for + the delay of rgmii clk. This funciont is common for yt8521, yt8531s + and yt8531. + This patch has been verified on AM335x platform. + +Signed-off-by: Frank Sae +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/phy/motorcomm.c | 253 ++++++++++++++++++++++++++++-------- + 1 file changed, 199 insertions(+), 54 deletions(-) + +--- a/drivers/net/phy/motorcomm.c ++++ b/drivers/net/phy/motorcomm.c +@@ -10,6 +10,7 @@ + #include + #include + #include ++#include + + #define PHY_ID_YT8511 0x0000010a + #define PHY_ID_YT8521 0x0000011a +@@ -187,21 +188,9 @@ + * 1b1 use inverted tx_clk_rgmii. + */ + #define YT8521_RC1R_TX_CLK_SEL_INVERTED BIT(14) +-/* TX Gig-E Delay is bits 3:0, default 0x1 +- * TX Fast-E Delay is bits 7:4, default 0xf +- * RX Delay is bits 13:10, default 0x0 +- * Delay = 150ps * N +- * On = 2250ps, off = 0ps +- */ + #define YT8521_RC1R_RX_DELAY_MASK GENMASK(13, 10) +-#define YT8521_RC1R_RX_DELAY_EN (0xF << 10) +-#define YT8521_RC1R_RX_DELAY_DIS (0x0 << 10) + #define YT8521_RC1R_FE_TX_DELAY_MASK GENMASK(7, 4) +-#define YT8521_RC1R_FE_TX_DELAY_EN (0xF << 4) +-#define YT8521_RC1R_FE_TX_DELAY_DIS (0x0 << 4) + #define YT8521_RC1R_GE_TX_DELAY_MASK GENMASK(3, 0) +-#define YT8521_RC1R_GE_TX_DELAY_EN (0xF << 0) +-#define YT8521_RC1R_GE_TX_DELAY_DIS (0x0 << 0) + #define YT8521_RC1R_RGMII_0_000_NS 0 + #define YT8521_RC1R_RGMII_0_150_NS 1 + #define YT8521_RC1R_RGMII_0_300_NS 2 +@@ -274,6 +263,10 @@ + + /* Extended Register end */ + ++#define YTPHY_DTS_OUTPUT_CLK_DIS 0 ++#define YTPHY_DTS_OUTPUT_CLK_25M 25000000 ++#define YTPHY_DTS_OUTPUT_CLK_125M 125000000 ++ + struct yt8521_priv { + /* combo_advertising is used for case of YT8521 in combo mode, + * this means that yt8521 may work in utp or fiber mode which depends +@@ -641,6 +634,142 @@ static int yt8521_write_page(struct phy_ + }; + + /** ++ * struct ytphy_cfg_reg_map - map a config value to a register value ++ * @cfg: value in device configuration ++ * @reg: value in the register ++ */ ++struct ytphy_cfg_reg_map { ++ u32 cfg; ++ u32 reg; ++}; ++ ++static const struct ytphy_cfg_reg_map ytphy_rgmii_delays[] = { ++ /* for tx delay / rx delay with YT8521_CCR_RXC_DLY_EN is not set. */ ++ { 0, YT8521_RC1R_RGMII_0_000_NS }, ++ { 150, YT8521_RC1R_RGMII_0_150_NS }, ++ { 300, YT8521_RC1R_RGMII_0_300_NS }, ++ { 450, YT8521_RC1R_RGMII_0_450_NS }, ++ { 600, YT8521_RC1R_RGMII_0_600_NS }, ++ { 750, YT8521_RC1R_RGMII_0_750_NS }, ++ { 900, YT8521_RC1R_RGMII_0_900_NS }, ++ { 1050, YT8521_RC1R_RGMII_1_050_NS }, ++ { 1200, YT8521_RC1R_RGMII_1_200_NS }, ++ { 1350, YT8521_RC1R_RGMII_1_350_NS }, ++ { 1500, YT8521_RC1R_RGMII_1_500_NS }, ++ { 1650, YT8521_RC1R_RGMII_1_650_NS }, ++ { 1800, YT8521_RC1R_RGMII_1_800_NS }, ++ { 1950, YT8521_RC1R_RGMII_1_950_NS }, /* default tx/rx delay */ ++ { 2100, YT8521_RC1R_RGMII_2_100_NS }, ++ { 2250, YT8521_RC1R_RGMII_2_250_NS }, ++ ++ /* only for rx delay with YT8521_CCR_RXC_DLY_EN is set. */ ++ { 0 + YT8521_CCR_RXC_DLY_1_900_NS, YT8521_RC1R_RGMII_0_000_NS }, ++ { 150 + YT8521_CCR_RXC_DLY_1_900_NS, YT8521_RC1R_RGMII_0_150_NS }, ++ { 300 + YT8521_CCR_RXC_DLY_1_900_NS, YT8521_RC1R_RGMII_0_300_NS }, ++ { 450 + YT8521_CCR_RXC_DLY_1_900_NS, YT8521_RC1R_RGMII_0_450_NS }, ++ { 600 + YT8521_CCR_RXC_DLY_1_900_NS, YT8521_RC1R_RGMII_0_600_NS }, ++ { 750 + YT8521_CCR_RXC_DLY_1_900_NS, YT8521_RC1R_RGMII_0_750_NS }, ++ { 900 + YT8521_CCR_RXC_DLY_1_900_NS, YT8521_RC1R_RGMII_0_900_NS }, ++ { 1050 + YT8521_CCR_RXC_DLY_1_900_NS, YT8521_RC1R_RGMII_1_050_NS }, ++ { 1200 + YT8521_CCR_RXC_DLY_1_900_NS, YT8521_RC1R_RGMII_1_200_NS }, ++ { 1350 + YT8521_CCR_RXC_DLY_1_900_NS, YT8521_RC1R_RGMII_1_350_NS }, ++ { 1500 + YT8521_CCR_RXC_DLY_1_900_NS, YT8521_RC1R_RGMII_1_500_NS }, ++ { 1650 + YT8521_CCR_RXC_DLY_1_900_NS, YT8521_RC1R_RGMII_1_650_NS }, ++ { 1800 + YT8521_CCR_RXC_DLY_1_900_NS, YT8521_RC1R_RGMII_1_800_NS }, ++ { 1950 + YT8521_CCR_RXC_DLY_1_900_NS, YT8521_RC1R_RGMII_1_950_NS }, ++ { 2100 + YT8521_CCR_RXC_DLY_1_900_NS, YT8521_RC1R_RGMII_2_100_NS }, ++ { 2250 + YT8521_CCR_RXC_DLY_1_900_NS, YT8521_RC1R_RGMII_2_250_NS } ++}; ++ ++static u32 ytphy_get_delay_reg_value(struct phy_device *phydev, ++ const char *prop_name, ++ const struct ytphy_cfg_reg_map *tbl, ++ int tb_size, ++ u16 *rxc_dly_en, ++ u32 dflt) ++{ ++ struct device_node *node = phydev->mdio.dev.of_node; ++ int tb_size_half = tb_size / 2; ++ u32 val; ++ int i; ++ ++ if (of_property_read_u32(node, prop_name, &val)) ++ goto err_dts_val; ++ ++ /* when rxc_dly_en is NULL, it is get the delay for tx, only half of ++ * tb_size is valid. ++ */ ++ if (!rxc_dly_en) ++ tb_size = tb_size_half; ++ ++ for (i = 0; i < tb_size; i++) { ++ if (tbl[i].cfg == val) { ++ if (rxc_dly_en && i < tb_size_half) ++ *rxc_dly_en = 0; ++ return tbl[i].reg; ++ } ++ } ++ ++ phydev_warn(phydev, "Unsupported value %d for %s using default (%u)\n", ++ val, prop_name, dflt); ++ ++err_dts_val: ++ /* when rxc_dly_en is not NULL, it is get the delay for rx. ++ * The rx default in dts and ytphy_rgmii_clk_delay_config is 1950 ps, ++ * so YT8521_CCR_RXC_DLY_EN should not be set. ++ */ ++ if (rxc_dly_en) ++ *rxc_dly_en = 0; ++ ++ return dflt; ++} ++ ++static int ytphy_rgmii_clk_delay_config(struct phy_device *phydev) ++{ ++ int tb_size = ARRAY_SIZE(ytphy_rgmii_delays); ++ u16 rxc_dly_en = YT8521_CCR_RXC_DLY_EN; ++ u32 rx_reg, tx_reg; ++ u16 mask, val = 0; ++ int ret; ++ ++ rx_reg = ytphy_get_delay_reg_value(phydev, "rx-internal-delay-ps", ++ ytphy_rgmii_delays, tb_size, ++ &rxc_dly_en, ++ YT8521_RC1R_RGMII_1_950_NS); ++ tx_reg = ytphy_get_delay_reg_value(phydev, "tx-internal-delay-ps", ++ ytphy_rgmii_delays, tb_size, NULL, ++ YT8521_RC1R_RGMII_1_950_NS); ++ ++ switch (phydev->interface) { ++ case PHY_INTERFACE_MODE_RGMII: ++ rxc_dly_en = 0; ++ break; ++ case PHY_INTERFACE_MODE_RGMII_RXID: ++ val |= FIELD_PREP(YT8521_RC1R_RX_DELAY_MASK, rx_reg); ++ break; ++ case PHY_INTERFACE_MODE_RGMII_TXID: ++ rxc_dly_en = 0; ++ val |= FIELD_PREP(YT8521_RC1R_GE_TX_DELAY_MASK, tx_reg); ++ break; ++ case PHY_INTERFACE_MODE_RGMII_ID: ++ val |= FIELD_PREP(YT8521_RC1R_RX_DELAY_MASK, rx_reg) | ++ FIELD_PREP(YT8521_RC1R_GE_TX_DELAY_MASK, tx_reg); ++ break; ++ default: /* do not support other modes */ ++ return -EOPNOTSUPP; ++ } ++ ++ ret = ytphy_modify_ext(phydev, YT8521_CHIP_CONFIG_REG, ++ YT8521_CCR_RXC_DLY_EN, rxc_dly_en); ++ if (ret < 0) ++ return ret; ++ ++ /* Generally, it is not necessary to adjust YT8521_RC1R_FE_TX_DELAY */ ++ mask = YT8521_RC1R_RX_DELAY_MASK | YT8521_RC1R_GE_TX_DELAY_MASK; ++ return ytphy_modify_ext(phydev, YT8521_RGMII_CONFIG1_REG, mask, val); ++} ++ ++/** + * yt8521_probe() - read chip config then set suitable polling_mode + * @phydev: a pointer to a &struct phy_device + * +@@ -648,9 +777,12 @@ static int yt8521_write_page(struct phy_ + */ + static int yt8521_probe(struct phy_device *phydev) + { ++ struct device_node *node = phydev->mdio.dev.of_node; + struct device *dev = &phydev->mdio.dev; + struct yt8521_priv *priv; + int chip_config; ++ u16 mask, val; ++ u32 freq; + int ret; + + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); +@@ -695,7 +827,45 @@ static int yt8521_probe(struct phy_devic + return ret; + } + +- return 0; ++ if (of_property_read_u32(node, "motorcomm,clk-out-frequency-hz", &freq)) ++ freq = YTPHY_DTS_OUTPUT_CLK_DIS; ++ ++ if (phydev->drv->phy_id == PHY_ID_YT8521) { ++ switch (freq) { ++ case YTPHY_DTS_OUTPUT_CLK_DIS: ++ mask = YT8521_SCR_SYNCE_ENABLE; ++ val = 0; ++ break; ++ case YTPHY_DTS_OUTPUT_CLK_25M: ++ mask = YT8521_SCR_SYNCE_ENABLE | ++ YT8521_SCR_CLK_SRC_MASK | ++ YT8521_SCR_CLK_FRE_SEL_125M; ++ val = YT8521_SCR_SYNCE_ENABLE | ++ FIELD_PREP(YT8521_SCR_CLK_SRC_MASK, ++ YT8521_SCR_CLK_SRC_REF_25M); ++ break; ++ case YTPHY_DTS_OUTPUT_CLK_125M: ++ mask = YT8521_SCR_SYNCE_ENABLE | ++ YT8521_SCR_CLK_SRC_MASK | ++ YT8521_SCR_CLK_FRE_SEL_125M; ++ val = YT8521_SCR_SYNCE_ENABLE | ++ YT8521_SCR_CLK_FRE_SEL_125M | ++ FIELD_PREP(YT8521_SCR_CLK_SRC_MASK, ++ YT8521_SCR_CLK_SRC_PLL_125M); ++ break; ++ default: ++ phydev_warn(phydev, "Freq err:%u\n", freq); ++ return -EINVAL; ++ } ++ } else if (phydev->drv->phy_id == PHY_ID_YT8531S) { ++ return 0; ++ } else { ++ phydev_warn(phydev, "PHY id err\n"); ++ return -EINVAL; ++ } ++ ++ return ytphy_modify_ext_with_lock(phydev, YTPHY_SYNCE_CFG_REG, mask, ++ val); + } + + /** +@@ -1180,61 +1350,36 @@ static int yt8521_resume(struct phy_devi + */ + static int yt8521_config_init(struct phy_device *phydev) + { ++ struct device_node *node = phydev->mdio.dev.of_node; + int old_page; + int ret = 0; +- u16 val; + + old_page = phy_select_page(phydev, YT8521_RSSR_UTP_SPACE); + if (old_page < 0) + goto err_restore_page; + +- switch (phydev->interface) { +- case PHY_INTERFACE_MODE_RGMII: +- val = YT8521_RC1R_GE_TX_DELAY_DIS | YT8521_RC1R_FE_TX_DELAY_DIS; +- val |= YT8521_RC1R_RX_DELAY_DIS; +- break; +- case PHY_INTERFACE_MODE_RGMII_RXID: +- val = YT8521_RC1R_GE_TX_DELAY_DIS | YT8521_RC1R_FE_TX_DELAY_DIS; +- val |= YT8521_RC1R_RX_DELAY_EN; +- break; +- case PHY_INTERFACE_MODE_RGMII_TXID: +- val = YT8521_RC1R_GE_TX_DELAY_EN | YT8521_RC1R_FE_TX_DELAY_EN; +- val |= YT8521_RC1R_RX_DELAY_DIS; +- break; +- case PHY_INTERFACE_MODE_RGMII_ID: +- val = YT8521_RC1R_GE_TX_DELAY_EN | YT8521_RC1R_FE_TX_DELAY_EN; +- val |= YT8521_RC1R_RX_DELAY_EN; +- break; +- case PHY_INTERFACE_MODE_SGMII: +- break; +- default: /* do not support other modes */ +- ret = -EOPNOTSUPP; +- goto err_restore_page; +- } +- + /* set rgmii delay mode */ + if (phydev->interface != PHY_INTERFACE_MODE_SGMII) { +- ret = ytphy_modify_ext(phydev, YT8521_RGMII_CONFIG1_REG, +- (YT8521_RC1R_RX_DELAY_MASK | +- YT8521_RC1R_FE_TX_DELAY_MASK | +- YT8521_RC1R_GE_TX_DELAY_MASK), +- val); ++ ret = ytphy_rgmii_clk_delay_config(phydev); + if (ret < 0) + goto err_restore_page; + } + +- /* disable auto sleep */ +- ret = ytphy_modify_ext(phydev, YT8521_EXTREG_SLEEP_CONTROL1_REG, +- YT8521_ESC1R_SLEEP_SW, 0); +- if (ret < 0) +- goto err_restore_page; +- +- /* enable RXC clock when no wire plug */ +- ret = ytphy_modify_ext(phydev, YT8521_CLOCK_GATING_REG, +- YT8521_CGR_RX_CLK_EN, 0); +- if (ret < 0) +- goto err_restore_page; ++ if (of_property_read_bool(node, "motorcomm,auto-sleep-disabled")) { ++ /* disable auto sleep */ ++ ret = ytphy_modify_ext(phydev, YT8521_EXTREG_SLEEP_CONTROL1_REG, ++ YT8521_ESC1R_SLEEP_SW, 0); ++ if (ret < 0) ++ goto err_restore_page; ++ } + ++ if (of_property_read_bool(node, "motorcomm,keep-pll-enabled")) { ++ /* enable RXC clock when no wire plug */ ++ ret = ytphy_modify_ext(phydev, YT8521_CLOCK_GATING_REG, ++ YT8521_CGR_RX_CLK_EN, 0); ++ if (ret < 0) ++ goto err_restore_page; ++ } + err_restore_page: + return phy_restore_page(phydev, old_page, ret); + } diff --git a/target/linux/generic/backport-5.15/791-v6.3-08-net-phy-Add-dts-support-for-Motorcomm-yt8531s-gigabit.patch b/target/linux/generic/backport-5.15/791-v6.3-08-net-phy-Add-dts-support-for-Motorcomm-yt8531s-gigabit.patch new file mode 100644 index 0000000000..86fc04695c --- /dev/null +++ b/target/linux/generic/backport-5.15/791-v6.3-08-net-phy-Add-dts-support-for-Motorcomm-yt8531s-gigabit.patch @@ -0,0 +1,100 @@ +From 36152f87dda4af221b16258751451d9cd3d0fb0b Mon Sep 17 00:00:00 2001 +From: Frank Sae +Date: Thu, 2 Feb 2023 11:00:36 +0800 +Subject: [PATCH] net: phy: Add dts support for Motorcomm yt8531s gigabit + ethernet phy + +Add dts support for Motorcomm yt8531s gigabit ethernet phy. + Change yt8521_probe to support clk config of yt8531s. Becase + yt8521_probe does the things which yt8531s is needed, so + removed yt8531s function. + This patch has been verified on AM335x platform with yt8531s board. + +Signed-off-by: Frank Sae +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/phy/motorcomm.c | 51 ++++++++++++++++++++----------------- + 1 file changed, 27 insertions(+), 24 deletions(-) + +--- a/drivers/net/phy/motorcomm.c ++++ b/drivers/net/phy/motorcomm.c +@@ -258,8 +258,6 @@ + #define YT8531_SCR_CLK_SRC_CLOCK_FROM_DIGITAL 3 + #define YT8531_SCR_CLK_SRC_REF_25M 4 + #define YT8531_SCR_CLK_SRC_SSC_25M 5 +-#define YT8531S_SYNCE_CFG_REG 0xA012 +-#define YT8531S_SCR_SYNCE_ENABLE BIT(6) + + /* Extended Register end */ + +@@ -858,7 +856,32 @@ static int yt8521_probe(struct phy_devic + return -EINVAL; + } + } else if (phydev->drv->phy_id == PHY_ID_YT8531S) { +- return 0; ++ switch (freq) { ++ case YTPHY_DTS_OUTPUT_CLK_DIS: ++ mask = YT8531_SCR_SYNCE_ENABLE; ++ val = 0; ++ break; ++ case YTPHY_DTS_OUTPUT_CLK_25M: ++ mask = YT8531_SCR_SYNCE_ENABLE | ++ YT8531_SCR_CLK_SRC_MASK | ++ YT8531_SCR_CLK_FRE_SEL_125M; ++ val = YT8531_SCR_SYNCE_ENABLE | ++ FIELD_PREP(YT8531_SCR_CLK_SRC_MASK, ++ YT8531_SCR_CLK_SRC_REF_25M); ++ break; ++ case YTPHY_DTS_OUTPUT_CLK_125M: ++ mask = YT8531_SCR_SYNCE_ENABLE | ++ YT8531_SCR_CLK_SRC_MASK | ++ YT8531_SCR_CLK_FRE_SEL_125M; ++ val = YT8531_SCR_SYNCE_ENABLE | ++ YT8531_SCR_CLK_FRE_SEL_125M | ++ FIELD_PREP(YT8531_SCR_CLK_SRC_MASK, ++ YT8531_SCR_CLK_SRC_PLL_125M); ++ break; ++ default: ++ phydev_warn(phydev, "Freq err:%u\n", freq); ++ return -EINVAL; ++ } + } else { + phydev_warn(phydev, "PHY id err\n"); + return -EINVAL; +@@ -869,26 +892,6 @@ static int yt8521_probe(struct phy_devic + } + + /** +- * yt8531s_probe() - read chip config then set suitable polling_mode +- * @phydev: a pointer to a &struct phy_device +- * +- * returns 0 or negative errno code +- */ +-static int yt8531s_probe(struct phy_device *phydev) +-{ +- int ret; +- +- /* Disable SyncE clock output by default */ +- ret = ytphy_modify_ext_with_lock(phydev, YT8531S_SYNCE_CFG_REG, +- YT8531S_SCR_SYNCE_ENABLE, 0); +- if (ret < 0) +- return ret; +- +- /* same as yt8521_probe */ +- return yt8521_probe(phydev); +-} +- +-/** + * ytphy_utp_read_lpa() - read LPA then setup lp_advertising for utp + * @phydev: a pointer to a &struct phy_device + * +@@ -1970,7 +1973,7 @@ static struct phy_driver motorcomm_phy_d + PHY_ID_MATCH_EXACT(PHY_ID_YT8531S), + .name = "YT8531S Gigabit Ethernet", + .get_features = yt8521_get_features, +- .probe = yt8531s_probe, ++ .probe = yt8521_probe, + .read_page = yt8521_read_page, + .write_page = yt8521_write_page, + .get_wol = ytphy_get_wol, diff --git a/target/linux/generic/backport-5.15/791-v6.3-09-net-phy-Add-driver-for-Motorcomm-yt8531-gigabit-ethernet.patch b/target/linux/generic/backport-5.15/791-v6.3-09-net-phy-Add-driver-for-Motorcomm-yt8531-gigabit-ethernet.patch new file mode 100644 index 0000000000..9dce5a8add --- /dev/null +++ b/target/linux/generic/backport-5.15/791-v6.3-09-net-phy-Add-driver-for-Motorcomm-yt8531-gigabit-ethernet.patch @@ -0,0 +1,302 @@ +From 4ac94f728a588e7096dd5010cd7141a309ea7805 Mon Sep 17 00:00:00 2001 +From: Frank Sae +Date: Thu, 2 Feb 2023 11:00:37 +0800 +Subject: [PATCH] net: phy: Add driver for Motorcomm yt8531 gigabit ethernet + phy + +Add a driver for the motorcomm yt8531 gigabit ethernet phy. We have + verified the driver on AM335x platform with yt8531 board. On the + board, yt8531 gigabit ethernet phy works in utp mode, RGMII + interface, supports 1000M/100M/10M speeds, and wol(magic package). + +Signed-off-by: Frank Sae +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/phy/Kconfig | 2 +- + drivers/net/phy/motorcomm.c | 208 +++++++++++++++++++++++++++++++++++- + 2 files changed, 207 insertions(+), 3 deletions(-) + +--- a/drivers/net/phy/Kconfig ++++ b/drivers/net/phy/Kconfig +@@ -245,7 +245,7 @@ config MOTORCOMM_PHY + tristate "Motorcomm PHYs" + help + Enables support for Motorcomm network PHYs. +- Currently supports the YT8511, YT8521, YT8531S Gigabit Ethernet PHYs. ++ Currently supports YT85xx Gigabit Ethernet PHYs. + + config NATIONAL_PHY + tristate "National Semiconductor PHYs" +--- a/drivers/net/phy/motorcomm.c ++++ b/drivers/net/phy/motorcomm.c +@@ -1,6 +1,6 @@ + // SPDX-License-Identifier: GPL-2.0+ + /* +- * Motorcomm 8511/8521/8531S PHY driver. ++ * Motorcomm 8511/8521/8531/8531S PHY driver. + * + * Author: Peter Geis + * Author: Frank +@@ -14,6 +14,7 @@ + + #define PHY_ID_YT8511 0x0000010a + #define PHY_ID_YT8521 0x0000011a ++#define PHY_ID_YT8531 0x4f51e91b + #define PHY_ID_YT8531S 0x4f51e91a + + /* YT8521/YT8531S Register Overview +@@ -517,6 +518,61 @@ err_restore_page: + return phy_restore_page(phydev, old_page, ret); + } + ++static int yt8531_set_wol(struct phy_device *phydev, ++ struct ethtool_wolinfo *wol) ++{ ++ const u16 mac_addr_reg[] = { ++ YTPHY_WOL_MACADDR2_REG, ++ YTPHY_WOL_MACADDR1_REG, ++ YTPHY_WOL_MACADDR0_REG, ++ }; ++ const u8 *mac_addr; ++ u16 mask, val; ++ int ret; ++ u8 i; ++ ++ if (wol->wolopts & WAKE_MAGIC) { ++ mac_addr = phydev->attached_dev->dev_addr; ++ ++ /* Store the device address for the magic packet */ ++ for (i = 0; i < 3; i++) { ++ ret = ytphy_write_ext_with_lock(phydev, mac_addr_reg[i], ++ ((mac_addr[i * 2] << 8)) | ++ (mac_addr[i * 2 + 1])); ++ if (ret < 0) ++ return ret; ++ } ++ ++ /* Enable WOL feature */ ++ mask = YTPHY_WCR_PULSE_WIDTH_MASK | YTPHY_WCR_INTR_SEL; ++ val = YTPHY_WCR_ENABLE | YTPHY_WCR_INTR_SEL; ++ val |= YTPHY_WCR_TYPE_PULSE | YTPHY_WCR_PULSE_WIDTH_672MS; ++ ret = ytphy_modify_ext_with_lock(phydev, YTPHY_WOL_CONFIG_REG, ++ mask, val); ++ if (ret < 0) ++ return ret; ++ ++ /* Enable WOL interrupt */ ++ ret = phy_modify(phydev, YTPHY_INTERRUPT_ENABLE_REG, 0, ++ YTPHY_IER_WOL); ++ if (ret < 0) ++ return ret; ++ } else { ++ /* Disable WOL feature */ ++ mask = YTPHY_WCR_ENABLE | YTPHY_WCR_INTR_SEL; ++ ret = ytphy_modify_ext_with_lock(phydev, YTPHY_WOL_CONFIG_REG, ++ mask, 0); ++ ++ /* Disable WOL interrupt */ ++ ret = phy_modify(phydev, YTPHY_INTERRUPT_ENABLE_REG, ++ YTPHY_IER_WOL, 0); ++ if (ret < 0) ++ return ret; ++ } ++ ++ return 0; ++} ++ + static int yt8511_read_page(struct phy_device *phydev) + { + return __phy_read(phydev, YT8511_PAGE_SELECT); +@@ -767,6 +823,17 @@ static int ytphy_rgmii_clk_delay_config( + return ytphy_modify_ext(phydev, YT8521_RGMII_CONFIG1_REG, mask, val); + } + ++static int ytphy_rgmii_clk_delay_config_with_lock(struct phy_device *phydev) ++{ ++ int ret; ++ ++ phy_lock_mdio_bus(phydev); ++ ret = ytphy_rgmii_clk_delay_config(phydev); ++ phy_unlock_mdio_bus(phydev); ++ ++ return ret; ++} ++ + /** + * yt8521_probe() - read chip config then set suitable polling_mode + * @phydev: a pointer to a &struct phy_device +@@ -891,6 +958,43 @@ static int yt8521_probe(struct phy_devic + val); + } + ++static int yt8531_probe(struct phy_device *phydev) ++{ ++ struct device_node *node = phydev->mdio.dev.of_node; ++ u16 mask, val; ++ u32 freq; ++ ++ if (of_property_read_u32(node, "motorcomm,clk-out-frequency-hz", &freq)) ++ freq = YTPHY_DTS_OUTPUT_CLK_DIS; ++ ++ switch (freq) { ++ case YTPHY_DTS_OUTPUT_CLK_DIS: ++ mask = YT8531_SCR_SYNCE_ENABLE; ++ val = 0; ++ break; ++ case YTPHY_DTS_OUTPUT_CLK_25M: ++ mask = YT8531_SCR_SYNCE_ENABLE | YT8531_SCR_CLK_SRC_MASK | ++ YT8531_SCR_CLK_FRE_SEL_125M; ++ val = YT8531_SCR_SYNCE_ENABLE | ++ FIELD_PREP(YT8531_SCR_CLK_SRC_MASK, ++ YT8531_SCR_CLK_SRC_REF_25M); ++ break; ++ case YTPHY_DTS_OUTPUT_CLK_125M: ++ mask = YT8531_SCR_SYNCE_ENABLE | YT8531_SCR_CLK_SRC_MASK | ++ YT8531_SCR_CLK_FRE_SEL_125M; ++ val = YT8531_SCR_SYNCE_ENABLE | YT8531_SCR_CLK_FRE_SEL_125M | ++ FIELD_PREP(YT8531_SCR_CLK_SRC_MASK, ++ YT8531_SCR_CLK_SRC_PLL_125M); ++ break; ++ default: ++ phydev_warn(phydev, "Freq err:%u\n", freq); ++ return -EINVAL; ++ } ++ ++ return ytphy_modify_ext_with_lock(phydev, YTPHY_SYNCE_CFG_REG, mask, ++ val); ++} ++ + /** + * ytphy_utp_read_lpa() - read LPA then setup lp_advertising for utp + * @phydev: a pointer to a &struct phy_device +@@ -1387,6 +1491,94 @@ err_restore_page: + return phy_restore_page(phydev, old_page, ret); + } + ++static int yt8531_config_init(struct phy_device *phydev) ++{ ++ struct device_node *node = phydev->mdio.dev.of_node; ++ int ret; ++ ++ ret = ytphy_rgmii_clk_delay_config_with_lock(phydev); ++ if (ret < 0) ++ return ret; ++ ++ if (of_property_read_bool(node, "motorcomm,auto-sleep-disabled")) { ++ /* disable auto sleep */ ++ ret = ytphy_modify_ext_with_lock(phydev, ++ YT8521_EXTREG_SLEEP_CONTROL1_REG, ++ YT8521_ESC1R_SLEEP_SW, 0); ++ if (ret < 0) ++ return ret; ++ } ++ ++ if (of_property_read_bool(node, "motorcomm,keep-pll-enabled")) { ++ /* enable RXC clock when no wire plug */ ++ ret = ytphy_modify_ext_with_lock(phydev, ++ YT8521_CLOCK_GATING_REG, ++ YT8521_CGR_RX_CLK_EN, 0); ++ if (ret < 0) ++ return ret; ++ } ++ ++ return 0; ++} ++ ++/** ++ * yt8531_link_change_notify() - Adjust the tx clock direction according to ++ * the current speed and dts config. ++ * @phydev: a pointer to a &struct phy_device ++ * ++ * NOTE: This function is only used to adapt to VF2 with JH7110 SoC. Please ++ * keep "motorcomm,tx-clk-adj-enabled" not exist in dts when the soc is not ++ * JH7110. ++ */ ++static void yt8531_link_change_notify(struct phy_device *phydev) ++{ ++ struct device_node *node = phydev->mdio.dev.of_node; ++ bool tx_clk_adj_enabled = false; ++ bool tx_clk_1000_inverted; ++ bool tx_clk_100_inverted; ++ bool tx_clk_10_inverted; ++ u16 val = 0; ++ int ret; ++ ++ if (of_property_read_bool(node, "motorcomm,tx-clk-adj-enabled")) ++ tx_clk_adj_enabled = true; ++ ++ if (!tx_clk_adj_enabled) ++ return; ++ ++ if (of_property_read_bool(node, "motorcomm,tx-clk-10-inverted")) ++ tx_clk_10_inverted = true; ++ if (of_property_read_bool(node, "motorcomm,tx-clk-100-inverted")) ++ tx_clk_100_inverted = true; ++ if (of_property_read_bool(node, "motorcomm,tx-clk-1000-inverted")) ++ tx_clk_1000_inverted = true; ++ ++ if (phydev->speed < 0) ++ return; ++ ++ switch (phydev->speed) { ++ case SPEED_1000: ++ if (tx_clk_1000_inverted) ++ val = YT8521_RC1R_TX_CLK_SEL_INVERTED; ++ break; ++ case SPEED_100: ++ if (tx_clk_100_inverted) ++ val = YT8521_RC1R_TX_CLK_SEL_INVERTED; ++ break; ++ case SPEED_10: ++ if (tx_clk_10_inverted) ++ val = YT8521_RC1R_TX_CLK_SEL_INVERTED; ++ break; ++ default: ++ return; ++ } ++ ++ ret = ytphy_modify_ext_with_lock(phydev, YT8521_RGMII_CONFIG1_REG, ++ YT8521_RC1R_TX_CLK_SEL_INVERTED, val); ++ if (ret < 0) ++ phydev_warn(phydev, "Modify TX_CLK_SEL err:%d\n", ret); ++} ++ + /** + * yt8521_prepare_fiber_features() - A small helper function that setup + * fiber's features. +@@ -1970,6 +2162,17 @@ static struct phy_driver motorcomm_phy_d + .resume = yt8521_resume, + }, + { ++ PHY_ID_MATCH_EXACT(PHY_ID_YT8531), ++ .name = "YT8531 Gigabit Ethernet", ++ .probe = yt8531_probe, ++ .config_init = yt8531_config_init, ++ .suspend = genphy_suspend, ++ .resume = genphy_resume, ++ .get_wol = ytphy_get_wol, ++ .set_wol = yt8531_set_wol, ++ .link_change_notify = yt8531_link_change_notify, ++ }, ++ { + PHY_ID_MATCH_EXACT(PHY_ID_YT8531S), + .name = "YT8531S Gigabit Ethernet", + .get_features = yt8521_get_features, +@@ -1990,7 +2193,7 @@ static struct phy_driver motorcomm_phy_d + + module_phy_driver(motorcomm_phy_drvs); + +-MODULE_DESCRIPTION("Motorcomm 8511/8521/8531S PHY driver"); ++MODULE_DESCRIPTION("Motorcomm 8511/8521/8531/8531S PHY driver"); + MODULE_AUTHOR("Peter Geis"); + MODULE_AUTHOR("Frank"); + MODULE_LICENSE("GPL"); +@@ -1998,6 +2201,7 @@ MODULE_LICENSE("GPL"); + static const struct mdio_device_id __maybe_unused motorcomm_tbl[] = { + { PHY_ID_MATCH_EXACT(PHY_ID_YT8511) }, + { PHY_ID_MATCH_EXACT(PHY_ID_YT8521) }, ++ { PHY_ID_MATCH_EXACT(PHY_ID_YT8531) }, + { PHY_ID_MATCH_EXACT(PHY_ID_YT8531S) }, + { /* sentinel */ } + }; diff --git a/target/linux/generic/backport-5.15/791-v6.3-10-net-phy-motorcomm-uninitialized-variables-in.patch b/target/linux/generic/backport-5.15/791-v6.3-10-net-phy-motorcomm-uninitialized-variables-in.patch new file mode 100644 index 0000000000..29ae86dbbc --- /dev/null +++ b/target/linux/generic/backport-5.15/791-v6.3-10-net-phy-motorcomm-uninitialized-variables-in.patch @@ -0,0 +1,34 @@ +From 9753613f7399601f9bae6ee81e9d4274246c98ab Mon Sep 17 00:00:00 2001 +From: Dan Carpenter +Date: Wed, 15 Feb 2023 07:21:47 +0300 +Subject: [PATCH] net: phy: motorcomm: uninitialized variables in + yt8531_link_change_notify() + +These booleans are never set to false, but are just used without being +initialized. + +Fixes: 4ac94f728a58 ("net: phy: Add driver for Motorcomm yt8531 gigabit ethernet phy") +Signed-off-by: Dan Carpenter +Reviewed-by: Frank Sae +Link: https://lore.kernel.org/r/Y+xd2yJet2ImHLoQ@kili +Signed-off-by: Jakub Kicinski +--- + drivers/net/phy/motorcomm.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/net/phy/motorcomm.c ++++ b/drivers/net/phy/motorcomm.c +@@ -1533,10 +1533,10 @@ static int yt8531_config_init(struct phy + static void yt8531_link_change_notify(struct phy_device *phydev) + { + struct device_node *node = phydev->mdio.dev.of_node; ++ bool tx_clk_1000_inverted = false; ++ bool tx_clk_100_inverted = false; ++ bool tx_clk_10_inverted = false; + bool tx_clk_adj_enabled = false; +- bool tx_clk_1000_inverted; +- bool tx_clk_100_inverted; +- bool tx_clk_10_inverted; + u16 val = 0; + int ret; + diff --git a/target/linux/generic/backport-5.15/804-v5.18-0009-nvmem-Add-driver-for-OCOTP-in-Sunplus-SP7021.patch b/target/linux/generic/backport-5.15/804-v5.18-0009-nvmem-Add-driver-for-OCOTP-in-Sunplus-SP7021.patch index 95929b7fe3..2a9dc74947 100644 --- a/target/linux/generic/backport-5.15/804-v5.18-0009-nvmem-Add-driver-for-OCOTP-in-Sunplus-SP7021.patch +++ b/target/linux/generic/backport-5.15/804-v5.18-0009-nvmem-Add-driver-for-OCOTP-in-Sunplus-SP7021.patch @@ -19,7 +19,7 @@ Signed-off-by: Greg Kroah-Hartman --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -17961,6 +17961,11 @@ L: netdev@vger.kernel.org +@@ -17962,6 +17962,11 @@ L: netdev@vger.kernel.org S: Maintained F: drivers/net/ethernet/dlink/sundance.c diff --git a/target/linux/realtek/patches-5.15/008-5.17-watchdog-add-realtek-otto-watchdog-timer.patch b/target/linux/realtek/patches-5.15/008-5.17-watchdog-add-realtek-otto-watchdog-timer.patch index df66df794c..e562dd8396 100644 --- a/target/linux/realtek/patches-5.15/008-5.17-watchdog-add-realtek-otto-watchdog-timer.patch +++ b/target/linux/realtek/patches-5.15/008-5.17-watchdog-add-realtek-otto-watchdog-timer.patch @@ -32,7 +32,7 @@ Signed-off-by: Guenter Roeck --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -15898,6 +15898,13 @@ S: Maintained +@@ -15899,6 +15899,13 @@ S: Maintained F: include/sound/rt*.h F: sound/soc/codecs/rt* diff --git a/target/linux/rockchip/armv8/config-5.15 b/target/linux/rockchip/armv8/config-5.15 index 87715789c7..2359fd8729 100644 --- a/target/linux/rockchip/armv8/config-5.15 +++ b/target/linux/rockchip/armv8/config-5.15 @@ -350,6 +350,7 @@ CONFIG_MMC_SDHCI_OF_DWCMSHC=y # CONFIG_MMC_SDHCI_PCI is not set CONFIG_MMC_SDHCI_PLTFM=y CONFIG_MODULES_USE_ELF_RELA=y +CONFIG_MOTORCOMM_PHY=y CONFIG_MQ_IOSCHED_DEADLINE=y # CONFIG_MTD_CFI is not set CONFIG_MTD_CMDLINE_PARTS=y From 60c1fe692896a441e8624afe8643c7f52bd863c9 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Sat, 13 May 2023 13:54:38 +0800 Subject: [PATCH 26/33] uboot-rockchip: add NanoPi R2C support Add support for the FriendlyARM NanoPi R2C. Manually generated of-platdata files to avoid swig dependency. Signed-off-by: Tianling Shen --- package/boot/uboot-rockchip/Makefile | 8 + ...rock64pro-disable-CONFIG_USE_PREBOOT.patch | 4 +- ...d-support-for-FriendlyARM-NanoPi-R2C.patch | 199 ++++++++++++++++++ .../of-platdata/nanopi-r2c-rk3328/dt-decl.h | 23 ++ .../of-platdata/nanopi-r2c-rk3328/dt-plat.c | 155 ++++++++++++++ .../nanopi-r2c-rk3328/dt-structs-gen.h | 51 +++++ 6 files changed, 438 insertions(+), 2 deletions(-) create mode 100644 package/boot/uboot-rockchip/patches/102-rockchip-rk3328-Add-support-for-FriendlyARM-NanoPi-R2C.patch create mode 100644 package/boot/uboot-rockchip/src/of-platdata/nanopi-r2c-rk3328/dt-decl.h create mode 100644 package/boot/uboot-rockchip/src/of-platdata/nanopi-r2c-rk3328/dt-plat.c create mode 100644 package/boot/uboot-rockchip/src/of-platdata/nanopi-r2c-rk3328/dt-structs-gen.h diff --git a/package/boot/uboot-rockchip/Makefile b/package/boot/uboot-rockchip/Makefile index f27a3e0638..bdd1f5d5d8 100644 --- a/package/boot/uboot-rockchip/Makefile +++ b/package/boot/uboot-rockchip/Makefile @@ -31,6 +31,13 @@ define U-Boot/rk3328/Default OF_PLATDATA:=$(1) endef +define U-Boot/nanopi-r2c-rk3328 + $(U-Boot/rk3328/Default) + NAME:=NanoPi R2C + BUILD_DEVICES:= \ + friendlyarm_nanopi-r2c +endef + define U-Boot/nanopi-r2s-rk3328 $(U-Boot/rk3328/Default) NAME:=NanoPi R2S @@ -78,6 +85,7 @@ UBOOT_TARGETS := \ nanopi-r4s-rk3399 \ rock-pi-4-rk3399 \ rockpro64-rk3399 \ + nanopi-r2c-rk3328 \ nanopi-r2s-rk3328 \ roc-cc-rk3328 diff --git a/package/boot/uboot-rockchip/patches/101-rock64pro-disable-CONFIG_USE_PREBOOT.patch b/package/boot/uboot-rockchip/patches/101-rock64pro-disable-CONFIG_USE_PREBOOT.patch index f630818358..174c9ea29c 100644 --- a/package/boot/uboot-rockchip/patches/101-rock64pro-disable-CONFIG_USE_PREBOOT.patch +++ b/package/boot/uboot-rockchip/patches/101-rock64pro-disable-CONFIG_USE_PREBOOT.patch @@ -17,9 +17,9 @@ Signed-off-by: Marty Jones --- a/configs/rockpro64-rk3399_defconfig +++ b/configs/rockpro64-rk3399_defconfig -@@ -12,7 +12,6 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y +@@ -12,7 +12,6 @@ CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SPL_SPI_FLASH_SUPPORT=y CONFIG_SPL_SPI_SUPPORT=y - CONFIG_DEFAULT_DEVICE_TREE="rk3399-rockpro64" CONFIG_DEBUG_UART=y -CONFIG_USE_PREBOOT=y CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-rockpro64.dtb" diff --git a/package/boot/uboot-rockchip/patches/102-rockchip-rk3328-Add-support-for-FriendlyARM-NanoPi-R2C.patch b/package/boot/uboot-rockchip/patches/102-rockchip-rk3328-Add-support-for-FriendlyARM-NanoPi-R2C.patch new file mode 100644 index 0000000000..bc450b0dd4 --- /dev/null +++ b/package/boot/uboot-rockchip/patches/102-rockchip-rk3328-Add-support-for-FriendlyARM-NanoPi-R2C.patch @@ -0,0 +1,199 @@ +From 7000a609473ffe14d32c656cdd0ff3ca0d3ecbd7 Mon Sep 17 00:00:00 2001 +From: Tianling Shen +Date: Tue, 11 Apr 2023 18:14:49 +0800 +Subject: [PATCH] rockchip: rk3328: Add support for FriendlyARM NanoPi R2C + +The NanoPi R2C is a minor variant of NanoPi R2S with the on-board NIC +chip changed from rtl8211e to yt8521s, and otherwise identical to R2S. + +The device tree is taken from the kernel linux-next branch: +https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=004589ff9df5b75672a78b6c3c4cba93202b14c9 + +Signed-off-by: Tianling Shen +Reviewed-by: Kever Yang +--- + arch/arm/dts/Makefile | 1 + + arch/arm/dts/rk3328-nanopi-r2c-u-boot.dtsi | 3 + + arch/arm/dts/rk3328-nanopi-r2c.dts | 40 ++++++++ + board/rockchip/evb_rk3328/MAINTAINERS | 6 ++ + configs/nanopi-r2c-rk3328_defconfig | 112 +++++++++++++++++++++ + 5 files changed, 162 insertions(+) + create mode 100644 arch/arm/dts/rk3328-nanopi-r2c-u-boot.dtsi + create mode 100644 arch/arm/dts/rk3328-nanopi-r2c.dts + create mode 100644 configs/nanopi-r2c-rk3328_defconfig + +--- a/arch/arm/dts/Makefile ++++ b/arch/arm/dts/Makefile +@@ -108,6 +108,7 @@ dtb-$(CONFIG_ROCKCHIP_RK3308) += \ + + dtb-$(CONFIG_ROCKCHIP_RK3328) += \ + rk3328-evb.dtb \ ++ rk3328-nanopi-r2c.dtb \ + rk3328-nanopi-r2s.dtb \ + rk3328-roc-cc.dtb \ + rk3328-rock64.dtb \ +--- /dev/null ++++ b/arch/arm/dts/rk3328-nanopi-r2c-u-boot.dtsi +@@ -0,0 +1,3 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later ++ ++#include "rk3328-nanopi-r2s-u-boot.dtsi" +--- /dev/null ++++ b/arch/arm/dts/rk3328-nanopi-r2c.dts +@@ -0,0 +1,40 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT ++/* ++ * Copyright (c) 2021 FriendlyElec Computer Tech. Co., Ltd. ++ * (http://www.friendlyarm.com) ++ * ++ * Copyright (c) 2021-2023 Tianling Shen ++ */ ++ ++/dts-v1/; ++#include "rk3328-nanopi-r2s.dts" ++ ++/ { ++ model = "FriendlyElec NanoPi R2C"; ++ compatible = "friendlyarm,nanopi-r2c", "rockchip,rk3328"; ++}; ++ ++&gmac2io { ++ phy-handle = <&yt8521s>; ++ tx_delay = <0x22>; ++ rx_delay = <0x12>; ++ ++ mdio { ++ /delete-node/ ethernet-phy@1; ++ ++ yt8521s: ethernet-phy@3 { ++ compatible = "ethernet-phy-ieee802.3-c22"; ++ reg = <3>; ++ ++ motorcomm,clk-out-frequency-hz = <125000000>; ++ motorcomm,keep-pll-enabled; ++ motorcomm,auto-sleep-disabled; ++ ++ pinctrl-0 = <ð_phy_reset_pin>; ++ pinctrl-names = "default"; ++ reset-assert-us = <10000>; ++ reset-deassert-us = <50000>; ++ reset-gpios = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++}; +--- a/board/rockchip/evb_rk3328/MAINTAINERS ++++ b/board/rockchip/evb_rk3328/MAINTAINERS +@@ -5,6 +5,12 @@ F: board/rockchip/evb_rk3328 + F: include/configs/evb_rk3328.h + F: configs/evb-rk3328_defconfig + ++NANOPI-R2C-RK3328 ++M: Tianling Shen ++S: Maintained ++F: configs/nanopi-r2c-rk3328_defconfig ++F: arch/arm/dts/rk3328-nanopi-r2c-u-boot.dtsi ++ + NANOPI-R2S-RK3328 + M: David Bauer + S: Maintained +--- /dev/null ++++ b/configs/nanopi-r2c-rk3328_defconfig +@@ -0,0 +1,98 @@ ++CONFIG_ARM=y ++CONFIG_ARCH_ROCKCHIP=y ++CONFIG_SYS_TEXT_BASE=0x00200000 ++CONFIG_SPL_GPIO_SUPPORT=y ++CONFIG_NR_DRAM_BANKS=1 ++CONFIG_ENV_OFFSET=0x3F8000 ++CONFIG_DEFAULT_DEVICE_TREE="rk3328-nanopi-r2c" ++CONFIG_ROCKCHIP_RK3328=y ++CONFIG_TPL_ROCKCHIP_COMMON_BOARD=y ++CONFIG_TPL_LIBCOMMON_SUPPORT=y ++CONFIG_TPL_LIBGENERIC_SUPPORT=y ++CONFIG_SPL_DRIVERS_MISC_SUPPORT=y ++CONFIG_SPL_STACK_R_ADDR=0x600000 ++CONFIG_DEBUG_UART_BASE=0xFF130000 ++CONFIG_DEBUG_UART_CLOCK=24000000 ++CONFIG_DEBUG_UART=y ++CONFIG_TPL_SYS_MALLOC_F_LEN=0x800 ++# CONFIG_ANDROID_BOOT_IMAGE is not set ++CONFIG_FIT=y ++CONFIG_FIT_VERBOSE=y ++CONFIG_SPL_LOAD_FIT=y ++CONFIG_DEFAULT_FDT_FILE="rockchip/rk3328-nanopi-r2c.dtb" ++# CONFIG_DISPLAY_CPUINFO is not set ++CONFIG_DISPLAY_BOARDINFO_LATE=y ++CONFIG_MISC_INIT_R=y ++# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set ++CONFIG_TPL_SYS_MALLOC_SIMPLE=y ++CONFIG_SPL_STACK_R=y ++CONFIG_SPL_I2C_SUPPORT=y ++CONFIG_SPL_POWER_SUPPORT=y ++CONFIG_SPL_ATF=y ++CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y ++CONFIG_CMD_BOOTZ=y ++CONFIG_CMD_GPT=y ++CONFIG_CMD_MMC=y ++CONFIG_CMD_USB=y ++# CONFIG_CMD_SETEXPR is not set ++CONFIG_CMD_TIME=y ++CONFIG_SPL_OF_CONTROL=y ++CONFIG_TPL_OF_CONTROL=y ++CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" ++CONFIG_TPL_OF_PLATDATA=y ++CONFIG_ENV_IS_IN_MMC=y ++CONFIG_SYS_RELOC_GD_ENV_ADDR=y ++CONFIG_NET_RANDOM_ETHADDR=y ++CONFIG_TPL_DM=y ++CONFIG_REGMAP=y ++CONFIG_SPL_REGMAP=y ++CONFIG_TPL_REGMAP=y ++CONFIG_SYSCON=y ++CONFIG_SPL_SYSCON=y ++CONFIG_TPL_SYSCON=y ++CONFIG_CLK=y ++CONFIG_SPL_CLK=y ++CONFIG_FASTBOOT_BUF_ADDR=0x800800 ++CONFIG_FASTBOOT_CMD_OEM_FORMAT=y ++CONFIG_ROCKCHIP_GPIO=y ++CONFIG_SYS_I2C_ROCKCHIP=y ++CONFIG_MMC_DW=y ++CONFIG_MMC_DW_ROCKCHIP=y ++CONFIG_SF_DEFAULT_SPEED=20000000 ++CONFIG_DM_ETH=y ++CONFIG_ETH_DESIGNWARE=y ++CONFIG_GMAC_ROCKCHIP=y ++CONFIG_PINCTRL=y ++CONFIG_SPL_PINCTRL=y ++CONFIG_DM_PMIC=y ++CONFIG_PMIC_RK8XX=y ++CONFIG_SPL_DM_REGULATOR=y ++CONFIG_REGULATOR_PWM=y ++CONFIG_DM_REGULATOR_FIXED=y ++CONFIG_SPL_DM_REGULATOR_FIXED=y ++CONFIG_REGULATOR_RK8XX=y ++CONFIG_PWM_ROCKCHIP=y ++CONFIG_RAM=y ++CONFIG_SPL_RAM=y ++CONFIG_TPL_RAM=y ++CONFIG_DM_RESET=y ++CONFIG_BAUDRATE=1500000 ++CONFIG_DEBUG_UART_SHIFT=2 ++CONFIG_SYSINFO=y ++CONFIG_SYSRESET=y ++# CONFIG_TPL_SYSRESET is not set ++CONFIG_USB=y ++CONFIG_USB_XHCI_HCD=y ++CONFIG_USB_XHCI_DWC3=y ++CONFIG_USB_EHCI_HCD=y ++CONFIG_USB_EHCI_GENERIC=y ++CONFIG_USB_OHCI_HCD=y ++CONFIG_USB_OHCI_GENERIC=y ++CONFIG_USB_DWC2=y ++CONFIG_USB_DWC3=y ++# CONFIG_USB_DWC3_GADGET is not set ++CONFIG_USB_GADGET=y ++CONFIG_USB_GADGET_DWC2_OTG=y ++CONFIG_SPL_TINY_MEMSET=y ++CONFIG_TPL_TINY_MEMSET=y ++CONFIG_ERRNO_STR=y diff --git a/package/boot/uboot-rockchip/src/of-platdata/nanopi-r2c-rk3328/dt-decl.h b/package/boot/uboot-rockchip/src/of-platdata/nanopi-r2c-rk3328/dt-decl.h new file mode 100644 index 0000000000..0919e4ed53 --- /dev/null +++ b/package/boot/uboot-rockchip/src/of-platdata/nanopi-r2c-rk3328/dt-decl.h @@ -0,0 +1,23 @@ +/* + * DO NOT MODIFY + * + * Declares externs for all device/uclass instances. + * This was generated by dtoc from a .dtb (device tree binary) file. + */ + +#include +#include + +/* driver declarations - these allow DM_DRIVER_GET() to be used */ +extern U_BOOT_DRIVER(rockchip_rk3328_cru); +extern U_BOOT_DRIVER(rockchip_rk3328_dmc); +extern U_BOOT_DRIVER(rockchip_rk3288_dw_mshc); +extern U_BOOT_DRIVER(ns16550_serial); +extern U_BOOT_DRIVER(rockchip_rk3328_grf); + +/* uclass driver declarations - needed for DM_UCLASS_DRIVER_REF() */ +extern UCLASS_DRIVER(clk); +extern UCLASS_DRIVER(mmc); +extern UCLASS_DRIVER(ram); +extern UCLASS_DRIVER(serial); +extern UCLASS_DRIVER(syscon); diff --git a/package/boot/uboot-rockchip/src/of-platdata/nanopi-r2c-rk3328/dt-plat.c b/package/boot/uboot-rockchip/src/of-platdata/nanopi-r2c-rk3328/dt-plat.c new file mode 100644 index 0000000000..e5b330c9d9 --- /dev/null +++ b/package/boot/uboot-rockchip/src/of-platdata/nanopi-r2c-rk3328/dt-plat.c @@ -0,0 +1,155 @@ +/* + * DO NOT MODIFY + * + * Declares the U_BOOT_DRIVER() records and platform data. + * This was generated by dtoc from a .dtb (device tree binary) file. + */ + +/* Allow use of U_BOOT_DRVINFO() in this file */ +#define DT_PLAT_C + +#include +#include +#include + +/* + * driver_info declarations, ordered by 'struct driver_info' linker_list idx: + * + * idx driver_info driver + * --- -------------------- -------------------- + * 0: clock_controller_at_ff440000 rockchip_rk3328_cru + * 1: dmc rockchip_rk3328_dmc + * 2: mmc_at_ff500000 rockchip_rk3288_dw_mshc + * 3: serial_at_ff130000 ns16550_serial + * 4: syscon_at_ff100000 rockchip_rk3328_grf + * --- -------------------- -------------------- + */ + +/* + * Node /clock-controller@ff440000 index 0 + * driver rockchip_rk3328_cru parent None + */ +static struct dtd_rockchip_rk3328_cru dtv_clock_controller_at_ff440000 = { + .reg = {0xff440000, 0x1000}, + .rockchip_grf = 0x3a, +}; +U_BOOT_DRVINFO(clock_controller_at_ff440000) = { + .name = "rockchip_rk3328_cru", + .plat = &dtv_clock_controller_at_ff440000, + .plat_size = sizeof(dtv_clock_controller_at_ff440000), + .parent_idx = -1, +}; + +/* + * Node /dmc index 1 + * driver rockchip_rk3328_dmc parent None + */ +static struct dtd_rockchip_rk3328_dmc dtv_dmc = { + .reg = {0xff400000, 0x1000, 0xff780000, 0x3000, 0xff100000, 0x1000, 0xff440000, 0x1000, + 0xff720000, 0x1000, 0xff798000, 0x1000}, + .rockchip_sdram_params = {0x1, 0xa, 0x2, 0x1, 0x0, 0x0, 0x11, 0x0, + 0x11, 0x0, 0x0, 0x94291288, 0x0, 0x27, 0x462, 0x15, + 0x242, 0xff, 0x14d, 0x0, 0x1, 0x0, 0x0, 0x0, + 0x43049010, 0x64, 0x28003b, 0xd0, 0x20053, 0xd4, 0x220000, 0xd8, + 0x100, 0xdc, 0x40000, 0xe0, 0x0, 0xe4, 0x110000, 0xe8, + 0x420, 0xec, 0x400, 0xf4, 0xf011f, 0x100, 0x9060b06, 0x104, + 0x20209, 0x108, 0x505040a, 0x10c, 0x40400c, 0x110, 0x5030206, 0x114, + 0x3030202, 0x120, 0x3030b03, 0x124, 0x20208, 0x180, 0x1000040, 0x184, + 0x0, 0x190, 0x7030003, 0x198, 0x5001100, 0x1a0, 0xc0400003, 0x240, + 0x6000604, 0x244, 0x201, 0x250, 0xf00, 0x490, 0x1, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0x4, 0xc, 0x28, 0xa, 0x2c, + 0x0, 0x30, 0x9, 0xffffffff, 0xffffffff, 0x77, 0x88, 0x79, + 0x79, 0x87, 0x97, 0x87, 0x78, 0x77, 0x78, 0x87, + 0x88, 0x87, 0x87, 0x77, 0x78, 0x78, 0x78, 0x78, + 0x78, 0x78, 0x78, 0x78, 0x78, 0x69, 0x9, 0x77, + 0x78, 0x77, 0x78, 0x77, 0x78, 0x77, 0x78, 0x77, + 0x79, 0x9, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, + 0x78, 0x78, 0x78, 0x69, 0x9, 0x77, 0x78, 0x77, + 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x79, 0x9, + 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, + 0x78, 0x69, 0x9, 0x77, 0x78, 0x77, 0x78, 0x77, + 0x78, 0x77, 0x78, 0x77, 0x79, 0x9, 0x78, 0x78, + 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x69, + 0x9, 0x77, 0x78, 0x77, 0x77, 0x77, 0x77, 0x77, + 0x77, 0x77, 0x79, 0x9}, +}; +U_BOOT_DRVINFO(dmc) = { + .name = "rockchip_rk3328_dmc", + .plat = &dtv_dmc, + .plat_size = sizeof(dtv_dmc), + .parent_idx = -1, +}; + +/* + * Node /mmc@ff500000 index 2 + * driver rockchip_rk3288_dw_mshc parent None + */ +static struct dtd_rockchip_rk3288_dw_mshc dtv_mmc_at_ff500000 = { + .bus_width = 0x4, + .cap_sd_highspeed = true, + .clocks = { + {0, {317}}, + {0, {33}}, + {0, {74}}, + {0, {78}},}, + .disable_wp = true, + .fifo_depth = 0x100, + .interrupts = {0x0, 0xc, 0x4}, + .max_frequency = 0x8f0d180, + .pinctrl_0 = {0x47, 0x48, 0x49, 0x4a}, + .pinctrl_names = "default", + .reg = {0xff500000, 0x4000}, + .sd_uhs_sdr104 = true, + .sd_uhs_sdr12 = true, + .sd_uhs_sdr25 = true, + .sd_uhs_sdr50 = true, + .u_boot_spl_fifo_mode = true, + .vmmc_supply = 0x4b, + .vqmmc_supply = 0x1e, +}; +U_BOOT_DRVINFO(mmc_at_ff500000) = { + .name = "rockchip_rk3288_dw_mshc", + .plat = &dtv_mmc_at_ff500000, + .plat_size = sizeof(dtv_mmc_at_ff500000), + .parent_idx = -1, +}; + +/* + * Node /serial@ff130000 index 3 + * driver ns16550_serial parent None + */ +static struct dtd_ns16550_serial dtv_serial_at_ff130000 = { + .clock_frequency = 0x16e3600, + .clocks = { + {0, {40}}, + {0, {212}},}, + .dma_names = {"tx", "rx"}, + .dmas = {0x10, 0x6, 0x10, 0x7}, + .interrupts = {0x0, 0x39, 0x4}, + .pinctrl_0 = 0x26, + .pinctrl_names = "default", + .reg = {0xff130000, 0x100}, + .reg_io_width = 0x4, + .reg_shift = 0x2, +}; +U_BOOT_DRVINFO(serial_at_ff130000) = { + .name = "ns16550_serial", + .plat = &dtv_serial_at_ff130000, + .plat_size = sizeof(dtv_serial_at_ff130000), + .parent_idx = -1, +}; + +/* + * Node /syscon@ff100000 index 4 + * driver rockchip_rk3328_grf parent None + */ +static struct dtd_rockchip_rk3328_grf dtv_syscon_at_ff100000 = { + .reg = {0xff100000, 0x1000}, +}; +U_BOOT_DRVINFO(syscon_at_ff100000) = { + .name = "rockchip_rk3328_grf", + .plat = &dtv_syscon_at_ff100000, + .plat_size = sizeof(dtv_syscon_at_ff100000), + .parent_idx = -1, +}; + diff --git a/package/boot/uboot-rockchip/src/of-platdata/nanopi-r2c-rk3328/dt-structs-gen.h b/package/boot/uboot-rockchip/src/of-platdata/nanopi-r2c-rk3328/dt-structs-gen.h new file mode 100644 index 0000000000..b1ff08a927 --- /dev/null +++ b/package/boot/uboot-rockchip/src/of-platdata/nanopi-r2c-rk3328/dt-structs-gen.h @@ -0,0 +1,51 @@ +/* + * DO NOT MODIFY + * + * Defines the structs used to hold devicetree data. + * This was generated by dtoc from a .dtb (device tree binary) file. + */ + +#include +#include +struct dtd_ns16550_serial { + fdt32_t clock_frequency; + struct phandle_1_arg clocks[2]; + const char * dma_names[2]; + fdt32_t dmas[4]; + fdt32_t interrupts[3]; + fdt32_t pinctrl_0; + const char * pinctrl_names; + fdt64_t reg[2]; + fdt32_t reg_io_width; + fdt32_t reg_shift; +}; +struct dtd_rockchip_rk3288_dw_mshc { + fdt32_t bus_width; + bool cap_sd_highspeed; + struct phandle_1_arg clocks[4]; + bool disable_wp; + fdt32_t fifo_depth; + fdt32_t interrupts[3]; + fdt32_t max_frequency; + fdt32_t pinctrl_0[4]; + const char * pinctrl_names; + fdt64_t reg[2]; + bool sd_uhs_sdr104; + bool sd_uhs_sdr12; + bool sd_uhs_sdr25; + bool sd_uhs_sdr50; + bool u_boot_spl_fifo_mode; + fdt32_t vmmc_supply; + fdt32_t vqmmc_supply; +}; +struct dtd_rockchip_rk3328_cru { + fdt64_t reg[2]; + fdt32_t rockchip_grf; +}; +struct dtd_rockchip_rk3328_dmc { + fdt64_t reg[12]; + fdt32_t rockchip_sdram_params[196]; +}; +struct dtd_rockchip_rk3328_grf { + fdt64_t reg[2]; +}; From 8f578c15b3147ec52ceb2ec48e9223143144f2ad Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Sat, 13 May 2023 13:54:38 +0800 Subject: [PATCH 27/33] rockchip: add NanoPi R2C support The NanoPi R2C is a minor variant of NanoPi R2S with the on-board NIC chip changed from rtl8211e to yt8521s, and otherwise identical to R2S. Signed-off-by: Tianling Shen --- .../armv8/base-files/etc/board.d/01_leds | 6 +- .../armv8/base-files/etc/board.d/02_network | 1 + .../etc/hotplug.d/net/40-net-smp-affinity | 1 + target/linux/rockchip/image/armv8.mk | 9 +++ ...-rockchip-Add-FriendlyARM-NanoPi-R2C.patch | 70 +++++++++++++++++++ ...-rockchip-use-system-LED-for-OpenWrt.patch | 22 ++++++ 6 files changed, 105 insertions(+), 4 deletions(-) create mode 100644 target/linux/rockchip/patches-5.15/006-v6.4-arm64-dts-rockchip-Add-FriendlyARM-NanoPi-R2C.patch diff --git a/target/linux/rockchip/armv8/base-files/etc/board.d/01_leds b/target/linux/rockchip/armv8/base-files/etc/board.d/01_leds index b10c43ba60..2c9206b03e 100644 --- a/target/linux/rockchip/armv8/base-files/etc/board.d/01_leds +++ b/target/linux/rockchip/armv8/base-files/etc/board.d/01_leds @@ -8,10 +8,8 @@ boardname="${board##*,}" board_config_update case $board in -friendlyarm,nanopi-r2s) - ucidef_set_led_netdev "wan" "WAN" "$boardname:green:wan" "eth0" - ucidef_set_led_netdev "lan" "LAN" "$boardname:green:lan" "eth1" - ;; +friendlyarm,nanopi-r2c|\ +friendlyarm,nanopi-r2s|\ friendlyarm,nanopi-r4s) ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth0" ucidef_set_led_netdev "lan" "LAN" "green:lan" "eth1" diff --git a/target/linux/rockchip/armv8/base-files/etc/board.d/02_network b/target/linux/rockchip/armv8/base-files/etc/board.d/02_network index 816045a480..16ba01b7e3 100644 --- a/target/linux/rockchip/armv8/base-files/etc/board.d/02_network +++ b/target/linux/rockchip/armv8/base-files/etc/board.d/02_network @@ -46,6 +46,7 @@ rockchip_setup_macs() local label_mac="" case "$board" in + friendlyarm,nanopi-r2c|\ friendlyarm,nanopi-r2s) wan_mac=$(macaddr_generate_from_mmc_cid mmcblk0) lan_mac=$(macaddr_add "$wan_mac" 1) diff --git a/target/linux/rockchip/armv8/base-files/etc/hotplug.d/net/40-net-smp-affinity b/target/linux/rockchip/armv8/base-files/etc/hotplug.d/net/40-net-smp-affinity index c76e62a23a..3d1d99128e 100644 --- a/target/linux/rockchip/armv8/base-files/etc/hotplug.d/net/40-net-smp-affinity +++ b/target/linux/rockchip/armv8/base-files/etc/hotplug.d/net/40-net-smp-affinity @@ -29,6 +29,7 @@ set_interface_core() { } case "$(board_name)" in +friendlyarm,nanopi-r2c|\ friendlyarm,nanopi-r2s) set_interface_core 2 "eth0" set_interface_core 4 "eth1" "xhci-hcd:usb3" diff --git a/target/linux/rockchip/image/armv8.mk b/target/linux/rockchip/image/armv8.mk index 72e5832f06..601ddcbdd6 100644 --- a/target/linux/rockchip/image/armv8.mk +++ b/target/linux/rockchip/image/armv8.mk @@ -15,6 +15,15 @@ define Device/firefly_roc-rk3328-cc endef TARGET_DEVICES += firefly_roc-rk3328-cc +define Device/friendlyarm_nanopi-r2c + DEVICE_VENDOR := FriendlyARM + DEVICE_MODEL := NanoPi R2C + SOC := rk3328 + IMAGE/sysupgrade.img.gz := boot-common | boot-script | pine64-img | gzip | append-metadata + DEVICE_PACKAGES := kmod-usb-net-rtl8152 +endef +TARGET_DEVICES += friendlyarm_nanopi-r2c + define Device/friendlyarm_nanopi-r2s DEVICE_VENDOR := FriendlyARM DEVICE_MODEL := NanoPi R2S diff --git a/target/linux/rockchip/patches-5.15/006-v6.4-arm64-dts-rockchip-Add-FriendlyARM-NanoPi-R2C.patch b/target/linux/rockchip/patches-5.15/006-v6.4-arm64-dts-rockchip-Add-FriendlyARM-NanoPi-R2C.patch new file mode 100644 index 0000000000..f58463b3d1 --- /dev/null +++ b/target/linux/rockchip/patches-5.15/006-v6.4-arm64-dts-rockchip-Add-FriendlyARM-NanoPi-R2C.patch @@ -0,0 +1,70 @@ +From 004589ff9df5b75672a78b6c3c4cba93202b14c9 Mon Sep 17 00:00:00 2001 +From: Tianling Shen +Date: Sat, 25 Mar 2023 15:40:20 +0800 +Subject: [PATCH] arm64: dts: rockchip: Add FriendlyARM NanoPi R2C + +The NanoPi R2C is a minor variant of NanoPi R2S with the on-board NIC +chip changed from rtl8211e to yt8521s, and otherwise identical to R2S. + +Signed-off-by: Tianling Shen +Link: https://lore.kernel.org/r/20230325074022.9818-3-cnsztl@gmail.com +Signed-off-by: Heiko Stuebner +--- + arch/arm64/boot/dts/rockchip/Makefile | 1 + + .../boot/dts/rockchip/rk3328-nanopi-r2c.dts | 40 +++++++++++++++++++ + 2 files changed, 41 insertions(+) + create mode 100644 arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2c.dts + +--- a/arch/arm64/boot/dts/rockchip/Makefile ++++ b/arch/arm64/boot/dts/rockchip/Makefile +@@ -9,6 +9,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3318-a9 + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3326-odroid-go2.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-a1.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-evb.dtb ++dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-nanopi-r2c.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-nanopi-r2s.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-rock64.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-rock-pi-e.dtb +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2c.dts +@@ -0,0 +1,40 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT ++/* ++ * Copyright (c) 2021 FriendlyElec Computer Tech. Co., Ltd. ++ * (http://www.friendlyarm.com) ++ * ++ * Copyright (c) 2021-2023 Tianling Shen ++ */ ++ ++/dts-v1/; ++#include "rk3328-nanopi-r2s.dts" ++ ++/ { ++ model = "FriendlyElec NanoPi R2C"; ++ compatible = "friendlyarm,nanopi-r2c", "rockchip,rk3328"; ++}; ++ ++&gmac2io { ++ phy-handle = <&yt8521s>; ++ tx_delay = <0x22>; ++ rx_delay = <0x12>; ++ ++ mdio { ++ /delete-node/ ethernet-phy@1; ++ ++ yt8521s: ethernet-phy@3 { ++ compatible = "ethernet-phy-ieee802.3-c22"; ++ reg = <3>; ++ ++ motorcomm,clk-out-frequency-hz = <125000000>; ++ motorcomm,keep-pll-enabled; ++ motorcomm,auto-sleep-disabled; ++ ++ pinctrl-0 = <ð_phy_reset_pin>; ++ pinctrl-names = "default"; ++ reset-assert-us = <10000>; ++ reset-deassert-us = <50000>; ++ reset-gpios = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++}; diff --git a/target/linux/rockchip/patches-5.15/100-rockchip-use-system-LED-for-OpenWrt.patch b/target/linux/rockchip/patches-5.15/100-rockchip-use-system-LED-for-OpenWrt.patch index 4b963f3348..01009c5eb8 100644 --- a/target/linux/rockchip/patches-5.15/100-rockchip-use-system-LED-for-OpenWrt.patch +++ b/target/linux/rockchip/patches-5.15/100-rockchip-use-system-LED-for-OpenWrt.patch @@ -27,6 +27,28 @@ Signed-off-by: David Bauer }; chosen { +@@ -49,18 +54,18 @@ + + lan_led: led-0 { + gpios = <&gpio2 RK_PB7 GPIO_ACTIVE_HIGH>; +- label = "nanopi-r2s:green:lan"; ++ label = "green:lan"; + }; + + sys_led: led-1 { + gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>; +- label = "nanopi-r2s:red:sys"; ++ label = "red:sys"; + default-state = "on"; + }; + + wan_led: led-2 { + gpios = <&gpio2 RK_PC2 GPIO_ACTIVE_HIGH>; +- label = "nanopi-r2s:green:wan"; ++ label = "green:wan"; + }; + }; + --- a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts +++ b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts @@ -13,6 +13,11 @@ From ce81896769412fdab838efcb4b79d1981e166372 Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Thu, 11 May 2023 15:15:57 -0400 Subject: [PATCH 28/33] umdns: Update to umdns HEAD Update to umdns HEAD to include latest enhancements for browse method filtering, return of TXT records as an array, dumping IPv4/6 as an array, and including the interface name in a browse reply. Signed-off-by: Mark Baker Tested-by: Stefan Lippers-Hollmann #ipq807x, mt7621, x86_64 --- package/network/services/umdns/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/network/services/umdns/Makefile b/package/network/services/umdns/Makefile index 7f196cd1f5..b7564fa7c3 100644 --- a/package/network/services/umdns/Makefile +++ b/package/network/services/umdns/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2014-2021 OpenWrt.org +# Copyright (C) 2014-2023 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -12,9 +12,9 @@ PKG_RELEASE:=5 PKG_SOURCE_URL=$(PROJECT_GIT)/project/mdnsd.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2021-05-13 -PKG_SOURCE_VERSION:=b777a0b53f7d89ab2a60e3eed7d98036806da9a4 -PKG_MIRROR_HASH:=54992acf7edd32610de7bcb0ea7c58b20f69bf1ac20be69e76abcff41f25e775 +PKG_SOURCE_DATE:=2023-01-16 +PKG_SOURCE_VERSION:=65b3308d13de7d7975444d34389651612e2a4d38 +PKG_MIRROR_HASH:=945fdf51a299b68982aab74e8fba5614f2553a7b4c49a3a53b3093ea8aac0279 PKG_MAINTAINER:=John Crispin PKG_LICENSE:=LGPL-2.1 From b2c0d9d01f02f58965eae7d14104423bb3510bd5 Mon Sep 17 00:00:00 2001 From: John Audia Date: Thu, 18 May 2023 06:16:11 -0400 Subject: [PATCH 29/33] kernel: other: adjust paths for new location This upstream commit[1] moves drivers/bus/mhi/core/ to drivers/bus/mhi/host/ so we need to correct for that here. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.112&id=9fbf10148f31a63b6d8c2b0e56cb97eb173d600b Signed-off-by: John Audia --- package/kernel/linux/modules/other.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/kernel/linux/modules/other.mk b/package/kernel/linux/modules/other.mk index 51e70fbe18..cd827725bd 100644 --- a/package/kernel/linux/modules/other.mk +++ b/package/kernel/linux/modules/other.mk @@ -1338,7 +1338,7 @@ define KernelPackage/mhi-bus TITLE:=MHI bus KCONFIG:=CONFIG_MHI_BUS \ CONFIG_MHI_BUS_DEBUG=y - FILES:=$(LINUX_DIR)/drivers/bus/mhi/core/mhi.ko + FILES:=$(LINUX_DIR)/drivers/bus/mhi/host/mhi.ko AUTOLOAD:=$(call AutoProbe,mhi) endef @@ -1353,7 +1353,7 @@ define KernelPackage/mhi-pci-generic TITLE:=MHI PCI controller driver DEPENDS:=@PCI_SUPPORT +kmod-mhi-bus KCONFIG:=CONFIG_MHI_BUS_PCI_GENERIC - FILES:=$(LINUX_DIR)/drivers/bus/mhi/mhi_pci_generic.ko + FILES:=$(LINUX_DIR)/drivers/bus/mhi/host/mhi_pci_generic.ko AUTOLOAD:=$(call AutoProbe,mhi_pci_generic) endef From 6605b595eda76533a9e6fb907f80ede3d1b255d1 Mon Sep 17 00:00:00 2001 From: John Audia Date: Thu, 18 May 2023 06:18:23 -0400 Subject: [PATCH 30/33] kernel: bump 5.15 to 5.15.112 Manually adjusted before running quilt due to new location in tree: backport-5.15/780-v5.16-bus-mhi-pci_generic-Introduce-Sierra-EM919X-support.patch backport-5.15/781-v6.1-bus-mhi-host-always-print-detected-modem-name.patch pending-5.15/790-bus-mhi-core-add-SBL-state-callback.patch All other patches automatically rebased. Build system: x86_64 Build-tested: bcm2711/RPi4B, ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod Run-tested: bcm2711/RPi4B, ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod Signed-off-by: John Audia --- include/kernel-5.15 | 4 ++-- ...-mhi-pci_generic-Introduce-Sierra-EM919X-support.patch | 6 +++--- ....1-bus-mhi-host-always-print-detected-modem-name.patch | 6 +++--- .../760-net-usb-r8152-add-LED-configuration-from-OF.patch | 8 ++++---- ...-mv88e6xxx-Request-assisted-learning-on-CPU-port.patch | 2 +- .../790-bus-mhi-core-add-SBL-state-callback.patch | 6 +++--- .../mediatek/patches-5.15/410-bt-mtk-serial-fix.patch | 2 +- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/include/kernel-5.15 b/include/kernel-5.15 index f1b1323e0e..ddb9b7a875 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .111 -LINUX_KERNEL_HASH-5.15.111 = 77ceea259c0158dd624304871170d09b2e59ed612f3a4d436fe0f07362dcaec2 +LINUX_VERSION-5.15 = .112 +LINUX_KERNEL_HASH-5.15.112 = b0e8ebdba38e0c369f64ec4dc2a69ec59ffe87a64b82f940dbdf8e752b6ad651 diff --git a/target/linux/generic/backport-5.15/780-v5.16-bus-mhi-pci_generic-Introduce-Sierra-EM919X-support.patch b/target/linux/generic/backport-5.15/780-v5.16-bus-mhi-pci_generic-Introduce-Sierra-EM919X-support.patch index 5fe10e0caa..44f0864e9a 100644 --- a/target/linux/generic/backport-5.15/780-v5.16-bus-mhi-pci_generic-Introduce-Sierra-EM919X-support.patch +++ b/target/linux/generic/backport-5.15/780-v5.16-bus-mhi-pci_generic-Introduce-Sierra-EM919X-support.patch @@ -16,11 +16,11 @@ Signed-off-by: Manivannan Sadhasivam Link: https://lore.kernel.org/r/20211216081227.237749-11-manivannan.sadhasivam@linaro.org Signed-off-by: Greg Kroah-Hartman --- - drivers/bus/mhi/pci_generic.c | 43 +++++++++++++++++++++++++++++++++++ + drivers/bus/mhi/host/pci_generic.c | 43 +++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) ---- a/drivers/bus/mhi/pci_generic.c -+++ b/drivers/bus/mhi/pci_generic.c +--- a/drivers/bus/mhi/host/pci_generic.c ++++ b/drivers/bus/mhi/host/pci_generic.c @@ -406,6 +406,46 @@ static const struct mhi_pci_dev_info mhi .mru_default = 32768, }; diff --git a/target/linux/generic/backport-5.15/781-v6.1-bus-mhi-host-always-print-detected-modem-name.patch b/target/linux/generic/backport-5.15/781-v6.1-bus-mhi-host-always-print-detected-modem-name.patch index e974c21cb7..3c71a27b79 100644 --- a/target/linux/generic/backport-5.15/781-v6.1-bus-mhi-host-always-print-detected-modem-name.patch +++ b/target/linux/generic/backport-5.15/781-v6.1-bus-mhi-host-always-print-detected-modem-name.patch @@ -21,11 +21,11 @@ Link: https://lore.kernel.org/r/20220831100349.1488762-1-koen.vandeputte@citymes [mani: added missing review tags] Signed-off-by: Manivannan Sadhasivam --- - drivers/bus/mhi/pci_generic.c | 2 +- + drivers/bus/mhi/host/pci_generic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) ---- a/drivers/bus/mhi/pci_generic.c -+++ b/drivers/bus/mhi/pci_generic.c +--- a/drivers/bus/mhi/host/pci_generic.c ++++ b/drivers/bus/mhi/host/pci_generic.c @@ -806,7 +806,7 @@ static int mhi_pci_probe(struct pci_dev struct mhi_controller *mhi_cntrl; int err; diff --git a/target/linux/generic/hack-5.15/760-net-usb-r8152-add-LED-configuration-from-OF.patch b/target/linux/generic/hack-5.15/760-net-usb-r8152-add-LED-configuration-from-OF.patch index c315dcf8ff..f61c078521 100644 --- a/target/linux/generic/hack-5.15/760-net-usb-r8152-add-LED-configuration-from-OF.patch +++ b/target/linux/generic/hack-5.15/760-net-usb-r8152-add-LED-configuration-from-OF.patch @@ -22,7 +22,7 @@ Signed-off-by: David Bauer #include #include #include -@@ -6864,6 +6865,22 @@ static void rtl_tally_reset(struct r8152 +@@ -6886,6 +6887,22 @@ static void rtl_tally_reset(struct r8152 ocp_write_word(tp, MCU_TYPE_PLA, PLA_RSTTALLY, ocp_data); } @@ -45,7 +45,7 @@ Signed-off-by: David Bauer static void r8152b_init(struct r8152 *tp) { u32 ocp_data; -@@ -6905,6 +6922,8 @@ static void r8152b_init(struct r8152 *tp +@@ -6927,6 +6944,8 @@ static void r8152b_init(struct r8152 *tp ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_USB_CTRL); ocp_data &= ~(RX_AGG_DISABLE | RX_ZERO_EN); ocp_write_word(tp, MCU_TYPE_USB, USB_USB_CTRL, ocp_data); @@ -54,7 +54,7 @@ Signed-off-by: David Bauer } static void r8153_init(struct r8152 *tp) -@@ -7045,6 +7064,8 @@ static void r8153_init(struct r8152 *tp) +@@ -7067,6 +7086,8 @@ static void r8153_init(struct r8152 *tp) tp->coalesce = COALESCE_SLOW; break; } @@ -63,7 +63,7 @@ Signed-off-by: David Bauer } static void r8153b_init(struct r8152 *tp) -@@ -7127,6 +7148,8 @@ static void r8153b_init(struct r8152 *tp +@@ -7149,6 +7170,8 @@ static void r8153b_init(struct r8152 *tp rtl_tally_reset(tp); tp->coalesce = 15000; /* 15 us */ diff --git a/target/linux/generic/pending-5.15/768-net-dsa-mv88e6xxx-Request-assisted-learning-on-CPU-port.patch b/target/linux/generic/pending-5.15/768-net-dsa-mv88e6xxx-Request-assisted-learning-on-CPU-port.patch index c6b56699c4..18933de3a0 100644 --- a/target/linux/generic/pending-5.15/768-net-dsa-mv88e6xxx-Request-assisted-learning-on-CPU-port.patch +++ b/target/linux/generic/pending-5.15/768-net-dsa-mv88e6xxx-Request-assisted-learning-on-CPU-port.patch @@ -17,7 +17,7 @@ Signed-off-by: Tobias Waldekranz --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c -@@ -6332,6 +6332,7 @@ static int mv88e6xxx_register_switch(str +@@ -6333,6 +6333,7 @@ static int mv88e6xxx_register_switch(str ds->ops = &mv88e6xxx_switch_ops; ds->ageing_time_min = chip->info->age_time_coeff; ds->ageing_time_max = chip->info->age_time_coeff * U8_MAX; diff --git a/target/linux/generic/pending-5.15/790-bus-mhi-core-add-SBL-state-callback.patch b/target/linux/generic/pending-5.15/790-bus-mhi-core-add-SBL-state-callback.patch index 00d5cb9ce9..2f728fefd7 100644 --- a/target/linux/generic/pending-5.15/790-bus-mhi-core-add-SBL-state-callback.patch +++ b/target/linux/generic/pending-5.15/790-bus-mhi-core-add-SBL-state-callback.patch @@ -14,12 +14,12 @@ callback that the controller can trigger off. Signed-off-by: Robert Marko --- - drivers/bus/mhi/core/main.c | 1 + + drivers/bus/mhi/host/main.c | 1 + include/linux/mhi.h | 2 ++ 2 files changed, 3 insertions(+) ---- a/drivers/bus/mhi/core/main.c -+++ b/drivers/bus/mhi/core/main.c +--- a/drivers/bus/mhi/host/main.c ++++ b/drivers/bus/mhi/host/main.c @@ -891,6 +891,7 @@ int mhi_process_ctrl_ev_ring(struct mhi_ switch (event) { case MHI_EE_SBL: diff --git a/target/linux/mediatek/patches-5.15/410-bt-mtk-serial-fix.patch b/target/linux/mediatek/patches-5.15/410-bt-mtk-serial-fix.patch index a11549ba47..3f4597c65d 100644 --- a/target/linux/mediatek/patches-5.15/410-bt-mtk-serial-fix.patch +++ b/target/linux/mediatek/patches-5.15/410-bt-mtk-serial-fix.patch @@ -19,7 +19,7 @@ }, [PORT_NPCM] = { .name = "Nuvoton 16550", -@@ -2760,6 +2760,11 @@ serial8250_do_set_termios(struct uart_po +@@ -2766,6 +2766,11 @@ serial8250_do_set_termios(struct uart_po unsigned long flags; unsigned int baud, quot, frac = 0; From 2b51688f358f965db7fae5308d1c677d9aad91e0 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Thu, 18 May 2023 00:27:22 +0200 Subject: [PATCH 31/33] toolchain: glibc: Update glibc 2.37 to recent HEAD This adds the following changes: 790e504a17 stdlib: Undo post review change to 16adc58e73f3 [BZ #27749] 590d0e089b elf: Restore ldconfig libc6 implicit soname logic [BZ #30125] 1d63573f81 stdio-common: tests: don't double-define _FORTIFY_SOURCE 97ad4c64b9 gshadow: Matching sgetsgent, sgetsgent_r ERANGE handling (bug 30151) 9cc2f41e52 x86_64: Fix asm constraints in feraiseexcept (bug 30305) 78ab913eab posix: Fix system blocks SIGCHLD erroneously [BZ #30163] 5d750495db gmon: Fix allocated buffer overflow (bug 29444) d230623264 gmon: improve mcount overflow handling [BZ# 27576] ff3a71ec1f gmon: fix memory corruption issues [BZ# 30101] a908c18d47 gmon: Revert addition of tunables to preserve GLIBC_PRIVATE ABI 7c32cb7dd8 gmon: Revert addition of tunables to the manual Signed-off-by: Hauke Mehrtens --- toolchain/glibc/common.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/toolchain/glibc/common.mk b/toolchain/glibc/common.mk index 33afb2d60a..4fe5761f45 100644 --- a/toolchain/glibc/common.mk +++ b/toolchain/glibc/common.mk @@ -12,8 +12,8 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) -PKG_SOURCE_VERSION:=d8e1a7590d375159fb5aac07ad8111ab4699e994 -PKG_MIRROR_HASH:=4ea04f4b5cdd5567e11defe6f8947c168382fc0a22abe121bb43f4bb83615237 +PKG_SOURCE_VERSION:=7c32cb7dd88cf100b0b412163896e30aa2ee671a +PKG_MIRROR_HASH:=92afa3672e4af0c3ba9d360e9aaac60c094a0aad9334ef78a1fd2ee49f5e1b64 PKG_SOURCE_URL:=https://sourceware.org/git/glibc.git PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz From 76f241ad57da585d24f5fe56508f26780b8d885e Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Thu, 18 May 2023 00:31:21 +0200 Subject: [PATCH 32/33] toolchain: glibc: Fix build with autoconf 2.71 The glibc build was failing with this error message: aclocal.m4:6: error: Exactly version 2.69 of Autoconf is required but you have 2.71 aclocal.m4:6: the top level The autoconf run on glibc is not needed, just remove it. Fixes: #12631 Fixes: 030447b8f4c7 ("tools/autoconf: bump to 2.71") Signed-off-by: Hauke Mehrtens --- toolchain/glibc/common.mk | 5 ----- 1 file changed, 5 deletions(-) diff --git a/toolchain/glibc/common.mk b/toolchain/glibc/common.mk index 4fe5761f45..0d880e04df 100644 --- a/toolchain/glibc/common.mk +++ b/toolchain/glibc/common.mk @@ -79,11 +79,6 @@ define Host/SetToolchainInfo endef define Host/Configure - [ -f $(HOST_BUILD_DIR)/.autoconf ] || { \ - cd $(HOST_BUILD_DIR)/; \ - autoconf --force && \ - touch $(HOST_BUILD_DIR)/.autoconf; \ - } mkdir -p $(CUR_BUILD_DIR) ( cd $(CUR_BUILD_DIR); rm -f config.cache; \ $(GLIBC_CONFIGURE) \ From cf19fd0cb59f6e91e87f74a5471ea92a751e91d0 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Thu, 18 May 2023 12:20:15 +0200 Subject: [PATCH 33/33] ipq40xx: fix rebooting after 5.15.111 Kernel 5.15.111 includes backport of commit ("firmware: qcom_scm: Clear download bit during reboot") which is causing reboot on ipq40xx to stop working, more precisely the board will hang after reboot is called with: root@OpenWrt:/# reboot root@OpenWrt:/# [ 76.473541] device lan1 left promiscuous mode [ 76.474204] br-lan: port 1(lan1) entered disabled state [ 76.527975] device lan2 left promiscuous mode [ 76.530301] br-lan: port 2(lan2) entered disabled state [ 76.579376] device lan3 left promiscuous mode [ 76.581698] br-lan: port 3(lan3) entered disabled state [ 76.638434] device lan4 left promiscuous mode [ 76.638777] br-lan: port 4(lan4) entered disabled state [ 76.978489] qca8k-ipq4019 c000000.switch wan: Link is Down [ 76.978883] device eth0 left promiscuous mode [ 76.987077] ipqess-edma c080000.ethernet eth0: Link is Down [ Format: Log Type - Time(microsec) - Message - Optional Info Log Type: B - Since Boot(Power On Reset), D - Delta, S - Statistic S - QC_IMAGE_VERSION_STRING=BOOT.BF.3.1.1-00123 S - IMAGE_VARIANT_STRING=DAABANAZA S - OEM_IMAGE_VERSION_STRING=CRM S - Boot Config, 0x00000021 S - Reset status Config, 0x00000010 S - Core 0 Frequency, 0 MHz B - 261 - PBL, Start B - 1339 - bootable_media_detect_entry, Start B - 1679 - bootable_media_detect_success, Start B - 1693 - elf_loader_entry, Start B - 5076 - auth_hash_seg_entry, Start B - 7223 - auth_hash_seg_exit, Start B - 578349 - elf_segs_hash_verify_entry, Start B - 696356 - PBL, End B - 696380 - SBL1, Start B - 787236 - pm_device_init, Start D - 7 - pm_device_init, Delta B - 788701 - boot_flash_init, Start D - 52782 - boot_flash_init, Delta B - 845625 - boot_config_data_table_init, Start D - 3836 - boot_config_data_table_init, Delta - (419 Bytes) B - 852841 - clock_init, Start D - 7566 - clock_init, Delta B - 864883 - CDT version:2,Platform ID:9,Major ID:0,Minor ID:0,Subtype:64 B - 868413 - sbl1_ddr_set_params, Start B - 873402 - cpr_init, Start D - 2 - cpr_init, Delta B - 877842 - Pre_DDR_clock_init, Start D - 4 - Pre_DDR_clock_init, Delta D - 13234 - sbl1_ddr_set_params, Delta B - 891155 - pm_driver_init, Start D - 2 - pm_driver_init, Delta B - 909105 - Image Load, Start B - 1030210 - Boot error ocuured!. Error code: 303d So, until a proper fix is found, lets revert the culprit patch to have reboot working again. Fixes: 228e0e10398b ("kernel: bump 5.15 to 5.15.111") Signed-off-by: Robert Marko --- ...qcom_scm-Clear-download-bit-during-r.patch | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 target/linux/ipq40xx/patches-5.15/910-Revert-firmware-qcom_scm-Clear-download-bit-during-r.patch diff --git a/target/linux/ipq40xx/patches-5.15/910-Revert-firmware-qcom_scm-Clear-download-bit-during-r.patch b/target/linux/ipq40xx/patches-5.15/910-Revert-firmware-qcom_scm-Clear-download-bit-during-r.patch new file mode 100644 index 0000000000..e24895deec --- /dev/null +++ b/target/linux/ipq40xx/patches-5.15/910-Revert-firmware-qcom_scm-Clear-download-bit-during-r.patch @@ -0,0 +1,27 @@ +From c87df89a82c17411cd6b98e5afaa1203ee9508dc Mon Sep 17 00:00:00 2001 +From: Robert Marko +Date: Thu, 18 May 2023 12:16:02 +0200 +Subject: [PATCH] Revert "firmware: qcom_scm: Clear download bit during reboot" + +This reverts commit a3ea89b5978dbcd0fa55f675c5a1e04611093709. + +It is breaking reboot on IPQ4019 boards, so revert until a proper fix +is found. + +Signed-off-by: Robert Marko +--- + drivers/firmware/qcom_scm.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/firmware/qcom_scm.c ++++ b/drivers/firmware/qcom_scm.c +@@ -1352,7 +1352,8 @@ static int qcom_scm_probe(struct platfor + static void qcom_scm_shutdown(struct platform_device *pdev) + { + /* Clean shutdown, disable download mode to allow normal restart */ +- qcom_scm_set_download_mode(false); ++ if (download_mode) ++ qcom_scm_set_download_mode(false); + } + + static const struct of_device_id qcom_scm_dt_match[] = {