From patchwork Mon Mar 25 09:39:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 161054 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp3749399jan; Mon, 25 Mar 2019 02:42:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqwrH+yyhtcdQcAA2WBJyg1rt2Tvekw9wONRofciZavwx7PCSFT8Q3PzSV/UihOaKnkVGlN6 X-Received: by 2002:a17:902:e709:: with SMTP id co9mr1250061plb.86.1553506938631; Mon, 25 Mar 2019 02:42:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553506938; cv=none; d=google.com; s=arc-20160816; b=LDP4KIsO/fOYN+4t7wpCZ0COnLxqwtuOu/gGf/iREjOjImgtCgNAmerdqFQwQ82kxV cYsjSFHzhfyWLudP5M96G8Tj3A9UvRMD51knBg3+5C/0AbHb32EUuf631IvFMe2n3XeQ w2zequ/U0wy1Jxh0NxYxXLBsArUN0uEOxHcgEYbaaOIVcKVizYn0bFBPzajXEgglkhyh mgg7VbUrYBie0Ojj52xwQ/ffPPHKvTJoYUZZugM44aX1Mz42hdyC1KMfm9lDTqjAnKNm g31fCTyaTZ6touulCZJ39+ZO9iD8hHZyWSv4O6ir0i2VEqezSG7bu+War8+a721Muk+y cIzw== 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:dkim-signature; bh=HfjjoKmsDgZT6jDC5T6H72l2yvWvnghjKzXKSseYIoU=; b=EN4+2fE3DeuURCnLtKQ458HRjFswJsfUvMLG/Nr7d7YZ9Jg3YrxL2fm59CxBvYE6g6 IGnyzgJYG2SUhpdwS7EdmUMMPXD1ce8LFhS0folqpQoHy+q1PujEnxKYwj1KrK6y9yWn rqVONb+WD5n82olUwZYzXXDCpkQ1zR6+cKc4+D01oeuzlg6lbv326yvBstALLe7zyZaZ ZIwUdBlzKwQZQxoEFs+zeAswIJ2OgtbLM5RFv6ti7I6BZ/EzFzUvgulDXZ10wUZ0iSsq +DqMlc/mQWx0hHbGwsJJrmKc93BuMx/0O5gs3qtElLfvuBAVt6GadLb3VvFtIAkTyyl2 jabw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="f3DsT/1l"; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i18si12695129pfa.205.2019.03.25.02.42.18; Mon, 25 Mar 2019 02:42:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="f3DsT/1l"; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730243AbfCYJmR (ORCPT + 5 others); Mon, 25 Mar 2019 05:42:17 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:37400 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730399AbfCYJmR (ORCPT ); Mon, 25 Mar 2019 05:42:17 -0400 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x2P9fvuV012556; Mon, 25 Mar 2019 04:41:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1553506917; bh=HfjjoKmsDgZT6jDC5T6H72l2yvWvnghjKzXKSseYIoU=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=f3DsT/1lr7cjO7CpXgVsetyb6Z1Uk3vtX+jlHTF8JCyt5KtMdZsRJoigCzC5UmBrK Aa3vIVojViV3r4Z6gmznBMT7ZSQF0E8xCDcn8/FWIaXt4BC0lydmkaqUm9pbmBPdFi cgx+Lz0KlPZ4GpdzQpVF16+7w6f7xhFHtS4jsuvA= Received: from DFLE102.ent.ti.com (dfle102.ent.ti.com [10.64.6.23]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x2P9fvNN013838 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 25 Mar 2019 04:41:57 -0500 Received: from DFLE104.ent.ti.com (10.64.6.25) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Mon, 25 Mar 2019 04:41:56 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1713.5 via Frontend Transport; Mon, 25 Mar 2019 04:41:56 -0500 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id x2P9feaH028077; Mon, 25 Mar 2019 04:41:51 -0500 From: Kishon Vijay Abraham I To: Gustavo Pimentel , Bjorn Helgaas , Rob Herring , Lorenzo Pieralisi , Arnd Bergmann , Murali Karicheri CC: Kishon Vijay Abraham I , Jingoo Han , Greg Kroah-Hartman , , , , , , , Minghuan Lian , Mingkai Hu , Roy Zang , Jesper Nilsson Subject: [PATCH v3 02/26] PCI: keystone: Cleanup error_irq configuration Date: Mon, 25 Mar 2019 15:09:23 +0530 Message-ID: <20190325093947.32633-3-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190325093947.32633-1-kishon@ti.com> References: <20190325093947.32633-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org pci-keystone driver uses irq_of_parse_and_map to get irq number of error_irq. Use platform_get_irq instead and move platform_get_irq() and request_irq() of error_irq from ks_pcie_add_pcie_port to ks_pcie_probe since error_irq is common to both RC mode and EP mode. Signed-off-by: Kishon Vijay Abraham I --- drivers/pci/controller/dwc/pci-keystone.c | 43 +++++++++-------------- 1 file changed, 17 insertions(+), 26 deletions(-) -- 2.17.1 diff --git a/drivers/pci/controller/dwc/pci-keystone.c b/drivers/pci/controller/dwc/pci-keystone.c index 07f55b355d75..e50f8773e768 100644 --- a/drivers/pci/controller/dwc/pci-keystone.c +++ b/drivers/pci/controller/dwc/pci-keystone.c @@ -98,8 +98,6 @@ struct keystone_pcie { struct irq_domain *legacy_irq_domain; struct device_node *np; - int error_irq; - /* Application register space */ void __iomem *va_app_base; /* DT 1st resource */ struct resource app; @@ -743,12 +741,6 @@ static int ks_pcie_config_legacy_irq(struct keystone_pcie *ks_pcie) return ret; } -static void ks_pcie_setup_interrupts(struct keystone_pcie *ks_pcie) -{ - if (ks_pcie->error_irq > 0) - ks_pcie_enable_error_irq(ks_pcie); -} - /* * When a PCI device does not exist during config cycles, keystone host gets a * bus error instead of returning 0xffffffff. This handler always returns 0 @@ -810,7 +802,6 @@ static int __init ks_pcie_host_init(struct pcie_port *pp) ks_pcie_stop_link(pci); ks_pcie_setup_rc_app_regs(ks_pcie); - ks_pcie_setup_interrupts(ks_pcie); writew(PCI_IO_RANGE_TYPE_32 | (PCI_IO_RANGE_TYPE_32 << 8), pci->dbi_base + PCI_IO_BASE); @@ -854,23 +845,6 @@ static int __init ks_pcie_add_pcie_port(struct keystone_pcie *ks_pcie, struct device *dev = &pdev->dev; int ret; - /* - * Index 0 is the platform interrupt for error interrupt - * from RC. This is optional. - */ - ks_pcie->error_irq = irq_of_parse_and_map(ks_pcie->np, 0); - if (ks_pcie->error_irq <= 0) - dev_info(dev, "no error IRQ defined\n"); - else { - ret = request_irq(ks_pcie->error_irq, ks_pcie_err_irq_handler, - IRQF_SHARED, "pcie-error-irq", ks_pcie); - if (ret < 0) { - dev_err(dev, "failed to request error IRQ %d\n", - ks_pcie->error_irq); - return ret; - } - } - pp->ops = &ks_pcie_host_ops; ret = ks_pcie_dw_host_init(ks_pcie); if (ret) { @@ -946,6 +920,7 @@ static int __init ks_pcie_probe(struct platform_device *pdev) u32 num_lanes; char name[10]; int ret; + int irq; int i; ks_pcie = devm_kzalloc(dev, sizeof(*ks_pcie), GFP_KERNEL); @@ -965,6 +940,20 @@ static int __init ks_pcie_probe(struct platform_device *pdev) return ret; } + irq = platform_get_irq(pdev, 0); + if (irq < 0) { + dev_err(dev, "missing IRQ resource: %d\n", irq); + return irq; + } + + ret = request_irq(irq, ks_pcie_err_irq_handler, IRQF_SHARED, + "ks-pcie-error-irq", ks_pcie); + if (ret < 0) { + dev_err(dev, "failed to request error IRQ %d\n", + irq); + return ret; + } + ret = of_property_read_u32(np, "num-lanes", &num_lanes); if (ret) num_lanes = 1; @@ -1020,6 +1009,8 @@ static int __init ks_pcie_probe(struct platform_device *pdev) if (ret < 0) goto err_get_sync; + ks_pcie_enable_error_irq(ks_pcie); + return 0; err_get_sync: