Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1571439pxb; Wed, 10 Feb 2021 11:24:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJz9urR8Zx05rZ2ahMa8Vu9wzmrZwTy4saVDUj5VukHGmssI6qYPJQSyYWLeI/T0+FxpYcqW X-Received: by 2002:a50:acc1:: with SMTP id x59mr4623408edc.43.1612985066603; Wed, 10 Feb 2021 11:24:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612985066; cv=none; d=google.com; s=arc-20160816; b=jtF3JSJlisWzmTF5+SULsn+FNW3oZUHI0qhH6nK/ftaQykVDa3sEXKeojhS+riTzpA devrTxlvzTJx6Yo9+/FWvN3WUG4GE7Lfr4Ph6iK7MvT5YF/IkTYFWf6nXX52+agw6tYI 4rJcHbCMBGnayGPVnmf5l0wYscc/+VlvPvsqsySMTUmgE8Ugjq5HojdFii3wTBuqcbrk 1nwZRingC86NHxBkOtw0dR+yXjBTBT8DNGFZ3EV1cxBQVSSN6BM0Zd8znamAgbAGW7hT ZYwIMVVtQa+83H6YB9h/R855NS/u68+u0vQaClocWKl15BgtnbPnLA/wqA69P8/KLFMQ qw+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=FXzDdxZIyeXjhTwCTEsoui0m1flbX0zJ4Me1t1JzLAo=; b=Xtrs8DUHRNXxmPsVkLila8jnHSt1S45e4DyKPs+Fl9xeFAuFUU5Ec/tQ2cuCIsPi32 qXl1OX3pSEIoC/cC59qY4nNNG32ffQAfxJpYwpaDnLEmQRu/ASKyRgRYiRLCtanSYPj1 FFRX2pO4N8eC/HI3L3rNgGscchUMwhMO5m9urZlMnsfvL7k2EfDIBM2PUK1mVoCsYcbf qPYep0TkdhoohTKH1CWxM7M/cP6x5R/PSrMdD7zJpDU3zYdEhnfWt5NSb/sA7gZ7amH0 txnNH8l/hev9ln1k3fJPUxHDUcZnIkSFGcxGGa85/rXB+aPDR/s8N132ZzS0BXVwaJYu y5Hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XUrvUlB8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s6si1903458ejz.2.2021.02.10.11.24.02; Wed, 10 Feb 2021 11:24:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XUrvUlB8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233858AbhBJTWf (ORCPT + 99 others); Wed, 10 Feb 2021 14:22:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:34562 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232516AbhBJTWd (ORCPT ); Wed, 10 Feb 2021 14:22:33 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id DB18564E76; Wed, 10 Feb 2021 19:21:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1612984912; bh=CHueUMIMBD3GE7Looz6rSUXBk635o0bKJjvrSZmh/t0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=XUrvUlB85euQ4N/sJBKAwuv6Ncp95ojkWdXDak05eJ/dqgN5kGD/q+uN5oZl7zC+o y8Ew3TiYa0GDuChsNQcObLl42RHlna8oPHVyhV6cdrxp+EmyhDgINhT1OdSwIchzGG Xin4HsifB3odO7dy+VN0KkLsVdXTXy5Gk355dRmOvvHDWndynYlyZbRDXc+UUFyYah TRNHtiscqfGY+kiJLqqJ8rCRSTZ8TXozoHasPQpDxh/rPKV3VHxYORZoCkgVwbrj4U 9reL4fqRCP8JcKx4GpWduyc/t5lHx2EysByvE6CmiAtNj4tXlnRbVpe/5gAS2rzRpx mpMzxuJL3WP2A== Received: by mail-ed1-f47.google.com with SMTP id v7so4323653eds.10; Wed, 10 Feb 2021 11:21:51 -0800 (PST) X-Gm-Message-State: AOAM531Hpvl4aYvR1JtMUjwwiGPADYoNPYd7XkCjwNek8dPmyCOFPMA5 OBRhQFq77P5r4rX5DnFWaClWRSZ71BsU9QYPpw== X-Received: by 2002:aa7:c7c8:: with SMTP id o8mr4669819eds.137.1612984910399; Wed, 10 Feb 2021 11:21:50 -0800 (PST) MIME-Version: 1.0 References: <20210203090727.789939-1-zhang.lyra@gmail.com> <20210203090727.789939-2-zhang.lyra@gmail.com> <20210204232549.GA1305874@robh.at.kernel.org> In-Reply-To: From: Rob Herring Date: Wed, 10 Feb 2021 13:21:38 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 1/2] dt-bindings: iommu: add bindings for sprd iommu To: Chunyan Zhang Cc: Robin Murphy , Joerg Roedel , Linux IOMMU , DTML , Baolin Wang , Linux Kernel Mailing List , Orson Zhai , Sheng Xu , Chunyan Zhang Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 5, 2021 at 1:21 AM Chunyan Zhang wrote: > > Hi Rob, > > On Fri, 5 Feb 2021 at 07:25, Rob Herring wrote: > > > > On Wed, Feb 03, 2021 at 05:07:26PM +0800, Chunyan Zhang wrote: > > > From: Chunyan Zhang > > > > > > This iommu module can be used by Unisoc's multimedia devices, such as > > > display, Image codec(jpeg) and a few signal processors, including > > > VSP(video), GSP(graphic), ISP(image), and CPP(camera pixel processor), etc. > > > > > > Signed-off-by: Chunyan Zhang > > > --- > > > .../devicetree/bindings/iommu/sprd,iommu.yaml | 72 +++++++++++++++++++ > > > 1 file changed, 72 insertions(+) > > > create mode 100644 Documentation/devicetree/bindings/iommu/sprd,iommu.yaml > > > > > > diff --git a/Documentation/devicetree/bindings/iommu/sprd,iommu.yaml b/Documentation/devicetree/bindings/iommu/sprd,iommu.yaml > > > new file mode 100644 > > > index 000000000000..4fc99e81fa66 > > > --- /dev/null > > > +++ b/Documentation/devicetree/bindings/iommu/sprd,iommu.yaml > > > @@ -0,0 +1,72 @@ > > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > > > +# Copyright 2020 Unisoc Inc. > > > +%YAML 1.2 > > > +--- > > > +$id: http://devicetree.org/schemas/iommu/sprd,iommu.yaml# > > > +$schema: http://devicetree.org/meta-schemas/core.yaml# > > > + > > > +title: Unisoc IOMMU and Multi-media MMU > > > + > > > +maintainers: > > > + - Chunyan Zhang > > > + > > > +properties: > > > + compatible: > > > + enum: > > > + - sprd,iommu-v1 > > > + > > > + "#iommu-cells": > > > + const: 0 > > > + description: > > > + Unisoc IOMMUs are all single-master IOMMU devices, therefore no > > > + additional information needs to associate with its master device. > > > + Please refer to the generic bindings document for more details, > > > + Documentation/devicetree/bindings/iommu/iommu.txt > > > + > > > + reg: > > > + maxItems: 1 > > > + description: > > > + Not required if 'sprd,iommu-regs' is defined. > > > + > > > + clocks: > > > + description: > > > + Reference to a gate clock phandle, since access to some of IOMMUs are > > > + controlled by gate clock, but this is not required. > > > + > > > + sprd,iommu-regs: > > > + $ref: /schemas/types.yaml#/definitions/phandle-array > > > + description: > > > + Reference to a syscon phandle plus 1 cell, the syscon defines the > > > + register range used by the iommu and the media device, the cell > > > + defines the offset for iommu registers. Since iommu module shares > > > + the same register range with the media device which uses it. > > > + > > > +required: > > > + - compatible > > > + - "#iommu-cells" > > > + > > > +oneOf: > > > + - required: > > > + - reg > > > + - required: > > > + - sprd,iommu-regs > > > + > > > +additionalProperties: false > > > + > > > +examples: > > > + - | > > > + iommu_disp: iommu-disp { > > > + compatible = "sprd,iommu-v1"; > > > + sprd,iommu-regs = <&dpu_regs 0x800>; > > > > If the IOMMU is contained within another device, then it should just be > > a child node of that device. > > Yes, actually IOMMU can be seen as a child of multimedia devices, I > considered moving IOMMU under into multimedia device node, but > multimedia devices need IOMMU when probe[1], so I dropped that idea. Don't design your binding around working-around linux issues. > And they share the same register base, e.g. > > + mm { > + compatible = "simple-bus"; > + #address-cells = <2>; > + #size-cells = <2>; > + ranges; > + > + dpu_regs: syscon@63000000 { Drop this node. > + compatible = "sprd,sc9863a-dpuregs", "syscon"; > + reg = <0 0x63000000 0 0x1000>; > + }; > + > + dpu: dpu@63000000 { > + compatible = "sprd,sharkl3-dpu"; > + sprd,disp-regs = <&dpu_regs>; reg = <0 0x63000000 0 0x800>; > + iommus = <&iommu_dispc>; > + }; > + > + iommu_dispc: iommu@63000000 { > + compatible = "sprd,iommu-v1"; > + sprd,iommu-regs = <&dpu_regs 0x800>; reg = <0 0x63000800 0 0x800>; > + #iommu-cells = <0>; Though given it seems there is only 1 client and this might really be just 1 h/w block, you don't really need to use the iommu binding at all. The DPU should be able to instantiate it's own IOMMU device. There's other examples of this such as mali GPU though that is all one driver, but that's a Linux implementation detail. Rob