From patchwork Thu Jun 18 08:38:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kunihiko Hayashi X-Patchwork-Id: 191090 Delivered-To: patch@linaro.org Received: by 2002:a54:30ca:0:0:0:0:0 with SMTP id e10csp1125989ecs; Thu, 18 Jun 2020 01:39:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdVFD4uXkmmfi4Z8UxUvuMyR6aDAWKqfDiANMR9NDo55GVqITLlhqLMUcxITlvPcEVyZ/G X-Received: by 2002:a05:6402:1243:: with SMTP id l3mr3190318edw.64.1592469541683; Thu, 18 Jun 2020 01:39:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592469541; cv=none; d=google.com; s=arc-20160816; b=OSE3qAM0lTxIEWAD6aKaYf6HMMDG/mIqzdlLblnh2KBFqXI/V7/N7xcItmj5R1fiSM P3ytIRG4VO6F+hCSXpUfzNxa1Buiv8ZPNmGjlHuDFOG9VFkZ3ftyEHHCyQxMy1YjBd7N LiXh2IJTBlzrVAsB7OKIvNgn0yMU52pgeYM3fKF3Oad5nxVECysiUcPEoAQGfGlfDtdJ vM84wrEemu4vieZaKbA0vZwetD6x9S/pshv2Ueb7gZKGKsPkxfrhiDBbkZ8dGQDfWz6f Bbbm4idfIy/1kUJh3o9zqvw0i4aIgxVKrOzQrRPPhNmcwf5ePSXMTj0bQUVs2tVdMY5a PNnQ== 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=iNyGXIz9dONTOXOlMLSYb2cRqQEeEfLk2q00wmZ33oo=; b=vQZYF6rCvVPDWyktdhU6Zp3aIzSGNEFPFOorjXwsExUXtWWkxqE9hXwHLGrsWDnjHV INBwzKh04lSd9ERv3wbYB+zsEHislz4rIEA7ama9GHz6RKrJq6qFRQXLFNoriJ4kipgG jk7qcv0BerSsvmBZLVXJxaOnHHp6+wPfOT5szFPV7wjrBVsOhRH3WwClNlnAYDyEET21 jikQa0NW9WaNYZggX6IeAYP0a8kr2toCSV33wjLw0BzO3xb+KkQXjai5sACDvOl769lT 414ik8x9zjNz4jgUnmT+JHufBHbH/OMmMbEb/ox8XHFTy2LqrjpzWz+lwj8THyhKQBxB a7GQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a15si1490925ejd.215.2020.06.18.01.39.01; Thu, 18 Jun 2020 01:39:01 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728842AbgFRIib (ORCPT + 6 others); Thu, 18 Jun 2020 04:38:31 -0400 Received: from mx.socionext.com ([202.248.49.38]:19342 "EHLO mx.socionext.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727839AbgFRIi0 (ORCPT ); Thu, 18 Jun 2020 04:38:26 -0400 Received: from unknown (HELO kinkan-ex.css.socionext.com) ([172.31.9.52]) by mx.socionext.com with ESMTP; 18 Jun 2020 17:38:24 +0900 Received: from mail.mfilter.local (m-filter-2 [10.213.24.62]) by kinkan-ex.css.socionext.com (Postfix) with ESMTP id 528D6180B51; Thu, 18 Jun 2020 17:38:24 +0900 (JST) Received: from 172.31.9.51 (172.31.9.51) by m-FILTER with ESMTP; Thu, 18 Jun 2020 17:38:24 +0900 Received: from plum.e01.socionext.com (unknown [10.213.132.32]) by kinkan.css.socionext.com (Postfix) with ESMTP id D09501A12AD; Thu, 18 Jun 2020 17:38:23 +0900 (JST) From: Kunihiko Hayashi To: Bjorn Helgaas , Lorenzo Pieralisi , Jingoo Han , Gustavo Pimentel , Rob Herring , Masahiro Yamada , Marc Zyngier Cc: linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Masami Hiramatsu , Jassi Brar , Kunihiko Hayashi Subject: [PATCH v5 1/6] PCI: dwc: Add msi_host_isr() callback Date: Thu, 18 Jun 2020 17:38:08 +0900 Message-Id: <1592469493-1549-2-git-send-email-hayashi.kunihiko@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1592469493-1549-1-git-send-email-hayashi.kunihiko@socionext.com> References: <1592469493-1549-1-git-send-email-hayashi.kunihiko@socionext.com> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This adds msi_host_isr() callback function support to describe SoC-dependent service triggered by MSI. For example, when AER interrupt is triggered by MSI, the callback function reads SoC-dependent registers and detects that the interrupt is from AER, and invoke AER interrupts related to MSI. Cc: Marc Zyngier Cc: Jingoo Han Cc: Gustavo Pimentel Signed-off-by: Kunihiko Hayashi Acked-by: Gustavo Pimentel --- drivers/pci/controller/dwc/pcie-designware-host.c | 3 +++ drivers/pci/controller/dwc/pcie-designware.h | 1 + 2 files changed, 4 insertions(+) -- 2.7.4 diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c index 0a4a5aa..026edb1 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -83,6 +83,9 @@ irqreturn_t dw_handle_msi_irq(struct pcie_port *pp) u32 status, num_ctrls; irqreturn_t ret = IRQ_NONE; + if (pp->ops->msi_host_isr) + pp->ops->msi_host_isr(pp); + num_ctrls = pp->num_vectors / MAX_MSI_IRQS_PER_CTRL; for (i = 0; i < num_ctrls; i++) { diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h index 656e00f..e741967 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -170,6 +170,7 @@ struct dw_pcie_host_ops { void (*scan_bus)(struct pcie_port *pp); void (*set_num_vectors)(struct pcie_port *pp); int (*msi_host_init)(struct pcie_port *pp); + void (*msi_host_isr)(struct pcie_port *pp); }; struct pcie_port { From patchwork Thu Jun 18 08:38:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kunihiko Hayashi X-Patchwork-Id: 191089 Delivered-To: patch@linaro.org Received: by 2002:a54:30ca:0:0:0:0:0 with SMTP id e10csp1125983ecs; Thu, 18 Jun 2020 01:39:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8eAbWZdcrcharEjIhgWMcF60yogkL4LMXMvsyzdKG/1a6JHJFwnyxAt4abR7zaeOTZigx X-Received: by 2002:a17:906:924c:: with SMTP id c12mr3140871ejx.457.1592469541044; Thu, 18 Jun 2020 01:39:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592469541; cv=none; d=google.com; s=arc-20160816; b=LRSwbvUw11fsHZSzdSX4kj8U6YaDDBu1u9Mq365/Fivd0eKsKkyiNqFMKxhe9H7djl GN9wxzYns2FJCL/O94msuf+wgcazVSL6ydpn8Soex18zRcTMlfjd6iZ5BjVh9bCSV1LW hTPNEpJx4rTRe5JLcSIS1K/jQxGckph59Z+bnd/8bTDV565+Pp/kCKfaQupBcvi3ln9E J/U/00CdzvmYhLkHS+/OCthzyl9OFj6Iu052ZkUK5kUh7tiv12lzZVrrpbxe4yCqtDI8 HCTa6zm5oDKMUwtD4ifPtuzNdFi/sw8WdFHcajr2P3Fq7QjFucurCAgKZqJbJgzRaBSA r/Bw== 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=ZCOWevsUJtDUU0RQDb3UxjNGM/GLminMGzlhiBN9Tq4=; b=aR0I2bkSr8dvQDhdfBkWA4ffr3buP+G7VVxrhO+PoNpGxdJPlfN5ow0b5VOu+tymIM zb0SaMePZ2FV7zCezO6haQ7N6ui4ybfA3UYwc2ZzD5xX26xAXVOvvmiCs5DbdhmJ5/Ke CyfrK9bK7SrViPgOEowStNkQqiTK4CowDdTHLltDTT+9Gwmgxgcq0FBogk6SyWCnnM+P C0ABYCoCmSXkkjdoiWIVDieaYm/zOsrAognOTKvQDHZbH/+ggxNof8rNp3J3b3AFkJkB eKDmBAU/YLp/tBRPwCvSdkdXttpmmGpVmigDPLl4fPt9GdRb50Zivuv97Y79X+tyCYnI bQtg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a15si1490925ejd.215.2020.06.18.01.39.00; Thu, 18 Jun 2020 01:39:01 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728847AbgFRIic (ORCPT + 6 others); Thu, 18 Jun 2020 04:38:32 -0400 Received: from mx.socionext.com ([202.248.49.38]:19349 "EHLO mx.socionext.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728820AbgFRIi1 (ORCPT ); Thu, 18 Jun 2020 04:38:27 -0400 Received: from unknown (HELO kinkan-ex.css.socionext.com) ([172.31.9.52]) by mx.socionext.com with ESMTP; 18 Jun 2020 17:38:25 +0900 Received: from mail.mfilter.local (m-filter-1 [10.213.24.61]) by kinkan-ex.css.socionext.com (Postfix) with ESMTP id 5BC97180B51; Thu, 18 Jun 2020 17:38:25 +0900 (JST) Received: from 172.31.9.51 (172.31.9.51) by m-FILTER with ESMTP; Thu, 18 Jun 2020 17:38:25 +0900 Received: from plum.e01.socionext.com (unknown [10.213.132.32]) by kinkan.css.socionext.com (Postfix) with ESMTP id CB0D41A12AD; Thu, 18 Jun 2020 17:38:24 +0900 (JST) From: Kunihiko Hayashi To: Bjorn Helgaas , Lorenzo Pieralisi , Jingoo Han , Gustavo Pimentel , Rob Herring , Masahiro Yamada , Marc Zyngier Cc: linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Masami Hiramatsu , Jassi Brar , Kunihiko Hayashi Subject: [PATCH v5 2/6] PCI: uniphier: Add misc interrupt handler to invoke PME and AER Date: Thu, 18 Jun 2020 17:38:09 +0900 Message-Id: <1592469493-1549-3-git-send-email-hayashi.kunihiko@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1592469493-1549-1-git-send-email-hayashi.kunihiko@socionext.com> References: <1592469493-1549-1-git-send-email-hayashi.kunihiko@socionext.com> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The misc interrupts consisting of PME, AER, and Link event, is handled by INTx handler, however, these interrupts should be also handled by MSI handler. This adds the function uniphier_pcie_misc_isr() that handles misc interrupts, which is called from both INTx and MSI handlers. This function detects PME and AER interrupts with the status register, and invoke PME and AER drivers related to MSI. And this sets the mask for misc interrupts from INTx if MSI is enabled and sets the mask for misc interrupts from MSI if MSI is disabled. Cc: Marc Zyngier Cc: Jingoo Han Cc: Gustavo Pimentel Signed-off-by: Kunihiko Hayashi --- drivers/pci/controller/dwc/pcie-uniphier.c | 57 ++++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 11 deletions(-) -- 2.7.4 diff --git a/drivers/pci/controller/dwc/pcie-uniphier.c b/drivers/pci/controller/dwc/pcie-uniphier.c index a5401a0..5ce2479 100644 --- a/drivers/pci/controller/dwc/pcie-uniphier.c +++ b/drivers/pci/controller/dwc/pcie-uniphier.c @@ -44,7 +44,9 @@ #define PCL_SYS_AUX_PWR_DET BIT(8) #define PCL_RCV_INT 0x8108 +#define PCL_RCV_INT_ALL_INT_MASK GENMASK(28, 25) #define PCL_RCV_INT_ALL_ENABLE GENMASK(20, 17) +#define PCL_RCV_INT_ALL_MSI_MASK GENMASK(12, 9) #define PCL_CFG_BW_MGT_STATUS BIT(4) #define PCL_CFG_LINK_AUTO_BW_STATUS BIT(3) #define PCL_CFG_AER_RC_ERR_MSI_STATUS BIT(2) @@ -167,7 +169,15 @@ static void uniphier_pcie_stop_link(struct dw_pcie *pci) static void uniphier_pcie_irq_enable(struct uniphier_pcie_priv *priv) { - writel(PCL_RCV_INT_ALL_ENABLE, priv->base + PCL_RCV_INT); + u32 val; + + val = PCL_RCV_INT_ALL_ENABLE; + if (pci_msi_enabled()) + val |= PCL_RCV_INT_ALL_INT_MASK; + else + val |= PCL_RCV_INT_ALL_MSI_MASK; + + writel(val, priv->base + PCL_RCV_INT); writel(PCL_RCV_INTX_ALL_ENABLE, priv->base + PCL_RCV_INTX); } @@ -231,32 +241,56 @@ static const struct irq_domain_ops uniphier_intx_domain_ops = { .map = uniphier_pcie_intx_map, }; -static void uniphier_pcie_irq_handler(struct irq_desc *desc) +static void uniphier_pcie_misc_isr(struct pcie_port *pp, bool is_msi) { - struct pcie_port *pp = irq_desc_get_handler_data(desc); struct dw_pcie *pci = to_dw_pcie_from_pp(pp); struct uniphier_pcie_priv *priv = to_uniphier_pcie(pci); - struct irq_chip *chip = irq_desc_get_chip(desc); - unsigned long reg; - u32 val, bit, virq; + u32 val, virq; - /* INT for debug */ val = readl(priv->base + PCL_RCV_INT); if (val & PCL_CFG_BW_MGT_STATUS) dev_dbg(pci->dev, "Link Bandwidth Management Event\n"); + if (val & PCL_CFG_LINK_AUTO_BW_STATUS) dev_dbg(pci->dev, "Link Autonomous Bandwidth Event\n"); - if (val & PCL_CFG_AER_RC_ERR_MSI_STATUS) - dev_dbg(pci->dev, "Root Error\n"); - if (val & PCL_CFG_PME_MSI_STATUS) - dev_dbg(pci->dev, "PME Interrupt\n"); + + if (is_msi) { + if (val & PCL_CFG_AER_RC_ERR_MSI_STATUS) + dev_dbg(pci->dev, "Root Error Status\n"); + + if (val & PCL_CFG_PME_MSI_STATUS) + dev_dbg(pci->dev, "PME Interrupt\n"); + + if (val & (PCL_CFG_AER_RC_ERR_MSI_STATUS | + PCL_CFG_PME_MSI_STATUS)) { + virq = irq_linear_revmap(pp->irq_domain, 0); + generic_handle_irq(virq); + } + } writel(val, priv->base + PCL_RCV_INT); +} + +static void uniphier_pcie_msi_host_isr(struct pcie_port *pp) +{ + uniphier_pcie_misc_isr(pp, true); +} + +static void uniphier_pcie_irq_handler(struct irq_desc *desc) +{ + struct pcie_port *pp = irq_desc_get_handler_data(desc); + struct dw_pcie *pci = to_dw_pcie_from_pp(pp); + struct uniphier_pcie_priv *priv = to_uniphier_pcie(pci); + struct irq_chip *chip = irq_desc_get_chip(desc); + unsigned long reg; + u32 val, bit, virq; /* INTx */ chained_irq_enter(chip, desc); + uniphier_pcie_misc_isr(pp, false); + val = readl(priv->base + PCL_RCV_INTX); reg = FIELD_GET(PCL_RCV_INTX_ALL_STATUS, val); @@ -330,6 +364,7 @@ static int uniphier_pcie_host_init(struct pcie_port *pp) static const struct dw_pcie_host_ops uniphier_pcie_host_ops = { .host_init = uniphier_pcie_host_init, + .msi_host_isr = uniphier_pcie_msi_host_isr, }; static int uniphier_add_pcie_port(struct uniphier_pcie_priv *priv, From patchwork Thu Jun 18 08:38:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kunihiko Hayashi X-Patchwork-Id: 191093 Delivered-To: patch@linaro.org Received: by 2002:a54:30ca:0:0:0:0:0 with SMTP id e10csp1126172ecs; Thu, 18 Jun 2020 01:39:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzc9S9H2SkYZd1rwUfE+ZiY3oS5EN9sXnIR8l/xXGM8+GcPuXxzNsz2cJ3e0wtuRoJbRnKi X-Received: by 2002:a17:906:ccdd:: with SMTP id ot29mr2812425ejb.119.1592469563001; Thu, 18 Jun 2020 01:39:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592469562; cv=none; d=google.com; s=arc-20160816; b=HURpoujHxPjK83ybMTLbR2ydE3+JgywshJc3wEYuDQvRb+EluTajylEJCtpjlC6irq DJ+9ViJwFgBft05sv9KgyAaZf0x3NDdnY2LiZkLwcMhsZRtnrf+9kdPfy4PrAH4g2APN 6T4sdfbnwdEaRbJ6BLTQPktKU0r25AbgEmODQD76tnfr5voNYNZQ+I8W3GwxIt367r9s omo7kM8F2Fw2x8EvMTHX7Lu9DcLuw4DK3yuHiO++JeR5SvsaFhSEwYCdJvaUaO/BkLuQ Pd6YCsmphlIzJJSfz39yvIveURmhXgl8tNYijEMJ/JZdj9wxq4GZBhQjiFcYjdpTNfXF y3Yw== 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=NES0+Yk8OnWgH95/pv+pL4gMwYf8bdYustHRFZhhU/U=; b=Ov1+cqSSg7t5fwhWFGNN6MEMOyJ7kofWfwHeKkfWRjiJuIg01MDScYIIajjP/dh2SU BZ5HNUx4KWhliGnAAE9Lp4hS2DW7Up6t4T9AvdEUY/E0Ca1/1LVct7Zc2ZoHHe3PPVuv /t1lwYH93mmUzWtkDM0SYnr3wbx1C/AUbUJl/yMcLMurAnjDSuussqhP8OBUiEYg8H81 wZ7JPv6V0DCpWqVmfXoisR3CHHQUO0IKJEDaP2AAQbJCsY+til151IwL5I4chhYWviBZ eiuhSR02FGV10ofijB4Wev2mQSniyL2i2sghvyJKB2YRKPK25SOt40ghRXCZ+VrbnTxm euQw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gu20si1531413ejb.13.2020.06.18.01.39.22; Thu, 18 Jun 2020 01:39:22 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728825AbgFRIjV (ORCPT + 6 others); Thu, 18 Jun 2020 04:39:21 -0400 Received: from mx.socionext.com ([202.248.49.38]:19356 "EHLO mx.socionext.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728823AbgFRIi1 (ORCPT ); Thu, 18 Jun 2020 04:38:27 -0400 Received: from unknown (HELO kinkan-ex.css.socionext.com) ([172.31.9.52]) by mx.socionext.com with ESMTP; 18 Jun 2020 17:38:26 +0900 Received: from mail.mfilter.local (m-filter-2 [10.213.24.62]) by kinkan-ex.css.socionext.com (Postfix) with ESMTP id 6B432180B51; Thu, 18 Jun 2020 17:38:26 +0900 (JST) Received: from 172.31.9.51 (172.31.9.51) by m-FILTER with ESMTP; Thu, 18 Jun 2020 17:38:26 +0900 Received: from plum.e01.socionext.com (unknown [10.213.132.32]) by kinkan.css.socionext.com (Postfix) with ESMTP id 9911D1A12AD; Thu, 18 Jun 2020 17:38:25 +0900 (JST) From: Kunihiko Hayashi To: Bjorn Helgaas , Lorenzo Pieralisi , Jingoo Han , Gustavo Pimentel , Rob Herring , Masahiro Yamada , Marc Zyngier Cc: linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Masami Hiramatsu , Jassi Brar , Kunihiko Hayashi Subject: [PATCH v5 3/6] dt-bindings: PCI: uniphier: Add iATU register description Date: Thu, 18 Jun 2020 17:38:10 +0900 Message-Id: <1592469493-1549-4-git-send-email-hayashi.kunihiko@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1592469493-1549-1-git-send-email-hayashi.kunihiko@socionext.com> References: <1592469493-1549-1-git-send-email-hayashi.kunihiko@socionext.com> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org In the dt-bindings, "atu" reg-names is required to get the register space for iATU in Synopsys DWC version 4.80 or later. Signed-off-by: Kunihiko Hayashi Acked-by: Rob Herring --- Documentation/devicetree/bindings/pci/uniphier-pcie.txt | 1 + 1 file changed, 1 insertion(+) -- 2.7.4 diff --git a/Documentation/devicetree/bindings/pci/uniphier-pcie.txt b/Documentation/devicetree/bindings/pci/uniphier-pcie.txt index 1fa2c59..c4b7381 100644 --- a/Documentation/devicetree/bindings/pci/uniphier-pcie.txt +++ b/Documentation/devicetree/bindings/pci/uniphier-pcie.txt @@ -16,6 +16,7 @@ Required properties: "dbi" - controller configuration registers "link" - SoC-specific glue layer registers "config" - PCIe configuration space + "atu" - iATU registers for DWC version 4.80 or later - clocks: A phandle to the clock gate for PCIe glue layer including the host controller. - resets: A phandle to the reset line for PCIe glue layer including From patchwork Thu Jun 18 08:38:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kunihiko Hayashi X-Patchwork-Id: 191088 Delivered-To: patch@linaro.org Received: by 2002:a54:30ca:0:0:0:0:0 with SMTP id e10csp1125969ecs; Thu, 18 Jun 2020 01:39:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/gUAUFX4c/fLYMvFKlOPkBQhdg0UfNl0qpBQV0P4UzyQpe2oer1R5RcMxk4HksYo9wJj7 X-Received: by 2002:a50:f19d:: with SMTP id x29mr3037350edl.215.1592469539953; Thu, 18 Jun 2020 01:38:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592469539; cv=none; d=google.com; s=arc-20160816; b=YNkDJJfNma57+C8cPVcuFC80k+vc1hvNINd/AyWLT9+2wKuc0FIdx+MOsuIcC+k7pr Q8nh8i3490QPR3O0Ys7sx/6aF0wxGzR3UvepRUPiaJ4dElAhMlyrrT8kLZ1VBwfwRgN/ c+3DlKCs/2kQIMCc4Z7RaxdaNz5R4ED7e4asjPsNNfIb4y/9ys451HN+eH28MajRAjTF KwbWxfBaF7dpgYiXiuJxu31vZP2XqjLeij6c9g1ssTFs/YxuXG9Jimg/uUI82TJh3xU/ vdXyqRm0kx1S1Wp5jmsXyBiTJ0LLIqp6HE6hGuijxpFVRh8bwZJysE4PeQ604aRGCDzp Dk3g== 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=4P4GjfjkLq9hygITUkCPD7eIs/Iyu2aXHk0ElH5z3fI=; b=mz18P9GFbyZzf+/UQ41fiw0rvjAZfpRKvQo6qLjxk5WwdJeTTYuBTxfW2dw5L/zJxu E1njkcauETScKrqeLFtHyraoQAmrP+TgVtoJrlfJ2tdJMcZFtGRep0hrtXolbMJmXoBi boXf9dMgz5SFEu4mwIdnoIUmTPubMsQYVzrwS7XWVSbi70wz6upiTYsN9Q/e/OfzsLQE KX+NFIFJahkYLDOaW9tSnk8afFH4OTZYVGBUjwCR7udIavj1HbojWcrOKj0VtfZ+bmm1 L7hCZxmqHGrLULp1bJdoEO+Zgu3R9MPI25Ks6fxIqniCJ4dmmTO07Vsa2Lpyr5mIigLh CD4g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a15si1490925ejd.215.2020.06.18.01.38.59; Thu, 18 Jun 2020 01:38:59 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728849AbgFRIic (ORCPT + 6 others); Thu, 18 Jun 2020 04:38:32 -0400 Received: from mx.socionext.com ([202.248.49.38]:19364 "EHLO mx.socionext.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728824AbgFRIi2 (ORCPT ); Thu, 18 Jun 2020 04:38:28 -0400 Received: from unknown (HELO iyokan-ex.css.socionext.com) ([172.31.9.54]) by mx.socionext.com with ESMTP; 18 Jun 2020 17:38:26 +0900 Received: from mail.mfilter.local (m-filter-1 [10.213.24.61]) by iyokan-ex.css.socionext.com (Postfix) with ESMTP id E406C60057; Thu, 18 Jun 2020 17:38:26 +0900 (JST) Received: from 172.31.9.51 (172.31.9.51) by m-FILTER with ESMTP; Thu, 18 Jun 2020 17:38:26 +0900 Received: from plum.e01.socionext.com (unknown [10.213.132.32]) by kinkan.css.socionext.com (Postfix) with ESMTP id 5E0AB1A12AD; Thu, 18 Jun 2020 17:38:26 +0900 (JST) From: Kunihiko Hayashi To: Bjorn Helgaas , Lorenzo Pieralisi , Jingoo Han , Gustavo Pimentel , Rob Herring , Masahiro Yamada , Marc Zyngier Cc: linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Masami Hiramatsu , Jassi Brar , Kunihiko Hayashi Subject: [PATCH v5 4/6] PCI: uniphier: Add iATU register support Date: Thu, 18 Jun 2020 17:38:11 +0900 Message-Id: <1592469493-1549-5-git-send-email-hayashi.kunihiko@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1592469493-1549-1-git-send-email-hayashi.kunihiko@socionext.com> References: <1592469493-1549-1-git-send-email-hayashi.kunihiko@socionext.com> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This gets iATU register area from reg property. In Synopsys DWC version 4.80 or later, since iATU register area is separated from core register area, this area is necessary to get from DT independently. Signed-off-by: Kunihiko Hayashi --- drivers/pci/controller/dwc/pcie-uniphier.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.7.4 diff --git a/drivers/pci/controller/dwc/pcie-uniphier.c b/drivers/pci/controller/dwc/pcie-uniphier.c index 5ce2479..c37a968 100644 --- a/drivers/pci/controller/dwc/pcie-uniphier.c +++ b/drivers/pci/controller/dwc/pcie-uniphier.c @@ -451,6 +451,11 @@ static int uniphier_pcie_probe(struct platform_device *pdev) if (IS_ERR(priv->pci.dbi_base)) return PTR_ERR(priv->pci.dbi_base); + priv->pci.atu_base = + devm_platform_ioremap_resource_byname(pdev, "atu"); + if (IS_ERR(priv->pci.atu_base)) + priv->pci.atu_base = NULL; + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "link"); priv->base = devm_ioremap_resource(dev, res); if (IS_ERR(priv->base)) From patchwork Thu Jun 18 08:38:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kunihiko Hayashi X-Patchwork-Id: 191091 Delivered-To: patch@linaro.org Received: by 2002:a54:30ca:0:0:0:0:0 with SMTP id e10csp1126012ecs; Thu, 18 Jun 2020 01:39:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfS9Kun7yezbC0utU/WSod3hvgfOm9mSsqoFck+6Kzrg+A4J6Cz6cF1EQLO4LQYN5wWdvz X-Received: by 2002:a17:906:1d52:: with SMTP id o18mr2687738ejh.399.1592469543814; Thu, 18 Jun 2020 01:39:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592469543; cv=none; d=google.com; s=arc-20160816; b=ItfESFgxWs53IAzBcUdZaUzOuUvZj03TbMwlcQEGOz3QnGdl2cVJZevDGl+QNzv9NN jgd6NTIjADNGL1I7uvmmUolnJinmbpqXDDS4Km4Zdz1belwQB747dDIH/80woPffEyfX F+ZnkTRnx456E0gjyDeRb4mN3rz3L3dvNPGG+O+qdOHRe2+slU7HT/cVOg1Q8rln5luj 7uTi7Tf/o5yftT6gr51IxqJkanwdTs6nwN95tI5U4MG/HqDblMz2UFJqoQAkvk8/oCRi CZMxTeGXmXIpm7uOVgwbpcY/myovZUq2Gi322RxBFlmmyRmIgcfvxwsmHtVrxsglrQ8f JXIg== 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=AqLr77e+YiK8+HVwWmuG9SWDToMvkIOUFQNYa7obawA=; b=jHNzPK88RpOHiwnoOkAba9qtzbWrLiYO8JHmPbwWFmOii9zdWd6m0TKGCstnQWs3o8 /9Mcint/ubSZW95o1dFwulFB+z3eJIFvthdxB9UCqlElpj/JZHwXjFuoh1Eg8seEZVOY z4SKAJnCCbZEtAl+8syjM9g/Wt1D2LmLsyvmJtK5q8H6Ra2nZWZ4qnO+YMOULxEyv/ge ibnyIIL6gmOnSy/PbPPZCHFpX+Ry6XmMigxmipAwowBTFonTfJz+lHAkbrUnN6hwGDkt fYnOPNb4wTMrYyiKRobalz2wMZrLOxMosWoFcI9cWlud4mwttlhrlwWBEgV0ecm3MAgy BB2g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a15si1490925ejd.215.2020.06.18.01.39.03; Thu, 18 Jun 2020 01:39:03 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728890AbgFRIjC (ORCPT + 6 others); Thu, 18 Jun 2020 04:39:02 -0400 Received: from mx.socionext.com ([202.248.49.38]:19368 "EHLO mx.socionext.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728825AbgFRIi2 (ORCPT ); Thu, 18 Jun 2020 04:38:28 -0400 Received: from unknown (HELO kinkan-ex.css.socionext.com) ([172.31.9.52]) by mx.socionext.com with ESMTP; 18 Jun 2020 17:38:27 +0900 Received: from mail.mfilter.local (m-filter-2 [10.213.24.62]) by kinkan-ex.css.socionext.com (Postfix) with ESMTP id 75A22180B51; Thu, 18 Jun 2020 17:38:27 +0900 (JST) Received: from 172.31.9.51 (172.31.9.51) by m-FILTER with ESMTP; Thu, 18 Jun 2020 17:38:27 +0900 Received: from plum.e01.socionext.com (unknown [10.213.132.32]) by kinkan.css.socionext.com (Postfix) with ESMTP id 1A10B1A12AD; Thu, 18 Jun 2020 17:38:27 +0900 (JST) From: Kunihiko Hayashi To: Bjorn Helgaas , Lorenzo Pieralisi , Jingoo Han , Gustavo Pimentel , Rob Herring , Masahiro Yamada , Marc Zyngier Cc: linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Masami Hiramatsu , Jassi Brar , Kunihiko Hayashi Subject: [PATCH v5 5/6] PCI: uniphier: Add error message when failed to get phy Date: Thu, 18 Jun 2020 17:38:12 +0900 Message-Id: <1592469493-1549-6-git-send-email-hayashi.kunihiko@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1592469493-1549-1-git-send-email-hayashi.kunihiko@socionext.com> References: <1592469493-1549-1-git-send-email-hayashi.kunihiko@socionext.com> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Even if phy driver doesn't probe, the error message can't be distinguished from other errors. This displays error message caused by the phy driver explicitly. Signed-off-by: Kunihiko Hayashi --- drivers/pci/controller/dwc/pcie-uniphier.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/drivers/pci/controller/dwc/pcie-uniphier.c b/drivers/pci/controller/dwc/pcie-uniphier.c index c37a968..8356dd3 100644 --- a/drivers/pci/controller/dwc/pcie-uniphier.c +++ b/drivers/pci/controller/dwc/pcie-uniphier.c @@ -470,8 +470,12 @@ static int uniphier_pcie_probe(struct platform_device *pdev) return PTR_ERR(priv->rst); priv->phy = devm_phy_optional_get(dev, "pcie-phy"); - if (IS_ERR(priv->phy)) - return PTR_ERR(priv->phy); + if (IS_ERR(priv->phy)) { + ret = PTR_ERR(priv->phy); + if (ret != -EPROBE_DEFER) + dev_err(dev, "Failed to get phy (%d)\n", ret); + return ret; + } platform_set_drvdata(pdev, priv); From patchwork Thu Jun 18 08:38:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kunihiko Hayashi X-Patchwork-Id: 191092 Delivered-To: patch@linaro.org Received: by 2002:a54:30ca:0:0:0:0:0 with SMTP id e10csp1126162ecs; Thu, 18 Jun 2020 01:39:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyI5aWwIe31YOw8krWfApxol9GHkU7/b4M3G9wRkKOcP7tugsOdhpzu0Ij2Rt2FfykZruvI X-Received: by 2002:aa7:d5c7:: with SMTP id d7mr3063034eds.11.1592469561881; Thu, 18 Jun 2020 01:39:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592469561; cv=none; d=google.com; s=arc-20160816; b=phYfY1XJxgyA8skVmBmXujQrTizNn9AAfKl9Z40BtECaQByNTNaUajd9FNEprA6zyj AwkB2Obqx4HAXyg60mPtrLbJKVBLcncM0FoQ+i3LJr8IJ/OVEJ3T59XQfwHGDoEGBd/z NlndB8wcfyz6kni4ljMsN4C7zHioJFtXxpKPjKBJmBKBU4JWUnIDhIM4KcBfkAFUHbcW Yl5QtUHHQNLBw/cEvX8p2PE19i6hcdCe55j1cHduZiGZaPr/2P3eqBOHCBRLYX4Dnkxg BJPlq+oGJhMN2GpNNwbPWVbNvBsImo6mzkm2FQB7AljlySp4O6Rjng8OK+RmVPEwmt7V WOtw== 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=QPn7RyiehK3L1fHXGplowd2GSiLN/O2Xc/jht7++7fY=; b=NQd25XyARV8GGy4OcDGNVuRbcLQGh2UFP+M3Do1w8akJaeAv3yWMysEpHrdk8tGDOd knQOEh2RkgFeUS6qiiB9/79beFm2nnaiN0AjdklKBynbHFOrZPuFof4SNyH4UPL9iVeY 8QrWrxG5piAuV8oHi/R07eBC9u0eAeFGyFN1/+MwgZp9T/sKwLjDwxSAIkhmhYxACF8E bld6rTxbHU/KWzpqTeaOv1R4vzJen60vxOJdMzDCx+EMfQXdXevh1eroPfqinNe903ry LPhHzkcgIVfgVoQVRJfcLpnUIIF1MIOjXdi8fXj+uUKm/qPG0gr7xmesLLgqxayPXm// 3p8w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gu20si1531413ejb.13.2020.06.18.01.39.21; Thu, 18 Jun 2020 01:39:21 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728704AbgFRIjB (ORCPT + 6 others); Thu, 18 Jun 2020 04:39:01 -0400 Received: from mx.socionext.com ([202.248.49.38]:19334 "EHLO mx.socionext.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728826AbgFRIi3 (ORCPT ); Thu, 18 Jun 2020 04:38:29 -0400 Received: from unknown (HELO iyokan-ex.css.socionext.com) ([172.31.9.54]) by mx.socionext.com with ESMTP; 18 Jun 2020 17:38:28 +0900 Received: from mail.mfilter.local (m-filter-1 [10.213.24.61]) by iyokan-ex.css.socionext.com (Postfix) with ESMTP id 7559760057; Thu, 18 Jun 2020 17:38:28 +0900 (JST) Received: from 172.31.9.51 (172.31.9.51) by m-FILTER with ESMTP; Thu, 18 Jun 2020 17:38:28 +0900 Received: from plum.e01.socionext.com (unknown [10.213.132.32]) by kinkan.css.socionext.com (Postfix) with ESMTP id D055C1A12AD; Thu, 18 Jun 2020 17:38:27 +0900 (JST) From: Kunihiko Hayashi To: Bjorn Helgaas , Lorenzo Pieralisi , Jingoo Han , Gustavo Pimentel , Rob Herring , Masahiro Yamada , Marc Zyngier Cc: linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Masami Hiramatsu , Jassi Brar , Kunihiko Hayashi Subject: [PATCH v5 6/6] PCI: uniphier: Use devm_platform_ioremap_resource_byname() Date: Thu, 18 Jun 2020 17:38:13 +0900 Message-Id: <1592469493-1549-7-git-send-email-hayashi.kunihiko@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1592469493-1549-1-git-send-email-hayashi.kunihiko@socionext.com> References: <1592469493-1549-1-git-send-email-hayashi.kunihiko@socionext.com> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Use devm_platform_ioremap_resource_byname() to simplify the code a bit. Signed-off-by: Kunihiko Hayashi --- drivers/pci/controller/dwc/pcie-uniphier.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.7.4 diff --git a/drivers/pci/controller/dwc/pcie-uniphier.c b/drivers/pci/controller/dwc/pcie-uniphier.c index 8356dd3..233d624 100644 --- a/drivers/pci/controller/dwc/pcie-uniphier.c +++ b/drivers/pci/controller/dwc/pcie-uniphier.c @@ -456,8 +456,7 @@ static int uniphier_pcie_probe(struct platform_device *pdev) if (IS_ERR(priv->pci.atu_base)) priv->pci.atu_base = NULL; - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "link"); - priv->base = devm_ioremap_resource(dev, res); + priv->base = devm_platform_ioremap_resource_byname(pdev, "link"); if (IS_ERR(priv->base)) return PTR_ERR(priv->base);