* [PATCH 0/2] iommu/rockchip: Add support for multiple interface clocks
@ 2025-11-26 8:33 Chaoyi Chen
2025-11-26 8:33 ` [PATCH 1/2] dt-bindings: iommu: rockchip: " Chaoyi Chen
2025-11-26 8:33 ` [PATCH 2/2] iommu/rockchip: Use devm_clk_bulk_get_all() to get multiple iface clock Chaoyi Chen
0 siblings, 2 replies; 5+ messages in thread
From: Chaoyi Chen @ 2025-11-26 8:33 UTC (permalink / raw)
To: Joerg Roedel, Will Deacon, Robin Murphy, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner
Cc: iommu, devicetree, linux-arm-kernel, linux-rockchip, linux-kernel,
Chaoyi Chen
From: Chaoyi Chen <chaoyi.chen@rock-chips.com>
Hi,
Some rockchip iommus require extra clocks besides aclk and interface
clock, such as the iommus for NPU and RKVENC in RK3576.
This series adds support for these extra clocks, which are called
`iface_x`.
Chaoyi Chen (2):
dt-bindings: iommu: rockchip: Add support for multiple interface
clocks
iommu/rockchip: Use devm_clk_bulk_get_all() to get multiple iface
clock
.../bindings/iommu/rockchip,iommu.yaml | 8 ++++++++
drivers/iommu/rockchip-iommu.c | 20 ++++---------------
2 files changed, 12 insertions(+), 16 deletions(-)
--
2.51.1
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH 1/2] dt-bindings: iommu: rockchip: Add support for multiple interface clocks
2025-11-26 8:33 [PATCH 0/2] iommu/rockchip: Add support for multiple interface clocks Chaoyi Chen
@ 2025-11-26 8:33 ` Chaoyi Chen
2025-11-27 7:49 ` Krzysztof Kozlowski
2025-11-26 8:33 ` [PATCH 2/2] iommu/rockchip: Use devm_clk_bulk_get_all() to get multiple iface clock Chaoyi Chen
1 sibling, 1 reply; 5+ messages in thread
From: Chaoyi Chen @ 2025-11-26 8:33 UTC (permalink / raw)
To: Joerg Roedel, Will Deacon, Robin Murphy, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner
Cc: iommu, devicetree, linux-arm-kernel, linux-rockchip, linux-kernel,
Chaoyi Chen
From: Chaoyi Chen <chaoyi.chen@rock-chips.com>
The iommu found on RK3576 NPU/RKVDEC may contains more than one
interface clock.
Signed-off-by: Chaoyi Chen <chaoyi.chen@rock-chips.com>
---
.../devicetree/bindings/iommu/rockchip,iommu.yaml | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/Documentation/devicetree/bindings/iommu/rockchip,iommu.yaml b/Documentation/devicetree/bindings/iommu/rockchip,iommu.yaml
index 6ce41d11ff5e..11cc22a0b1d3 100644
--- a/Documentation/devicetree/bindings/iommu/rockchip,iommu.yaml
+++ b/Documentation/devicetree/bindings/iommu/rockchip,iommu.yaml
@@ -42,14 +42,22 @@ properties:
minItems: 1
clocks:
+ minItems: 2
items:
- description: Core clock
- description: Interface clock
+ - description: Interface clock 1
+ - description: Interface clock 2
+ - description: Interface clock 3
clock-names:
+ minItems: 2
items:
- const: aclk
- const: iface
+ - const: iface_1
+ - const: iface_2
+ - const: iface_3
"#iommu-cells":
const: 0
--
2.51.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 1/2] dt-bindings: iommu: rockchip: Add support for multiple interface clocks
2025-11-26 8:33 ` [PATCH 1/2] dt-bindings: iommu: rockchip: " Chaoyi Chen
@ 2025-11-27 7:49 ` Krzysztof Kozlowski
2025-11-27 8:02 ` Chaoyi Chen
0 siblings, 1 reply; 5+ messages in thread
From: Krzysztof Kozlowski @ 2025-11-27 7:49 UTC (permalink / raw)
To: Chaoyi Chen
Cc: Joerg Roedel, Will Deacon, Robin Murphy, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner, iommu,
devicetree, linux-arm-kernel, linux-rockchip, linux-kernel,
Chaoyi Chen
On Wed, Nov 26, 2025 at 04:33:44PM +0800, Chaoyi Chen wrote:
> From: Chaoyi Chen <chaoyi.chen@rock-chips.com>
>
> The iommu found on RK3576 NPU/RKVDEC may contains more than one
> interface clock.
So you need to restrict this per each variant. See writign schema doc in
DT dir.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] dt-bindings: iommu: rockchip: Add support for multiple interface clocks
2025-11-27 7:49 ` Krzysztof Kozlowski
@ 2025-11-27 8:02 ` Chaoyi Chen
0 siblings, 0 replies; 5+ messages in thread
From: Chaoyi Chen @ 2025-11-27 8:02 UTC (permalink / raw)
To: Krzysztof Kozlowski, Chaoyi Chen
Cc: Joerg Roedel, Will Deacon, Robin Murphy, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner, iommu,
devicetree, linux-arm-kernel, linux-rockchip, linux-kernel
On 11/27/2025 3:49 PM, Krzysztof Kozlowski wrote:
> On Wed, Nov 26, 2025 at 04:33:44PM +0800, Chaoyi Chen wrote:
>> From: Chaoyi Chen <chaoyi.chen@rock-chips.com>
>>
>> The iommu found on RK3576 NPU/RKVDEC may contains more than one
>> interface clock.
>
> So you need to restrict this per each variant. See writign schema doc in
> DT dir.
Oh, I will rewrite it in v2. Thank you.
>
> Best regards,
> Krzysztof
>
>
>
--
Best,
Chaoyi
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] iommu/rockchip: Use devm_clk_bulk_get_all() to get multiple iface clock
2025-11-26 8:33 [PATCH 0/2] iommu/rockchip: Add support for multiple interface clocks Chaoyi Chen
2025-11-26 8:33 ` [PATCH 1/2] dt-bindings: iommu: rockchip: " Chaoyi Chen
@ 2025-11-26 8:33 ` Chaoyi Chen
1 sibling, 0 replies; 5+ messages in thread
From: Chaoyi Chen @ 2025-11-26 8:33 UTC (permalink / raw)
To: Joerg Roedel, Will Deacon, Robin Murphy, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner
Cc: iommu, devicetree, linux-arm-kernel, linux-rockchip, linux-kernel,
Chaoyi Chen
From: Chaoyi Chen <chaoyi.chen@rock-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@rock-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
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-11-27 8:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-26 8:33 [PATCH 0/2] iommu/rockchip: Add support for multiple interface clocks Chaoyi Chen
2025-11-26 8:33 ` [PATCH 1/2] dt-bindings: iommu: rockchip: " Chaoyi Chen
2025-11-27 7:49 ` Krzysztof Kozlowski
2025-11-27 8:02 ` Chaoyi Chen
2025-11-26 8:33 ` [PATCH 2/2] iommu/rockchip: Use devm_clk_bulk_get_all() to get multiple iface clock Chaoyi Chen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).