This is an automated email from the ASF dual-hosted git repository.

GUIDINGLI pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 658b07c24e0c886bcf97ad262f6329d733d62910
Author: makejian <[email protected]>
AuthorDate: Mon Nov 23 16:38:17 2026 +0800

    arch/tricore: fix the PCON2/DCON2 cache size unit
    
    PCON2/DCON2 report the I-/D-cache size in KB (TC4Dx UM 5.3.4.2), not in 
units of 1000 bytes. up_get_icache_size()/up_get_dcache_size() multiplied the 
register field by 1000, understating the size by ~2.4% and making 
up_clean/flush_dcache_all() walk too few lines. Multiply by 1024 instead.
    
    Signed-off-by: makejian <[email protected]>
---
 arch/tricore/src/common/tricore_cache.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/tricore/src/common/tricore_cache.c 
b/arch/tricore/src/common/tricore_cache.c
index c4be92bbba0..7491c403ce0 100644
--- a/arch/tricore/src/common/tricore_cache.c
+++ b/arch/tricore/src/common/tricore_cache.c
@@ -50,7 +50,7 @@
 #define PCON1_INVALIDATE (1 << 0)
 #define DCON1_INVALIDATE (1 << 0)
 
-/* PCON2/DCON2 bits 15:0: cache size field. */
+/* PCON2/DCON2 bits 15:0: cache size in KB. */
 
 #define ICACHE_SIZE_MASK (0xffff << 0)
 #define DCACHE_SIZE_MASK (0xffff << 0)
@@ -110,7 +110,7 @@ size_t up_get_icache_linesize(void)
 
 size_t up_get_icache_size(void)
 {
-  return (tricore_mfcr(TRICORE_CPU_PCON2) & ICACHE_SIZE_MASK) * 1000;
+  return (tricore_mfcr(TRICORE_CPU_PCON2) & ICACHE_SIZE_MASK) * 1024;
 }
 
 /****************************************************************************
@@ -236,7 +236,7 @@ size_t up_get_dcache_linesize(void)
 
 size_t up_get_dcache_size(void)
 {
-  return (tricore_mfcr(TRICORE_CPU_DCON2) & DCACHE_SIZE_MASK) * 1000;
+  return (tricore_mfcr(TRICORE_CPU_DCON2) & DCACHE_SIZE_MASK) * 1024;
 }
 
 /****************************************************************************

Reply via email to