Skip to content

Commit 69a8918

Browse files
committed
Merge branch 'bits/180-sio' into asahi-wip
2 parents 490ff6e + 5f3720a commit 69a8918

5 files changed

Lines changed: 1038 additions & 0 deletions

File tree

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/dma/apple,sio.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Apple SIO Coprocessor
8+
9+
description:
10+
SIO is a coprocessor on Apple M1 and later chips (and maybe also on earlier
11+
chips). Its role is to offload SPI, UART and DisplayPort audio transfers,
12+
being a pretend DMA controller.
13+
14+
maintainers:
15+
- Martin Povišer <povik+lin@cutebit.org>
16+
17+
allOf:
18+
- $ref: dma-controller.yaml#
19+
20+
properties:
21+
compatible:
22+
items:
23+
- enum:
24+
- apple,t6000-sio
25+
- apple,t8103-sio
26+
- const: apple,sio
27+
28+
reg:
29+
maxItems: 1
30+
31+
'#dma-cells':
32+
const: 1
33+
description:
34+
DMA clients specify a single cell that corresponds to the RTKit endpoint
35+
number used for arranging the transfers in question
36+
37+
dma-channels:
38+
maximum: 128
39+
40+
mboxes:
41+
maxItems: 1
42+
43+
iommus:
44+
maxItems: 1
45+
46+
power-domains:
47+
maxItems: 1
48+
49+
memory-region:
50+
minItems: 2
51+
maxItems: 8
52+
description:
53+
A number of references to reserved memory regions among which are the DATA/TEXT
54+
sections of coprocessor executable firmware and also auxiliary firmware data
55+
describing the available DMA-enabled peripherals
56+
57+
apple,sio-firmware-params:
58+
$ref: /schemas/types.yaml#/definitions/uint32-array
59+
description: |
60+
Parameters in the form of opaque key/value pairs that are to be sent to the SIO
61+
coprocesssor once it boots. These parameters can point into the reserved memory
62+
regions (in device address space).
63+
64+
Note that unlike Apple's firmware, we treat the parameters, and the data they
65+
refer to, as opaque. Apple embed short data blobs into their SIO devicetree node
66+
that describe the DMA-enabled peripherals (presumably with defined semantics).
67+
Their driver processes those blobs and sets up data structure in mapped device
68+
memory, then references this memory in the parameters sent to the SIO. At the
69+
level of description we are opting for in this binding, we assume the job of
70+
constructing those data structures has been done in advance, leaving behind an
71+
opaque list of key/value parameter pairs to be sent by a prospective driver.
72+
73+
This approach is chosen for two reasons:
74+
75+
- It means we don't need to try to understand the semantics of Apple's blobs
76+
as long as we know the transformation we need to do from Apple's devicetree
77+
data to SIO data (which can be shoved away into a loader). It also means the
78+
semantics of Apple's blobs (or of something to replace them) need not be part
79+
of the binding and be kept up with Apple's firmware changes in the future.
80+
81+
- It leaves less work for the driver attaching on this binding. Instead the work
82+
is done upfront in the loader which can be better suited for keeping up with
83+
Apple's firmware changes.
84+
85+
required:
86+
- compatible
87+
- reg
88+
- '#dma-cells'
89+
- dma-channels
90+
- mboxes
91+
- iommus
92+
- power-domains
93+
94+
additionalProperties: false
95+
96+
examples:
97+
- |
98+
sio: dma-controller@36400000 {
99+
compatible = "apple,t8103-sio", "apple,sio";
100+
reg = <0x36400000 0x8000>;
101+
dma-channels = <128>;
102+
#dma-cells = <1>;
103+
mboxes = <&sio_mbox>;
104+
iommus = <&sio_dart 0>;
105+
power-domains = <&ps_sio_cpu>;
106+
memory-region = <&sio_text>, <&sio_data>,
107+
<&sio_auxdata1>, <&sio_auxdata2>; /* Filled by loader */
108+
apple,sio-firmware-params = <0xb 0x10>, <0xc 0x1b80>, <0xf 0x14>,
109+
<0x10 0x1e000>, <0x30d 0x34>, <0x30e 0x4000>,
110+
<0x1a 0x38>, <0x1b 0x50>; /* Filled by loader */
111+
};

MAINTAINERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2034,8 +2034,10 @@ M: Martin Povišer <povik+lin@cutebit.org>
20342034
L: asahi@lists.linux.dev
20352035
L: alsa-devel@alsa-project.org (moderated for non-subscribers)
20362036
S: Maintained
2037+
F: Documentation/devicetree/bindings/dma/apple,sio.yaml
20372038
F: Documentation/devicetree/bindings/sound/adi,ssm3515.yaml
20382039
F: Documentation/devicetree/bindings/sound/apple,*
2040+
F: drivers/dma/apple-sio.c
20392041
F: sound/soc/apple/*
20402042
F: sound/soc/codecs/cs42l83-i2c.c
20412043
F: sound/soc/codecs/ssm3515.c

drivers/dma/Kconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,21 @@ config APPLE_ADMAC
8989
tristate "Apple ADMAC support"
9090
depends on ARCH_APPLE || COMPILE_TEST
9191
select DMA_ENGINE
92+
select DMA_VIRTUAL_CHANNELS
9293
default ARCH_APPLE
9394
help
9495
Enable support for Audio DMA Controller found on Apple Silicon SoCs.
9596

97+
config APPLE_SIO
98+
tristate "Apple SIO support"
99+
depends on ARCH_APPLE || COMPILE_TEST
100+
depends on APPLE_RTKIT
101+
select DMA_ENGINE
102+
default m if ARCH_APPLE
103+
help
104+
Enable support for the SIO coprocessor found on Apple Silicon SoCs
105+
where it provides DMA services.
106+
96107
config AT_HDMAC
97108
tristate "Atmel AHB DMA support"
98109
depends on ARCH_AT91

drivers/dma/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ obj-$(CONFIG_AMBA_PL08X) += amba-pl08x.o
1818
obj-$(CONFIG_AMCC_PPC440SPE_ADMA) += ppc4xx/
1919
obj-$(CONFIG_AMD_PTDMA) += ptdma/
2020
obj-$(CONFIG_APPLE_ADMAC) += apple-admac.o
21+
obj-$(CONFIG_APPLE_SIO) += apple-sio.o
2122
obj-$(CONFIG_AT_HDMAC) += at_hdmac.o
2223
obj-$(CONFIG_AT_XDMAC) += at_xdmac.o
2324
obj-$(CONFIG_AXI_DMAC) += dma-axi-dmac.o

0 commit comments

Comments
 (0)