From: Ze Huang <huangze@whut.edu.cn>
To: Krzysztof Kozlowski <krzk@kernel.org>, Ze Huang <huangze@whut.edu.cn>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>, Yixun Lan <dlan@gentoo.org>,
Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
Philipp Zabel <p.zabel@pengutronix.de>,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Alexandre Ghiti <alex@ghiti.fr>,
linux-usb@vger.kernel.org, devicetree@vger.kernel.org,
linux-riscv@lists.infradead.org, spacemit@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 2/4] dt-bindings: soc: spacemit: Add K1 MBUS controller
Date: Tue, 27 May 2025 19:13:05 +0800 [thread overview]
Message-ID: <aDWeQfqKfxrgTA__@jean.localdomain> (raw)
In-Reply-To: <20250527-energetic-pink-cricket-a282fd@kuoka>
On Tue, May 27, 2025 at 08:51:19AM +0200, Krzysztof Kozlowski wrote:
> On Mon, May 26, 2025 at 10:40:18PM GMT, Ze Huang wrote:
> > Some devices on the SpacemiT K1 SoC perform DMA through a memory bus
> > (MBUS) that is not their immediate parent in the device tree. This bus
> > uses a different address mapping than the CPU.
> >
> > To express this topology properly, devices are expected to use the
> > interconnects with name "dma-mem" to reference the MBUS controller.
>
> I don't get it, sorry. Devices performing DMA through foo-bar should use
> dmas property for foo-bar DMA controller. Interconnects is not for that.
>
Hi Krzysztof,
Sorry for not clarifying this earlier - let me provide some context.
The purpose of this node is to describe the address translation used for DMA
device to memory transactions. I’m using the "interconnects" property with the
reserved name "dma-mem" [1] in consumer devices to express this relationship.
The actual translation is handled by the `of_translate_dma_address()` [2].
This support was introduced in the series linked in [3].
This setup is similar to what we see on platforms like Allwinner sun5i,
sun8i-r40, and NVIDIA Tegra. [4][5]
I considered reusing the existing Allwinner MBUS driver and bindings.
However, the Allwinner MBUS includes additional functionality such as
bandwidth monitoring and frequency control - features that are either
absent or undocumented on the SpacemiT K1 SoC.
For this reason, I opted to introduce a minimal binding that only expresses
the required DMA mapping relationship.
Let me know if this makes sense or if you'd like me to adjust further.
Thanks!
Ze
Link: https://elixir.bootlin.com/linux/v6.15/source/Documentation/devicetree/bindings/interconnect/interconnect.txt#L60 [1]
Link: https://elixir.bootlin.com/linux/v6.15/source/drivers/of/address.c#L635 [2]
Link: https://lore.kernel.org/all/cover.f8909884585996f28d97f4ef95efbcab19527dc4.1554108995.git-series.maxime.ripard@bootlin.com/ [3]
Link: https://elixir.bootlin.com/linux/v6.15/source/arch/arm/boot/dts/allwinner/sun8i-r40.dtsi#L328 [4]
Link: https://elixir.bootlin.com/linux/v6.15/source/arch/arm64/boot/dts/nvidia/tegra234.dtsi#L3052 [5]
>
> >
> > Signed-off-by: Ze Huang <huangze@whut.edu.cn>
> > ---
> > .../bindings/soc/spacemit/spacemit,k1-mbus.yaml | 55 ++++++++++++++++++++++
> > 1 file changed, 55 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/soc/spacemit/spacemit,k1-mbus.yaml b/Documentation/devicetree/bindings/soc/spacemit/spacemit,k1-mbus.yaml
> > new file mode 100644
> > index 0000000000000000000000000000000000000000..533cf99dff689cf55a159118c32a676054294ffa
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/soc/spacemit/spacemit,k1-mbus.yaml
> > @@ -0,0 +1,55 @@
> > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/soc/spacemit/spacemit,k1-mbus.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: SpacemiT Memory Bus controller
> > +
> > +maintainers:
> > + - Ze Huang <huangze9015@gmail.com>
> > +
> > +description: |
> > + On the SpacemiT K1 SoC, some devices do not perform DMA through their
> > + immediate parent node in the device tree. Instead, they access memory
> > + through a separate memory bus (MBUS) that uses a different address
> > + mapping from the CPU.
> > +
> > + To correctly describe the DMA path, such devices must reference the MBUS
> > + controller through an interconnect with the reserved name "dma-mem".
> > +
> > +properties:
> > + compatible:
> > + const: spacemit,k1-mbus
> > +
> > + reg:
> > + maxItems: 1
> > +
> > + dma-ranges:
> > + maxItems: 1
> > +
> > + "#address-cells": true
> > +
> > + "#size-cells": true
>
> No improvements.
>
>
> > +
> > + "#interconnect-cells":
> > + const: 0
>
> This is not a interconnect provider, but DMA controller, according to
> youro description.
>
> > +
> > +required:
> > + - compatible
> > + - reg
> > + - dma-ranges
> > + - "#interconnect-cells"
> > +
> > +additionalProperties: false
> > +
> > +examples:
> > + - |
> > + dram-controller@0 {
>
> Either dma-controller or memory-controller, decide what is this.
>
I think memory-controller is better.
>
> > + compatible = "spacemit,k1-mbus";
> > + reg = <0x00000000 0x80000000>;
> > + dma-ranges = <0x00000000 0x00000000 0x80000000>;
> > + #address-cells = <1>;
> > + #size-cells = <1>;
>
> Nothing improved.
>
The #address-cells and #size-cells properties are included here to satisfy
`make dt_binding_check` and `make CHECK_DTBS`.
Without them, warnings will be triggered during validation.
dram-controller@0: dma-ranges: [[0], [0], [0], [2147483648]] is too long
>
> > + #interconnect-cells = <0>;
> > + };
> >
> > --
> > 2.49.0
> >
>
>
>
next prev parent reply other threads:[~2025-05-27 11:13 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-26 14:40 [PATCH v4 0/4] Add SpacemiT K1 USB3.0 host controller support Ze Huang
2025-05-26 14:40 ` [PATCH v4 1/4] dt-bindings: usb: dwc3: add support for SpacemiT K1 Ze Huang
2025-05-27 6:47 ` Krzysztof Kozlowski
2025-05-27 6:53 ` Krzysztof Kozlowski
2025-05-26 14:40 ` [PATCH v4 2/4] dt-bindings: soc: spacemit: Add K1 MBUS controller Ze Huang
2025-05-27 6:51 ` Krzysztof Kozlowski
2025-05-27 11:13 ` Ze Huang [this message]
2025-05-27 16:25 ` Rob Herring
2025-05-27 16:41 ` Ze Huang
2025-05-27 17:12 ` Rob Herring
2025-05-27 6:54 ` Krzysztof Kozlowski
2025-05-27 11:15 ` Ze Huang
2025-05-26 14:40 ` [PATCH v4 3/4] usb: dwc3: add generic driver to support flattened DT Ze Huang
2025-06-03 1:20 ` Thinh Nguyen
2025-06-03 2:51 ` Ze Huang
2025-07-04 2:10 ` Frank Li
2025-07-04 2:41 ` Ze Huang
2025-06-05 13:34 ` Yixun Lan
[not found] ` <20250605213443.17a7aa26b@smtp.qiye.163.com>
2025-06-06 11:43 ` Ze Huang
2025-05-26 14:40 ` [PATCH v4 4/4] riscv: dts: spacemit: add usb3.0 support for K1 Ze Huang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aDWeQfqKfxrgTA__@jean.localdomain \
--to=huangze@whut.edu.cn \
--cc=Thinh.Nguyen@synopsys.com \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlan@gentoo.org \
--cc=gregkh@linuxfoundation.org \
--cc=krzk+dt@kernel.org \
--cc=krzk@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-usb@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=robh@kernel.org \
--cc=spacemit@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).