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 2020/10/21 14:52:18 UTC

[GitHub] [mynewt-core] mikevoyt commented on a change in pull request #2377: 64KB block and chip erase for Nordic nrf52 QSPI

mikevoyt commented on a change in pull request #2377:
URL: https://github.com/apache/mynewt-core/pull/2377#discussion_r509356585



##########
File path: hw/mcu/nordic/nrf52xxx/src/hal_qspi.c
##########
@@ -218,30 +223,77 @@ nrf52k_qspi_write(const struct hal_flash *dev, uint32_t address,
     return 0;
 }
 
+static void
+erase_block(uint32_t starting_address,
+            nrf_qspi_erase_len_t block_size_type)
+{
+    while ((NRF_QSPI->STATUS & QSPI_STATUS_READY_Msk) == 0)
+        ;
+    NRF_QSPI->EVENTS_READY = 0;
+    NRF_QSPI->ERASE.PTR = starting_address;
+    NRF_QSPI->ERASE.LEN = block_size_type;
+    NRF_QSPI->TASKS_ERASESTART = 1;
+    while (NRF_QSPI->EVENTS_READY == 0)
+        ;
+
+}
+
 static int
 nrf52k_qspi_erase_sector(const struct hal_flash *dev,
-        uint32_t sector_address)
+                         uint32_t sector_address)
 {
     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)
-            ;
+        erase_block(sector_address, NRF_QSPI_ERASE_LEN_4KB);
         sector_address += 4096;
     }
+
+    return 0;
+}
+
+static int
+nrf52k_qspi_erase(const struct hal_flash *dev, uint32_t address,
+                  uint32_t size)
+{
+
+    uint32_t end;
+    int rc;

Review comment:
       @kasjer no problem, I've removed `int rc`, and forced pushed the branch so now we have one clean commit.
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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