You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by vi...@apache.org on 2019/09/22 15:13:54 UTC

[mynewt-core] branch master updated: mcu/dialog/da1469x: (#1992)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new d05637f  mcu/dialog/da1469x: (#1992)
d05637f is described below

commit d05637f8e852e0d8ba468bed5b46e99174d169b3
Author: Ben McCrea <bm...@juul.com>
AuthorDate: Sun Sep 22 08:13:47 2019 -0700

    mcu/dialog/da1469x: (#1992)
    
    Added syscfgs to allow MCU initialization of QSPIC_BURSTCMDA_REG,
    QSPIC_BURSTCMDB_REG and QSPIC_CTRLMODE_REG when hal_flash_init()
    is called.
---
 hw/mcu/dialog/da1469x/src/hal_flash.c | 30 +++++++++++++++++++++++++++++-
 hw/mcu/dialog/da1469x/syscfg.yml      | 24 ++++++++++++++++++++++++
 2 files changed, 53 insertions(+), 1 deletion(-)

diff --git a/hw/mcu/dialog/da1469x/src/hal_flash.c b/hw/mcu/dialog/da1469x/src/hal_flash.c
index 6b389a7..2ae59bd 100644
--- a/hw/mcu/dialog/da1469x/src/hal_flash.c
+++ b/hw/mcu/dialog/da1469x/src/hal_flash.c
@@ -379,8 +379,36 @@ da1469x_hff_sector_info(const struct hal_flash *dev, int idx,
     return 0;
 }
 
+#if MYNEWT_VAL(MCU_QSPIC_APP_CFG)
+static sec_text_ram_core void
+da1469x_hff_mcu_custom_init(const struct hal_flash *dev)
+{
+    uint32_t primask;
+    uint32_t ctrlmode_reg = QSPIC->QSPIC_CTRLMODE_REG;
+    __HAL_DISABLE_INTERRUPTS(primask);
+    da1469x_qspi_mode_manual(dev);
+#if defined (MYNEWT_VAL_MCU_QSPIC_BURSTCMDA_INIT_VAL)
+    QSPIC->QSPIC_BURSTCMDA_REG = MYNEWT_VAL(MCU_QSPIC_BURSTCMDA_INIT_VAL);
+#endif
+#if defined (MYNEWT_VAL_MCU_QSPIC_BURSTCMDB_INIT_VAL)
+    QSPIC->QSPIC_BURSTCMDB_REG = MYNEWT_VAL(MCU_QSPIC_BURSTCMDB_INIT_VAL);
+#endif
+#if defined (MYNEWT_VAL_MCU_QSPIC_CTRLMODE_INIT_VAL)
+    QSPIC->QSPIC_CTRLMODE_REG = MYNEWT_VAL(MCU_QSPIC_CTRLMODE_INIT_VAL);
+#endif
+    if (ctrlmode_reg & QSPIC_QSPIC_CTRLMODE_REG_QSPIC_AUTO_MD_Msk) {
+        /* restore auto mode */
+        da1469x_qspi_mode_auto(dev);
+    }
+    __HAL_ENABLE_INTERRUPTS(primask);
+}
+#endif
+
 static int
-da1469x_hff_init(const struct hal_flash *dev)
+    da1469x_hff_init(const struct hal_flash *dev)
 {
+#if MYNEWT_VAL(MCU_QSPIC_APP_CFG)
+    da1469x_hff_mcu_custom_init(dev);
+#endif
     return 0;
 }
diff --git a/hw/mcu/dialog/da1469x/syscfg.yml b/hw/mcu/dialog/da1469x/syscfg.yml
index 2f668be..d9fed26 100644
--- a/hw/mcu/dialog/da1469x/syscfg.yml
+++ b/hw/mcu/dialog/da1469x/syscfg.yml
@@ -125,6 +125,30 @@ syscfg.defs:
             data before writing, i.e. each such transfer will be split into
             chunks of this size. Buffer is created on stack.
         value: 128
+    MCU_QSPIC_APP_CFG:
+        description: >
+            Enable application initialization of QSPIC settings. Syscfg values that
+            are defined for QSPIC_BURSTCMDA_REG, QSPIC_BURSTCMDB_REG or
+            QSPIC_CTRLMODE_REG will be applied by hal_flash_init.
+        value: 0
+    MCU_QSPIC_BURSTCMDA_INIT_VAL:
+        description: >
+            MCU initialization value for QSPIC_BURSTCMDA_REG
+        value: ''
+        restrictions:
+        - (MCU_QSPIC_APP_CFG)
+    MCU_QSPIC_BURSTCMDB_INIT_VAL:
+        description: >
+            MCU initialization value for QSPIC_BURSTCMDB_REG
+        value: ''
+        restrictions:
+        - (MCU_QSPIC_APP_CFG)
+    MCU_QSPIC_CTRLMODE_INIT_VAL:
+        description: >
+            MCU initialization value for QSPIC_CTRLMODE_REG
+        value: ''
+        restrictions:
+        - (MCU_QSPIC_APP_CFG)
 
 # MCU peripherals definitions
     I2C_0: