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

agross pushed a commit to branch flash-autoconfigure-fix
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/flash-autoconfigure-fix by 
this push:
     new 09627d478 da146x: hal_flash: Add export of RDID detection
09627d478 is described below

commit 09627d478f31c7daeac647ce09feb3b41d30fa2d
Author: Andy Gross <andy.gr...@juul.com>
AuthorDate: Mon Sep 26 18:17:55 2022 -0500

    da146x: hal_flash: Add export of RDID detection
    
    This patch adds a globally exported pointer to the RDID information detected
    during flash init.  This can be used by other software to make decisions 
about
    special actions taken with specific flash devices.
    
    Signed-off-by: Andy Gross <andy.gr...@juul.com>
---
 hw/mcu/dialog/da1469x/include/mcu/da1469x_hal.h |  2 ++
 hw/mcu/dialog/da1469x/src/hal_flash.c           | 13 +++++++------
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/hw/mcu/dialog/da1469x/include/mcu/da1469x_hal.h 
b/hw/mcu/dialog/da1469x/include/mcu/da1469x_hal.h
index 26c5f3c4c..01014963e 100755
--- a/hw/mcu/dialog/da1469x/include/mcu/da1469x_hal.h
+++ b/hw/mcu/dialog/da1469x/include/mcu/da1469x_hal.h
@@ -85,6 +85,8 @@ struct qspi_flash_config {
 extern const struct qspi_flash_config rdids[];
 extern const int qspi_flash_config_array_size;
 
+extern const struct qspi_flash_config *rdid_detected;
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/hw/mcu/dialog/da1469x/src/hal_flash.c 
b/hw/mcu/dialog/da1469x/src/hal_flash.c
index 6004e2594..62a977800 100644
--- a/hw/mcu/dialog/da1469x/src/hal_flash.c
+++ b/hw/mcu/dialog/da1469x/src/hal_flash.c
@@ -34,6 +34,8 @@ union da1469x_qspi_data_reg {
     uint8_t  d8;
 };
 
+const struct qspi_flash_config *rdid_detected = NULL;
+
 static int da1469x_hff_read(const struct hal_flash *dev, uint32_t address,
                             void *dst, uint32_t num_bytes);
 static int da1469x_hff_write(const struct hal_flash *dev, uint32_t address,
@@ -453,20 +455,19 @@ qspi_read_rdid(const struct hal_flash *dev)
 static sec_text_ram_core void
 da1469x_hff_mcu_custom_init(const struct hal_flash *dev)
 {
-    const struct qspi_flash_config *config = NULL;
     uint32_t primask;
 
     __HAL_DISABLE_INTERRUPTS(primask);
 
     /* detect flash device and use correct configuration */
-    config = qspi_read_rdid(dev);
-    assert(config);
+    rdid_detected = qspi_read_rdid(dev);
+    assert(rdid_detected);
 
-    QSPIC->QSPIC_BURSTCMDA_REG = config->cmda;
-    QSPIC->QSPIC_BURSTCMDB_REG = config->cmdb;
+    QSPIC->QSPIC_BURSTCMDA_REG = rdid_detected->cmda;
+    QSPIC->QSPIC_BURSTCMDB_REG = rdid_detected->cmdb;
 
     /* provision attached QSPI device for proper quad operation */
-    qspi_qe_enable(dev, &config->qe);
+    qspi_qe_enable(dev, &rdid_detected->qe);
 
     /*
      * Set auto mode, read pipe delay to 0x7, read pipe enable

Reply via email to