Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2746829pxu; Sun, 29 Nov 2020 03:48:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJwRaGUA4RojdoK0JuaMNICpjfDO7+N8UjaVa5Lq35GgZx1ncoVoMPrg/wanJANH/1qA5WOQ X-Received: by 2002:aa7:d54b:: with SMTP id u11mr16817435edr.341.1606650487747; Sun, 29 Nov 2020 03:48:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606650487; cv=none; d=google.com; s=arc-20160816; b=Hkp+6ukBHtYMPRWcSzPtFJoXTbyC2Q5yT6VNfVRILKEmc1Uc0KZNQ5A0+OZENKLDpM G9plC4ghI29eEoxUpSEvNgpCs2poz6+MqeD6qFNL7EbmRAfZEPzeD7e/DY9N04HQltni 2dAEDp/8qcbyTLTK8vk4mi2MqDxIGBdtHNwSB7A3qBM2dlstZ+NJVqkAtLRJu/5WY38m Hzlrp1uuPBv60DQlVNwglffdFI8i75ugAmBLF5ocT6Vk8ngBabsEHM3Anvd0/aR4lUaL IUJOGfriKezhbmnvJ8myWxKV+gW/XnMEBdD9gh7Od9HvWNQcAWxcIBT1omlhrEnOcyah 7cng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:ironport-sdr:ironport-sdr; bh=jPD+1UMBcX4oETAR4E9SuwhmNQ/Wef7Yjp0mFPKlYYQ=; b=QOFrZhZgf4xUtuKXttXWM9YkeWCWO69igtoHItx8wB2uVpqgpFvzIKT1N9Pq0pvuE5 P0AGJZ2qWs6+Ylw8QpKJfcZmm83oyvExNp15EeRWCzVLonhCgDHUINFMH8cUFCFbSTZ/ sKaN8Tdw7cFG2duxUr1JrTFyNBAzSesX74JnUqhbMQcw09m+oT4npp7qtZffxR3r/U92 727k3VlZg8utS56GnG+vRuZHQdxF1oUspSniqJI0Q5jtaRl0PnIz2tLGl5Q4uBgi3upN lDVUAfqgKKpbIDngj7E660ZPsncHprEvHNpfWwvxVdD3tb8PWWkN/9TCPvCM/0YGinny 6DyA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b23si239408edj.55.2020.11.29.03.47.45; Sun, 29 Nov 2020 03:48:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387427AbgK2Loo (ORCPT + 99 others); Sun, 29 Nov 2020 06:44:44 -0500 Received: from mga07.intel.com ([134.134.136.100]:8115 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727756AbgK2Lom (ORCPT ); Sun, 29 Nov 2020 06:44:42 -0500 IronPort-SDR: Fz9Eml63hAHzCC8BSKlDQBrKnqiWkoXca/lrSBWnfylK3K/HKNnXbRwYWXZjgnuLwCmbQiHYGh PJmEc5Fij11w== X-IronPort-AV: E=McAfee;i="6000,8403,9819"; a="236654213" X-IronPort-AV: E=Sophos;i="5.78,379,1599548400"; d="scan'208";a="236654213" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2020 03:43:17 -0800 IronPort-SDR: CvBpK8wCYh2NHgyFQzSnwBMJd6P6GWP+CUaIWm1N0re9SzV+jlSw99BjjN+r4tZmuHS6sQ4Z0u l996HquIA/4Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,379,1599548400"; d="scan'208";a="480261667" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by orsmga004.jf.intel.com with ESMTP; 29 Nov 2020 03:43:14 -0800 From: Cezary Rojewski To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: alsa-devel@alsa-project.org, broonie@kernel.org, tiwai@suse.com, pierre-louis.bossart@linux.intel.com, mateusz.gorski@linux.intel.com, Cezary Rojewski Subject: [PATCH 6/8] ASoC: Intel: Skylake: Await purge request ack on CNL Date: Sun, 29 Nov 2020 12:41:46 +0100 Message-Id: <20201129114148.13772-7-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201129114148.13772-1-cezary.rojewski@intel.com> References: <20201129114148.13772-1-cezary.rojewski@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org commit 7693cadac86548b30389a6e11d78c38db654f393 upstream. Each purge request is sent by driver after master core is powered up and unresetted but before it is unstalled. On unstall, ROM begins processing the request and initializing environment for FW load. Host should await ROM's ack before moving forward. Without doing so, ROM init poll may start too early and false timeouts can occur. Fixes: cb6a55284629 ("ASoC: Intel: cnl: Add sst library functions for cnl platform") Signed-off-by: Cezary Rojewski Reviewed-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20200305145314.32579-8-cezary.rojewski@intel.com Signed-off-by: Mark Brown Cc: # 5.4.x --- sound/soc/intel/skylake/bxt-sst.c | 1 - sound/soc/intel/skylake/cnl-sst.c | 20 ++++++++++++++++++-- sound/soc/intel/skylake/skl-sst-dsp.h | 1 + 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/sound/soc/intel/skylake/bxt-sst.c b/sound/soc/intel/skylake/bxt-sst.c index cdafade8abd6..38b9d7494083 100644 --- a/sound/soc/intel/skylake/bxt-sst.c +++ b/sound/soc/intel/skylake/bxt-sst.c @@ -17,7 +17,6 @@ #include "skl.h" #define BXT_BASEFW_TIMEOUT 3000 -#define BXT_INIT_TIMEOUT 300 #define BXT_ROM_INIT_TIMEOUT 70 #define BXT_IPC_PURGE_FW 0x01004000 diff --git a/sound/soc/intel/skylake/cnl-sst.c b/sound/soc/intel/skylake/cnl-sst.c index 060e47ae3391..c6abcd5aa67b 100644 --- a/sound/soc/intel/skylake/cnl-sst.c +++ b/sound/soc/intel/skylake/cnl-sst.c @@ -57,18 +57,34 @@ static int cnl_prepare_fw(struct sst_dsp *ctx, const void *fwdata, u32 fwsize) ctx->dsp_ops.stream_tag = stream_tag; memcpy(ctx->dmab.area, fwdata, fwsize); + ret = skl_dsp_core_power_up(ctx, SKL_DSP_CORE0_MASK); + if (ret < 0) { + dev_err(ctx->dev, "dsp core0 power up failed\n"); + ret = -EIO; + goto base_fw_load_failed; + } + /* purge FW request */ sst_dsp_shim_write(ctx, CNL_ADSP_REG_HIPCIDR, CNL_ADSP_REG_HIPCIDR_BUSY | (CNL_IPC_PURGE | ((stream_tag - 1) << CNL_ROM_CTRL_DMA_ID))); - ret = cnl_dsp_enable_core(ctx, SKL_DSP_CORE0_MASK); + ret = skl_dsp_start_core(ctx, SKL_DSP_CORE0_MASK); if (ret < 0) { - dev_err(ctx->dev, "dsp boot core failed ret: %d\n", ret); + dev_err(ctx->dev, "Start dsp core failed ret: %d\n", ret); ret = -EIO; goto base_fw_load_failed; } + ret = sst_dsp_register_poll(ctx, CNL_ADSP_REG_HIPCIDA, + CNL_ADSP_REG_HIPCIDA_DONE, + CNL_ADSP_REG_HIPCIDA_DONE, + BXT_INIT_TIMEOUT, "HIPCIDA Done"); + if (ret < 0) { + dev_err(ctx->dev, "timeout for purge request: %d\n", ret); + goto base_fw_load_failed; + } + /* enable interrupt */ cnl_ipc_int_enable(ctx); cnl_ipc_op_int_enable(ctx); diff --git a/sound/soc/intel/skylake/skl-sst-dsp.h b/sound/soc/intel/skylake/skl-sst-dsp.h index 067d1ea11cde..1df9ef422f61 100644 --- a/sound/soc/intel/skylake/skl-sst-dsp.h +++ b/sound/soc/intel/skylake/skl-sst-dsp.h @@ -68,6 +68,7 @@ struct skl_dev; #define SKL_FW_INIT 0x1 #define SKL_FW_RFW_START 0xf #define BXT_FW_ROM_INIT_RETRY 3 +#define BXT_INIT_TIMEOUT 300 #define SKL_ADSPIC_IPC 1 #define SKL_ADSPIS_IPC 1 -- 2.17.1