From: Serge Semin <Sergey.Semin@baikalelectronics.ru> To: "Bjorn Helgaas" <bhelgaas@google.com>, "Lorenzo Pieralisi" <lorenzo.pieralisi@arm.com>, "Cai Huoqing" <cai.huoqing@linux.dev>, "Jingoo Han" <jingoohan1@gmail.com>, "Gustavo Pimentel" <gustavo.pimentel@synopsys.com>, "Vinod Koul" <vkoul@kernel.org>, "Manivannan Sadhasivam" <manivannan.sadhasivam@linaro.org>, "Yoshihiro Shimoda" <yoshihiro.shimoda.uh@renesas.com>, "Rob Herring" <robh@kernel.org>, "Lorenzo Pieralisi" <lpieralisi@kernel.org>, "Krzysztof Wilczyński" <kw@linux.com>, "Nobuhiro Iwamatsu" <nobuhiro1.iwamatsu@toshiba.co.jp> Cc: Serge Semin <Sergey.Semin@baikalelectronics.ru>, Serge Semin <fancer.lancer@gmail.com>, Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>, Pavel Parkhomenko <Pavel.Parkhomenko@baikalelectronics.ru>, <linux-pci@vger.kernel.org>, <dmaengine@vger.kernel.org>, <linux-kernel@vger.kernel.org>, Bjorn Helgaas <helgaas@kernel.org>, <linux-arm-kernel@lists.infradead.org> Subject: [PATCH RESEND v3 07/10] PCI: visconti: Convert to using generic resources getter Date: Tue, 11 Apr 2023 06:39:25 +0300 [thread overview] Message-ID: <20230411033928.30397-8-Sergey.Semin@baikalelectronics.ru> (raw) In-Reply-To: <20230411033928.30397-1-Sergey.Semin@baikalelectronics.ru> The generic resources request infrastructure has been recently added to the DW PCIe core driver. Since the DT-bindings of the Toshibo Visconti PCIe Host controller is fully compatible with the generic names set let's convert the driver to using that infrastructure. It won't take much effort since the low-level device driver implies the resources request only with no additional manipulations involving them. So just drop the locally defined clocks request procedures, activate the generic resources request capability and make sure the mandatory resources have been requested by the DW PCIe core driver. Suggested-by: Bjorn Helgaas <helgaas@kernel.org> Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru> --- drivers/pci/controller/dwc/pcie-visconti.c | 37 ++++++++++------------ 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-visconti.c b/drivers/pci/controller/dwc/pcie-visconti.c index 71026fefa366..ae1517b52c58 100644 --- a/drivers/pci/controller/dwc/pcie-visconti.c +++ b/drivers/pci/controller/dwc/pcie-visconti.c @@ -29,9 +29,6 @@ struct visconti_pcie { void __iomem *ulreg_base; void __iomem *smu_base; void __iomem *mpu_base; - struct clk *refclk; - struct clk *coreclk; - struct clk *auxclk; }; #define PCIE_UL_REG_S_PCIE_MODE 0x00F4 @@ -198,6 +195,21 @@ static int visconti_pcie_host_init(struct dw_pcie_rp *pp) int err; u32 val; + if (!pcie->pci.core_clks[DW_PCIE_REF_CLK].clk) { + dev_err(pci->dev, "Missing ref clock source\n"); + return -ENOENT; + } + + if (!pcie->pci.core_clks[DW_PCIE_CORE_CLK].clk) { + dev_err(pci->dev, "Missing core clock source\n"); + return -ENOENT; + } + + if (!pcie->pci.core_clks[DW_PCIE_AUX_CLK].clk) { + dev_err(pci->dev, "Missing aux clock source\n"); + return -ENOENT; + } + visconti_smu_writel(pcie, PISMU_CKON_PCIE_AUX_CLK | PISMU_CKON_PCIE_MSTR_ACLK, PISMU_CKON_PCIE); @@ -242,8 +254,6 @@ static const struct dw_pcie_host_ops visconti_pcie_host_ops = { static int visconti_get_resources(struct platform_device *pdev, struct visconti_pcie *pcie) { - struct device *dev = &pdev->dev; - pcie->ulreg_base = devm_platform_ioremap_resource_byname(pdev, "ulreg"); if (IS_ERR(pcie->ulreg_base)) return PTR_ERR(pcie->ulreg_base); @@ -256,21 +266,6 @@ static int visconti_get_resources(struct platform_device *pdev, if (IS_ERR(pcie->mpu_base)) return PTR_ERR(pcie->mpu_base); - pcie->refclk = devm_clk_get(dev, "ref"); - if (IS_ERR(pcie->refclk)) - return dev_err_probe(dev, PTR_ERR(pcie->refclk), - "Failed to get ref clock\n"); - - pcie->coreclk = devm_clk_get(dev, "core"); - if (IS_ERR(pcie->coreclk)) - return dev_err_probe(dev, PTR_ERR(pcie->coreclk), - "Failed to get core clock\n"); - - pcie->auxclk = devm_clk_get(dev, "aux"); - if (IS_ERR(pcie->auxclk)) - return dev_err_probe(dev, PTR_ERR(pcie->auxclk), - "Failed to get aux clock\n"); - return 0; } @@ -304,6 +299,8 @@ static int visconti_pcie_probe(struct platform_device *pdev) pci->dev = dev; pci->ops = &dw_pcie_ops; + dw_pcie_cap_set(pci, REQ_RES); + ret = visconti_get_resources(pdev, pcie); if (ret) return ret; -- 2.40.0
WARNING: multiple messages have this Message-ID (diff)
From: Serge Semin <Sergey.Semin@baikalelectronics.ru> To: "Bjorn Helgaas" <bhelgaas@google.com>, "Lorenzo Pieralisi" <lorenzo.pieralisi@arm.com>, "Cai Huoqing" <cai.huoqing@linux.dev>, "Jingoo Han" <jingoohan1@gmail.com>, "Gustavo Pimentel" <gustavo.pimentel@synopsys.com>, "Vinod Koul" <vkoul@kernel.org>, "Manivannan Sadhasivam" <manivannan.sadhasivam@linaro.org>, "Yoshihiro Shimoda" <yoshihiro.shimoda.uh@renesas.com>, "Rob Herring" <robh@kernel.org>, "Lorenzo Pieralisi" <lpieralisi@kernel.org>, "Krzysztof Wilczyński" <kw@linux.com>, "Nobuhiro Iwamatsu" <nobuhiro1.iwamatsu@toshiba.co.jp> Cc: Serge Semin <Sergey.Semin@baikalelectronics.ru>, Serge Semin <fancer.lancer@gmail.com>, Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>, Pavel Parkhomenko <Pavel.Parkhomenko@baikalelectronics.ru>, <linux-pci@vger.kernel.org>, <dmaengine@vger.kernel.org>, <linux-kernel@vger.kernel.org>, Bjorn Helgaas <helgaas@kernel.org>, <linux-arm-kernel@lists.infradead.org> Subject: [PATCH RESEND v3 07/10] PCI: visconti: Convert to using generic resources getter Date: Tue, 11 Apr 2023 06:39:25 +0300 [thread overview] Message-ID: <20230411033928.30397-8-Sergey.Semin@baikalelectronics.ru> (raw) In-Reply-To: <20230411033928.30397-1-Sergey.Semin@baikalelectronics.ru> The generic resources request infrastructure has been recently added to the DW PCIe core driver. Since the DT-bindings of the Toshibo Visconti PCIe Host controller is fully compatible with the generic names set let's convert the driver to using that infrastructure. It won't take much effort since the low-level device driver implies the resources request only with no additional manipulations involving them. So just drop the locally defined clocks request procedures, activate the generic resources request capability and make sure the mandatory resources have been requested by the DW PCIe core driver. Suggested-by: Bjorn Helgaas <helgaas@kernel.org> Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru> --- drivers/pci/controller/dwc/pcie-visconti.c | 37 ++++++++++------------ 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-visconti.c b/drivers/pci/controller/dwc/pcie-visconti.c index 71026fefa366..ae1517b52c58 100644 --- a/drivers/pci/controller/dwc/pcie-visconti.c +++ b/drivers/pci/controller/dwc/pcie-visconti.c @@ -29,9 +29,6 @@ struct visconti_pcie { void __iomem *ulreg_base; void __iomem *smu_base; void __iomem *mpu_base; - struct clk *refclk; - struct clk *coreclk; - struct clk *auxclk; }; #define PCIE_UL_REG_S_PCIE_MODE 0x00F4 @@ -198,6 +195,21 @@ static int visconti_pcie_host_init(struct dw_pcie_rp *pp) int err; u32 val; + if (!pcie->pci.core_clks[DW_PCIE_REF_CLK].clk) { + dev_err(pci->dev, "Missing ref clock source\n"); + return -ENOENT; + } + + if (!pcie->pci.core_clks[DW_PCIE_CORE_CLK].clk) { + dev_err(pci->dev, "Missing core clock source\n"); + return -ENOENT; + } + + if (!pcie->pci.core_clks[DW_PCIE_AUX_CLK].clk) { + dev_err(pci->dev, "Missing aux clock source\n"); + return -ENOENT; + } + visconti_smu_writel(pcie, PISMU_CKON_PCIE_AUX_CLK | PISMU_CKON_PCIE_MSTR_ACLK, PISMU_CKON_PCIE); @@ -242,8 +254,6 @@ static const struct dw_pcie_host_ops visconti_pcie_host_ops = { static int visconti_get_resources(struct platform_device *pdev, struct visconti_pcie *pcie) { - struct device *dev = &pdev->dev; - pcie->ulreg_base = devm_platform_ioremap_resource_byname(pdev, "ulreg"); if (IS_ERR(pcie->ulreg_base)) return PTR_ERR(pcie->ulreg_base); @@ -256,21 +266,6 @@ static int visconti_get_resources(struct platform_device *pdev, if (IS_ERR(pcie->mpu_base)) return PTR_ERR(pcie->mpu_base); - pcie->refclk = devm_clk_get(dev, "ref"); - if (IS_ERR(pcie->refclk)) - return dev_err_probe(dev, PTR_ERR(pcie->refclk), - "Failed to get ref clock\n"); - - pcie->coreclk = devm_clk_get(dev, "core"); - if (IS_ERR(pcie->coreclk)) - return dev_err_probe(dev, PTR_ERR(pcie->coreclk), - "Failed to get core clock\n"); - - pcie->auxclk = devm_clk_get(dev, "aux"); - if (IS_ERR(pcie->auxclk)) - return dev_err_probe(dev, PTR_ERR(pcie->auxclk), - "Failed to get aux clock\n"); - return 0; } @@ -304,6 +299,8 @@ static int visconti_pcie_probe(struct platform_device *pdev) pci->dev = dev; pci->ops = &dw_pcie_ops; + dw_pcie_cap_set(pci, REQ_RES); + ret = visconti_get_resources(pdev, pcie); if (ret) return ret; -- 2.40.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-04-11 3:40 UTC|newest] Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-04-11 3:39 [PATCH RESEND v3 00/10] PCI: dwc: Relatively simple fixes and cleanups Serge Semin 2023-04-11 3:39 ` [PATCH RESEND v3 01/10] PCI: dwc: Fix erroneous version type test helper Serge Semin 2023-04-11 11:04 ` Manivannan Sadhasivam 2023-04-11 3:39 ` [PATCH RESEND v3 02/10] PCI: dwc: Fix inbound iATU entries out-of-bounds warning message Serge Semin 2023-04-11 11:05 ` Manivannan Sadhasivam 2023-04-11 3:39 ` [PATCH RESEND v3 03/10] PCI: bt1: Enable async probe type Serge Semin 2023-04-11 11:05 ` Manivannan Sadhasivam 2023-04-11 3:39 ` [PATCH RESEND v3 04/10] PCI: bt1: Fix printing false error message Serge Semin 2023-04-11 11:06 ` Manivannan Sadhasivam 2023-04-11 3:39 ` [PATCH RESEND v3 05/10] PCI: dwc: Drop duplicated fast-link-mode flag unsetting Serge Semin 2023-04-11 11:09 ` Manivannan Sadhasivam 2023-04-11 3:39 ` [PATCH RESEND v3 06/10] PCI: dwc: Drop empty line from dw_pcie_link_set_max_speed() Serge Semin 2023-04-11 11:09 ` Manivannan Sadhasivam 2023-04-11 3:39 ` Serge Semin [this message] 2023-04-11 3:39 ` [PATCH RESEND v3 07/10] PCI: visconti: Convert to using generic resources getter Serge Semin 2023-04-11 11:19 ` Manivannan Sadhasivam 2023-04-11 11:19 ` Manivannan Sadhasivam 2023-04-11 17:10 ` Serge Semin 2023-04-11 17:10 ` Serge Semin 2023-04-11 3:39 ` [PATCH RESEND v3 08/10] MAINTAINERS: Add all generic DW PCIe RP/EP DT-schemas Serge Semin 2023-04-11 11:20 ` Manivannan Sadhasivam 2023-04-11 3:39 ` [PATCH RESEND v3 09/10] MAINTAINERS: Add myself as the DW PCIe core reviewer Serge Semin 2023-04-11 11:24 ` Manivannan Sadhasivam 2023-04-11 17:16 ` Serge Semin 2023-04-11 3:39 ` [PATCH RESEND v3 10/10] MAINTAINERS: Add myself as the DW eDMA driver reviewer Serge Semin 2023-04-11 11:25 ` Manivannan Sadhasivam 2023-04-11 11:02 ` [PATCH RESEND v3 00/10] PCI: dwc: Relatively simple fixes and cleanups Manivannan Sadhasivam 2023-04-11 16:59 ` Serge Semin 2023-04-12 16:58 ` Vinod Koul 2023-04-13 13:34 ` Serge Semin 2023-04-13 14:00 ` Manivannan Sadhasivam 2023-04-14 0:25 ` Serge Semin
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230411033928.30397-8-Sergey.Semin@baikalelectronics.ru \ --to=sergey.semin@baikalelectronics.ru \ --cc=Alexey.Malahov@baikalelectronics.ru \ --cc=Pavel.Parkhomenko@baikalelectronics.ru \ --cc=bhelgaas@google.com \ --cc=cai.huoqing@linux.dev \ --cc=dmaengine@vger.kernel.org \ --cc=fancer.lancer@gmail.com \ --cc=gustavo.pimentel@synopsys.com \ --cc=helgaas@kernel.org \ --cc=jingoohan1@gmail.com \ --cc=kw@linux.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-pci@vger.kernel.org \ --cc=lorenzo.pieralisi@arm.com \ --cc=lpieralisi@kernel.org \ --cc=manivannan.sadhasivam@linaro.org \ --cc=nobuhiro1.iwamatsu@toshiba.co.jp \ --cc=robh@kernel.org \ --cc=vkoul@kernel.org \ --cc=yoshihiro.shimoda.uh@renesas.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.