From patchwork Fri Oct 13 16:49:35 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: 152677 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp2023490vqb; Fri, 13 Oct 2023 09:50:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGo4HPQS1s651EFLdRmuf7GK9akIMZbzeIBbZh+YSKX4eceN+7AEdfNflF9Nmd5dphrXmlr X-Received: by 2002:a17:90b:1d12:b0:27d:55b4:e72 with SMTP id on18-20020a17090b1d1200b0027d55b40e72mr39329pjb.2.1697215845974; Fri, 13 Oct 2023 09:50:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697215845; cv=none; d=google.com; s=arc-20160816; b=l3EssSBZlNoxpRfQmPPS5ikRJip27WbdrHXw9d8z+OuCD55pVa0HhzJ4tfrUxoZegp F5D7POWKa7eDOf0TVp63W6rQYkod0+y8GH10wjkDC42jg1wP33l/6FeHPY7Bhgr/ZJvD cEFMSHfOXjx6j+tEVy5aGsM7+tKO2fMnyCnpH2qXsrdloJtT84V/Ofc0MshOz2D+T7Yt M4FE+Hv52g2+2f4M+A7ch0D2gBEAocuPNnIRncRk8Zs6ABijo1qEzFPY6J/j/d99k6iQ /pOwXfeeNpaPa8SB+Amtaf1tf2XcrGLFdEj4S0nRKYuY/dzg8pgMFncHd0d303ULQnqE 16Jw== 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 :references:in-reply-to:message-id:date:subject:cc:to:dkim-signature :from; bh=uczSgTQLi6Ws10mkGz7xBUwK2hIRFnyEIXxpUpBHyZM=; fh=xWyeI4lB9WXdqgVlPqO6VB3bYgvOVVDe7UyK/9rOCvk=; b=penE/FOyTOgy7Oz30S3NATFgmvoQNOvLKCOidb0Snd4A6njOTQJma8pJGhkGNqr8BF +PEgE8k16d4QyC90xxyttcRDEE/WDdHdP2Yys6mFv97FVcCKWc7tOFasChLuVkik0N0u A45EVXyotK6aVPo/sXz2MVDP7zvlFuI2psbDzQ3M43IVVS1j2i0yHA2UydFX7POM4NVI EwggRGONzBqMkdi9CEAvQUGse3pNKyKPlnmcT09/f5JGkfFXlflkjFecwxMFDhsIIl8E uZsAL2NAnlTOyBCxVVin1peakeSqFd5Lux/1VDGjc6pSPwgcQdXCDpdwYBQN3Cftak0N S+Ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cutebit.org header.s=mail header.b=AdMRzBbV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id mp2-20020a17090b190200b00277382d4803si419300pjb.173.2023.10.13.09.50.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 09:50:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@cutebit.org header.s=mail header.b=AdMRzBbV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 7314C829C9B0; Fri, 13 Oct 2023 09:50:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230495AbjJMQuW (ORCPT + 19 others); Fri, 13 Oct 2023 12:50:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229891AbjJMQuS (ORCPT ); Fri, 13 Oct 2023 12:50:18 -0400 Received: from hutie.ust.cz (hutie.ust.cz [IPv6:2a03:3b40:fe:f0::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 607C695; Fri, 13 Oct 2023 09:50:14 -0700 (PDT) From: =?utf-8?q?Martin_Povi=C5=A1er?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cutebit.org; s=mail; t=1697215811; bh=uczSgTQLi6Ws10mkGz7xBUwK2hIRFnyEIXxpUpBHyZM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=AdMRzBbVw4C7wrvkyyKQ5Np/LkXMSbmuazyZnvSThbV6tlehaeaMOL1v3IuVwya4V 0BMn6Y3L7DondoMuJgK4PG412MXYKWj2dV3XfFnqXljpdU+uP58FRgiDIVJ35eeuUl 99pfultvmU9+Vxuh8/lE6tsEJe5hsBAkxjRD7T80= To: =?utf-8?q?Martin_Povi=C5=A1er?= , Vinod Koul , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: asahi@lists.linux.dev, dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Rob Herring Subject: [PATCH v3 1/2] dt-bindings: dma: apple,sio: Add schema Date: Fri, 13 Oct 2023 18:49:35 +0200 Message-Id: <20231013164936.60718-2-povik+lin@cutebit.org> In-Reply-To: <20231013164936.60718-1-povik+lin@cutebit.org> References: <20231013164936.60718-1-povik+lin@cutebit.org> MIME-Version: 1.0 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Fri, 13 Oct 2023 09:50:43 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779659803261893694 X-GMAIL-MSGID: 1779659803261893694 Describe the SIO coprocessor which serves as pretend DMA controller on recent Apple platforms. Reviewed-by: Rob Herring Signed-off-by: Martin Povišer --- This patch was reviewed outside the version count here. https://lore.kernel.org/asahi/167693643966.613996.10372170526471864080.robh@kernel.org .../devicetree/bindings/dma/apple,sio.yaml | 111 ++++++++++++++++++ 1 file changed, 111 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..0e3780ad9dd7 --- /dev/null +++ b/Documentation/devicetree/bindings/dma/apple,sio.yaml @@ -0,0 +1,111 @@ +# 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: + minItems: 2 + maxItems: 8 + 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 point into the reserved memory + regions (in device address space). + + 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: + - | + sio: dma-controller@36400000 { + 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 = <&sio_text>, <&sio_data>, + <&sio_auxdata1>, <&sio_auxdata2>; /* Filled by loader */ + apple,sio-firmware-params = <0xb 0x10>, <0xc 0x1b80>, <0xf 0x14>, + <0x10 0x1e000>, <0x30d 0x34>, <0x30e 0x4000>, + <0x1a 0x38>, <0x1b 0x50>; /* Filled by loader */ + };