Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3004609imm; Thu, 24 May 2018 20:59:49 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrSTu3hFSCk/UUiK9iyMPNw83xwKl9ox+PfokDLSrTMF0v2Z3xccISFIYJIWrqPsnv68W1R X-Received: by 2002:a65:6031:: with SMTP id p17-v6mr638950pgu.311.1527220789447; Thu, 24 May 2018 20:59:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527220789; cv=none; d=google.com; s=arc-20160816; b=ZGKWcdnc85dMnXJtnEoD6ACjsBqVCTZnIA/PiRAZ0NNdUOvm37oTT6KpdfCZknjPJB cTYJ9+nDQKmoJOlnFsbfxYqIzrdxz1Ujg5nMPDcnoMEh5LdG0np6OrWyg9yST3R/+8ZU 12BMD9gf15lUakd59pMcQ9w+cUEgD0zj/4KKvWYeSUlO0ryn3PfuukH+3Nspa4LkJ23w a/nKJJbeCM80Aphgf+gijQa4qABkEFQvoJoNhDMXZME07g9/QvQnUBoN0SwvrTlUDzjI fODKhJQKhWGlvLTVI3U3Bc5H+2y7OBOLuvXAh12a3YxoagUUTJtUH5cZoa43NOwS3sLM nQzw== 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=IIzBzXaMdacSXVFQ/soNGLcowiALHxEGaIoTTaTlngM=; b=aN3vAeJJYM38gXAgp0tFT7vEBbM3tv9CwnIOlfrNUkUeigZbdpBKA5MKuOrkOuiDaS 0nc7E5y237zoW6miu7+pwWsrxCbg9oayWu0JG3DE8y1mLirYLuvP59Wo31mYY8IjGYRM cyeZXsYV7S8ZzvHn02hhfOoAN5LuH+xC+Hv7NXd81hSQimIpWU0DIxC0f2cLwfAal0t5 S59CDcEY33AqyPHHP9o4RDg436Y/N1dop167gwREAbNDsh5xNhfqPN9WBtY4M8rDqFO/ YvW14PwUIOy7+f/wUl2vcf8X1i0/veHVC+263SXP6sMv23RrXmRHcySZ5sjz0FkEAEy/ PwUg== 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 s14-v6si17480997pgf.640.2018.05.24.20.59.33; Thu, 24 May 2018 20:59:49 -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 S934077AbeEYD7W (ORCPT + 99 others); Thu, 24 May 2018 23:59:22 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:7743 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754696AbeEYD7S (ORCPT ); Thu, 24 May 2018 23:59:18 -0400 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 7B802B37B6993; Fri, 25 May 2018 11:59:04 +0800 (CST) Received: from vm107-55-164.huawei.com (100.107.55.164) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.382.0; Fri, 25 May 2018 11:58:56 +0800 From: Xiaowei Song To: , , , , , , , , , CC: , Subject: [PATCH v5 1/1] PCI: kirin: Add MSI support Date: Fri, 25 May 2018 11:58:55 +0800 Message-ID: <20180525035855.32649-2-songxiaowei@hisilicon.com> X-Mailer: git-send-email 2.11.GIT In-Reply-To: <20180525035855.32649-1-songxiaowei@hisilicon.com> References: <20180525035855.32649-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 --- 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..6997276eb69c 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 ret = 0; + + if (IS_ENABLED(CONFIG_PCI_MSI)) { + ret = platform_get_irq(pdev, 0); + if (ret < 0) { + dev_err(&pdev->dev, + "failed to get MSI IRQ (%d)\n", ret); + return ret; + } + + pci->pp.msi_irq = ret; + } + + return ret; +} + 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