From patchwork Sat Nov 25 14:27:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 169746 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp1968273vqx; Sat, 25 Nov 2023 06:28:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IFQDuZbS3GgTJ07LQYFYUTJVYzEW6r7Yu1MWhrji1yJ/gmJmWrT8OQIfBqgaoMbLP6hJi6r X-Received: by 2002:a17:90b:17cd:b0:285:a0ae:6a4c with SMTP id me13-20020a17090b17cd00b00285a0ae6a4cmr2497882pjb.29.1700922539380; Sat, 25 Nov 2023 06:28:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700922539; cv=none; d=google.com; s=arc-20160816; b=AGfjXzwGl3roZ4XaNDtMAefA76MPn8YsRQzqZTErp1MdN5hXXGp6VbEKJO/L4FhaHN y3MRtsQvE8iGJr12AfY0+kGAvoJzsEkh7V1uBI5CIApc2Hb8fYx5IykidvOAtxwEgWQM 2OXAfFDw+er8n5bFU00E/lhVv+5Zy7YQAlQTSB/QpopOIkJCc4f5XuLWWBHaFqGQOJbU vrfRLj1fs/3qfVQsgYgyVz9+spRInBxAj+DBcaRiIobiiOEViGH3CkzEQIGpBtNLqAx3 /1IcaRjG5+9yiO0v0n6QZPhzhXVjXhH3uUYSzSa6m+SfH4q5eFrvWXlaxUVoTF6kVLOG +HzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=IjrMx0Y9XqGbeFGv2v7KF3vpFk6Af7SmrHYjsceKUcc=; fh=U1JT+TKNacymScwygDAagMa2UR8OqmqOmCHB7vFmHHM=; b=qbCQiDoxVvsGWhFo24IsF++FDyiNsTgX0S1jnj7xl3BJcbor2UNyIJDN+/EEVuKtH2 N5L4H/MmucrTnxgLVfXCHnKdIpqWgybRIBkNSbUBrvye8KGi2SycS2i/be0qHXP7Dstl NCfrAek+1NMPS5QZ922S9+kcGXMtX3Yx6fb9JEnEBOWp0t80xF8cgHTGK9IkWnps+k8y LDZ/brhkrzc7FP/dJ+hDTeiNZlYzRbQUmHyRDZ/23k8Sf1CpUWWQDYyslm2dCFtQ990b Txcjz5SaQTvu/22WStwVOHShYCCWO/5swC2xi8qJOhvhQY3/LgMTV5EZuR+l/1PntKaq 18vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nMSIOCap; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id 8-20020a631448000000b00577e00c5ffasi6227841pgu.867.2023.11.25.06.28.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Nov 2023 06:28:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nMSIOCap; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 994BF809222D; Sat, 25 Nov 2023 06:27:30 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232215AbjKYO1Q (ORCPT + 99 others); Sat, 25 Nov 2023 09:27:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232017AbjKYO1M (ORCPT ); Sat, 25 Nov 2023 09:27:12 -0500 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8918BB0 for ; Sat, 25 Nov 2023 06:27:18 -0800 (PST) Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2c87acba73bso36986171fa.1 for ; Sat, 25 Nov 2023 06:27:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700922437; x=1701527237; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=IjrMx0Y9XqGbeFGv2v7KF3vpFk6Af7SmrHYjsceKUcc=; b=nMSIOCap7eRtNRKAftq68BVAYtwGVTsfBXmqPy9RDILKMmNIJY5fER2N9Crr61Cp8E oFvNPF6FaZjr97/MOuvNF8jTW0EGx4Diw2YbnbKOvoBkk1dI7HmuvXZuaDSIitO3SAHo 0SXhUDvMm/mvlYI37hGF1gj6sYvNrtX/8oD2bFwPcHotHNThHoO2mHY8n3gS4pdKGf63 2ejPYdv5+POuh+x/7jShwCyPDjG6wiC9ANdnT+Wx5bxZDXFaqTOKUvKNdoorK5CNHQfz ZeQURHlnqoYRUE8dODLxlvWtHVS4QBtdnv8Cs6r4f3gNr1LOEKr8yigwUCtntwq/14Az y6mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700922437; x=1701527237; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IjrMx0Y9XqGbeFGv2v7KF3vpFk6Af7SmrHYjsceKUcc=; b=OnkGyqTmkPHUuUbll2qPjTIWVbcXGVTM+lJ2P1v3/o1yvb/O2eOK3lcnKVJBvIT0of GXVykBv6HEjVGpF8ahO/ipDjZGb07KB2J50ArNFLu8M/h34b5ykBcUDXetwwaQq3GWRG T3kpKUSio2os5g+/0IfcqrWeKIXvoElWgdeQiBFoXktRlsq37XtZS9iBQfodooUdLTtU EacrsKbDoxMKgXx80S1EUO0cqSkjObcqXjZuUYmjcobgY2u6O5l+ciBFetLMpzyiwzo2 VDPB+dxZfwK8fQyMuQM7vHePsfIFn/S7H8cjKD5a9tWnWocpwBYRuNIIjbt95/08Ouja 1zIQ== X-Gm-Message-State: AOJu0YyBb8wiL/pExn8ezvuz0t3WwqelOOlTzLxF7AXNVUB7jb76bDow gMmRS3PxY+EwR1Fj39CgwEm9Hu84R+lqki5Vyls= X-Received: by 2002:a2e:9d4e:0:b0:2b9:4b2e:5420 with SMTP id y14-20020a2e9d4e000000b002b94b2e5420mr4192424ljj.52.1700922436912; Sat, 25 Nov 2023 06:27:16 -0800 (PST) Received: from [10.167.154.1] (178235187180.dynamic-4-waw-k-2-3-0.vectranet.pl. [178.235.187.180]) by smtp.gmail.com with ESMTPSA id cb8-20020a170906a44800b009fd4583851esm3569253ejb.178.2023.11.25.06.27.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Nov 2023 06:27:16 -0800 (PST) From: Konrad Dybcio Date: Sat, 25 Nov 2023 15:27:04 +0100 Subject: [PATCH v6 2/2] irqchip: irq-qcom-mpm: Support passing a slice of SRAM as reg space MIME-Version: 1.0 Message-Id: <20230328-topic-msgram_mpm-v6-2-682e4855b7e2@linaro.org> References: <20230328-topic-msgram_mpm-v6-0-682e4855b7e2@linaro.org> In-Reply-To: <20230328-topic-msgram_mpm-v6-0-682e4855b7e2@linaro.org> To: Andy Gross , Bjorn Andersson , Thomas Gleixner , Marc Zyngier , Rob Herring , Krzysztof Kozlowski , Shawn Guo , Conor Dooley Cc: Marijn Suijten , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1700922431; l=2753; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=C9jl/qWAOl6wjNdLIwtjlGydPzEtEemM1AEix/NRi+g=; b=QtoC2BFtU8WEQA3FaUGzzwenP8GqsgZoAjavep58j+7Xe7xYs8nBar2m2me6Rpy4DsIoa0wF3 Rm4t4mZXOxaC1SKmjd726QWQTfffqWQ1f0bR+GNiVeYGNpXTX11V9zK X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sat, 25 Nov 2023 06:27:30 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783546552684689147 X-GMAIL-MSGID: 1783546552684689147 The MPM hardware is accessible to us from the ARM CPUs through a shared memory region (RPM MSG RAM) that's also concurrently accessed by other kinds of cores on the system (like modem, ADSP etc.). Modeling this relation in a (somewhat) sane manner in the device tree basically requires us to either present the MPM as a child of said memory region (which makes little sense, as a mapped memory carveout is not a bus), define nodes which bleed their register spaces into one another, or passing their slice of the MSG RAM through some kind of a property. Go with the third option and add a way to map a region passed through the "qcom,rpm-msg-ram" property as our register space. The current way of using 'reg' is preserved for ABI reasons. Acked-by: Shawn Guo Signed-off-by: Konrad Dybcio Reviewed-by: Bryan O'Donoghue --- drivers/irqchip/irq-qcom-mpm.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/irqchip/irq-qcom-mpm.c b/drivers/irqchip/irq-qcom-mpm.c index 7124565234a5..7115e3056aa5 100644 --- a/drivers/irqchip/irq-qcom-mpm.c +++ b/drivers/irqchip/irq-qcom-mpm.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -322,8 +323,10 @@ static int qcom_mpm_init(struct device_node *np, struct device_node *parent) struct device *dev = &pdev->dev; struct irq_domain *parent_domain; struct generic_pm_domain *genpd; + struct device_node *msgram_np; struct qcom_mpm_priv *priv; unsigned int pin_cnt; + struct resource res; int i, irq; int ret; @@ -374,9 +377,21 @@ static int qcom_mpm_init(struct device_node *np, struct device_node *parent) raw_spin_lock_init(&priv->lock); - priv->base = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(priv->base)) - return PTR_ERR(priv->base); + /* If we have a handle to an RPM message ram partition, use it. */ + msgram_np = of_parse_phandle(np, "qcom,rpm-msg-ram", 0); + if (msgram_np) { + ret = of_address_to_resource(msgram_np, 0, &res); + /* Don't use devm_ioremap_resource, as we're accessing a shared region. */ + priv->base = devm_ioremap(dev, res.start, resource_size(&res)); + of_node_put(msgram_np); + if (IS_ERR(priv->base)) + return PTR_ERR(priv->base); + } else { + /* Otherwise, fall back to simple MMIO. */ + priv->base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(priv->base)) + return PTR_ERR(priv->base); + } for (i = 0; i < priv->reg_stride; i++) { qcom_mpm_write(priv, MPM_REG_ENABLE, i, 0);