Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5975344yba; Mon, 13 May 2019 22:37:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqw3FwYDBjosOJabqWT2QqMpz3q4NYdRuoyKSb3eSrx2lsxbgN9nzsD4Y9UPhaoJ8BWIB/+X X-Received: by 2002:a63:cc4e:: with SMTP id q14mr35040984pgi.84.1557812253807; Mon, 13 May 2019 22:37:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557812253; cv=none; d=google.com; s=arc-20160816; b=Xic5wVjZKQRz5eRrSShaHpH4oC95ojz/3ha79TT05878/NrrshKn/VQpgXh02dB+uX sI5U4VDbeodVX3rUhwmMzlJ+NSXkeQ3or5zUl8O+/+x6YoDN+6cJPoBKS3JD12TNIq0Q M7pQgRyMABpJ5qWuCR/MSyMxT1BfJYrZRJ4ctt5vj0S0h2k+7oDeZmZ6SIKueg2TL/YN claUubtOKxqlwy9Ha5CqUyeov250PsFIF1v2Br9z6MKz//wwTKpfcFI51l3pdJxvFJtU r7/Kf4NdOcSELZM/0lK7QmYhW3a3HuEuwHTLhf0ya/sQR7iPY060IMviWQLJfuRN2s8t VVcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=BUOydJOYKqfw1vGDoYoy/mQ+7TBt6hmzNJDpw1eO9Yc=; b=mizkt8Eki+DqzvwHP1/TzQVi7PHIjizKd2+v8X0aU1TDTDv7Q5eiQbZZL3kMCl0n6j tuJMimj+aRQQAMQrZ3yS6htib88jmU+3czRxWiV+rXG6xQYK+W7/csciaXOIXov6lJYT R1pkueaTfN3aKeiDVMtTkH4Dqxpai76Lp9WAJC0Pn7I9AfS89Al0wf+u05CH6E+ozvnS newMAL/tb5rQ8MMJa03wtF6YpghS6lCQeiMLlRRSzvEk4C/w7o3yT1LSaV4s1uHQeo54 qh2rCwU7/pBWv3ErJuwDF2O0fFdxsM1Z3wv6eClR/zZ42Xhwf1gRG+ODHF4GgT7ntJdt H8Gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=a2cBsCTV; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u15si20510942pgn.177.2019.05.13.22.37.18; Mon, 13 May 2019 22:37:33 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=a2cBsCTV; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726790AbfENFfS (ORCPT + 99 others); Tue, 14 May 2019 01:35:18 -0400 Received: from mail-io1-f68.google.com ([209.85.166.68]:43819 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725935AbfENFfR (ORCPT ); Tue, 14 May 2019 01:35:17 -0400 Received: by mail-io1-f68.google.com with SMTP id v7so12014893iob.10; Mon, 13 May 2019 22:35:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=BUOydJOYKqfw1vGDoYoy/mQ+7TBt6hmzNJDpw1eO9Yc=; b=a2cBsCTVrgJJ6cLQ137IbO1f9p0YKaVA25kngwav0+++ixE/mtgJVYepJQmMK1OM9F fMNdfmsG9hTQwosk4jm36dp7KWKwusa8CHzZ9h2WJz91liJLKd7iIsXnEZ3ztUDls8Nw kj69obXgXvYFqJeoFqdvjkipitqp0HJFuvJzDisDKCwHx8IHj0Cqub2twXE3GMpvuhrD nTEYCp0c4A5+yraginrF0vv+up/me39UpGh8Atngi96Nvz6VcTlWFPzeSAZD28pvUkSf WVm6Fh6IqPu6c4PLri8creybLmLMs1f6Cerwifn7CChiXH/oiaNwdJ+4wVNQEw+oEN5h xliw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=BUOydJOYKqfw1vGDoYoy/mQ+7TBt6hmzNJDpw1eO9Yc=; b=UeIhbnNyUkRm8Mtl5qJen54Mu5dL6HH8CU4ByErrSRZfhWzFKD+brT7X3LlNw/ULnp rjfPL2qVa2e0peezSQIIUsBn8xafnwkVZfBAfI+a3YFi+lPO+e+zTWzPSKFMKU4hGJ2e ITDJd6cRBtSO23/4UC7GSw6kI5KIQVKW2/dKnmleRAfC5zndTACYS1rAVV63nRdtE+b5 Wo3g/xdGz4VM/WlDY39Rjki4K+zP0ukL/ck6Av1FM0RQUg5adE20ZUnUl7jJyxGtltth 0ytXTrXzJGwHVtCwn3Pyqp/4y/4hgpAWEE88ASKk0ECawcLi6iR2hLRB6g9bGJGvJtcD TxPg== X-Gm-Message-State: APjAAAUPJAeKRskTQYvFy/Uf0kXjlamh8Enuv7cx6JCvj8NVyecZhaMO WapYjqTplD1BvWmoAU3cNIk8YjRlmHls9Pa9kdQ= X-Received: by 2002:a5e:a51a:: with SMTP id 26mr11296309iog.171.1557812116707; Mon, 13 May 2019 22:35:16 -0700 (PDT) MIME-Version: 1.0 References: <1556081835-12921-1-git-send-email-ley.foon.tan@intel.com> In-Reply-To: <1556081835-12921-1-git-send-email-ley.foon.tan@intel.com> From: Ley Foon Tan Date: Tue, 14 May 2019 13:35:05 +0800 Message-ID: Subject: Re: [PATCH] PCI: altera: Allow building as module To: Ley Foon Tan Cc: Bjorn Helgaas , Lorenzo Pieralisi , linux-kernel@vger.kernel.org, linux-pci , devicetree@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 24, 2019 at 12:57 PM Ley Foon Tan wrote: > > Altera PCIe Rootport IP is a soft IP and is only available after > FPGA image is programmed. > > Make driver modulable to support use case FPGA image is programmed > after kernel is booted. User proram FPGA image in kernel then only load > PCIe driver module. > > Signed-off-by: Ley Foon Tan > --- > drivers/pci/controller/Kconfig | 2 +- > drivers/pci/controller/pcie-altera.c | 28 ++++++++++++++++++++++++++-- > 2 files changed, 27 insertions(+), 3 deletions(-) > > diff --git a/drivers/pci/controller/Kconfig b/drivers/pci/controller/Kconfig > index 6012f3059acd..4b550f9cdd56 100644 > --- a/drivers/pci/controller/Kconfig > +++ b/drivers/pci/controller/Kconfig > @@ -174,7 +174,7 @@ config PCIE_IPROC_MSI > PCIe controller > > config PCIE_ALTERA > - bool "Altera PCIe controller" > + tristate "Altera PCIe controller" > depends on ARM || NIOS2 || ARM64 || COMPILE_TEST > help > Say Y here if you want to enable PCIe controller support on Altera > diff --git a/drivers/pci/controller/pcie-altera.c b/drivers/pci/controller/pcie-altera.c > index 27edcebd1726..6c86bc69ace8 100644 > --- a/drivers/pci/controller/pcie-altera.c > +++ b/drivers/pci/controller/pcie-altera.c > @@ -10,6 +10,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -705,6 +706,13 @@ static int altera_pcie_init_irq_domain(struct altera_pcie *pcie) > return 0; > } > > +static int altera_pcie_irq_teardown(struct altera_pcie *pcie) > +{ > + irq_set_chained_handler_and_data(pcie->irq, NULL, NULL); > + irq_domain_remove(pcie->irq_domain); > + irq_dispose_mapping(pcie->irq); > +} > + > static int altera_pcie_parse_dt(struct altera_pcie *pcie) > { > struct device *dev = &pcie->pdev->dev; > @@ -798,6 +806,7 @@ static int altera_pcie_probe(struct platform_device *pdev) > > pcie = pci_host_bridge_priv(bridge); > pcie->pdev = pdev; > + platform_set_drvdata(pdev, pcie); > > match = of_match_device(altera_pcie_of_match, &pdev->dev); > if (!match) > @@ -855,13 +864,28 @@ static int altera_pcie_probe(struct platform_device *pdev) > return ret; > } > > +static int altera_pcie_remove(struct platform_device *pdev) > +{ > + struct altera_pcie *pcie = platform_get_drvdata(pdev); > + struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie); > + > + pci_stop_root_bus(bridge->bus); > + pci_remove_root_bus(bridge->bus); > + pci_free_resource_list(&pcie->resources); > + altera_pcie_irq_teardown(pcie); > + > + return 0; > +} > + > static struct platform_driver altera_pcie_driver = { > .probe = altera_pcie_probe, > + .remove = altera_pcie_remove, > .driver = { > .name = "altera-pcie", > .of_match_table = altera_pcie_of_match, > - .suppress_bind_attrs = true, > }, > }; > > -builtin_platform_driver(altera_pcie_driver); > +MODULE_DEVICE_TABLE(of, altera_pcie_of_match); > +module_platform_driver(altera_pcie_driver); > +MODULE_LICENSE("GPL v2"); > -- > 2.19.0 > Hi Any comment for this patch? Regards Ley Foon