target/rockchip: rockchip-iommu get all clocks
Signed-off-by: Liangbin Lian <jjm2473@gmail.com>
This commit is contained in:
parent
37a6e9805f
commit
b14a42061a
@ -23,7 +23,7 @@ Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
|
||||
|
||||
--- a/drivers/iommu/rockchip-iommu.c
|
||||
+++ b/drivers/iommu/rockchip-iommu.c
|
||||
@@ -1323,7 +1323,6 @@ static int rk_iommu_of_xlate(struct devi
|
||||
@@ -1290,7 +1290,6 @@ static int rk_iommu_of_xlate(struct devi
|
||||
iommu_dev = of_find_device_by_node(args->np);
|
||||
|
||||
data->iommu = platform_get_drvdata(iommu_dev);
|
||||
@ -31,7 +31,7 @@ Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
|
||||
dev_iommu_priv_set(dev, data);
|
||||
|
||||
platform_device_put(iommu_dev);
|
||||
@@ -1404,6 +1403,8 @@ static int rk_iommu_probe(struct platfor
|
||||
@@ -1362,6 +1361,8 @@ static int rk_iommu_probe(struct platfor
|
||||
if (!iommu)
|
||||
return -ENOMEM;
|
||||
|
||||
@ -0,0 +1,58 @@
|
||||
From 471d9a647afe9b1a770409fd4600b9cbb3c644c6 Mon Sep 17 00:00:00 2001
|
||||
From: Simon Xue <xxm@rock-chips.com>
|
||||
Date: Tue, 7 Sep 2021 14:50:55 +0800
|
||||
Subject: [PATCH] iommu: rockchip: optimise getting clocks
|
||||
|
||||
Use devm_clk_bulk_get_all instead of devm_clk_bulk_get. So we don't need
|
||||
the complicated operation.
|
||||
|
||||
Change-Id: Idbe7668bd26b744f8d8b7d79d5eb99fa891bd0be
|
||||
Signed-off-by: Simon Xue <xxm@rock-chips.com>
|
||||
---
|
||||
drivers/iommu/rockchip-iommu.c | 20 ++++----------------
|
||||
1 file changed, 4 insertions(+), 16 deletions(-)
|
||||
|
||||
--- a/drivers/iommu/rockchip-iommu.c
|
||||
+++ b/drivers/iommu/rockchip-iommu.c
|
||||
@@ -91,11 +91,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);
|
||||
@@ -1409,25 +1404,18 @@ static int rk_iommu_probe(struct platfor
|
||||
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)
|
||||
@ -11,7 +11,7 @@ VPU/NPU drivers do not support passthrough iommu.
|
||||
|
||||
--- a/drivers/iommu/rockchip-iommu.c
|
||||
+++ b/drivers/iommu/rockchip-iommu.c
|
||||
@@ -1298,6 +1298,13 @@ static int rk_iommu_of_xlate(struct devi
|
||||
@@ -1292,6 +1292,13 @@ static int rk_iommu_of_xlate(struct devi
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ VPU/NPU drivers do not support passthrough iommu.
|
||||
void rockchip_iommu_mask_irq(struct device *dev)
|
||||
{
|
||||
struct rk_iommu *iommu = rk_iommu_from_dev(dev);
|
||||
@@ -1340,6 +1347,7 @@ static const struct iommu_ops rk_iommu_o
|
||||
@@ -1334,6 +1341,7 @@ static const struct iommu_ops rk_iommu_o
|
||||
.pgsize_bitmap = RK_IOMMU_PGSIZE_BITMAP,
|
||||
.of_xlate = rk_iommu_of_xlate,
|
||||
.owner = THIS_MODULE,
|
||||
|
||||
@ -11,7 +11,7 @@ fix MPP AV1 decoding
|
||||
|
||||
--- a/drivers/iommu/rockchip-iommu.c
|
||||
+++ b/drivers/iommu/rockchip-iommu.c
|
||||
@@ -910,6 +910,39 @@ static size_t rk_iommu_unmap(struct iomm
|
||||
@@ -905,6 +905,39 @@ static size_t rk_iommu_unmap(struct iomm
|
||||
return unmap_size;
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ fix MPP AV1 decoding
|
||||
static struct rk_iommu *rk_iommu_from_dev(struct device *dev)
|
||||
{
|
||||
struct rk_iommudata *data = dev_iommu_priv_get(dev);
|
||||
@@ -1352,6 +1385,7 @@ static const struct iommu_ops rk_iommu_o
|
||||
@@ -1346,6 +1379,7 @@ static const struct iommu_ops rk_iommu_o
|
||||
.attach_dev = rk_iommu_attach_device,
|
||||
.map = rk_iommu_map,
|
||||
.unmap = rk_iommu_unmap,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user