Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1828124ybl; Thu, 15 Aug 2019 01:50:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqxh84SWb4ZNsqcknGmucD8OsHpE6WFWKBm1RnggeN+xiO+yfAqBmCmCPFCy32nXFb+YHvaW X-Received: by 2002:a17:90a:d151:: with SMTP id t17mr1277311pjw.60.1565859008266; Thu, 15 Aug 2019 01:50:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565859008; cv=none; d=google.com; s=arc-20160816; b=vKocMy8CMQLILlNhJeALVDpSFWm2ICVZ9CYp3oM8mgI0Il8mVwXnEs8I2+QBqRl83B kU/hqB32kc6e5t2rrd8LTEnI3rz7GBOIKz76vDKpNpLvRkpjvhPsn1biG67hkD/TlX16 8gqBtIg6gB9PYLxI7G5yeekFXju9nVfK2489AoMYzs+g86gbvWOpfgiifA1Vq178g8lh qxUctWGP7qHn/oZLnu4fcY5yzcyQgS/MbJJh8j/PnPHiINYz6pP/d9/PXVCXEe7IT0Wp zyZOMaU/acfpmbzpcmIUr1CND1aHR0FgpnaPw+898Yf3DsvhLlk9pbNHUxJIPzxh7SGa nbEA== 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=avJRplmkzhIDC4ywioHw4iCIjFrs8bVUWmuL2wIAbHE=; b=CvHfuJqPmQi68t+AJqRnxlatbu/bYer/lCzah+Dw6sbfGySFA7KZv6pP+WKZCFZFei ibZruiX03nAbyXWhLzzvs4iSiApmidzjkkorQUDwdtTON+uhHxiWh7K/3lFxnxH11Z8X ToHU6paxnesy8kIj8U6Y/IaZttp3kZRxTu9Ty+m3XwJrphA9QLQIhceGiJvEMQSxDmT1 ZqcF3jyHudONE9arklagzwjpeo6Y+2G2aF0I8Dn9Y4s45NM8zjbBy4Us2VVSJrMV1a4u LoGEKvTsRi6G1vPsOPWwHd+PeY+RI72ayfpb4Y1JwJUZFhvG+vCZ7ViF6ytwfVpkJWbz fbkQ== 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 f37si598212pjg.61.2019.08.15.01.49.53; Thu, 15 Aug 2019 01:50:08 -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 S1730912AbfHOIrs (ORCPT + 99 others); Thu, 15 Aug 2019 04:47:48 -0400 Received: from inva020.nxp.com ([92.121.34.13]:59212 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730307AbfHOIrr (ORCPT ); Thu, 15 Aug 2019 04:47:47 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 1AE3D1A0467; Thu, 15 Aug 2019 10:47:45 +0200 (CEST) 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 638CC1A0013; Thu, 15 Aug 2019 10:47:36 +0200 (CEST) Received: from titan.ap.freescale.net (TITAN.ap.freescale.net [10.192.208.233]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 952794030E; Thu, 15 Aug 2019 16:47:25 +0800 (SGT) From: Xiaowei Bao To: jingoohan1@gmail.com, gustavo.pimentel@synopsys.com, bhelgaas@google.com, robh+dt@kernel.org, mark.rutland@arm.com, shawnguo@kernel.org, leoyang.li@nxp.com, kishon@ti.com, lorenzo.pieralisi@arm.com, arnd@arndb.de, gregkh@linuxfoundation.org, minghuan.Lian@nxp.com, mingkai.hu@nxp.com, roy.zang@nxp.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 02/10] PCI: designware-ep: Add the doorbell mode of MSI-X in EP mode Date: Thu, 15 Aug 2019 16:37:08 +0800 Message-Id: <20190815083716.4715-2-xiaowei.bao@nxp.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20190815083716.4715-1-xiaowei.bao@nxp.com> References: <20190815083716.4715-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 EP mode. Signed-off-by: Xiaowei Bao --- drivers/pci/controller/dwc/pcie-designware-ep.c | 14 ++++++++++++++ drivers/pci/controller/dwc/pcie-designware.h | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/controller/dwc/pcie-designware-ep.c index 75e2955..e3a7cdf 100644 --- a/drivers/pci/controller/dwc/pcie-designware-ep.c +++ b/drivers/pci/controller/dwc/pcie-designware-ep.c @@ -454,6 +454,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 2b291e8..cd903e9 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -88,6 +88,11 @@ #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_MSIX_DOORBELL_VF_SHIFT 16 +#define PCIE_MSIX_DOORBELL_VF_ACTIVE BIT(15) + /* * iATU Unroll-specific register definitions * From 4.80 core version the address translation will be made by unroll @@ -399,6 +404,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) @@ -431,6 +438,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