Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932749AbbKXWs3 (ORCPT ); Tue, 24 Nov 2015 17:48:29 -0500 Received: from mail-by2on0136.outbound.protection.outlook.com ([207.46.100.136]:58880 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755410AbbKXWsW (ORCPT ); Tue, 24 Nov 2015 17:48:22 -0500 Authentication-Results: spf=permerror (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 RESEND v3 08/11] staging: fsl-mc: set MSI domain for DPRC objects Date: Tue, 24 Nov 2015 16:31:21 -0600 Message-ID: <1448404284-22258-9-git-send-email-German.Rivera@freescale.com> X-Mailer: git-send-email 2.3.3 In-Reply-To: <1448404284-22258-1-git-send-email-German.Rivera@freescale.com> References: <1448404284-22258-1-git-send-email-German.Rivera@freescale.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11FD024;1:RvrJa9N4vFwE3kXxRT5x/JtQKbFPS0jdpiOhE332r4Cw+AHSX7ELHo95FOdrLrGjqll36tnmYHyFU8C1oM8fDZhBQoVPiwzMYsLWbaWCMu5q40RkL1Cdx9UrQYRt0BOT6ka501AiGTa6zljOxcQ0rpnbdXjakPbtivlBVmb96V2HJ6uJb6y/DnAO4IWVkEcgq2qtr8a7JUKj7DFY/XJ0fmVmWJnfVwUigp3fWW/H1LSOJVCZ1M/FrWjoJr58z9gC5FWRAU1wrYhGTNfWyQYIZd6Vwu5phMLikWoiudHFX38MVej18K56y8Odl3JB+mhTOTDGqFQk22yh1rUd5kYwKptuffFNO1mMchet1Ku+dtHGpJhxQgbRiB9ayRR/nvCU8EMRA5vrVCVf5fVSp+/RKJEqTX7FdAtdF4n+rtJkx3ykhCHdRwNmzLczA1AoMIybF9YdVBOG2SCBthgqijU+qQ== X-Forefront-Antispam-Report: CIP:192.88.168.50;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(2980300002)(448002)(3190300001)(189002)(199003)(11100500001)(4001430100002)(50986999)(76176999)(50466002)(5007970100001)(86362001)(50226001)(87936001)(106466001)(2950100001)(85326001)(36756003)(189998001)(229853001)(5001960100002)(77096005)(2201001)(107886002)(48376002)(5008740100001)(6806005)(5001770100001)(97736004)(19580405001)(19580395003)(104016004)(5003940100001)(47776003)(92566002)(81156007)(586003)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:BY1PR0301MB1301;H:tx30smr01.am.freescale.net;FPR:;SPF:PermError;PTR:InfoDomainNonexistent;MX:1;A:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Exchange-Diagnostics: 1;BY1PR0301MB1301;2:MOsH54xzg727/eArJkgHpl5D7eRKdEuwMf0BXL6NI7wBxGGkjWM3GGi0DiB5BWpLjzOCLjC6xiy002VpiHz0+BdOZETRrUKFqLG92EdlUQKxF+0e5Zx/sUv9gq2i2IZ3MJlARGiFjsfe6gtCA9rh7w==;3:SY58rDK62yhlaDJq6fKmBYfMR3ioFlFfq8DZnZEixYQJK8n0Uyfv1IKly6hWEXdKz0uiWU8Wq9zo8cLCgfhrYuSj93g0BS3v3NzU/9Wj0rohEqWE8HSy0zg2glFJtzhbv5N8+gp5/wzYLgr3pSoZnKhTCuH65lg0/DScwq4hjD2/doKznQfzLeFb0VtdtMNEy8Eb7N7B4rVqzck4qE0UlbfjDhDywLbHV8lWdW6Uj+A=;25:vLHbNwo7Br3D9qas1iMKopfCO5z1zYwTGU+mkb3vz6MxQcdICBKNkWBC0+xd95JN4ZarpC8jVgOnsPSSswH78ihbgae7DC4j08vahOHS/LU6QyloAISXTNkf0t5jIvikHnKVyhMxN7HbfVmyVxTUdmqgrRtjbTwh3XXWAbqsHFS8aXfEWYkWZSXQdsIiBgEqU58TBaFr1afFCYd6wKZ+yxlVWLt755j2oC8p2bmVv0pvGyXJAGKqSgNZU08If5nBnTDEb8moJP/J3Yu9snxosA== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0301MB1301; X-Microsoft-Exchange-Diagnostics: 1;BY1PR0301MB1301;20:RnA0C0QWlTdflk1MbPMqFuQS4x6A9nCmdG0hyukUVZXx387D77FRopMg0gHq9djRySzQgzxJO2Gx7Wb+HzlzDBzP00kOKs2BVlnecfCLHeLMTu70Q/FoW7eV7xx+jU0bGpA+IO2YJg38dPYLy6qFUEIw65nBWbXg/OX0vx/aGxkc33IX4Q/sV+eK+pejV88DjPk6fiA6YTkAuHumbpzNf2LsaU/GoIdQKY3d55FoxwSfB3d+xpSH0dufcThfr6RwBH7bsqSYgZQ0oWGs6UICImdpXGJE/wSLEYA5xoNAJfMJCh5BMA8DcjvIMXRIRCCafbS9XWiPWrHnLMtfjIj8o8YAYFPWGYIDKiep+nBV6bE=;4:oz60X+ua+6stijyZLEx3pLvxICODJHFm54Eay5D0iMM3yBFd4rKbBjZWRusfTJg01E9CkSQlZua+jmDzwPQXRiFC4Iqw6iq/CbmxPYxpBw/ygkN7lAeEOp1xOP7yNf8yPu0IfY8t2tFACJbh3TVM1+/2mn3auqff+6wK9e2Y2HUQYmMutBQRdupkU5R1R3MUs5ZBtx4MhP6z0sRYPKzdENex3T/XpSyPyAwDO/Tqiuz2VntiYmhhVEFb6fFj5DoeXTQAA27fv/OhEBV3GLXRS8Qw+JzXjXLKJPgQ/h4/Dh/3Tgg98Ix9ewtSjP+1G1m07X+BZuaaay2PjjPSyiqSNYO/XvLoucli4jqA5sC+1nEYShj2r/EJiUbXlWSEHW3PowfvcPj59T/AUDZTI2+YvA7u6MY7+xAGb/aHJJaEZUzTLTYKNgTCXMSjMjg8uAcx X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(101931422205132); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(8121501046)(5005006)(520078)(3002001)(10201501046);SRVR:BY1PR0301MB1301;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0301MB1301; X-Forefront-PRVS: 0770F75EA9 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BY1PR0301MB1301;23:UZi4rHDv5IAExzJN9x3ySKDCvdIY2zxZl02Rkck?= =?us-ascii?Q?hrZqHsDfguqt5HKhk8hu1VX1Dxe4Ei2QQHC05voxlzvVp66CpPRKf1yJHBc8?= =?us-ascii?Q?axcSPrnLLlLKG/aweW2VzsKAJMcOaeYSt8RuW0Nme6lRoW6e3IEsOLESgoIk?= =?us-ascii?Q?JOhqvJ7/OWMyH0G4vUeZmUY72H9GVvaltVF63G+Zmy+WmomZOxsFwvmYwiGq?= =?us-ascii?Q?LNB6vxavKTn1LH14eft6TFc9tFmtflE0yK6NpI7EsCA6eL+9KGLuTd6RHSxV?= =?us-ascii?Q?QswEd3DjhUTxyHn1bynYN9SIMS/mIZo9dOkek5xorDSGdyRWp/prktImdpYc?= =?us-ascii?Q?ib9dhuMVKZsQgd+kzygzQAtpwE/xrKugfCHR6rxqDS9Y1MslJa7hi2JKB9Ti?= =?us-ascii?Q?7SsWypROpDpK9jtPtZ2IGUH5L4M5gi5+0HZIqexANTnew9IBYqlYzdN74Xzu?= =?us-ascii?Q?yEpuxU8ULHr7h3LZ5U3OGl/sdGGaIYLmLj6QIqU5m5n4crX3AAghIAOhcUud?= =?us-ascii?Q?+2xHuhyscfVoYpk4dHoX+CKn8tBB822wJS3FNjSJbOgZm/4nUz/vpaOnyA8F?= =?us-ascii?Q?kWCvk0Zc0XPujJV0KhTTCSFqdwrAA2wZ17+dlg594Unh6splLVaY3RD4c+Tv?= =?us-ascii?Q?kGWxS4t1dfk7ojwbH+2zyi++QdPBM0Yk66y8UModkIeBTR8J1chw/e5vB0yx?= =?us-ascii?Q?HsQNX12341QBgZ5/oPyPQNVB38ZIU3VHbtC/W3LBjsc2+fRI+scaIwAntm4J?= =?us-ascii?Q?QoKL+j1mW8QwtD3y544MRPohD/syHRE1cRwdZifwzmkOFDAEil3V4JZaO25E?= =?us-ascii?Q?qFzYpgARaFYtBxFtzEZVaUH0pVVCDWtCIYCXMNZzIU6RLoQ96JdTxGIJT5J8?= =?us-ascii?Q?l/aF1SIMQDacvfz5MRGuK65l7NkgKU/5UUggroFiC6wL2esWBLSnbY/aExTF?= =?us-ascii?Q?dHmZdJ+948XFsnqqiqyTy2nkSZNk3LXjnq4+qC3mxhFOq4Lj3dUSSwQNggNa?= =?us-ascii?Q?myB6Xbmc0+6YF0dD21xWrz+50uVlWrfsdjXctLqyO40e41Ltxw4l6+cLRr7G?= =?us-ascii?Q?Pob/XYtRLbnMOcxuorU5IcUhQCYoP?= X-Microsoft-Exchange-Diagnostics: 1;BY1PR0301MB1301;5:MEZVJg2Q80RnVgqnR134ALtHeboPQg7o+IrzPwOvR7VHNN/TIlXtMdWDNYmf0d1iPIwW6AgR0pI7Df2ucFzxcSL+hmlVTgaqMTjbptBj7GfnW9+mZv8pVjHQRBV/s6JV0PPet82nGj6p5IU5jJVk0w==;24:65dZeHKjEYojL8JuVWiH06tKDipjFFP4Bq/nr5izNgF5FUk3VdyZRHfHap3HrcHq5G8fO7ynUZ1M5q7VrTo615YZHijGZfe1tDV77mztsjo= X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Nov 2015 22:48:03.5732 (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: BY1PR0301MB1301 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 ef1bb93..6d83035 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/