Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp384340imm; Thu, 31 May 2018 02:08:54 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI5LmMa0eDAmVmrR33gjT5weaTOti8Qnpue9rpVGzVmdB7vuYLQSfyVe0F0JECc77Ycspwt X-Received: by 2002:a65:608c:: with SMTP id t12-v6mr4752359pgu.182.1527757734129; Thu, 31 May 2018 02:08:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527757734; cv=none; d=google.com; s=arc-20160816; b=vdEuXaGOCGzB/57p+CkQLYDz5egsz1qKe6WEb1YS4+Obyg8OL9HOs0oZuglepY+NXR a3UmEHehy67GtUMGJjVk3NiDuNQqEmyd4z/RXAGpuT9nYR2yU47DHqi/YfUwIUVFfXjr Vr/JUxWX/J4b5nrgxeegLtpj34m0SSYy3on0bW1P+abHcHtU4EmlRW0yTdobgflXao79 RDap1dYlZWjkSeAOfJRM2Ych5JJfcEGnN7lT/P7Pu8/rByy1GxWagyEFmi/rQxabqEu1 QIlxj3ESUwx9KTXu8mod2S3ELzrzCbGrr5gPvc1w2N1tCnL0NTkbjED87qUUSsBNqvYc IQoQ== 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=0ybLkISD8NweGBohHU3brTGxF93lhz9V4xWlsqpP++RdKTv6ZVxQzvflzCVDR0qCbm 0ABnOJt0jJw8qChCOnXckW0q1M7k6RV4L35GXRtoWqD4Lsshzz/k+cEIFoOPJJdkd24n m0f4cERysxVYgv7X7v9XQ/mtLYokmo/zgdfrj+5MbzX3sVajcEy/ANKAFGSDgJQKF3aj K12nE5kQT4rYD3DahtiQQNG6P6dZVqIBVrMaEFlrrl5/MZ9oUsI2gLLU4Oe9UHuW/9p8 14XiQ+MZJk+8PpKQo54ggDr9Rn4M40BAFN7PtEWiNxojADHz25uxPdroSZeJj/P3dZh9 /KeQ== 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 r17-v6si17098377pls.597.2018.05.31.02.08.40; Thu, 31 May 2018 02:08:54 -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 S1754144AbeEaJHJ (ORCPT + 99 others); Thu, 31 May 2018 05:07:09 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:8215 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754080AbeEaJHF (ORCPT ); Thu, 31 May 2018 05:07:05 -0400 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 273F81BC1EFD9; Thu, 31 May 2018 17:06:51 +0800 (CST) Received: from vm107-55-164.huawei.com (100.107.55.164) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.382.0; Thu, 31 May 2018 17:06:45 +0800 From: Xiaowei Song To: , , , , , , , , , , CC: , Subject: [PATCH v5 1/1] PCI: kirin: Add MSI support Date: Thu, 31 May 2018 17:06:43 +0800 Message-ID: <20180531090643.96810-2-songxiaowei@hisilicon.com> X-Mailer: git-send-email 2.11.GIT In-Reply-To: <20180531090643.96810-1-songxiaowei@hisilicon.com> References: <20180531090643.96810-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