Skip to contentSkip to conversation

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

PATCH In review [email protected] 2 participants 6 messages Aug 29, 2023 – Oct 15, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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

From: Ivaylo Ivanov <[email protected]>

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

---
 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%)
arch/arm/Kconfig +0 -29
index 97c25b4f14..5339da370c 100644
@@ -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"
arch/arm/mach-apple/Kconfig +42 -0

51 lines not on this page · raw message

arch/arm/mach-apple/Makefile +1 -4
index 50b465b947..d147ccdde2 100644
@@ -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/
arch/arm/mach-apple/m1/Makefile new file +6 -0
new file mode 100644
index 0000000000..50b465b947
@@ -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
arch/arm/mach-apple/m1/board.c renamed from arch/arm/mach-apple/board.c +0 -0
similarity index 100%
rename from arch/arm/mach-apple/board.c
rename to arch/arm/mach-apple/m1/board.c
arch/arm/mach-apple/m1/lowlevel_init.S renamed from arch/arm/mach-apple/lowlevel_init.S +0 -0
similarity index 100%
rename from arch/arm/mach-apple/lowlevel_init.S
rename to arch/arm/mach-apple/m1/lowlevel_init.S
arch/arm/mach-apple/m1/rtkit.c renamed from arch/arm/mach-apple/rtkit.c +0 -0
similarity index 100%
rename from arch/arm/mach-apple/rtkit.c
rename to arch/arm/mach-apple/m1/rtkit.c
arch/arm/mach-apple/m1/sart.c renamed from arch/arm/mach-apple/sart.c +0 -0
similarity index 100%
rename from arch/arm/mach-apple/sart.c
rename to arch/arm/mach-apple/m1/sart.c
configs/apple_m1_defconfig +1 -0
index 755560971e..bd723881da 100644
@@ -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

#1 lore raw
Quoted 8 lines

From: [email protected]
Date: Tue, 29 Aug 2023 20:25:19 +0300

From: Ivaylo Ivanov <[email protected]>

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

Which other Apple SoCs?

Quoted 173 lines
---
 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%)
arch/arm/Kconfig +0 -29
index 97c25b4f14..5339da370c 100644
@@ -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"
arch/arm/mach-apple/Kconfig +42 -0
index 294690ec0e..a38779b387 100644
@@ -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
arch/arm/mach-apple/Makefile +1 -4
index 50b465b947..d147ccdde2 100644
@@ -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/
arch/arm/mach-apple/m1/Makefile new file +6 -0
new file mode 100644
index 0000000000..50b465b947
@@ -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
arch/arm/mach-apple/m1/board.c renamed from arch/arm/mach-apple/board.c +0 -0
similarity index 100%
rename from arch/arm/mach-apple/board.c
rename to arch/arm/mach-apple/m1/board.c
arch/arm/mach-apple/m1/lowlevel_init.S renamed from arch/arm/mach-apple/lowlevel_init.S +0 -0
similarity index 100%
rename from arch/arm/mach-apple/lowlevel_init.S
rename to arch/arm/mach-apple/m1/lowlevel_init.S
arch/arm/mach-apple/m1/rtkit.c renamed from arch/arm/mach-apple/rtkit.c +0 -0
similarity index 100%
rename from arch/arm/mach-apple/rtkit.c
rename to arch/arm/mach-apple/m1/rtkit.c
arch/arm/mach-apple/m1/sart.c renamed from arch/arm/mach-apple/sart.c +0 -0
similarity index 100%
rename from arch/arm/mach-apple/sart.c
rename to arch/arm/mach-apple/m1/sart.c
configs/apple_m1_defconfig +1 -1
index 755560971e..bd723881da 100644
@@ -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

#2 lore raw

I'm currently working on S5L8950X. I also have some T7000 and T8010 devices that I'll work on in the future.

There's a project called freemyipod that has a fork of U-Boot working on iPod Nano's (specifically the S5L8730 in the iPod Nano 5). I've read that they're planning on upstreaming it in the near future.

Quoted 184 lines · Mark Kettenis
Quoted 8 lines

From: [email protected]
Date: Tue, 29 Aug 2023 20:25:19 +0300

From: Ivaylo Ivanov <[email protected]>

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

Which other Apple SoCs?

Quoted 173 lines
---
 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%)
