From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754920AbbJGQFh (ORCPT ); Wed, 7 Oct 2015 12:05:37 -0400 Received: from avon.wwwdotorg.org ([70.85.31.133]:43337 "EHLO avon.wwwdotorg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754158AbbJGQFf (ORCPT ); Wed, 7 Oct 2015 12:05:35 -0400 Subject: Re: [PATCH V2 1/2] Documentation: DT: Add binding documentation for NVIDIA ADMA To: Jon Hunter References: <1444047007-30494-1-git-send-email-jonathanh@nvidia.com> <1444047007-30494-2-git-send-email-jonathanh@nvidia.com> <20151005131215.GN19064@leverpostej> <56139181.4090706@nvidia.com> <561451D3.2070605@wwwdotorg.org> <56153991.3040409@nvidia.com> Cc: Mark Rutland , Laxman Dewangan , Vinod Koul , Thierry Reding , Alexandre Courbot , Rob Herring , Pawel Moll , Ian Campbell , Kumar Gala , Arnd Bergmann , dmaengine@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org From: Stephen Warren Message-ID: <561542D3.8030607@wwwdotorg.org> Date: Wed, 7 Oct 2015 10:05:39 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <56153991.3040409@nvidia.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/07/2015 09:26 AM, Jon Hunter wrote: > > On 06/10/15 23:57, Stephen Warren wrote: >> On 10/06/2015 03:16 AM, Jon Hunter wrote: >>> >>> On 05/10/15 14:12, Mark Rutland wrote: >>>> On Mon, Oct 05, 2015 at 01:10:06PM +0100, Jon Hunter wrote: >>>>> Add device-tree binding documentation for the Tegra210 Audio DMA >>>>> controller. >>>>> >>>>> Signed-off-by: Jon Hunter >>>>> --- >>>>> .../devicetree/bindings/dma/tegra210-adma.txt | 63 >>>>> ++++++++++++++++++++++ >>>>> 1 file changed, 63 insertions(+) >>>>> create mode 100644 >>>>> Documentation/devicetree/bindings/dma/tegra210-adma.txt >>>>> >>>>> diff --git a/Documentation/devicetree/bindings/dma/tegra210-adma.txt >>>>> b/Documentation/devicetree/bindings/dma/tegra210-adma.txt >>>>> new file mode 100644 >>>>> index 000000000000..df0e46868a63 >>>>> --- /dev/null >>>>> +++ b/Documentation/devicetree/bindings/dma/tegra210-adma.txt >>>>> @@ -0,0 +1,63 @@ >>>>> +* NVIDIA Tegra Audio DMA (ADMA) controller >>>>> + >>>>> +Required properties: >>>>> +- compatible: Must be "nvidia,tegra210-adma". >>>>> +- reg: Should contain DMA registers location and length. This >>>>> should be >>>>> + a single entry that includes all of the per-channel registers in one >>>>> + contiguous bank. >>>>> +- interrupt-parent: Phandle to the interrupt parent controller. >>>>> +- interrupts: Should contain all of the per-channel DMA interrupts in >>>>> + ascending order with respect to the DMA channel index. >>>>> +- clocks: Must contain one entry for the ADMA module clock, >>>>> "adma_ape". >>>>> +- clock-names: Must contain the entry "adma_ape". >>>>> +- dma-channels: Must be 22. Defines the number of DMA channels >>>>> supported >>>>> + by the DMA controller. >>>> >>>> If this has to be a fixed value, why is it necessary? Why does the >>>> driver not just know this? >>>> >>>> Are there other instances of this IP block where this differs? >>> >>> So this will change for future devices and yes it may seem silly now to >>> have something that fixed and appears to be constant but I was trying to >>> future proof the binding. May be the comment should read "For tegra210 >>> must be 22", however, I thought the compatible string would imply this. >> >> Typically you'd want a table in the driver that maps from compatible >> value to the set of per-SoC data that's associated with the compatible >> value. Then, you don't need to put this data into the DT. > > Yes I have seen that which I was not sure that I was a fan of, given > that we have DT and its purpose is to describe the hardware. So may be > the problem I have is deciding on which hardware parameters should be > described in DT versus those that should be place in the driver itself. > I am not sure if there is a rule of thumb for this type of thing? It seems to be a matter of preference. I think DT is mainly about identifying which HW is present. Facets of the HW that are fixed (100% derivable from the compatible value) belong in the driver. If we took the opposite view, we should put a description of every register/field layout in the DT in case they change on new HW and we don't want to edit the driver code to take account of that, and in fact should put byte code into the DT since simple data might not be enough to allow us not to edit the driver. Facets that vary between boards, use-cases, etc. are the main benefit of DT in my opinion, not slow-moving data specific to SoCs.