Received: by 2002:a9a:4c47:0:b029:116:c383:538 with SMTP id u7csp1216723lko; Tue, 13 Jul 2021 19:50:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+pOWFhdki5W3jizatAte8amgkqjmpPGEKXOTiL+HDcQ3yh4iZGk8B9ZLom5DBgyzAEoQp X-Received: by 2002:a17:906:4ad2:: with SMTP id u18mr9476943ejt.549.1626231039465; Tue, 13 Jul 2021 19:50:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626231039; cv=none; d=google.com; s=arc-20160816; b=QIzzrkhrz2PeCEXt2VhMbwRRlp0uud4+UH+vQ4tc6HEI41TNvywSehZJMfKwP6qex8 aDw9xiQ90gNlc+V+f4YJ2BSdouplqrOR8rkXZR5WtPzS9HDLFdjJ9L5JzXXYsKE8Rc0X u+pFg4Utjze+OIsejZROOZhDvJZbiOTV7tSzhMfr0UZXPVsyzaAN+4vqRJBYSHgm02lz ErVtLdT4IfHzcAxJ4visR1vqYun//+cSkgrh3Mfi1aXnUMhoam2Ec0neUZCPYydYyh2V MZstdfyhflTxf0kx41zquwHD8yIAocAv+Dlya52xgsD8F+/9UtYqVSvYfnrBiTaEXClH OKIw== 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; bh=8Sct9cqtLCDs5J4YGSGDWushtGBnJPI5oDW57e2Sdo8=; b=npChQbA5/c49mcow0/fRJ01lkgKAm1CTZfuvGnloRgZYGYQIf7yQNmKLjTmr+zKVBk OeI5KUXYwZ0I5PhqeCUliW5WU6Bpo2y+2KVdY7KqlUXGFKyNWSsc7Fqzcbn3TbAQYwYt ThRHrw/eVKo/aBEsLQGouGyAJmX0YS0f8LAFtLMvZYpmNbrSJkI9eB4xxk6S584A3Zgz G+AOt9awhtOjGqs/UYd6/Zt5CPJOm8ZVECdoJddqqoZerxuT27IRtn6Tn1h2Pvw7C2uU /o+ZFprSRnrJ9Z3dbm7kibQA5cqoAthsN2bKtet4xQZZD68orB9HUzVljT3YoIks4Ljz rLfQ== 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 a12si980295edr.3.2021.07.13.19.50.17; Tue, 13 Jul 2021 19:50:39 -0700 (PDT) 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 S237690AbhGNCtg (ORCPT + 99 others); Tue, 13 Jul 2021 22:49:36 -0400 Received: from mga09.intel.com ([134.134.136.24]:8788 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237691AbhGNCte (ORCPT ); Tue, 13 Jul 2021 22:49:34 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10044"; a="210253435" X-IronPort-AV: E=Sophos;i="5.84,238,1620716400"; d="scan'208";a="210253435" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jul 2021 19:46:43 -0700 X-IronPort-AV: E=Sophos;i="5.84,238,1620716400"; d="scan'208";a="493593254" Received: from bard-ubuntu.sh.intel.com ([10.239.185.57]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jul 2021 19:46:40 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, tiwai@suse.de, broonie@kernel.org, gregkh@linuxfoundation.org, srinivas.kandagatla@linaro.org, pierre-louis.bossart@linux.intel.com, sanyog.r.kale@intel.com, bard.liao@intel.com Subject: [PATCH 6/6] soundwire: intel: introduce shim and alh base Date: Wed, 14 Jul 2021 10:46:14 +0800 Message-Id: <20210714024614.9357-7-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210714024614.9357-1-yung-chuan.liao@linux.intel.com> References: <20210714024614.9357-1-yung-chuan.liao@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org shim base and alh base are platform-dependent. Adding these two parameters allows us to use different shim/alh base for each platform. Signed-off-by: Bard Liao Reviewed-by: Pierre-Louis Bossart Reviewed-by: Ranjani Sridharan --- drivers/soundwire/intel_init.c | 8 +++++--- include/linux/soundwire/sdw_intel.h | 8 ++++++++ sound/soc/sof/intel/hda.c | 2 ++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/soundwire/intel_init.c b/drivers/soundwire/intel_init.c index 03ff69ab1797..e329022e1669 100644 --- a/drivers/soundwire/intel_init.c +++ b/drivers/soundwire/intel_init.c @@ -63,8 +63,8 @@ static struct sdw_intel_link_dev *intel_link_dev_register(struct sdw_intel_res * link->mmio_base = res->mmio_base; link->registers = res->mmio_base + SDW_LINK_BASE + (SDW_LINK_SIZE * link_id); - link->shim = res->mmio_base + SDW_SHIM_BASE; - link->alh = res->mmio_base + SDW_ALH_BASE; + link->shim = res->mmio_base + res->shim_base; + link->alh = res->mmio_base + res->alh_base; link->ops = res->ops; link->dev = res->dev; @@ -214,6 +214,8 @@ static struct sdw_intel_ctx } ctx->mmio_base = res->mmio_base; + ctx->shim_base = res->shim_base; + ctx->alh_base = res->alh_base; ctx->link_mask = res->link_mask; ctx->handle = res->handle; mutex_init(&ctx->shim_lock); @@ -302,7 +304,7 @@ sdw_intel_startup_controller(struct sdw_intel_ctx *ctx) return -EINVAL; /* Check SNDWLCAP.LCOUNT */ - caps = ioread32(ctx->mmio_base + SDW_SHIM_BASE + SDW_SHIM_LCAP); + caps = ioread32(ctx->mmio_base + ctx->shim_base + SDW_SHIM_LCAP); caps &= GENMASK(2, 0); /* Check HW supported vs property value */ diff --git a/include/linux/soundwire/sdw_intel.h b/include/linux/soundwire/sdw_intel.h index 7fce6aee0c36..8a463b8fc12a 100644 --- a/include/linux/soundwire/sdw_intel.h +++ b/include/linux/soundwire/sdw_intel.h @@ -195,6 +195,8 @@ struct sdw_intel_slave_id { * @link_list: list to handle interrupts across all links * @shim_lock: mutex to handle concurrent rmw access to shared SHIM registers. * @shim_mask: flags to track initialization of SHIM shared registers + * @shim_base: sdw shim base. + * @alh_base: sdw alh base. */ struct sdw_intel_ctx { int count; @@ -207,6 +209,8 @@ struct sdw_intel_ctx { struct list_head link_list; struct mutex shim_lock; /* lock for access to shared SHIM registers */ u32 shim_mask; + u32 shim_base; + u32 alh_base; }; /** @@ -225,6 +229,8 @@ struct sdw_intel_ctx { * machine-specific quirks are handled in the DSP driver. * @clock_stop_quirks: mask array of possible behaviors requested by the * DSP driver. The quirks are common for all links for now. + * @shim_base: sdw shim base. + * @alh_base: sdw alh base. */ struct sdw_intel_res { int count; @@ -236,6 +242,8 @@ struct sdw_intel_res { struct device *dev; u32 link_mask; u32 clock_stop_quirks; + u32 shim_base; + u32 alh_base; }; /* diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c index c979581c6812..b4e35fbbe693 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -166,6 +166,8 @@ static int hda_sdw_probe(struct snd_sof_dev *sdev) memset(&res, 0, sizeof(res)); res.mmio_base = sdev->bar[HDA_DSP_BAR]; + res.shim_base = hdev->desc->sdw_shim_base; + res.alh_base = hdev->desc->sdw_alh_base; res.irq = sdev->ipc_irq; res.handle = hdev->info.handle; res.parent = sdev->dev; -- 2.17.1