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.
This commit is contained in:
SPRESENSE 2021-05-19 17:04:22 +09:00 committed by Alin Jerpelea
parent e26da5f564
commit 98871e58af

View File

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