From patchwork Tue Jan 3 01:09:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 13087060 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 64E4AC3DA7A for ; Tue, 3 Jan 2023 01:11:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=x189NpiZT1QqfNoUFqsHQtVU8hSE4SdCVuLwGnsvI5o=; b=LOPyE+3pWOd5En RfgkHQ5ItBldAENpP1Q55mlCKaKIs5Z1mzjS6QOJ9sK3IcZrxi9WwoiS8yzbRzk4+lDSC14baGZQ9 OBmsd0PYYIUFFDxvuKygZTC0DfyFB/Z2IBsTfRwbt2HObsI3zfRfTEEij3woGpshZZFXxxfckwchD mB9UANB6UM2H23hSZlOSHtEbeNydng7hEalYINZmUyahgdo+pzo5c2qHvTxc5e7H8Yv55NnC7nss3 45KBvXDoWYcNO+gXMtV5hSTMV4Xn0jykB1JVXMsvBr/CHagqpZ4xeqQu7Pqo1p8QlEKqIhA9G/gUG DCw7Hv7k5pO7LwN90M6w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pCVou-00FVVF-VR; Tue, 03 Jan 2023 01:10:25 +0000 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pCVnr-00FVFW-K4 for linux-arm-kernel@lists.infradead.org; Tue, 03 Jan 2023 01:09:21 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 1CA5C320091D; Mon, 2 Jan 2023 20:09:18 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Mon, 02 Jan 2023 20:09:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1672708157; x=1672794557; bh=ez FU4xIsWU9r0j3R9gbsjOutPYOzIkuUPEsZkjIMNUQ=; b=ysFzFO7qoXLTgCeEil UPJ4g+pwrpPLNpTU2ODGVgjy7OznuxvvlHC2pDgGk6nWdoeTAS+6hgH3lQB5QGap W4pcK/KgSq1KVf/8koUZ10R5AtusMvSk0ErGUaFWaS6oCsa1fvnZ68JnLPp0hDJl Yb2USiCorZ7DXkZK+oYu87NZIq1GUGQs0XMhE8cGs7NI1NxRwT/iFqRQe6sz3eni 3gy8EGYQhke+DZvVhng/vqtIvRwG5zaIjJ0c2T6iKts2eux9ZI5sHbGKKF3b1AjX wwYSF5297IK2fe2FhMz+ZCoEkycIjwRBuvUKJ6oundSXoNMBnBqGE4ik3a60mK2U yM2w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1672708157; x=1672794557; bh=ezFU4xIsWU9r0 j3R9gbsjOutPYOzIkuUPEsZkjIMNUQ=; b=qPmEr0jQTznHxX4YH91JJ/Tt1OXoA +SBQ8+YRAeNQHjCf/iICYQ9yJIqN7Fh3W4qHXb43C6whCUjmqapXK2mEFghZpdi6 nvi2nXQCn9eNaLM4aN+qg9uil81boFSCHo1ZjrDA4IJL4vhhS8odo7aR6w+DkgPC U1Cyk18Uy8P46JmFLyIjSbOjbx20dXNvoSdFJ2WqxgdgWyG00m9sxVGR3cTQ3NY3 V8118KLv9X02O2fO15vK8v+2Ex9Bw15pT41JtsPNxd+MF4QoSfMnN7rRD+CWgXeq gwmvVHc1KV+CeX9YPW3uROZO2YRshdNQFEkS30/4SauqWnj1NyjE5xsRw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrjeefgdeffecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpedukeetueduhedtleetvefguddvvdejhfefudelgfduveeggeehgfdu feeitdevteenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhg X-ME-Proxy: Feedback-ID: i0ad843c9:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 2 Jan 2023 20:09:16 -0500 (EST) From: Samuel Holland To: Joerg Roedel , Will Deacon , Robin Murphy , Chen-Yu Tsai , Jernej Skrabec , Krzysztof Kozlowski , Rob Herring Cc: iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Maxime Ripard , Samuel Holland , Philipp Zabel Subject: [PATCH v2 4/6] iommu/sun50i: Support variants without an external reset Date: Mon, 2 Jan 2023 19:09:01 -0600 Message-Id: <20230103010903.11181-5-samuel@sholland.org> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20230103010903.11181-1-samuel@sholland.org> References: <20230103010903.11181-1-samuel@sholland.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230102_170919_728182_EABB3445 X-CRM114-Status: GOOD ( 16.16 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The IOMMU in the Allwinner D1 SoC does not have an external reset line. Only attempt to get the reset on hardware variants which should have one according to the binding. And switch from the deprecated function to the explicit "exclusive" variant. Reviewed-by: Jernej Skrabec Reviewed-by: Philipp Zabel Signed-off-by: Samuel Holland --- (no changes since v1) drivers/iommu/sun50i-iommu.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/sun50i-iommu.c b/drivers/iommu/sun50i-iommu.c index a3a462933c62..d19f6ce25f76 100644 --- a/drivers/iommu/sun50i-iommu.c +++ b/drivers/iommu/sun50i-iommu.c @@ -95,6 +95,10 @@ #define SPAGE_SIZE 4096 +struct sun50i_iommu_variant { + bool has_reset; +}; + struct sun50i_iommu { struct iommu_device iommu; @@ -995,9 +999,14 @@ static irqreturn_t sun50i_iommu_irq(int irq, void *dev_id) static int sun50i_iommu_probe(struct platform_device *pdev) { + const struct sun50i_iommu_variant *variant; struct sun50i_iommu *iommu; int ret, irq; + variant = of_device_get_match_data(&pdev->dev); + if (!variant) + return -EINVAL; + iommu = devm_kzalloc(&pdev->dev, sizeof(*iommu), GFP_KERNEL); if (!iommu) return -ENOMEM; @@ -1037,7 +1046,8 @@ static int sun50i_iommu_probe(struct platform_device *pdev) goto err_free_group; } - iommu->reset = devm_reset_control_get(&pdev->dev, NULL); + if (variant->has_reset) + iommu->reset = devm_reset_control_get_exclusive(&pdev->dev, NULL); if (IS_ERR(iommu->reset)) { dev_err(&pdev->dev, "Couldn't get our reset line.\n"); ret = PTR_ERR(iommu->reset); @@ -1075,8 +1085,12 @@ static int sun50i_iommu_probe(struct platform_device *pdev) return ret; } +static const struct sun50i_iommu_variant sun50i_h6_iommu = { + .has_reset = true, +}; + static const struct of_device_id sun50i_iommu_dt[] = { - { .compatible = "allwinner,sun50i-h6-iommu", }, + { .compatible = "allwinner,sun50i-h6-iommu", .data = &sun50i_h6_iommu }, { /* sentinel */ }, }; MODULE_DEVICE_TABLE(of, sun50i_iommu_dt);