From patchwork Mon Jul 9 11:18:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nipun Gupta X-Patchwork-Id: 10514295 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DFFB96032C for ; Mon, 9 Jul 2018 11:20:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C3BA428ABA for ; Mon, 9 Jul 2018 11:20:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AE6E728AA7; Mon, 9 Jul 2018 11:20:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1FB9228AB2 for ; Mon, 9 Jul 2018 11:20:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932898AbeGILTi (ORCPT ); Mon, 9 Jul 2018 07:19:38 -0400 Received: from mail-eopbgr10045.outbound.protection.outlook.com ([40.107.1.45]:51708 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933207AbeGILTd (ORCPT ); Mon, 9 Jul 2018 07:19:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xfY5RYQhQgu+isysu/060FKeJFwq+ihpMMXav4s+AUE=; b=i1fSEpVgU9pMH2ZH6Dk9iJOUBtKhTGaWLchRPfytQyLdAEANfN4p7OGXJYdx8sUOUeCo1PFOnMBYs3PB9OxJTMsBS9bERLeNd+guzS8c5TjKnD+0161Q6YLOqy5CyObEaEhKYLun46S0VS6dNwXuQouEOatmWxoNsdRwnqJKQLU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=nipun.gupta@nxp.com; Received: from b27504-OptiPlex-790.ap.freescale.net (14.142.187.166) by HE1PR0401MB2427.eurprd04.prod.outlook.com (2603:10a6:3:25::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.930.21; Mon, 9 Jul 2018 11:19:25 +0000 From: Nipun Gupta To: robin.murphy@arm.com, will.deacon@arm.com, robh+dt@kernel.org, robh@kernel.org, mark.rutland@arm.com, catalin.marinas@arm.com, gregkh@linuxfoundation.org, laurentiu.tudor@nxp.com, bhelgaas@google.com, hch@lst.de Cc: joro@8bytes.org, m.szyprowski@samsung.com, shawnguo@kernel.org, frowand.list@gmail.com, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-pci@vger.kernel.org, bharat.bhushan@nxp.com, stuyoder@gmail.com, leoyang.li@nxp.com, Nipun Gupta Subject: [PATCH 5/7 v6] bus/fsl-mc: support dma configure for devices on fsl-mc bus Date: Mon, 9 Jul 2018 16:48:21 +0530 Message-Id: <1531135103-10699-6-git-send-email-nipun.gupta@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1531135103-10699-1-git-send-email-nipun.gupta@nxp.com> References: <1531135103-10699-1-git-send-email-nipun.gupta@nxp.com> MIME-Version: 1.0 X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: BM1PR0101CA0068.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:19::30) To HE1PR0401MB2427.eurprd04.prod.outlook.com (2603:10a6:3:25::24) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a604f963-abf0-49b9-096d-08d5e58dd66e X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(48565401081)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:HE1PR0401MB2427; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0401MB2427; 3:9IAl/R4b27FuSAI/bUQVuhjG7+Oe/hbfHw8HupjtlieAzTKmImvyXsDNZm5UWu74b92Fi65ZXt176yI9cu5mpraIU9vbl8ez4y4GODeinXiaKgNJ4i2OSXH2NeIL604xIEToaaIMRsje1W3q9TdOvn0sRmG9fCTP2ZMsmjPpTF/1tW+2ghNC/bg4aiFY2plN3J7ePcmcuhpiV2wljBtwCOkC1MwGQZ8LqI5d2u1Eb2pJYBv7sYvbIvnlC+65OJgJ; 25:i4OSn+xA0tPfAYAirsKyilt1s3dOVGfDqNbUOiSVgOR/JFCv8GUiTcLxvNQK8c4SX01cD3nJL2Y9o9wJSovOgF5sO5lzHaCCPWLAAq9bqdKPQGxQ64ImEMhvrlDleaJo6iDECLYAjnNvmqW2YB0+5kw2jXu9Z7UabKMfJnQXodYUIsWh7N/2bKLXj2EPSU4DLYP9gOcD4SRpB9lWeEmM9f8586x7DRb/6GiwI/1NlU0ksGkegQ1UiDIgYcRil89mvutRnRbgVVaBLSMdkddtHaluz0kGmQQzDTgDqA+BHxo7uJlJmk6Ga/1J5l7aIKY9bBzdCViEwDoCT9F+/TOVDg==; 31:f2XSYSkDyDbPsNlJg9pm9ZkB55U5xmZ5skGsEpncjjATTBdOti2f/KpRU0gUOtm2QxZr6ZU495IaDBHE9uqqSZwsmGds7o9z2ml9jmmQh5s7rh5hsbbaOW4zYXjjhdXbxlrIkv6leViZFY/zUDA7FAf90VKpE6jyuURhaytpHgGHRMk4mtwk6k0uL0OhsXC39ODh+7PpberdRpD35EMTwtr9EWZxytAf8m0coG4XUaM= X-MS-TrafficTypeDiagnostic: HE1PR0401MB2427: X-Microsoft-Exchange-Diagnostics: 1; HE1PR0401MB2427; 20:B7UbW+9kPl6xY1QXcfLGpsqSCvbn7UXNlGtAS4UcGBr3rExOVtt+/WvL9/EeUVkR7GT+1vapDnpJHkZmhriuOyC4j4p/fv47r90c7gL5y3o1pDLzHXCUm0iR8rzkcHXWpsJTIL7my/NSqQrJvWyHueu27up/ubh+DFeWX9PR17LTvumL8YivY0F7wUUWe2b88enX728J7JRerI8NxiiELczHgL0zIasN6HCaaTKIRzqRr/Gszl4SnR8XncKfIPyvyJewoPDkZ6qkFGATSynet7pc3vWLUhzfwOLHV7VVFsm9wMKkV/ubpD/DKJpiJCGP+vEaVH0GQvcQD7m5mdQ0XJlWoRSNkmsRI4st9Iw3NrY2IEEPhoxLNywFA0bN68+JqlsUAaNjsdpIbot5JgGsnrULlt/vjwvbyXWVpvhl/QdYl44/AIvUOUCOvBLQk+z6pdOj7QmVmA9XwmKpQmcNP66L+yhWIxOzKa2Wqli5Z+NXFMjiFdPTp4tsuw19dSWa; 4:OGcsvGUFTsi3b87YMMw+4g5NLuzd2buXZTq9EUdDwH2ZW0mQLkbK/HM9wOnec9V4aIiRsMsfpcZ8Q46OLljyYLDsEVB/uWuZzCeOj74KBfk9mLGV2RJhjabfsSTugL0hGO5MT85Z7cUWUYjBhUwTYjLsmSY9LkymgcBK9z2QDShb/K4y8ndcYXLeC8eOAkq6yIR4sYRnqWvKJg3U6WULmqFXjyiYzcGMIJm/+qTo5WRaX/swWuIa0O3CRgg61T/+kJMG5f1AgX9R1G/u6cGouH6MytJ6FhF2mvlTOZ8nqTe9oYr9mTNCvSgY2wLB6v8Q X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(3231311)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123564045)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:HE1PR0401MB2427; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0401MB2427; X-Forefront-PRVS: 07283408BE X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(396003)(136003)(346002)(39860400002)(366004)(189003)(199004)(44832011)(446003)(25786009)(51416003)(486006)(81156014)(81166006)(2906002)(39060400002)(6506007)(386003)(50226002)(7416002)(316002)(476003)(4326008)(2616005)(50466002)(11346002)(47776003)(8676002)(66066001)(68736007)(956004)(48376002)(5009440100003)(6486002)(7736002)(76176011)(16586007)(53936002)(26005)(478600001)(55236004)(106356001)(105586002)(5660300001)(186003)(52116002)(305945005)(97736004)(8936002)(16526019)(36756003)(3846002)(6666003)(6512007)(86362001)(6116002)(110426005)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0401MB2427; H:b27504-OptiPlex-790.ap.freescale.net; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR0401MB2427; 23:3uuM8SjT08fKlYSqO60jb5MNNaVJS5HP7+PCFeJ?= =?us-ascii?Q?WZcc4gyA7+FXjEknBkhUmMEji/LB35HtCwsDDL2lUG4yutSGpaXuEkhMdutF?= =?us-ascii?Q?mhnPARbMDF03MpMqqx5A4RWaB3+qxHXJkRlcb5cZpUQud6dFHuTpQloFfP98?= =?us-ascii?Q?LT11ScAkE9GniCi3BCALWg0tM+InTm15UpwsO48M9W1eMKxRJnCjTuTl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nMBDdPM/fxXWWCzpILW+2BH2zhaTYW/RReWVrRcIpEWqmX1yZNvUJ1wnXtSqSN0ieNy+Q53SBhjf5EIUIuddVMULsMjLc2dxGCdWCoLCFyykfxBMM6pBAmqvV5h5SwmxxnbY72YBA==; 5:t9mhjJZMyLY17LMvjt8PJ5bl0hK50rszWWgncSFkLlczAIPjIy7O629ewY3rZrNbNxipAHz7/6nnte3/hHkRVp3IZSoGDBgFsoFzPsp94IK3aDxjkV/s5b3DF0++KoAdxL3nzRyTVVdAV5ia0vNUERgSz7gN/uBOWAF/jVWfmNg=; 24:VZV9zt5KMt7vjSS0IJwQMGAf7lBYO9F00kLrygTh2dPa3v23C7Uwsm34F7kNXK9fzIwwaj52LA7MysrZQZou2C+vSv4xBFOnq7pQKYZVEKA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR0401MB2427; 7:8WMoPMo2wpi0WGee6C+kYUQLF6qV34iVngUsL2XkfrT/V1k1TEnxXcKSpA1KwXXxPooZKOzTH6AJhhJTnzl1+yfAQWt3/VNplsdGd+yeoZtbtLLSQTSpDtRp6FBwQVslMm+cJ8Vc0nFmkqRxjSsUSp2ee35QtHCc00rHhHg/dqokMmdY2QYcp/B81g2Jypp+tcLOZeS5papIegzDV14Kvco4MEDxjYRYRMKUoUXcCoEubNOp+K3e5ZOx553f+AyC X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jul 2018 11:19:25.1094 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a604f963-abf0-49b9-096d-08d5e58dd66e X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0401MB2427 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds support of dma configuration for devices on fsl-mc bus using 'dma_configure' callback for busses. Also, directly calling arch_setup_dma_ops is removed from the fsl-mc bus. Signed-off-by: Nipun Gupta Reviewed-by: Laurentiu Tudor Reviewed-by: Robin Murphy --- drivers/bus/fsl-mc/fsl-mc-bus.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c index 5d8266c..fa43c7d 100644 --- a/drivers/bus/fsl-mc/fsl-mc-bus.c +++ b/drivers/bus/fsl-mc/fsl-mc-bus.c @@ -127,6 +127,16 @@ static int fsl_mc_bus_uevent(struct device *dev, struct kobj_uevent_env *env) return 0; } +static int fsl_mc_dma_configure(struct device *dev) +{ + struct device *dma_dev = dev; + + while (dev_is_fsl_mc(dma_dev)) + dma_dev = dma_dev->parent; + + return of_dma_configure(dev, dma_dev->of_node, 0); +} + static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -148,6 +158,7 @@ struct bus_type fsl_mc_bus_type = { .name = "fsl-mc", .match = fsl_mc_bus_match, .uevent = fsl_mc_bus_uevent, + .dma_configure = fsl_mc_dma_configure, .dev_groups = fsl_mc_dev_groups, }; EXPORT_SYMBOL_GPL(fsl_mc_bus_type); @@ -633,10 +644,6 @@ int fsl_mc_device_add(struct fsl_mc_obj_desc *obj_desc, goto error_cleanup_dev; } - /* Objects are coherent, unless 'no shareability' flag set. */ - if (!(obj_desc->flags & FSL_MC_OBJ_FLAG_NO_MEM_SHAREABILITY)) - arch_setup_dma_ops(&mc_dev->dev, 0, 0, NULL, true); - /* * The device-specific probe callback will get invoked by device_add() */