aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2022-04-21 19:55:38 -0400
committerTom Rini <trini@konsulko.com>2022-04-21 19:55:38 -0400
commitea5583b90f9c162af6f2025718dc50ffbb6e4552 (patch)
tree91f01f0434711bb9c31a311c0ba0e876c9627a8f
parente50f66e364be80e02dd0834b84b830f3aade82ea (diff)
parent151a030063898e5c8b03b40c3a96b073db0b0dc7 (diff)
Merge branch '2022-04-21-further-cleanups'
- Fix SPL_SYS_MALLOC_SIMPLE and non-SPL_FRAMEWORK boards (a large number of PowerPC platforms) - Remove duplication of crc16 functionality - Migrate COUNTER_FREQUENCY to CONFIG_COUNTER_FREQUENCY and have it in Kconfig
-rw-r--r--Kconfig1
-rw-r--r--arch/arm/Kconfig17
-rw-r--r--arch/arm/cpu/armv7/ls102xa/psci.S2
-rw-r--r--arch/arm/cpu/armv7/ls102xa/timer.c2
-rw-r--r--arch/arm/cpu/armv7/nonsec_virt.S4
-rw-r--r--arch/arm/cpu/armv7/sunxi/psci.c2
-rw-r--r--arch/arm/cpu/armv8/fsl-layerscape/spintable.S2
-rw-r--r--arch/arm/cpu/armv8/start.S4
-rw-r--r--arch/arm/mach-rockchip/rk3036-board-spl.c2
-rw-r--r--arch/arm/mach-rockchip/spl.c2
-rw-r--r--arch/arm/mach-rockchip/tpl.c2
-rw-r--r--arch/arm/mach-versal/Kconfig6
-rw-r--r--board/sunxi/board.c6
-rw-r--r--board/xilinx/versal/board.c2
-rw-r--r--configs/a3y17lte_defconfig1
-rw-r--r--configs/a5y17lte_defconfig1
-rw-r--r--configs/a7y17lte_defconfig1
-rw-r--r--configs/bubblegum_96_defconfig1
-rw-r--r--configs/chromebook_bob_defconfig1
-rw-r--r--configs/chromebook_kevin_defconfig1
-rw-r--r--configs/cortina_presidio-asic-base_defconfig1
-rw-r--r--configs/cortina_presidio-asic-emmc_defconfig1
-rw-r--r--configs/cortina_presidio-asic-pnand_defconfig1
-rw-r--r--configs/cubieboard7_defconfig1
-rw-r--r--configs/dragonboard410c_defconfig1
-rw-r--r--configs/dragonboard820c_defconfig1
-rw-r--r--configs/evb-px30_defconfig1
-rw-r--r--configs/evb-px5_defconfig1
-rw-r--r--configs/evb-rk3308_defconfig1
-rw-r--r--configs/evb-rk3328_defconfig1
-rw-r--r--configs/evb-rk3399_defconfig1
-rw-r--r--configs/evb-rk3568_defconfig1
-rw-r--r--configs/ficus-rk3399_defconfig1
-rw-r--r--configs/firefly-px30_defconfig1
-rw-r--r--configs/firefly-rk3399_defconfig1
-rw-r--r--configs/geekbox_defconfig1
-rw-r--r--configs/hihope_rzg2_defconfig1
-rw-r--r--configs/hikey960_defconfig1
-rw-r--r--configs/hikey_defconfig1
-rw-r--r--configs/khadas-edge-captain-rk3399_defconfig1
-rw-r--r--configs/khadas-edge-rk3399_defconfig1
-rw-r--r--configs/khadas-edge-v-rk3399_defconfig1
-rw-r--r--configs/kontron_sl28_defconfig1
-rw-r--r--configs/leez-rk3399_defconfig1
-rw-r--r--configs/lion-rk3368_defconfig1
-rw-r--r--configs/ls1012a2g5rdb_qspi_defconfig1
-rw-r--r--configs/ls1012a2g5rdb_tfa_defconfig1
-rw-r--r--configs/ls1012afrdm_qspi_defconfig1
-rw-r--r--configs/ls1012afrdm_tfa_defconfig1
-rw-r--r--configs/ls1012afrwy_qspi_SECURE_BOOT_defconfig1
-rw-r--r--configs/ls1012afrwy_qspi_defconfig1
-rw-r--r--configs/ls1012afrwy_tfa_SECURE_BOOT_defconfig1
-rw-r--r--configs/ls1012afrwy_tfa_defconfig1
-rw-r--r--configs/ls1012aqds_qspi_defconfig1
-rw-r--r--configs/ls1012aqds_tfa_SECURE_BOOT_defconfig1
-rw-r--r--configs/ls1012aqds_tfa_defconfig1
-rw-r--r--configs/ls1012ardb_qspi_SECURE_BOOT_defconfig1
-rw-r--r--configs/ls1012ardb_qspi_defconfig1
-rw-r--r--configs/ls1012ardb_tfa_SECURE_BOOT_defconfig1
-rw-r--r--configs/ls1012ardb_tfa_defconfig1
-rw-r--r--configs/ls1021aiot_qspi_defconfig1
-rw-r--r--configs/ls1021aiot_sdcard_defconfig1
-rw-r--r--configs/ls1021aqds_ddr4_nor_defconfig1
-rw-r--r--configs/ls1021aqds_ddr4_nor_lpuart_defconfig1
-rw-r--r--configs/ls1021aqds_nand_defconfig1
-rw-r--r--configs/ls1021aqds_nor_SECURE_BOOT_defconfig1
-rw-r--r--configs/ls1021aqds_nor_defconfig1
-rw-r--r--configs/ls1021aqds_nor_lpuart_defconfig1
-rw-r--r--configs/ls1021aqds_qspi_defconfig1
-rw-r--r--configs/ls1021aqds_sdcard_ifc_defconfig1
-rw-r--r--configs/ls1021aqds_sdcard_qspi_defconfig1
-rw-r--r--configs/ls1021atsn_qspi_defconfig1
-rw-r--r--configs/ls1021atsn_sdcard_defconfig1
-rw-r--r--configs/ls1021atwr_nor_SECURE_BOOT_defconfig1
-rw-r--r--configs/ls1021atwr_nor_defconfig1
-rw-r--r--configs/ls1021atwr_nor_lpuart_defconfig1
-rw-r--r--configs/ls1021atwr_qspi_defconfig1
-rw-r--r--configs/ls1021atwr_sdcard_ifc_SECURE_BOOT_defconfig1
-rw-r--r--configs/ls1021atwr_sdcard_ifc_defconfig1
-rw-r--r--configs/ls1021atwr_sdcard_qspi_defconfig1
-rw-r--r--configs/ls1028aqds_tfa_SECURE_BOOT_defconfig1
-rw-r--r--configs/ls1028aqds_tfa_defconfig1
-rw-r--r--configs/ls1028aqds_tfa_lpuart_defconfig1
-rw-r--r--configs/ls1028ardb_tfa_SECURE_BOOT_defconfig1
-rw-r--r--configs/ls1028ardb_tfa_defconfig1
-rw-r--r--configs/ls1043aqds_defconfig1
-rw-r--r--configs/ls1043aqds_lpuart_defconfig1
-rw-r--r--configs/ls1043aqds_nand_defconfig1
-rw-r--r--configs/ls1043aqds_nor_ddr3_defconfig1
-rw-r--r--configs/ls1043aqds_qspi_defconfig1
-rw-r--r--configs/ls1043aqds_sdcard_ifc_defconfig1
-rw-r--r--configs/ls1043aqds_sdcard_qspi_defconfig1
-rw-r--r--configs/ls1043aqds_tfa_SECURE_BOOT_defconfig1
-rw-r--r--configs/ls1043aqds_tfa_defconfig1
-rw-r--r--configs/ls1043ardb_SECURE_BOOT_defconfig1
-rw-r--r--configs/ls1043ardb_defconfig1
-rw-r--r--configs/ls1043ardb_nand_SECURE_BOOT_defconfig1
-rw-r--r--configs/ls1043ardb_nand_defconfig1
-rw-r--r--configs/ls1043ardb_sdcard_SECURE_BOOT_defconfig1
-rw-r--r--configs/ls1043ardb_sdcard_defconfig1
-rw-r--r--configs/ls1043ardb_tfa_SECURE_BOOT_defconfig1
-rw-r--r--configs/ls1043ardb_tfa_defconfig1
-rw-r--r--configs/ls1046afrwy_tfa_SECURE_BOOT_defconfig1
-rw-r--r--configs/ls1046afrwy_tfa_defconfig1
-rw-r--r--configs/ls1046aqds_SECURE_BOOT_defconfig1
-rw-r--r--configs/ls1046aqds_defconfig1
-rw-r--r--configs/ls1046aqds_lpuart_defconfig1
-rw-r--r--configs/ls1046aqds_nand_defconfig1
-rw-r--r--configs/ls1046aqds_qspi_defconfig1
-rw-r--r--configs/ls1046aqds_sdcard_ifc_defconfig1
-rw-r--r--configs/ls1046aqds_sdcard_qspi_defconfig1
-rw-r--r--configs/ls1046aqds_tfa_SECURE_BOOT_defconfig1
-rw-r--r--configs/ls1046aqds_tfa_defconfig1
-rw-r--r--configs/ls1046ardb_emmc_defconfig1
-rw-r--r--configs/ls1046ardb_qspi_SECURE_BOOT_defconfig1
-rw-r--r--configs/ls1046ardb_qspi_defconfig1
-rw-r--r--configs/ls1046ardb_qspi_spl_defconfig1
-rw-r--r--configs/ls1046ardb_sdcard_SECURE_BOOT_defconfig1
-rw-r--r--configs/ls1046ardb_sdcard_defconfig1
-rw-r--r--configs/ls1046ardb_tfa_SECURE_BOOT_defconfig1
-rw-r--r--configs/ls1046ardb_tfa_defconfig1
-rw-r--r--configs/ls2080aqds_SECURE_BOOT_defconfig1
-rw-r--r--configs/ls2080aqds_defconfig1
-rw-r--r--configs/ls2080aqds_nand_defconfig1
-rw-r--r--configs/ls2080aqds_qspi_defconfig1
-rw-r--r--configs/ls2080aqds_sdcard_defconfig1
-rw-r--r--configs/ls2080ardb_SECURE_BOOT_defconfig1
-rw-r--r--configs/ls2080ardb_defconfig1
-rw-r--r--configs/ls2080ardb_nand_defconfig1
-rw-r--r--configs/ls2081ardb_defconfig1
-rw-r--r--configs/ls2088aqds_tfa_defconfig1
-rw-r--r--configs/ls2088ardb_qspi_SECURE_BOOT_defconfig1
-rw-r--r--configs/ls2088ardb_qspi_defconfig1
-rw-r--r--configs/ls2088ardb_tfa_SECURE_BOOT_defconfig1
-rw-r--r--configs/ls2088ardb_tfa_defconfig1
-rw-r--r--configs/mt8183_pumpkin_defconfig1
-rw-r--r--configs/mt8512_bm1_emmc_defconfig1
-rw-r--r--configs/mt8516_pumpkin_defconfig1
-rw-r--r--configs/mt8518_ap1_emmc_defconfig1
-rw-r--r--configs/nanopc-t4-rk3399_defconfig1
-rw-r--r--configs/nanopi-m4-2gb-rk3399_defconfig1
-rw-r--r--configs/nanopi-m4-rk3399_defconfig1
-rw-r--r--configs/nanopi-m4b-rk3399_defconfig1
-rw-r--r--configs/nanopi-neo4-rk3399_defconfig1
-rw-r--r--configs/nanopi-r2s-rk3328_defconfig1
-rw-r--r--configs/nanopi-r4s-rk3399_defconfig1
-rw-r--r--configs/odroid-go2_defconfig1
-rw-r--r--configs/orangepi-rk3399_defconfig1
-rw-r--r--configs/p2371-2180_defconfig1
-rw-r--r--configs/p2771-0000-000_defconfig1
-rw-r--r--configs/p2771-0000-500_defconfig1
-rw-r--r--configs/p3450-0000_defconfig1
-rw-r--r--configs/pg_wcom_expu1_defconfig1
-rw-r--r--configs/pg_wcom_expu1_update_defconfig1
-rw-r--r--configs/pg_wcom_seli8_defconfig1
-rw-r--r--configs/pg_wcom_seli8_update_defconfig1
-rw-r--r--configs/pinebook-pro-rk3399_defconfig1
-rw-r--r--configs/puma-rk3399_defconfig1
-rw-r--r--configs/px30-core-ctouch2-of10-px30_defconfig1
-rw-r--r--configs/px30-core-ctouch2-px30_defconfig1
-rw-r--r--configs/px30-core-edimm2.2-px30_defconfig1
-rw-r--r--configs/r8a77970_eagle_defconfig1
-rw-r--r--configs/r8a77980_condor_defconfig1
-rw-r--r--configs/r8a77990_ebisu_defconfig1
-rw-r--r--configs/r8a77995_draak_defconfig1
-rw-r--r--configs/r8a779a0_falcon_defconfig1
-rw-r--r--configs/rcar3_salvator-x_defconfig1
-rw-r--r--configs/rcar3_ulcb_defconfig1
-rw-r--r--configs/roc-cc-rk3308_defconfig1
-rw-r--r--configs/roc-cc-rk3328_defconfig1
-rw-r--r--configs/roc-pc-mezzanine-rk3399_defconfig1
-rw-r--r--configs/roc-pc-rk3399_defconfig1
-rw-r--r--configs/rock-pi-4-rk3399_defconfig1
-rw-r--r--configs/rock-pi-4c-rk3399_defconfig1
-rw-r--r--configs/rock-pi-e-rk3328_defconfig1
-rw-r--r--configs/rock-pi-n10-rk3399pro_defconfig1
-rw-r--r--configs/rock64-rk3328_defconfig1
-rw-r--r--configs/rock960-rk3399_defconfig1
-rw-r--r--configs/rockpro64-rk3399_defconfig1
-rw-r--r--configs/sheep-rk3368_defconfig1
-rw-r--r--configs/silinux_ek874_defconfig1
-rw-r--r--configs/socfpga_agilex_atf_defconfig1
-rw-r--r--configs/socfpga_agilex_defconfig1
-rw-r--r--configs/socfpga_agilex_vab_defconfig1
-rw-r--r--configs/socfpga_n5x_atf_defconfig1
-rw-r--r--configs/socfpga_n5x_defconfig1
-rw-r--r--configs/socfpga_n5x_vab_defconfig1
-rw-r--r--configs/socfpga_stratix10_atf_defconfig1
-rw-r--r--configs/socfpga_stratix10_defconfig1
-rw-r--r--configs/starqltechn_defconfig1
-rw-r--r--configs/thunderx_88xx_defconfig1
-rw-r--r--configs/vexpress_aemv8a_juno_defconfig1
-rw-r--r--configs/vexpress_aemv8a_semi_defconfig1
-rw-r--r--configs/vexpress_aemv8r_defconfig1
-rw-r--r--configs/xilinx_versal_mini_defconfig2
-rw-r--r--configs/xilinx_versal_mini_emmc0_defconfig2
-rw-r--r--configs/xilinx_versal_mini_emmc1_defconfig2
-rw-r--r--configs/xilinx_versal_virt_defconfig2
-rw-r--r--drivers/misc/Kconfig1
-rw-r--r--drivers/misc/atsha204a-i2c.c122
-rw-r--r--fs/ext4/Makefile2
-rw-r--r--fs/ext4/crc16.c62
-rw-r--r--fs/ext4/crc16.h16
-rw-r--r--fs/ext4/ext4_common.c8
-rw-r--r--fs/ext4/ext4_common.h2
-rw-r--r--fs/ubifs/Makefile2
-rw-r--r--fs/ubifs/crc16.c60
-rw-r--r--fs/ubifs/lpt.c2
-rw-r--r--fs/ubifs/lpt_commit.c2
-rw-r--r--include/configs/apalis-imx8.h3
-rw-r--r--include/configs/apalis-imx8x.h3
-rw-r--r--include/configs/capricorn-common.h3
-rw-r--r--include/configs/cgtqmx8.h3
-rw-r--r--include/configs/colibri-imx8x.h1
-rw-r--r--include/configs/condor.h3
-rw-r--r--include/configs/draak.h3
-rw-r--r--include/configs/dragonboard410c.h3
-rw-r--r--include/configs/dragonboard820c.h3
-rw-r--r--include/configs/eagle.h3
-rw-r--r--include/configs/ebisu.h3
-rw-r--r--include/configs/exynos-common.h1
-rw-r--r--include/configs/exynos7420-common.h3
-rw-r--r--include/configs/exynos78x0-common.h3
-rw-r--r--include/configs/falcon.h3
-rw-r--r--include/configs/hihope-rzg2.h3
-rw-r--r--include/configs/hikey.h3
-rw-r--r--include/configs/hikey960.h3
-rw-r--r--include/configs/imx8qm_mek.h3
-rw-r--r--include/configs/imx8qm_rom7720.h3
-rw-r--r--include/configs/imx8qxp_mek.h3
-rw-r--r--include/configs/imx8ulp_evk.h2
-rw-r--r--include/configs/km/pg-wcom-ls102xa.h1
-rw-r--r--include/configs/kontron_sl28.h1
-rw-r--r--include/configs/ls1012a_common.h3
-rw-r--r--include/configs/ls1021aiot.h1
-rw-r--r--include/configs/ls1021aqds.h1
-rw-r--r--include/configs/ls1021atsn.h1
-rw-r--r--include/configs/ls1021atwr.h1
-rw-r--r--include/configs/ls1028a_common.h3
-rw-r--r--include/configs/ls1043a_common.h3
-rw-r--r--include/configs/ls1046a_common.h3
-rw-r--r--include/configs/ls1088aqds.h1
-rw-r--r--include/configs/ls1088ardb.h1
-rw-r--r--include/configs/ls2080a_common.h2
-rw-r--r--include/configs/lx2160a_common.h1
-rw-r--r--include/configs/mt8183.h1
-rw-r--r--include/configs/mt8512.h1
-rw-r--r--include/configs/mt8516.h1
-rw-r--r--include/configs/mt8518.h1
-rw-r--r--include/configs/mx6_common.h1
-rw-r--r--include/configs/mx7_common.h1
-rw-r--r--include/configs/owl-common.h3
-rw-r--r--include/configs/p2371-2180.h3
-rw-r--r--include/configs/p2771-0000.h3
-rw-r--r--include/configs/p3450-0000.h3
-rw-r--r--include/configs/presidio_asic.h3
-rw-r--r--include/configs/px30_common.h2
-rw-r--r--include/configs/rk3036_common.h1
-rw-r--r--include/configs/rk3128_common.h1
-rw-r--r--include/configs/rk322x_common.h1
-rw-r--r--include/configs/rk3288_common.h1
-rw-r--r--include/configs/rk3308_common.h1
-rw-r--r--include/configs/rk3328_common.h2
-rw-r--r--include/configs/rk3368_common.h2
-rw-r--r--include/configs/rk3399_common.h2
-rw-r--r--include/configs/rk3568_common.h2
-rw-r--r--include/configs/salvator-x.h3
-rw-r--r--include/configs/sdm845.h3
-rw-r--r--include/configs/silinux-ek874.h3
-rw-r--r--include/configs/socfpga_soc64_common.h5
-rw-r--r--include/configs/sunxi-common.h1
-rw-r--r--include/configs/ten64.h1
-rw-r--r--include/configs/thunderx_88xx.h3
-rw-r--r--include/configs/ulcb.h3
-rw-r--r--include/configs/vexpress_aemv8.h3
-rw-r--r--include/configs/xilinx_versal.h5
-rw-r--r--include/configs/xilinx_zynqmp.h5
-rw-r--r--include/linux/crc16.h (renamed from fs/ubifs/crc16.h)0
-rw-r--r--include/u-boot/crc.h5
-rw-r--r--lib/Makefile7
-rw-r--r--lib/crc16-ccitt.c84
-rw-r--r--lib/crc16.c124
-rw-r--r--tools/Makefile2
283 files changed, 374 insertions, 524 deletions
diff --git a/Kconfig b/Kconfig
index 429e5d3dbb..bdae59e06f 100644
--- a/Kconfig
+++ b/Kconfig
@@ -283,6 +283,7 @@ config SYS_MALLOC_LEN
config SPL_SYS_MALLOC_F_LEN
hex "Size of malloc() pool in SPL"
depends on SYS_MALLOC_F && SPL
+ default 0 if !SPL_FRAMEWORK
default 0x2800 if RCAR_GEN3
default SYS_MALLOC_F_LEN
help
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 9470122b69..13be6b6195 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -20,6 +20,23 @@ config ARM64_CRC32
not be present on all ARMv8.0, but is always present on ARMv8.1 and
newer.
+config COUNTER_FREQUENCY
+ int "Timer clock frequency"
+ depends on ARM64 || CPU_V7A
+ default 8000000 if IMX8 || MX7 || MX6UL || MX6ULL
+ default 24000000 if ARCH_SUNXI || ARCH_EXYNOS || ROCKCHIP_RK3128 || \
+ ROCKCHIP_RK3288 || ROCKCHIP_RK322X || ROCKCHIP_RK3036
+ default 25000000 if ARCH_LX2160A || ARCH_LX2162A || ARCH_LS1088A
+ default 100000000 if ARCH_ZYNQMP
+ default 0
+ help
+ For platforms with ARMv8-A and ARMv7-A which features a system
+ counter, those platforms needs software to program the counter
+ frequency. Setup time clock frequency for certain platform.
+ 0 means no need to configure the system counter frequency.
+ For platforms needs the frequency set in U-Boot with a
+ pre-defined value, should have the macro defined as a non-zero value.
+
config POSITION_INDEPENDENT
bool "Generate position-independent pre-relocation code"
depends on ARM64 || CPU_V7A
diff --git a/arch/arm/cpu/armv7/ls102xa/psci.S b/arch/arm/cpu/armv7/ls102xa/psci.S
index 531cfb033b..3956178369 100644
--- a/arch/arm/cpu/armv7/ls102xa/psci.S
+++ b/arch/arm/cpu/armv7/ls102xa/psci.S
@@ -36,7 +36,7 @@
.align 5
-#define ONE_MS (COUNTER_FREQUENCY / 1000)
+#define ONE_MS (CONFIG_COUNTER_FREQUENCY / 1000)
#define RESET_WAIT (30 * ONE_MS)
.globl psci_version
diff --git a/arch/arm/cpu/armv7/ls102xa/timer.c b/arch/arm/cpu/armv7/ls102xa/timer.c
index d79bf105f1..c6126b10c3 100644
--- a/arch/arm/cpu/armv7/ls102xa/timer.c
+++ b/arch/arm/cpu/armv7/ls102xa/timer.c
@@ -65,7 +65,7 @@ int timer_init(void)
/* Enable System Counter */
writel(SYS_COUNTER_CTRL_ENABLE, &sctr->cntcr);
- freq = COUNTER_FREQUENCY;
+ freq = CONFIG_COUNTER_FREQUENCY;
asm("mcr p15, 0, %0, c14, c0, 0" : : "r" (freq));
/* Set PL1 Physical Timer Ctrl */
diff --git a/arch/arm/cpu/armv7/nonsec_virt.S b/arch/arm/cpu/armv7/nonsec_virt.S
index 1773fae205..39aeeb423f 100644
--- a/arch/arm/cpu/armv7/nonsec_virt.S
+++ b/arch/arm/cpu/armv7/nonsec_virt.S
@@ -189,11 +189,11 @@ ENTRY(_nonsec_init)
* we do this here instead.
* But first check if we have the generic timer.
*/
-#ifdef COUNTER_FREQUENCY
+#if CONFIG_COUNTER_FREQUENCY
mrc p15, 0, r0, c0, c1, 1 @ read ID_PFR1
and r0, r0, #CPUID_ARM_GENTIMER_MASK @ mask arch timer bits
cmp r0, #(1 << CPUID_ARM_GENTIMER_SHIFT)
- ldreq r1, =COUNTER_FREQUENCY
+ ldreq r1, =CONFIG_COUNTER_FREQUENCY
mcreq p15, 0, r1, c14, c0, 0 @ write CNTFRQ
#endif
diff --git a/arch/arm/cpu/armv7/sunxi/psci.c b/arch/arm/cpu/armv7/sunxi/psci.c
index 1ac50f558a..d1bd6b9be4 100644
--- a/arch/arm/cpu/armv7/sunxi/psci.c
+++ b/arch/arm/cpu/armv7/sunxi/psci.c
@@ -57,7 +57,7 @@ static u32 __secure cp15_read_cntp_ctl(void)
return val;
}
-#define ONE_MS (COUNTER_FREQUENCY / 1000)
+#define ONE_MS (CONFIG_COUNTER_FREQUENCY / 1000)
static void __secure __mdelay(u32 ms)
{
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/spintable.S b/arch/arm/cpu/armv8/fsl-layerscape/spintable.S
index d6bd188459..1eb0c2d4a7 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/spintable.S
+++ b/arch/arm/cpu/armv8/fsl-layerscape/spintable.S
@@ -113,6 +113,6 @@ _dead_loop:
.align 3
.global __real_cntfrq
__real_cntfrq:
- .quad COUNTER_FREQUENCY
+ .quad CONFIG_COUNTER_FREQUENCY
/* Secondary Boot Code ends here */
__secondary_boot_code_end:
diff --git a/arch/arm/cpu/armv8/start.S b/arch/arm/cpu/armv8/start.S
index 6a6a4f8650..d328e8c08a 100644
--- a/arch/arm/cpu/armv8/start.S
+++ b/arch/arm/cpu/armv8/start.S
@@ -138,9 +138,9 @@ pie_fixup_done:
0:
msr daifclr, #0x4 /* Unmask SError interrupts */
-#ifdef COUNTER_FREQUENCY
+#if CONFIG_COUNTER_FREQUENCY
branch_if_not_highest_el x0, 4f
- ldr x0, =COUNTER_FREQUENCY
+ ldr x0, =CONFIG_COUNTER_FREQUENCY
msr cntfrq_el0, x0 /* Initialize CNTFRQ */
#endif
diff --git a/arch/arm/mach-rockchip/rk3036-board-spl.c b/arch/arm/mach-rockchip/rk3036-board-spl.c
index 6eb89e15b8..73f6d241a1 100644
--- a/arch/arm/mach-rockchip/rk3036-board-spl.c
+++ b/arch/arm/mach-rockchip/rk3036-board-spl.c
@@ -20,7 +20,7 @@
void rockchip_stimer_init(void)
{
asm volatile("mcr p15, 0, %0, c14, c0, 0"
- : : "r"(COUNTER_FREQUENCY));
+ : : "r"(CONFIG_COUNTER_FREQUENCY));
writel(0, CONFIG_ROCKCHIP_STIMER_BASE + TIMER_CONTROL_REG);
writel(0xffffffff, CONFIG_ROCKCHIP_STIMER_BASE);
diff --git a/arch/arm/mach-rockchip/spl.c b/arch/arm/mach-rockchip/spl.c
index eda2248029..30be640425 100644
--- a/arch/arm/mach-rockchip/spl.c
+++ b/arch/arm/mach-rockchip/spl.c
@@ -88,7 +88,7 @@ __weak void rockchip_stimer_init(void)
return;
#ifndef CONFIG_ARM64
asm volatile("mcr p15, 0, %0, c14, c0, 0"
- : : "r"(COUNTER_FREQUENCY));
+ : : "r"(CONFIG_COUNTER_FREQUENCY));
#endif
writel(0, CONFIG_ROCKCHIP_STIMER_BASE + TIMER_CONTROL_REG);
writel(0xffffffff, CONFIG_ROCKCHIP_STIMER_BASE);
diff --git a/arch/arm/mach-rockchip/tpl.c b/arch/arm/mach-rockchip/tpl.c
index 8126587060..ed46a9ad28 100644
--- a/arch/arm/mach-rockchip/tpl.c
+++ b/arch/arm/mach-rockchip/tpl.c
@@ -39,7 +39,7 @@ __weak void rockchip_stimer_init(void)
#ifndef CONFIG_ARM64
asm volatile("mcr p15, 0, %0, c14, c0, 0"
- : : "r"(COUNTER_FREQUENCY));
+ : : "r"(CONFIG_COUNTER_FREQUENCY));
#endif
writel(0, CONFIG_ROCKCHIP_STIMER_BASE + TIMER_CONTROL_REG);
diff --git a/arch/arm/mach-versal/Kconfig b/arch/arm/mach-versal/Kconfig
index 0c6ad345ff..645f06add4 100644
--- a/arch/arm/mach-versal/Kconfig
+++ b/arch/arm/mach-versal/Kconfig
@@ -24,12 +24,6 @@ config SYS_CONFIG_NAME
config SYS_MALLOC_LEN
default 0x2000000
-config COUNTER_FREQUENCY
- int "Timer clock frequency"
- default 0
- help
- Setup time clock frequency for certain platform
-
config ZYNQ_SDHCI_MAX_FREQ
default 200000000
diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 89324159d5..371ed9eeba 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -202,14 +202,14 @@ int board_init(void)
* we avoid the risk of writing to it.
*/
asm volatile("mrc p15, 0, %0, c14, c0, 0" : "=r"(freq));
- if (freq != COUNTER_FREQUENCY) {
+ if (freq != CONFIG_COUNTER_FREQUENCY) {
debug("arch timer frequency is %d Hz, should be %d, fixing ...\n",
- freq, COUNTER_FREQUENCY);
+ freq, CONFIG_COUNTER_FREQUENCY);
#ifdef CONFIG_NON_SECURE
printf("arch timer frequency is wrong, but cannot adjust it\n");
#else
asm volatile("mcr p15, 0, %0, c14, c0, 0"
- : : "r"(COUNTER_FREQUENCY));
+ : : "r"(CONFIG_COUNTER_FREQUENCY));
#endif
}
}
diff --git a/board/xilinx/versal/board.c b/board/xilinx/versal/board.c
index 9940f2aeb3..2e2807eee4 100644
--- a/board/xilinx/versal/board.c
+++ b/board/xilinx/versal/board.c
@@ -74,7 +74,7 @@ int board_early_init_r(void)
* Program freq register in System counter and
* enable system counter.
*/
- writel(COUNTER_FREQUENCY,
+ writel(CONFIG_COUNTER_FREQUENCY,
&iou_scntr_secure->base_frequency_id_register);
debug("counter val 0x%x\n",
diff --git a/configs/a3y17lte_defconfig b/configs/a3y17lte_defconfig
index 8636f151d8..536e23e1df 100644
--- a/configs/a3y17lte_defconfig
+++ b/configs/a3y17lte_defconfig
@@ -1,6 +1,7 @@
CONFIG_ARM=y
CONFIG_SYS_CONFIG_NAME="exynos78x0-common"
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=26000000
CONFIG_ARCH_EXYNOS=y
CONFIG_SYS_TEXT_BASE=0x40001000
CONFIG_SYS_MALLOC_F_LEN=0x400
diff --git a/configs/a5y17lte_defconfig b/configs/a5y17lte_defconfig
index 97fa87c727..c6f452a855 100644
--- a/configs/a5y17lte_defconfig
+++ b/configs/a5y17lte_defconfig
@@ -1,6 +1,7 @@
CONFIG_ARM=y
CONFIG_SYS_CONFIG_NAME="exynos78x0-common"
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=26000000
CONFIG_ARCH_EXYNOS=y
CONFIG_SYS_TEXT_BASE=0x40001000
CONFIG_SYS_MALLOC_F_LEN=0x400
diff --git a/configs/a7y17lte_defconfig b/configs/a7y17lte_defconfig
index 9e66425988..28e9c097d1 100644
--- a/configs/a7y17lte_defconfig
+++ b/configs/a7y17lte_defconfig
@@ -1,6 +1,7 @@
CONFIG_ARM=y
CONFIG_SYS_CONFIG_NAME="exynos78x0-common"
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=26000000
CONFIG_ARCH_EXYNOS=y
CONFIG_SYS_TEXT_BASE=0x40001000
CONFIG_SYS_MALLOC_F_LEN=0x400
diff --git a/configs/bubblegum_96_defconfig b/configs/bubblegum_96_defconfig
index f4e6abc411..a21b245c84 100644
--- a/configs/bubblegum_96_defconfig
+++ b/configs/bubblegum_96_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_OWL=y
CONFIG_SYS_MALLOC_LEN=0x2000000
CONFIG_ENV_SIZE=0x2000
diff --git a/configs/chromebook_bob_defconfig b/configs/chromebook_bob_defconfig
index 638c65d79a..1b2db5d0a8 100644
--- a/configs/chromebook_bob_defconfig
+++ b/configs/chromebook_bob_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_SPL_GPIO=y
diff --git a/configs/chromebook_kevin_defconfig b/configs/chromebook_kevin_defconfig
index 38c1403b99..ad6cbca198 100644
--- a/configs/chromebook_kevin_defconfig
+++ b/configs/chromebook_kevin_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_SPL_GPIO=y
diff --git a/configs/cortina_presidio-asic-base_defconfig b/configs/cortina_presidio-asic-base_defconfig
index 4a8377a3fd..6514f0753e 100644
--- a/configs/cortina_presidio-asic-base_defconfig
+++ b/configs/cortina_presidio-asic-base_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
# CONFIG_SYS_ARCH_TIMER is not set
CONFIG_TARGET_PRESIDIO_ASIC=y
CONFIG_SYS_TEXT_BASE=0x04000000
diff --git a/configs/cortina_presidio-asic-emmc_defconfig b/configs/cortina_presidio-asic-emmc_defconfig
index 236520e8a3..b0bd54f7cb 100644
--- a/configs/cortina_presidio-asic-emmc_defconfig
+++ b/configs/cortina_presidio-asic-emmc_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
# CONFIG_SYS_ARCH_TIMER is not set
CONFIG_TARGET_PRESIDIO_ASIC=y
CONFIG_SYS_TEXT_BASE=0x04000000
diff --git a/configs/cortina_presidio-asic-pnand_defconfig b/configs/cortina_presidio-asic-pnand_defconfig
index 06eaa5f15e..944fed6ca0 100644
--- a/configs/cortina_presidio-asic-pnand_defconfig
+++ b/configs/cortina_presidio-asic-pnand_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
# CONFIG_SYS_ARCH_TIMER is not set
CONFIG_TARGET_PRESIDIO_ASIC=y
CONFIG_SYS_TEXT_BASE=0x04000000
diff --git a/configs/cubieboard7_defconfig b/configs/cubieboard7_defconfig
index e73d8d8ed7..677bff64b9 100644
--- a/configs/cubieboard7_defconfig
+++ b/configs/cubieboard7_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_OWL=y
CONFIG_SYS_MALLOC_LEN=0x2000000
CONFIG_DEFAULT_DEVICE_TREE="s700-cubieboard7"
diff --git a/configs/dragonboard410c_defconfig b/configs/dragonboard410c_defconfig
index 33cb31c725..dc136f9861 100644
--- a/configs/dragonboard410c_defconfig
+++ b/configs/dragonboard410c_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=19000000
CONFIG_ARCH_SNAPDRAGON=y
CONFIG_SYS_TEXT_BASE=0x8f600000
CONFIG_SYS_MALLOC_LEN=0x802000
diff --git a/configs/dragonboard820c_defconfig b/configs/dragonboard820c_defconfig
index 4797153968..3bd22aa34f 100644
--- a/configs/dragonboard820c_defconfig
+++ b/configs/dragonboard820c_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=19000000
CONFIG_ARCH_SNAPDRAGON=y
CONFIG_SYS_TEXT_BASE=0x80080000
CONFIG_SYS_MALLOC_LEN=0x804000
diff --git a/configs/evb-px30_defconfig b/configs/evb-px30_defconfig
index 061d76e86a..36eaf4e6b9 100644
--- a/configs/evb-px30_defconfig
+++ b/configs/evb-px30_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_SYS_MALLOC_F_LEN=0x2000
diff --git a/configs/evb-px5_defconfig b/configs/evb-px5_defconfig
index 581b8cdfad..1e2b0f0308 100644
--- a/configs/evb-px5_defconfig
+++ b/configs/evb-px5_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_NR_DRAM_BANKS=1
diff --git a/configs/evb-rk3308_defconfig b/configs/evb-rk3308_defconfig
index 26d124827e..b4ce8a1a39 100644
--- a/configs/evb-rk3308_defconfig
+++ b/configs/evb-rk3308_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00600000
CONFIG_SYS_MALLOC_F_LEN=0x2000
diff --git a/configs/evb-rk3328_defconfig b/configs/evb-rk3328_defconfig
index 78fb93bf97..7e0c4c50a6 100644
--- a/configs/evb-rk3328_defconfig
+++ b/configs/evb-rk3328_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_NR_DRAM_BANKS=1
diff --git a/configs/evb-rk3399_defconfig b/configs/evb-rk3399_defconfig
index a18e622580..a9afb63fdd 100644
--- a/configs/evb-rk3399_defconfig
+++ b/configs/evb-rk3399_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_NR_DRAM_BANKS=1
diff --git a/configs/evb-rk3568_defconfig b/configs/evb-rk3568_defconfig
index a472043583..d2af961eaf 100644
--- a/configs/evb-rk3568_defconfig
+++ b/configs/evb-rk3568_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00a00000
CONFIG_SPL_LIBCOMMON_SUPPORT=y
diff --git a/configs/ficus-rk3399_defconfig b/configs/ficus-rk3399_defconfig
index 33d67818ac..1ee3cb225b 100644
--- a/configs/ficus-rk3399_defconfig
+++ b/configs/ficus-rk3399_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_ENV_OFFSET=0x3F8000
diff --git a/configs/firefly-px30_defconfig b/configs/firefly-px30_defconfig
index 873b34b792..01858a65b4 100644
--- a/configs/firefly-px30_defconfig
+++ b/configs/firefly-px30_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_SYS_MALLOC_F_LEN=0x2000
diff --git a/configs/firefly-rk3399_defconfig b/configs/firefly-rk3399_defconfig
index 2858c35d10..3803e42f38 100644
--- a/configs/firefly-rk3399_defconfig
+++ b/configs/firefly-rk3399_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_NR_DRAM_BANKS=1
diff --git a/configs/geekbox_defconfig b/configs/geekbox_defconfig
index e211176f10..8287600e0b 100644
--- a/configs/geekbox_defconfig
+++ b/configs/geekbox_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_SYS_MALLOC_F_LEN=0x1000
diff --git a/configs/hihope_rzg2_defconfig b/configs/hihope_rzg2_defconfig
index 05dd00a45f..3e1077389c 100644
--- a/configs/hihope_rzg2_defconfig
+++ b/configs/hihope_rzg2_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=16666666
CONFIG_ARCH_CPU_INIT=y
CONFIG_ARCH_RMOBILE=y
CONFIG_SYS_TEXT_BASE=0x50000000
diff --git a/configs/hikey960_defconfig b/configs/hikey960_defconfig
index ce3393689f..627daa1fb8 100644
--- a/configs/hikey960_defconfig
+++ b/configs/hikey960_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=19000000
CONFIG_TARGET_HIKEY960=y
CONFIG_SYS_TEXT_BASE=0x1ac98000
CONFIG_SYS_MALLOC_LEN=0x801000
diff --git a/configs/hikey_defconfig b/configs/hikey_defconfig
index 0c04945357..6f33bba1eb 100644
--- a/configs/hikey_defconfig
+++ b/configs/hikey_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=19000000
CONFIG_SYS_TEXT_BASE=0x35000000
CONFIG_SYS_MALLOC_LEN=0x801000
CONFIG_NR_DRAM_BANKS=6
diff --git a/configs/khadas-edge-captain-rk3399_defconfig b/configs/khadas-edge-captain-rk3399_defconfig
index fffdc61e0f..cddf5228b6 100644
--- a/configs/khadas-edge-captain-rk3399_defconfig
+++ b/configs/khadas-edge-captain-rk3399_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_NR_DRAM_BANKS=1
diff --git a/configs/khadas-edge-rk3399_defconfig b/configs/khadas-edge-rk3399_defconfig
index 2c6f32e27c..bd52c015fa 100644
--- a/configs/khadas-edge-rk3399_defconfig
+++ b/configs/khadas-edge-rk3399_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_NR_DRAM_BANKS=1
diff --git a/configs/khadas-edge-v-rk3399_defconfig b/configs/khadas-edge-v-rk3399_defconfig
index 3f3cf7d2cd..21bf9487a8 100644
--- a/configs/khadas-edge-v-rk3399_defconfig
+++ b/configs/khadas-edge-v-rk3399_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_NR_DRAM_BANKS=1
diff --git a/configs/kontron_sl28_defconfig b/configs/kontron_sl28_defconfig
index 90f925b6b4..0d2c067208 100644
--- a/configs/kontron_sl28_defconfig
+++ b/configs/kontron_sl28_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_SL28=y
CONFIG_SYS_MALLOC_LEN=0x202000
CONFIG_SYS_MALLOC_F_LEN=0x4000
diff --git a/configs/leez-rk3399_defconfig b/configs/leez-rk3399_defconfig
index e2bb140bb8..2fa8d563eb 100644
--- a/configs/leez-rk3399_defconfig
+++ b/configs/leez-rk3399_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_NR_DRAM_BANKS=1
diff --git a/configs/lion-rk3368_defconfig b/configs/lion-rk3368_defconfig
index 2a7cf0d8b7..426913816b 100644
--- a/configs/lion-rk3368_defconfig
+++ b/configs/lion-rk3368_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_NR_DRAM_BANKS=1
diff --git a/configs/ls1012a2g5rdb_qspi_defconfig b/configs/ls1012a2g5rdb_qspi_defconfig
index ff5cfaca6d..cb9ad24b12 100644
--- a/configs/ls1012a2g5rdb_qspi_defconfig
+++ b/configs/ls1012a2g5rdb_qspi_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1012A2G5RDB=y
CONFIG_SYS_TEXT_BASE=0x40100000
CONFIG_SYS_MALLOC_LEN=0x500000
diff --git a/configs/ls1012a2g5rdb_tfa_defconfig b/configs/ls1012a2g5rdb_tfa_defconfig
index c2807c1a7c..8763e0d7b0 100644
--- a/configs/ls1012a2g5rdb_tfa_defconfig
+++ b/configs/ls1012a2g5rdb_tfa_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1012A2G5RDB=y
CONFIG_TFABOOT=y
CONFIG_SYS_TEXT_BASE=0x82000000
diff --git a/configs/ls1012afrdm_qspi_defconfig b/configs/ls1012afrdm_qspi_defconfig
index 9d1d266fe4..fa3486cfbb 100644
--- a/configs/ls1012afrdm_qspi_defconfig
+++ b/configs/ls1012afrdm_qspi_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1012AFRDM=y
CONFIG_SYS_TEXT_BASE=0x40100000
CONFIG_SYS_MALLOC_LEN=0x500000
diff --git a/configs/ls1012afrdm_tfa_defconfig b/configs/ls1012afrdm_tfa_defconfig
index c0c9b73a33..a56a27bfc2 100644
--- a/configs/ls1012afrdm_tfa_defconfig
+++ b/configs/ls1012afrdm_tfa_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1012AFRDM=y
CONFIG_TFABOOT=y
CONFIG_SYS_TEXT_BASE=0x82000000
diff --git a/configs/ls1012afrwy_qspi_SECURE_BOOT_defconfig b/configs/ls1012afrwy_qspi_SECURE_BOOT_defconfig
index fe0c894c3c..e25d964124 100644
--- a/configs/ls1012afrwy_qspi_SECURE_BOOT_defconfig
+++ b/configs/ls1012afrwy_qspi_SECURE_BOOT_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1012AFRWY=y
CONFIG_SYS_TEXT_BASE=0x40100000
CONFIG_SYS_MALLOC_LEN=0x500000
diff --git a/configs/ls1012afrwy_qspi_defconfig b/configs/ls1012afrwy_qspi_defconfig
index 36583d75b1..e0ae291872 100644
--- a/configs/ls1012afrwy_qspi_defconfig
+++ b/configs/ls1012afrwy_qspi_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1012AFRWY=y
CONFIG_SYS_TEXT_BASE=0x40100000
CONFIG_SYS_MALLOC_LEN=0x500000
diff --git a/configs/ls1012afrwy_tfa_SECURE_BOOT_defconfig b/configs/ls1012afrwy_tfa_SECURE_BOOT_defconfig
index b790d520d2..56ddeaaf4d 100644
--- a/configs/ls1012afrwy_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls1012afrwy_tfa_SECURE_BOOT_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1012AFRWY=y
CONFIG_TFABOOT=y
CONFIG_SYS_TEXT_BASE=0x82000000
diff --git a/configs/ls1012afrwy_tfa_defconfig b/configs/ls1012afrwy_tfa_defconfig
index 39f7f4fee4..4d718cd44e 100644
--- a/configs/ls1012afrwy_tfa_defconfig
+++ b/configs/ls1012afrwy_tfa_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1012AFRWY=y
CONFIG_TFABOOT=y
CONFIG_SYS_TEXT_BASE=0x82000000
diff --git a/configs/ls1012aqds_qspi_defconfig b/configs/ls1012aqds_qspi_defconfig
index 7e2f701e45..eedb895c6b 100644
--- a/configs/ls1012aqds_qspi_defconfig
+++ b/configs/ls1012aqds_qspi_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1012AQDS=y
CONFIG_SYS_TEXT_BASE=0x40100000
CONFIG_SYS_MALLOC_LEN=0x500000
diff --git a/configs/ls1012aqds_tfa_SECURE_BOOT_defconfig b/configs/ls1012aqds_tfa_SECURE_BOOT_defconfig
index fe2d5e352d..fa847f3844 100644
--- a/configs/ls1012aqds_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls1012aqds_tfa_SECURE_BOOT_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1012AQDS=y
CONFIG_TFABOOT=y
CONFIG_SYS_TEXT_BASE=0x82000000
diff --git a/configs/ls1012aqds_tfa_defconfig b/configs/ls1012aqds_tfa_defconfig
index 09dbac2303..295d27173e 100644
--- a/configs/ls1012aqds_tfa_defconfig
+++ b/configs/ls1012aqds_tfa_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1012AQDS=y
CONFIG_TFABOOT=y
CONFIG_SYS_TEXT_BASE=0x82000000
diff --git a/configs/ls1012ardb_qspi_SECURE_BOOT_defconfig b/configs/ls1012ardb_qspi_SECURE_BOOT_defconfig
index 25a9142920..eccaf13160 100644
--- a/configs/ls1012ardb_qspi_SECURE_BOOT_defconfig
+++ b/configs/ls1012ardb_qspi_SECURE_BOOT_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1012ARDB=y
CONFIG_SYS_TEXT_BASE=0x40100000
CONFIG_SYS_MALLOC_LEN=0x500000
diff --git a/configs/ls1012ardb_qspi_defconfig b/configs/ls1012ardb_qspi_defconfig
index 3087e6ec79..d9293d3e24 100644
--- a/configs/ls1012ardb_qspi_defconfig
+++ b/configs/ls1012ardb_qspi_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1012ARDB=y
CONFIG_SYS_TEXT_BASE=0x40100000
CONFIG_SYS_MALLOC_LEN=0x500000
diff --git a/configs/ls1012ardb_tfa_SECURE_BOOT_defconfig b/configs/ls1012ardb_tfa_SECURE_BOOT_defconfig
index 5b974e02c7..8397c49989 100644
--- a/configs/ls1012ardb_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls1012ardb_tfa_SECURE_BOOT_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1012ARDB=y
CONFIG_TFABOOT=y
CONFIG_SYS_TEXT_BASE=0x82000000
diff --git a/configs/ls1012ardb_tfa_defconfig b/configs/ls1012ardb_tfa_defconfig
index d9741254fd..82ccb856c3 100644
--- a/configs/ls1012ardb_tfa_defconfig
+++ b/configs/ls1012ardb_tfa_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1012ARDB=y
CONFIG_TFABOOT=y
CONFIG_SYS_TEXT_BASE=0x82000000
diff --git a/configs/ls1021aiot_qspi_defconfig b/configs/ls1021aiot_qspi_defconfig
index fa3885fa8d..0e869a2295 100644
--- a/configs/ls1021aiot_qspi_defconfig
+++ b/configs/ls1021aiot_qspi_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=12500000
CONFIG_TARGET_LS1021AIOT=y
CONFIG_SYS_TEXT_BASE=0x40010000
CONFIG_SYS_MALLOC_LEN=0x1002000
diff --git a/configs/ls1021aiot_sdcard_defconfig b/configs/ls1021aiot_sdcard_defconfig
index 79dde0ee0a..030480bdbf 100644
--- a/configs/ls1021aiot_sdcard_defconfig
+++ b/configs/ls1021aiot_sdcard_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=12500000
CONFIG_TARGET_LS1021AIOT=y
CONFIG_SYS_TEXT_BASE=0x82000000
CONFIG_SYS_MALLOC_LEN=0x1002000
diff --git a/configs/ls1021aqds_ddr4_nor_defconfig b/configs/ls1021aqds_ddr4_nor_defconfig
index 113213425a..70501cb3f0 100644
--- a/configs/ls1021aqds_ddr4_nor_defconfig
+++ b/configs/ls1021aqds_ddr4_nor_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=12500000
CONFIG_TARGET_LS1021AQDS=y
CONFIG_SYS_TEXT_BASE=0x60100000
CONFIG_SYS_MALLOC_LEN=0x1002000
diff --git a/configs/ls1021aqds_ddr4_nor_lpuart_defconfig b/configs/ls1021aqds_ddr4_nor_lpuart_defconfig
index 0a4a88fab3..1948abc74a 100644
--- a/configs/ls1021aqds_ddr4_nor_lpuart_defconfig
+++ b/configs/ls1021aqds_ddr4_nor_lpuart_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=12500000
CONFIG_TARGET_LS1021AQDS=y
CONFIG_SYS_TEXT_BASE=0x60100000
CONFIG_SYS_MALLOC_LEN=0x1002000
diff --git a/configs/ls1021aqds_nand_defconfig b/configs/ls1021aqds_nand_defconfig
index c8dba2a763..7bb4205137 100644
--- a/configs/ls1021aqds_nand_defconfig
+++ b/configs/ls1021aqds_nand_defconfig
@@ -1,6 +1,7 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
CONFIG_SPL_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=12500000
CONFIG_TARGET_LS1021AQDS=y
CONFIG_SYS_TEXT_BASE=0x82000000
CONFIG_SYS_MALLOC_LEN=0x1002000
diff --git a/configs/ls1021aqds_nor_SECURE_BOOT_defconfig b/configs/ls1021aqds_nor_SECURE_BOOT_defconfig
index 32daccab5e..6b6cf1fcdd 100644
--- a/configs/ls1021aqds_nor_SECURE_BOOT_defconfig
+++ b/configs/ls1021aqds_nor_SECURE_BOOT_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=12500000
CONFIG_TARGET_LS1021AQDS=y
CONFIG_SYS_TEXT_BASE=0x60100000
CONFIG_SYS_MALLOC_LEN=0x1002000
diff --git a/configs/ls1021aqds_nor_defconfig b/configs/ls1021aqds_nor_defconfig
index 0d11db7fa7..d5b85db931 100644
--- a/configs/ls1021aqds_nor_defconfig
+++ b/configs/ls1021aqds_nor_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=12500000
CONFIG_TARGET_LS1021AQDS=y
CONFIG_SYS_TEXT_BASE=0x60100000
CONFIG_SYS_MALLOC_LEN=0x1002000
diff --git a/configs/ls1021aqds_nor_lpuart_defconfig b/configs/ls1021aqds_nor_lpuart_defconfig
index 85346c8938..6f18270c7e 100644
--- a/configs/ls1021aqds_nor_lpuart_defconfig
+++ b/configs/ls1021aqds_nor_lpuart_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=12500000
CONFIG_TARGET_LS1021AQDS=y
CONFIG_SYS_TEXT_BASE=0x60100000
CONFIG_SYS_MALLOC_LEN=0x1002000
diff --git a/configs/ls1021aqds_qspi_defconfig b/configs/ls1021aqds_qspi_defconfig
index b08c254dab..d677ff7228 100644
--- a/configs/ls1021aqds_qspi_defconfig
+++ b/configs/ls1021aqds_qspi_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=12500000
CONFIG_TARGET_LS1021AQDS=y
CONFIG_SYS_TEXT_BASE=0x40100000
CONFIG_SYS_MALLOC_LEN=0x1002000
diff --git a/configs/ls1021aqds_sdcard_ifc_defconfig b/configs/ls1021aqds_sdcard_ifc_defconfig
index 876ffad329..61809aae70 100644
--- a/configs/ls1021aqds_sdcard_ifc_defconfig
+++ b/configs/ls1021aqds_sdcard_ifc_defconfig
@@ -1,6 +1,7 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
CONFIG_SPL_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=12500000
CONFIG_TARGET_LS1021AQDS=y
CONFIG_SYS_TEXT_BASE=0x82000000
CONFIG_SYS_MALLOC_LEN=0x1002000
diff --git a/configs/ls1021aqds_sdcard_qspi_defconfig b/configs/ls1021aqds_sdcard_qspi_defconfig
index 08c39a97de..66f930aa61 100644
--- a/configs/ls1021aqds_sdcard_qspi_defconfig
+++ b/configs/ls1021aqds_sdcard_qspi_defconfig
@@ -1,6 +1,7 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
CONFIG_SPL_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=12500000
CONFIG_TARGET_LS1021AQDS=y
CONFIG_SYS_TEXT_BASE=0x82000000
CONFIG_SYS_MALLOC_LEN=0x1002000
diff --git a/configs/ls1021atsn_qspi_defconfig b/configs/ls1021atsn_qspi_defconfig
index 9a59290e1c..0b42b195f9 100644
--- a/configs/ls1021atsn_qspi_defconfig
+++ b/configs/ls1021atsn_qspi_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=12500000
CONFIG_TARGET_LS1021ATSN=y
CONFIG_SYS_TEXT_BASE=0x40100000
CONFIG_SYS_MALLOC_LEN=0x1002000
diff --git a/configs/ls1021atsn_sdcard_defconfig b/configs/ls1021atsn_sdcard_defconfig
index f1f03eff65..e6fdec2974 100644
--- a/configs/ls1021atsn_sdcard_defconfig
+++ b/configs/ls1021atsn_sdcard_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=12500000
CONFIG_TARGET_LS1021ATSN=y
CONFIG_SYS_TEXT_BASE=0x82000000
CONFIG_SYS_MALLOC_LEN=0x1020000
diff --git a/configs/ls1021atwr_nor_SECURE_BOOT_defconfig b/configs/ls1021atwr_nor_SECURE_BOOT_defconfig
index 6e6f474465..628e1d475e 100644
--- a/configs/ls1021atwr_nor_SECURE_BOOT_defconfig
+++ b/configs/ls1021atwr_nor_SECURE_BOOT_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=12500000
CONFIG_TARGET_LS1021ATWR=y
CONFIG_SYS_TEXT_BASE=0x60100000
CONFIG_SYS_MALLOC_LEN=0x1020000
diff --git a/configs/ls1021atwr_nor_defconfig b/configs/ls1021atwr_nor_defconfig
index e709759308..c4df3338d7 100644
--- a/configs/ls1021atwr_nor_defconfig
+++ b/configs/ls1021atwr_nor_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=12500000
CONFIG_TARGET_LS1021ATWR=y
CONFIG_SYS_TEXT_BASE=0x60100000
CONFIG_SYS_MALLOC_LEN=0x1020000
diff --git a/configs/ls1021atwr_nor_lpuart_defconfig b/configs/ls1021atwr_nor_lpuart_defconfig
index 0320f6c620..aa6b619d34 100644
--- a/configs/ls1021atwr_nor_lpuart_defconfig
+++ b/configs/ls1021atwr_nor_lpuart_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=12500000
CONFIG_TARGET_LS1021ATWR=y
CONFIG_SYS_TEXT_BASE=0x60100000
CONFIG_SYS_MALLOC_LEN=0x1020000
diff --git a/configs/ls1021atwr_qspi_defconfig b/configs/ls1021atwr_qspi_defconfig
index 559468f915..1edc123181 100644
--- a/configs/ls1021atwr_qspi_defconfig
+++ b/configs/ls1021atwr_qspi_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=12500000
CONFIG_TARGET_LS1021ATWR=y
CONFIG_SYS_TEXT_BASE=0x40100000
CONFIG_SYS_MALLOC_LEN=0x1002000
diff --git a/configs/ls1021atwr_sdcard_ifc_SECURE_BOOT_defconfig b/configs/ls1021atwr_sdcard_ifc_SECURE_BOOT_defconfig
index 0975b3937e..7824b24fb0 100644
--- a/configs/ls1021atwr_sdcard_ifc_SECURE_BOOT_defconfig
+++ b/configs/ls1021atwr_sdcard_ifc_SECURE_BOOT_defconfig
@@ -1,6 +1,7 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
CONFIG_SPL_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=12500000
CONFIG_TARGET_LS1021ATWR=y
CONFIG_SYS_TEXT_BASE=0x82000000
CONFIG_SYS_MALLOC_LEN=0x1020000
diff --git a/configs/ls1021atwr_sdcard_ifc_defconfig b/configs/ls1021atwr_sdcard_ifc_defconfig
index 5d0916bb9c..8bab45bcff 100644
--- a/configs/ls1021atwr_sdcard_ifc_defconfig
+++ b/configs/ls1021atwr_sdcard_ifc_defconfig
@@ -1,6 +1,7 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
CONFIG_SPL_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=12500000
CONFIG_TARGET_LS1021ATWR=y
CONFIG_SYS_TEXT_BASE=0x82000000
CONFIG_SYS_MALLOC_LEN=0x1020000
diff --git a/configs/ls1021atwr_sdcard_qspi_defconfig b/configs/ls1021atwr_sdcard_qspi_defconfig
index a69d4e0469..a0f05d513d 100644
--- a/configs/ls1021atwr_sdcard_qspi_defconfig
+++ b/configs/ls1021atwr_sdcard_qspi_defconfig
@@ -1,6 +1,7 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
CONFIG_SPL_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=12500000
CONFIG_TARGET_LS1021ATWR=y
CONFIG_SYS_TEXT_BASE=0x82000000
CONFIG_SYS_MALLOC_LEN=0x1020000
diff --git a/configs/ls1028aqds_tfa_SECURE_BOOT_defconfig b/configs/ls1028aqds_tfa_SECURE_BOOT_defconfig
index 2a1aa3ad97..2e4db036a4 100644
--- a/configs/ls1028aqds_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls1028aqds_tfa_SECURE_BOOT_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_GIC_V3_ITS=y
CONFIG_TARGET_LS1028AQDS=y
CONFIG_TFABOOT=y
diff --git a/configs/ls1028aqds_tfa_defconfig b/configs/ls1028aqds_tfa_defconfig
index 7a8d295270..556f77e222 100644
--- a/configs/ls1028aqds_tfa_defconfig
+++ b/configs/ls1028aqds_tfa_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_GIC_V3_ITS=y
CONFIG_TARGET_LS1028AQDS=y
CONFIG_TFABOOT=y
diff --git a/configs/ls1028aqds_tfa_lpuart_defconfig b/configs/ls1028aqds_tfa_lpuart_defconfig
index 8190d18a1b..2adb28c89d 100644
--- a/configs/ls1028aqds_tfa_lpuart_defconfig
+++ b/configs/ls1028aqds_tfa_lpuart_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1028AQDS=y
CONFIG_TFABOOT=y
CONFIG_SYS_MALLOC_LEN=0x202000
diff --git a/configs/ls1028ardb_tfa_SECURE_BOOT_defconfig b/configs/ls1028ardb_tfa_SECURE_BOOT_defconfig
index 5b1bd5c3b7..20cb844b01 100644
--- a/configs/ls1028ardb_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls1028ardb_tfa_SECURE_BOOT_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_GIC_V3_ITS=y
CONFIG_TARGET_LS1028ARDB=y
CONFIG_TFABOOT=y
diff --git a/configs/ls1028ardb_tfa_defconfig b/configs/ls1028ardb_tfa_defconfig
index f28efd287b..fdfdf39c61 100644
--- a/configs/ls1028ardb_tfa_defconfig
+++ b/configs/ls1028ardb_tfa_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_GIC_V3_ITS=y
CONFIG_TARGET_LS1028ARDB=y
CONFIG_TFABOOT=y
diff --git a/configs/ls1043aqds_defconfig b/configs/ls1043aqds_defconfig
index 13f005734d..49ed96365e 100644
--- a/configs/ls1043aqds_defconfig
+++ b/configs/ls1043aqds_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1043AQDS=y
CONFIG_SYS_TEXT_BASE=0x60100000
CONFIG_SYS_MALLOC_LEN=0x120000
diff --git a/configs/ls1043aqds_lpuart_defconfig b/configs/ls1043aqds_lpuart_defconfig
index 15fb06e5a8..bd5c5f7fea 100644
--- a/configs/ls1043aqds_lpuart_defconfig
+++ b/configs/ls1043aqds_lpuart_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1043AQDS=y
CONFIG_SYS_TEXT_BASE=0x60100000
CONFIG_SYS_MALLOC_LEN=0x120000
diff --git a/configs/ls1043aqds_nand_defconfig b/configs/ls1043aqds_nand_defconfig
index 76c4ff1b77..aba4a1e98a 100644
--- a/configs/ls1043aqds_nand_defconfig
+++ b/configs/ls1043aqds_nand_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1043AQDS=y
CONFIG_SYS_TEXT_BASE=0x82000000
CONFIG_SYS_MALLOC_LEN=0x102000
diff --git a/configs/ls1043aqds_nor_ddr3_defconfig b/configs/ls1043aqds_nor_ddr3_defconfig
index 34451996e5..9c1886b6ff 100644
--- a/configs/ls1043aqds_nor_ddr3_defconfig
+++ b/configs/ls1043aqds_nor_ddr3_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1043AQDS=y
CONFIG_SYS_TEXT_BASE=0x60100000
CONFIG_SYS_MALLOC_LEN=0x120000
diff --git a/configs/ls1043aqds_qspi_defconfig b/configs/ls1043aqds_qspi_defconfig
index ddb598510e..1c7b27e3d7 100644
--- a/configs/ls1043aqds_qspi_defconfig
+++ b/configs/ls1043aqds_qspi_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1043AQDS=y
CONFIG_SYS_TEXT_BASE=0x40100000
CONFIG_SYS_MALLOC_LEN=0x102000
diff --git a/configs/ls1043aqds_sdcard_ifc_defconfig b/configs/ls1043aqds_sdcard_ifc_defconfig
index 3a0ef69f6a..699ac5b105 100644
--- a/configs/ls1043aqds_sdcard_ifc_defconfig
+++ b/configs/ls1043aqds_sdcard_ifc_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1043AQDS=y
CONFIG_SYS_TEXT_BASE=0x82000000
CONFIG_SYS_MALLOC_LEN=0x102000
diff --git a/configs/ls1043aqds_sdcard_qspi_defconfig b/configs/ls1043aqds_sdcard_qspi_defconfig
index 11d4fd430a..78ff90d19e 100644
--- a/configs/ls1043aqds_sdcard_qspi_defconfig
+++ b/configs/ls1043aqds_sdcard_qspi_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1043AQDS=y
CONFIG_SYS_TEXT_BASE=0x82000000
CONFIG_SYS_MALLOC_LEN=0x102000
diff --git a/configs/ls1043aqds_tfa_SECURE_BOOT_defconfig b/configs/ls1043aqds_tfa_SECURE_BOOT_defconfig
index 8a62239fa6..6f920ef8a8 100644
--- a/configs/ls1043aqds_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls1043aqds_tfa_SECURE_BOOT_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1043AQDS=y
CONFIG_TFABOOT=y
CONFIG_SYS_TEXT_BASE=0x82000000
diff --git a/configs/ls1043aqds_tfa_defconfig b/configs/ls1043aqds_tfa_defconfig
index 98c03da0f8..031b5d8e75 100644
--- a/configs/ls1043aqds_tfa_defconfig
+++ b/configs/ls1043aqds_tfa_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1043AQDS=y
CONFIG_TFABOOT=y
CONFIG_SYS_TEXT_BASE=0x82000000
diff --git a/configs/ls1043ardb_SECURE_BOOT_defconfig b/configs/ls1043ardb_SECURE_BOOT_defconfig
index 6839a0213d..65c336984e 100644
--- a/configs/ls1043ardb_SECURE_BOOT_defconfig
+++ b/configs/ls1043ardb_SECURE_BOOT_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1043ARDB=y
CONFIG_SYS_TEXT_BASE=0x60100000
CONFIG_SYS_MALLOC_LEN=0x120000
diff --git a/configs/ls1043ardb_defconfig b/configs/ls1043ardb_defconfig
index fc646e728e..c617716c53 100644
--- a/configs/ls1043ardb_defconfig
+++ b/configs/ls1043ardb_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1043ARDB=y
CONFIG_SYS_TEXT_BASE=0x60100000
CONFIG_SYS_MALLOC_LEN=0x120000
diff --git a/configs/ls1043ardb_nand_SECURE_BOOT_defconfig b/configs/ls1043ardb_nand_SECURE_BOOT_defconfig
index 8a2d0b6bf9..750cc54899 100644
--- a/configs/ls1043ardb_nand_SECURE_BOOT_defconfig
+++ b/configs/ls1043ardb_nand_SECURE_BOOT_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1043ARDB=y
CONFIG_SYS_TEXT_BASE=0x82000000
CONFIG_SYS_MALLOC_LEN=0x102000
diff --git a/configs/ls1043ardb_nand_defconfig b/configs/ls1043ardb_nand_defconfig
index b47050f447..78195de5ff 100644
--- a/configs/ls1043ardb_nand_defconfig
+++ b/configs/ls1043ardb_nand_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1043ARDB=y
CONFIG_SYS_TEXT_BASE=0x82000000
CONFIG_SYS_MALLOC_LEN=0x102000
diff --git a/configs/ls1043ardb_sdcard_SECURE_BOOT_defconfig b/configs/ls1043ardb_sdcard_SECURE_BOOT_defconfig
index 105888df36..69d8d43c93 100644
--- a/configs/ls1043ardb_sdcard_SECURE_BOOT_defconfig
+++ b/configs/ls1043ardb_sdcard_SECURE_BOOT_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1043ARDB=y
CONFIG_SYS_TEXT_BASE=0x82000000
CONFIG_SYS_MALLOC_LEN=0x102000
diff --git a/configs/ls1043ardb_sdcard_defconfig b/configs/ls1043ardb_sdcard_defconfig
index f0b0f9f152..b05731df92 100644
--- a/configs/ls1043ardb_sdcard_defconfig
+++ b/configs/ls1043ardb_sdcard_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1043ARDB=y
CONFIG_SYS_TEXT_BASE=0x82000000
CONFIG_SYS_MALLOC_LEN=0x102000
diff --git a/configs/ls1043ardb_tfa_SECURE_BOOT_defconfig b/configs/ls1043ardb_tfa_SECURE_BOOT_defconfig
index 41a285e3a5..b08ba4f5c6 100644
--- a/configs/ls1043ardb_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls1043ardb_tfa_SECURE_BOOT_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1043ARDB=y
CONFIG_TFABOOT=y
CONFIG_SYS_TEXT_BASE=0x82000000
diff --git a/configs/ls1043ardb_tfa_defconfig b/configs/ls1043ardb_tfa_defconfig
index 2094740788..90623a7df9 100644
--- a/configs/ls1043ardb_tfa_defconfig
+++ b/configs/ls1043ardb_tfa_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1043ARDB=y
CONFIG_TFABOOT=y
CONFIG_SYS_TEXT_BASE=0x82000000
diff --git a/configs/ls1046afrwy_tfa_SECURE_BOOT_defconfig b/configs/ls1046afrwy_tfa_SECURE_BOOT_defconfig
index 93d323d3ba..3cbe1b7c10 100644
--- a/configs/ls1046afrwy_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls1046afrwy_tfa_SECURE_BOOT_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1046AFRWY=y
CONFIG_TFABOOT=y
CONFIG_SYS_TEXT_BASE=0x82000000
diff --git a/configs/ls1046afrwy_tfa_defconfig b/configs/ls1046afrwy_tfa_defconfig
index 3c12b40b89..2c198cd913 100644
--- a/configs/ls1046afrwy_tfa_defconfig
+++ b/configs/ls1046afrwy_tfa_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1046AFRWY=y
CONFIG_TFABOOT=y
CONFIG_SYS_TEXT_BASE=0x82000000
diff --git a/configs/ls1046aqds_SECURE_BOOT_defconfig b/configs/ls1046aqds_SECURE_BOOT_defconfig
index e1f00f4379..902c14c735 100644
--- a/configs/ls1046aqds_SECURE_BOOT_defconfig
+++ b/configs/ls1046aqds_SECURE_BOOT_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1046AQDS=y
CONFIG_SYS_TEXT_BASE=0x60100000
CONFIG_SYS_MALLOC_LEN=0x120000
diff --git a/configs/ls1046aqds_defconfig b/configs/ls1046aqds_defconfig
index 5620e1ac6f..f9616ef82d 100644
--- a/configs/ls1046aqds_defconfig
+++ b/configs/ls1046aqds_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1046AQDS=y
CONFIG_SYS_TEXT_BASE=0x60100000
CONFIG_SYS_MALLOC_LEN=0x120000
diff --git a/configs/ls1046aqds_lpuart_defconfig b/configs/ls1046aqds_lpuart_defconfig
index ecdb1b2d25..d1538829d1 100644
--- a/configs/ls1046aqds_lpuart_defconfig
+++ b/configs/ls1046aqds_lpuart_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1046AQDS=y
CONFIG_SYS_TEXT_BASE=0x60100000
CONFIG_SYS_MALLOC_LEN=0x120000
diff --git a/configs/ls1046aqds_nand_defconfig b/configs/ls1046aqds_nand_defconfig
index 09e02183be..b804ac4109 100644
--- a/configs/ls1046aqds_nand_defconfig
+++ b/configs/ls1046aqds_nand_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1046AQDS=y
CONFIG_SYS_TEXT_BASE=0x82000000
CONFIG_SYS_MALLOC_LEN=0x102000
diff --git a/configs/ls1046aqds_qspi_defconfig b/configs/ls1046aqds_qspi_defconfig
index ca43837df0..cb8a7a219b 100644
--- a/configs/ls1046aqds_qspi_defconfig
+++ b/configs/ls1046aqds_qspi_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1046AQDS=y
CONFIG_SYS_TEXT_BASE=0x40100000
CONFIG_SYS_MALLOC_LEN=0x102000
diff --git a/configs/ls1046aqds_sdcard_ifc_defconfig b/configs/ls1046aqds_sdcard_ifc_defconfig
index 6d44392058..48e58f6c10 100644
--- a/configs/ls1046aqds_sdcard_ifc_defconfig
+++ b/configs/ls1046aqds_sdcard_ifc_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1046AQDS=y
CONFIG_SYS_TEXT_BASE=0x82000000
CONFIG_SYS_MALLOC_LEN=0x102000
diff --git a/configs/ls1046aqds_sdcard_qspi_defconfig b/configs/ls1046aqds_sdcard_qspi_defconfig
index 7360daab61..bc54884824 100644
--- a/configs/ls1046aqds_sdcard_qspi_defconfig
+++ b/configs/ls1046aqds_sdcard_qspi_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1046AQDS=y
CONFIG_SYS_TEXT_BASE=0x82000000
CONFIG_SYS_MALLOC_LEN=0x102000
diff --git a/configs/ls1046aqds_tfa_SECURE_BOOT_defconfig b/configs/ls1046aqds_tfa_SECURE_BOOT_defconfig
index 1e9a3c1c82..e96cda3cef 100644
--- a/configs/ls1046aqds_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls1046aqds_tfa_SECURE_BOOT_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1046AQDS=y
CONFIG_TFABOOT=y
CONFIG_SYS_TEXT_BASE=0x82000000
diff --git a/configs/ls1046aqds_tfa_defconfig b/configs/ls1046aqds_tfa_defconfig
index 2d44439d91..633399afc7 100644
--- a/configs/ls1046aqds_tfa_defconfig
+++ b/configs/ls1046aqds_tfa_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1046AQDS=y
CONFIG_TFABOOT=y
CONFIG_SYS_TEXT_BASE=0x82000000
diff --git a/configs/ls1046ardb_emmc_defconfig b/configs/ls1046ardb_emmc_defconfig
index c14e97583b..2c6772d28f 100644
--- a/configs/ls1046ardb_emmc_defconfig
+++ b/configs/ls1046ardb_emmc_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1046ARDB=y
CONFIG_SYS_TEXT_BASE=0x82000000
CONFIG_SYS_MALLOC_LEN=0x102000
diff --git a/configs/ls1046ardb_qspi_SECURE_BOOT_defconfig b/configs/ls1046ardb_qspi_SECURE_BOOT_defconfig
index a4fa4ea329..b7ace80367 100644
--- a/configs/ls1046ardb_qspi_SECURE_BOOT_defconfig
+++ b/configs/ls1046ardb_qspi_SECURE_BOOT_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1046ARDB=y
CONFIG_SYS_TEXT_BASE=0x40100000
CONFIG_SYS_MALLOC_LEN=0x102000
diff --git a/configs/ls1046ardb_qspi_defconfig b/configs/ls1046ardb_qspi_defconfig
index cb2567421f..78acce163b 100644
--- a/configs/ls1046ardb_qspi_defconfig
+++ b/configs/ls1046ardb_qspi_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1046ARDB=y
CONFIG_SYS_TEXT_BASE=0x40100000
CONFIG_SYS_MALLOC_LEN=0x102000
diff --git a/configs/ls1046ardb_qspi_spl_defconfig b/configs/ls1046ardb_qspi_spl_defconfig
index 78ce9373ed..9d43c35439 100644
--- a/configs/ls1046ardb_qspi_spl_defconfig
+++ b/configs/ls1046ardb_qspi_spl_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1046ARDB=y
CONFIG_SYS_TEXT_BASE=0x82000000
CONFIG_SYS_MALLOC_LEN=0x102000
diff --git a/configs/ls1046ardb_sdcard_SECURE_BOOT_defconfig b/configs/ls1046ardb_sdcard_SECURE_BOOT_defconfig
index 38fe9ea2da..af30b022c8 100644
--- a/configs/ls1046ardb_sdcard_SECURE_BOOT_defconfig
+++ b/configs/ls1046ardb_sdcard_SECURE_BOOT_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1046ARDB=y
CONFIG_SYS_TEXT_BASE=0x82000000
CONFIG_SYS_MALLOC_LEN=0x102000
diff --git a/configs/ls1046ardb_sdcard_defconfig b/configs/ls1046ardb_sdcard_defconfig
index 0646f0f7e3..40e343c299 100644
--- a/configs/ls1046ardb_sdcard_defconfig
+++ b/configs/ls1046ardb_sdcard_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1046ARDB=y
CONFIG_SYS_TEXT_BASE=0x82000000
CONFIG_SYS_MALLOC_LEN=0x102000
diff --git a/configs/ls1046ardb_tfa_SECURE_BOOT_defconfig b/configs/ls1046ardb_tfa_SECURE_BOOT_defconfig
index 4d23458602..369b80a18d 100644
--- a/configs/ls1046ardb_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls1046ardb_tfa_SECURE_BOOT_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1046ARDB=y
CONFIG_TFABOOT=y
CONFIG_SYS_TEXT_BASE=0x82000000
diff --git a/configs/ls1046ardb_tfa_defconfig b/configs/ls1046ardb_tfa_defconfig
index e7587b302f..f126cb7036 100644
--- a/configs/ls1046ardb_tfa_defconfig
+++ b/configs/ls1046ardb_tfa_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_TARGET_LS1046ARDB=y
CONFIG_TFABOOT=y
CONFIG_SYS_TEXT_BASE=0x82000000
diff --git a/configs/ls2080aqds_SECURE_BOOT_defconfig b/configs/ls2080aqds_SECURE_BOOT_defconfig
index dfe180dfd2..ff0550db53 100644
--- a/configs/ls2080aqds_SECURE_BOOT_defconfig
+++ b/configs/ls2080aqds_SECURE_BOOT_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_GIC_V3_ITS=y
CONFIG_TARGET_LS2080AQDS=y
CONFIG_SYS_TEXT_BASE=0x30100000
diff --git a/configs/ls2080aqds_defconfig b/configs/ls2080aqds_defconfig
index 09ec59d87c..97eebb7274 100644
--- a/configs/ls2080aqds_defconfig
+++ b/configs/ls2080aqds_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_GIC_V3_ITS=y
CONFIG_TARGET_LS2080AQDS=y
CONFIG_SYS_TEXT_BASE=0x30100000
diff --git a/configs/ls2080aqds_nand_defconfig b/configs/ls2080aqds_nand_defconfig
index a36b85b27a..e7b2cc4c80 100644
--- a/configs/ls2080aqds_nand_defconfig
+++ b/configs/ls2080aqds_nand_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_GIC_V3_ITS=y
CONFIG_TARGET_LS2080AQDS=y
CONFIG_SYS_TEXT_BASE=0x80400000
diff --git a/configs/ls2080aqds_qspi_defconfig b/configs/ls2080aqds_qspi_defconfig
index 09d1af9509..faa8f713b3 100644
--- a/configs/ls2080aqds_qspi_defconfig
+++ b/configs/ls2080aqds_qspi_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_GIC_V3_ITS=y
CONFIG_TARGET_LS2080AQDS=y
CONFIG_SYS_TEXT_BASE=0x20100000
diff --git a/configs/ls2080aqds_sdcard_defconfig b/configs/ls2080aqds_sdcard_defconfig
index dd47a27c92..843c1e72ac 100644
--- a/configs/ls2080aqds_sdcard_defconfig
+++ b/configs/ls2080aqds_sdcard_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_GIC_V3_ITS=y
CONFIG_TARGET_LS2080AQDS=y
CONFIG_SYS_TEXT_BASE=0x80400000
diff --git a/configs/ls2080ardb_SECURE_BOOT_defconfig b/configs/ls2080ardb_SECURE_BOOT_defconfig
index 98ed05897b..0a36c795c8 100644
--- a/configs/ls2080ardb_SECURE_BOOT_defconfig
+++ b/configs/ls2080ardb_SECURE_BOOT_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_GIC_V3_ITS=y
CONFIG_TARGET_LS2080ARDB=y
CONFIG_SYS_TEXT_BASE=0x30100000
diff --git a/configs/ls2080ardb_defconfig b/configs/ls2080ardb_defconfig
index a978b8b2ac..1001618f63 100644
--- a/configs/ls2080ardb_defconfig
+++ b/configs/ls2080ardb_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_GIC_V3_ITS=y
CONFIG_TARGET_LS2080ARDB=y
CONFIG_SYS_TEXT_BASE=0x30100000
diff --git a/configs/ls2080ardb_nand_defconfig b/configs/ls2080ardb_nand_defconfig
index 9c28a4329c..505cdc19a3 100644
--- a/configs/ls2080ardb_nand_defconfig
+++ b/configs/ls2080ardb_nand_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_GIC_V3_ITS=y
CONFIG_TARGET_LS2080ARDB=y
CONFIG_SYS_TEXT_BASE=0x80400000
diff --git a/configs/ls2081ardb_defconfig b/configs/ls2081ardb_defconfig
index 53a81a6157..dee0406502 100644
--- a/configs/ls2081ardb_defconfig
+++ b/configs/ls2081ardb_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_GIC_V3_ITS=y
CONFIG_TARGET_LS2081ARDB=y
CONFIG_SYS_TEXT_BASE=0x20100000
diff --git a/configs/ls2088aqds_tfa_defconfig b/configs/ls2088aqds_tfa_defconfig
index 7d57f7aa60..cd535babb5 100644
--- a/configs/ls2088aqds_tfa_defconfig
+++ b/configs/ls2088aqds_tfa_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_GIC_V3_ITS=y
CONFIG_TARGET_LS2080AQDS=y
CONFIG_TFABOOT=y
diff --git a/configs/ls2088ardb_qspi_SECURE_BOOT_defconfig b/configs/ls2088ardb_qspi_SECURE_BOOT_defconfig
index 540a9ee7cc..540d8e0f04 100644
--- a/configs/ls2088ardb_qspi_SECURE_BOOT_defconfig
+++ b/configs/ls2088ardb_qspi_SECURE_BOOT_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_GIC_V3_ITS=y
CONFIG_TARGET_LS2080ARDB=y
CONFIG_SYS_TEXT_BASE=0x20100000
diff --git a/configs/ls2088ardb_qspi_defconfig b/configs/ls2088ardb_qspi_defconfig
index d58a8431df..df0244a8e5 100644
--- a/configs/ls2088ardb_qspi_defconfig
+++ b/configs/ls2088ardb_qspi_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_GIC_V3_ITS=y
CONFIG_TARGET_LS2080ARDB=y
CONFIG_SYS_TEXT_BASE=0x20100000
diff --git a/configs/ls2088ardb_tfa_SECURE_BOOT_defconfig b/configs/ls2088ardb_tfa_SECURE_BOOT_defconfig
index 1e5daeab13..2740f0c698 100644
--- a/configs/ls2088ardb_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls2088ardb_tfa_SECURE_BOOT_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_GIC_V3_ITS=y
CONFIG_TARGET_LS2080ARDB=y
CONFIG_TFABOOT=y
diff --git a/configs/ls2088ardb_tfa_defconfig b/configs/ls2088ardb_tfa_defconfig
index e9d3c56909..004c557923 100644
--- a/configs/ls2088ardb_tfa_defconfig
+++ b/configs/ls2088ardb_tfa_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25000000
CONFIG_GIC_V3_ITS=y
CONFIG_TARGET_LS2080ARDB=y
CONFIG_TFABOOT=y
diff --git a/configs/mt8183_pumpkin_defconfig b/configs/mt8183_pumpkin_defconfig
index 42627a2538..ea7ab5c809 100644
--- a/configs/mt8183_pumpkin_defconfig
+++ b/configs/mt8183_pumpkin_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=13000000
CONFIG_POSITION_INDEPENDENT=y
CONFIG_ARCH_MEDIATEK=y
CONFIG_SYS_TEXT_BASE=0x4c000000
diff --git a/configs/mt8512_bm1_emmc_defconfig b/configs/mt8512_bm1_emmc_defconfig
index 546d1dc80d..7e711b1b46 100644
--- a/configs/mt8512_bm1_emmc_defconfig
+++ b/configs/mt8512_bm1_emmc_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=13000000
CONFIG_POSITION_INDEPENDENT=y
CONFIG_ARCH_MEDIATEK=y
CONFIG_SYS_TEXT_BASE=0x44e00000
diff --git a/configs/mt8516_pumpkin_defconfig b/configs/mt8516_pumpkin_defconfig
index 458b4fb084..52c12609b1 100644
--- a/configs/mt8516_pumpkin_defconfig
+++ b/configs/mt8516_pumpkin_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=13000000
CONFIG_POSITION_INDEPENDENT=y
CONFIG_ARCH_MEDIATEK=y
CONFIG_SYS_TEXT_BASE=0x4C000000
diff --git a/configs/mt8518_ap1_emmc_defconfig b/configs/mt8518_ap1_emmc_defconfig
index 444da0be93..a994cd3a2d 100644
--- a/configs/mt8518_ap1_emmc_defconfig
+++ b/configs/mt8518_ap1_emmc_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=13000000
CONFIG_POSITION_INDEPENDENT=y
CONFIG_ARCH_MEDIATEK=y
CONFIG_SYS_TEXT_BASE=0x40008000
diff --git a/configs/nanopc-t4-rk3399_defconfig b/configs/nanopc-t4-rk3399_defconfig
index 164b066b91..31de4bd1a9 100644
--- a/configs/nanopc-t4-rk3399_defconfig
+++ b/configs/nanopc-t4-rk3399_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_NR_DRAM_BANKS=1
diff --git a/configs/nanopi-m4-2gb-rk3399_defconfig b/configs/nanopi-m4-2gb-rk3399_defconfig
index d3075e6a4a..7c8eff869b 100644
--- a/configs/nanopi-m4-2gb-rk3399_defconfig
+++ b/configs/nanopi-m4-2gb-rk3399_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_NR_DRAM_BANKS=1
diff --git a/configs/nanopi-m4-rk3399_defconfig b/configs/nanopi-m4-rk3399_defconfig
index 957879b14b..d500ebe58d 100644
--- a/configs/nanopi-m4-rk3399_defconfig
+++ b/configs/nanopi-m4-rk3399_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_NR_DRAM_BANKS=1
diff --git a/configs/nanopi-m4b-rk3399_defconfig b/configs/nanopi-m4b-rk3399_defconfig
index 805549bf3b..16e39035e5 100644
--- a/configs/nanopi-m4b-rk3399_defconfig
+++ b/configs/nanopi-m4b-rk3399_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_NR_DRAM_BANKS=1
diff --git a/configs/nanopi-neo4-rk3399_defconfig b/configs/nanopi-neo4-rk3399_defconfig
index c9d7be19db..753ba92d0e 100644
--- a/configs/nanopi-neo4-rk3399_defconfig
+++ b/configs/nanopi-neo4-rk3399_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_NR_DRAM_BANKS=1
diff --git a/configs/nanopi-r2s-rk3328_defconfig b/configs/nanopi-r2s-rk3328_defconfig
index 899b14caa0..453e54295d 100644
--- a/configs/nanopi-r2s-rk3328_defconfig
+++ b/configs/nanopi-r2s-rk3328_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_SPL_GPIO=y
diff --git a/configs/nanopi-r4s-rk3399_defconfig b/configs/nanopi-r4s-rk3399_defconfig
index 359673fe60..46ba07f4d5 100644
--- a/configs/nanopi-r4s-rk3399_defconfig
+++ b/configs/nanopi-r4s-rk3399_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_NR_DRAM_BANKS=1
diff --git a/configs/odroid-go2_defconfig b/configs/odroid-go2_defconfig
index 33fd076e14..8ff71fd28c 100644
--- a/configs/odroid-go2_defconfig
+++ b/configs/odroid-go2_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_SYS_MALLOC_F_LEN=0x2000
diff --git a/configs/orangepi-rk3399_defconfig b/configs/orangepi-rk3399_defconfig
index 04e1f4e136..461300fd10 100644
--- a/configs/orangepi-rk3399_defconfig
+++ b/configs/orangepi-rk3399_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_NR_DRAM_BANKS=1
diff --git a/configs/p2371-2180_defconfig b/configs/p2371-2180_defconfig
index 67657b0369..5977325973 100644
--- a/configs/p2371-2180_defconfig
+++ b/configs/p2371-2180_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=19200000
CONFIG_SYS_L2CACHE_OFF=y
CONFIG_ARCH_TEGRA=y
CONFIG_SYS_TEXT_BASE=0x80080000
diff --git a/configs/p2771-0000-000_defconfig b/configs/p2771-0000-000_defconfig
index 53d98b11f5..47be8a1c28 100644
--- a/configs/p2771-0000-000_defconfig
+++ b/configs/p2771-0000-000_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=19200000
CONFIG_SYS_L2CACHE_OFF=y
CONFIG_ARCH_TEGRA=y
CONFIG_SYS_TEXT_BASE=0x80080000
diff --git a/configs/p2771-0000-500_defconfig b/configs/p2771-0000-500_defconfig
index 2e3eec0ee1..94866cd769 100644
--- a/configs/p2771-0000-500_defconfig
+++ b/configs/p2771-0000-500_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=19200000
CONFIG_SYS_L2CACHE_OFF=y
CONFIG_ARCH_TEGRA=y
CONFIG_SYS_TEXT_BASE=0x80080000
diff --git a/configs/p3450-0000_defconfig b/configs/p3450-0000_defconfig
index 46f4cd0110..ec813dd7a5 100644
--- a/configs/p3450-0000_defconfig
+++ b/configs/p3450-0000_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=19200000
CONFIG_SYS_L2CACHE_OFF=y
CONFIG_ARCH_TEGRA=y
CONFIG_SYS_TEXT_BASE=0x80080000
diff --git a/configs/pg_wcom_expu1_defconfig b/configs/pg_wcom_expu1_defconfig
index ab98e0a159..844a39fd38 100644
--- a/configs/pg_wcom_expu1_defconfig
+++ b/configs/pg_wcom_expu1_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=8333333
CONFIG_TARGET_PG_WCOM_EXPU1=y
CONFIG_SYS_TEXT_BASE=0x60100000
CONFIG_SYS_MALLOC_LEN=0x1004000
diff --git a/configs/pg_wcom_expu1_update_defconfig b/configs/pg_wcom_expu1_update_defconfig
index 261243f942..bea61f70f6 100644
--- a/configs/pg_wcom_expu1_update_defconfig
+++ b/configs/pg_wcom_expu1_update_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=8333333
CONFIG_TARGET_PG_WCOM_EXPU1=y
CONFIG_SYS_TEXT_BASE=0x60240000
CONFIG_SYS_MALLOC_LEN=0x1004000
diff --git a/configs/pg_wcom_seli8_defconfig b/configs/pg_wcom_seli8_defconfig
index 80a3b74278..8161088178 100644
--- a/configs/pg_wcom_seli8_defconfig
+++ b/configs/pg_wcom_seli8_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=8333333
CONFIG_TARGET_PG_WCOM_SELI8=y
CONFIG_SYS_TEXT_BASE=0x60100000
CONFIG_SYS_MALLOC_LEN=0x1004000
diff --git a/configs/pg_wcom_seli8_update_defconfig b/configs/pg_wcom_seli8_update_defconfig
index d322d6daac..0a36ab9839 100644
--- a/configs/pg_wcom_seli8_update_defconfig
+++ b/configs/pg_wcom_seli8_update_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=8333333
CONFIG_TARGET_PG_WCOM_SELI8=y
CONFIG_SYS_TEXT_BASE=0x60240000
CONFIG_SYS_MALLOC_LEN=0x1004000
diff --git a/configs/pinebook-pro-rk3399_defconfig b/configs/pinebook-pro-rk3399_defconfig
index d12a7d4e40..8ca1d0708f 100644
--- a/configs/pinebook-pro-rk3399_defconfig
+++ b/configs/pinebook-pro-rk3399_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_NR_DRAM_BANKS=1
diff --git a/configs/puma-rk3399_defconfig b/configs/puma-rk3399_defconfig
index c98b5cf5f1..7ce2dc0719 100644
--- a/configs/puma-rk3399_defconfig
+++ b/configs/puma-rk3399_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_SPL_GPIO=y
diff --git a/configs/px30-core-ctouch2-of10-px30_defconfig b/configs/px30-core-ctouch2-of10-px30_defconfig
index 9521990772..213d01fe7a 100644
--- a/configs/px30-core-ctouch2-of10-px30_defconfig
+++ b/configs/px30-core-ctouch2-of10-px30_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_SYS_MALLOC_F_LEN=0x2000
diff --git a/configs/px30-core-ctouch2-px30_defconfig b/configs/px30-core-ctouch2-px30_defconfig
index 35d1bcbd4e..875d7aa7de 100644
--- a/configs/px30-core-ctouch2-px30_defconfig
+++ b/configs/px30-core-ctouch2-px30_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_SYS_MALLOC_F_LEN=0x2000
diff --git a/configs/px30-core-edimm2.2-px30_defconfig b/configs/px30-core-edimm2.2-px30_defconfig
index c237114905..4e2fa8cf7d 100644
--- a/configs/px30-core-edimm2.2-px30_defconfig
+++ b/configs/px30-core-edimm2.2-px30_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_SYS_MALLOC_F_LEN=0x2000
diff --git a/configs/r8a77970_eagle_defconfig b/configs/r8a77970_eagle_defconfig
index b3fbe86928..7b050d8245 100644
--- a/configs/r8a77970_eagle_defconfig
+++ b/configs/r8a77970_eagle_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=16666666
CONFIG_ARCH_CPU_INIT=y
CONFIG_ARCH_RMOBILE=y
CONFIG_SYS_TEXT_BASE=0x50000000
diff --git a/configs/r8a77980_condor_defconfig b/configs/r8a77980_condor_defconfig
index 88901ec46c..c3b6e99ae7 100644
--- a/configs/r8a77980_condor_defconfig
+++ b/configs/r8a77980_condor_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=16666666
CONFIG_ARCH_CPU_INIT=y
CONFIG_ARCH_RMOBILE=y
CONFIG_SYS_TEXT_BASE=0x50000000
diff --git a/configs/r8a77990_ebisu_defconfig b/configs/r8a77990_ebisu_defconfig
index 13422a10be..fba03a760f 100644
--- a/configs/r8a77990_ebisu_defconfig
+++ b/configs/r8a77990_ebisu_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=16666666
CONFIG_ARCH_CPU_INIT=y
CONFIG_ARCH_RMOBILE=y
CONFIG_SYS_TEXT_BASE=0x50000000
diff --git a/configs/r8a77995_draak_defconfig b/configs/r8a77995_draak_defconfig
index 640f303bff..008254715e 100644
--- a/configs/r8a77995_draak_defconfig
+++ b/configs/r8a77995_draak_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=16666666
CONFIG_ARCH_CPU_INIT=y
CONFIG_ARCH_RMOBILE=y
CONFIG_SYS_TEXT_BASE=0x50000000
diff --git a/configs/r8a779a0_falcon_defconfig b/configs/r8a779a0_falcon_defconfig
index c3f56e4b1a..f76b1132a8 100644
--- a/configs/r8a779a0_falcon_defconfig
+++ b/configs/r8a779a0_falcon_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=16666666
CONFIG_ARCH_CPU_INIT=y
CONFIG_ARCH_RMOBILE=y
CONFIG_SYS_TEXT_BASE=0x50000000
diff --git a/configs/rcar3_salvator-x_defconfig b/configs/rcar3_salvator-x_defconfig
index 5df295980b..f333291aa4 100644
--- a/configs/rcar3_salvator-x_defconfig
+++ b/configs/rcar3_salvator-x_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=16666666
CONFIG_ARCH_CPU_INIT=y
CONFIG_ARCH_RMOBILE=y
CONFIG_SYS_MALLOC_LEN=0x4000000
diff --git a/configs/rcar3_ulcb_defconfig b/configs/rcar3_ulcb_defconfig
index 85a2e48f96..a7ef4f1c0e 100644
--- a/configs/rcar3_ulcb_defconfig
+++ b/configs/rcar3_ulcb_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=16666666
CONFIG_ARCH_CPU_INIT=y
CONFIG_ARCH_RMOBILE=y
CONFIG_SYS_TEXT_BASE=0x50000000
diff --git a/configs/roc-cc-rk3308_defconfig b/configs/roc-cc-rk3308_defconfig
index 5bc691d167..0ae45ca8a1 100644
--- a/configs/roc-cc-rk3308_defconfig
+++ b/configs/roc-cc-rk3308_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00600000
CONFIG_SYS_MALLOC_F_LEN=0x2000
diff --git a/configs/roc-cc-rk3328_defconfig b/configs/roc-cc-rk3328_defconfig
index a60731d546..5fc4dd7794 100644
--- a/configs/roc-cc-rk3328_defconfig
+++ b/configs/roc-cc-rk3328_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_SPL_GPIO=y
diff --git a/configs/roc-pc-mezzanine-rk3399_defconfig b/configs/roc-pc-mezzanine-rk3399_defconfig
index 569c5dc34f..fd857ed0ff 100644
--- a/configs/roc-pc-mezzanine-rk3399_defconfig
+++ b/configs/roc-pc-mezzanine-rk3399_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_SPL_GPIO=y
diff --git a/configs/roc-pc-rk3399_defconfig b/configs/roc-pc-rk3399_defconfig
index 1ea9a9ad40..4684fa6e74 100644
--- a/configs/roc-pc-rk3399_defconfig
+++ b/configs/roc-pc-rk3399_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_SPL_GPIO=y
diff --git a/configs/rock-pi-4-rk3399_defconfig b/configs/rock-pi-4-rk3399_defconfig
index 1099aad5dd..80d1e63b59 100644
--- a/configs/rock-pi-4-rk3399_defconfig
+++ b/configs/rock-pi-4-rk3399_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_NR_DRAM_BANKS=1
diff --git a/configs/rock-pi-4c-rk3399_defconfig b/configs/rock-pi-4c-rk3399_defconfig
index ae4aec22ab..bda4b70dbf 100644
--- a/configs/rock-pi-4c-rk3399_defconfig
+++ b/configs/rock-pi-4c-rk3399_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_NR_DRAM_BANKS=1
diff --git a/configs/rock-pi-e-rk3328_defconfig b/configs/rock-pi-e-rk3328_defconfig
index 31581630ba..36038d9053 100644
--- a/configs/rock-pi-e-rk3328_defconfig
+++ b/configs/rock-pi-e-rk3328_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_SPL_GPIO=y
diff --git a/configs/rock-pi-n10-rk3399pro_defconfig b/configs/rock-pi-n10-rk3399pro_defconfig
index c205479b1f..7151da4c19 100644
--- a/configs/rock-pi-n10-rk3399pro_defconfig
+++ b/configs/rock-pi-n10-rk3399pro_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_SPL_GPIO=y
diff --git a/configs/rock64-rk3328_defconfig b/configs/rock64-rk3328_defconfig
index 6704946c16..ea61fe738f 100644
--- a/configs/rock64-rk3328_defconfig
+++ b/configs/rock64-rk3328_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_SPL_GPIO=y
diff --git a/configs/rock960-rk3399_defconfig b/configs/rock960-rk3399_defconfig
index 1e45d82c60..be0e1c7d18 100644
--- a/configs/rock960-rk3399_defconfig
+++ b/configs/rock960-rk3399_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_ENV_OFFSET=0x3F8000
diff --git a/configs/rockpro64-rk3399_defconfig b/configs/rockpro64-rk3399_defconfig
index 18257d52f5..e6f7a8469a 100644
--- a/configs/rockpro64-rk3399_defconfig
+++ b/configs/rockpro64-rk3399_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_NR_DRAM_BANKS=1
diff --git a/configs/sheep-rk3368_defconfig b/configs/sheep-rk3368_defconfig
index 41d9fa321e..80f599d3a3 100644
--- a/configs/sheep-rk3368_defconfig
+++ b/configs/sheep-rk3368_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_NR_DRAM_BANKS=1
diff --git a/configs/silinux_ek874_defconfig b/configs/silinux_ek874_defconfig
index 61c2a73928..099a200539 100644
--- a/configs/silinux_ek874_defconfig
+++ b/configs/silinux_ek874_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=16666666
CONFIG_ARCH_CPU_INIT=y
CONFIG_ARCH_RMOBILE=y
CONFIG_SYS_TEXT_BASE=0x50000000
diff --git a/configs/socfpga_agilex_atf_defconfig b/configs/socfpga_agilex_atf_defconfig
index af2a2280b9..f1ae3c3349 100644
--- a/configs/socfpga_agilex_atf_defconfig
+++ b/configs/socfpga_agilex_atf_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=400000000
CONFIG_SPL_LDSCRIPT="arch/arm/mach-socfpga/u-boot-spl-soc64.lds"
CONFIG_ARCH_SOCFPGA=y
CONFIG_SYS_TEXT_BASE=0x200000
diff --git a/configs/socfpga_agilex_defconfig b/configs/socfpga_agilex_defconfig
index 31815a2d50..bfbbd9bfdd 100644
--- a/configs/socfpga_agilex_defconfig
+++ b/configs/socfpga_agilex_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=400000000
CONFIG_ARCH_SOCFPGA=y
CONFIG_SYS_TEXT_BASE=0x1000
CONFIG_SYS_MALLOC_LEN=0x500000
diff --git a/configs/socfpga_agilex_vab_defconfig b/configs/socfpga_agilex_vab_defconfig
index b7c4d067db..d29b51729d 100644
--- a/configs/socfpga_agilex_vab_defconfig
+++ b/configs/socfpga_agilex_vab_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=400000000
CONFIG_SPL_LDSCRIPT="arch/arm/mach-socfpga/u-boot-spl-soc64.lds"
CONFIG_ARCH_SOCFPGA=y
CONFIG_SYS_TEXT_BASE=0x200000
diff --git a/configs/socfpga_n5x_atf_defconfig b/configs/socfpga_n5x_atf_defconfig
index 7c4bb718a0..50b3319561 100644
--- a/configs/socfpga_n5x_atf_defconfig
+++ b/configs/socfpga_n5x_atf_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=400000000
CONFIG_SPL_LDSCRIPT="arch/arm/mach-socfpga/u-boot-spl-soc64.lds"
CONFIG_ARCH_SOCFPGA=y
CONFIG_SYS_TEXT_BASE=0x200000
diff --git a/configs/socfpga_n5x_defconfig b/configs/socfpga_n5x_defconfig
index 489a5113f3..8cdf65dbee 100644
--- a/configs/socfpga_n5x_defconfig
+++ b/configs/socfpga_n5x_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=400000000
CONFIG_ARCH_SOCFPGA=y
CONFIG_SYS_TEXT_BASE=0x1000
CONFIG_SYS_MALLOC_LEN=0x500000
diff --git a/configs/socfpga_n5x_vab_defconfig b/configs/socfpga_n5x_vab_defconfig
index cf9905e5f8..04942e4fd9 100644
--- a/configs/socfpga_n5x_vab_defconfig
+++ b/configs/socfpga_n5x_vab_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=400000000
CONFIG_SPL_LDSCRIPT="arch/arm/mach-socfpga/u-boot-spl-soc64.lds"
CONFIG_ARCH_SOCFPGA=y
CONFIG_SYS_TEXT_BASE=0x200000
diff --git a/configs/socfpga_stratix10_atf_defconfig b/configs/socfpga_stratix10_atf_defconfig
index 409a689c26..6d2f4736c6 100644
--- a/configs/socfpga_stratix10_atf_defconfig
+++ b/configs/socfpga_stratix10_atf_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=400000000
CONFIG_SPL_LDSCRIPT="arch/arm/mach-socfpga/u-boot-spl-soc64.lds"
CONFIG_ARCH_SOCFPGA=y
CONFIG_SYS_TEXT_BASE=0x200000
diff --git a/configs/socfpga_stratix10_defconfig b/configs/socfpga_stratix10_defconfig
index 5d4aa6f702..8e16c2bfbb 100644
--- a/configs/socfpga_stratix10_defconfig
+++ b/configs/socfpga_stratix10_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=400000000
CONFIG_ARCH_SOCFPGA=y
CONFIG_SYS_TEXT_BASE=0x1000
CONFIG_SYS_MALLOC_LEN=0x500000
diff --git a/configs/starqltechn_defconfig b/configs/starqltechn_defconfig
index e3b2f7c249..608d001b6d 100644
--- a/configs/starqltechn_defconfig
+++ b/configs/starqltechn_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=19000000
CONFIG_POSITION_INDEPENDENT=y
CONFIG_ARCH_SNAPDRAGON=y
CONFIG_DEFAULT_DEVICE_TREE="starqltechn"
diff --git a/configs/thunderx_88xx_defconfig b/configs/thunderx_88xx_defconfig
index 471f315446..5e818864d2 100644
--- a/configs/thunderx_88xx_defconfig
+++ b/configs/thunderx_88xx_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=25165824
CONFIG_TARGET_THUNDERX_88XX=y
CONFIG_SYS_TEXT_BASE=0x00500000
CONFIG_SYS_MALLOC_LEN=0x101000
diff --git a/configs/vexpress_aemv8a_juno_defconfig b/configs/vexpress_aemv8a_juno_defconfig
index 374fa32cbf..967bc56093 100644
--- a/configs/vexpress_aemv8a_juno_defconfig
+++ b/configs/vexpress_aemv8a_juno_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_VEXPRESS64=y
CONFIG_NR_DRAM_BANKS=2
CONFIG_DEFAULT_DEVICE_TREE="juno-r2"
diff --git a/configs/vexpress_aemv8a_semi_defconfig b/configs/vexpress_aemv8a_semi_defconfig
index eca61764ba..1a4cbc1cdd 100644
--- a/configs/vexpress_aemv8a_semi_defconfig
+++ b/configs/vexpress_aemv8a_semi_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
# CONFIG_ARM64_CRC32 is not set
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_VEXPRESS64=y
CONFIG_NR_DRAM_BANKS=2
CONFIG_DEFAULT_DEVICE_TREE="fvp-base-revc"
diff --git a/configs/vexpress_aemv8r_defconfig b/configs/vexpress_aemv8r_defconfig
index 612797e47d..a1c5d88717 100644
--- a/configs/vexpress_aemv8r_defconfig
+++ b/configs/vexpress_aemv8r_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_VEXPRESS64=y
CONFIG_NR_DRAM_BANKS=2
CONFIG_DEFAULT_DEVICE_TREE="arm_fvp"
diff --git a/configs/xilinx_versal_mini_defconfig b/configs/xilinx_versal_mini_defconfig
index 2cffba4845..16d26352ec 100644
--- a/configs/xilinx_versal_mini_defconfig
+++ b/configs/xilinx_versal_mini_defconfig
@@ -1,6 +1,7 @@
CONFIG_ARM=y
CONFIG_SYS_CONFIG_NAME="xilinx_versal_mini_qspi"
CONFIG_SYS_ICACHE_OFF=y
+CONFIG_COUNTER_FREQUENCY=100000000
CONFIG_ARCH_VERSAL=y
CONFIG_SYS_TEXT_BASE=0xFFFC0000
CONFIG_SYS_MALLOC_LEN=0x2000
@@ -9,7 +10,6 @@ CONFIG_NR_DRAM_BANKS=3
CONFIG_ENV_SIZE=0x80
CONFIG_DEFAULT_DEVICE_TREE="versal-mini"
CONFIG_SYS_MEM_RSVD_FOR_MMU=y
-CONFIG_COUNTER_FREQUENCY=100000000
# CONFIG_PSCI_RESET is not set
CONFIG_SYS_LOAD_ADDR=0x8000000
CONFIG_SYS_MEMTEST_START=0x00000000
diff --git a/configs/xilinx_versal_mini_emmc0_defconfig b/configs/xilinx_versal_mini_emmc0_defconfig
index a1b51e5b1c..ab14118fdc 100644
--- a/configs/xilinx_versal_mini_emmc0_defconfig
+++ b/configs/xilinx_versal_mini_emmc0_defconfig
@@ -1,6 +1,7 @@
CONFIG_ARM=y
CONFIG_SYS_CONFIG_NAME="xilinx_versal_mini"
CONFIG_SYS_ICACHE_OFF=y
+CONFIG_COUNTER_FREQUENCY=100000000
CONFIG_ARCH_VERSAL=y
CONFIG_SYS_TEXT_BASE=0x10000
CONFIG_SYS_MALLOC_LEN=0x80000
@@ -8,7 +9,6 @@ CONFIG_SYS_MALLOC_F_LEN=0x400
CONFIG_NR_DRAM_BANKS=1
CONFIG_ENV_SIZE=0x80
CONFIG_DEFAULT_DEVICE_TREE="versal-mini-emmc0"
-CONFIG_COUNTER_FREQUENCY=100000000
# CONFIG_PSCI_RESET is not set
CONFIG_SYS_LOAD_ADDR=0x8000000
# CONFIG_EXPERT is not set
diff --git a/configs/xilinx_versal_mini_emmc1_defconfig b/configs/xilinx_versal_mini_emmc1_defconfig
index 4727df5ad0..cab3d21cb7 100644
--- a/configs/xilinx_versal_mini_emmc1_defconfig
+++ b/configs/xilinx_versal_mini_emmc1_defconfig
@@ -1,6 +1,7 @@
CONFIG_ARM=y
CONFIG_SYS_CONFIG_NAME="xilinx_versal_mini"
CONFIG_SYS_ICACHE_OFF=y
+CONFIG_COUNTER_FREQUENCY=100000000
CONFIG_ARCH_VERSAL=y
CONFIG_SYS_TEXT_BASE=0x10000
CONFIG_SYS_MALLOC_LEN=0x80000
@@ -8,7 +9,6 @@ CONFIG_SYS_MALLOC_F_LEN=0x400
CONFIG_NR_DRAM_BANKS=1
CONFIG_ENV_SIZE=0x80
CONFIG_DEFAULT_DEVICE_TREE="versal-mini-emmc1"
-CONFIG_COUNTER_FREQUENCY=100000000
# CONFIG_PSCI_RESET is not set
CONFIG_SYS_LOAD_ADDR=0x8000000
# CONFIG_EXPERT is not set
diff --git a/configs/xilinx_versal_virt_defconfig b/configs/xilinx_versal_virt_defconfig
index f5873599ca..38747ffd02 100644
--- a/configs/xilinx_versal_virt_defconfig
+++ b/configs/xilinx_versal_virt_defconfig
@@ -1,4 +1,5 @@
CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=100000000
CONFIG_POSITION_INDEPENDENT=y
CONFIG_SYS_INIT_SP_BSS_OFFSET=1572864
CONFIG_ARCH_VERSAL=y
@@ -8,7 +9,6 @@ CONFIG_DM_GPIO=y
CONFIG_DEFAULT_DEVICE_TREE="xilinx-versal-virt"
CONFIG_CMD_FRU=y
CONFIG_DEFINE_TCM_OCM_MMAP=y
-CONFIG_COUNTER_FREQUENCY=100000000
CONFIG_SYS_LOAD_ADDR=0x8000000
CONFIG_SYS_MEMTEST_START=0x00000000
CONFIG_SYS_MEMTEST_END=0x00001000
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 10fd601278..dab7a99c68 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -40,6 +40,7 @@ config ALTERA_SYSID
config ATSHA204A
bool "Support for Atmel ATSHA204A module"
+ select BITREVERSE
depends on MISC
help
Enable support for I2C connected Atmel's ATSHA204A
diff --git a/drivers/misc/atsha204a-i2c.c b/drivers/misc/atsha204a-i2c.c
index 63fe541dad..5da8134f05 100644
--- a/drivers/misc/atsha204a-i2c.c
+++ b/drivers/misc/atsha204a-i2c.c
@@ -18,6 +18,7 @@
#include <log.h>
#include <asm/global_data.h>
#include <linux/delay.h>
+#include <linux/bitrev.h>
#include <u-boot/crc.h>
#define ATSHA204A_TWLO 60
@@ -27,126 +28,9 @@
DECLARE_GLOBAL_DATA_PTR;
-/*
- * The ATSHA204A uses an (to me) unknown CRC-16 algorithm.
- * The Reveng CRC-16 catalogue does not contain it.
- *
- * Because in Atmel's documentation only a primitive implementation
- * can be found, I have implemented this one with lookup table.
- */
-
-/*
- * This is the code that computes the table below:
- *
- * int i, j;
- * for (i = 0; i < 256; ++i) {
- * u8 c = 0;
- * for (j = 0; j < 8; ++j) {
- * c = (c << 1) | ((i >> j) & 1);
- * }
- * bitreverse_table[i] = c;
- * }
- */
-
-static u8 const bitreverse_table[256] = {
- 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
- 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
- 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
- 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
- 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
- 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
- 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
- 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
- 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
- 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
- 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
- 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
- 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
- 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
- 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
- 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
- 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
- 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
- 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
- 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
- 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
- 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
- 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
- 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
- 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
- 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
- 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
- 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
- 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
- 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
- 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
- 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff,
-};
-
-/*
- * This is the code that computes the table below:
- *
- * int i, j;
- * for (i = 0; i < 256; ++i) {
- * u16 c = i << 8;
- * for (j = 0; j < 8; ++j) {
- * int b = c >> 15;
- * c <<= 1;
- * if (b)
- * c ^= 0x8005;
- * }
- * crc16_table[i] = c;
- * }
- */
-static u16 const crc16_table[256] = {
- 0x0000, 0x8005, 0x800f, 0x000a, 0x801b, 0x001e, 0x0014, 0x8011,
- 0x8033, 0x0036, 0x003c, 0x8039, 0x0028, 0x802d, 0x8027, 0x0022,
- 0x8063, 0x0066, 0x006c, 0x8069, 0x0078, 0x807d, 0x8077, 0x0072,
- 0x0050, 0x8055, 0x805f, 0x005a, 0x804b, 0x004e, 0x0044, 0x8041,
- 0x80c3, 0x00c6, 0x00cc, 0x80c9, 0x00d8, 0x80dd, 0x80d7, 0x00d2,
- 0x00f0, 0x80f5, 0x80ff, 0x00fa, 0x80eb, 0x00ee, 0x00e4, 0x80e1,
- 0x00a0, 0x80a5, 0x80af, 0x00aa, 0x80bb, 0x00be, 0x00b4, 0x80b1,
- 0x8093, 0x0096, 0x009c, 0x8099, 0x0088, 0x808d, 0x8087, 0x0082,
- 0x8183, 0x0186, 0x018c, 0x8189, 0x0198, 0x819d, 0x8197, 0x0192,
- 0x01b0, 0x81b5, 0x81bf, 0x01ba, 0x81ab, 0x01ae, 0x01a4, 0x81a1,
- 0x01e0, 0x81e5, 0x81ef, 0x01ea, 0x81fb, 0x01fe, 0x01f4, 0x81f1,
- 0x81d3, 0x01d6, 0x01dc, 0x81d9, 0x01c8, 0x81cd, 0x81c7, 0x01c2,
- 0x0140, 0x8145, 0x814f, 0x014a, 0x815b, 0x015e, 0x0154, 0x8151,
- 0x8173, 0x0176, 0x017c, 0x8179, 0x0168, 0x816d, 0x8167, 0x0162,
- 0x8123, 0x0126, 0x012c, 0x8129, 0x0138, 0x813d, 0x8137, 0x0132,
- 0x0110, 0x8115, 0x811f, 0x011a, 0x810b, 0x010e, 0x0104, 0x8101,
- 0x8303, 0x0306, 0x030c, 0x8309, 0x0318, 0x831d, 0x8317, 0x0312,
- 0x0330, 0x8335, 0x833f, 0x033a, 0x832b, 0x032e, 0x0324, 0x8321,
- 0x0360, 0x8365, 0x836f, 0x036a, 0x837b, 0x037e, 0x0374, 0x8371,
- 0x8353, 0x0356, 0x035c, 0x8359, 0x0348, 0x834d, 0x8347, 0x0342,
- 0x03c0, 0x83c5, 0x83cf, 0x03ca, 0x83db, 0x03de, 0x03d4, 0x83d1,
- 0x83f3, 0x03f6, 0x03fc, 0x83f9, 0x03e8, 0x83ed, 0x83e7, 0x03e2,
- 0x83a3, 0x03a6, 0x03ac, 0x83a9, 0x03b8, 0x83bd, 0x83b7, 0x03b2,
- 0x0390, 0x8395, 0x839f, 0x039a, 0x838b, 0x038e, 0x0384, 0x8381,
- 0x0280, 0x8285, 0x828f, 0x028a, 0x829b, 0x029e, 0x0294, 0x8291,
- 0x82b3, 0x02b6, 0x02bc, 0x82b9, 0x02a8, 0x82ad, 0x82a7, 0x02a2,
- 0x82e3, 0x02e6, 0x02ec, 0x82e9, 0x02f8, 0x82fd, 0x82f7, 0x02f2,
- 0x02d0, 0x82d5, 0x82df, 0x02da, 0x82cb, 0x02ce, 0x02c4, 0x82c1,
- 0x8243, 0x0246, 0x024c, 0x8249, 0x0258, 0x825d, 0x8257, 0x0252,
- 0x0270, 0x8275, 0x827f, 0x027a, 0x826b, 0x026e, 0x0264, 0x8261,
- 0x0220, 0x8225, 0x822f, 0x022a, 0x823b, 0x023e, 0x0234, 0x8231,
- 0x8213, 0x0216, 0x021c, 0x8219, 0x0208, 0x820d, 0x8207, 0x0202,
-};
-
-static inline u16 crc16_byte(u16 crc, const u8 data)
+static inline u16 atsha204a_crc16(const u8 *buffer, size_t len)
{
- u16 t = crc16_table[((crc >> 8) ^ bitreverse_table[data]) & 0xff];
- return ((crc << 8) ^ t);
-}
-
-static u16 atsha204a_crc16(const u8 *buffer, size_t len)
-{
- u16 crc = 0;
-
- while (len--)
- crc = crc16_byte(crc, *buffer++);
-
- return crc;
+ return bitrev16(crc16(0, buffer, len));
}
static int atsha204a_send(struct udevice *dev, const u8 *buf, u8 len)
diff --git a/fs/ext4/Makefile b/fs/ext4/Makefile
index c2544beee3..6ae44a2d0a 100644
--- a/fs/ext4/Makefile
+++ b/fs/ext4/Makefile
@@ -8,4 +8,4 @@
#
obj-y := ext4fs.o ext4_common.o dev.o
-obj-$(CONFIG_EXT4_WRITE) += ext4_write.o ext4_journal.o crc16.o
+obj-$(CONFIG_EXT4_WRITE) += ext4_write.o ext4_journal.o
diff --git a/fs/ext4/crc16.c b/fs/ext4/crc16.c
deleted file mode 100644
index 3afb34daef..0000000000
--- a/fs/ext4/crc16.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * crc16.c
- *
- * This source code is licensed under the GNU General Public License,
- * Version 2. See the file COPYING for more details.
- */
-
-#include <common.h>
-#include <asm/byteorder.h>
-#include <linux/stat.h>
-#include "crc16.h"
-
-/** CRC table for the CRC-16. The poly is 0x8005 (x16 + x15 + x2 + 1) */
-static __u16 const crc16_table[256] = {
- 0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241,
- 0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440,
- 0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40,
- 0x0A00, 0xCAC1, 0xCB81, 0x0B40, 0xC901, 0x09C0, 0x0880, 0xC841,
- 0xD801, 0x18C0, 0x1980, 0xD941, 0x1B00, 0xDBC1, 0xDA81, 0x1A40,
- 0x1E00, 0xDEC1, 0xDF81, 0x1F40, 0xDD01, 0x1DC0, 0x1C80, 0xDC41,
- 0x1400, 0xD4C1, 0xD581, 0x1540, 0xD701, 0x17C0, 0x1680, 0xD641,
- 0xD201, 0x12C0, 0x1380, 0xD341, 0x1100, 0xD1C1, 0xD081, 0x1040,
- 0xF001, 0x30C0, 0x3180, 0xF141, 0x3300, 0xF3C1, 0xF281, 0x3240,
- 0x3600, 0xF6C1, 0xF781, 0x3740, 0xF501, 0x35C0, 0x3480, 0xF441,
- 0x3C00, 0xFCC1, 0xFD81, 0x3D40, 0xFF01, 0x3FC0, 0x3E80, 0xFE41,
- 0xFA01, 0x3AC0, 0x3B80, 0xFB41, 0x3900, 0xF9C1, 0xF881, 0x3840,
- 0x2800, 0xE8C1, 0xE981, 0x2940, 0xEB01, 0x2BC0, 0x2A80, 0xEA41,
- 0xEE01, 0x2EC0, 0x2F80, 0xEF41, 0x2D00, 0xEDC1, 0xEC81, 0x2C40,
- 0xE401, 0x24C0, 0x2580, 0xE541, 0x2700, 0xE7C1, 0xE681, 0x2640,
- 0x2200, 0xE2C1, 0xE381, 0x2340, 0xE101, 0x21C0, 0x2080, 0xE041,
- 0xA001, 0x60C0, 0x6180, 0xA141, 0x6300, 0xA3C1, 0xA281, 0x6240,
- 0x6600, 0xA6C1, 0xA781, 0x6740, 0xA501, 0x65C0, 0x6480, 0xA441,
- 0x6C00, 0xACC1, 0xAD81, 0x6D40, 0xAF01, 0x6FC0, 0x6E80, 0xAE41,
- 0xAA01, 0x6AC0, 0x6B80, 0xAB41, 0x6900, 0xA9C1, 0xA881, 0x6840,
- 0x7800, 0xB8C1, 0xB981, 0x7940, 0xBB01, 0x7BC0, 0x7A80, 0xBA41,
- 0xBE01, 0x7EC0, 0x7F80, 0xBF41, 0x7D00, 0xBDC1, 0xBC81, 0x7C40,
- 0xB401, 0x74C0, 0x7580, 0xB541, 0x7700, 0xB7C1, 0xB681, 0x7640,
- 0x7200, 0xB2C1, 0xB381, 0x7340, 0xB101, 0x71C0, 0x7080, 0xB041,
- 0x5000, 0x90C1, 0x9181, 0x5140, 0x9301, 0x53C0, 0x5280, 0x9241,
- 0x9601, 0x56C0, 0x5780, 0x9741, 0x5500, 0x95C1, 0x9481, 0x5440,
- 0x9C01, 0x5CC0, 0x5D80, 0x9D41, 0x5F00, 0x9FC1, 0x9E81, 0x5E40,
- 0x5A00, 0x9AC1, 0x9B81, 0x5B40, 0x9901, 0x59C0, 0x5880, 0x9841,
- 0x8801, 0x48C0, 0x4980, 0x8941, 0x4B00, 0x8BC1, 0x8A81, 0x4A40,
- 0x4E00, 0x8EC1, 0x8F81, 0x4F40, 0x8D01, 0x4DC0, 0x4C80, 0x8C41,
- 0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641,
- 0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040
-};
-
-/**
- * Compute the CRC-16 for the data buffer
-*/
-
-unsigned int ext2fs_crc16(unsigned int crc,
- const void *buffer, unsigned int len)
-{
- const unsigned char *cp = buffer;
-
- while (len--)
- crc = (((crc >> 8) & 0xffU) ^
- crc16_table[(crc ^ *cp++) & 0xffU]) & 0x0000ffffU;
- return crc;
-}
diff --git a/fs/ext4/crc16.h b/fs/ext4/crc16.h
deleted file mode 100644
index 5fd113a56c..0000000000
--- a/fs/ext4/crc16.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * crc16.h - CRC-16 routine
- * Implements the standard CRC-16:
- * Width 16
- * Poly 0x8005 (x16 + x15 + x2 + 1)
- * Init 0
- *
- * Copyright (c) 2005 Ben Gardner <bgardner@wabtec.com>
- * This source code is licensed under the GNU General Public License,
- * Version 2. See the file COPYING for more details.
- */
-#ifndef __CRC16_H
-#define __CRC16_H
-extern unsigned int ext2fs_crc16(unsigned int crc,
- const void *buffer, unsigned int len);
-#endif
diff --git a/fs/ext4/ext4_common.c b/fs/ext4/ext4_common.c
index c52cc400e1..d49ba4a995 100644
--- a/fs/ext4/ext4_common.c
+++ b/fs/ext4/ext4_common.c
@@ -427,14 +427,14 @@ uint16_t ext4fs_checksum_update(uint32_t i)
if (le32_to_cpu(fs->sb->feature_ro_compat) & EXT4_FEATURE_RO_COMPAT_GDT_CSUM) {
int offset = offsetof(struct ext2_block_group, bg_checksum);
- crc = ext2fs_crc16(~0, fs->sb->unique_id,
+ crc = crc16(~0, (__u8 *)fs->sb->unique_id,
sizeof(fs->sb->unique_id));
- crc = ext2fs_crc16(crc, &le32_i, sizeof(le32_i));
- crc = ext2fs_crc16(crc, desc, offset);
+ crc = crc16(crc, (__u8 *)&le32_i, sizeof(le32_i));
+ crc = crc16(crc, (__u8 *)desc, offset);
offset += sizeof(desc->bg_checksum); /* skip checksum */
assert(offset == sizeof(*desc));
if (offset < fs->gdsize) {
- crc = ext2fs_crc16(crc, (__u8 *)desc + offset,
+ crc = crc16(crc, (__u8 *)desc + offset,
fs->gdsize - offset);
}
}
diff --git a/fs/ext4/ext4_common.h b/fs/ext4/ext4_common.h
index beaee9c80b..504c708b06 100644
--- a/fs/ext4/ext4_common.h
+++ b/fs/ext4/ext4_common.h
@@ -27,7 +27,7 @@
#include <linux/errno.h>
#if defined(CONFIG_EXT4_WRITE)
#include "ext4_journal.h"
-#include "crc16.h"
+#include <linux/crc16.h>
#endif
#define YES 1
diff --git a/fs/ubifs/Makefile b/fs/ubifs/Makefile
index 64d6447294..631ba5f438 100644
--- a/fs/ubifs/Makefile
+++ b/fs/ubifs/Makefile
@@ -9,5 +9,5 @@
obj-y := ubifs.o io.o super.o sb.o master.o lpt.o
obj-y += lpt_commit.o scan.o lprops.o
-obj-y += tnc.o tnc_misc.o debug.o crc16.o budget.o
+obj-y += tnc.o tnc_misc.o debug.o budget.o
obj-y += log.o orphan.o recovery.o replay.o gc.o
diff --git a/fs/ubifs/crc16.c b/fs/ubifs/crc16.c
deleted file mode 100644
index 443ccf855d..0000000000
--- a/fs/ubifs/crc16.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * crc16.c
- *
- * This source code is licensed under the GNU General Public License,
- * Version 2. See the file COPYING for more details.
- */
-
-#include <linux/types.h>
-#include "crc16.h"
-
-/** CRC table for the CRC-16. The poly is 0x8005 (x^16 + x^15 + x^2 + 1) */
-u16 const crc16_table[256] = {
- 0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241,
- 0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440,
- 0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40,
- 0x0A00, 0xCAC1, 0xCB81, 0x0B40, 0xC901, 0x09C0, 0x0880, 0xC841,
- 0xD801, 0x18C0, 0x1980, 0xD941, 0x1B00, 0xDBC1, 0xDA81, 0x1A40,
- 0x1E00, 0xDEC1, 0xDF81, 0x1F40, 0xDD01, 0x1DC0, 0x1C80, 0xDC41,
- 0x1400, 0xD4C1, 0xD581, 0x1540, 0xD701, 0x17C0, 0x1680, 0xD641,
- 0xD201, 0x12C0, 0x1380, 0xD341, 0x1100, 0xD1C1, 0xD081, 0x1040,
- 0xF001, 0x30C0, 0x3180, 0xF141, 0x3300, 0xF3C1, 0xF281, 0x3240,
- 0x3600, 0xF6C1, 0xF781, 0x3740, 0xF501, 0x35C0, 0x3480, 0xF441,
- 0x3C00, 0xFCC1, 0xFD81, 0x3D40, 0xFF01, 0x3FC0, 0x3E80, 0xFE41,
- 0xFA01, 0x3AC0, 0x3B80, 0xFB41, 0x3900, 0xF9C1, 0xF881, 0x3840,
- 0x2800, 0xE8C1, 0xE981, 0x2940, 0xEB01, 0x2BC0, 0x2A80, 0xEA41,
- 0xEE01, 0x2EC0, 0x2F80, 0xEF41, 0x2D00, 0xEDC1, 0xEC81, 0x2C40,
- 0xE401, 0x24C0, 0x2580, 0xE541, 0x2700, 0xE7C1, 0xE681, 0x2640,
- 0x2200, 0xE2C1, 0xE381, 0x2340, 0xE101, 0x21C0, 0x2080, 0xE041,
- 0xA001, 0x60C0, 0x6180, 0xA141, 0x6300, 0xA3C1, 0xA281, 0x6240,
- 0x6600, 0xA6C1, 0xA781, 0x6740, 0xA501, 0x65C0, 0x6480, 0xA441,
- 0x6C00, 0xACC1, 0xAD81, 0x6D40, 0xAF01, 0x6FC0, 0x6E80, 0xAE41,
- 0xAA01, 0x6AC0, 0x6B80, 0xAB41, 0x6900, 0xA9C1, 0xA881, 0x6840,
- 0x7800, 0xB8C1, 0xB981, 0x7940, 0xBB01, 0x7BC0, 0x7A80, 0xBA41,
- 0xBE01, 0x7EC0, 0x7F80, 0xBF41, 0x7D00, 0xBDC1, 0xBC81, 0x7C40,
- 0xB401, 0x74C0, 0x7580, 0xB541, 0x7700, 0xB7C1, 0xB681, 0x7640,
- 0x7200, 0xB2C1, 0xB381, 0x7340, 0xB101, 0x71C0, 0x7080, 0xB041,
- 0x5000, 0x90C1, 0x9181, 0x5140, 0x9301, 0x53C0, 0x5280, 0x9241,
- 0x9601, 0x56C0, 0x5780, 0x9741, 0x5500, 0x95C1, 0x9481, 0x5440,
- 0x9C01, 0x5CC0, 0x5D80, 0x9D41, 0x5F00, 0x9FC1, 0x9E81, 0x5E40,
- 0x5A00, 0x9AC1, 0x9B81, 0x5B40, 0x9901, 0x59C0, 0x5880, 0x9841,
- 0x8801, 0x48C0, 0x4980, 0x8941, 0x4B00, 0x8BC1, 0x8A81, 0x4A40,
- 0x4E00, 0x8EC1, 0x8F81, 0x4F40, 0x8D01, 0x4DC0, 0x4C80, 0x8C41,
- 0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641,
- 0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040
-};
-
-/**
- * crc16 - compute the CRC-16 for the data buffer
- * @crc: previous CRC value
- * @buffer: data pointer
- * @len: number of bytes in the buffer
- *
- * Returns the updated CRC value.
- */
-u16 crc16(u16 crc, u8 const *buffer, size_t len)
-{
- while (len--)
- crc = crc16_byte(crc, *buffer++);
- return crc;
-}
diff --git a/fs/ubifs/lpt.c b/fs/ubifs/lpt.c
index 62748b0210..27835e60d2 100644
--- a/fs/ubifs/lpt.c
+++ b/fs/ubifs/lpt.c
@@ -42,7 +42,7 @@
#include <linux/compat.h>
#include <linux/err.h>
#include <ubi_uboot.h>
-#include "crc16.h"
+#include <linux/crc16.h>
#endif
/**
diff --git a/fs/ubifs/lpt_commit.c b/fs/ubifs/lpt_commit.c
index 897d001430..ba0b19a1f2 100644
--- a/fs/ubifs/lpt_commit.c
+++ b/fs/ubifs/lpt_commit.c
@@ -23,7 +23,7 @@
#include <linux/bitops.h>
#include <linux/compat.h>
#include <linux/err.h>
-#include "crc16.h"
+#include <linux/crc16.h>
#endif
#include "ubifs.h"
diff --git a/include/configs/apalis-imx8.h b/include/configs/apalis-imx8.h
index c87bcd475e..e759f18fe4 100644
--- a/include/configs/apalis-imx8.h
+++ b/include/configs/apalis-imx8.h
@@ -84,7 +84,4 @@
#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \
sizeof(CONFIG_SYS_PROMPT) + 16)
-/* Generic Timer Definitions */
-#define COUNTER_FREQUENCY 8000000 /* 8MHz */
-
#endif /* __APALIS_IMX8_H */
diff --git a/include/configs/apalis-imx8x.h b/include/configs/apalis-imx8x.h
index 71a80f38bb..17f1981643 100644
--- a/include/configs/apalis-imx8x.h
+++ b/include/configs/apalis-imx8x.h
@@ -115,9 +115,6 @@
#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \
sizeof(CONFIG_SYS_PROMPT) + 16)
-/* Generic Timer Definitions */
-#define COUNTER_FREQUENCY 8000000 /* 8MHz */
-
/* Networking */
#define CONFIG_FEC_ENET_DEV 0
#define IMX_FEC_BASE 0x5b040000
diff --git a/include/configs/capricorn-common.h b/include/configs/capricorn-common.h
index 58d7a3a8ce..1466be10fc 100644
--- a/include/configs/capricorn-common.h
+++ b/include/configs/capricorn-common.h
@@ -123,9 +123,6 @@
#define CONFIG_SYS_MAXARGS 64
#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
-/* Generic Timer Definitions */
-#define COUNTER_FREQUENCY 8000000 /* 8MHz */
-
#define BOOTAUX_RESERVED_MEM_BASE 0x88000000
#define BOOTAUX_RESERVED_MEM_SIZE SZ_128M /* Reserve from second 128MB */
diff --git a/include/configs/cgtqmx8.h b/include/configs/cgtqmx8.h
index bd5c072382..b5817f1e42 100644
--- a/include/configs/cgtqmx8.h
+++ b/include/configs/cgtqmx8.h
@@ -131,9 +131,6 @@
#define PHYS_SDRAM_1_SIZE 0x80000000 /* 2 GB */
#define PHYS_SDRAM_2_SIZE 0x100000000 /* 4 GB */
-/* Generic Timer Definitions */
-#define COUNTER_FREQUENCY 8000000 /* 8MHz */
-
/* Networking */
#define CONFIG_FEC_MXC_PHYADDR -1
#define FEC_QUIRK_ENET_MAC
diff --git a/include/configs/colibri-imx8x.h b/include/configs/colibri-imx8x.h
index 008fa6ef07..265b7294fe 100644
--- a/include/configs/colibri-imx8x.h
+++ b/include/configs/colibri-imx8x.h
@@ -119,7 +119,6 @@
sizeof(CONFIG_SYS_PROMPT) + 16)
/* Generic Timer Definitions */
-#define COUNTER_FREQUENCY 8000000 /* 8MHz */
#define BOOTAUX_RESERVED_MEM_BASE 0x88000000
#define BOOTAUX_RESERVED_MEM_SIZE SZ_128M /* Reserve from second 128MB */
diff --git a/include/configs/condor.h b/include/configs/condor.h
index 213e68f158..819184996e 100644
--- a/include/configs/condor.h
+++ b/include/configs/condor.h
@@ -24,7 +24,4 @@
/* Board Clock */
/* XTAL_CLK : 33.33MHz */
-/* Generic Timer Definitions (use in assembler source) */
-#define COUNTER_FREQUENCY 0xFE502A /* 16.66MHz from CPclk */
-
#endif /* __CONDOR_H */
diff --git a/include/configs/draak.h b/include/configs/draak.h
index 5bd8740c6f..476b4c3710 100644
--- a/include/configs/draak.h
+++ b/include/configs/draak.h
@@ -11,9 +11,6 @@
#include "rcar-gen3-common.h"
-/* Generic Timer Definitions (use in assembler source) */
-#define COUNTER_FREQUENCY 0xFE502A /* 16.66MHz from CPclk */
-
/* Environment in eMMC, at the end of 2nd "boot sector" */
#define CONFIG_FLASH_SHOW_PROGRESS 45
diff --git a/include/configs/dragonboard410c.h b/include/configs/dragonboard410c.h
index 43a179f013..14ba52a2eb 100644
--- a/include/configs/dragonboard410c.h
+++ b/include/configs/dragonboard410c.h
@@ -23,9 +23,6 @@
/* UART */
-/* Generic Timer Definitions */
-#define COUNTER_FREQUENCY 19000000
-
/* Fixup - in init code we switch from device to host mode,
* it has to be done after each HCD reset */
#define CONFIG_EHCI_HCD_INIT_AFTER_RESET
diff --git a/include/configs/dragonboard820c.h b/include/configs/dragonboard820c.h
index 229e1a323b..1e2b15b33f 100644
--- a/include/configs/dragonboard820c.h
+++ b/include/configs/dragonboard820c.h
@@ -23,9 +23,6 @@
#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + 0x7fff0)
#define CONFIG_SYS_BOOTM_LEN SZ_64M
-/* Generic Timer Definitions */
-#define COUNTER_FREQUENCY 19000000
-
#ifndef CONFIG_SPL_BUILD
#include <config_distro_bootcmd.h>
#endif
diff --git a/include/configs/eagle.h b/include/configs/eagle.h
index 42fe057716..c751f75a7d 100644
--- a/include/configs/eagle.h
+++ b/include/configs/eagle.h
@@ -16,7 +16,4 @@
/* Board Clock */
/* XTAL_CLK : 33.33MHz */
-/* Generic Timer Definitions (use in assembler source) */
-#define COUNTER_FREQUENCY 0xFE502A /* 16.66MHz from CPclk */
-
#endif /* __EAGLE_H */
diff --git a/include/configs/ebisu.h b/include/configs/ebisu.h
index ce31a462fc..3adc4180ef 100644
--- a/include/configs/ebisu.h
+++ b/include/configs/ebisu.h
@@ -13,9 +13,6 @@
#include "rcar-gen3-common.h"
-/* Generic Timer Definitions (use in assembler source) */
-#define COUNTER_FREQUENCY 0xFE502A /* 16.66MHz from CPclk */
-
/* Environment in eMMC, at the end of 2nd "boot sector" */
#define CONFIG_FLASH_SHOW_PROGRESS 45
diff --git a/include/configs/exynos-common.h b/include/configs/exynos-common.h
index eb2606905f..dd1cbd7ab8 100644
--- a/include/configs/exynos-common.h
+++ b/include/configs/exynos-common.h
@@ -19,7 +19,6 @@
/* Keep L2 Cache Disabled */
/* input clock of PLL: 24MHz input clock */
-#define COUNTER_FREQUENCY 24000000
/* select serial console configuration */
diff --git a/include/configs/exynos7420-common.h b/include/configs/exynos7420-common.h
index fcb238fb3e..5658da474c 100644
--- a/include/configs/exynos7420-common.h
+++ b/include/configs/exynos7420-common.h
@@ -24,9 +24,6 @@
/* select serial console configuration */
-/* Timer input clock frequency */
-#define COUNTER_FREQUENCY 24000000
-
/* IRAM Layout */
#define CONFIG_IRAM_BASE 0x02100000
#define CONFIG_IRAM_SIZE 0x58000
diff --git a/include/configs/exynos78x0-common.h b/include/configs/exynos78x0-common.h
index 457057ce71..ec43e133dd 100644
--- a/include/configs/exynos78x0-common.h
+++ b/include/configs/exynos78x0-common.h
@@ -25,9 +25,6 @@
/* Boot Argument Buffer Size */
#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
-/* Timer input clock frequency */
-#define COUNTER_FREQUENCY 26000000
-
#define CPU_RELEASE_ADDR secondary_boot_addr
#define CONFIG_SYS_BAUDRATE_TABLE \
diff --git a/include/configs/falcon.h b/include/configs/falcon.h
index 52dcf19cca..446261cedc 100644
--- a/include/configs/falcon.h
+++ b/include/configs/falcon.h
@@ -24,7 +24,4 @@
/* Board Clock */
/* XTAL_CLK : 16.66MHz */
-/* Generic Timer Definitions (use in assembler source) */
-#define COUNTER_FREQUENCY 0xFE502A /* 16.66MHz from CPclk */
-
#endif /* __FALCON_H */
diff --git a/include/configs/hihope-rzg2.h b/include/configs/hihope-rzg2.h
index e46eb07a5e..54702985b9 100644
--- a/include/configs/hihope-rzg2.h
+++ b/include/configs/hihope-rzg2.h
@@ -11,7 +11,4 @@
#include "rcar-gen3-common.h"
-/* Generic Timer Definitions (use in assembler source) */
-#define COUNTER_FREQUENCY 0xFE502A /* 16.66MHz from CPclk */
-
#endif /* __HIHOPE_RZG2_H */
diff --git a/include/configs/hikey.h b/include/configs/hikey.h
index 29a0d94386..19d5b6261f 100644
--- a/include/configs/hikey.h
+++ b/include/configs/hikey.h
@@ -32,9 +32,6 @@
#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + 0x7fff0)
-/* Generic Timer Definitions */
-#define COUNTER_FREQUENCY 19000000
-
/* Generic Interrupt Controller Definitions */
#define GICD_BASE 0xf6801000
#define GICC_BASE 0xf6802000
diff --git a/include/configs/hikey960.h b/include/configs/hikey960.h
index f446ecb864..c088f2f2b6 100644
--- a/include/configs/hikey960.h
+++ b/include/configs/hikey960.h
@@ -24,9 +24,6 @@
#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + 0x7fff0)
-/* Generic Timer Definitions */
-#define COUNTER_FREQUENCY 19000000
-
/* Generic Interrupt Controller Definitions */
#define GICD_BASE 0xe82b1000
#define GICC_BASE 0xe82b2000
diff --git a/include/configs/imx8qm_mek.h b/include/configs/imx8qm_mek.h
index 0fe38e61c4..a9c52d2750 100644
--- a/include/configs/imx8qm_mek.h
+++ b/include/configs/imx8qm_mek.h
@@ -130,7 +130,4 @@
#define PHYS_SDRAM_1_SIZE 0x80000000 /* 2 GB */
#define PHYS_SDRAM_2_SIZE 0x100000000 /* 4 GB */
-/* Generic Timer Definitions */
-#define COUNTER_FREQUENCY 8000000 /* 8MHz */
-
#endif /* __IMX8QM_MEK_H */
diff --git a/include/configs/imx8qm_rom7720.h b/include/configs/imx8qm_rom7720.h
index 7532c6e755..c7cace2c36 100644
--- a/include/configs/imx8qm_rom7720.h
+++ b/include/configs/imx8qm_rom7720.h
@@ -124,8 +124,5 @@
/* LPDDR4 board total DDR is 6GB, DDR4 board total DDR is 4 GB */
#define PHYS_SDRAM_2_SIZE 0x80000000 /* 2 GB */
-/* Generic Timer Definitions */
-#define COUNTER_FREQUENCY 8000000 /* 8MHz */
-
#include <linux/stringify.h>
#endif /* __IMX8QM_ROM7720_H */
diff --git a/include/configs/imx8qxp_mek.h b/include/configs/imx8qxp_mek.h
index beb35c9343..9052a9142e 100644
--- a/include/configs/imx8qxp_mek.h
+++ b/include/configs/imx8qxp_mek.h
@@ -129,9 +129,6 @@
/* LPDDR4 board total DDR is 3GB */
#define PHYS_SDRAM_2_SIZE 0x40000000 /* 1 GB */
-/* Generic Timer Definitions */
-#define COUNTER_FREQUENCY 8000000 /* 8MHz */
-
#ifndef CONFIG_DM_PCA953X
#define CONFIG_PCA953X
#endif
diff --git a/include/configs/imx8ulp_evk.h b/include/configs/imx8ulp_evk.h
index f078c37c2d..f274b66343 100644
--- a/include/configs/imx8ulp_evk.h
+++ b/include/configs/imx8ulp_evk.h
@@ -27,8 +27,6 @@
#endif
-#define COUNTER_FREQUENCY 1000000 /* 1MHz */
-
/* ENET Config */
#if defined(CONFIG_FEC_MXC)
#define PHY_ANEG_TIMEOUT 20000
diff --git a/include/configs/km/pg-wcom-ls102xa.h b/include/configs/km/pg-wcom-ls102xa.h
index 0494790c84..dca5589a3e 100644
--- a/include/configs/km/pg-wcom-ls102xa.h
+++ b/include/configs/km/pg-wcom-ls102xa.h
@@ -176,7 +176,6 @@
#define CONFIG_LAYERSCAPE_NS_ACCESS
#define CONFIG_SMP_PEN_ADDR 0x01ee0200
-#define COUNTER_FREQUENCY 8333333
#define CONFIG_HWCONFIG
#define HWCONFIG_BUFFER_SIZE 256
diff --git a/include/configs/kontron_sl28.h b/include/configs/kontron_sl28.h
index c3ab049535..c47b5940fb 100644
--- a/include/configs/kontron_sl28.h
+++ b/include/configs/kontron_sl28.h
@@ -32,7 +32,6 @@
#define CPU_RELEASE_ADDR secondary_boot_addr
/* generic timer */
-#define COUNTER_FREQUENCY 25000000
/* early heap for SPL DM */
#define CONFIG_MALLOC_F_ADDR CONFIG_SYS_FSL_OCRAM_BASE
diff --git a/include/configs/ls1012a_common.h b/include/configs/ls1012a_common.h
index f92ff17eeb..67da01f5e3 100644
--- a/include/configs/ls1012a_common.h
+++ b/include/configs/ls1012a_common.h
@@ -21,9 +21,6 @@
#define CONFIG_SYS_SDRAM_BASE CONFIG_SYS_DDR_SDRAM_BASE
#define CONFIG_SYS_DDR_BLOCK2_BASE 0x880000000ULL
-/* Generic Timer Definitions */
-#define COUNTER_FREQUENCY 25000000 /* 25MHz */
-
/* CSU */
#define CONFIG_LAYERSCAPE_NS_ACCESS
diff --git a/include/configs/ls1021aiot.h b/include/configs/ls1021aiot.h
index 9746081831..82ae3492a2 100644
--- a/include/configs/ls1021aiot.h
+++ b/include/configs/ls1021aiot.h
@@ -119,7 +119,6 @@
#define CONFIG_PEN_ADDR_BIG_ENDIAN
#define CONFIG_LAYERSCAPE_NS_ACCESS
#define CONFIG_SMP_PEN_ADDR 0x01ee0200
-#define COUNTER_FREQUENCY 12500000
#define CONFIG_HWCONFIG
#define HWCONFIG_BUFFER_SIZE 256
diff --git a/include/configs/ls1021aqds.h b/include/configs/ls1021aqds.h
index 010f3a1636..7b79e0841a 100644
--- a/include/configs/ls1021aqds.h
+++ b/include/configs/ls1021aqds.h
@@ -334,7 +334,6 @@
#define CONFIG_PEN_ADDR_BIG_ENDIAN
#define CONFIG_LAYERSCAPE_NS_ACCESS
#define CONFIG_SMP_PEN_ADDR 0x01ee0200
-#define COUNTER_FREQUENCY 12500000
#define CONFIG_HWCONFIG
#define HWCONFIG_BUFFER_SIZE 256
diff --git a/include/configs/ls1021atsn.h b/include/configs/ls1021atsn.h
index bc2a265c40..546c4fcdb9 100644
--- a/include/configs/ls1021atsn.h
+++ b/include/configs/ls1021atsn.h
@@ -99,7 +99,6 @@
#endif
#define CONFIG_LAYERSCAPE_NS_ACCESS
-#define COUNTER_FREQUENCY 12500000
#define CONFIG_HWCONFIG
#define HWCONFIG_BUFFER_SIZE 256
diff --git a/include/configs/ls1021atwr.h b/include/configs/ls1021atwr.h
index 6b1ab87539..b4383d4bbd 100644
--- a/include/configs/ls1021atwr.h
+++ b/include/configs/ls1021atwr.h
@@ -192,7 +192,6 @@
#define CONFIG_PEN_ADDR_BIG_ENDIAN
#define CONFIG_LAYERSCAPE_NS_ACCESS
#define CONFIG_SMP_PEN_ADDR 0x01ee0200
-#define COUNTER_FREQUENCY 12500000
#define CONFIG_HWCONFIG
#define HWCONFIG_BUFFER_SIZE 256
diff --git a/include/configs/ls1028a_common.h b/include/configs/ls1028a_common.h
index 7bb6d416ea..a98d8dd720 100644
--- a/include/configs/ls1028a_common.h
+++ b/include/configs/ls1028a_common.h
@@ -25,9 +25,6 @@
*/
#define CPU_RELEASE_ADDR secondary_boot_addr
-/* Generic Timer Definitions */
-#define COUNTER_FREQUENCY 25000000 /* 25MHz */
-
/* GPIO */
/* I2C */
diff --git a/include/configs/ls1043a_common.h b/include/configs/ls1043a_common.h
index 83b95c242f..61c6d45676 100644
--- a/include/configs/ls1043a_common.h
+++ b/include/configs/ls1043a_common.h
@@ -44,9 +44,6 @@
#define CPU_RELEASE_ADDR secondary_boot_addr
-/* Generic Timer Definitions */
-#define COUNTER_FREQUENCY 25000000 /* 25MHz */
-
/* Serial Port */
#define CONFIG_SYS_NS16550_SERIAL
#define CONFIG_SYS_NS16550_REG_SIZE 1
diff --git a/include/configs/ls1046a_common.h b/include/configs/ls1046a_common.h
index 7552610e03..f9279e4ab4 100644
--- a/include/configs/ls1046a_common.h
+++ b/include/configs/ls1046a_common.h
@@ -44,9 +44,6 @@
#define CPU_RELEASE_ADDR secondary_boot_addr
-/* Generic Timer Definitions */
-#define COUNTER_FREQUENCY 25000000 /* 25MHz */
-
/* Serial Port */
#define CONFIG_SYS_NS16550_SERIAL
#define CONFIG_SYS_NS16550_REG_SIZE 1
diff --git a/include/configs/ls1088aqds.h b/include/configs/ls1088aqds.h
index 1ea6befa9b..e532c343f4 100644
--- a/include/configs/ls1088aqds.h
+++ b/include/configs/ls1088aqds.h
@@ -13,7 +13,6 @@
#endif
#define COUNTER_FREQUENCY_REAL (get_board_sys_clk()/4)
-#define COUNTER_FREQUENCY 25000000 /* 25MHz */
#define CONFIG_MEM_INIT_VALUE 0xdeadbeef
#define SPD_EEPROM_ADDRESS 0x51
diff --git a/include/configs/ls1088ardb.h b/include/configs/ls1088ardb.h
index 1a9cda1e7d..693a2f64b6 100644
--- a/include/configs/ls1088ardb.h
+++ b/include/configs/ls1088ardb.h
@@ -14,7 +14,6 @@
#endif
#define COUNTER_FREQUENCY_REAL 25000000 /* 25MHz */
-#define COUNTER_FREQUENCY 25000000 /* 25MHz */
#ifdef CONFIG_EMU
#define CONFIG_SYS_FSL_DDR_EMU
diff --git a/include/configs/ls2080a_common.h b/include/configs/ls2080a_common.h
index 82585f5dbf..e77e9b7f37 100644
--- a/include/configs/ls2080a_common.h
+++ b/include/configs/ls2080a_common.h
@@ -41,12 +41,10 @@
#define CONFIG_SYS_FSL_OTHER_DDR_NUM_CTRLS
-/* Generic Timer Definitions */
/*
* This is not an accurate number. It is used in start.S. The frequency
* will be udpated later when get_bus_freq(0) is available.
*/
-#define COUNTER_FREQUENCY 25000000 /* 25MHz */
/* GPIO */
diff --git a/include/configs/lx2160a_common.h b/include/configs/lx2160a_common.h
index 96dfe49a7e..d569014819 100644
--- a/include/configs/lx2160a_common.h
+++ b/include/configs/lx2160a_common.h
@@ -46,7 +46,6 @@
* will be udpated later when get_bus_freq(0) is available.
*/
-#define COUNTER_FREQUENCY 25000000 /* 25MHz */
/* Serial Port */
#define CONFIG_PL011_CLOCK (get_bus_freq(0) / 4)
diff --git a/include/configs/mt8183.h b/include/configs/mt8183.h
index 2b4e976aa1..ee31c02e6e 100644
--- a/include/configs/mt8183.h
+++ b/include/configs/mt8183.h
@@ -11,7 +11,6 @@
#include <linux/sizes.h>
-#define COUNTER_FREQUENCY 13000000
#define CONFIG_SYS_NS16550_SERIAL
#define CONFIG_SYS_NS16550_REG_SIZE -4
diff --git a/include/configs/mt8512.h b/include/configs/mt8512.h
index 9c443db9f5..1af8d2e480 100644
--- a/include/configs/mt8512.h
+++ b/include/configs/mt8512.h
@@ -13,7 +13,6 @@
#define CONFIG_SYS_NONCACHED_MEMORY SZ_1M
-#define COUNTER_FREQUENCY 13000000
#define CONFIG_SYS_BOOTM_LEN SZ_64M
diff --git a/include/configs/mt8516.h b/include/configs/mt8516.h
index 47132c1db1..cb2af5843f 100644
--- a/include/configs/mt8516.h
+++ b/include/configs/mt8516.h
@@ -11,7 +11,6 @@
#include <linux/sizes.h>
-#define COUNTER_FREQUENCY 13000000
#define CONFIG_SYS_NS16550_SERIAL
#define CONFIG_SYS_NS16550_REG_SIZE -4
diff --git a/include/configs/mt8518.h b/include/configs/mt8518.h
index 49ee926b0c..8ca8d25148 100644
--- a/include/configs/mt8518.h
+++ b/include/configs/mt8518.h
@@ -13,7 +13,6 @@
#define CONFIG_SYS_NONCACHED_MEMORY SZ_1M
-#define COUNTER_FREQUENCY 13000000
/* DRAM definition */
#define CONFIG_SYS_SDRAM_BASE 0x40000000
diff --git a/include/configs/mx6_common.h b/include/configs/mx6_common.h
index a0e481703b..10e46c628d 100644
--- a/include/configs/mx6_common.h
+++ b/include/configs/mx6_common.h
@@ -10,7 +10,6 @@
#if (defined(CONFIG_MX6UL) || defined(CONFIG_MX6ULL))
#define CONFIG_SC_TIMER_CLK 8000000 /* 8Mhz */
-#define COUNTER_FREQUENCY CONFIG_SC_TIMER_CLK
#else
#ifndef CONFIG_SYS_L2CACHE_OFF
#define CONFIG_SYS_L2_PL310
diff --git a/include/configs/mx7_common.h b/include/configs/mx7_common.h
index 76c374af25..9f7d60f8fb 100644
--- a/include/configs/mx7_common.h
+++ b/include/configs/mx7_common.h
@@ -16,7 +16,6 @@
/* Timer settings */
#define CONFIG_MXC_GPT_HCLK
#define CONFIG_SC_TIMER_CLK 8000000 /* 8Mhz */
-#define COUNTER_FREQUENCY CONFIG_SC_TIMER_CLK
#define CONFIG_SYS_BOOTM_LEN 0x1000000
diff --git a/include/configs/owl-common.h b/include/configs/owl-common.h
index 96453214ee..fabbb01e0c 100644
--- a/include/configs/owl-common.h
+++ b/include/configs/owl-common.h
@@ -13,9 +13,6 @@
/* SDRAM Definitions */
#define CONFIG_SYS_SDRAM_BASE 0x0
-/* Generic Timer Definitions */
-#define COUNTER_FREQUENCY (24000000) /* 24MHz */
-
/* Some commands use this as the default load address */
/*
diff --git a/include/configs/p2371-2180.h b/include/configs/p2371-2180.h
index ef1fa2a592..7f942888e7 100644
--- a/include/configs/p2371-2180.h
+++ b/include/configs/p2371-2180.h
@@ -24,7 +24,4 @@
#include "tegra-common-post.h"
-/* Crystal is 38.4MHz. clk_m runs at half that rate */
-#define COUNTER_FREQUENCY 19200000
-
#endif /* _P2371_2180_H */
diff --git a/include/configs/p2771-0000.h b/include/configs/p2771-0000.h
index 4c3da224c6..84cdd57196 100644
--- a/include/configs/p2771-0000.h
+++ b/include/configs/p2771-0000.h
@@ -37,7 +37,4 @@
#include "tegra-common-post.h"
-/* Crystal is 38.4MHz. clk_m runs at half that rate */
-#define COUNTER_FREQUENCY 19200000
-
#endif
diff --git a/include/configs/p3450-0000.h b/include/configs/p3450-0000.h
index 1c962be8b8..ec1a8634e7 100644
--- a/include/configs/p3450-0000.h
+++ b/include/configs/p3450-0000.h
@@ -35,7 +35,4 @@
/* General networking support */
#include "tegra-common-post.h"
-/* Crystal is 38.4MHz. clk_m runs at half that rate */
-#define COUNTER_FREQUENCY 19200000
-
#endif /* _P3450_0000_H */
diff --git a/include/configs/presidio_asic.h b/include/configs/presidio_asic.h
index 3295d43ed6..1d526a7380 100644
--- a/include/configs/presidio_asic.h
+++ b/include/configs/presidio_asic.h
@@ -12,8 +12,7 @@
#define CONFIG_SYS_BOOTM_LEN 0x00c00000
/* Generic Timer Definitions */
-#define COUNTER_FREQUENCY 25000000
-#define CONFIG_SYS_TIMER_RATE COUNTER_FREQUENCY
+#define CONFIG_SYS_TIMER_RATE 25000000
#define CONFIG_SYS_TIMER_COUNTER 0xf4321008
/* note: arch/arm/cpu/armv8/start.S which references GICD_BASE/GICC_BASE
diff --git a/include/configs/px30_common.h b/include/configs/px30_common.h
index dc609013f3..a7f5e91165 100644
--- a/include/configs/px30_common.h
+++ b/include/configs/px30_common.h
@@ -12,8 +12,6 @@
#define CONFIG_SYS_NS16550_MEM32
-#define COUNTER_FREQUENCY 24000000
-
/* FIXME: ff020000 is pmu_mem (10k), while ff0e0000 is regular int_mem */
#define CONFIG_IRAM_BASE 0xff020000
diff --git a/include/configs/rk3036_common.h b/include/configs/rk3036_common.h
index 5905518edf..ab2b492d03 100644
--- a/include/configs/rk3036_common.h
+++ b/include/configs/rk3036_common.h
@@ -10,7 +10,6 @@
#define CONFIG_SYS_CBSIZE 1024
-#define COUNTER_FREQUENCY 24000000
#define CONFIG_SYS_HZ_CLOCK 24000000
#define CONFIG_SYS_INIT_SP_ADDR 0x60100000
diff --git a/include/configs/rk3128_common.h b/include/configs/rk3128_common.h
index d77a7d7b09..8f04e9de5a 100644
--- a/include/configs/rk3128_common.h
+++ b/include/configs/rk3128_common.h
@@ -11,7 +11,6 @@
#define CONFIG_SYS_MAXARGS 16
#define CONFIG_SYS_CBSIZE 1024
-#define COUNTER_FREQUENCY 24000000
#define CONFIG_SYS_HZ_CLOCK 24000000
#define CONFIG_IRAM_BASE 0x10080000
diff --git a/include/configs/rk322x_common.h b/include/configs/rk322x_common.h
index 3258820fcd..36191ee9c1 100644
--- a/include/configs/rk322x_common.h
+++ b/include/configs/rk322x_common.h
@@ -11,7 +11,6 @@
#define CONFIG_SYS_CBSIZE 1024
#define CONFIG_SYS_BOOTM_LEN (64 << 20) /* 64M */
-#define COUNTER_FREQUENCY 24000000
#define CONFIG_SYS_HZ_CLOCK 24000000
#define CONFIG_SYS_INIT_SP_ADDR 0x61100000
diff --git a/include/configs/rk3288_common.h b/include/configs/rk3288_common.h
index e2e0f70a70..075623f342 100644
--- a/include/configs/rk3288_common.h
+++ b/include/configs/rk3288_common.h
@@ -13,7 +13,6 @@
#define CONFIG_SYS_CBSIZE 1024
-#define COUNTER_FREQUENCY 24000000
#define CONFIG_SYS_HZ_CLOCK 24000000
#ifdef CONFIG_SPL_ROCKCHIP_BACK_TO_BROM
diff --git a/include/configs/rk3308_common.h b/include/configs/rk3308_common.h
index 9cda8d9c48..44a3e7adf2 100644
--- a/include/configs/rk3308_common.h
+++ b/include/configs/rk3308_common.h
@@ -20,7 +20,6 @@
#define CONFIG_SPL_STACK 0x00400000
#define CONFIG_SYS_BOOTM_LEN (64 << 20) /* 64M */
-#define COUNTER_FREQUENCY 24000000
#define CONFIG_SYS_BOOTM_LEN (64 << 20) /* 64M */
diff --git a/include/configs/rk3328_common.h b/include/configs/rk3328_common.h
index 8a5f0c8999..2b8d77c47e 100644
--- a/include/configs/rk3328_common.h
+++ b/include/configs/rk3328_common.h
@@ -10,8 +10,6 @@
#define CONFIG_IRAM_BASE 0xff090000
-#define COUNTER_FREQUENCY 24000000
-
#define CONFIG_SYS_CBSIZE 1024
#define CONFIG_SYS_INIT_SP_ADDR 0x00300000
diff --git a/include/configs/rk3368_common.h b/include/configs/rk3368_common.h
index 239296c1d2..2f71ce72df 100644
--- a/include/configs/rk3368_common.h
+++ b/include/configs/rk3368_common.h
@@ -15,8 +15,6 @@
#define SDRAM_MAX_SIZE 0xff000000
#define CONFIG_SYS_CBSIZE 1024
-#define COUNTER_FREQUENCY 24000000
-
#define CONFIG_IRAM_BASE 0xff8c0000
#define CONFIG_SYS_INIT_SP_ADDR 0x00300000
diff --git a/include/configs/rk3399_common.h b/include/configs/rk3399_common.h
index 4037dba58c..8e13737666 100644
--- a/include/configs/rk3399_common.h
+++ b/include/configs/rk3399_common.h
@@ -10,8 +10,6 @@
#define CONFIG_SYS_CBSIZE 1024
-#define COUNTER_FREQUENCY 24000000
-
#define CONFIG_IRAM_BASE 0xff8c0000
#define CONFIG_SYS_INIT_SP_ADDR 0x00300000
diff --git a/include/configs/rk3568_common.h b/include/configs/rk3568_common.h
index 5649cd64e0..e9947ea492 100644
--- a/include/configs/rk3568_common.h
+++ b/include/configs/rk3568_common.h
@@ -10,8 +10,6 @@
#define CONFIG_SYS_CBSIZE 1024
-#define COUNTER_FREQUENCY 24000000
-
#define CONFIG_IRAM_BASE 0xfdcc0000
#define CONFIG_SYS_INIT_SP_ADDR 0x00c00000
diff --git a/include/configs/salvator-x.h b/include/configs/salvator-x.h
index 764bc1bbf2..eb00e2b004 100644
--- a/include/configs/salvator-x.h
+++ b/include/configs/salvator-x.h
@@ -11,9 +11,6 @@
#include "rcar-gen3-common.h"
-/* Generic Timer Definitions (use in assembler source) */
-#define COUNTER_FREQUENCY 0xFE502A /* 16.66MHz from CPclk */
-
/* Environment in eMMC, at the end of 2nd "boot sector" */
#define CONFIG_FLASH_SHOW_PROGRESS 45
diff --git a/include/configs/sdm845.h b/include/configs/sdm845.h
index ba57323c74..835f05d63e 100644
--- a/include/configs/sdm845.h
+++ b/include/configs/sdm845.h
@@ -13,9 +13,6 @@
#define CONFIG_SYS_BAUDRATE_TABLE { 115200, 230400, 460800, 921600 }
-/* Generic Timer Definitions */
-#define COUNTER_FREQUENCY 19000000
-
#define CONFIG_EXTRA_ENV_SETTINGS \
"bootm_size=0x4000000\0" \
"bootm_low=0x80000000\0" \
diff --git a/include/configs/silinux-ek874.h b/include/configs/silinux-ek874.h
index a99babb48b..346858c456 100644
--- a/include/configs/silinux-ek874.h
+++ b/include/configs/silinux-ek874.h
@@ -11,7 +11,4 @@
#include "rcar-gen3-common.h"
-/* Generic Timer Definitions (use in assembler source) */
-#define COUNTER_FREQUENCY 0xFE502A /* 16.66MHz from CPclk */
-
#endif /* __SILINUX_EK874_H */
diff --git a/include/configs/socfpga_soc64_common.h b/include/configs/socfpga_soc64_common.h
index c288d548f5..3447b8f17c 100644
--- a/include/configs/socfpga_soc64_common.h
+++ b/include/configs/socfpga_soc64_common.h
@@ -109,11 +109,6 @@
#define CONFIG_SYS_NS16550_MEM32
/*
- * Timer & watchdog configurations
- */
-#define COUNTER_FREQUENCY 400000000
-
-/*
* SDMMC configurations
*/
#ifdef CONFIG_CMD_MMC
diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index a9031035d7..068340aa96 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -38,7 +38,6 @@
#endif
/* CPU */
-#define COUNTER_FREQUENCY 24000000
/*
* The DRAM Base differs between some models. We cannot use macros for the
diff --git a/include/configs/ten64.h b/include/configs/ten64.h
index f82b1e0d21..04772c9e4e 100644
--- a/include/configs/ten64.h
+++ b/include/configs/ten64.h
@@ -9,7 +9,6 @@
#include "ls1088a_common.h"
-#define COUNTER_FREQUENCY 25000000 /* 25MHz */
#define CONFIG_SYS_LS_MC_BOOT_TIMEOUT_MS 5000
diff --git a/include/configs/thunderx_88xx.h b/include/configs/thunderx_88xx.h
index d07a8fe86b..3537ba30e1 100644
--- a/include/configs/thunderx_88xx.h
+++ b/include/configs/thunderx_88xx.h
@@ -20,9 +20,6 @@
/* SMP Spin Table Definitions */
#define CPU_RELEASE_ADDR (CONFIG_SYS_SDRAM_BASE + 0x7fff0)
-/* Generic Timer Definitions */
-#define COUNTER_FREQUENCY (0x1800000) /* 24MHz */
-
/* PL011 Serial Configuration */
#define CONFIG_PL011_CLOCK 24000000
diff --git a/include/configs/ulcb.h b/include/configs/ulcb.h
index c991bff0e8..14ea40bee3 100644
--- a/include/configs/ulcb.h
+++ b/include/configs/ulcb.h
@@ -11,9 +11,6 @@
#include "rcar-gen3-common.h"
-/* Generic Timer Definitions (use in assembler source) */
-#define COUNTER_FREQUENCY 0xFE502A /* 16.66MHz from CPclk */
-
/* Environment in eMMC, at the end of 2nd "boot sector" */
#define CONFIG_FLASH_SHOW_PROGRESS 45
diff --git a/include/configs/vexpress_aemv8.h b/include/configs/vexpress_aemv8.h
index 4f0ff239e6..0632b367ca 100644
--- a/include/configs/vexpress_aemv8.h
+++ b/include/configs/vexpress_aemv8.h
@@ -73,9 +73,6 @@
#define V2M_SYS_CFGCTRL (V2M_SYSREGS + 0x0a4)
#define V2M_SYS_CFGSTAT (V2M_SYSREGS + 0x0a8)
-/* Generic Timer Definitions */
-#define COUNTER_FREQUENCY 24000000 /* 24MHz */
-
/* Generic Interrupt Controller Definitions */
#ifdef CONFIG_GICV3
#define GICD_BASE (V2M_PA_BASE + 0x2f000000)
diff --git a/include/configs/xilinx_versal.h b/include/configs/xilinx_versal.h
index b025d2638d..b78c242948 100644
--- a/include/configs/xilinx_versal.h
+++ b/include/configs/xilinx_versal.h
@@ -16,11 +16,6 @@
#define CONFIG_SYS_INIT_SP_ADDR CONFIG_SYS_TEXT_BASE
-/* Generic Timer Definitions - setup in EL3. Setup by ATF for other cases */
-#if CONFIG_COUNTER_FREQUENCY
-# define COUNTER_FREQUENCY CONFIG_COUNTER_FREQUENCY
-#endif
-
/* Serial setup */
#define CONFIG_SYS_BAUDRATE_TABLE \
{ 4800, 9600, 19200, 38400, 57600, 115200 }
diff --git a/include/configs/xilinx_zynqmp.h b/include/configs/xilinx_zynqmp.h
index e5e700d804..8eb44b18d2 100644
--- a/include/configs/xilinx_zynqmp.h
+++ b/include/configs/xilinx_zynqmp.h
@@ -16,11 +16,6 @@
#define CONFIG_SYS_INIT_SP_ADDR CONFIG_SYS_TEXT_BASE
-/* Generic Timer Definitions - setup in EL3. Setup by ATF for other cases */
-#if !defined(COUNTER_FREQUENCY)
-# define COUNTER_FREQUENCY 100000000
-#endif
-
/* Serial setup */
#define CONFIG_SYS_BAUDRATE_TABLE \
{ 4800, 9600, 19200, 38400, 57600, 115200 }
diff --git a/fs/ubifs/crc16.h b/include/linux/crc16.h
index 052fd3311a..052fd3311a 100644
--- a/fs/ubifs/crc16.h
+++ b/include/linux/crc16.h
diff --git a/include/u-boot/crc.h b/include/u-boot/crc.h
index 52ec6a9e2d..5174bd7ac4 100644
--- a/include/u-boot/crc.h
+++ b/include/u-boot/crc.h
@@ -25,7 +25,10 @@
*/
unsigned int crc8(unsigned int crc_start, const unsigned char *vptr, int len);
-/* lib/crc16.c - 16 bit CRC with polynomial x^16+x^12+x^5+1 (CRC-CCITT) */
+/* lib/crc16.c - 16 bit CRC with polynomial x^16 + x^15 + x^2 + 1 */
+uint16_t crc16(uint16_t crc, const unsigned char *buffer, size_t len);
+
+/* lib/crc16-ccitt.c - 16 bit CRC with polynomial x^16+x^12+x^5+1 (CRC-CCITT) */
uint16_t crc16_ccitt(uint16_t crc_start, const unsigned char *s, int len);
/**
* crc16_ccitt_wd_buf - Perform CRC16-CCIT on an input buffer and return the
diff --git a/lib/Makefile b/lib/Makefile
index 13fe5fb7a4..d9b1811f75 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -36,6 +36,7 @@ endif
obj-y += crc8.o
obj-y += crc16.o
+obj-y += crc16-ccitt.o
obj-$(CONFIG_ERRNO_STR) += errno_str.o
obj-$(CONFIG_FIT) += fdtdec_common.o
obj-$(CONFIG_TEST_FDTDEC) += fdtdec_test.o
@@ -91,9 +92,9 @@ obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT) += libfdt/
obj-$(CONFIG_$(SPL_TPL_)OF_REAL) += fdtdec_common.o fdtdec.o
ifdef CONFIG_SPL_BUILD
-obj-$(CONFIG_SPL_YMODEM_SUPPORT) += crc16.o
-obj-$(CONFIG_$(SPL_TPL_)HASH) += crc16.o
-obj-$(CONFIG_MMC_SPI_CRC_ON) += crc16.o
+obj-$(CONFIG_SPL_YMODEM_SUPPORT) += crc16-ccitt.o
+obj-$(CONFIG_$(SPL_TPL_)HASH) += crc16-ccitt.o
+obj-$(CONFIG_MMC_SPI_CRC_ON) += crc16-ccitt.o
obj-y += net_utils.o
endif
obj-$(CONFIG_ADDR_MAP) += addr_map.o
diff --git a/lib/crc16-ccitt.c b/lib/crc16-ccitt.c
new file mode 100644
index 0000000000..6cadbc103d
--- /dev/null
+++ b/lib/crc16-ccitt.c
@@ -0,0 +1,84 @@
+// SPDX-License-Identifier: eCos-2.0
+/*
+ *==========================================================================
+ *
+ * crc16-ccitt.c
+ *
+ * 16 bit CRC with polynomial x^16+x^12+x^5+1
+ *
+ *==========================================================================
+ *#####DESCRIPTIONBEGIN####
+ *
+ * Author(s): gthomas
+ * Contributors: gthomas,asl
+ * Date: 2001-01-31
+ * Purpose:
+ * Description:
+ *
+ * This code is part of eCos (tm).
+ *
+ *####DESCRIPTIONEND####
+ *
+ *==========================================================================
+ */
+
+#ifdef USE_HOSTCC
+#include <arpa/inet.h>
+#else
+#include <common.h>
+#endif
+#include <u-boot/crc.h>
+
+/* Table of CRC constants - implements x^16+x^12+x^5+1 */
+static const uint16_t crc16_tab[] = {
+ 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7,
+ 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef,
+ 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6,
+ 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de,
+ 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485,
+ 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d,
+ 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4,
+ 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc,
+ 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823,
+ 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b,
+ 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12,
+ 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a,
+ 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41,
+ 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49,
+ 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70,
+ 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78,
+ 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f,
+ 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067,
+ 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e,
+ 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256,
+ 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d,
+ 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
+ 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c,
+ 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634,
+ 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab,
+ 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3,
+ 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a,
+ 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92,
+ 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9,
+ 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1,
+ 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8,
+ 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0,
+};
+
+uint16_t crc16_ccitt(uint16_t cksum, const unsigned char *buf, int len)
+{
+ for (int i = 0; i < len; i++)
+ cksum = crc16_tab[((cksum>>8) ^ *buf++) & 0xff] ^ (cksum << 8);
+
+ return cksum;
+}
+
+void crc16_ccitt_wd_buf(const uint8_t *in, uint len,
+ uint8_t *out, uint chunk_sz)
+{
+ uint16_t crc;
+
+ crc = crc16_ccitt(0, in, len);
+ crc = htons(crc);
+ memcpy(out, &crc, sizeof(crc));
+}
diff --git a/lib/crc16.c b/lib/crc16.c
index f46ba727c9..7cf33fc7eb 100644
--- a/lib/crc16.c
+++ b/lib/crc16.c
@@ -1,84 +1,60 @@
-// SPDX-License-Identifier: eCos-2.0
/*
- *==========================================================================
- *
* crc16.c
*
- * 16 bit CRC with polynomial x^16+x^12+x^5+1
- *
- *==========================================================================
- *#####DESCRIPTIONBEGIN####
- *
- * Author(s): gthomas
- * Contributors: gthomas,asl
- * Date: 2001-01-31
- * Purpose:
- * Description:
- *
- * This code is part of eCos (tm).
- *
- *####DESCRIPTIONEND####
- *
- *==========================================================================
+ * This source code is licensed under the GNU General Public License,
+ * Version 2. See the file COPYING for more details.
*/
-#ifdef USE_HOSTCC
-#include <arpa/inet.h>
-#else
-#include <common.h>
-#endif
-#include <u-boot/crc.h>
+#include <linux/types.h>
+#include <linux/crc16.h>
-/* Table of CRC constants - implements x^16+x^12+x^5+1 */
-static const uint16_t crc16_tab[] = {
- 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7,
- 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef,
- 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6,
- 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de,
- 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485,
- 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d,
- 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4,
- 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc,
- 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823,
- 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b,
- 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12,
- 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a,
- 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41,
- 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49,
- 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70,
- 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78,
- 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f,
- 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067,
- 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e,
- 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256,
- 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d,
- 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
- 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c,
- 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634,
- 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab,
- 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3,
- 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a,
- 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92,
- 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9,
- 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1,
- 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8,
- 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0,
+/** CRC table for the CRC-16. The poly is 0x8005 (x^16 + x^15 + x^2 + 1) */
+u16 const crc16_table[256] = {
+ 0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241,
+ 0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440,
+ 0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40,
+ 0x0A00, 0xCAC1, 0xCB81, 0x0B40, 0xC901, 0x09C0, 0x0880, 0xC841,
+ 0xD801, 0x18C0, 0x1980, 0xD941, 0x1B00, 0xDBC1, 0xDA81, 0x1A40,
+ 0x1E00, 0xDEC1, 0xDF81, 0x1F40, 0xDD01, 0x1DC0, 0x1C80, 0xDC41,
+ 0x1400, 0xD4C1, 0xD581, 0x1540, 0xD701, 0x17C0, 0x1680, 0xD641,
+ 0xD201, 0x12C0, 0x1380, 0xD341, 0x1100, 0xD1C1, 0xD081, 0x1040,
+ 0xF001, 0x30C0, 0x3180, 0xF141, 0x3300, 0xF3C1, 0xF281, 0x3240,
+ 0x3600, 0xF6C1, 0xF781, 0x3740, 0xF501, 0x35C0, 0x3480, 0xF441,
+ 0x3C00, 0xFCC1, 0xFD81, 0x3D40, 0xFF01, 0x3FC0, 0x3E80, 0xFE41,
+ 0xFA01, 0x3AC0, 0x3B80, 0xFB41, 0x3900, 0xF9C1, 0xF881, 0x3840,
+ 0x2800, 0xE8C1, 0xE981, 0x2940, 0xEB01, 0x2BC0, 0x2A80, 0xEA41,
+ 0xEE01, 0x2EC0, 0x2F80, 0xEF41, 0x2D00, 0xEDC1, 0xEC81, 0x2C40,
+ 0xE401, 0x24C0, 0x2580, 0xE541, 0x2700, 0xE7C1, 0xE681, 0x2640,
+ 0x2200, 0xE2C1, 0xE381, 0x2340, 0xE101, 0x21C0, 0x2080, 0xE041,
+ 0xA001, 0x60C0, 0x6180, 0xA141, 0x6300, 0xA3C1, 0xA281, 0x6240,
+ 0x6600, 0xA6C1, 0xA781, 0x6740, 0xA501, 0x65C0, 0x6480, 0xA441,
+ 0x6C00, 0xACC1, 0xAD81, 0x6D40, 0xAF01, 0x6FC0, 0x6E80, 0xAE41,
+ 0xAA01, 0x6AC0, 0x6B80, 0xAB41, 0x6900, 0xA9C1, 0xA881, 0x6840,
+ 0x7800, 0xB8C1, 0xB981, 0x7940, 0xBB01, 0x7BC0, 0x7A80, 0xBA41,
+ 0xBE01, 0x7EC0, 0x7F80, 0xBF41, 0x7D00, 0xBDC1, 0xBC81, 0x7C40,
+ 0xB401, 0x74C0, 0x7580, 0xB541, 0x7700, 0xB7C1, 0xB681, 0x7640,
+ 0x7200, 0xB2C1, 0xB381, 0x7340, 0xB101, 0x71C0, 0x7080, 0xB041,
+ 0x5000, 0x90C1, 0x9181, 0x5140, 0x9301, 0x53C0, 0x5280, 0x9241,
+ 0x9601, 0x56C0, 0x5780, 0x9741, 0x5500, 0x95C1, 0x9481, 0x5440,
+ 0x9C01, 0x5CC0, 0x5D80, 0x9D41, 0x5F00, 0x9FC1, 0x9E81, 0x5E40,
+ 0x5A00, 0x9AC1, 0x9B81, 0x5B40, 0x9901, 0x59C0, 0x5880, 0x9841,
+ 0x8801, 0x48C0, 0x4980, 0x8941, 0x4B00, 0x8BC1, 0x8A81, 0x4A40,
+ 0x4E00, 0x8EC1, 0x8F81, 0x4F40, 0x8D01, 0x4DC0, 0x4C80, 0x8C41,
+ 0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641,
+ 0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040
};
-uint16_t crc16_ccitt(uint16_t cksum, const unsigned char *buf, int len)
-{
- for (int i = 0; i < len; i++)
- cksum = crc16_tab[((cksum>>8) ^ *buf++) & 0xff] ^ (cksum << 8);
-
- return cksum;
-}
-
-void crc16_ccitt_wd_buf(const uint8_t *in, uint len,
- uint8_t *out, uint chunk_sz)
+/**
+ * crc16 - compute the CRC-16 for the data buffer
+ * @crc: previous CRC value
+ * @buffer: data pointer
+ * @len: number of bytes in the buffer
+ *
+ * Returns the updated CRC value.
+ */
+u16 crc16(u16 crc, u8 const *buffer, size_t len)
{
- uint16_t crc;
-
- crc = crc16_ccitt(0, in, len);
- crc = htons(crc);
- memcpy(out, &crc, sizeof(crc));
+ while (len--)
+ crc = crc16_byte(crc, *buffer++);
+ return crc;
}
diff --git a/tools/Makefile b/tools/Makefile
index e17271be8b..9f2339666a 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -132,7 +132,7 @@ dumpimage-mkimage-objs := aisimage.o \
$(ROCKCHIP_OBS) \
socfpgaimage.o \
sunxi_egon.o \
- lib/crc16.o \
+ lib/crc16-ccitt.o \
lib/hash-checksum.o \
lib/sha1.o \
lib/sha256.o \