Skip to contentSkip to conversation

Apple M1 Support

PATCH Superseded Mark Kettenis 4 participants 16 messages Oct 11, 2021 – Oct 14, 2021

Subsystems (8)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover Apple M1 Support

This series adds basic support for Apple's M1 SoC to U-Boot. This builds a basic U-Boot that can be used as a payload for the m1n1 boot loader being developed by the Asahi Linux project.

The goal here is to privide an UEFI interface on these machines that allows booting various open source OSes. This initial series provides support for the serial port, framebuffer and the USB 3.1 Type-C ports. It can boot a support OS (e.g. OpenBSD/arm64) from a USB disk.

This version attempts to address most comments. It doesn't add a proper WDT/sysreset driver yet since I prefer to do that once the device tree bindings for that have been ironed out.

ChangeLog:

v2: - Add IOMMU uclass and use it for the DART driver
- Cut back DART driver to only support bypass mode
- Rework the S5P serial support to use more DT stuff
- Update preliminary device trees

v3: - Respin for CONFIG_SYS_LOAD_ADDR kconfig migration

Mark Kettenis (7):
iommu: Add IOMMU uclass
test: Add tests for IOMMU uclass
arm: apple: Add initial support for Apple's M1 SoC
serial: s5p: Add Apple M1 support
iommu: Add Apple DART driver
arm: dts: apple: Add preliminary device trees
doc: board: apple: Add Apple M1 documentation

 arch/arm/Kconfig                              |  23 +
 arch/arm/Makefile                             |   1 +
 arch/arm/dts/Makefile                         |   4 +
 arch/arm/dts/t8103-j274.dts                   | 135 +++++
 arch/arm/dts/t8103-j293.dts                   |  97 +++
 arch/arm/dts/t8103.dtsi                       | 560 ++++++++++++++++++
 arch/arm/include/asm/arch-m1/uart.h           |  41 ++
 arch/arm/mach-apple/Kconfig                   |  18 +
 arch/arm/mach-apple/Makefile                  |   4 +
 arch/arm/mach-apple/board.c                   | 161 +++++
 arch/arm/mach-apple/lowlevel_init.S           |  17 +
 arch/sandbox/dts/test.dts                     |   6 +
 configs/apple_m1_defconfig                    |  20 +
 configs/sandbox64_defconfig                   |   1 +
 configs/sandbox_defconfig                     |   1 +
 configs/sandbox_flattree_defconfig            |   1 +
 configs/sandbox_noinst_defconfig              |   1 +
 configs/sandbox_spl_defconfig                 |   1 +
 doc/board/apple/index.rst                     |   9 +
 doc/board/apple/m1.rst                        |  56 ++
 doc/board/index.rst                           |   1 +
 drivers/Kconfig                               |   2 +
 drivers/Makefile                              |   1 +
 drivers/core/device.c                         |   8 +
 drivers/iommu/Kconfig                         |  23 +
 drivers/iommu/Makefile                        |   6 +
 drivers/iommu/apple_dart.c                    |  59 ++
 drivers/iommu/iommu-uclass.c                  |  45 ++
 drivers/iommu/sandbox_iommu.c                 |  18 +
 drivers/serial/Kconfig                        |   4 +-
 drivers/serial/serial_s5p.c                   | 104 +++-
 include/configs/apple.h                       |  36 ++
 include/dm/uclass-id.h                        |   1 +
 .../interrupt-controller/apple-aic.h          |  15 +
 include/dt-bindings/pinctrl/apple.h           |  13 +
 include/dt-bindings/spmi/spmi.h               |  10 +
 include/iommu.h                               |  16 +
 test/dm/Makefile                              |   1 +
 test/dm/iommu.c                               |  28 +
 39 files changed, 1524 insertions(+), 24 deletions(-)
 create mode 100644 arch/arm/dts/t8103-j274.dts
 create mode 100644 arch/arm/dts/t8103-j293.dts
 create mode 100644 arch/arm/dts/t8103.dtsi
 create mode 100644 arch/arm/include/asm/arch-m1/uart.h
 create mode 100644 arch/arm/mach-apple/Kconfig
 create mode 100644 arch/arm/mach-apple/Makefile
 create mode 100644 arch/arm/mach-apple/board.c
 create mode 100644 arch/arm/mach-apple/lowlevel_init.S
 create mode 100644 configs/apple_m1_defconfig
 create mode 100644 doc/board/apple/index.rst
 create mode 100644 doc/board/apple/m1.rst
 create mode 100644 drivers/iommu/Kconfig
 create mode 100644 drivers/iommu/Makefile
 create mode 100644 drivers/iommu/apple_dart.c
 create mode 100644 drivers/iommu/iommu-uclass.c
 create mode 100644 drivers/iommu/sandbox_iommu.c
 create mode 100644 include/configs/apple.h
 create mode 100644 include/dt-bindings/interrupt-controller/apple-aic.h
 create mode 100644 include/dt-bindings/pinctrl/apple.h
 create mode 100644 include/dt-bindings/spmi/spmi.h
 create mode 100644 include/iommu.h
 create mode 100644 test/dm/iommu.c
Signature · 1 line
2.33.0
#1 lore raw

PATCH v3 1/7 iommu: Add IOMMU uclass

This uclass is intended to manage IOMMUs on systems where the IOMMUs are not in bypass mode by default. In that case U-Boot cannot ignore the IOMMUs if it wants to use devices that need to do DMA and sit behind such an IOMMU.

This initial IOMMU uclass implementation does not implement and device ops and is intended for IOMMUs that have a bypass mode that does not require address translation. Support for IOMMUs that do require address translation is planned and device ops will be defined when support for such IOMMUs will be added.

---
 drivers/Kconfig              |  2 ++
 drivers/Makefile             |  1 +
 drivers/core/device.c        |  8 +++++++
 drivers/iommu/Kconfig        | 13 +++++++++++
 drivers/iommu/Makefile       |  3 +++
 drivers/iommu/iommu-uclass.c | 45 ++++++++++++++++++++++++++++++++++++
 include/dm/uclass-id.h       |  1 +
 include/iommu.h              | 16 +++++++++++++
 8 files changed, 89 insertions(+)
 create mode 100644 drivers/iommu/Kconfig
 create mode 100644 drivers/iommu/Makefile
 create mode 100644 drivers/iommu/iommu-uclass.c
 create mode 100644 include/iommu.h
drivers/Kconfig +2 -0
index 417d6f88c2..b26ca8cf70 100644
@@ -50,6 +50,8 @@ source "drivers/i2c/Kconfig"
 
 source "drivers/input/Kconfig"
 
+source "drivers/iommu/Kconfig"
+
 source "drivers/led/Kconfig"
 
 source "drivers/mailbox/Kconfig"
drivers/Makefile +1 -0
index 4cbc40787d..4e7cf28440 100644
@@ -102,6 +102,7 @@ obj-y += mtd/
 obj-y += pwm/
 obj-y += reset/
 obj-y += input/
