public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] [PATCH 2/8] SPARC: SPARC cfi-flash support for 64-bit reads
@ 2008-03-13  9:38 Daniel Hellstrom
  2008-03-13 12:04 ` Wolfgang Denk
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Hellstrom @ 2008-03-13  9:38 UTC (permalink / raw)
  To: u-boot

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 spcific and can be found by including <asm/processor.h>.

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

Best Regards,
Daniel Hellstrom


 drivers/mtd/cfi_flash.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)


diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 439c950..6fc6bc4 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -241,8 +241,12 @@ static u32 flash_read32(void *addr)
 
 static u64 flash_read64(void *addr)
 {
+#ifdef CONFIG_SPARC
+    return __raw_readq(addr);
+#else
     /* No architectures currently implement __raw_readq() */
     return *(volatile u64 *)addr;
+#endif
 }
 
 /*-----------------------------------------------------------------------

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot-Users] [PATCH 2/8] SPARC: SPARC cfi-flash support for 64-bit reads
  2008-03-13  9:38 [U-Boot-Users] [PATCH 2/8] SPARC: SPARC cfi-flash support for 64-bit reads Daniel Hellstrom
@ 2008-03-13 12:04 ` Wolfgang Denk
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Denk @ 2008-03-13 12:04 UTC (permalink / raw)
  To: u-boot

In message <47D8F62A.2000108@gaisler.com> you wrote:
> 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 spcific and can be found by including <asm/processor.h>.
> 
> SPARC has implemented __raw_readq, it reads 64-bit from any 32-bit address.
> 
> Best Regards,
> Daniel Hellstrom
> 
> 
>  drivers/mtd/cfi_flash.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> 
> diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
> index 439c950..6fc6bc4 100644
> --- a/drivers/mtd/cfi_flash.c
> +++ b/drivers/mtd/cfi_flash.c
> @@ -241,8 +241,12 @@ static u32 flash_read32(void *addr)
>  
>  static u64 flash_read64(void *addr)
>  {
> +#ifdef CONFIG_SPARC
> +    return __raw_readq(addr);
> +#else
>      /* No architectures currently implement __raw_readq() */
>      return *(volatile u64 *)addr;
> +#endif
>  }

Instead of #ifdef'fing this code,  you  should  implement  a  private
(SPARC  specific)  version  of  flash_read64()  and probably make the
existing  one  "weak"  so  it  can  be  overwritten  by  such  custom
definitions.

Best regards,

Wolfgang Denk

-- 
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
If I can have honesty, it's easier to overlook mistakes.
	-- Kirk, "Space Seed", stardate 3141.9

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-03-13 12:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-13  9:38 [U-Boot-Users] [PATCH 2/8] SPARC: SPARC cfi-flash support for 64-bit reads Daniel Hellstrom
2008-03-13 12:04 ` Wolfgang Denk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox