1 From 15a0487680cf506bb4b9bfee2c41b2c3176d4efa Mon Sep 17 00:00:00 2001
2 From: Samuel Holland <samuel@sholland.org>
3 Date: Wed, 27 Apr 2022 19:01:57 -0500
4 Subject: [PATCH 050/117] iommu/sun50i: Support variants without an external
7 The IOMMU in the Allwinner D1 SoC does not have an external reset line.
9 Only attempt to get the reset on hardware variants which should have one
10 according to the binding. And switch from the deprecated function to the
11 explicit "exclusive" variant.
13 Signed-off-by: Samuel Holland <samuel@sholland.org>
15 drivers/iommu/sun50i-iommu.c | 18 ++++++++++++++++--
16 1 file changed, 16 insertions(+), 2 deletions(-)
18 --- a/drivers/iommu/sun50i-iommu.c
19 +++ b/drivers/iommu/sun50i-iommu.c
22 #define SPAGE_SIZE 4096
24 +struct sun50i_iommu_variant {
29 struct iommu_device iommu;
31 @@ -979,9 +983,14 @@ static irqreturn_t sun50i_iommu_irq(int
33 static int sun50i_iommu_probe(struct platform_device *pdev)
35 + const struct sun50i_iommu_variant *variant;
36 struct sun50i_iommu *iommu;
39 + variant = of_device_get_match_data(&pdev->dev);
43 iommu = devm_kzalloc(&pdev->dev, sizeof(*iommu), GFP_KERNEL);
46 @@ -1021,7 +1030,8 @@ static int sun50i_iommu_probe(struct pla
50 - iommu->reset = devm_reset_control_get(&pdev->dev, NULL);
51 + if (variant->has_reset)
52 + iommu->reset = devm_reset_control_get_exclusive(&pdev->dev, NULL);
53 if (IS_ERR(iommu->reset)) {
54 dev_err(&pdev->dev, "Couldn't get our reset line.\n");
55 ret = PTR_ERR(iommu->reset);
56 @@ -1059,8 +1069,12 @@ err_free_cache:
60 +static const struct sun50i_iommu_variant sun50i_h6_iommu = {
64 static const struct of_device_id sun50i_iommu_dt[] = {
65 - { .compatible = "allwinner,sun50i-h6-iommu", },
66 + { .compatible = "allwinner,sun50i-h6-iommu", .data = &sun50i_h6_iommu },
69 MODULE_DEVICE_TABLE(of, sun50i_iommu_dt);