[PATCH 2/2] soc: apple: sart: Add SART4 support

Yureka Lilian yureka at cyberchaos.dev
Sun Oct 18 09:38:11 PDT 2026


Add support for SART4 found on Apple M5 Pro/Max (t6050) SoCs.
This mirrors the SART3 implementation but with offsets adapted to the
new capacity.

Signed-off-by: Yureka Lilian <yureka at cyberchaos.dev>
---
 drivers/soc/apple/sart.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/drivers/soc/apple/sart.c b/drivers/soc/apple/sart.c
index 66b99955b395..3be8e358248a 100644
--- a/drivers/soc/apple/sart.c
+++ b/drivers/soc/apple/sart.c
@@ -61,6 +61,18 @@
 
 #define APPLE_SART3_FLAGS_ALLOW 0xff
 
+/* SARTv4 registers */
+#define APPLE_SART4_CONFIG(idx) (0x00 + 4 * (idx))
+
+#define APPLE_SART4_PADDR(idx)	(0x60 + 4 * (idx))
+#define APPLE_SART4_PADDR_SHIFT 12
+
+#define APPLE_SART4_SIZE(idx)  (0xc0 + 4 * (idx))
+#define APPLE_SART4_SIZE_SHIFT 12
+#define APPLE_SART4_SIZE_MAX   GENMASK(29, 0)
+
+#define APPLE_SART4_FLAGS_ALLOW 0xff
+
 struct apple_sart_ops {
 	void (*get_entry)(struct apple_sart *sart, int index, u8 *flags,
 			  phys_addr_t *paddr, size_t *size);
@@ -177,6 +189,35 @@ static struct apple_sart_ops sart_ops_v3 = {
 	.size_max = APPLE_SART3_SIZE_MAX,
 };
 
+static void sart4_get_entry(struct apple_sart *sart, int index, u8 *flags,
+			    phys_addr_t *paddr, size_t *size)
+{
+	phys_addr_t paddr_ = readl(sart->regs + APPLE_SART4_PADDR(index));
+	size_t size_ = readl(sart->regs + APPLE_SART4_SIZE(index));
+
+	*flags = readl(sart->regs + APPLE_SART4_CONFIG(index));
+	*size = size_ << APPLE_SART4_SIZE_SHIFT;
+	*paddr = paddr_ << APPLE_SART4_PADDR_SHIFT;
+}
+
+static void sart4_set_entry(struct apple_sart *sart, int index, u8 flags,
+			    phys_addr_t paddr_shifted, size_t size_shifted)
+{
+	writel(paddr_shifted, sart->regs + APPLE_SART4_PADDR(index));
+	writel(size_shifted, sart->regs + APPLE_SART4_SIZE(index));
+	writel(flags, sart->regs + APPLE_SART4_CONFIG(index));
+}
+
+static struct apple_sart_ops sart_ops_v4 = {
+	.get_entry = sart4_get_entry,
+	.set_entry = sart4_set_entry,
+	.flags_allow = APPLE_SART4_FLAGS_ALLOW,
+	.size_shift = APPLE_SART4_SIZE_SHIFT,
+	.paddr_shift = APPLE_SART4_PADDR_SHIFT,
+	.size_max = APPLE_SART4_SIZE_MAX,
+};
+
+
 static int apple_sart_probe(struct platform_device *pdev)
 {
 	int i;
@@ -352,6 +393,10 @@ static void apple_sart_shutdown(struct platform_device *pdev)
 }
 
 static const struct of_device_id apple_sart_of_match[] = {
+	{
+		.compatible = "apple,t6050-sart",
+		.data = &sart_ops_v4,
+	},
 	{
 		.compatible = "apple,t6000-sart",
 		.data = &sart_ops_v3,

-- 
2.55.0




More information about the linux-arm-kernel mailing list