Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp233135imm; Wed, 11 Jul 2018 01:11:14 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdvS6adpsGCeXn7Arc++mj4UFb1mdpxB/fntgXH9JLHUZoOW+cLwgGv0LlCLrkAaGBnDOAB X-Received: by 2002:a63:62c4:: with SMTP id w187-v6mr25520336pgb.55.1531296674068; Wed, 11 Jul 2018 01:11:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531296674; cv=none; d=google.com; s=arc-20160816; b=sjCm1VjgUpVWZQByCN/BuLM5BYNZ5oAA3f6VJohz3sC5kIQeMcQc9YM81xA8pdok0b kS4OeHQOFz+0eGyVgtnvrgZUWf1PmREmfgWvHaLRVQHCflUcbBicPzBIAAXSpFLOn/KN cX9322K1bLWLruzqC4HGsmr56Cn9jhEb1wEkGH7kKAyWWZiWVQXXtWgFmicL661gN49Q Snyu4VLzvyNJhrn0oFXgzVPRDyxCTsV+ovU60ZURbZ6CxNGiGPesa31l54110Q/lP7Mr XzkNthiwFMaoY5IcomAIFo1lTqAFpI3XlbWII31Glo1YxUEXeXkPywUVx2+uGzuZGueH NEGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=2zVskj4gMzjG+KeMaQvMsV9P5Y41EZx2zyUeuokCX54=; b=roATo7E3xHATNaWP3jROSfoIpk02cy68A499h7AXAlqAPaJeaGuQqABuawMueBTaj9 WeHPapbbxJzGHFpLE3iUaoxD9KjE1G0QUZGvbVK5M7qrJs5lH1ZKUGx8qN8Werxr4toV mxtUpv0a52ch82no1MPxUNIh95GLymfBlVoSwT4igPHO4nkXrOAte244PiIVeRwdEM+0 JmSasM3Z4jYewLuE9GxnzPFpUT8lqLlsV9Ryje/Lijq9h7UN6srXRQrBTLFpKomvo4oR mWH7ib4UP8U5A4VUQEe6a+UtSsbtBGTERW6PBt4dIXfkUinm7cozuEaCvoNgNYti8/P7 5MTg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e7-v6si18612554plk.397.2018.07.11.01.10.58; Wed, 11 Jul 2018 01:11:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726843AbeGKIND (ORCPT + 99 others); Wed, 11 Jul 2018 04:13:03 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:38112 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726205AbeGKIND (ORCPT ); Wed, 11 Jul 2018 04:13:03 -0400 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 4B2563DA1EC6C; Wed, 11 Jul 2018 16:09:57 +0800 (CST) Received: from vm107-55-164.huawei.com (100.107.55.164) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.382.0; Wed, 11 Jul 2018 16:09:47 +0800 From: Xiaowei Song To: , , , , , , , CC: , , Subject: [PATCH v7 1/1] PCI: kirin: Add MSI support Date: Wed, 11 Jul 2018 16:09:46 +0800 Message-ID: <20180711080946.14942-2-songxiaowei@hisilicon.com> X-Mailer: git-send-email 2.11.GIT In-Reply-To: <20180711080946.14942-1-songxiaowei@hisilicon.com> References: <20180711080946.14942-1-songxiaowei@hisilicon.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [100.107.55.164] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add support for MSI Signed-off-by: Xiaowei Song Signed-off-by: Yao Chen --- drivers/pci/dwc/pcie-kirin.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/pci/dwc/pcie-kirin.c b/drivers/pci/dwc/pcie-kirin.c index d2970a009eb5..5352e0c3be82 100644 --- a/drivers/pci/dwc/pcie-kirin.c +++ b/drivers/pci/dwc/pcie-kirin.c @@ -430,6 +430,9 @@ static int kirin_pcie_host_init(struct pcie_port *pp) { kirin_pcie_establish_link(pp); + if (IS_ENABLED(CONFIG_PCI_MSI)) + dw_pcie_msi_init(pp); + return 0; } @@ -445,9 +448,34 @@ static const struct dw_pcie_host_ops kirin_pcie_host_ops = { .host_init = kirin_pcie_host_init, }; +static int kirin_pcie_add_msi(struct dw_pcie *pci, + struct platform_device *pdev) +{ + int irq; + + if (IS_ENABLED(CONFIG_PCI_MSI)) { + irq = platform_get_irq(pdev, 0); + if (irq < 0) { + dev_err(&pdev->dev, + "failed to get MSI IRQ (%d)\n", irq); + return irq; + } + + pci->pp.msi_irq = irq; + } + + return 0; +} + static int __init kirin_add_pcie_port(struct dw_pcie *pci, struct platform_device *pdev) { + int ret; + + ret = kirin_pcie_add_msi(pci, pdev); + if (ret) + return ret; + pci->pp.ops = &kirin_pcie_host_ops; return dw_pcie_host_init(&pci->pp); -- 2.11.GIT