+obj-y += iommu/
 # SOC specific infrastructure drivers.
 obj-y += smem/
 obj-y += thermal/
drivers/core/device.c +8 -0
index 42ba2dce46..0242ec43e1 100644
@@ -28,6 +28,7 @@
 #include <dm/uclass.h>
 #include <dm/uclass-internal.h>
 #include <dm/util.h>
+#include <iommu.h>
 #include <linux/err.h>
 #include <linux/list.h>
 #include <power-domain.h>
@@ -543,6 +544,13 @@ int device_probe(struct udevice *dev)
 			goto fail;
 	}
 
+	if (CONFIG_IS_ENABLED(IOMMU) && dev->parent &&
+	    (device_get_uclass_id(dev) != UCLASS_IOMMU)) {
+		ret = dev_iommu_probe(dev);
+		if (ret)
+			goto fail;
+	}
+
 	ret = device_get_dma_constraints(dev);
 	if (ret)
 		goto fail;
drivers/iommu/Kconfig new file +13 -0
new file mode 100644
index 0000000000..8cb377560e
@@ -0,0 +1,13 @@
+#
+# IOMMU devices
+#
+
+menu "IOMMU device drivers"
+
+config IOMMU
+	bool "Enable Driver Model for IOMMU drivers"
+	depends on DM
+	help
+	  Enable driver model for IOMMU devices.
+
+endmenu
drivers/iommu/Makefile new file +3 -0
new file mode 100644
index 0000000000..f1ceb10150
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0+
+
+obj-$(CONFIG_IOMMU) += iommu-uclass.o
drivers/iommu/iommu-uclass.c new file +45 -0

45 lines not on this page · raw message

include/dm/uclass-id.h +1 -0
index 3768432b68..fd139b9b2a 100644
@@ -62,6 +62,7 @@ enum uclass_id {
 	UCLASS_I2C_MUX,		/* I2C multiplexer */
 	UCLASS_I2S,		/* I2S bus */
 	UCLASS_IDE,		/* IDE device */
+	UCLASS_IOMMU,		/* IOMMU */
 	UCLASS_IRQ,		/* Interrupt controller */
 	UCLASS_KEYBOARD,	/* Keyboard input device */
 	UCLASS_LED,		/* Light-emitting diode (LED) */
include/iommu.h new file +16 -0
new file mode 100644
index 0000000000..d17a06a6f3
@@ -0,0 +1,16 @@
+#ifndef _IOMMU_H
+#define _IOMMU_H
+
+struct udevice;
+
+#if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) && \
+	CONFIG_IS_ENABLED(IOMMU)
+int dev_iommu_probe(struct udevice *dev);
+#else
+static inline int dev_iommu_probe(struct udevice *dev)
+{
+	return 0;
+}
+#endif
+
+#endif
Signature · 1 line
2.33.0
#2 lore raw

PATCH v3 2/7 test: Add tests for IOMMU uclass

In reply to Mark Kettenis

Add a set of tests for the IOMMU uclass.

---
 arch/sandbox/dts/test.dts          |  6 ++++++
 configs/sandbox64_defconfig        |  1 +
 configs/sandbox_defconfig          |  1 +
 configs/sandbox_flattree_defconfig |  1 +
 configs/sandbox_noinst_defconfig   |  1 +
 configs/sandbox_spl_defconfig      |  1 +
 drivers/iommu/Makefile             |  2 ++
 drivers/iommu/sandbox_iommu.c      | 18 ++++++++++++++++++
 test/dm/Makefile                   |  1 +
 test/dm/iommu.c                    | 28 ++++++++++++++++++++++++++++
 10 files changed, 60 insertions(+)
 create mode 100644 drivers/iommu/sandbox_iommu.c
 create mode 100644 test/dm/iommu.c
arch/sandbox/dts/test.dts +6 -0
index e27d106466..8cd688e8d2 100644
@@ -764,6 +764,11 @@
 		vss-microvolts = <0>;
 	};
 
