[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20251126083345.88-3-kernel@airkyi.com>
Date: Wed, 26 Nov 2025 16:33:45 +0800
From: Chaoyi Chen <kernel@...kyi.com>
To: Joerg Roedel <joro@...tes.org>,
Will Deacon <will@...nel.org>,
Robin Murphy <robin.murphy@....com>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Heiko Stuebner <heiko@...ech.de>
Cc: iommu@...ts.linux.dev,
devicetree@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-rockchip@...ts.infradead.org,
linux-kernel@...r.kernel.org,
Chaoyi Chen <chaoyi.chen@...k-chips.com>
Subject: [PATCH 2/2] iommu/rockchip: Use devm_clk_bulk_get_all() to get multiple iface clock
From: Chaoyi Chen <chaoyi.chen@...k-chips.com>
The iommu found on RK3576 NPU/RKVDEC may contains more than one
interface clock.
Just use devm_clk_bulk_get_all() to get all the clocks and use them.
Signed-off-by: Chaoyi Chen <chaoyi.chen@...k-chips.com>
---
drivers/iommu/rockchip-iommu.c | 20 ++++----------------
1 file changed, 4 insertions(+), 16 deletions(-)
diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c
index 0861dd469bd8..76f71fb679f8 100644
--- a/drivers/iommu/rockchip-iommu.c
+++ b/drivers/iommu/rockchip-iommu.c
@@ -93,11 +93,6 @@ struct rk_iommu_domain {
struct iommu_domain domain;
};
-/* list of clocks required by IOMMU */
-static const char * const rk_iommu_clocks[] = {
- "aclk", "iface",
-};
-
struct rk_iommu_ops {
phys_addr_t (*pt_address)(u32 dte);
u32 (*mk_dtentries)(dma_addr_t pt_dma);
@@ -1236,25 +1231,18 @@ static int rk_iommu_probe(struct platform_device *pdev)
iommu->reset_disabled = device_property_read_bool(dev,
"rockchip,disable-mmu-reset");
- iommu->num_clocks = ARRAY_SIZE(rk_iommu_clocks);
- iommu->clocks = devm_kcalloc(iommu->dev, iommu->num_clocks,
- sizeof(*iommu->clocks), GFP_KERNEL);
- if (!iommu->clocks)
- return -ENOMEM;
-
- for (i = 0; i < iommu->num_clocks; ++i)
- iommu->clocks[i].id = rk_iommu_clocks[i];
-
/*
* iommu clocks should be present for all new devices and devicetrees
* but there are older devicetrees without clocks out in the wild.
* So clocks as optional for the time being.
*/
- err = devm_clk_bulk_get(iommu->dev, iommu->num_clocks, iommu->clocks);
+ err = devm_clk_bulk_get_all(dev, &iommu->clocks);
if (err == -ENOENT)
iommu->num_clocks = 0;
- else if (err)
+ else if (err < 0)
return err;
+ else
+ iommu->num_clocks = err;
err = clk_bulk_prepare(iommu->num_clocks, iommu->clocks);
if (err)
--
2.51.1
Powered by blists - more mailing lists