From patchwork Tue Dec 15 13:06:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 7854611 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E6EFA9F349 for ; Tue, 15 Dec 2015 13:06:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3B7C920382 for ; Tue, 15 Dec 2015 13:06:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6A1C32035E for ; Tue, 15 Dec 2015 13:06:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932967AbbLONE1 (ORCPT ); Tue, 15 Dec 2015 08:04:27 -0500 Received: from mail-pa0-f51.google.com ([209.85.220.51]:33866 "EHLO mail-pa0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932176AbbLONE0 (ORCPT ); Tue, 15 Dec 2015 08:04:26 -0500 Received: by mail-pa0-f51.google.com with SMTP id wq6so4629050pac.1; Tue, 15 Dec 2015 05:04:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:date:message-id:in-reply-to:references:subject; bh=ijn0P4ANTRLvW/uk7RfXMhKKPksthfoz8Qp3E6R5kH8=; b=gFSWmZcweeRxRQirQILaKULOCFnEzWSMlhN9I9tFlolOaBxB1Ym49kx7FqKAJ8Jusf i2GwApZeZv5Tq2fbWrW5IIaxim8wXHi8/EJocy775/hBe7iZ5VNDdW9NcrOcyTlO8x+Z JfPHR7O65ruPn8RGb5A838eNY+jngpaL77LQN4P9Bcpr26r3dm7Otvi9FkvEo1buPXi+ nKjxocIPxWPBRY42niVfHMYfI0EJQ/X+WYvmyFIzOzThbph95RieLgbGZ4PJbK0rbjBT BDBkLE6NmiCxcIe4tmLbXRBvhN+Efysozt5mIuIP9GF8Ag7feIAe3QG8dB0dt8zmOIk/ 7Qxg== X-Received: by 10.66.246.70 with SMTP id xu6mr7674364pac.77.1450184665757; Tue, 15 Dec 2015 05:04:25 -0800 (PST) Received: from [127.0.0.1] (s214090.ppp.asahi-net.or.jp. [220.157.214.90]) by smtp.gmail.com with ESMTPSA id hz8sm2375841pac.10.2015.12.15.05.04.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Dec 2015 05:04:24 -0800 (PST) From: Magnus Damm To: iommu@lists.linux-foundation.org Cc: laurent.pinchart+renesas@ideasonboard.com, geert+renesas@glider.be, linux-sh@vger.kernel.org, joro@8bytes.org, linux-kernel@vger.kernel.org, horms+renesas@verge.net.au, Magnus Damm Date: Tue, 15 Dec 2015 22:06:04 +0900 Message-Id: <20151215130604.13535.42142.sendpatchset@little-apple> In-Reply-To: <20151215130508.13535.26186.sendpatchset@little-apple> References: <20151215130508.13535.26186.sendpatchset@little-apple> Subject: [PATCH/RFC 06/10] iommu/ipmmu-vmsa: Also use IOMMU_OF_DECLARE() Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Magnus Damm Hook up IOMMU_OF_DECLARE() support. The default case has the use_of_iommu feature disabled so the init order remains unchanged for the default case. Signed-off-by: Magnus Damm --- drivers/iommu/ipmmu-vmsa.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- 0016/drivers/iommu/ipmmu-vmsa.c +++ work/drivers/iommu/ipmmu-vmsa.c 2015-12-15 21:19:31.090513000 +0900 @@ -18,6 +18,8 @@ #include #include #include +#include +#include #include #include #include @@ -36,6 +38,7 @@ struct ipmmu_features { bool has_cache_leaf_nodes; bool setup_imbuscr; bool twobit_imttbcr_sl0; + bool use_of_iommu; }; struct ipmmu_vmsa_device { @@ -891,6 +894,7 @@ static const struct ipmmu_features ipmmu .has_cache_leaf_nodes = false, .setup_imbuscr = true, .twobit_imttbcr_sl0 = false, + .use_of_iommu = false, }; static const struct of_device_id ipmmu_of_ids[] = { @@ -1015,15 +1019,21 @@ static struct platform_driver ipmmu_driv static int __init ipmmu_init(void) { + static bool setup_done; int ret; + if (setup_done) + return 0; + ret = platform_driver_register(&ipmmu_driver); if (ret < 0) return ret; +#ifdef CONFIG_ARM if (!iommu_present(&platform_bus_type)) bus_set_iommu(&platform_bus_type, &ipmmu_ops); - +#endif + setup_done = true; return 0; } @@ -1035,6 +1045,29 @@ static void __exit ipmmu_exit(void) subsys_initcall(ipmmu_init); module_exit(ipmmu_exit); +static int __init ipmmu_vmsa_iommu_of_setup(struct device_node *np) +{ + const struct of_device_id *match; + const struct ipmmu_features *feature; + static const struct iommu_ops *ops = &ipmmu_ops; + + ipmmu_init(); + + match = of_match_node(ipmmu_of_ids, np); + if (match) { + feature = match->data; + if (feature->use_of_iommu) { + of_iommu_set_ops(np, (struct iommu_ops *)ops); + if (!iommu_present(&platform_bus_type)) + bus_set_iommu(&platform_bus_type, ops); + } + } + return 0; +} + +IOMMU_OF_DECLARE(ipmmu_vmsa_iommu_of, "renesas,ipmmu-vmsa", + ipmmu_vmsa_iommu_of_setup); + MODULE_DESCRIPTION("IOMMU API for Renesas VMSA-compatible IPMMU"); MODULE_AUTHOR("Laurent Pinchart "); MODULE_LICENSE("GPL v2");