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

[GitHub] utzig closed pull request #1538: Fix nrf52 qspi erase

utzig closed pull request #1538: Fix nrf52 qspi erase
URL: https://github.com/apache/mynewt-core/pull/1538
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/hw/mcu/nordic/nrf52xxx-compat/syscfg.yml b/hw/mcu/nordic/nrf52xxx-compat/syscfg.yml
index 03c6d806bf..84218003e8 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/src/hal_qspi.c b/hw/mcu/nordic/nrf52xxx/src/hal_qspi.c
index 2abb778e64..57b32e23e0 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;
 }
 
diff --git a/hw/mcu/nordic/nrf52xxx/syscfg.yml b/hw/mcu/nordic/nrf52xxx/syscfg.yml
index 2295677761..a22c881bb2 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
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services