From 8c2aa1efe7e74f30f00159ddfa0acb25e55bef76 Mon Sep 17 00:00:00 2001 From: Mikhail Kshevetskiy <mikhail.kshevetskiy@gmail.com> Date: Sun, 31 Jul 2022 14:19:11 +0300 Subject: [PATCH] econet: switch to new spi/spi-nand drivers This change produces incompatibility with old flash structure, thus it's not possible to upgrade old devices (special installation procedure is required). There benefits as well: * opensource driver * more flashes supported * better support of spare area * more space on the flash is available * no special UBI related hack is required * no double bad block management Upgrade procedure: 0) get new 'u-boot-nand.bin' and 'squashfs.itb' images 1) backup 'art' partition 2) rename u-boot-nand.bin image to tcboot.bin and flash it: * reboot board and keep it in the bootloader * put tcboot.bin to the board using binary tftp node * wait for flashing complete and reboot board * new bootloader will start * execute "run format_ubi" from u-boot command line * rename "squashfs.itb" file to "image.itb" and put it to TFTP server on your PC * execute "run update_itb" twice from u-boot command line * execute "setenv board_id rodimus && saveenv" from u-boot command line * reboot board, new image will be booted. 3) restore 'art' partition Downgrade procedure: 0) get old bootloader and 'squashfs.itb' images 1) rename old bootloader to "uboot-nand.bin" and put it to TFTP server on your PC 2) reboot board and keep it in the bootloader 3) execute "run update_uboot" from u-boot command line 4) wait for flashing complete and reboot board to start old bootloader 5) flash old images and recover art partition --- iopsys-econet/config/config | 2 +- iopsys-econet/dts/en75xx-base.dtsi | 19 +++++++++++++++++-- ...562_7915D_ActiveEthWan_KERNEL_5_4_demo.mak | 12 ++++++------ iopsys-econet/en7562/config-5.4 | 19 ++++++++++++++----- iopsys-econet/rule.mak | 8 ++++++-- 5 files changed, 44 insertions(+), 16 deletions(-) diff --git a/iopsys-econet/config/config b/iopsys-econet/config/config index c93742a62..ce81a0a85 100644 --- a/iopsys-econet/config/config +++ b/iopsys-econet/config/config @@ -1,5 +1,5 @@ CONFIG_KERNEL_GIT_CLONE_URI="https://dev.iopsys.eu/econet/linux.git" -CONFIG_KERNEL_GIT_REF="44b4e4f0d231b55a1716a47bab8cbe28e26b6868" +CONFIG_KERNEL_GIT_REF="42f75a1a40c26b2aa350927e65d20550ed260d6e" #Econet drivers CONFIG_PACKAGE_kmod-ether=y diff --git a/iopsys-econet/dts/en75xx-base.dtsi b/iopsys-econet/dts/en75xx-base.dtsi index cdd2d7c81..191b7f0c9 100755 --- a/iopsys-econet/dts/en75xx-base.dtsi +++ b/iopsys-econet/dts/en75xx-base.dtsi @@ -156,7 +156,7 @@ <0x1fbe3000 0x200>; //I2C_SLAVE SRAM }; - scu@1fb00000 { + scu: scu@1fb00000 { compatible = "econet,ecnt-scu"; reg = <0x1fb00000 0x960>, //NP SCU <0x1fa20000 0x360>, //CHIP SCU @@ -333,10 +333,25 @@ }; spi_ctrl: spi_controller@1fa10000 { - compatible = "econet,ecnt-spi_ctrl"; + //compatible = "econet,ecnt-spi_ctrl"; + compatible = "econet,en75xx-spi"; + #address-cells = <1>; + #size-cells = <0>; reg = <0x1fa10000 0x140>, //SPI Controller Base <0x00000000 0x1000>; //SPI Controller auto read interrupt test interrupts = <GIC_SPI 51 IRQ_TYPE_LEVEL_HIGH>; + + scu = <&scu>; + spi2nfi = <&spi_spi2nfi>; + spi-ecc = <&spi_ecc>; + + spinand@0 { + compatible = "spi-nand"; + reg = <0x0>; // Chip select + spi-tx-bus-width = <2>; + spi-rx-bus-width = <2>; + spi-max-frequency = <50000000>; + }; }; spi_spi2nfi: spi_spi2nfi@1fa11000 { diff --git a/iopsys-econet/en7562/UNION_EN7562_7915D_ActiveEthWan_KERNEL_5_4_demo.mak b/iopsys-econet/en7562/UNION_EN7562_7915D_ActiveEthWan_KERNEL_5_4_demo.mak index 5abeb548e..cfb2f5ddc 100755 --- a/iopsys-econet/en7562/UNION_EN7562_7915D_ActiveEthWan_KERNEL_5_4_demo.mak +++ b/iopsys-econet/en7562/UNION_EN7562_7915D_ActiveEthWan_KERNEL_5_4_demo.mak @@ -234,7 +234,7 @@ TCSUPPORT_MT7570=y NOT_SUPPORT_BADBLOCK_CHECK=y # TCSUPPORT_NAND_BADBLOCK_CHECK is not set # TCSUPPORT_NAND_RT63368 is not set -TCSUPPORT_NAND_BMT=y +# TCSUPPORT_NAND_BMT is not set # TCSUPPORT_SQUASHFS_ADD_YAFFS is not set TCSUPPORT_RA_HWNAT=y TCSUPPORT_HWNAT_V3=y @@ -266,7 +266,7 @@ TCSUPPORT_EPON_OAM_LAN_DBG=y # TCSUPPORT_UART_DISABLE is not set # TCSUPPORT_UART2 is not set # TCSUPPORT_FE_VIP_ENHANCEMENT is not set -TCSUPPORT_SPI_CONTROLLER_ECC=y +# TCSUPPORT_SPI_CONTROLLER_ECC is not set # TCSUPPORT_NAND_FLASH_OTP is not set # TCSUPPORT_GRE_TUNNEL_HWNAT is not set @@ -430,10 +430,10 @@ TCSUPPORT_MULTICAST_SPEED=y # TCSUPPORT_IGMP_SNOOPING_V3 is not set TCSUPPORT_SMUX=y # TCSUPPORT_MULIF_WAN_SAME_MAC is not set -TCSUPPORT_MTD_PARTITIONS_CMDLINE=y -TCSUPPORT_SQUASHFS_PARTITIONS_CMDLINE_STR="1m[bootloader]a,5m[boot1]a,5m[boot2]a,70m[rootfs1]a,70m[rootfs2]a,10m[overlay1],10m[overlay2],1m[jffs_test],-[ubi_container]a" -TCSUPPORT_UBIFS_PARTITIONS_CMDLINE_STR="1m[bootloader]a,5m[boot1]a,5m[boot2]a,161m[ubi]a,-[ubi_container]a" -TCSUPPORT_PARTITIONS_CMDLINE_STR="1m[bootloader]a,5m[boot1]a,5m[boot2]a,161m[ubi]a,-[ubi_container]a" +# TCSUPPORT_MTD_PARTITIONS_CMDLINE is not set +# TCSUPPORT_SQUASHFS_PARTITIONS_CMDLINE_STR is not set +# TCSUPPORT_UBIFS_PARTITIONS_CMDLINE_STR is not set +# TCSUPPORT_PARTITIONS_CMDLINE_STR is not set TCSUPPORT_MTD_PARTITION_NUM=9 TCSUPPORT_MTD_ENCHANCEMENT=y TCSUPPORT_RESERVEAREA_BLOCK=6 diff --git a/iopsys-econet/en7562/config-5.4 b/iopsys-econet/en7562/config-5.4 index 9c3464ff5..38a675323 100755 --- a/iopsys-econet/en7562/config-5.4 +++ b/iopsys-econet/en7562/config-5.4 @@ -425,15 +425,24 @@ CONFIG_MTD_CFI_ADV_OPTIONS=y CONFIG_MTD_CFI_GEOMETRY=y # CONFIG_MTD_CFI_INTELEXT is not set # CONFIG_MTD_COMPLEX_MAPPINGS is not set -CONFIG_MTD_ECNT=y +# CONFIG_MTD_ECNT is not set CONFIG_MTD_JEDECPROBE=y CONFIG_MTD_NAND_CORE=y -CONFIG_MTD_NAND_ECC_SW_HAMMING=y -CONFIG_MTD_RAW_NAND=y -CONFIG_MTD_SPIFLASH=y +CONFIG_MTD_SPI_NAND=y +CONFIG_ECONET_BMT_BBT_HACK=y +CONFIG_ECONET_READ_FLASH_BYTE_HACK=y + +CONFIG_SPI=y +CONFIG_SPI_MASTER=y +CONFIG_SPI_MEM=y +CONFIG_SPI_EN75XX=y + +# CONFIG_MTD_NAND_ECC_SW_HAMMING is not set +# CONFIG_MTD_RAW_NAND is not set +# CONFIG_MTD_SPIFLASH is not set CONFIG_MTD_UBI=y CONFIG_MTD_UBI_BEB_LIMIT=20 -# CONFIG_MTD_UBI_BLOCK is not set +CONFIG_MTD_UBI_BLOCK=y CONFIG_MTD_UBI_WL_THRESHOLD=4096 CONFIG_MTD_CMDLINE_PARTS=y CONFIG_MUTEX_SPIN_ON_OWNER=y diff --git a/iopsys-econet/rule.mak b/iopsys-econet/rule.mak index 52debd5ef..3cc44823e 100644 --- a/iopsys-econet/rule.mak +++ b/iopsys-econet/rule.mak @@ -142,8 +142,8 @@ export RALINK_PCIE_ADDR_SWAP=1 export TCSUPPORT_HWNAT_WIFI=1 export TCPLATFORM=en7523 export TCSOCNAME=en7523 -export TCSUPPORT_BB_SPI=1 -export TCSUPPORT_BB_NAND=1 +#export TCSUPPORT_BB_SPI=1 +#export TCSUPPORT_BB_NAND=1 export TCSUPPORT_WLAN_SW_RPS=1 export TCSUPPORT_LITTLE_ENDIAN=1 export TCSUPPORT_DDR_CALI=1 @@ -821,6 +821,7 @@ EXTRA_CFLAGS+=-fsigned-char export COMPILE_TOOLCHAIN endif +ifeq ($(strip $(TCSUPPORT_CPU_EN7523)),) ifneq ($(strip $(TCSUPPORT_KERNEL_VERSION)),206022) export TCSUPPORT_SPI_CONTROLLER_ECC=1 #/* ToDo */ @@ -836,6 +837,9 @@ else BSP_CFLAGS+=-I$(KERNEL_ECNT_DIR)/drivers/mtd/econet endif endif +else +BSP_CFLAGS+=-I$(GLOBAL_INC_DIR)/modules +endif ifeq ($(strip $(TCSUPPORT_SECURE_BOOT)),) export TCSUPPORT_SECURE_BOOT_VERSION=0 -- GitLab