Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758210AbbKGBsp (ORCPT ); Fri, 6 Nov 2015 20:48:45 -0500 Received: from mail-bl2on0101.outbound.protection.outlook.com ([65.55.169.101]:52147 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751708AbbKGBqY (ORCPT ); Fri, 6 Nov 2015 20:46:24 -0500 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=freescale.com; freescale.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none;freescale.mail.onmicrosoft.com; dmarc=none action=none header.from=freescale.com; From: "J. German Rivera" To: , , , CC: , , , , , , , , , , , , , , "J. German Rivera" Subject: [PATCH v3 08/11] staging: fsl-mc: set MSI domain for DPRC objects Date: Fri, 6 Nov 2015 19:30:24 -0600 Message-ID: <1446859827-6927-9-git-send-email-German.Rivera@freescale.com> X-Mailer: git-send-email 2.3.3 In-Reply-To: <1446859827-6927-1-git-send-email-German.Rivera@freescale.com> References: <1446859827-6927-1-git-send-email-German.Rivera@freescale.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11OLC013;1:9E0IXB33B9qRmM4jp9OEdiU1k1bubJIjFG9vRBL8TxS5XQvbOfvnBxj7B1rcCLxj8AF+2aV2tOpFbJ/UEhoYUoRFGMG46Cd6HK3cgg2pNqfMU4OMry04MhyW8U+8MjkdsndlOY27uMfY2fMegj0MWWXxTpNhiZm5eNuYgi5fFVkVZXVkjC3g2jo0vsxXDFy9g/qj0d2+95iFW0aRo4xRUwfQw2vU1EpwWLKB5ZI+HevsRPvHKjhnUbjldgioeB6LcLQULsXSjbgM8y4nic/P3TUkuat+Vg/LaVNL/zoausFRJcPmJvzZI/NoeH38ixkpJZhyvSE1DkdVhOrJmDUNDz7lA3KYaUFjM4CQquphxuw1yjA8rwPvz+UP0xHEJ1IFo1SC4PhYQ3CR30C77J78Hg== X-Forefront-Antispam-Report: CIP:192.88.168.50;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(189998001)(85426001)(2201001)(86362001)(107886002)(5008740100001)(5001770100001)(50226001)(50466002)(105606002)(48376002)(36756003)(4001430100002)(19580395003)(81156007)(47776003)(106466001)(229853001)(5003940100001)(5001960100002)(97736004)(104016004)(5007970100001)(6806005)(2950100001)(87936001)(92566002)(19580405001)(50986999)(77096005)(11100500001)(76176999);DIR:OUT;SFP:1102;SCL:1;SRVR:BLUPR03MB1442;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;PTR:InfoDomainNonexistent;A:1;MX:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Exchange-Diagnostics: 1;BLUPR03MB1442;2:8s2PKCX0xOeNkmP68gJheKUxhj8hcK9/FW6GXIb2DODqoJMcq5nr+WdRNd6v1W6dLEPummZJE+BldVraQYnYkUMKv1GsXIqUbNsK/A3ZHSN5nH4HvU+swnnea4wnWHugjcUAT6J1D7r5tB86VGFbQ1qUg/9BPfirca8Txk/am5c=;3:AxpWdcvuq1jSYXR6rs9d/KEe9jhQ66B9IKLr8Z3P4WqAln31XuMWmVc59YtcfpkQqA1JOI3g7/EFeeh2OhAmDFeUBRs5Q+kuh99UwrL6WGWgvIgaJq0ZpqgbKY6kyZEtl33wHhwp6V9u4ahZ4WGoq+U/Wz0On0OP40ic3shxP0Y/b4kXCPefJpR2+l+T3wL0lAjUDSPxG+YeCd3gBZB8AJacwl/16yKsoXBGbyHkOxM=;25:0moqnA2rGnyjz2O5iIDvqdkU/MbEayrxw5KSA1RnCZHkbQoi8obbqJrEjGVGAmtloqaN1nc2j2bXERHmN4ZLAXSmy0/B2/Nfq9rRo58hul37eSRAX8USmDUxOcCFfX8qgoHWxTGWhBGVK09hIO/dNFn7OLByYdUA82VQxRgvJiWjOIFY3VYuxZKHtizMnYtxSuZxBWjVkANcVeF5P4ckSHDZpl5hrTUcNbLSiH9aPE0aJ4EtDqCBxA36k88fad3Uiyp6++Z60pPlZgy6Ky3fHw== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR03MB1442; X-Microsoft-Exchange-Diagnostics: 1;BLUPR03MB1442;20:NFWSsgjV+1oSfMDh3nuAvln7ZecmjwMrRkY4gK5sLCuUTTSlFGEihwLxIjFBFBaJ1JGudN+cvNgOEOThBXj/54eoMgx4dQU4b9bJDCuUIgxEJh76pP9+svhFedMKBe3acWZAgKoSVRhJvb8zi28A+VJJ6LDkz9NPTuNFz6/RHhcJHBgbH5O1q7rpmW8QzAv2SUrtiWbFvV7mfPjxaeJM4hJWcs+WGrDf1r6t4LPdQxaDIT0Hlopr028ra82S7xQs6OBlKvdz/nVsMJJCFH1lX4EHvD0Msbelx9cUDwz3UHswKygwHcwDcyNro3VeMcAwx4cZO7cwV+Tac3wUk6HCCmC2IUUgVkXuCt2vYuFopUI=;4:8OuoHgYA170Cczsu94ihVP1CbBtIZZoCUqAHtXEWnIwDWK+taLAdWzzJQcpStIWdHD2ioayGVx7+MWUVr4Mp/+ib8E2B3QICcXByTOJL8VbuM3qotub6SjMQv5DTHMYwJKP0V538gK1an74QnvOoet0Dg84b6SMIj+E83m/s/lD+Qn8Tx+k+WFXJHrXgLnXXVvFdaVOcyjTOAgXzkXaWct6Y6RhNY1UFaFGv+BW+ngcp0u/kydziFUJuPsFbU9vbOg6p/VinbKg0P2oTe9SHIvEwM0j1pxLBTgM5EDzbquIgxai8qri9wGuSvTcDkErj75Ff4EATysxOhW9DeXhbgaHX8rCz2zFNk23fbTjxbrIoSzDaKzozTws8mc13QN9D X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(101931422205132); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(520078)(8121501046)(5005006)(10201501046)(3002001);SRVR:BLUPR03MB1442;BCL:0;PCL:0;RULEID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6ckwnOt3xfdyh73a3woDq?= =?us-ascii?Q?sJytfsLLUNrWxLZuktUZ7tPVw9rV45/iTpsMT1fjbR5+f5FWE1/v42AFoNZI?= =?us-ascii?Q?fEIhlPv8W3u4wlQhiq1VfJBzm9/b/1Mr0d1UMCNUkgRnqtdcB53cfPVz29A/?= =?us-ascii?Q?MvtoZ2jYvs0Yiizozznyri/1Ut9yFPw/IdVb6DY9Fljqzq4Bgaw+HWkdFFc8?= =?us-ascii?Q?m07f7WsHsZ0T0w5eyyKm7saKa+PAr/8ncKHHR4/rfz3Q115LjKbMMtoyeTB/?= =?us-ascii?Q?YlzRTxmdP/cL2viAAucWPBQ6Zwb?= X-Microsoft-Exchange-Diagnostics: 1;BLUPR03MB1442;5:VYvx+EufzpjPmMmVKmpc5/JfWnMceCC3kgMSkMz4PzEJXWLIwMffYE9caauWpj1IxfcI9f6sX2JbAtX4651dQHBdXqnUqvMOdINo8s507Ck4g+gPMxXXs/2eI9KLL2Pwf/edT0Z2Z8nFLoEq66i+eg==;24:OSPxpSHkwGjuR5i6lvr1QXUodMfD71bsI+YjkG8uzAJEvF4ypATD6XFiQ/1ULYsSQBifgYltOnUo/IfOLVVt+4S1FYLfnPxM5wfMx0V4t6Y=;20:dePPcGAel8FaRmMX60yqofhgjIUanZ7EVF2t56eqMdJ4d6gq+VMKHVU4/yJgnX1RV+tMCgvS3DFER8FTqbzpuw== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2015 01:46:21.5083 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d;Ip=[192.88.168.50];Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR03MB1442 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3119 Lines: 113 THE MSI domain associated with a root DPRC object is obtained form the device tree. Child DPRCs inherit the parent DPRC MSI domain. Signed-off-by: J. German Rivera --- CHANGE HISTORY Changes in v3: none Changes in v2: none drivers/staging/fsl-mc/bus/dprc-driver.c | 39 ++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c b/drivers/staging/fsl-mc/bus/dprc-driver.c index 3bcd161..455379d 100644 --- a/drivers/staging/fsl-mc/bus/dprc-driver.c +++ b/drivers/staging/fsl-mc/bus/dprc-driver.c @@ -13,6 +13,7 @@ #include "../include/mc-sys.h" #include #include +#include #include "dprc-cmd.h" struct dprc_child_objs { @@ -398,11 +399,16 @@ static int dprc_probe(struct fsl_mc_device *mc_dev) { int error; size_t region_size; + struct device *parent_dev = mc_dev->dev.parent; struct fsl_mc_bus *mc_bus = to_fsl_mc_bus(mc_dev); + bool msi_domain_set = false; if (WARN_ON(strcmp(mc_dev->obj_desc.type, "dprc") != 0)) return -EINVAL; + if (WARN_ON(dev_get_msi_domain(&mc_dev->dev))) + return -EINVAL; + if (!mc_dev->mc_io) { /* * This is a child DPRC: @@ -421,6 +427,30 @@ static int dprc_probe(struct fsl_mc_device *mc_dev) &mc_dev->mc_io); if (error < 0) return error; + /* + * Inherit parent MSI domain: + */ + dev_set_msi_domain(&mc_dev->dev, + dev_get_msi_domain(parent_dev)); + msi_domain_set = true; + } else { + /* + * This is a root DPRC + */ + struct irq_domain *mc_msi_domain; + + if (WARN_ON(parent_dev->bus == &fsl_mc_bus_type)) + return -EINVAL; + + error = fsl_mc_find_msi_domain(parent_dev->of_node, + &mc_msi_domain); + if (error < 0) { + dev_warn(&mc_dev->dev, + "WARNING: MC bus without interrupt support\n"); + } else { + dev_set_msi_domain(&mc_dev->dev, mc_msi_domain); + msi_domain_set = true; + } } error = dprc_open(mc_dev->mc_io, 0, mc_dev->obj_desc.id, @@ -446,6 +476,9 @@ error_cleanup_open: (void)dprc_close(mc_dev->mc_io, 0, mc_dev->mc_handle); error_cleanup_mc_io: + if (msi_domain_set) + dev_set_msi_domain(&mc_dev->dev, NULL); + fsl_destroy_mc_io(mc_dev->mc_io); return error; } @@ -463,6 +496,7 @@ error_cleanup_mc_io: static int dprc_remove(struct fsl_mc_device *mc_dev) { int error; + struct fsl_mc_bus *mc_bus = to_fsl_mc_bus(mc_dev); if (WARN_ON(strcmp(mc_dev->obj_desc.type, "dprc") != 0)) return -EINVAL; @@ -475,6 +509,11 @@ static int dprc_remove(struct fsl_mc_device *mc_dev) if (error < 0) dev_err(&mc_dev->dev, "dprc_close() failed: %d\n", error); + if (dev_get_msi_domain(&mc_dev->dev)) { + fsl_mc_cleanup_irq_pool(mc_bus); + dev_set_msi_domain(&mc_dev->dev, NULL); + } + dev_info(&mc_dev->dev, "DPRC device unbound from driver"); return 0; } -- 2.3.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/