arch/arm/Kconfig +0 -29
index 97c25b4f14..5339da370c 100644
@@ -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"
arch/arm/mach-apple/Kconfig +42 -0
index 294690ec0e..a38779b387 100644
@@ -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
arch/arm/mach-apple/Makefile +1 -4
index 50b465b947..d147ccdde2 100644
@@ -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/
arch/arm/mach-apple/m1/Makefile new file +6 -0
new file mode 100644
index 0000000000..50b465b947
@@ -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
arch/arm/mach-apple/m1/board.c renamed from arch/arm/mach-apple/board.c +0 -0
similarity index 100%
rename from arch/arm/mach-apple/board.c
rename to arch/arm/mach-apple/m1/board.c
arch/arm/mach-apple/m1/lowlevel_init.S renamed from arch/arm/mach-apple/lowlevel_init.S +0 -0
similarity index 100%
rename from arch/arm/mach-apple/lowlevel_init.S
rename to arch/arm/mach-apple/m1/lowlevel_init.S
arch/arm/mach-apple/m1/rtkit.c renamed from arch/arm/mach-apple/rtkit.c +0 -0
similarity index 100%
rename from arch/arm/mach-apple/rtkit.c
rename to arch/arm/mach-apple/m1/rtkit.c
arch/arm/mach-apple/m1/sart.c renamed from arch/arm/mach-apple/sart.c +0 -0
similarity index 100%
rename from arch/arm/mach-apple/sart.c
rename to arch/arm/mach-apple/m1/sart.c
configs/apple_m1_defconfig +1 -1
index 755560971e..bd723881da 100644
@@ -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

#3 lore raw
Quoted 9 lines

Date: Tue, 29 Aug 2023 22:13:53 +0300
From: Ivaylo Ivanov <[email protected]>

I'm currently working on S5L8950X. I also have some T7000 and T8010 devices that I'll work on in the future.

There's a project called freemyipod that has a fork of U-Boot working on iPod Nano's (specifically the S5L8730 in the iPod Nano 5). I've read that they're planning on upstreaming it in the near future.

ok, well, most of the code you're moving isn't really M1/M2 specific. Apple uses RTKit all over the place. And some of the SoCs you mention are really close to M1/M2. And the older ones have a lot of Samsung heritage so I'm not sure they belong under mach-apple ...

Also, unless you actually have code to support other Apple SoCs, this just causes disruption for upstreaming more of the M1/M2 code. So I think this is best left alone until you actually show your code and we can see how to integrate it.

Quoted 187 lines · Mark Kettenis
Quoted 184 lines
Quoted 8 lines

From: [email protected]
Date: Tue, 29 Aug 2023 20:25:19 +0300

From: Ivaylo Ivanov <[email protected]>

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

Which other Apple SoCs?

Quoted 173 lines
---
 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%)
arch/arm/Kconfig +0 -29
index 97c25b4f14..5339da370c 100644
@@ -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"
arch/arm/mach-apple/Kconfig +42 -0
index 294690ec0e..a38779b387 100644
@@ -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
arch/arm/mach-apple/Makefile +1 -4
index 50b465b947..d147ccdde2 100644
@@ -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/
arch/arm/mach-apple/m1/Makefile new file +6 -0
new file mode 100644
index 0000000000..50b465b947
@@ -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
arch/arm/mach-apple/m1/board.c renamed from arch/arm/mach-apple/board.c +0 -0
similarity index 100%
rename from arch/arm/mach-apple/board.c
rename to arch/arm/mach-apple/m1/board.c
arch/arm/mach-apple/m1/lowlevel_init.S renamed from arch/arm/mach-apple/lowlevel_init.S +0 -0
similarity index 100%
rename from arch/arm/mach-apple/lowlevel_init.S
rename to arch/arm/mach-apple/m1/lowlevel_init.S
arch/arm/mach-apple/m1/rtkit.c renamed from arch/arm/mach-apple/rtkit.c +0 -0
similarity index 100%
rename from arch/arm/mach-apple/rtkit.c
rename to arch/arm/mach-apple/m1/rtkit.c
arch/arm/mach-apple/m1/sart.c renamed from arch/arm/mach-apple/sart.c +0 -0
similarity index 100%
rename from arch/arm/mach-apple/sart.c
rename to arch/arm/mach-apple/m1/sart.c
configs/apple_m1_defconfig +1 -1
index 755560971e..bd723881da 100644
@@ -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

