Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp910976ybv; Thu, 20 Feb 2020 09:25:10 -0800 (PST) X-Google-Smtp-Source: APXvYqyKlW9ZGbmSBRXVA/dekqoAse/OgJjxQsvQZbmqh2GTmT3nXzyUpnBTX4ZIHDK67hwmKc0B X-Received: by 2002:a05:6830:4c7:: with SMTP id s7mr24137764otd.359.1582219510099; Thu, 20 Feb 2020 09:25:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582219510; cv=none; d=google.com; s=arc-20160816; b=TzEvbadWgMydi+caLt9pjvYaBQiZVwLVTviokMVznATLQ6VhGbEx/fEz94N+D0iy1J wU6HOFwsdccFTMxeXj0sow1de2anYgs9ZJNnEG916FBJ2bq+H++Wd54aImx2/qy6+T3x xFsc5Wyu1tnjyCeoaB2CXq4xGLE39TxtZ+buwBxaZcyIY8YbLxIvwv5xE80Pc8fv/Uxn e5nprCkJmMg8nxCZ3NSdxc9uiFxIY+HYIttMNT3SsPpgMbEs21UQoH1W0Um3vIJIZSXi QhjZ9vKleaADxCtZrPAMoCvlxHDF0+IyIyAm0hTMosAtQUI6M6CEr0tgcUyUPZdAsvzA MdTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=DP+WeV+eCsLNcM+0j7VvT82QxXGphPuPG6yUJrTyu2U=; b=HlNo53O5Dech1Li55bxZK1EyZ1uI+HteazHe2dYCjGfwJP9OGOKYIkPXm73QKDThOd PNN39w/M8DlbEQwCYnAqmoItaQdOIEYXWYRayMXsVAamNKK4aG5mZQD01bUK3vQoMnkr ue2ahBuqT9tLhqrYVOS/fEaXxhgxu3f1Ku26benyxFlrduDZwePD3PcgHhZdMhe3MhFD E8eGIK+rFp31/drNL2TezwcYKkFzDUOGum5ElOoyTCM3dSJKe4Y8vyrMD/RVfdrFXVAG bqKJaIEcehRZecyZ8k3dfOlU+OVOuiBotAOc8hwP9dUM72/ehbm2Mo3qNTEkbP07B9rI fHLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@thegoodpenguin-co-uk.20150623.gappssmtp.com header.s=20150623 header.b=R78Qigu1; 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 8si11239531oix.109.2020.02.20.09.24.57; Thu, 20 Feb 2020 09:25:10 -0800 (PST) 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; dkim=pass header.i=@thegoodpenguin-co-uk.20150623.gappssmtp.com header.s=20150623 header.b=R78Qigu1; 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 S1728809AbgBTRXx (ORCPT + 99 others); Thu, 20 Feb 2020 12:23:53 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:54726 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728733AbgBTRXw (ORCPT ); Thu, 20 Feb 2020 12:23:52 -0500 Received: by mail-wm1-f68.google.com with SMTP id n3so2881967wmk.4 for ; Thu, 20 Feb 2020 09:23:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thegoodpenguin-co-uk.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=DP+WeV+eCsLNcM+0j7VvT82QxXGphPuPG6yUJrTyu2U=; b=R78Qigu18fQdSDHxyFt+gW5wubpXXtRHLj65ytZxFXLLy3m/Co+0ptUws9rqJFpJTg 5+KMf7B15USerdDLnaoM9irKTCXrd4+J95sO5zPCYQiTRs1Gx8H+H+x3G2CiCAvuyJu5 /U/9vm5hgp+xuWqrMkrMZg0yyxMQOx5fXOOBCnAmpu0LyPxTUnE7Woy2rl4jTb9Ms9hr BzKxrwajcq3cp0lXRn35Sj3uf/H+DPPJh2HtZNdDHWmp+kfRaedRNapGWL/oRqlgLd9B vgTlVOzYwGfyHr6qIwYaKx8aSkCjt4Qex3WgH9VjUUnUTQGJ47QI/fkm1+Agh9LLL/qK l0SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=DP+WeV+eCsLNcM+0j7VvT82QxXGphPuPG6yUJrTyu2U=; b=dJ0HZtUN19FwSk5NElRvh4/jCfjkMjS8AEksVfwamwvCxvD3Qz06kXZ2Ga6VtcNkjS JLgubchtCLlUKdN1HDJKq+rrTW+mPhziDu+xu9ZQuMeBo2cKQzwA/DIV2SaBizsi38Sq Sub4de5o5bLB/9oNqrBcErh0i3JHpDWBNoGZdafjijTKrN2SmYubf0hIZV5ZHyZ6wO4T R/lnYuCcONcFExQCANZ/SblqxQ48y+QdJhSjPbt9Ty5CEHliDHDcx2Df6plD49sezBUg y/ioefLs6uyh6AotPMfJjKQARvdjfJ5gFhyC9kIfKNbHVscSoXCtVQbHh4uy/MUARqCT mfBw== X-Gm-Message-State: APjAAAW9KxKSKe9cHwVawWzBFqOo31AgDJ3qSzLiy54xcwMRNHn0MWOn hkhBT+OsvCUBpVbNTbMD6LsU3A== X-Received: by 2002:a1c:b789:: with SMTP id h131mr5560317wmf.148.1582219430876; Thu, 20 Feb 2020 09:23:50 -0800 (PST) Received: from big-machine ([2a00:23c5:dd80:8400:98d8:49e6:cdcc:25df]) by smtp.gmail.com with ESMTPSA id c77sm5261153wmd.12.2020.02.20.09.23.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Feb 2020 09:23:50 -0800 (PST) Date: Thu, 20 Feb 2020 17:23:48 +0000 From: Andrew Murray To: Zhiqiang Hou Cc: linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, bhelgaas@google.com, robh+dt@kernel.org, andrew.murray@arm.com, arnd@arndb.de, mark.rutland@arm.com, l.subrahmanya@mobiveil.co.in, shawnguo@kernel.org, m.karthikeyan@mobiveil.co.in, leoyang.li@nxp.com, lorenzo.pieralisi@arm.com, catalin.marinas@arm.com, will.deacon@arm.com, Mingkai.Hu@nxp.com, Minghuan.Lian@nxp.com, Xiaowei.Bao@nxp.com Subject: Re: [PATCHv10 03/13] PCI: mobiveil: Collect the interrupt related operations into a function Message-ID: <20200220172348.GF19388@big-machine> References: <20200213040644.45858-1-Zhiqiang.Hou@nxp.com> <20200213040644.45858-4-Zhiqiang.Hou@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200213040644.45858-4-Zhiqiang.Hou@nxp.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 13, 2020 at 12:06:34PM +0800, Zhiqiang Hou wrote: > From: Hou Zhiqiang > > Collect the interrupt initialization related operations into > a new function such that it is more readable. > > Signed-off-by: Hou Zhiqiang Reviewed-by: Andrew Murray > --- > V10: > - Refined the subject and change log. > > drivers/pci/controller/pcie-mobiveil.c | 65 +++++++++++++++++--------- > 1 file changed, 42 insertions(+), 23 deletions(-) > > diff --git a/drivers/pci/controller/pcie-mobiveil.c b/drivers/pci/controller/pcie-mobiveil.c > index 01df04ea5b48..9449528bb14f 100644 > --- a/drivers/pci/controller/pcie-mobiveil.c > +++ b/drivers/pci/controller/pcie-mobiveil.c > @@ -454,12 +454,6 @@ static int mobiveil_pcie_parse_dt(struct mobiveil_pcie *pcie) > return PTR_ERR(pcie->csr_axi_slave_base); > pcie->pcie_reg_base = res->start; > > - /* map MSI config resource */ > - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "apb_csr"); > - pcie->apb_csr_base = devm_pci_remap_cfg_resource(dev, res); > - if (IS_ERR(pcie->apb_csr_base)) > - return PTR_ERR(pcie->apb_csr_base); > - > /* read the number of windows requested */ > if (of_property_read_u32(node, "apio-wins", &pcie->apio_wins)) > pcie->apio_wins = MAX_PIO_WINDOWS; > @@ -467,12 +461,6 @@ static int mobiveil_pcie_parse_dt(struct mobiveil_pcie *pcie) > if (of_property_read_u32(node, "ppio-wins", &pcie->ppio_wins)) > pcie->ppio_wins = MAX_PIO_WINDOWS; > > - rp->irq = platform_get_irq(pdev, 0); > - if (rp->irq <= 0) { > - dev_err(dev, "failed to map IRQ: %d\n", rp->irq); > - return -ENODEV; > - } > - > return 0; > } > > @@ -618,9 +606,6 @@ static int mobiveil_host_init(struct mobiveil_pcie *pcie) > pab_ctrl |= (1 << AMBA_PIO_ENABLE_SHIFT) | (1 << PEX_PIO_ENABLE_SHIFT); > mobiveil_csr_writel(pcie, pab_ctrl, PAB_CTRL); > > - mobiveil_csr_writel(pcie, (PAB_INTP_INTX_MASK | PAB_INTP_MSI_MASK), > - PAB_INTP_AMBA_MISC_ENB); > - > /* > * program PIO Enable Bit to 1 and Config Window Enable Bit to 1 in > * PAB_AXI_PIO_CTRL Register > @@ -670,9 +655,6 @@ static int mobiveil_host_init(struct mobiveil_pcie *pcie) > value |= (PCI_CLASS_BRIDGE_PCI << 16); > mobiveil_csr_writel(pcie, value, PAB_INTP_AXI_PIO_CLASS); > > - /* setup MSI hardware registers */ > - mobiveil_pcie_enable_msi(pcie); > - > return 0; > } > > @@ -873,6 +855,46 @@ static int mobiveil_pcie_init_irq_domain(struct mobiveil_pcie *pcie) > return 0; > } > > +static int mobiveil_pcie_interrupt_init(struct mobiveil_pcie *pcie) > +{ > + struct platform_device *pdev = pcie->pdev; > + struct device *dev = &pdev->dev; > + struct mobiveil_root_port *rp = &pcie->rp; > + struct resource *res; > + int ret; > + > + /* map MSI config resource */ > + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "apb_csr"); > + pcie->apb_csr_base = devm_pci_remap_cfg_resource(dev, res); > + if (IS_ERR(pcie->apb_csr_base)) > + return PTR_ERR(pcie->apb_csr_base); > + > + /* setup MSI hardware registers */ > + mobiveil_pcie_enable_msi(pcie); > + > + rp->irq = platform_get_irq(pdev, 0); > + if (rp->irq <= 0) { > + dev_err(dev, "failed to map IRQ: %d\n", rp->irq); > + return -ENODEV; > + } > + > + /* initialize the IRQ domains */ > + ret = mobiveil_pcie_init_irq_domain(pcie); > + if (ret) { > + dev_err(dev, "Failed creating IRQ Domain\n"); > + return ret; > + } > + > + irq_set_chained_handler_and_data(rp->irq, mobiveil_pcie_isr, pcie); > + > + /* Enable interrupts */ > + mobiveil_csr_writel(pcie, (PAB_INTP_INTX_MASK | PAB_INTP_MSI_MASK), > + PAB_INTP_AMBA_MISC_ENB); > + > + > + return 0; > +} > + > static int mobiveil_pcie_host_probe(struct mobiveil_pcie *pcie) > { > struct mobiveil_root_port *rp = &pcie->rp; > @@ -906,15 +928,12 @@ static int mobiveil_pcie_host_probe(struct mobiveil_pcie *pcie) > return ret; > } > > - /* initialize the IRQ domains */ > - ret = mobiveil_pcie_init_irq_domain(pcie); > + ret = mobiveil_pcie_interrupt_init(pcie); > if (ret) { > - dev_err(dev, "Failed creating IRQ Domain\n"); > + dev_err(dev, "Interrupt init failed\n"); > return ret; > } > > - irq_set_chained_handler_and_data(rp->irq, mobiveil_pcie_isr, pcie); > - > /* Initialize bridge */ > bridge->dev.parent = dev; > bridge->sysdata = pcie; > -- > 2.17.1 >