public inbox for ecos-patches@sourceware.org
 help / color / mirror / Atom feed
From: Edgar Grimberg <edgar.grimberg@zylin.com>
To: ecos-patches@ecos.sourceware.org
Subject: IO FLASH and caches
Date: Fri, 16 Oct 2009 07:41:00 -0000	[thread overview]
Message-ID: <d0f570ed0910160041h43d8a621ubb138f2cc98f9cd6@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 305 bytes --]

Hi,

The attached patch handles the case where the CPU cannot disable
caches and needs to provide an uncached address instead. The fix was
tested with a NIOS2 CPU.

Regards,
Edgar

-- 
Edgar Grimberg
System Developer
Zylin AS
ZY1000 JTAG Debugger http://www.zylin.com/zy1000.html
Phone: (+47) 51 63 25 00

[-- Attachment #2: io_flash_patch.txt --]
[-- Type: text/plain, Size: 1875 bytes --]

Index: current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/flash/current/ChangeLog,v
retrieving revision 1.53
diff -u -r1.53 ChangeLog
--- current/ChangeLog	1 Jul 2009 18:52:09 -0000	1.53
+++ current/ChangeLog	16 Oct 2009 07:36:48 -0000
@@ -1,3 +1,8 @@
+2009-10-16  Edgar Grimberg <edgar.grimberg@zylin.com>
+
+	* src/flash.c: Handles the case where the CPU cannot disable caches and needs 
+	to provide an uncached address instead
+
 2009-03-02  Sergei Gavrikov  <sergei.gavrikov@gmail.com>
 
 	* doc/flash.sgml: Fixed typos in a FLASH API listing.
Index: current/src/flash.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/flash/current/src/flash.c,v
retrieving revision 1.32
diff -u -r1.32 flash.c
--- current/src/flash.c	20 Feb 2009 22:06:15 -0000	1.32
+++ current/src/flash.c	16 Oct 2009 07:36:48 -0000
@@ -106,6 +106,12 @@
 #define CHECK_SOFT_WRITE_PROTECT(_addr_, _len_) CYG_EMPTY_STATEMENT
 #endif
 
+#ifdef CYGARC_UNCACHED_ADDRESS
+#	define UNCACHED_ADDRESS(_x_) CYGARC_UNCACHED_ADDRESS(_x_)
+#else
+#	define UNCACHED_ADDRESS(_x_) _x_
+#endif
+
 // Has the FLASH IO library been initialised?
 static bool init;
 
@@ -622,10 +628,14 @@
     stat = dev->funs->flash_program(dev, addr, ram, this_write);
 #ifdef CYGSEM_IO_FLASH_VERIFY_PROGRAM
     if (CYG_FLASH_ERR_OK == stat) // Claims to be OK
-      if (!dev->funs->flash_read && memcmp((void *)addr, ram, this_write) != 0) {                
+    {
+	 cyg_flashaddr_t unchached_addr;
+	 unchached_addr = UNCACHED_ADDRESS(addr);
+      if (!dev->funs->flash_read && memcmp((volatile void *)unchached_addr, ram, this_write) != 0) {
         stat = CYG_FLASH_ERR_DRV_VERIFY;
         CHATTER(dev, "V");
       }
+    }
 #endif
     if (CYG_FLASH_ERR_OK != stat) {
         if (err_address)

             reply	other threads:[~2009-10-16  7:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-16  7:41 Edgar Grimberg [this message]
2009-10-16 11:04 ` Nick Garnett
2009-10-16 12:30   ` Edgar Grimberg
2009-10-16 12:58     ` Nick Garnett
2009-10-16 13:23       ` Edgar Grimberg
2009-10-16 13:15     ` Bart Veer
2009-10-16 13:37       ` Edgar Grimberg
2009-10-16 14:41         ` Bart Veer
2009-10-16 14:57           ` Edgar Grimberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d0f570ed0910160041h43d8a621ubb138f2cc98f9cd6@mail.gmail.com \
    --to=edgar.grimberg@zylin.com \
    --cc=ecos-patches@ecos.sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).