From patchwork Mon May 15 07:10:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bard Liao X-Patchwork-Id: 13240884 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BF412C77B75 for ; Mon, 15 May 2023 06:58:48 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 677CBE9B; Mon, 15 May 2023 08:57:56 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 677CBE9B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1684133926; bh=jzpdfZmzNrU6pw0ISN0oU8vFcN6tRPXs+SPemPddfJg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=qAW5eW3AaYQjOUSW9jw+q2x9+ClGX6PM53N7S6yK7W12QU6PQQ/oihrS1J/S4/hBU vio98oFjIMgw/pMQZ9lex6e8fto5MiSnVIBQJZpldPxYNzVIKoKTxfIu1cIHAfvmSt oPlaGN0wjHXA6HSy3uzVfzAl5A9WFsenffc25b1Q= Received: by alsa1.perex.cz (Postfix, from userid 50401) id E7358F80697; Mon, 15 May 2023 08:52:13 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 877A4F8068E; Mon, 15 May 2023 08:52:13 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E0549F80553; Mon, 15 May 2023 08:52:07 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 1225DF8025A for ; Mon, 15 May 2023 08:50:33 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 1225DF8025A Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=QK5xfd/t DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684133435; x=1715669435; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jzpdfZmzNrU6pw0ISN0oU8vFcN6tRPXs+SPemPddfJg=; b=QK5xfd/ttdNifiM+q5UI1z1bET1e931n4l3i7BOwqXZWoSOOICN7qhtE yLLJBBUnc5YHOAy/5PKt5pg+GB8qJ7c7p7GwpEAuMmNQG5KdSLL5WmPC0 S16wo2Jv1pOS3O6u5Psui1QSyaQGNtOqSZhZ/PhjaB+Ip1v2brt7p0nwe w7maGgGWa4QM8trfooLLPpeKYoKGdmPwi0PrAASql4DFsc1qCidcATcrG GXpua6IH1u5X0Pfxzt7tFjOz4cSJRk00jfbctrdLghwLYB/O/KKxYnlz1 mPTgyMB4EYL4k5o5bK4qvoE8jIuh0HO4AtGkBwvWxtozEMpVEKytVEfYu g==; X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="349966310" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="349966310" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2023 23:50:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="694908629" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="694908629" Received: from bard-ubuntu.sh.intel.com ([10.239.185.57]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2023 23:50:31 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org, tiwai@suse.de Cc: linux-kernel@vger.kernel.org, vinod.koul@linaro.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 05/26] soundwire: intel/cadence: set ip_offset at run-time Date: Mon, 15 May 2023 15:10:21 +0800 Message-Id: <20230515071042.2038-6-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230515071042.2038-1-yung-chuan.liao@linux.intel.com> References: <20230515071042.2038-1-yung-chuan.liao@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: 65S6GH6IQ6EMKID7OVPFDXFZHASXJFLK X-Message-ID-Hash: 65S6GH6IQ6EMKID7OVPFDXFZHASXJFLK X-MailFrom: yung-chuan.liao@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Pierre-Louis Bossart Select relevant ip-offset depending on hardware version. This offset is used to access MCP_ or IP_MCP_ registers with a fixed offset. For existing platforms, the offset is exactly zero. Starting with LunarLake, the offset is 0x4000. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: Péter Ujfalusi Reviewed-by: Ranjani Sridharan Signed-off-by: Bard Liao --- drivers/soundwire/cadence_master.h | 2 ++ drivers/soundwire/intel.h | 2 ++ drivers/soundwire/intel_auxdevice.c | 1 + drivers/soundwire/intel_init.c | 2 ++ 4 files changed, 7 insertions(+) diff --git a/drivers/soundwire/cadence_master.h b/drivers/soundwire/cadence_master.h index 27c56274217f..86a450b1cbda 100644 --- a/drivers/soundwire/cadence_master.h +++ b/drivers/soundwire/cadence_master.h @@ -14,6 +14,8 @@ */ #define CDNS_MCP_IP_MAX_CMD_LEN 32 +#define SDW_CADENCE_MCP_IP_OFFSET 0x4000 + /** * struct sdw_cdns_pdi: PDI (Physical Data Interface) instance * diff --git a/drivers/soundwire/intel.h b/drivers/soundwire/intel.h index 51aa42a5a824..1b23292bb8be 100644 --- a/drivers/soundwire/intel.h +++ b/drivers/soundwire/intel.h @@ -10,6 +10,7 @@ * @hw_ops: platform-specific ops * @mmio_base: mmio base of SoundWire registers * @registers: Link IO registers base + * @ip_offset: offset for MCP_IP registers * @shim: Audio shim pointer * @shim_vs: Audio vendor-specific shim pointer * @alh: ALH (Audio Link Hub) pointer @@ -28,6 +29,7 @@ struct sdw_intel_link_res { void __iomem *mmio_base; /* not strictly needed, useful for debug */ void __iomem *registers; + u32 ip_offset; void __iomem *shim; void __iomem *shim_vs; void __iomem *alh; diff --git a/drivers/soundwire/intel_auxdevice.c b/drivers/soundwire/intel_auxdevice.c index b21e86084f7b..fcdf4f2d60e3 100644 --- a/drivers/soundwire/intel_auxdevice.c +++ b/drivers/soundwire/intel_auxdevice.c @@ -144,6 +144,7 @@ static int intel_link_probe(struct auxiliary_device *auxdev, sdw->link_res = &ldev->link_res; cdns->dev = dev; cdns->registers = sdw->link_res->registers; + cdns->ip_offset = sdw->link_res->ip_offset; cdns->instance = sdw->instance; cdns->msg_count = 0; diff --git a/drivers/soundwire/intel_init.c b/drivers/soundwire/intel_init.c index e0023af9e0e1..43d339c6bcee 100644 --- a/drivers/soundwire/intel_init.c +++ b/drivers/soundwire/intel_init.c @@ -66,10 +66,12 @@ static struct sdw_intel_link_dev *intel_link_dev_register(struct sdw_intel_res * if (!res->ext) { link->registers = res->mmio_base + SDW_LINK_BASE + (SDW_LINK_SIZE * link_id); + link->ip_offset = 0; link->shim = res->mmio_base + res->shim_base; link->alh = res->mmio_base + res->alh_base; } else { link->registers = res->mmio_base + SDW_IP_BASE(link_id); + link->ip_offset = SDW_CADENCE_MCP_IP_OFFSET; link->shim = res->mmio_base + SDW_SHIM2_GENERIC_BASE(link_id); link->shim_vs = res->mmio_base + SDW_SHIM2_VS_BASE(link_id); }