All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] iommu: Add M2 support to Apple DART driver
@ 2022-06-30 22:06 Janne Grunau
  2022-06-30 22:06 ` [PATCH 2/2] arm: apple: Add initial Apple M2 support Janne Grunau
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Janne Grunau @ 2022-06-30 22:06 UTC (permalink / raw)
  To: u-boot; +Cc: Mark Kettenis, Tom Rini, Simon Glass

"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>
---
 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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] arm: apple: Add initial Apple M2 support
  2022-06-30 22:06 [PATCH 1/2] iommu: Add M2 support to Apple DART driver Janne Grunau
@ 2022-06-30 22:06 ` Janne Grunau
  2022-07-10 17:33   ` Mark Kettenis
  2022-07-25 21:19   ` Tom Rini
  2022-07-10 17:32 ` [PATCH 1/2] iommu: Add M2 support to Apple DART driver Mark Kettenis
  2022-07-25 21:19 ` Tom Rini
  2 siblings, 2 replies; 6+ messages in thread
From: Janne Grunau @ 2022-06-30 22:06 UTC (permalink / raw)
  To: u-boot; +Cc: Mark Kettenis, Tom Rini, Simon Glass

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 <j@jannau.net>
---
 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;
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] iommu: Add M2 support to Apple DART driver
  2022-06-30 22:06 [PATCH 1/2] iommu: Add M2 support to Apple DART driver Janne Grunau
  2022-06-30 22:06 ` [PATCH 2/2] arm: apple: Add initial Apple M2 support Janne Grunau
@ 2022-07-10 17:32 ` Mark Kettenis
  2022-07-25 21:19 ` Tom Rini
  2 siblings, 0 replies; 6+ messages in thread
From: Mark Kettenis @ 2022-07-10 17:32 UTC (permalink / raw)
  To: Janne Grunau; +Cc: u-boot, kettenis, trini, sjg

> From: Janne Grunau <j@jannau.net>
> 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 <j@jannau.net>

Reviewed-by: Mark Kettenis <kettenis@openbsd.org>

> ---
>  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
> 
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] arm: apple: Add initial Apple M2 support
  2022-06-30 22:06 ` [PATCH 2/2] arm: apple: Add initial Apple M2 support Janne Grunau
@ 2022-07-10 17:33   ` Mark Kettenis
  2022-07-25 21:19   ` Tom Rini
  1 sibling, 0 replies; 6+ messages in thread
From: Mark Kettenis @ 2022-07-10 17:33 UTC (permalink / raw)
  To: Janne Grunau; +Cc: u-boot, kettenis, trini, sjg

> From: Janne Grunau <j@jannau.net>
> Date: Fri,  1 Jul 2022 00:06:17 +0200
> 
> 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 <j@jannau.net>

Reviewed-by: Mark Kettenis <kettenis@openbsd.org>

> ---
>  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;
> -- 
> 2.35.1
> 
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] iommu: Add M2 support to Apple DART driver
  2022-06-30 22:06 [PATCH 1/2] iommu: Add M2 support to Apple DART driver Janne Grunau
  2022-06-30 22:06 ` [PATCH 2/2] arm: apple: Add initial Apple M2 support Janne Grunau
  2022-07-10 17:32 ` [PATCH 1/2] iommu: Add M2 support to Apple DART driver Mark Kettenis
@ 2022-07-25 21:19 ` Tom Rini
  2 siblings, 0 replies; 6+ messages in thread
From: Tom Rini @ 2022-07-25 21:19 UTC (permalink / raw)
  To: Janne Grunau; +Cc: u-boot, Mark Kettenis, Simon Glass

[-- Attachment #1: Type: text/plain, Size: 382 bytes --]

On Fri, Jul 01, 2022 at 12:06:16AM +0200, Janne Grunau wrote:

> "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>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] arm: apple: Add initial Apple M2 support
  2022-06-30 22:06 ` [PATCH 2/2] arm: apple: Add initial Apple M2 support Janne Grunau
  2022-07-10 17:33   ` Mark Kettenis
@ 2022-07-25 21:19   ` Tom Rini
  1 sibling, 0 replies; 6+ messages in thread
From: Tom Rini @ 2022-07-25 21:19 UTC (permalink / raw)
  To: Janne Grunau; +Cc: u-boot, Mark Kettenis, Simon Glass

[-- Attachment #1: Type: text/plain, Size: 516 bytes --]

On Fri, Jul 01, 2022 at 12:06:17AM +0200, Janne Grunau wrote:

> 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 <j@jannau.net>
> Reviewed-by: Mark Kettenis <kettenis@openbsd.org>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-07-25 21:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-30 22:06 [PATCH 1/2] iommu: Add M2 support to Apple DART driver Janne Grunau
2022-06-30 22:06 ` [PATCH 2/2] arm: apple: Add initial Apple M2 support Janne Grunau
2022-07-10 17:33   ` Mark Kettenis
2022-07-25 21:19   ` Tom Rini
2022-07-10 17:32 ` [PATCH 1/2] iommu: Add M2 support to Apple DART driver Mark Kettenis
2022-07-25 21:19 ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.