Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp408106pxu; Tue, 1 Dec 2020 14:31:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJwe67tKBcpk0HIJi2i1Sr/c3NBVEfTRSm0qyd7LLJnwjtwAJYzsTGEpdTh7aIw4NnwCy2MI X-Received: by 2002:a17:906:b306:: with SMTP id n6mr5067422ejz.473.1606861861943; Tue, 01 Dec 2020 14:31:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606861861; cv=none; d=google.com; s=arc-20160816; b=AgyRBQIGKN2lHNb7MquyvZhfp3yeRI+5IkJn0vF56Z/4S9swWcV3p9/W4WiWs5nR5n cxWYErtEQnC3LjspOqaNQZIbbGxcDEEY1VmD45fZct8f+RLynZveEej+t2g5Gdfhl5S0 38Hc4+gOS5/D5FFnqZvb1MYTyyGqMuTMqVq/s+SkxtdMMqe29ud/qZCMOcF6XHwtbrDD LXwY0og09USKtRU80/qGfNapD/O1nR96z/SBRhxq11Mvp/uNUgyJ4K3I/97RNDsPeoHd AKfMmjf06GdjO/tClccNFtq9X9koC0UlT0QD1nYNf+Zmy4E14BPH4mCEYvaODLFfVQOC Vo/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SZJjPC52myBkVpoIX0vNZi2QpM8dbqPYj9W79Grj1wY=; b=R1nL8sbMjKQ3Q4jW78WrsEr0zaw8fsadIS3Wq05by4lm7dkA77I6SNRC9aG2j5Ij+T hZB0lPVbDAAQqko59Ix+aZaXi34xfERzWNdLqFowZW9C6C58tZ0IHRs8Q938BX8u8xTM O6k/6zgebXSu2Mg+CgCroEfBT8me4zZFjDGiJLAVwbW3v8d80kxV9PBo0gckAZqcKOyU Z4I+uFrsEuNrpm5o4j0Q0J+XxT8yr9EqoKEqjvVhFFOCaf0q3CCcygEcskV4Y8aV1JfZ KjIQbRDyh6VMZJU5OxRnXovIzBy+UmVYIjPqDX6RIaAhxmb2baoJKcVwAPh04WO5JNGW IDWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Y6jSkLP2; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bo5si791314ejb.102.2020.12.01.14.30.39; Tue, 01 Dec 2020 14:31:01 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Y6jSkLP2; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729438AbgLAJWt (ORCPT + 99 others); Tue, 1 Dec 2020 04:22:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:43648 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389130AbgLAJHV (ORCPT ); Tue, 1 Dec 2020 04:07:21 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4D9C622249; Tue, 1 Dec 2020 09:07:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606813625; bh=3X7nDeaHGV8ca1bsDthpExKd61Y42M88KLXSYxDFZUA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y6jSkLP2TnJ26daDMQI/4iYYCFW0BbJo3n3p10NEws2c6dmgg4DIl3VZtbqRyhXDN zo10xkjwgMEYr+HkOnvGFxWxvryxG8K6EVifhMGRxz/oWroW8sT5Ib1MD5v+wQTtBf 8P8TIie8dl3T1FQ37pGSbyAJ8IPEmxuj2MvEFLZY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "alsa-devel@alsa-project.org, broonie@kernel.org, tiwai@suse.com, pierre-louis.bossart@linux.intel.com, mateusz.gorski@linux.intel.com, Cezary Rojewski" , Pierre-Louis Bossart , Mark Brown , Cezary Rojewski Subject: [PATCH 5.4 96/98] ASoC: Intel: Skylake: Await purge request ack on CNL Date: Tue, 1 Dec 2020 09:54:13 +0100 Message-Id: <20201201084659.771053432@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201201084652.827177826@linuxfoundation.org> References: <20201201084652.827177826@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Cezary Rojewski 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 Signed-off-by: Greg Kroah-Hartman --- 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(-) --- 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 --- 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->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); --- 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