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/09/21 08:06:12 UTC

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

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



##########
File path: hw/mcu/nordic/nrf52xxx/src/hal_qspi.c
##########
@@ -226,16 +246,53 @@ nrf52k_qspi_erase_sector(const struct hal_flash *dev,
 
     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;
+
+    address &= ~0xFFFU;
+    end = address + size;
+
+    if (end == MYNEWT_VAL(QSPI_FLASH_SECTOR_COUNT) *
+                   MYNEWT_VAL(QSPI_FLASH_SECTOR_SIZE)) {
+        return erase_block(0, NRF_QSPI_ERASE_LEN_ALL);
+    }
+
+    while (size) {
+#if MYNEWT_VAL(SPIFLASH_BLOCK_ERASE_64BK)

Review comment:
       this is syscfg from different package, do not use it here. either make it always enabled or alternatively add new syscfg to MCU package




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