Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1525DC43334 for ; Sun, 10 Jul 2022 17:32:40 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2E096842BC; Sun, 10 Jul 2022 19:32:38 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xs4all.nl Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 73A2684504; Sun, 10 Jul 2022 19:32:35 +0200 (CEST) Received: from sibelius.xs4all.nl (80-61-163-207.fixed.kpn.net [80.61.163.207]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id F14BA84189 for ; Sun, 10 Jul 2022 19:32:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xs4all.nl Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=mark.kettenis@xs4all.nl Received: from localhost (bloch.sibelius.xs4all.nl [local]) by bloch.sibelius.xs4all.nl (OpenSMTPD) with ESMTPA id 1deabd2f; Sun, 10 Jul 2022 19:32:31 +0200 (CEST) Date: Sun, 10 Jul 2022 19:32:31 +0200 (CEST) From: Mark Kettenis To: Janne Grunau Cc: u-boot@lists.denx.de, kettenis@openbsd.org, trini@konsulko.com, sjg@chromium.org In-Reply-To: <20220630220617.23530-1-j@jannau.net> (message from Janne Grunau on Fri, 1 Jul 2022 00:06:16 +0200) Subject: Re: [PATCH 1/2] iommu: Add M2 support to Apple DART driver References: <20220630220617.23530-1-j@jannau.net> Message-ID: X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean > From: Janne Grunau > Date: Fri, 1 Jul 2022 00:06:16 +0200 > > "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 Reviewed-by: Mark Kettenis > --- > drivers/iommu/apple_dart.c | 18 +++++++++++++++++- > 1 file changed, 17 insertions(+), 1 deletion(-) > > diff --git a/drivers/iommu/apple_dart.c b/drivers/iommu/apple_dart.c > index f2e170096072..2faacb8f3b6f 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 */ } > }; > > -- > 2.35.1 > >