Skip to contentSkip to conversation

SPARC: CFI flash_read64 defined weak function.

PATCH New Daniel Hellstrom 2 participants 2 messages Mar 28, 2008 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 SPARC: CFI flash_read64 defined weak function.

Hello Wolfgang and Stefan,

This is a patch which defines flash_read64 weak in cfi_flash.c, cpu/leon3/cpu_init.c
defines this function for SPARC.

SPARC has implemented __raw_readq, it reads 64-bit from any 32-bit address.

For current SPARC architectures (LEON2 and LEON3) each read from the FLASH must lead to a cache miss. This is because FLASH can not be set non-cacheable since program code resides there, and alternatively disabling cache is poor from performance view, or doing a cache flush between each read is even poorer.

Forcing a cache miss on a SPARC is done by a special instruction "lda" - load alternative space, the alternative space number (ASI) is processor implementation specific and can be found in <asm-sparc/asi.h>.

This patch is also available at
ftp://ftp.gaisler.com/gaisler.com/uboot/patches.

Best Regards,
Daniel Hellstrom

 drivers/mtd/cfi_flash.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/mtd/cfi_flash.c +0 -0
diff --cc drivers/mtd/cfi_flash.c
index f04c72d,f04c72d..a55afc9
@@@ -239,12 -239,12 +239,14 @@@ static u32 flash_read32(void *addr
      return __raw_readl(addr);
  }
 
--static u64 flash_read64(void *addr)
++static u64 __flash_read64(void *addr)
  {
      /* No architectures currently implement __raw_readq() */
      return *(volatile u64 *)addr;
  }
 
++u64 flash_read64(void *addr)__attribute__((weak, 

alias("__flash_read64")));
++
/*-----------------------------------------------------------------------
*/
#if defined(CFG_ENV_IS_IN_FLASH) || defined(CFG_ENV_ADDR_REDUND) ||
(CFG_MONITOR_BASE >= CFG_FLASH_BASE)

#1 lore raw

PATCH 1/1 SPARC: CFI flash_read64 defined weak function.

Quoted 5 lines · In message <[email protected]> you wrote:

This is a patch which defines flash_read64 weak in cfi_flash.c, cpu/leon3/cpu_init.c
defines this function for SPARC.

Sorry, patch unusable...

Quoted 2 lines

++u64 flash_read64(void *addr)__attribute__((weak, alias("__flash_read64")));

^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Line-wrapped again.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The following statement is not true.  The previous statement is true.