• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisión6e0793f485e078e2f4fe3c45eca0c6042c085c25 (tree)
Tiempo2022-07-25 22:38:47
AutorJanne Grunau <j@jann...>
CommiterTom Rini

Log Message

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>

Cambiar Resumen

Diferencia incremental

--- a/drivers/iommu/apple_dart.c
+++ b/drivers/iommu/apple_dart.c
@@ -24,6 +24,12 @@
2424 #define DART_TTBR_VALID BIT(31)
2525 #define DART_TTBR_SHIFT 12
2626
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+
2733 static int apple_dart_probe(struct udevice *dev)
2834 {
2935 void *base;
@@ -34,7 +40,16 @@ static int apple_dart_probe(struct udevice *dev)
3440 return -EINVAL;
3541
3642 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 {
3853 for (sid = 0; sid < 16; sid++) {
3954 writel(DART_TCR_BYPASS_DART | DART_TCR_BYPASS_DAPF,
4055 base + DART_TCR(sid));
@@ -49,6 +64,7 @@ static int apple_dart_probe(struct udevice *dev)
4964 static const struct udevice_id apple_dart_ids[] = {
5065 { .compatible = "apple,t8103-dart" },
5166 { .compatible = "apple,t6000-dart" },
67+ { .compatible = "apple,t8112-dart" },
5268 { /* sentinel */ }
5369 };
5470