public inbox for ecos-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug 1000825] New: No SPI transaction for Atmel Dataflash cyg_dataflash_release
@ 2009-09-23  9:52 bugzilla-daemon
  2009-09-23 14:27 ` [Bug 1000825] " bugzilla-daemon
  0 siblings, 1 reply; 2+ messages in thread
From: bugzilla-daemon @ 2009-09-23  9:52 UTC (permalink / raw)
  To: ecos-bugs

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1000825

           Summary: No SPI transaction for Atmel Dataflash
                    cyg_dataflash_release
           Product: eCos
           Version: CVS
          Platform: Other (please specify)
        OS/Version: ARM
            Status: UNCONFIRMED
          Severity: normal
          Priority: normal
         Component: Flash
        AssignedTo: gary@mlbassoc.com
        ReportedBy: stano@meduna.org
         QAContact: ecos-bugs@ecos.sourceware.org
             Class: ---


In the devs/flash/atmel/dataflash/current/src/devs_flash_atmel_dataflash.c
there is a transaction guard missing around df_wait_ready in
cyg_dataflash_release. This results in bad things if the bus is shared with
another device.

 cyg_dataflash_release(cyg_dataflash_device_t *dev)
 {
     int err;
+    cyg_spi_device *spi_dev = dev->spi_dev;

+    cyg_spi_transaction_begin(spi_dev);
     err = df_wait_ready(dev); 
+    cyg_spi_transaction_end(spi_dev);

     cyg_drv_mutex_unlock(&dev->lock);


-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


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

* [Bug 1000825] No SPI transaction for Atmel Dataflash cyg_dataflash_release
  2009-09-23  9:52 [Bug 1000825] New: No SPI transaction for Atmel Dataflash cyg_dataflash_release bugzilla-daemon
@ 2009-09-23 14:27 ` bugzilla-daemon
  0 siblings, 0 replies; 2+ messages in thread
From: bugzilla-daemon @ 2009-09-23 14:27 UTC (permalink / raw)
  To: ecos-bugs

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1000825





--- Comment #1 from Stanislav Meduna <stano@meduna.org>  2009-09-23 15:27:40 ---
I have also changed the df_wait_ready_buf, as I can't afford to have the bus
locked while waiting for the program/erase operation to complete (the other
device on the bus needs to be serviced in much shorter time).

I am not quite sure whether the following is correct (needs also the original
patch), but I'm including it anyway:

 df_wait_ready_buf(cyg_dataflash_device_t *dev, cyg_uint8 buf_num)
 {
     df_status_t status;
+    cyg_spi_device *spi_dev = dev->spi_dev;

     if (CYG_DATAFLASH_STATE_IDLE == dev->state)
         return CYG_DATAFLASH_ERR_OK;
@@ -238,10 +480,19 @@
         // REMIND: this loop should have an timeout 
         // in case of device malfunction

-        do 
+      // XXX Stano: an access to a single dataflash is locked via
aquire/release,
+      // so the operations are guaranteed to be serialized.
+      // Do not take the whole bus while polling, there can be other devices
+      // that can't afford to wait until the operation completes
+        while (1) 
         {
             status = df_read_status(dev);
-        } while (0 == status.ready); 
+         if (0 != status.ready)
+            break;
+          cyg_spi_transaction_end(spi_dev);
+         HAL_DELAY_US(5);
+          cyg_spi_transaction_begin(spi_dev);
+        }

         dev->state    = CYG_DATAFLASH_STATE_IDLE;
         dev->busy_buf = DATA_BUF_NONE;


-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


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

end of thread, other threads:[~2009-09-23 14:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-23  9:52 [Bug 1000825] New: No SPI transaction for Atmel Dataflash cyg_dataflash_release bugzilla-daemon
2009-09-23 14:27 ` [Bug 1000825] " bugzilla-daemon

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).