+	iommu: iommu@0 {
+		compatible = "sandbox,iommu";
+		#iommu-cells = <0>;
+	};
+
 	irq: irq {
 		compatible = "sandbox,irq";
 		interrupt-controller;
@@ -1226,6 +1231,7 @@
 
 	usb_1: usb@1 {
 		compatible = "sandbox,usb";
+		iommus = <&iommu>;
 		hub {
 			compatible = "usb-hub";
 			usb,device-class = <9>;
configs/sandbox64_defconfig +1 -0
index df9633d762..acfcf8282a 100644
@@ -131,6 +131,7 @@ CONFIG_SPL_I2C_MUX=y
 CONFIG_I2C_ARB_GPIO_CHALLENGE=y
 CONFIG_CROS_EC_KEYB=y
 CONFIG_I8042_KEYB=y
+CONFIG_IOMMU=y
 CONFIG_LED=y
 CONFIG_LED_BLINK=y
 CONFIG_LED_GPIO=y
configs/sandbox_defconfig +1 -0
index d601677190..e50c428833 100644
@@ -169,6 +169,7 @@ CONFIG_SPL_I2C_MUX=y
 CONFIG_I2C_ARB_GPIO_CHALLENGE=y
 CONFIG_CROS_EC_KEYB=y
 CONFIG_I8042_KEYB=y
+CONFIG_IOMMU=y
 CONFIG_LED=y
 CONFIG_LED_BLINK=y
 CONFIG_LED_GPIO=y
configs/sandbox_flattree_defconfig +1 -0
index 11015744e7..80bb0320a7 100644
@@ -108,6 +108,7 @@ CONFIG_SPL_I2C_MUX=y
 CONFIG_I2C_ARB_GPIO_CHALLENGE=y
 CONFIG_CROS_EC_KEYB=y
 CONFIG_I8042_KEYB=y
+CONFIG_IOMMU=y
 CONFIG_LED=y
 CONFIG_LED_BLINK=y
 CONFIG_LED_GPIO=y
configs/sandbox_noinst_defconfig +1 -0
index b3584563d2..dcf13234ea 100644
@@ -129,6 +129,7 @@ CONFIG_I2C_MUX=y
 CONFIG_I2C_ARB_GPIO_CHALLENGE=y
 CONFIG_CROS_EC_KEYB=y
 CONFIG_I8042_KEYB=y
+CONFIG_IOMMU=y
 CONFIG_LED=y
 CONFIG_LED_BLINK=y
 CONFIG_LED_GPIO=y
configs/sandbox_spl_defconfig +1 -0
index 73cf5dd2b0..0e97ec0f9e 100644
@@ -131,6 +131,7 @@ CONFIG_I2C_MUX=y
 CONFIG_I2C_ARB_GPIO_CHALLENGE=y
 CONFIG_CROS_EC_KEYB=y
 CONFIG_I8042_KEYB=y
+CONFIG_IOMMU=y
 CONFIG_LED=y
 CONFIG_LED_BLINK=y
 CONFIG_LED_GPIO=y
drivers/iommu/Makefile +2 -0
index f1ceb10150..af1c6bbb7a 100644
@@ -1,3 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0+
 
 obj-$(CONFIG_IOMMU) += iommu-uclass.o
+
+obj-$(CONFIG_SANDBOX) += sandbox_iommu.o
drivers/iommu/sandbox_iommu.c new file +18 -0
new file mode 100644
index 0000000000..c8161a40ae
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2021 Mark Kettenis <[email protected]>
+ */
+
+#include <common.h>
+#include <dm.h>
+
+static const struct udevice_id sandbox_iommu_ids[] = {
+	{ .compatible = "sandbox,iommu" },
+	{ /* sentinel */ }
+};
+
+U_BOOT_DRIVER(sandbox_iommu) = {
+	.name = "sandbox_iommu",
+	.id = UCLASS_IOMMU,
+	.of_match = sandbox_iommu_ids,
+};
test/dm/Makefile +1 -0
index 55162e9499..7de013f636 100644
@@ -48,6 +48,7 @@ obj-$(CONFIG_DM_I2C) += i2c.o
 obj-$(CONFIG_SOUND) += i2s.o
 obj-y += irq.o
 obj-$(CONFIG_CLK_K210_SET_RATE) += k210_pll.o
+obj-$(CONFIG_IOMMU) += iommu.o
 obj-$(CONFIG_LED) += led.o
 obj-$(CONFIG_DM_MAILBOX) += mailbox.o
 obj-$(CONFIG_DM_MDIO) += mdio.o
test/dm/iommu.c new file +28 -0
new file mode 100644
index 0000000000..94174a7482
@@ -0,0 +1,28 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2021 Mark Kettenis <[email protected]>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <dm/test.h>
+#include <dm/uclass-internal.h>
+#include <iommu.h>
+#include <test/test.h>
+#include <test/ut.h>
+
+static int dm_test_iommu(struct unit_test_state *uts)
+{
+	struct udevice *dev;
+
+	ut_assertok(uclass_find_device(UCLASS_IOMMU, 0, &dev));
+	ut_assert(!(dev_get_flags(dev) & DM_FLAG_ACTIVATED));
+
+	/* Probing USB probes the IOMMU through the "iommus" property */
+	ut_assertok(uclass_probe_all(UCLASS_USB));
+	ut_assert(dev_get_flags(dev) & DM_FLAG_ACTIVATED);
+
+	return 0;
+}
+
+DM_TEST(dm_test_iommu, UT_TESTF_SCAN_FDT);
Signature · 1 line
2.33.0
#3 lore raw

PATCH v3 3/7 arm: apple: Add initial support for Apple's M1 SoC

In reply to Mark Kettenis

Add support for Apple's M1 SoC that is used in "Apple Silicon" Macs. This builds a basic U-Boot that can be used as a payload for the m1n1 boot loader being developed by the Asahi Linux project.

---
 arch/arm/Kconfig                    |  21 ++++
 arch/arm/Makefile                   |   1 +
 arch/arm/mach-apple/Kconfig         |  18 ++++
 arch/arm/mach-apple/Makefile        |   4 +
 arch/arm/mach-apple/board.c         | 161 ++++++++++++++++++++++++++++
 arch/arm/mach-apple/lowlevel_init.S |  17 +++
 configs/apple_m1_defconfig          |  15 +++
 include/configs/apple.h             |  36 +++++++
 8 files changed, 273 insertions(+)
 create mode 100644 arch/arm/mach-apple/Kconfig
 create mode 100644 arch/arm/mach-apple/Makefile
 create mode 100644 arch/arm/mach-apple/board.c
 create mode 100644 arch/arm/mach-apple/lowlevel_init.S
 create mode 100644 configs/apple_m1_defconfig
 create mode 100644 include/configs/apple.h
arch/arm/Kconfig +21 -0
index ebb1927270..6b9b50fe05 100644
@@ -923,6 +923,25 @@ config ARCH_NEXELL
 	select DM
 	select GPIO_EXTRA_HEADER
 
+config ARCH_APPLE
+	bool "Apple SoCs"
+	select ARM64
+	select BLK
+	select CMD_USB
+	select DM
+	select DM_KEYBOARD
+	select DM_SERIAL
+	select DM_USB
+	select DM_VIDEO
+	select LINUX_KERNEL_IMAGE_HEADER
+	select OF_CONTROL
+	select OF_BOARD
+	select POSITION_INDEPENDENT
+	select USB
+	imply CMD_DM
+	imply CMD_GPT
+	imply DISTRO_DEFAULTS
+
 config ARCH_OWL
 	bool "Actions Semi OWL SoCs"
 	select DM
@@ -2016,6 +2035,8 @@ config ISW_ENTRY_ADDR
 	  image headers.
 endif
 
+source "arch/arm/mach-apple/Kconfig"
+
 source "arch/arm/mach-aspeed/Kconfig"
 
 source "arch/arm/mach-at91/Kconfig"
arch/arm/Makefile +1 -0
index 6c9a00c5a4..ad757e982e 100644
@@ -55,6 +55,7 @@ PLATFORM_CPPFLAGS += $(arch-y) $(tune-y)
 
 # Machine directory name.  This list is sorted alphanumerically
 # by CONFIG_* macro name.
+machine-$(CONFIG_ARCH_APPLE)		+= apple
 machine-$(CONFIG_ARCH_ASPEED)		+= aspeed
 machine-$(CONFIG_ARCH_AT91)		+= at91
 machine-$(CONFIG_ARCH_BCM283X)		+= bcm283x
arch/arm/mach-apple/Kconfig new file +18 -0
new file mode 100644
index 0000000000..66cab91b2a
@@ -0,0 +1,18 @@
+if ARCH_APPLE
+
+config SYS_TEXT_BASE
+	default 0x00000000
+
+config SYS_CONFIG_NAME
+	default "apple"
+
+config SYS_SOC
+	default "m1"
+
+config SYS_MALLOC_LEN
+	default 0x4000000
+
+config SYS_MALLOC_F_LEN
+	default 0x4000
+
+endif
arch/arm/mach-apple/Makefile new file +4 -0
new file mode 100644
index 0000000000..e74a8c9df1
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0+
+
+obj-y += board.o
+obj-y += lowlevel_init.o
arch/arm/mach-apple/board.c new file +161 -0

161 lines not on this page · raw message

arch/arm/mach-apple/lowlevel_init.S new file +17 -0
new file mode 100644
index 0000000000..e1c0d91cef
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2021 Mark Kettenis <[email protected]>
+ */
+
+.align 8
+.global fw_dtb_pointer
+fw_dtb_pointer:
+	.quad	0
+
+.global save_boot_params
+save_boot_params:
+	/* Stash DTB pointer passed by m1n1 */
+	adr	x1, fw_dtb_pointer
+	str	x0, [x1]
+
+	b	save_boot_params_ret
configs/apple_m1_defconfig new file +15 -0
new file mode 100644
index 0000000000..6072e7524c
@@ -0,0 +1,15 @@
+CONFIG_ARM=y
+CONFIG_ARCH_APPLE=y
+# CONFIG_DISPLAY_CPUINFO is not set
+# CONFIG_MMC is not set
+# CONFIG_NET is not set
+CONFIG_VIDEO_SIMPLE=y
+CONFIG_DISPLAY_BOARDINFO_LATE=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_KEYBOARD=y
+CONFIG_USB_STORAGE=y
+CONFIG_USE_PREBOOT=y
+CONFIG_PREBOOT="usb start"
+CONFIG_SYS_LOAD_ADDR=0x880000000
+# CONFIG_GENERATE_SMBIOS_TABLE is not set
include/configs/apple.h new file +36 -0
new file mode 100644
index 0000000000..b1f6043174
@@ -0,0 +1,36 @@
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#include <linux/sizes.h>
+
+#define CONFIG_SYS_SDRAM_BASE	0x880000000
+
+#define CONFIG_LNX_KRNL_IMG_TEXT_OFFSET_BASE	CONFIG_SYS_TEXT_BASE
+
+/* Environment */
+#define ENV_DEVICE_SETTINGS \
+	"stdin=serial,usbkbd\0" \
+	"stdout=serial,vidconsole\0" \
+	"stderr=serial,vidconsole\0"
+
+#define ENV_MEM_LAYOUT_SETTINGS \
+	"fdt_addr_r=0x960100000\0" \
+	"kernel_addr_r=0x960200000\0"
+
+#if CONFIG_IS_ENABLED(CMD_USB)
+	#define BOOT_TARGET_USB(func) func(USB, usb, 0)
+#else
+	#define BOOT_TARGET_USB(func)
+#endif
+
+#define BOOT_TARGET_DEVICES(func) \
+	BOOT_TARGET_USB(func)
+
+#include <config_distro_bootcmd.h>
+
+#define CONFIG_EXTRA_ENV_SETTINGS \
+	ENV_DEVICE_SETTINGS \
+	ENV_MEM_LAYOUT_SETTINGS \
+	BOOTENV
+
+#endif
Signature · 1 line
2.33.0
#4 lore raw

PATCH v3 4/7 serial: s5p: Add Apple M1 support

In reply to Mark Kettenis

Apple M1 SoCs include an S5L UART which is a variant of the S5P UART. Add support for this variant and enable it by default on Apple SoCs.

---
 arch/arm/Kconfig                    |   1 +
 arch/arm/include/asm/arch-m1/uart.h |  41 +++++++++++
 configs/apple_m1_defconfig          |   4 ++
 drivers/serial/Kconfig              |   4 +-
 drivers/serial/serial_s5p.c         | 104 ++++++++++++++++++++++------
 5 files changed, 130 insertions(+), 24 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-m1/uart.h
arch/arm/Kconfig +1 -0
index 6b9b50fe05..c3ddd8af52 100644
@@ -927,6 +927,7 @@ config ARCH_APPLE
 	bool "Apple SoCs"
 	select ARM64
 	select BLK
+	select CLK
 	select CMD_USB
 	select DM
 	select DM_KEYBOARD
arch/arm/include/asm/arch-m1/uart.h new file +41 -0

41 lines not on this page · raw message

configs/apple_m1_defconfig +4 -0
index 6072e7524c..520d7c7632 100644
@@ -13,3 +13,7 @@ CONFIG_USE_PREBOOT=y
 CONFIG_PREBOOT="usb start"
 CONFIG_SYS_LOAD_ADDR=0x880000000
 # CONFIG_GENERATE_SMBIOS_TABLE is not set
+CONFIG_DEBUG_UART=y
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_DEBUG_UART_BASE=0x235200000
+CONFIG_DEBUG_UART_CLOCK=240000
drivers/serial/Kconfig +2 -2
index 122a39789c..7ee12901e7 100644
@@ -290,7 +290,7 @@ config DEBUG_SBI_CONSOLE
 
 config DEBUG_UART_S5P
 	bool "Samsung S5P"
-	depends on ARCH_EXYNOS || ARCH_S5PC1XX
+	depends on ARCH_APPLE || ARCH_EXYNOS || ARCH_S5PC1XX
 	help
 	  Select this to enable a debug UART using the serial_s5p driver. You
 	  will need to provide parameters to make this work. The driver will
@@ -737,7 +737,7 @@ config ROCKCHIP_SERIAL
 
 config S5P_SERIAL
 	bool "Support for Samsung S5P UART"
-	depends on ARCH_EXYNOS || ARCH_S5PC1XX
+	depends on ARCH_APPLE || ARCH_EXYNOS || ARCH_S5PC1XX
 	default y
 	help
 	  Select this to enable Samsung S5P UART support.
drivers/serial/serial_s5p.c +82 -22

201 lines not on this page · raw message

Signature · 1 line
2.33.0
#5 lore raw

PATCH v3 5/7 iommu: Add Apple DART driver

In reply to Mark Kettenis

The DART is an IOMMU that is used on Apple's M1 SoC. This driver configures the DART such that it operates in bypass mode which is enough to support DMA for the USB3 ports integrated on the SoC.

---
 arch/arm/Kconfig           |  1 +
 drivers/iommu/Kconfig      | 10 +++++++
 drivers/iommu/Makefile     |  1 +
 drivers/iommu/apple_dart.c | 59 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 71 insertions(+)
 create mode 100644 drivers/iommu/apple_dart.c
arch/arm/Kconfig +1 -0
index c3ddd8af52..39420c48ad 100644
@@ -934,6 +934,7 @@ config ARCH_APPLE
 	select DM_SERIAL
 	select DM_USB
 	select DM_VIDEO
+	select IOMMU
 	select LINUX_KERNEL_IMAGE_HEADER
 	select OF_CONTROL
 	select OF_BOARD
drivers/iommu/Kconfig +10 -0
index 8cb377560e..51694c168c 100644
@@ -10,4 +10,14 @@ config IOMMU
 	help
 	  Enable driver model for IOMMU devices.
 
+config APPLE_DART
+	bool "Apple DART support"
+	depends on IOMMU && ARCH_APPLE
+	default y
+	help
+	  Enable support for the DART on Apple SoCs.  The DART is Apple's
+	  IOMMU implementation.  The driver performs the necessary
+	  configuration to put the DART into bypass mode such that it can
+	  be used transparently by U-Boot.
+
 endmenu
drivers/iommu/Makefile +1 -0
index af1c6bbb7a..e3e0900e17 100644
@@ -2,4 +2,5 @@
 
 obj-$(CONFIG_IOMMU) += iommu-uclass.o
 
+obj-$(CONFIG_APPLE_DART) += apple_dart.o
 obj-$(CONFIG_SANDBOX) += sandbox_iommu.o
drivers/iommu/apple_dart.c new file +59 -0

59 lines not on this page · raw message

Signature · 1 line
2.33.0
#6 lore raw

PATCH v3 6/7 arm: dts: apple: Add preliminary device trees

In reply to Mark Kettenis

Add preliminary device trees for the Apple M1 mini (2020) and Apple M1 Macbook Pro 13" (2020). Device tree bindings for the Apple M1 SoC are still being formalized and these device trees will be synchronized with the Linux kernel as needed.

These device trees are provided as a reference only as U-Boot uses the device tree passed by the m1n1 bootloader.

---
 arch/arm/dts/Makefile                         |   4 +
 arch/arm/dts/t8103-j274.dts                   | 135 +++++
 arch/arm/dts/t8103-j293.dts                   |  97 +++
 arch/arm/dts/t8103.dtsi                       | 560 ++++++++++++++++++
 configs/apple_m1_defconfig                    |   1 +
 .../interrupt-controller/apple-aic.h          |  15 +
 include/dt-bindings/pinctrl/apple.h           |  13 +
 include/dt-bindings/spmi/spmi.h               |  10 +
 8 files changed, 835 insertions(+)
 create mode 100644 arch/arm/dts/t8103-j274.dts
 create mode 100644 arch/arm/dts/t8103-j293.dts
 create mode 100644 arch/arm/dts/t8103.dtsi
 create mode 100644 include/dt-bindings/interrupt-controller/apple-aic.h
 create mode 100644 include/dt-bindings/pinctrl/apple.h
 create mode 100644 include/dt-bindings/spmi/spmi.h
arch/arm/dts/Makefile +4 -0
index b8a382d153..1ac881d5ea 100644
@@ -29,6 +29,10 @@ dtb-$(CONFIG_EXYNOS5) += exynos5250-arndale.dtb \
 	exynos5422-odroidxu3.dtb
 dtb-$(CONFIG_EXYNOS7420) += exynos7420-espresso7420.dtb
 
+dtb-$(CONFIG_ARCH_APPLE) += \
+	t8103-j274.dtb \
+	t8103-j293.dtb
+
 dtb-$(CONFIG_ARCH_DAVINCI) += \
 	da850-evm.dtb \
 	da850-lcdk.dtb \
arch/arm/dts/t8103-j274.dts new file +135 -0

135 lines not on this page · raw message

arch/arm/dts/t8103-j293.dts new file +97 -0

97 lines not on this page · raw message

arch/arm/dts/t8103.dtsi new file +560 -0

560 lines not on this page · raw message

configs/apple_m1_defconfig +1 -0
index 520d7c7632..d71cbfd043 100644
@@ -1,5 +1,6 @@
 CONFIG_ARM=y
 CONFIG_ARCH_APPLE=y
+CONFIG_DEFAULT_DEVICE_TREE="t8103-j274"
 # CONFIG_DISPLAY_CPUINFO is not set
 # CONFIG_MMC is not set
 # CONFIG_NET is not set
include/dt-bindings/interrupt-controller/apple-aic.h new file +15 -0
new file mode 100644
index 0000000000..9ac56a7e6d
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause */
+#ifndef _DT_BINDINGS_INTERRUPT_CONTROLLER_APPLE_AIC_H
+#define _DT_BINDINGS_INTERRUPT_CONTROLLER_APPLE_AIC_H
+
+#include <dt-bindings/interrupt-controller/irq.h>
+
+#define AIC_IRQ	0
+#define AIC_FIQ	1
+
+#define AIC_TMR_HV_PHYS		0
+#define AIC_TMR_HV_VIRT		1
+#define AIC_TMR_GUEST_PHYS	2
+#define AIC_TMR_GUEST_VIRT	3
+
+#endif
include/dt-bindings/pinctrl/apple.h new file +13 -0
new file mode 100644
index 0000000000..ea0a6f4665
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0+ OR MIT */
+/*
+ * This header provides constants for Apple pinctrl bindings.
+ */
+
+#ifndef _DT_BINDINGS_PINCTRL_APPLE_H
+#define _DT_BINDINGS_PINCTRL_APPLE_H
+
+#define APPLE_PINMUX(pin, func) ((pin) | ((func) << 16))
+#define APPLE_PIN(pinmux) ((pinmux) & 0xffff)
+#define APPLE_FUNC(pinmux) ((pinmux) >> 16)
+
+#endif /* _DT_BINDINGS_PINCTRL_APPLE_H */
include/dt-bindings/spmi/spmi.h new file +10 -0
new file mode 100644
index 0000000000..ad4a43481d
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ */
+#ifndef __DT_BINDINGS_SPMI_H
+#define __DT_BINDINGS_SPMI_H
+
+#define SPMI_USID	0
+#define SPMI_GSID	1
+
+#endif
Signature · 1 line
2.33.0
#7 lore raw

PATCH v3 7/7 doc: board: apple: Add Apple M1 documentation

In reply to Mark Kettenis

Provide preliminary instructions on how to get U-Boot to run on Apple Silicon Macs.

---
 doc/board/apple/index.rst |  9 +++++++
 doc/board/apple/m1.rst    | 56 +++++++++++++++++++++++++++++++++++++++
 doc/board/index.rst       |  1 +
 3 files changed, 66 insertions(+)
 create mode 100644 doc/board/apple/index.rst
 create mode 100644 doc/board/apple/m1.rst
doc/board/apple/index.rst new file +9 -0
new file mode 100644
index 0000000000..8446847818
@@ -0,0 +1,9 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+Apple
+=====
+
+.. toctree::
+   :maxdepth: 2
+
+   m1
doc/board/apple/m1.rst new file +56 -0

56 lines not on this page · raw message

doc/board/index.rst +1 -0
index aa397ab942..1b93ced563 100644
@@ -10,6 +10,7 @@ Board-specific doc
    advantech/index
    AndesTech/index
    amlogic/index
+   apple/index
    atmel/index
    congatec/index
    coreboot/index
Signature · 1 line
2.33.0
#8 lore raw

Re: [PATCH v3 7/7] doc: board: apple: Add Apple M1 documentation

Hi Mark,

Quoted 4 lines · Mark Kettenis

Provide preliminary instructions on how to get U-Boot to run on Apple Silicon Macs.

Please can you add a change log to this patch? Patman will do it for you.

Quoted 8 lines
---
 doc/board/apple/index.rst |  9 +++++++
 doc/board/apple/m1.rst    | 56 +++++++++++++++++++++++++++++++++++++++
 doc/board/index.rst       |  1 +
 3 files changed, 66 insertions(+)
 create mode 100644 doc/board/apple/index.rst
 create mode 100644 doc/board/apple/m1.rst

[..]

Regards,
Simon

#9 lore raw

Re: [PATCH v3 7/7] doc: board: apple: Add Apple M1 documentation

Quoted 5 lines

From: Simon Glass <[email protected]>
Date: Mon, 11 Oct 2021 11:01:20 -0600

Hi Mark,

Quoted 7 lines
Quoted 4 lines · Mark Kettenis

Provide preliminary instructions on how to get U-Boot to run on Apple Silicon Macs.

Please can you add a change log to this patch? Patman will do it for you.

Sorry, I'm confused. The changelog is on the cover letter. This particular patch did not change at all...

Quoted 14 lines
Quoted 8 lines
---
 doc/board/apple/index.rst |  9 +++++++
 doc/board/apple/m1.rst    | 56 +++++++++++++++++++++++++++++++++++++++
 doc/board/index.rst       |  1 +
 3 files changed, 66 insertions(+)
 create mode 100644 doc/board/apple/index.rst
 create mode 100644 doc/board/apple/m1.rst

[..]

Regards,
Simon

#10 lore raw

Re: [PATCH v3 7/7] doc: board: apple: Add Apple M1 documentation

Hi Mark,

Quoted 8 lines · Mark Kettenis
Quoted 8 lines

From: Simon Glass <[email protected]>
Date: Mon, 11 Oct 2021 11:01:20 -0600

Hi Mark,

Quoted 1 line · Mark Kettenis
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Provide preliminary instructions on how to get U-Boot to run on Apple Silicon Macs.

Please can you add a change log to this patch? Patman will do it for you.

Sorry, I'm confused. The changelog is on the cover letter. This particular patch did not change at all...

OK perhaps that is why I am confused too...it is better to have the change log on each patch as well.

Regards,
Simon

#11 lore raw

Re: [PATCH v3 7/7] doc: board: apple: Add Apple M1 documentation

Quoted 20 lines · Simon Glass

Hi Mark,

Quoted 7 lines · Mark Kettenis
Quoted 7 lines

From: Simon Glass <[email protected]>
Date: Mon, 11 Oct 2021 11:01:20 -0600

Hi Mark,

On Mon, 11 Oct 2021 at 10:40, Mark Kettenis <[email protected]>

Quoted 6 lines · wrote:
Quoted 6 lines
Quoted 4 lines

Provide preliminary instructions on how to get U-Boot to run on Apple Silicon Macs.

Please can you add a change log to this patch? Patman will do it for

you.

Quoted 1 line
Quoted 8 lines
Quoted 2 lines

Sorry, I'm confused. The changelog is on the cover letter. This particular patch did not change at all...

OK perhaps that is why I am confused too...it is better to have the change log on each patch as well.

Regards,
Simon

hey guys , that’s really a cool thing !

Quoted 2 lines

--

François-Frédéric Ozog | *Director Business Development*
T: +33.67221.6485
[email protected] | Skype: ffozog

Tested-by on v3 7/7
#12 lore raw

Re: [PATCH v3 7/7] doc: board: apple: Add Apple M1 documentation

In reply to Mark Kettenis

Hi Mark,

Quoted 3 lines · Mark Kettenis

Provide preliminary instructions on how to get U-Boot to run on Apple Silicon Macs.

Apple-Silicon

This is ambiguous. The Macs are not made out of silicon. It is a Mac using Apple Silicon.

Quoted 31 lines
---
 doc/board/apple/index.rst |  9 +++++++
 doc/board/apple/m1.rst    | 56 +++++++++++++++++++++++++++++++++++++++
 doc/board/index.rst       |  1 +
 3 files changed, 66 insertions(+)
 create mode 100644 doc/board/apple/index.rst
 create mode 100644 doc/board/apple/m1.rst
doc/board/apple/index.rst new file +9 -0
new file mode 100644
index 0000000000..8446847818
@@ -0,0 +1,9 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+Apple
+=====
+
+.. toctree::
+   :maxdepth: 2
+
+   m1
doc/board/apple/m1.rst new file +0 -0
new file mode 100644
index 0000000000..2f2d940a4c

doc/board/apple/m1.rst line 3

Quoted 3 lines
doc/board/apple/m1.rst new file +3 -0
@@ -0,0 +1,56 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+U-Boot for Apple Silicon Macs

Apple-Silicon

doc/board/apple/m1.rst line 6

Quoted 3 lines
doc/board/apple/m1.rst new file +3 -0
+=============================
+
+Allows Apple Silicon Macs to boot U-Boot via the m1n1 bootloader

Apple-Silicon

Quoted 4 lines
doc/board/apple/m1.rst new file +4 -0
+developed by the Asahi Linux project.  At this point the machines with
+the following SoCs work:
+
+ - Apple M1 SoC

doc/board/apple/m1.rst line 20

Quoted 10 lines
doc/board/apple/m1.rst new file +10 -0
+
+On these SoCs the following hardware is supported:
+
+ - S5L serial port
+ - Framebuffer
+ - USB 3.1 Type-C ports
+
+Device trees are currently provided for the M1 Mac mini (2020, J274)
+and M1 MacBook Pro 13" (2020, J293).  The M1 MacBook Air (2020) is
+expected to work with the J293 device tree.  The M1 iMac (2021) may

Tested on MacBook Air 2020 A2337

Quoted 17 lines
doc/board/apple/m1.rst new file +17 -0
+work with the J274 device tree.
+
+Building U-Boot
+---------------
+
+.. code-block:: bash
+
+    $ export CROSS_COMPILE=aarch64-none-elf-
+    $ make apple_m1_defconfig
+    $ make
+
+This will build ``u-boot-nodtb.bin`` as well as devices trees for some
+of the supported machines.  These device trees can be found in the
+``arch/arm/dts`` subdirectory of your build.
+
+Image creation
+--------------

doc/board/apple/m1.rst line 47

Quoted 10 lines
doc/board/apple/m1.rst new file +10 -0
+
+In order to run U-Boot on an Apple Silicon Mac, U-Boot has to be used
+as a payload for the m1n1 bootloader.  Instructions for building m1n1
+can be found here:
+
+    https://github.com/AsahiLinux/docs/wiki/SW%3Am1n1
+
+.. code-block:: bash
+
+    $ cat m1n1.macho t8103-j274.dtb u-boot-nodtb.bin > u-boot.macho

or just u-boot.bin which is more normal

Quoted 22 lines
doc/board/apple/m1.rst new file +9 -0
+
+Image installation
+------------------
+
+Instructions on how to install U-Boot on your Mac can be found at:
+
+    https://github.com/AsahiLinux/docs/wiki/Developer-Quickstart
+
+Just replace ``m1n1.macho`` with ``u-boot.macho`` in the instructions.
doc/board/index.rst +1 -1
index aa397ab942..1b93ced563 100644
@@ -10,6 +10,7 @@ Board-specific doc
    advantech/index
    AndesTech/index
    amlogic/index
+   apple/index
    atmel/index
    congatec/index
    coreboot/index
--
Quoted 2 lines

2.33.0

Regards,
Simon

#13 lore raw

Re: [PATCH v3 7/7] doc: board: apple: Add Apple M1 documentation

Quoted 7 lines

From: Simon Glass <[email protected]>
Date: Mon, 11 Oct 2021 13:10:02 -0600

Hi Mark,

Quoted 1 line · Mark Kettenis
Quoted 7 lines
Quoted 2 lines

Provide preliminary instructions on how to get U-Boot to run on Apple Silicon Macs.

Apple-Silicon

This is ambiguous. The Macs are not made out of silicon. It is a Mac using Apple Silicon.

Well, this is the marketing term that tends to be used to distinguish them from the Macs with an Intel CPU in them. It doesn't have to make sense ;).

Quoted 83 lines
Quoted 32 lines
---
 doc/board/apple/index.rst |  9 +++++++
 doc/board/apple/m1.rst    | 56 +++++++++++++++++++++++++++++++++++++++
 doc/board/index.rst       |  1 +
 3 files changed, 66 insertions(+)
 create mode 100644 doc/board/apple/index.rst
 create mode 100644 doc/board/apple/m1.rst
doc/board/apple/index.rst new file +9 -0
new file mode 100644
index 0000000000..8446847818
@@ -0,0 +1,9 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+Apple
+=====
+
+.. toctree::
+   :maxdepth: 2
+
+   m1
doc/board/apple/m1.rst new file +0 -0
new file mode 100644
index 0000000000..2f2d940a4c

doc/board/apple/m1.rst line 3

Quoted 3 lines
doc/board/apple/m1.rst new file +3 -0
@@ -0,0 +1,56 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+U-Boot for Apple Silicon Macs

Apple-Silicon

doc/board/apple/m1.rst line 6

Quoted 3 lines
doc/board/apple/m1.rst new file +3 -0
+=============================
+
+Allows Apple Silicon Macs to boot U-Boot via the m1n1 bootloader

Apple-Silicon

Quoted 4 lines
doc/board/apple/m1.rst new file +4 -0
+developed by the Asahi Linux project.  At this point the machines with
+the following SoCs work:
+
+ - Apple M1 SoC

doc/board/apple/m1.rst line 20

Quoted 10 lines
doc/board/apple/m1.rst new file +10 -0
+
+On these SoCs the following hardware is supported:
+
+ - S5L serial port
+ - Framebuffer
+ - USB 3.1 Type-C ports
+
+Device trees are currently provided for the M1 Mac mini (2020, J274)
+and M1 MacBook Pro 13" (2020, J293).  The M1 MacBook Air (2020) is
+expected to work with the J293 device tree.  The M1 iMac (2021) may

Tested on MacBook Air 2020 A2337

Quoted 21 lines
doc/board/apple/m1.rst new file +21 -0
+work with the J274 device tree.
+
+Building U-Boot
+---------------
+
+.. code-block:: bash
+
+    $ export CROSS_COMPILE=aarch64-none-elf-
+    $ make apple_m1_defconfig
+    $ make
+
+This will build ``u-boot-nodtb.bin`` as well as devices trees for some
+of the supported machines.  These device trees can be found in the
+``arch/arm/dts`` subdirectory of your build.
+
+Image creation
+--------------
+
+In order to run U-Boot on an Apple Silicon Mac, U-Boot has to be used
+as a payload for the m1n1 bootloader.  Instructions for building m1n1
+can be found here:
Quoted 8 lines

doc/board/apple/m1.rst line 47

Quoted 6 lines
doc/board/apple/m1.rst new file +6 -0
+
+    https://github.com/AsahiLinux/docs/wiki/SW%3Am1n1
+
+.. code-block:: bash
+
+    $ cat m1n1.macho t8103-j274.dtb u-boot-nodtb.bin > u-boot.macho

or just u-boot.bin which is more normal

But that one has the DTB baked in, so it makes no sense to use it in this context as the DTB is provided separately.

Quoted 28 lines
Quoted 22 lines
doc/board/apple/m1.rst new file +9 -0
+
+Image installation
+------------------
+
+Instructions on how to install U-Boot on your Mac can be found at:
+
+    https://github.com/AsahiLinux/docs/wiki/Developer-Quickstart
+
+Just replace ``m1n1.macho`` with ``u-boot.macho`` in the instructions.
doc/board/index.rst +1 -1
index aa397ab942..1b93ced563 100644
@@ -10,6 +10,7 @@ Board-specific doc
    advantech/index
    AndesTech/index
    amlogic/index
+   apple/index
    atmel/index
    congatec/index
    coreboot/index
--
Quoted 2 lines

2.33.0

Regards,
Simon

#14 lore raw

Re: [PATCH v3 7/7] doc: board: apple: Add Apple M1 documentation

Hi Mark,

Quoted 112 lines · Mark Kettenis
Quoted 8 lines

From: Simon Glass <[email protected]>
Date: Mon, 11 Oct 2021 13:10:02 -0600

Hi Mark,

Quoted 1 line · Mark Kettenis
Quoted 7 lines
Quoted 2 lines

Provide preliminary instructions on how to get U-Boot to run on Apple Silicon Macs.

Apple-Silicon

This is ambiguous. The Macs are not made out of silicon. It is a Mac using Apple Silicon.

Well, this is the marketing term that tends to be used to distinguish them from the Macs with an Intel CPU in them. It doesn't have to make sense ;).

Quoted 83 lines
Quoted 32 lines
---
 doc/board/apple/index.rst |  9 +++++++
 doc/board/apple/m1.rst    | 56 +++++++++++++++++++++++++++++++++++++++
 doc/board/index.rst       |  1 +
 3 files changed, 66 insertions(+)
 create mode 100644 doc/board/apple/index.rst
 create mode 100644 doc/board/apple/m1.rst
doc/board/apple/index.rst new file +9 -0
new file mode 100644
index 0000000000..8446847818
@@ -0,0 +1,9 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+Apple
+=====
+
+.. toctree::
+   :maxdepth: 2
+
+   m1
doc/board/apple/m1.rst new file +0 -0
new file mode 100644
index 0000000000..2f2d940a4c

doc/board/apple/m1.rst line 3

Quoted 3 lines
doc/board/apple/m1.rst new file +3 -0
@@ -0,0 +1,56 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+U-Boot for Apple Silicon Macs

Apple-Silicon

doc/board/apple/m1.rst line 6

Quoted 3 lines
doc/board/apple/m1.rst new file +3 -0
+=============================
+
+Allows Apple Silicon Macs to boot U-Boot via the m1n1 bootloader

Apple-Silicon

Quoted 4 lines
doc/board/apple/m1.rst new file +4 -0
+developed by the Asahi Linux project.  At this point the machines with
+the following SoCs work:
+
+ - Apple M1 SoC

doc/board/apple/m1.rst line 20

Quoted 10 lines
doc/board/apple/m1.rst new file +10 -0
+
+On these SoCs the following hardware is supported:
+
+ - S5L serial port
+ - Framebuffer
+ - USB 3.1 Type-C ports
+
+Device trees are currently provided for the M1 Mac mini (2020, J274)
+and M1 MacBook Pro 13" (2020, J293).  The M1 MacBook Air (2020) is
+expected to work with the J293 device tree.  The M1 iMac (2021) may

Tested on MacBook Air 2020 A2337

Quoted 21 lines
doc/board/apple/m1.rst new file +21 -0
+work with the J274 device tree.
+
+Building U-Boot
+---------------
+
+.. code-block:: bash
+
+    $ export CROSS_COMPILE=aarch64-none-elf-
+    $ make apple_m1_defconfig
+    $ make
+
+This will build ``u-boot-nodtb.bin`` as well as devices trees for some
+of the supported machines.  These device trees can be found in the
+``arch/arm/dts`` subdirectory of your build.
+
+Image creation
+--------------
+
+In order to run U-Boot on an Apple Silicon Mac, U-Boot has to be used
+as a payload for the m1n1 bootloader.  Instructions for building m1n1
+can be found here:
Quoted 8 lines

doc/board/apple/m1.rst line 47

Quoted 6 lines
doc/board/apple/m1.rst new file +6 -0
+
+    https://github.com/AsahiLinux/docs/wiki/SW%3Am1n1
+
+.. code-block:: bash
+
+    $ cat m1n1.macho t8103-j274.dtb u-boot-nodtb.bin > u-boot.macho

or just u-boot.bin which is more normal

Quoted 2 lines

But that one has the DTB baked in, so it makes no sense to use it in this context as the DTB is provided separately.

Yes, that's true. Please add a note explaining that.

Regards,
Simon

Tested-by on the v3 series
#15 lore raw
In reply to Mark Kettenis
Quoted 97 lines · Mark Kettenis

This series adds basic support for Apple's M1 SoC to U-Boot. This builds a basic U-Boot that can be used as a payload for the m1n1 boot loader being developed by the Asahi Linux project.

The goal here is to privide an UEFI interface on these machines that allows booting various open source OSes. This initial series provides support for the serial port, framebuffer and the USB 3.1 Type-C ports. It can boot a support OS (e.g. OpenBSD/arm64) from a USB disk.

This version attempts to address most comments. It doesn't add a proper WDT/sysreset driver yet since I prefer to do that once the device tree bindings for that have been ironed out.

ChangeLog:

v2: - Add IOMMU uclass and use it for the DART driver
- Cut back DART driver to only support bypass mode
- Rework the S5P serial support to use more DT stuff
- Update preliminary device trees

v3: - Respin for CONFIG_SYS_LOAD_ADDR kconfig migration

Mark Kettenis (7):
iommu: Add IOMMU uclass
test: Add tests for IOMMU uclass
arm: apple: Add initial support for Apple's M1 SoC
serial: s5p: Add Apple M1 support
iommu: Add Apple DART driver
arm: dts: apple: Add preliminary device trees
doc: board: apple: Add Apple M1 documentation

 arch/arm/Kconfig                              |  23 +
 arch/arm/Makefile                             |   1 +
 arch/arm/dts/Makefile                         |   4 +
 arch/arm/dts/t8103-j274.dts                   | 135 +++++
 arch/arm/dts/t8103-j293.dts                   |  97 +++
 arch/arm/dts/t8103.dtsi                       | 560 ++++++++++++++++++
 arch/arm/include/asm/arch-m1/uart.h           |  41 ++
 arch/arm/mach-apple/Kconfig                   |  18 +
 arch/arm/mach-apple/Makefile                  |   4 +
 arch/arm/mach-apple/board.c                   | 161 +++++
 arch/arm/mach-apple/lowlevel_init.S           |  17 +
 arch/sandbox/dts/test.dts                     |   6 +
 configs/apple_m1_defconfig                    |  20 +
 configs/sandbox64_defconfig                   |   1 +
 configs/sandbox_defconfig                     |   1 +
 configs/sandbox_flattree_defconfig            |   1 +
 configs/sandbox_noinst_defconfig              |   1 +
 configs/sandbox_spl_defconfig                 |   1 +
 doc/board/apple/index.rst                     |   9 +
 doc/board/apple/m1.rst                        |  56 ++
 doc/board/index.rst                           |   1 +
 drivers/Kconfig                               |   2 +
 drivers/Makefile                              |   1 +
 drivers/core/device.c                         |   8 +
 drivers/iommu/Kconfig                         |  23 +
 drivers/iommu/Makefile                        |   6 +
 drivers/iommu/apple_dart.c                    |  59 ++
 drivers/iommu/iommu-uclass.c                  |  45 ++
 drivers/iommu/sandbox_iommu.c                 |  18 +
 drivers/serial/Kconfig                        |   4 +-
 drivers/serial/serial_s5p.c                   | 104 +++-
 include/configs/apple.h                       |  36 ++
 include/dm/uclass-id.h                        |   1 +
 .../interrupt-controller/apple-aic.h          |  15 +
 include/dt-bindings/pinctrl/apple.h           |  13 +
 include/dt-bindings/spmi/spmi.h               |  10 +
 include/iommu.h                               |  16 +
 test/dm/Makefile                              |   1 +
 test/dm/iommu.c                               |  28 +
 39 files changed, 1524 insertions(+), 24 deletions(-)
 create mode 100644 arch/arm/dts/t8103-j274.dts
 create mode 100644 arch/arm/dts/t8103-j293.dts
 create mode 100644 arch/arm/dts/t8103.dtsi
 create mode 100644 arch/arm/include/asm/arch-m1/uart.h
 create mode 100644 arch/arm/mach-apple/Kconfig
 create mode 100644 arch/arm/mach-apple/Makefile
 create mode 100644 arch/arm/mach-apple/board.c
 create mode 100644 arch/arm/mach-apple/lowlevel_init.S
 create mode 100644 configs/apple_m1_defconfig
 create mode 100644 doc/board/apple/index.rst
 create mode 100644 doc/board/apple/m1.rst
 create mode 100644 drivers/iommu/Kconfig
 create mode 100644 drivers/iommu/Makefile
 create mode 100644 drivers/iommu/apple_dart.c
 create mode 100644 drivers/iommu/iommu-uclass.c
 create mode 100644 drivers/iommu/sandbox_iommu.c
 create mode 100644 include/configs/apple.h
 create mode 100644 include/dt-bindings/interrupt-controller/apple-aic.h
 create mode 100644 include/dt-bindings/pinctrl/apple.h
 create mode 100644 include/dt-bindings/spmi/spmi.h
 create mode 100644 include/iommu.h
 create mode 100644 test/dm/iommu.c
Quoted 3 lines

--
2.33.0

The series:

Tested on MacBook Air 2020 A2337

Regards,
Simon