Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1827607imm; Thu, 23 Aug 2018 09:22:46 -0700 (PDT) X-Google-Smtp-Source: AA+uWPyN7BMKdHJdR4rGhXDdM8+a9eEZLNJSDp/T1kWBoC66PdQ5llbBo1t/D3Bd9g6gYS+ijMDU X-Received: by 2002:a63:454d:: with SMTP id u13-v6mr14392659pgk.342.1535041366147; Thu, 23 Aug 2018 09:22:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535041366; cv=none; d=google.com; s=arc-20160816; b=j4kj8ET03KoubfgfwZSKGCAR7iAUH1GkLBW8SS6Ih4Y8yVeQmQ0bl294Z/KsLaCsDU 6BBqr7ETptFfdyycS6BhxePKofUJwDwkgHo8L/xiK5ZKMdPtbtJdS/X+uszF1mgCKJwW +8PpcVYZGYzX13HWgDtsXjqMbyvvs5gDgkYjvwVrS7Vul4QjYBsuOGybhmJzcP/U2tCn XNB2F7+pzrinCNiImgNwr0vP+WbLk1PZ9DUTyeNXHbouOG342KScwUgrZ9/HP6hEW0Ct Dl5kokHLXAq1eQlbe/cf2cGN9WZ2uoVmDaNqSQNwrgND8ZudqD9CJRdh41H85pD9FvRI uiOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=VwfKW/+S2FD8ns5Chv4/OAHmcW9ULs2bMeyJoc/BNfw=; b=y45BppC/NYyv8MdRiHxN8vk6H61NQsHPNq3EgQOQaTdaKsM1QoYBZ9lII7UPV2zbE+ /j3RbBsE32hwgB8ethQbBHij095eNAX1fEQRhoPLoUwzyRwP9Rj/HOzIKzj86qM0UNES MtZ4fkrbonu/2PD5NOBv4RPGVw1QUlpBlbx7vO3YLotbH8C3rYyqM5tj24uKJKfqDcfn RTIERGvbtB2LBzW0RRLhP4PUNV0CXycrLsCbDRZLtaNqBPJk8Ll0hLU0QY1dqzBEZN6G tud5tPupE8abMpxhskubbpVSONzsmhw3Kc0+layOUfAUtLlsTehi7/5M5lPNOyuGX4lJ T+GQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KN9wNyJW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id f80-v6si2363074pfe.291.2018.08.23.09.22.31; Thu, 23 Aug 2018 09:22:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KN9wNyJW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1730187AbeHWQvc (ORCPT + 99 others); Thu, 23 Aug 2018 12:51:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:38822 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729611AbeHWQvc (ORCPT ); Thu, 23 Aug 2018 12:51:32 -0400 Received: from mail-qk0-f174.google.com (mail-qk0-f174.google.com [209.85.220.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CD5B7208E8; Thu, 23 Aug 2018 13:21:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1535030510; bh=USO/Y8AHjw5OVWesm6RS66FPWrYenf0jv5CKATNn1MU=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=KN9wNyJWHD97qwS3pCKeN9W9nRkQ0Hr/+u6hzrGzCS6ch9yHGUg/Clp5flsxELpFP TDjn4TWz5ULoPVrQbrfjrs4W6dIQUWfVw+/ZEg9TSQN6oq97ZEYfYPkXUYnL2b4Ucr StgLc5qVOSp3DquayaPABgQxdy1kUy4Dwk0cQj30= Received: by mail-qk0-f174.google.com with SMTP id z125-v6so3542169qkb.12; Thu, 23 Aug 2018 06:21:49 -0700 (PDT) X-Gm-Message-State: AOUpUlGO6jvBzBEljo1RFlPmdqqIu1OkWzVoQ2FGP98pBxieVjDuk7nj RNIDFcM5yAr7FCDLOiGu+kb6mnfuXPGuB8NUpg== X-Received: by 2002:a37:169c:: with SMTP id 28-v6mr26071000qkw.184.1535030509053; Thu, 23 Aug 2018 06:21:49 -0700 (PDT) MIME-Version: 1.0 References: <1534843809-4137-1-git-send-email-yamada.masahiro@socionext.com> <1534843809-4137-2-git-send-email-yamada.masahiro@socionext.com> In-Reply-To: From: Rob Herring Date: Thu, 23 Aug 2018 08:21:37 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/2] dt-bindings: dmaengine: add DT binding for UniPhier MIO DMAC To: Jassi Brar Cc: Masahiro Yamada , Vinod , "open list:DMA GENERIC OFFLOAD ENGINE SUBSYSTEM" , Masami Hiramatsu , devicetree@vger.kernel.org, "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 23, 2018 at 12:38 AM Jassi Brar wrote: > > On 23 August 2018 at 10:48, Masahiro Yamada > wrote: > > Hi Jassi, > > > > > > 2018-08-21 19:44 GMT+09:00 Jassi Brar : > >> On 21 August 2018 at 15:17, Masahiro Yamada > >> wrote: > >>> (+CC Rob, DT, LKML) > >>> > >>> I forgot to CC this to DT community... > >>> > >>> > >>> 2018-08-21 18:30 GMT+09:00 Masahiro Yamada : > >>>> The MIO DMAC (Media IO DMA Controller) is used in UniPhier LD4, > >>>> Pro4, and sLD8 SoCs. > >>>> > >>>> Signed-off-by: Masahiro Yamada > >>>> --- > >>>> > >>>> .../devicetree/bindings/dma/uniphier-mio-dmac.txt | 28 ++++++++++++++++++++++ > >>>> 1 file changed, 28 insertions(+) > >>>> create mode 100644 Documentation/devicetree/bindings/dma/uniphier-mio-dmac.txt > >>>> > >>>> diff --git a/Documentation/devicetree/bindings/dma/uniphier-mio-dmac.txt b/Documentation/devicetree/bindings/dma/uniphier-mio-dmac.txt > >>>> new file mode 100644 > >>>> index 0000000..a9e969e > >>>> --- /dev/null > >>>> +++ b/Documentation/devicetree/bindings/dma/uniphier-mio-dmac.txt > >>>> @@ -0,0 +1,28 @@ > >>>> +UniPhier Media IO DMA controller > >>>> + > >>>> +This works as an external DMA engine for SD/eMMC controllers etc. > >>>> +found in UniPhier LD4, Pro4, sLD8 SoCs. > >>>> + > >>>> +Required properties: > >>>> +- compatible: should be "socionext,uniphier-mio-dmac". > >>>> +- reg: offset and length of the register set for the device. > >>>> +- interrupts: a list of interrupt specifiers associated with the DMA channels. > >>>> +- clocks: a single clock specifier > >>>> +- #dma-cells: should be <1>. The single cell represents the channel number. > >>>> +- dma-channels: specify the number of the DMA channels. This should match to > >>>> + the number of tuples in the interrupts property. > >>>> + > >> Can we not infer the number of channels from interrupt tuples? After > >> all the driver assumes they are same. > > > > > > It would be possible to count the number of tuples > > in "interrupts". > > > > > > > > I know of_irq_count(), but I do not see any driver > > in drivers/dma/ that calls it. > > > > > > I guess the reason is that of_irq_count() is not exported, > > so tristate drivers like this cannot use it. > > > > > > I checked Documentation/devicetree/bindings/dma/, > > and some controllers specify _redundant_ dma-channels property. > > > > fsl-mxs-dma.txt > > renesas,rcar-dmac.txt > > renesas,usb-dmac.txt > > > :) I am not sure "because others are doing it" is a good reason to > introduce redundancy. > > > > I also see counter-implementation. > > > > > > bcm2835-dma.c hard-codes the number of channels in the driver. > > tegra210-adma.c associates nr_channels with compatible string. > > > > > > > > I will wait for comments from the maintainers. > > > > If desired, I will export of_irq_count() > > and use it from my driver. > > > If you don't want to leave too much footprint, you could do > > count = 0; > while (of_irq_parse_one(dev, count, &irq) == 0) count++ > > of_irq_parse_one() is already exported. Yes, but we really don't more users and drivers shouldn't be using it. Grepping DT functions and when the only users are pretty much powerpc, that's a good indication not to use the function. And you don't want to use of_irq_count either. platform_irq_count is what should be used here. It's already exported. Rob