From patchwork Tue Apr 17 10:21:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nipun Gupta X-Patchwork-Id: 10344707 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 AE17060216 for ; Tue, 17 Apr 2018 10:27:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A9174286A9 for ; Tue, 17 Apr 2018 10:27:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9DB8B28930; Tue, 17 Apr 2018 10:27:49 +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 43260286A9 for ; Tue, 17 Apr 2018 10:27:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752726AbeDQK1X (ORCPT ); Tue, 17 Apr 2018 06:27:23 -0400 Received: from mail-eopbgr50044.outbound.protection.outlook.com ([40.107.5.44]:27520 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751345AbeDQK1Q (ORCPT ); Tue, 17 Apr 2018 06:27:16 -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; bh=1+yxw6S/vp1VSFuGYRtrGi5r7mrmL3b9MhCxyfdDNnA=; b=PC0jqVBDFwERsqMLXgFJ5Ni/q55at+P/9nQP8apxlUWjje7WG7NmtRzozpZ1hbmWN2fu48kT0SAyZs7U6Pi80oZMbftbDSpskDNx5zzXd5RQjzDmNHm1qlk5jwCHKsyxu8Rbee8bRaUNqGGh87+H0VdjydA4i2/nxZbG6SF8pBQ= 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 AM4PR0401MB2418.eurprd04.prod.outlook.com (2603:10a6:200:51::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.12; Tue, 17 Apr 2018 10:27:09 +0000 From: Nipun Gupta To: robin.murphy@arm.com, will.deacon@arm.com, mark.rutland@arm.com, catalin.marinas@arm.com Cc: hch@lst.de, gregkh@linuxfoundation.org, joro@8bytes.org, robh+dt@kernel.org, m.szyprowski@samsung.com, shawnguo@kernel.org, frowand.list@gmail.com, bhelgaas@google.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, laurentiu.tudor@nxp.com, leoyang.li@nxp.com, Nipun Gupta Subject: [PATCH 5/6 v2] bus: fsl-mc: supoprt dma configure for devices on fsl-mc bus Date: Tue, 17 Apr 2018 15:51:53 +0530 Message-Id: <1523960514-25457-6-git-send-email-nipun.gupta@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1523960514-25457-1-git-send-email-nipun.gupta@nxp.com> References: <1520260166-29387-1-git-send-email-nipun.gupta@nxp.com> <1523960514-25457-1-git-send-email-nipun.gupta@nxp.com> MIME-Version: 1.0 X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: MAXPR0101CA0011.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:c::21) To AM4PR0401MB2418.eurprd04.prod.outlook.com (2603:10a6:200:51::23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:AM4PR0401MB2418; X-Microsoft-Exchange-Diagnostics: 1; AM4PR0401MB2418; 3:W+o1OAO4xLCznmYODTmzwlUN1ZgASEEw+fd57yj8UygcDUcMX2ztslh625z98HEKsM3MjSQ5o9wHdCkhhyvBpUilnnyUO619O8injDOyozms6LofOd+Xdd1ibCSmfErqBxAHp2zzaz+UeQIHYNQ4D/BlcCJKWUr9mrzpneb9ppFIS9ofANgA94eFtjkvATj1pYRovSBImQFmJjdpG2srHjxAoCUj6+Q/YUUAz7WZhuCiP8s0DHN43Dvlqn5z1Y5k; 25:KFlnpiy80rvUnuYxWlIyOSsxypcvvCZIMA/8GZtqGuWxd97F4nAU5u7eLWZKowVvnk8YmLngYLaXpdBZHjlZGz+SLOKZ3qnpfZwqrjfYh5yIoymQVDZcT9rWXiuStPuXQhjWexl9LuGusP5N7fmbuyi/VVIHBp3geNCJ6TgazBEcWTjfYSQu5prhTLN2jrWd9IoYpm892eERB6yd4ngSuH8HFOQqAmCmmhI1wLUFvXKDukM3X2Qzu7P6fykx0CP2r67+5ZuERR03Qa+x5etK4r9ZLLgQUXLLxQVxnzCpPaP5+2hI4eMA83PsdDGQpVw7DlYM7zya0RxWpV3ovZQcHw==; 31:QAFiWxk7Gl2G4rFimPr1ie6i1WfDBApTEHBBgOGDtROieyp6hHsc9EyPIMeLbGy/SzBAjcBqA3JD0BkpB0hf2ELvNpnbdNCGiqPo1SpWDfE1VyoLjDTsbL3t04VI0IFZA2Y3hdwl8a/8li80XLeDBpumnlF62L25zeojRDmuyYf72bwaXVlkUsSllYnx8h7OsmZVikzMnfIkyLJTdFw/MTfBJtABaCldq5xPVVpsMuU= X-MS-TrafficTypeDiagnostic: AM4PR0401MB2418: X-Microsoft-Exchange-Diagnostics: 1; AM4PR0401MB2418; 20:h2jTpqb1MWFePpDz+4iTQQ7myEtFqLwhj4ToDyAVTcTm39Oljs8uo+OlKPrcHvc9KDqnVSGG2FcXWXo0k8dr16ecqopJ5IUusGvHP87g9sjharn3d2XsWQNIjeIaeLY0MSVf9iaDaBvYBAK8Z8kpTquP90YDBunq3IgUi2jMLXsuEdloWfgpWSIlJ1gnXlBTdFO0p9HsveEQJlCpD44NQLFJ2vYJzNTqLCtEf6fnCt6mxsgrKF+xIG2BIUsGRSe3ORFeNi6xKi1UpbSNk5IYgxUZ4oNiMZPBTiNkhs5tEj5n87RHVovR4adFCm1LLjKbJHW29X/haRVJYbs6KvBWhe9Tdj6SEEIrJYp9bMOkSoCqtJ7d+gWw+603nICVCzgCcHi4iJp8Toin0v91EQVY0oejMIEpu8K7AH8nnB+JrlyPaNixToWrmkvprT9IiF2MTEvVG+53iDiEaSJnzLQPiC4u8rxk6Cmk14P1ZPuKWlwxBbymzuSLp1a63l73voZd; 4:1VS4qWFXh/+xFNdtOeZZn5uwn83LGunawseiUPkU70bLM30U3Ijos449Xi3H5b0NJ/ZMXSZFLvwkzxawTBTYu0vMAxb1rM4HiUH2pVhTqlVf2yJ/+jExCso6tFd7fVwU+PXxqqB4orWjs9VGLvmjvpyGEqZaz4cTEM/wNIv6oh5pnMWGrCvBuP7SdMrEPDAbXlSPTKdhIZ2EVMCktl+VdgHrqw3pQMaVBHxoBYOjhnkcsvUWOC4as/vp4p42dDlUdfzCwFB04WUNd3LYS657X/YcCC4teYdPKUm3eZg/SsNdxalGUNM4qSB0suEieriS X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231232)(944501359)(52105095)(6055026)(6041310)(20161123562045)(20161123560045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:AM4PR0401MB2418; BCL:0; PCL:0; RULEID:; SRVR:AM4PR0401MB2418; X-Forefront-PRVS: 0645BEB7AA X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(39860400002)(396003)(376002)(39380400002)(346002)(189003)(199004)(6506007)(386003)(2616005)(446003)(11346002)(316002)(486006)(97736004)(956004)(16586007)(76176011)(55236004)(6512007)(186003)(16526019)(44832011)(48376002)(476003)(86362001)(8936002)(7736002)(8676002)(81156014)(81166006)(6116002)(3846002)(2906002)(53936002)(50226002)(66066001)(68736007)(5660300001)(478600001)(25786009)(39060400002)(5009440100003)(4326008)(47776003)(36756003)(106356001)(305945005)(105586002)(51416003)(52116002)(26005)(6486002)(7416002)(6666003)(50466002)(110426005); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR0401MB2418; 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; AM4PR0401MB2418; 23:c3lnA+mhktyW7YstuFm2/BOOsipdelLICy9Y1DP?= =?us-ascii?Q?95lFu3X5PXPu5ibYevhuH/kepM3G8oSwyXjGELp2WhXp8ia8XlAtfkisfzy5?= =?us-ascii?Q?ya/t+hqC0ijV8ILKje1VBhYM8cjCl/1yY04vCGqgKAlvDMnwWwoSurwOzZdd?= =?us-ascii?Q?ufzv11VTwqBMpYrfo63ub0kgs5L9niVwpZfS0gROIBmA2/sYIOGUzw81fD50?= =?us-ascii?Q?+CLPw7+A1riTyR6+a7AthzZBRvKtjmChrOPXs1i5XwD8aHlrO/Nh2L2nK6NP?= =?us-ascii?Q?6M6SLSS4+IbW/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TThQb5C4ZH9dRPb/s=; 24:BfyvmKzoOteXVBdzjPdVQ2E8bVK1BQcRw1Nbr3rNgT2p6R2l56KdOmfSp79m6fTdbVI/nkww1rcm41YQomxcoFLp6LGxQiMhRqZgrD2iGUs= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM4PR0401MB2418; 7:H52bIyTdMNFJTL+dI3YFN7ZSMYeWq6pg4A2Si6VUC8kBoujPU4ZdkZS54epGiwawtD0hdJWp27Ye/DnjAR65CasrEG2rLDDy5+C3I3CM8jzYxZyfJ64EETNcUJ5ShucSeX5ORKUEv46RjeyihFGNopz7NX1IH3k9gfhPA6rba69i9i6bfV/+CYXKQYyEwj8aKrW9fS7HaluUZWnbtMjUvlG3wot9Jr03gL9UK0E69VcZdF2BkLDVSRyqbVejI3Bs X-MS-Office365-Filtering-Correlation-Id: 8982286a-3949-4cbc-ae53-08d5a44dc927 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Apr 2018 10:27:09.0482 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8982286a-3949-4cbc-ae53-08d5a44dc927 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR0401MB2418 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 Signed-off-by: Nipun Gupta --- drivers/bus/fsl-mc/fsl-mc-bus.c | 16 ++++++++++++---- 1 file changed, 12 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..624828b 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); @@ -616,6 +627,7 @@ int fsl_mc_device_add(struct fsl_mc_obj_desc *obj_desc, mc_dev->icid = parent_mc_dev->icid; mc_dev->dma_mask = FSL_MC_DEFAULT_DMA_MASK; mc_dev->dev.dma_mask = &mc_dev->dma_mask; + mc_dev->dev.coherent_dma_mask = mc_dev->dma_mask; dev_set_msi_domain(&mc_dev->dev, dev_get_msi_domain(&parent_mc_dev->dev)); } @@ -633,10 +645,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() */