Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp222330ybh; Fri, 13 Mar 2020 20:45:20 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvUQ7bDCrHmf2HWlVVJnpQC79KYi0QEG9eXeVdmxweCe2l7DyTqY85oVUSm8EzF3ok8nH/l X-Received: by 2002:a9d:66d9:: with SMTP id t25mr14402814otm.92.1584157520358; Fri, 13 Mar 2020 20:45:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584157520; cv=none; d=google.com; s=arc-20160816; b=G4lRft/pL4g5NQ9blvBW24PX6nkdiT4E4oBTymLZgCRbdAdKI3fqXGiiqayofkApDk akM5y5psIZryVfWh9cOdR7CqS4oM7nHgkCpdPBJZROiWo2Uxze9Y3asw4uijqFCefjS2 6cYS/9riNQAbCfsX4WqSI4ldk+zxyaXg9WnPZCG6GDoB8HGS1WS7A947uO7KDVGExaNE x6nmOXDUa5erN9qW3mWHgqW/nXnZb4P94jhOOMzSFWhcPjGahAsnTDKfo6wLVTxeHs3Y jvLj7ahqhVM/VgNdFFmu9ae77FKVEO5SoTGJUc7s76EI7Fk6U+2681PSSLltdOkqC4fv 3YhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=vu9bmivABskFMfuXtcUNBisiflTv/1IEa+46DVSsYNM=; b=aOcxtx0hN4ENkUtOAq6cjqmaDkP61AfQBaHDahmUJQ5GGk5JxjR3km9dpoHIOVJ6M5 BqYCCBQOmoSuV7zE7QBt5RqfzQ1FaT+VpeD292fiXp2OsaMUZCUHL2NgY0fEh7Y4Cki2 LSlqXAQqUxEaFSATS5L1TtS6/CwfXNx/XMYc+4LzziX+DrvC/NtRoP9oJuVobUwbGZ3F 0UfmKOqiSHieBMIZU9Ar6KnMd+ujLK2Cf84TmiDiXYNh0HGgdw8k+jtPLTarVLtibS1Y 2t5rUbfkGbgv/soTEFtvgsUtGMW0wmF/C3QD1kVBiQtJved9Ge5ElfxjH/Z6m9u1Uxef y7zA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1si5291277ois.18.2020.03.13.20.45.08; Fri, 13 Mar 2020 20:45:20 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726740AbgCNDop (ORCPT + 99 others); Fri, 13 Mar 2020 23:44:45 -0400 Received: from inva020.nxp.com ([92.121.34.13]:60668 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726399AbgCNDon (ORCPT ); Fri, 13 Mar 2020 23:44:43 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 07EAE1A196A; Sat, 14 Mar 2020 04:44:40 +0100 (CET) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 339D01A16FC; Sat, 14 Mar 2020 04:44:30 +0100 (CET) Received: from titan.ap.freescale.net (titan.ap.freescale.net [10.192.208.233]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id B1BA9402D8; Sat, 14 Mar 2020 11:44:18 +0800 (SGT) From: Xiaowei Bao To: Zhiqiang.Hou@nxp.com, Minghuan.Lian@nxp.com, mingkai.hu@nxp.com, bhelgaas@google.com, robh+dt@kernel.org, shawnguo@kernel.org, leoyang.li@nxp.com, kishon@ti.com, lorenzo.pieralisi@arm.com, roy.zang@nxp.com, amurray@thegoodpenguin.co.uk, jingoohan1@gmail.com, gustavo.pimentel@synopsys.com, andrew.murray@arm.com, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org Cc: Xiaowei Bao Subject: [PATCH v6 02/11] PCI: designware-ep: Add the doorbell mode of MSI-X in EP mode Date: Sat, 14 Mar 2020 11:30:29 +0800 Message-Id: <20200314033038.24844-3-xiaowei.bao@nxp.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20200314033038.24844-1-xiaowei.bao@nxp.com> References: <20200314033038.24844-1-xiaowei.bao@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add the doorbell mode of MSI-X in DWC EP driver. Signed-off-by: Xiaowei Bao Reviewed-by: Andrew Murray --- v2: - Remove the macro of no used. v3: - No change. v4: - Modify the commit message. v5: - No change. v6: - No change. drivers/pci/controller/dwc/pcie-designware-ep.c | 14 ++++++++++++++ drivers/pci/controller/dwc/pcie-designware.h | 12 ++++++++++++ 2 files changed, 26 insertions(+) diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/controller/dwc/pcie-designware-ep.c index 58d8556..44ece33 100644 --- a/drivers/pci/controller/dwc/pcie-designware-ep.c +++ b/drivers/pci/controller/dwc/pcie-designware-ep.c @@ -449,6 +449,20 @@ int dw_pcie_ep_raise_msi_irq(struct dw_pcie_ep *ep, u8 func_no, return 0; } +int dw_pcie_ep_raise_msix_irq_doorbell(struct dw_pcie_ep *ep, u8 func_no, + u16 interrupt_num) +{ + struct dw_pcie *pci = to_dw_pcie_from_ep(ep); + u32 msg_data; + + msg_data = (func_no << PCIE_MSIX_DOORBELL_PF_SHIFT) | + (interrupt_num - 1); + + dw_pcie_writel_dbi(pci, PCIE_MSIX_DOORBELL, msg_data); + + return 0; +} + int dw_pcie_ep_raise_msix_irq(struct dw_pcie_ep *ep, u8 func_no, u16 interrupt_num) { diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h index 00d2d31..cb32afa 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -97,6 +97,9 @@ #define PCIE_MISC_CONTROL_1_OFF 0x8BC #define PCIE_DBI_RO_WR_EN BIT(0) +#define PCIE_MSIX_DOORBELL 0x948 +#define PCIE_MSIX_DOORBELL_PF_SHIFT 24 + #define PCIE_PL_CHK_REG_CONTROL_STATUS 0xB20 #define PCIE_PL_CHK_REG_CHK_REG_START BIT(0) #define PCIE_PL_CHK_REG_CHK_REG_CONTINUOUS BIT(1) @@ -431,6 +434,8 @@ int dw_pcie_ep_raise_msi_irq(struct dw_pcie_ep *ep, u8 func_no, u8 interrupt_num); int dw_pcie_ep_raise_msix_irq(struct dw_pcie_ep *ep, u8 func_no, u16 interrupt_num); +int dw_pcie_ep_raise_msix_irq_doorbell(struct dw_pcie_ep *ep, u8 func_no, + u16 interrupt_num); void dw_pcie_ep_reset_bar(struct dw_pcie *pci, enum pci_barno bar); #else static inline void dw_pcie_ep_linkup(struct dw_pcie_ep *ep) @@ -463,6 +468,13 @@ static inline int dw_pcie_ep_raise_msix_irq(struct dw_pcie_ep *ep, u8 func_no, return 0; } +static inline int dw_pcie_ep_raise_msix_irq_doorbell(struct dw_pcie_ep *ep, + u8 func_no, + u16 interrupt_num) +{ + return 0; +} + static inline void dw_pcie_ep_reset_bar(struct dw_pcie *pci, enum pci_barno bar) { } -- 2.9.5