[PATCH] arm: mach-apple: Move M1/M2 specifics into a separate folder

ivo.ivanov at null.net ivo.ivanov at null.net
Tue Aug 29 19:25:19 CEST 2023


From: Ivaylo Ivanov <ivo.ivanov at null.net>

Currently, mach-apple assumes we're working with M1/M2. Make room for
adding support for other Apple SoCs by moving everything from the M1/M2
SoC family in "mach-apple/" into "mach-apple/m1/".

Signed-off-by: Ivaylo Ivanov <ivo.ivanov at null.net>
---
 arch/arm/Kconfig                             | 29 --------------
 arch/arm/mach-apple/Kconfig                  | 42 ++++++++++++++++++++
 arch/arm/mach-apple/Makefile                 |  5 +--
 arch/arm/mach-apple/m1/Makefile              |  6 +++
 arch/arm/mach-apple/{ => m1}/board.c         |  0
 arch/arm/mach-apple/{ => m1}/lowlevel_init.S |  0
 arch/arm/mach-apple/{ => m1}/rtkit.c         |  0
 arch/arm/mach-apple/{ => m1}/sart.c          |  0
 configs/apple_m1_defconfig                   |  1 +
 9 files changed, 50 insertions(+), 33 deletions(-)
 create mode 100644 arch/arm/mach-apple/m1/Makefile
 rename arch/arm/mach-apple/{ => m1}/board.c (100%)
 rename arch/arm/mach-apple/{ => m1}/lowlevel_init.S (100%)
 rename arch/arm/mach-apple/{ => m1}/rtkit.c (100%)
 rename arch/arm/mach-apple/{ => m1}/sart.c (100%)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 97c25b4f14..5339da370c 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -980,38 +980,9 @@ config ARCH_NPCM

 config ARCH_APPLE
 	bool "Apple SoCs"
-	select ARM64
-	select CLK
-	select CMD_PCI
-	select CMD_USB
 	select DM
-	select DM_GPIO
-	select DM_KEYBOARD
-	select DM_MAILBOX
 	select DM_RESET
 	select DM_SERIAL
-	select DM_SPI
-	select DM_USB
-	select VIDEO
-	select IOMMU
-	select LINUX_KERNEL_IMAGE_HEADER
-	select OF_BOARD_SETUP
-	select OF_CONTROL
-	select PCI
-	select PINCTRL
-	select POSITION_INDEPENDENT
-	select POWER_DOMAIN
-	select REGMAP
-	select SPI
-	select SYSCON
-	select SYSRESET
-	select SYSRESET_WATCHDOG
-	select SYSRESET_WATCHDOG_AUTO
-	select USB
-	imply CMD_DM
-	imply CMD_GPT
-	imply DISTRO_DEFAULTS
-	imply OF_HAS_PRIOR_STAGE

 config ARCH_OWL
 	bool "Actions Semi OWL SoCs"
diff --git a/arch/arm/mach-apple/Kconfig b/arch/arm/mach-apple/Kconfig
index 294690ec0e..a38779b387 100644
--- a/arch/arm/mach-apple/Kconfig
+++ b/arch/arm/mach-apple/Kconfig
@@ -3,6 +3,46 @@ if ARCH_APPLE
 config TEXT_BASE
 	default 0x00000000

+choice
+	prompt "Apple Silicon architecture type select"
+	optional
+
+config ARCH_APPLE_M1
+	bool "Apple M1/M2 SoC family"
+	select ARM64
+	select CLK
+	select CMD_PCI
+	select CMD_USB
+	select DM_GPIO
+	select DM_KEYBOARD
+	select DM_MAILBOX
+	select DM_SPI
+	select DM_USB
+	select VIDEO
+	select IOMMU
+	select LINUX_KERNEL_IMAGE_HEADER
+	select OF_BOARD_SETUP
+	select OF_CONTROL
+	select PCI
+	select PINCTRL
+	select POSITION_INDEPENDENT
+	select POWER_DOMAIN
+	select REGMAP
+	select SPI
+	select SYSCON
+	select SYSRESET
+	select SYSRESET_WATCHDOG
+	select SYSRESET_WATCHDOG_AUTO
+	select USB
+	imply CMD_DM
+	imply CMD_GPT
+	imply DISTRO_DEFAULTS
+	imply OF_HAS_PRIOR_STAGE
+
+endchoice
+
+if ARCH_APPLE_M1
+
 config SYS_CONFIG_NAME
 	default "apple"

@@ -19,3 +59,5 @@ config LNX_KRNL_IMG_TEXT_OFFSET_BASE
 	default TEXT_BASE

 endif
+
+endif
diff --git a/arch/arm/mach-apple/Makefile b/arch/arm/mach-apple/Makefile
index 50b465b947..d147ccdde2 100644
--- a/arch/arm/mach-apple/Makefile
+++ b/arch/arm/mach-apple/Makefile
@@ -1,6 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0+

-obj-y += board.o
-obj-y += lowlevel_init.o
-obj-y += rtkit.o
-obj-$(CONFIG_NVME_APPLE) += sart.o
+obj-$(CONFIG_ARCH_APPLE_M1) += m1/
diff --git a/arch/arm/mach-apple/m1/Makefile b/arch/arm/mach-apple/m1/Makefile
new file mode 100644
index 0000000000..50b465b947
--- /dev/null
+++ b/arch/arm/mach-apple/m1/Makefile
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0+
+
+obj-y += board.o
+obj-y += lowlevel_init.o
+obj-y += rtkit.o
+obj-$(CONFIG_NVME_APPLE) += sart.o
diff --git a/arch/arm/mach-apple/board.c b/arch/arm/mach-apple/m1/board.c
similarity index 100%
rename from arch/arm/mach-apple/board.c
rename to arch/arm/mach-apple/m1/board.c
diff --git a/arch/arm/mach-apple/lowlevel_init.S b/arch/arm/mach-apple/m1/lowlevel_init.S
similarity index 100%
rename from arch/arm/mach-apple/lowlevel_init.S
rename to arch/arm/mach-apple/m1/lowlevel_init.S
diff --git a/arch/arm/mach-apple/rtkit.c b/arch/arm/mach-apple/m1/rtkit.c
similarity index 100%
rename from arch/arm/mach-apple/rtkit.c
rename to arch/arm/mach-apple/m1/rtkit.c
diff --git a/arch/arm/mach-apple/sart.c b/arch/arm/mach-apple/m1/sart.c
similarity index 100%
rename from arch/arm/mach-apple/sart.c
rename to arch/arm/mach-apple/m1/sart.c
diff --git a/configs/apple_m1_defconfig b/configs/apple_m1_defconfig
index 755560971e..bd723881da 100644
--- a/configs/apple_m1_defconfig
+++ b/configs/apple_m1_defconfig
@@ -1,5 +1,6 @@
 CONFIG_ARM=y
 CONFIG_ARCH_APPLE=y
+CONFIG_ARCH_APPLE_M1=y
 CONFIG_DEFAULT_DEVICE_TREE="t8103-j274"
 CONFIG_SYS_LOAD_ADDR=0x0
 CONFIG_USE_PREBOOT=y
--
2.34.1



More information about the U-Boot mailing list