From patchwork Tue Feb 14 14:10:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Martin_Povi=C5=A1er?= X-Patchwork-Id: 57041 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3007657wrn; Tue, 14 Feb 2023 06:32:21 -0800 (PST) X-Google-Smtp-Source: AK7set9sVqaibwQktsCoAx5/ExoXkWt6exocBMa05cNf3nyv0Wenjr1XNagCzIHshmCjLINLZzjb X-Received: by 2002:a50:9e07:0:b0:4ab:7f0:1865 with SMTP id z7-20020a509e07000000b004ab07f01865mr2225657ede.5.1676385141694; Tue, 14 Feb 2023 06:32:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676385141; cv=none; d=google.com; s=arc-20160816; b=R4HAe8Yq4ZQvnzMuSgkkqKslHieyZPpT516EJ8w7M5JZTMesg8Kv0IWr4UrENS4Y0s U/aHoJrI7Qtc9a2kxSyDVApMDfIwDdnjkHiwi66926M7Lfa4oRgWtZLeXaT6kJIDVIun TU9RNYL+0RxpEZ0O74siscjQ06iaoUB/EcN5Wuobi4luCq4+v4kWzZYV5D6+4GcJKd3D PoOQgCutf1phUKvUBIbi6xt1IkzinQvzuprUxvcxkftvqRVp2NReXre4kEE2HkPNkDnw ZI+/Pyjf8rvTKgjcYG/6fPlRhz4wAhSByaFuNDIlzmbQP+CxJusrBinCdjsR1/nHtglw O0Rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:dkim-signature:from; bh=5pAp3t0l3VlIhW4fUc+cLwXz2Tja64FRhpQyrgaKAyc=; b=hj3JrWVG+4aLpyhe3oZFkeRojsPgN1eOJtDB7hFAr5QKqS249eN70TPbJfZSWAippl IT1AhgB+jgevUIqZRtV9Oik/d4Bb/yD32tEVkAxgPmsQA8tGYN6ERnixAX0ereF5tWlj MHo1WZUhpKKWUwLNX1miP1qoirFIIyKN0J/z6OdZqe2h9+9KlB65aQuvfpdGG0bomvyf RYN1qh1FRFwaqaLHckwmI49U8+6XacKG6UY7CT6eNzgqm5pJMf0jEW9JqGu+gN1X7/5c Xv9cJaTzpD+uv/bLngi5Ac/4w/ioZol7cquAITfQ5HhXno9f2r+nLJ5nxkpqZMWHn/F0 Q9bA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cutebit.org header.s=mail header.b="Z45+z/7b"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cutebit.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f26-20020a056402151a00b004acd22dcc07si4126043edw.212.2023.02.14.06.31.55; Tue, 14 Feb 2023 06:32:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@cutebit.org header.s=mail header.b="Z45+z/7b"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cutebit.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232312AbjBNOZe (ORCPT + 99 others); Tue, 14 Feb 2023 09:25:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232221AbjBNOZc (ORCPT ); Tue, 14 Feb 2023 09:25:32 -0500 X-Greylist: delayed 516 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 14 Feb 2023 06:25:09 PST Received: from hutie.ust.cz (unknown [IPv6:2a03:3b40:fe:f0::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F14B2D5D; Tue, 14 Feb 2023 06:25:09 -0800 (PST) From: =?utf-8?q?Martin_Povi=C5=A1er?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cutebit.org; s=mail; t=1676383887; bh=5pAp3t0l3VlIhW4fUc+cLwXz2Tja64FRhpQyrgaKAyc=; h=From:To:Cc:Subject:Date; b=Z45+z/7boRVyipsWi/aaqFYx7TCrRxwZ9LEzVxh6q/io2rpOmW9UStpQMARQ8U88t Y6xiI20/yw3O9IwrzCha413PDbHMKyFesmOSwpaE3zPVEM3REOzmYMn2xQBPglgK0l jdFcxo3z8m8LGLFXd4DHMDLAf/92uCc5E6sWNCYk= To: Vinod Koul , Rob Herring , Krzysztof Kozlowski , Hector Martin , Sven Peter , Janne Grunau Cc: dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, asahi@lists.linux.dev, =?utf-8?q?Martin_Povi?= =?utf-8?q?=C5=A1er?= Subject: [RFC PATCH] dt-bindings: dma: apple,sio: Add schema Date: Tue, 14 Feb 2023 15:10:53 +0100 Message-Id: <20230214141053.92731-1-povik+lin@cutebit.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_FAIL,SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757817226035344756?= X-GMAIL-MSGID: =?utf-8?q?1757817226035344756?= Describe the SIO coprocessor which serves as pretend DMA controller on recent Apple platforms. Signed-off-by: Martin Povišer --- Since the schema mentions a loader preparing the binding appropriately, here's a PR with the relevant (WIP) loader code, if anyone wants to look: https://github.com/AsahiLinux/m1n1/pull/286 .../devicetree/bindings/dma/apple,sio.yaml | 129 ++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 Documentation/devicetree/bindings/dma/apple,sio.yaml diff --git a/Documentation/devicetree/bindings/dma/apple,sio.yaml b/Documentation/devicetree/bindings/dma/apple,sio.yaml new file mode 100644 index 000000000000..a76cc8265e76 --- /dev/null +++ b/Documentation/devicetree/bindings/dma/apple,sio.yaml @@ -0,0 +1,129 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/dma/apple,sio.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Apple SIO Coprocessor + +description: | + SIO is a coprocessor on Apple M1 and later chips (and maybe also on earlier + chips). Its role is to offload SPI, UART and DisplayPort audio transfers, + being a pretend DMA controller. + +maintainers: + - Martin Povišer + +allOf: + - $ref: "dma-controller.yaml#" + +properties: + compatible: + items: + - enum: + - apple,t6000-sio + - apple,t8103-sio + - const: apple,sio + + reg: + maxItems: 1 + + '#dma-cells': + const: 1 + description: + DMA clients specify a single cell that corresponds to the RTKit endpoint + number used for arranging the transfers in question + + dma-channels: + maximum: 128 + + mboxes: + maxItems: 1 + + iommus: + maxItems: 1 + + power-domains: + maxItems: 1 + + memory-region: + description: + A number of references to reserved memory regions among which are the DATA/TEXT + sections of coprocessor executable firmware and also auxiliary firmware data + describing the available DMA-enabled peripherals + + apple,sio-firmware-params: + $ref: /schemas/types.yaml#/definitions/uint32-array + description: | + Parameters in the form of opaque key/value pairs that are to be sent to the SIO + coprocesssor once it boots. These parameters can refer to the reserved memory + regions described in 'memory-region'. + + Note that unlike Apple's firmware, we treat the parameters, and the data they + refer to, as opaque. Apple embed short data blobs into their SIO devicetree node + that describe the DMA-enabled peripherals (presumably with defined semantics). + Their driver processes those blobs and sets up data structure in mapped device + memory, then references this memory in the parameters sent to the SIO. At the + level of description we are opting for in this binding, we assume the job of + constructing those data structures has been done in advance, leaving behind an + opaque list of key/value parameter pairs to be sent by a prospective driver. + + This approach is chosen for two reasons: + + - It means we don't need to try to understand the semantics of Apple's blobs + as long as we know the transformation we need to do from Apple's devicetree + data to SIO data (which can be shoved away into a loader). It also means the + semantics of Apple's blobs (or of something to replace them) need not be part + of the binding and be kept up with Apple's firmware changes in the future. + + - It leaves less work for the driver attaching on this binding. Instead the work + is done upfront in the loader which can be better suited for keeping up with + Apple's firmware changes. + +required: + - compatible + - reg + - '#dma-cells' + - dma-channels + - mboxes + - iommus + - power-domains + +additionalProperties: false + +examples: + - | + #include + #include + + aic: interrupt-controller { + interrupt-controller; + #interrupt-cells = <3>; + }; + + sio_mbox: mbox@36408000 { + compatible = "apple,t8103-asc-mailbox", "apple,asc-mailbox-v4"; + reg = <0x36408000 0x4000>; + interrupt-parent = <&aic>; + interrupts = , + , + , + ; + interrupt-names = "send-empty", "send-not-empty", + "recv-empty", "recv-not-empty"; + #mbox-cells = <0>; + power-domains = <&ps_sio>; + }; + + sio: dma-controller@36400000 { + status = "disabled"; /* To be filled by loader */ + compatible = "apple,t8103-sio", "apple,sio"; + reg = <0x36400000 0x8000>; + dma-channels = <128>; + #dma-cells = <1>; + mboxes = <&sio_mbox>; + iommus = <&sio_dart 0>; + power-domains = <&ps_sio_cpu>; + memory-region = <0x0>; /* To be filled by loader */ + apple,sio-firmware-params = <0x0>; /* To be filled by loader */ + };