From patchwork Wed Feb 10 01:56:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Duc Dang X-Patchwork-Id: 8267931 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 67E799F1C1 for ; Wed, 10 Feb 2016 02:03:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 85BE2202B8 for ; Wed, 10 Feb 2016 02:03:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7E60B20263 for ; Wed, 10 Feb 2016 02:03:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756280AbcBJCCr (ORCPT ); Tue, 9 Feb 2016 21:02:47 -0500 Received: from mail-pa0-f42.google.com ([209.85.220.42]:35213 "EHLO mail-pa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756223AbcBJCCq (ORCPT ); Tue, 9 Feb 2016 21:02:46 -0500 Received: by mail-pa0-f42.google.com with SMTP id ho8so3484762pac.2 for ; Tue, 09 Feb 2016 18:02:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apm.com; s=apm; h=from:to:cc:subject:date:message-id; bh=HHS7f7/vcKANKZYeo5BuKNyqMILa4HcWQeLaF5SVD+E=; b=D+kVIV1kTnMsE3n8IOvTkxshJgMyL4+p2l/I34XHvChG8k4vU6GP+SjL5O4R8kZmzd fUKX+lG0n22QjgOVs58t0iRpYc3VYks8n1NJCYGH1iKkYIm0ojeAHWnzHCtfw6CrO4Xo wqlaDcpgvFtkgvD0FMZfCsVDhYxDcwBk7OHRk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=HHS7f7/vcKANKZYeo5BuKNyqMILa4HcWQeLaF5SVD+E=; b=K2ShJ0THirqLBL5W37IbnborfLYiMFZzjxsyxZn1IgapAZxyMqCehhvKUDF8lzePPK BNGw9+rHoSInuKM4jmwIG/8usLI/22NVCXa3YPHVEP3rFZ6gu5+QXWnkEHNRdQMCjk+y Lkczg3d/g52v0JslouK9fsluuFE8WVGqnDsdpokSNfUDIhkIM1GyTem/TKiItzrWwLc1 8s12lbY/5WQtvok1vPDr+nhMcld87dIw4MwvTo9r4XtaVPysHwmuyCzb0IxqgOcqFVdv mkEa7+wVOmoy4sJXbu7eei3MhTmoMu8CJfBTBzdlDNsoWv9o9SAmlLEDvx6Fj94DTSHv +3UA== X-Gm-Message-State: AG10YOT1XNRa2/kl17iMGBfHLGfe+73XCSceMgm5GZfBlea3Psclzns3dZvxts6rH7OCxCRh X-Received: by 10.66.159.38 with SMTP id wz6mr55048170pab.12.1455069766408; Tue, 09 Feb 2016 18:02:46 -0800 (PST) Received: from dhdang-Precision-WorkStation-T3400.amcc.com (70-35-53-82.static.wiline.com. [70.35.53.82]) by smtp.gmail.com with ESMTPSA id yh5sm689545pab.13.2016.02.09.18.02.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 09 Feb 2016 18:02:45 -0800 (PST) From: Duc Dang To: Bjorn Helgaas , Marc Zyngier Cc: linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Tanmay Inamdar , Loc Ho , Feng Kan , patches@apm.com, Duc Dang Subject: [PATCH] PCI/MSI: pci-xgene-msi: Enable MSI support in ACPI boot for X-Gene v1 Date: Tue, 9 Feb 2016 17:56:24 -0800 Message-Id: <1455069384-22323-1-git-send-email-dhdang@apm.com> X-Mailer: git-send-email 1.9.1 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch makes pci-xgene-msi driver ACPI-aware and provides MSI capability for X-Gene v1 PCIe controllers in ACPI boot mode. Signed-off-by: Duc Dang Acked-by: Marc Zyngier --- drivers/pci/host/pci-xgene-msi.c | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/drivers/pci/host/pci-xgene-msi.c b/drivers/pci/host/pci-xgene-msi.c index a6456b5..466aa93 100644 --- a/drivers/pci/host/pci-xgene-msi.c +++ b/drivers/pci/host/pci-xgene-msi.c @@ -24,6 +24,7 @@ #include #include #include +#include #define MSI_IR0 0x000000 #define MSI_INT0 0x800000 @@ -39,7 +40,7 @@ struct xgene_msi_group { }; struct xgene_msi { - struct device_node *node; + struct fwnode_handle *fwnode; struct irq_domain *inner_domain; struct irq_domain *msi_domain; u64 msi_addr; @@ -249,6 +250,13 @@ static const struct irq_domain_ops msi_domain_ops = { .free = xgene_irq_domain_free, }; +#ifdef CONFIG_ACPI +static struct fwnode_handle *xgene_msi_get_fwnode(struct device *dev) +{ + return xgene_msi_ctrl.fwnode; +} +#endif + static int xgene_allocate_domains(struct xgene_msi *msi) { msi->inner_domain = irq_domain_add_linear(NULL, NR_MSI_VEC, @@ -256,7 +264,7 @@ static int xgene_allocate_domains(struct xgene_msi *msi) if (!msi->inner_domain) return -ENOMEM; - msi->msi_domain = pci_msi_create_irq_domain(of_node_to_fwnode(msi->node), + msi->msi_domain = pci_msi_create_irq_domain(msi->fwnode, &xgene_msi_domain_info, msi->inner_domain); @@ -265,6 +273,9 @@ static int xgene_allocate_domains(struct xgene_msi *msi) return -ENOMEM; } +#ifdef CONFIG_ACPI + pci_msi_register_fwnode_provider(&xgene_msi_get_fwnode); +#endif return 0; } @@ -473,6 +484,13 @@ static const struct of_device_id xgene_msi_match_table[] = { {}, }; +#ifdef CONFIG_ACPI +static const struct acpi_device_id xgene_msi_acpi_ids[] = { + {"APMC0D0E", 0}, + { }, +}; +#endif + static int xgene_msi_probe(struct platform_device *pdev) { struct resource *res; @@ -494,7 +512,17 @@ static int xgene_msi_probe(struct platform_device *pdev) goto error; } xgene_msi->msi_addr = res->start; - xgene_msi->node = pdev->dev.of_node; + + xgene_msi->fwnode = of_node_to_fwnode(pdev->dev.of_node); + if (!xgene_msi->fwnode) { + xgene_msi->fwnode = irq_domain_alloc_fwnode(NULL); + if (!xgene_msi->fwnode) { + dev_err(&pdev->dev, "Failed to create fwnode\n"); + rc = ENOMEM; + goto error; + } + } + xgene_msi->num_cpus = num_possible_cpus(); rc = xgene_msi_init_allocator(xgene_msi); @@ -571,6 +599,7 @@ static struct platform_driver xgene_msi_driver = { .driver = { .name = "xgene-msi", .of_match_table = xgene_msi_match_table, + .acpi_match_table = ACPI_PTR(xgene_msi_acpi_ids), }, .probe = xgene_msi_probe, .remove = xgene_msi_remove,