You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ut...@apache.org on 2018/11/29 13:13:01 UTC

[mynewt-core] branch master updated (d806218 -> ace2d93)

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

utzig pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git.


    from d806218  Merge pull request #1539 from kasjer/kasjer/spiflash-thread-safe
     new 5d4f992  Fix typo
     new ace2d93  Fix QSPI parameter error on erase command

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 hw/mcu/nordic/nrf52xxx-compat/syscfg.yml |  2 +-
 hw/mcu/nordic/nrf52xxx/src/hal_qspi.c    | 22 ++++++++++++++--------
 hw/mcu/nordic/nrf52xxx/syscfg.yml        |  2 +-
 3 files changed, 16 insertions(+), 10 deletions(-)


[mynewt-core] 01/02: Fix typo

Posted by ut...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

utzig pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 5d4f992704a423602914efa2ddd421236f199ca9
Author: Fabio Utzig <ut...@apache.org>
AuthorDate: Wed Nov 28 12:51:24 2018 -0200

    Fix typo
---
 hw/mcu/nordic/nrf52xxx-compat/syscfg.yml | 2 +-
 hw/mcu/nordic/nrf52xxx/syscfg.yml        | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/mcu/nordic/nrf52xxx-compat/syscfg.yml b/hw/mcu/nordic/nrf52xxx-compat/syscfg.yml
index 03c6d80..8421800 100644
--- a/hw/mcu/nordic/nrf52xxx-compat/syscfg.yml
+++ b/hw/mcu/nordic/nrf52xxx-compat/syscfg.yml
@@ -153,7 +153,7 @@ syscfg.defs:
         value: 0
     QSPI_FLASH_PAGE_SIZE:
         description: >
-            QSPI page size. Writes can only be perfrmed to one page at a time.
+            QSPI page size. Writes can only be performed to one page at a time.
             In most cases it should be 256.
         value: 0
 
diff --git a/hw/mcu/nordic/nrf52xxx/syscfg.yml b/hw/mcu/nordic/nrf52xxx/syscfg.yml
index 2295677..a22c881 100644
--- a/hw/mcu/nordic/nrf52xxx/syscfg.yml
+++ b/hw/mcu/nordic/nrf52xxx/syscfg.yml
@@ -333,7 +333,7 @@ syscfg.defs:
         value: 0
     QSPI_FLASH_PAGE_SIZE:
         description: >
-            QSPI page size. Writes can only be perfrmed to one page at a time.
+            QSPI page size. Writes can only be performed to one page at a time.
             In most cases it should be 256.
         value: 0
 


[mynewt-core] 02/02: Fix QSPI parameter error on erase command

Posted by ut...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

utzig pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit ace2d93e332ee64e48a2ba4f0b0bcd9bfcb24a76
Author: Fabio Utzig <ut...@apache.org>
AuthorDate: Wed Nov 28 12:51:49 2018 -0200

    Fix QSPI parameter error on erase command
    
    According to NRF52840 PS, the erase operation on QSPI only accepts 4k,
    64kb or all memory as parameters, which are encoded in the 2 LSb
    (QSPI 52.10.12). This makes the erase command call 4KB erase for each
    sector inside the user defined `QSPI_FLASH_SECTOR_SIZE`.
    
    Signed-off-by: Fabio Utzig <ut...@apache.org>
---
 hw/mcu/nordic/nrf52xxx/src/hal_qspi.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/hw/mcu/nordic/nrf52xxx/src/hal_qspi.c b/hw/mcu/nordic/nrf52xxx/src/hal_qspi.c
index 2abb778..57b32e2 100644
--- a/hw/mcu/nordic/nrf52xxx/src/hal_qspi.c
+++ b/hw/mcu/nordic/nrf52xxx/src/hal_qspi.c
@@ -222,14 +222,20 @@ static int
 nrf52k_qspi_erase_sector(const struct hal_flash *dev,
         uint32_t sector_address)
 {
-    while ((NRF_QSPI->STATUS & QSPI_STATUS_READY_Msk) == 0)
-        ;
-    NRF_QSPI->EVENTS_READY = 0;
-    NRF_QSPI->ERASE.PTR = sector_address;
-    NRF_QSPI->ERASE.LEN = MYNEWT_VAL(QSPI_FLASH_SECTOR_SIZE);
-    NRF_QSPI->TASKS_ERASESTART = 1;
-    while (NRF_QSPI->EVENTS_READY == 0)
-        ;
+    int8_t erases;
+
+    erases = MYNEWT_VAL(QSPI_FLASH_SECTOR_SIZE) / 4096;
+    while (erases-- > 0) {
+        while ((NRF_QSPI->STATUS & QSPI_STATUS_READY_Msk) == 0)
+            ;
+        NRF_QSPI->EVENTS_READY = 0;
+        NRF_QSPI->ERASE.PTR = sector_address;
+        NRF_QSPI->ERASE.LEN = NRF_QSPI_ERASE_LEN_4KB;
+        NRF_QSPI->TASKS_ERASESTART = 1;
+        while (NRF_QSPI->EVENTS_READY == 0)
+            ;
+        sector_address += 4096;
+    }
     return 0;
 }