From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030727AbbJ3UCl (ORCPT ); Fri, 30 Oct 2015 16:02:41 -0400 Received: from mail-bl2on0115.outbound.protection.outlook.com ([65.55.169.115]:49184 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1760113AbbJ3T7O (ORCPT ); Fri, 30 Oct 2015 15:59:14 -0400 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 v2 03/11] staging: fsl-mc: Added generic MSI support for FSL-MC devices Date: Fri, 30 Oct 2015 14:43:29 -0500 Message-ID: <1446234217-25512-4-git-send-email-German.Rivera@freescale.com> X-Mailer: git-send-email 2.3.3 In-Reply-To: <1446234217-25512-1-git-send-email-German.Rivera@freescale.com> References: <1446234217-25512-1-git-send-email-German.Rivera@freescale.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BN1BFFO11FD034;1:4/OlzuO2kOKqeXo+gyTjASckhAhyl9r8vhcy7vjk05XylwiBUThWanlx70KB9deHEu35rK81j8aKQxKZxPG6frSc0bBC2JUKWfjJwXDaNj39V8PI416mvkhkCEDPdfdgUiOrDzV2ulFDZVG6yw3RR0dhVtj0o3dy3nDPVHUsgVMA5FUUsu+f6Xw098iPVV3uA/wvOMIJ+5+VUe8AsimGlAthbRL7A8Q47odNZ8dMBAflFl8KBM5eR8xjslyrs/Xl8X9z99DPshYenxYPp8UWZlDv2GbHTpjCkoY+y0U8BSiLPUDFi4wrWKc564LQ9U3/jprjf1E3WhDLcfUsH+e/79bbiHRd0ZJMDyuJm1lB1C86bQ7Cp2swR+6krVKyFO8FF06dyjbjpOY6/GBO94fKiA== X-Forefront-Antispam-Report: CIP:192.88.168.50;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(11100500001)(229853001)(5007970100001)(6806005)(4001430100002)(105606002)(76176999)(104016004)(50226001)(5001770100001)(50986999)(106466001)(86362001)(5003940100001)(97736004)(81156007)(5001960100002)(19580395003)(85426001)(189998001)(2201001)(107886002)(77096005)(36756003)(47776003)(87936001)(50466002)(92566002)(48376002)(5008740100001)(19580405001)(2950100001)(41533002);DIR:OUT;SFP:1102;SCL:1;SRVR:BLUPR0301MB1636;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;PTR:InfoDomainNonexistent;MX:1;A:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Exchange-Diagnostics: 1;BLUPR0301MB1636;2:nPJcM7FyVpl6x3YnrPgT7iyN9ixwiFaZEvBHQmqThc/aLSsZu+7T9DQ2/4lECE7ot5B8zGeRUOiXTXu6Ih0Sh4tPnc2baPoUGXPPsd4R9WEH1PvXKnVa29IJJIZ6qBPApYv2wk1Br3GYJSSdZ/226obiurUHI8Y9xwW5P28/A3c=;3:1/vRwEGzBNeEogERXxFTg5ERnXr3WxRqqB6b+HZ9NTJIuR367EEnJF8vFuwqjVMKmJqGhoujk+MqFzyTU/Hz+iHQWHzsmSWC7KowJA/wjpbKcinRc4W4q+wVyslJ4wRtAmW+AUudV7qtas84HPTunlAl8yvGmxRKn4qF7Rjf9wbO8I9R4WQRQGd1iNRMDEG12Ms/F0RJlOwQ51PDR/vuRNMP0sg7oNFksYo0RdiJOvc=;25:kf9IIKstOVRnYJZG8om5pc1E7YsI1vaHnpFlxYzbyUVI67z3TU25m8Vn51fzge19ZTxkKS+sqzYAIozNf15e0t2q+jkJ8WH/Bg21Ywmtosd58DFX5SXN8pqqiUslzZ9vVebK4v03ab4kUO3vfoBqk7IluBSkMj8htyd0I0rGVFFLrMuUZ9dz6Y6e9UJAINCBebupQo31u2DY1w8GKsxRNnOA1BeMlcO0bhKd4RHknyrtvseRD7bFCnK0RG97vfdONEZuTrFc7B0muP+j7ac9dg== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR0301MB1636; X-Microsoft-Exchange-Diagnostics: 1;BLUPR0301MB1636;20:3Wi4YtGAYEQKd1K+BBPSZy6GrO9QyGoDVXohSgbpUKX9ZvrY2LDO86DEPrLebj14UyEtPP4nkTRGIKWi0m0cs46ZgMn3ba89zcIIN46IzPNHNNK4//ekbgqWSay3NFoyVJBpAGQRB96AisrpK13os8n4iSkp3Hey1SoBQj4u4UBFo1JaNbvHJnfCzzRGU4zdHuzRv3QNezNJJBXb4pAe+3B6BtHVfo/ca02nvKmUMY4gVRWFHsIFBDg+EOdGwLqDk7Ql8bzCOOM8tQS5hRnXOOOZGN2OYnx96VxKdHYER4B4FBGwoOjB/mglU/nMJwj371LhJLAn4sy3WIRGDmN5oeV8KOjbiM5pRAguxad5n1c=;4:HAybwTAWDHct49wNC0nwwdplg9ImDG/tKYl8stP3fmjz1QkGcceYomEEKDAxK96fj9Tsv5pnRInkUpbYWhvyZXXCbksJAwGKrLRU0iwL7rUK2MbPH4RWB2tIC8407jnNHDaUqch04RW27AGXro3SlA3rgpWuPUdinZA+aku0pi3U5pmKxM3QDWZx+FJhCaOAj2ckEAU95Tn4HOx9/W0WFKynt2Kz0RUuFjDWGoeOTDtVuy6ZAj0CniFBjBiHFR6HaPF7hWcNho5tmfC4NRqu3v4eDf+jIx+RuZFRmjVYhxEc5FPVg9MEqyqf6DCyLjPlOSTfgsjV7AJeKhtQQCtiEwUGvcE8a0EbcvWBd3j3kOrV2/AgBWLB7WrLZ4GqP0sAqH2d/tqnebQWnPFyMO/ZXg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(101931422205132); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(5005006)(8121501046)(520078)(3002001)(10201501046)(102215026);SRVR:BLUPR0301MB1636;BCL:0;PCL:0;RULEID:;SRVR:BLUPR0301MB1636; X-Forefront-PRVS: 07459438AA X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BLUPR0301MB1636;23:YTvKF/IrRdcNgzWX8/fKkzO60e8IEeAur3DYv+l?= =?us-ascii?Q?RCP5eKahsImU7AKddkgl/59BNmU05BYX/ShPOVXsQHzyH9PI5vKqNkLFUfPM?= =?us-ascii?Q?Kjv8AGNDUvsi9W2HpWKfEBmxmcfp/oTCdSO2ft0lJzPTZBL0xnsWNNnUFwVm?= =?us-ascii?Q?DBmXOc2uNbMPS+gHn8tF6T2mrifSL/ctSUtNThLap/vbVMgfbchEY8uw+nL6?= =?us-ascii?Q?/wVgDcXjwbM5Xsd4yvOigGOmCEuP/Eh4ajRd8T0yd3a9W/muSoR0OYdKLjX0?= =?us-ascii?Q?arxwJd4yxRjkwaU2/bvCOh90lBx3SSjJwc0cXwsgK/dtRgyI4lAvCDXK4ro+?= =?us-ascii?Q?hhcAoGEWDTEVlsF3tkNcXbGcMHgQPvcm0ncc48CPWQliaM5M4gmwVOWALHtW?= =?us-ascii?Q?klIWK5OdTxk47KEy72iWxJXOfH0j69t9xk7uwAK1nqX32NpTmSkjFbFGcMi8?= =?us-ascii?Q?46yGtoZEnJ5jruhlmoq5V5bbNMlmloJBipCMqwlbl+Qoes96uUgFO/GJASSZ?= =?us-ascii?Q?R8jFfWdbjBdewTKJBNf/i5ynzDnwR+Ujxf6DVW8P+8yIVk/4GzGFuoQLGoXP?= =?us-ascii?Q?a9gLFywkH3oiTnZSz6RXKS7fzqk96HUxfyfc7Cci5zve9Mz26DosCSpUJm1Z?= =?us-ascii?Q?Y9lfYxhvMdV7gcci7GzWYQW/6tVHiGKp7TAW2E875CS8mbHN9BbDVzjRVbnx?= =?us-ascii?Q?j03pg2TRjJyZCd5Rw121o9tkH2NYLGdHV3GG5hjsENSsRAah3xT010OlQZ9N?= =?us-ascii?Q?Tjp+J5iCD2alWCR3jWgsF+Sql4y0shRUNR4Aooxwj/eHJWzfpvafk8DfBVSA?= =?us-ascii?Q?+/6uIPhK/bcZEqexjNdfbCEVm1Q6qgtZECbzrdC+5r3o7Ixc5M9Y37JYW4e6?= =?us-ascii?Q?Z9BBD5P0KSunbyuqZwMyQ/U3LpuJpsqs7w3EY4DvMvRcPZ5IzrFzbk/wqrYP?= =?us-ascii?Q?GK7+qlBWvdjcuuS/px6TXJBled1QRygof81l8KdQTGl1HhOGplC4gXFJ+f0R?= =?us-ascii?Q?lvAAQOwS5w9ladtjzc18JFfbW69vXZniih4WRpNahfBbHUuSPN3y7ToaoURZ?= =?us-ascii?Q?E8xdQAytoefcFiYz3PNTY3Aq9iN3x4NIO6HxXZyFofGcQfLIstA=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1;BLUPR0301MB1636;5:25WoiVxYiNG3bT3tzlTIRpQVn90pBchDO8bCBhMls3nKrqZFGCAc6PoNCZAGOBcmaiMOE/3ofq7cpPUgPA8Au3P+B+L09QjcIuK6qGoEUK7dlsOMYprWoOez6pCAko/PhJKeA6t/Re2Jx5knv3JpRQ==;24:vAkPpU/kxNDwnN/POc5keZPeAAWPEhxkSoAsccgQtOq6gEdZa+TC43BETjrzvJhR60Liyer0scXOJL3QuCqHadLLStPgp2FDVH43+7vHK58=;20:4ito7yj2Wsi+Pky9Z6JqEVGJps2m58b0OxlMHgaUhXPBEwJofDYWe7lFbIsGjSKJSyW5R1Vrrxq4/+vj35iCtw== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2015 19:59:11.6663 (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: BLUPR0301MB1636 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Created an MSI domain for the fsl-mc bus-- including functions to create a domain, find a domain, alloc/free domain irqs, and bus specific overrides for domain and irq_chip ops. Signed-off-by: J. German Rivera --- Changes in v2: none drivers/staging/fsl-mc/bus/Kconfig | 1 + drivers/staging/fsl-mc/bus/Makefile | 1 + drivers/staging/fsl-mc/bus/mc-msi.c | 276 ++++++++++++++++++++++++++++ drivers/staging/fsl-mc/include/mc-private.h | 17 ++ drivers/staging/fsl-mc/include/mc.h | 17 ++ 5 files changed, 312 insertions(+) create mode 100644 drivers/staging/fsl-mc/bus/mc-msi.c diff --git a/drivers/staging/fsl-mc/bus/Kconfig b/drivers/staging/fsl-mc/bus/Kconfig index 0d779d9..c498ac6 100644 --- a/drivers/staging/fsl-mc/bus/Kconfig +++ b/drivers/staging/fsl-mc/bus/Kconfig @@ -9,6 +9,7 @@ config FSL_MC_BUS tristate "Freescale Management Complex (MC) bus driver" depends on OF && ARM64 + select GENERIC_MSI_IRQ_DOMAIN help Driver to enable the bus infrastructure for the Freescale QorIQ Management Complex (fsl-mc). The fsl-mc is a hardware diff --git a/drivers/staging/fsl-mc/bus/Makefile b/drivers/staging/fsl-mc/bus/Makefile index 25433a9..a5f2ba4 100644 --- a/drivers/staging/fsl-mc/bus/Makefile +++ b/drivers/staging/fsl-mc/bus/Makefile @@ -13,5 +13,6 @@ mc-bus-driver-objs := mc-bus.o \ dpmng.o \ dprc-driver.o \ mc-allocator.o \ + mc-msi.o \ dpmcp.o \ dpbp.o diff --git a/drivers/staging/fsl-mc/bus/mc-msi.c b/drivers/staging/fsl-mc/bus/mc-msi.c new file mode 100644 index 0000000..81b53e3 --- /dev/null +++ b/drivers/staging/fsl-mc/bus/mc-msi.c @@ -0,0 +1,276 @@ +/* + * Freescale Management Complex (MC) bus driver MSI support + * + * Copyright (C) 2015 Freescale Semiconductor, Inc. + * Author: German Rivera + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ + +#include "../include/mc-private.h" +#include +#include +#include +#include +#include +#include +#include "../include/mc-sys.h" +#include "dprc-cmd.h" + +static void fsl_mc_msi_set_desc(msi_alloc_info_t *arg, + struct msi_desc *desc) +{ + arg->desc = desc; + arg->hwirq = (irq_hw_number_t)desc->fsl_mc.msi_index; +} + +static void fsl_mc_msi_update_dom_ops(struct msi_domain_info *info) +{ + struct msi_domain_ops *ops = info->ops; + + if (WARN_ON(!ops)) + return; + + if (!ops->set_desc) + ops->set_desc = fsl_mc_msi_set_desc; +} + +static void __fsl_mc_msi_write_msg(struct fsl_mc_device *mc_bus_dev, + struct fsl_mc_device_irq *mc_dev_irq) +{ + int error; + struct fsl_mc_device *owner_mc_dev = mc_dev_irq->mc_dev; + struct msi_desc *msi_desc = mc_dev_irq->msi_desc; + struct dprc_irq_cfg irq_cfg; + + /* + * msi_desc->msg.address is 0x0 when this function is invoked in + * the free_irq() code path. In this case, for the MC, we don't + * really need to "unprogram" the MSI, so we just return. + */ + if (msi_desc->msg.address_lo == 0x0 && msi_desc->msg.address_hi == 0x0) + return; + + if (WARN_ON(!owner_mc_dev)) + return; + + irq_cfg.paddr = ((u64)msi_desc->msg.address_hi << 32) | + msi_desc->msg.address_lo; + irq_cfg.val = msi_desc->msg.data; + irq_cfg.user_irq_id = msi_desc->irq; + + /* + * DPRCs and other objects use different commands to set up IRQs, + * so we have to differentiate them here. + */ + if (owner_mc_dev == mc_bus_dev) { + /* + * IRQ is for the mc_bus_dev's DPRC itself + */ + error = dprc_set_irq(mc_bus_dev->mc_io, + MC_CMD_FLAG_INTR_DIS | MC_CMD_FLAG_PRI, + mc_bus_dev->mc_handle, + mc_dev_irq->dev_irq_index, + &irq_cfg); + if (error < 0) { + dev_err(&owner_mc_dev->dev, + "dprc_set_irq() failed: %d\n", error); + } + } else { + error = dprc_set_obj_irq(mc_bus_dev->mc_io, + MC_CMD_FLAG_INTR_DIS | MC_CMD_FLAG_PRI, + mc_bus_dev->mc_handle, + owner_mc_dev->obj_desc.type, + owner_mc_dev->obj_desc.id, + mc_dev_irq->dev_irq_index, + &irq_cfg); + if (error < 0) { + dev_err(&owner_mc_dev->dev, + "dprc_obj_set_irq() failed: %d\n", error); + } + } +} + +/* + * NOTE: This function is invoked with interrupts disabled + */ +static void fsl_mc_msi_write_msg(struct irq_data *irq_data, + struct msi_msg *msg) +{ + struct msi_desc *msi_desc = irq_data_get_msi_desc(irq_data); + struct fsl_mc_device *mc_bus_dev = to_fsl_mc_device(msi_desc->dev); + struct fsl_mc_bus *mc_bus = to_fsl_mc_bus(mc_bus_dev); + struct fsl_mc_device_irq *mc_dev_irq = + &mc_bus->irq_resources[msi_desc->fsl_mc.msi_index]; + + WARN_ON(mc_dev_irq->msi_desc != msi_desc); + msi_desc->msg = *msg; + + /* + * Program the MSI (paddr, value) pair in the device: + */ + __fsl_mc_msi_write_msg(mc_bus_dev, mc_dev_irq); +} + +static void fsl_mc_msi_update_chip_ops(struct msi_domain_info *info) +{ + struct irq_chip *chip = info->chip; + + if (WARN_ON((!chip))) + return; + + if (!chip->irq_write_msi_msg) + chip->irq_write_msi_msg = fsl_mc_msi_write_msg; +} + +/** + * fsl_mc_msi_create_irq_domain - Create a fsl-mc MSI interrupt domain + * @np: Optional device-tree node of the interrupt controller + * @info: MSI domain info + * @parent: Parent irq domain + * + * Updates the domain and chip ops and creates a fsl-mc MSI + * interrupt domain. + * + * Returns: + * A domain pointer or NULL in case of failure. + */ +struct irq_domain *fsl_mc_msi_create_irq_domain(struct fwnode_handle *fwnode, + struct msi_domain_info *info, + struct irq_domain *parent) +{ + struct irq_domain *domain; + + if (info->flags & MSI_FLAG_USE_DEF_DOM_OPS) + fsl_mc_msi_update_dom_ops(info); + if (info->flags & MSI_FLAG_USE_DEF_CHIP_OPS) + fsl_mc_msi_update_chip_ops(info); + + domain = msi_create_irq_domain(fwnode, info, parent); + if (domain) + domain->bus_token = DOMAIN_BUS_FSL_MC_MSI; + + return domain; +} + +int fsl_mc_find_msi_domain(struct device_node *mc_of_node, + struct irq_domain **mc_msi_domain) +{ + struct device_node *msi_parent_node; + struct irq_domain *msi_domain; + + msi_parent_node = of_parse_phandle(mc_of_node, "msi-parent", 0); + if (!msi_parent_node) { + pr_err("msi-parent phandle missing for %s\n", + mc_of_node->full_name); + return -ENOENT; + } + + /* + * Look up the fsl-mc MSI domain: + */ + msi_domain = irq_find_matching_host(msi_parent_node, + DOMAIN_BUS_FSL_MC_MSI); + if (!msi_domain) { + pr_err("Unable to find fsl-mc MSI domain for %s\n", + mc_of_node->full_name); + + return -ENOENT; + } + + *mc_msi_domain = msi_domain; + return 0; +} + +static void fsl_mc_msi_free_descs(struct device *dev) +{ + struct msi_desc *desc, *tmp; + + list_for_each_entry_safe(desc, tmp, dev_to_msi_list(dev), list) { + list_del(&desc->list); + free_msi_entry(desc); + } +} + +static int fsl_mc_msi_alloc_descs(struct device *dev, unsigned int irq_count) + +{ + unsigned int i; + int error; + struct msi_desc *msi_desc; + + for (i = 0; i < irq_count; i++) { + msi_desc = alloc_msi_entry(dev); + if (!msi_desc) { + dev_err(dev, "Failed to allocate msi entry\n"); + error = -ENOMEM; + goto cleanup_msi_descs; + } + + msi_desc->fsl_mc.msi_index = i; + msi_desc->nvec_used = 1; + INIT_LIST_HEAD(&msi_desc->list); + list_add_tail(&msi_desc->list, dev_to_msi_list(dev)); + } + + return 0; + +cleanup_msi_descs: + fsl_mc_msi_free_descs(dev); + return error; +} + +int fsl_mc_msi_domain_alloc_irqs(struct device *dev, + unsigned int irq_count) +{ + struct irq_domain *msi_domain; + int error; + + if (WARN_ON(!list_empty(dev_to_msi_list(dev)))) + return -EINVAL; + + error = fsl_mc_msi_alloc_descs(dev, irq_count); + if (error < 0) + return error; + + msi_domain = dev_get_msi_domain(dev); + if (WARN_ON(!msi_domain)) { + error = -EINVAL; + goto cleanup_msi_descs; + } + + /* + * NOTE: Calling this function will trigger the invocation of the + * its_fsl_mc_msi_prepare() callback + */ + error = msi_domain_alloc_irqs(msi_domain, dev, irq_count); + + if (error) { + dev_err(dev, "Failed to allocate IRQs\n"); + goto cleanup_msi_descs; + } + + return 0; + +cleanup_msi_descs: + fsl_mc_msi_free_descs(dev); + return error; +} + +void fsl_mc_msi_domain_free_irqs(struct device *dev) +{ + struct irq_domain *msi_domain; + + msi_domain = dev_get_msi_domain(dev); + if (WARN_ON(!msi_domain)) + return; + + msi_domain_free_irqs(msi_domain, dev); + + if (WARN_ON(list_empty(dev_to_msi_list(dev)))) + return; + + fsl_mc_msi_free_descs(dev); +} diff --git a/drivers/staging/fsl-mc/include/mc-private.h b/drivers/staging/fsl-mc/include/mc-private.h index 2c4cc79..3dabd003 100644 --- a/drivers/staging/fsl-mc/include/mc-private.h +++ b/drivers/staging/fsl-mc/include/mc-private.h @@ -26,6 +26,9 @@ strcmp(_obj_type, "dpmcp") == 0 || \ strcmp(_obj_type, "dpcon") == 0) +struct irq_domain; +struct msi_domain_info; + /** * struct fsl_mc - Private data of a "fsl,qoriq-mc" platform device * @root_mc_bus_dev: MC object device representing the root DPRC @@ -79,11 +82,13 @@ struct fsl_mc_resource_pool { * @resource_pools: array of resource pools (one pool per resource type) * for this MC bus. These resources represent allocatable entities * from the physical DPRC. + * @irq_resources: Pointer to array of IRQ objects for the IRQ pool * @scan_mutex: Serializes bus scanning */ struct fsl_mc_bus { struct fsl_mc_device mc_dev; struct fsl_mc_resource_pool resource_pools[FSL_MC_NUM_POOL_TYPES]; + struct fsl_mc_device_irq *irq_resources; struct mutex scan_mutex; /* serializes bus scanning */ }; @@ -116,4 +121,16 @@ int __must_check fsl_mc_resource_allocate(struct fsl_mc_bus *mc_bus, void fsl_mc_resource_free(struct fsl_mc_resource *resource); +struct irq_domain *fsl_mc_msi_create_irq_domain(struct fwnode_handle *fwnode, + struct msi_domain_info *info, + struct irq_domain *parent); + +int fsl_mc_find_msi_domain(struct device_node *mc_of_node, + struct irq_domain **mc_msi_domain); + +int fsl_mc_msi_domain_alloc_irqs(struct device *dev, + unsigned int irq_count); + +void fsl_mc_msi_domain_free_irqs(struct device *dev); + #endif /* _FSL_MC_PRIVATE_H_ */ diff --git a/drivers/staging/fsl-mc/include/mc.h b/drivers/staging/fsl-mc/include/mc.h index a933291..1c1d6ae 100644 --- a/drivers/staging/fsl-mc/include/mc.h +++ b/drivers/staging/fsl-mc/include/mc.h @@ -104,6 +104,23 @@ struct fsl_mc_resource { }; /** + * struct fsl_mc_device_irq - MC object device message-based interrupt + * @msi_desc: pointer to MSI descriptor allocated by fsl_mc_msi_alloc_descs() + * @mc_dev: MC object device that owns this interrupt + * @dev_irq_index: device-relative IRQ index + * @resource: MC generic resource associated with the interrupt + */ +struct fsl_mc_device_irq { + struct msi_desc *msi_desc; + struct fsl_mc_device *mc_dev; + u8 dev_irq_index; + struct fsl_mc_resource resource; +}; + +#define to_fsl_mc_irq(_mc_resource) \ + container_of(_mc_resource, struct fsl_mc_device_irq, resource) + +/** * Bit masks for a MC object device (struct fsl_mc_device) flags */ #define FSL_MC_IS_DPRC 0x0001 -- 2.3.3