#4 lore raw

S5L8950X is definitely belongs to the mach-apple folder, since it's the first truly apple-made SoC: it uses AIC, DART, Apple GPIO, etc etc. I might be wrong but I haven't seen any references of RTKit on S5L8950X.

I have already have gotten u-boot working with AIC timer and partial dwc2 support (plug-in detection works, not sure yet why it doesn't expose a USB interface to my PC) on the iPhone 5. It's confirmed to also work on the 5c, and with a few changes addresses-wise it also works on A5. Here's a rough link to my changes (which are still to-be-improved) on my github u-boot repo:
https://github.com/ivoszbg/u-boot/commit/e20958e142cb881488602b7e864c00073dfe32db

In my opinion, M1 support shouldn't have been placed in the mach-apple folder like that in the first place. It's disrupting the work for a ton of Apple SoCs, as if M1 is the only apple SoC in existence.

Quoted 207 lines · Mark Kettenis
Quoted 9 lines

Date: Tue, 29 Aug 2023 22:13:53 +0300
From: Ivaylo Ivanov <[email protected]>

I'm currently working on S5L8950X. I also have some T7000 and T8010 devices that I'll work on in the future.

There's a project called freemyipod that has a fork of U-Boot working on iPod Nano's (specifically the S5L8730 in the iPod Nano 5). I've read that they're planning on upstreaming it in the near future.

ok, well, most of the code you're moving isn't really M1/M2 specific. Apple uses RTKit all over the place. And some of the SoCs you mention are really close to M1/M2. And the older ones have a lot of Samsung heritage so I'm not sure they belong under mach-apple ...

Also, unless you actually have code to support other Apple SoCs, this just causes disruption for upstreaming more of the M1/M2 code. So I think this is best left alone until you actually show your code and we can see how to integrate it.

Quoted 187 lines · Mark Kettenis
Quoted 184 lines
Quoted 8 lines

From: [email protected]
Date: Tue, 29 Aug 2023 20:25:19 +0300

From: Ivaylo Ivanov <[email protected]>

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

Which other Apple SoCs?

Quoted 173 lines
---
 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%)
arch/arm/Kconfig +0 -29
index 97c25b4f14..5339da370c 100644
@@ -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"
arch/arm/mach-apple/Kconfig +42 -0
index 294690ec0e..a38779b387 100644
@@ -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
arch/arm/mach-apple/Makefile +1 -4
index 50b465b947..d147ccdde2 100644
@@ -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/
arch/arm/mach-apple/m1/Makefile new file +6 -0
new file mode 100644
index 0000000000..50b465b947
@@ -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
arch/arm/mach-apple/m1/board.c renamed from arch/arm/mach-apple/board.c +0 -0
similarity index 100%
rename from arch/arm/mach-apple/board.c
rename to arch/arm/mach-apple/m1/board.c
arch/arm/mach-apple/m1/lowlevel_init.S renamed from arch/arm/mach-apple/lowlevel_init.S +0 -0
similarity index 100%
rename from arch/arm/mach-apple/lowlevel_init.S
rename to arch/arm/mach-apple/m1/lowlevel_init.S
arch/arm/mach-apple/m1/rtkit.c renamed from arch/arm/mach-apple/rtkit.c +0 -0
similarity index 100%
rename from arch/arm/mach-apple/rtkit.c
rename to arch/arm/mach-apple/m1/rtkit.c
arch/arm/mach-apple/m1/sart.c renamed from arch/arm/mach-apple/sart.c +0 -0
similarity index 100%
rename from arch/arm/mach-apple/sart.c
rename to arch/arm/mach-apple/m1/sart.c
configs/apple_m1_defconfig +1 -1
index 755560971e..bd723881da 100644
@@ -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

#5 lore raw
Quoted 6 lines

Date: Wed, 11 Oct 2023 07:42:39 +0300
From: Ivaylo Ivanov <[email protected]>

S5L8950X is definitely belongs to the mach-apple folder, since it's the first truly apple-made SoC: it uses AIC, DART, Apple GPIO, etc etc. I might be wrong but I haven't seen any references of RTKit on S5L8950X.

Yes your device tree has:

    compatible = "samsung,s5l8950", "samsung,s5l89xx";

