From patchwork Thu Jun 30 22:06:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janne Grunau X-Patchwork-Id: 1650905 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LYsqX0SKMz9s09 for ; Fri, 1 Jul 2022 08:06:30 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5860D843D5; Fri, 1 Jul 2022 00:06:21 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=jannau.net 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 538C784422; Fri, 1 Jul 2022 00:06:20 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from soltyk.jannau.net (soltyk.jannau.net [144.76.91.90]) (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 2E097838BB for ; Fri, 1 Jul 2022 00:06:18 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=jannau.net Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=j@jannau.net Received: from coburn.home.jannau.net (p579ad988.dip0.t-ipconnect.de [87.154.217.136]) by soltyk.jannau.net (Postfix) with ESMTPSA id 9D89A26ED79; Fri, 1 Jul 2022 00:06:17 +0200 (CEST) From: Janne Grunau To: u-boot@lists.denx.de Cc: Mark Kettenis , Tom Rini , Simon Glass Subject: [PATCH 1/2] iommu: Add M2 support to Apple DART driver Date: Fri, 1 Jul 2022 00:06:16 +0200 Message-Id: <20220630220617.23530-1-j@jannau.net> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 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 "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 */ } }; From patchwork Thu Jun 30 22:06:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janne Grunau X-Patchwork-Id: 1650906 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LYsqc23XWz9s09 for ; Fri, 1 Jul 2022 08:06:36 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B9B018443C; Fri, 1 Jul 2022 00:06:22 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=jannau.net 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 AF70583C97; Fri, 1 Jul 2022 00:06:20 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from soltyk.jannau.net (soltyk.jannau.net [144.76.91.90]) (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 74F74843D5 for ; Fri, 1 Jul 2022 00:06:18 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=jannau.net Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=j@jannau.net Received: from coburn.home.jannau.net (p579ad988.dip0.t-ipconnect.de [87.154.217.136]) by soltyk.jannau.net (Postfix) with ESMTPSA id 215E226ED7A; Fri, 1 Jul 2022 00:06:18 +0200 (CEST) From: Janne Grunau To: u-boot@lists.denx.de Cc: Mark Kettenis , Tom Rini , Simon Glass Subject: [PATCH 2/2] arm: apple: Add initial Apple M2 support Date: Fri, 1 Jul 2022 00:06:17 +0200 Message-Id: <20220630220617.23530-2-j@jannau.net> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220630220617.23530-1-j@jannau.net> References: <20220630220617.23530-1-j@jannau.net> MIME-Version: 1.0 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 Apple's M2 SoC very similar to the M1 and can use the same memory map. The keyboard/trackpad on the MacBook Pro (13-inch, M2, 2022) uses "dockchannel" as transport instead of SPI and needs a new driver. USB, NVMe, uart, framebuffer and watchdog are working with the existing drivers. Signed-off-by: Janne Grunau Reviewed-by: Mark Kettenis --- arch/arm/mach-apple/board.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-apple/board.c b/arch/arm/mach-apple/board.c index 1525a9edee8e..16046423128c 100644 --- a/arch/arm/mach-apple/board.c +++ b/arch/arm/mach-apple/board.c @@ -16,7 +16,7 @@ DECLARE_GLOBAL_DATA_PTR; -/* Apple M1 */ +/* Apple M1/M2 */ static struct mm_region t8103_mem_map[] = { { @@ -376,7 +376,8 @@ void build_mem_map(void) fdt_size_t size; int i; - if (of_machine_is_compatible("apple,t8103")) + if (of_machine_is_compatible("apple,t8103") || + of_machine_is_compatible("apple,t8112")) mem_map = t8103_mem_map; else if (of_machine_is_compatible("apple,t6000")) mem_map = t6000_mem_map;