Revision | 6e0793f485e078e2f4fe3c45eca0c6042c085c25 (tree) |
---|---|
Time | 2022-07-25 22:38:47 |
Author | Janne Grunau <j@jann...> |
Commiter | Tom Rini |
iommu: Add M2 support to Apple DART driver
"apple,t8112-dart" uses an incompatible register interface but still
offers the same functionality. This DART is found on the M2 and M1
Pro/Max/Ultra SoCs.
Signed-off-by: Janne Grunau <j@jannau.net>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
@@ -24,6 +24,12 @@ | ||
24 | 24 | #define DART_TTBR_VALID BIT(31) |
25 | 25 | #define DART_TTBR_SHIFT 12 |
26 | 26 | |
27 | +#define DART_T8110_TCR(sid) (0x1000 + 4 * (sid)) | |
28 | +#define DART_T8110_TCR_BYPASS_DAPF BIT(2) | |
29 | +#define DART_T8110_TCR_BYPASS_DART BIT(1) | |
30 | +#define DART_T8110_TCR_TRANSLATE_ENABLE BIT(0) | |
31 | +#define DART_T8110_TTBR(sid) (0x1400 + 4 * (sid)) | |
32 | + | |
27 | 33 | static int apple_dart_probe(struct udevice *dev) |
28 | 34 | { |
29 | 35 | void *base; |
@@ -34,7 +40,16 @@ static int apple_dart_probe(struct udevice *dev) | ||
34 | 40 | return -EINVAL; |
35 | 41 | |
36 | 42 | u32 params2 = readl(base + DART_PARAMS2); |
37 | - if (params2 & DART_PARAMS2_BYPASS_SUPPORT) { | |
43 | + if (!(params2 & DART_PARAMS2_BYPASS_SUPPORT)) | |
44 | + return 0; | |
45 | + | |
46 | + if (device_is_compatible(dev, "apple,t8112-dart")) { | |
47 | + for (sid = 0; sid < 256; sid++) { | |
48 | + writel(DART_T8110_TCR_BYPASS_DART | DART_T8110_TCR_BYPASS_DAPF, | |
49 | + base + DART_T8110_TCR(sid)); | |
50 | + writel(0, base + DART_T8110_TTBR(sid)); | |
51 | + } | |
52 | + } else { | |
38 | 53 | for (sid = 0; sid < 16; sid++) { |
39 | 54 | writel(DART_TCR_BYPASS_DART | DART_TCR_BYPASS_DAPF, |
40 | 55 | base + DART_TCR(sid)); |
@@ -49,6 +64,7 @@ static int apple_dart_probe(struct udevice *dev) | ||
49 | 64 | static const struct udevice_id apple_dart_ids[] = { |
50 | 65 | { .compatible = "apple,t8103-dart" }, |
51 | 66 | { .compatible = "apple,t6000-dart" }, |
67 | + { .compatible = "apple,t8112-dart" }, | |
52 | 68 | { /* sentinel */ } |
53 | 69 | }; |
54 | 70 |