I do understand that it is hard to tell when Apple hardware changed from being a Samsung SoC with some Apple hardware blocks into an Apple SoC with some Samsung hardware blocks. U-Boot typically follows the precedent set by the Linux kernel. So if you're also planning to upstream Linux support for these devices, it probably is best to sort this out with the Linux maintainers first.

The U-Boot support for mach-apple was never intended to be M1-specific. The goal was always to support a wider range with a single board.c file as long as that makes sense. That probably doesn't make sense for 32-bit SoCs like yours. And if there are significant differences in the way U-Boot is started on iPhone/iPad platforms we probably need a different set of files and configs as well.

So my preferred approach would be to park this diff until a later stage where it is more obvious what the best way to split things up is.

Quoted 7 lines

I have already have gotten u-boot working with AIC timer and partial dwc2 support (plug-in detection works, not sure yet why it doesn't expose a USB interface to my PC) on the iPhone 5. It's confirmed to also work on the 5c, and with a few changes addresses-wise it also works on A5. Here's a rough link to my changes (which are still to-be-improved) on my github u-boot repo:
https://github.com/ivoszbg/u-boot/commit/e20958e142cb881488602b7e864c00073dfe32db

Most of the stuff in your board.c file probably doesn't belong there, but in separate clock and USB glue drivers.

Quoted 213 lines

In my opinion, M1 support shouldn't have been placed in the mach-apple folder like that in the first place. It's disrupting the work for a ton of Apple SoCs, as if M1 is the only apple SoC in existence.

Quoted 207 lines · Mark Kettenis
Quoted 9 lines

Date: Tue, 29 Aug 2023 22:13:53 +0300
From: Ivaylo Ivanov <[email protected]>

I'm currently working on S5L8950X. I also have some T7000 and T8010 devices that I'll work on in the future.

There's a project called freemyipod that has a fork of U-Boot working on iPod Nano's (specifically the S5L8730 in the iPod Nano 5). I've read that they're planning on upstreaming it in the near future.

ok, well, most of the code you're moving isn't really M1/M2 specific. Apple uses RTKit all over the place. And some of the SoCs you mention are really close to M1/M2. And the older ones have a lot of Samsung heritage so I'm not sure they belong under mach-apple ...

Also, unless you actually have code to support other Apple SoCs, this just causes disruption for upstreaming more of the M1/M2 code. So I think this is best left alone until you actually show your code and we can see how to integrate it.

Quoted 187 lines · Mark Kettenis
Quoted 184 lines
Quoted 8 lines

From: [email protected]
Date: Tue, 29 Aug 2023 20:25:19 +0300

From: Ivaylo Ivanov <[email protected]>

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

Which other Apple SoCs?

Quoted 173 lines
---
 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%)
arch/arm/Kconfig +0 -29
index 97c25b4f14..5339da370c 100644
@@ -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"
arch/arm/mach-apple/Kconfig +42 -0
index 294690ec0e..a38779b387 100644
@@ -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
arch/arm/mach-apple/Makefile +1 -4
index 50b465b947..d147ccdde2 100644
@@ -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/
arch/arm/mach-apple/m1/Makefile new file +6 -0
new file mode 100644
index 0000000000..50b465b947
@@ -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
arch/arm/mach-apple/m1/board.c renamed from arch/arm/mach-apple/board.c +0 -0
similarity index 100%
rename from arch/arm/mach-apple/board.c
rename to arch/arm/mach-apple/m1/board.c
arch/arm/mach-apple/m1/lowlevel_init.S renamed from arch/arm/mach-apple/lowlevel_init.S +0 -0
similarity index 100%
rename from arch/arm/mach-apple/lowlevel_init.S
rename to arch/arm/mach-apple/m1/lowlevel_init.S
arch/arm/mach-apple/m1/rtkit.c renamed from arch/arm/mach-apple/rtkit.c +0 -0
similarity index 100%
rename from arch/arm/mach-apple/rtkit.c
rename to arch/arm/mach-apple/m1/rtkit.c
arch/arm/mach-apple/m1/sart.c renamed from arch/arm/mach-apple/sart.c +0 -0
similarity index 100%
rename from arch/arm/mach-apple/sart.c
rename to arch/arm/mach-apple/m1/sart.c
configs/apple_m1_defconfig +1 -1
index 755560971e..bd723881da 100644
@@ -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