You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by je...@apache.org on 2021/05/20 05:24:09 UTC
[incubator-nuttx] 12/21: arch: cxd56xx: Fix gnss open error by
clock change
This is an automated email from the ASF dual-hosted git repository.
jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 98871e58af27dee3b5d02232246775e6843599b5
Author: SPRESENSE <41...@users.noreply.github.com>
AuthorDate: Wed May 19 17:04:22 2021 +0900
arch: cxd56xx: Fix gnss open error by clock change
If the system clock is changed during loading gnssfw, gnss open may be
failed. So this commit prohibits clock change until loading gnssfw is
completed.
---
arch/arm/src/cxd56xx/cxd56_gnss.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/arch/arm/src/cxd56xx/cxd56_gnss.c b/arch/arm/src/cxd56xx/cxd56_gnss.c
index 8325b89..13c739a 100644
--- a/arch/arm/src/cxd56xx/cxd56_gnss.c
+++ b/arch/arm/src/cxd56xx/cxd56_gnss.c
@@ -389,6 +389,11 @@ static struct pm_cpu_freqlock_s g_lv_lock =
PM_CPUFREQLOCK_INIT(PM_CPUFREQLOCK_TAG('G', 'T', 0),
PM_CPUFREQLOCK_FLAG_LV);
+/* Lock to prohibit clock change in gnss open */
+
+static struct pm_cpu_freqlock_s g_hold_lock =
+ PM_CPUFREQLOCK_INIT(0, PM_CPUFREQLOCK_FLAG_HOLD);
+
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -2632,7 +2637,16 @@ static int cxd56_gnss_open(FAR struct file *filep)
nxsem_set_protocol(&priv->syncsem, SEM_PRIO_NONE);
+ /* Prohibit the clock change during loading image */
+
+ up_pm_acquire_freqlock(&g_hold_lock);
+
ret = fw_pm_loadimage(CXD56_GNSS_GPS_CPUID, CXD56_GNSS_FWNAME);
+
+ /* Allow the clock change after loading image */
+
+ up_pm_release_freqlock(&g_hold_lock);
+
if (ret < 0)
{
goto _err1;