diff options
author | Janne Grunau <j@jannau.net> | 2022-07-01 00:06:16 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-07-25 09:38:47 -0400 |
commit | 6e0793f485e078e2f4fe3c45eca0c6042c085c25 (patch) | |
tree | 66f969ae15abf6e1bf07d565dc8dbc1bf12fd752 /drivers/iommu | |
parent | 538f6643b07586301a115d7aae304f916ba71004 (diff) | |
download | u-boot-6e0793f485e078e2f4fe3c45eca0c6042c085c25.tar.gz u-boot-6e0793f485e078e2f4fe3c45eca0c6042c085c25.tar.bz2 u-boot-6e0793f485e078e2f4fe3c45eca0c6042c085c25.zip |
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>
Diffstat (limited to 'drivers/iommu')
-rw-r--r-- | drivers/iommu/apple_dart.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/drivers/iommu/apple_dart.c b/drivers/iommu/apple_dart.c index f2e1700960..2faacb8f3b 100644 --- a/drivers/iommu/apple_dart.c +++ b/drivers/iommu/apple_dart.c @@ -24,6 +24,12 @@ #define DART_TTBR_VALID BIT(31) #define DART_TTBR_SHIFT 12 +#define DART_T8110_TCR(sid) (0x1000 + 4 * (sid)) +#define DART_T8110_TCR_BYPASS_DAPF BIT(2) +#define DART_T8110_TCR_BYPASS_DART BIT(1) +#define DART_T8110_TCR_TRANSLATE_ENABLE BIT(0) +#define DART_T8110_TTBR(sid) (0x1400 + 4 * (sid)) + static int apple_dart_probe(struct udevice *dev) { void *base; @@ -34,7 +40,16 @@ static int apple_dart_probe(struct udevice *dev) return -EINVAL; u32 params2 = readl(base + DART_PARAMS2); - if (params2 & DART_PARAMS2_BYPASS_SUPPORT) { + if (!(params2 & DART_PARAMS2_BYPASS_SUPPORT)) + return 0; + + if (device_is_compatible(dev, "apple,t8112-dart")) { + for (sid = 0; sid < 256; sid++) { + writel(DART_T8110_TCR_BYPASS_DART | DART_T8110_TCR_BYPASS_DAPF, + base + DART_T8110_TCR(sid)); + writel(0, base + DART_T8110_TTBR(sid)); + } + } else { for (sid = 0; sid < 16; sid++) { writel(DART_TCR_BYPASS_DART | DART_TCR_BYPASS_DAPF, base + DART_TCR(sid)); @@ -49,6 +64,7 @@ static int apple_dart_probe(struct udevice *dev) static const struct udevice_id apple_dart_ids[] = { { .compatible = "apple,t8103-dart" }, { .compatible = "apple,t6000-dart" }, + { .compatible = "apple,t8112-dart" }, { /* sentinel */ } }; |