Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp104513imp; Tue, 19 Feb 2019 19:13:39 -0800 (PST) X-Google-Smtp-Source: AHgI3IY1Hd8e3FDaT6pyqVa5BFrRkg6hVJou/jh9q3PQjSxJBw8qpkP+S1kh3aup8Gj8AsMq+O7K X-Received: by 2002:a62:d10b:: with SMTP id z11mr32566018pfg.84.1550632419648; Tue, 19 Feb 2019 19:13:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550632419; cv=none; d=google.com; s=arc-20160816; b=IOhK9dtZGxclZJRcVHtRLw4K7SuYTtXjSXdwLOzGrn9PHRWu+GFQ8tKQOWbRMNHWEb oIL7Zn9miuAbKsRYj4uJtfgiUhts44DJnCmxqE4NZIb5ZhI6tFRvrA9StrxqPC1w7QLX QwoDF58/w0GwPnUQFTA2uPgUDCvcHENuYoxOlR5WlbAWLUzLTxLJEBP3sdC1+sBy0tmq b1XhUjFMsjldpCZnDgm/i3lICDX8G9fB/aZYjQ2UX3g38UVQpmkGipGvdJrFxHdONpA6 jfMJNSwkO3OaLvR+Q++wU6pyPG/SR/O7nTnm2wHIrQUCPhI8tPd5/W2eSBgEo4jtI03F WbgA== 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; bh=z2LXbrHOldUTY/jAdGPp9j2Yl3u+b4VB1Kty9L2vXX0=; b=e9bkhSAJVsAWcJZxCRTqZaYSmz0VrfFXAqTm2KvdyfTcbBd6n+e+cYmyMg87Mi7U6t js2XSkGTNbXqUC+FXkIN8s5yd5olTzMSb9TsFAatg47F6J4fuBeMhFI6cP1wGB7Q4Phy 77pdJ/JzBX5/G4T5T2L55dMCtKfkQFnxPrZj9OzCDvdIlPSfXEv9+pJPIFHszv+PSZaA DVxHqakxf9SefTxjdL37qOxqhKBso72ZWtvMIEUbdPk+Gvxb3ZZE4uN6iQBOP5I16AIw LNOR1wT80DPbume/9IsQXG2rZDOpYGDeBJB44HPwohToDbi8rglkLqcXoxM//vUg6N3w yMUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QEOjlK8b; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x12si16897954pgf.454.2019.02.19.19.13.24; Tue, 19 Feb 2019 19:13:39 -0800 (PST) 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=@linaro.org header.s=google header.b=QEOjlK8b; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729843AbfBTDNC (ORCPT + 99 others); Tue, 19 Feb 2019 22:13:02 -0500 Received: from mail-lf1-f67.google.com ([209.85.167.67]:35987 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727085AbfBTDNC (ORCPT ); Tue, 19 Feb 2019 22:13:02 -0500 Received: by mail-lf1-f67.google.com with SMTP id q11so16419238lfd.3 for ; Tue, 19 Feb 2019 19:12:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=z2LXbrHOldUTY/jAdGPp9j2Yl3u+b4VB1Kty9L2vXX0=; b=QEOjlK8bT/e0l8yy6k559RMnGVM/tdyO3vBxCW0qTiQnYxDYumZVw7SfNnV/EGQlvS w024CbU5wFjRj9PaeBmY/3cI8VxwwUZ85cRPLumNTizEd4qa6ZDJFQhyfJqEeTTvNiX/ jddttdJfznYMARA7jWLZTAn/26boTiy5n+MvD/M8XMbqVg90BYVJaCM0CzclEqGxHbx9 smnPS1KNU+tk2CxVViAdwILhHgi31F+PrNOah10179nJHlCgdww2jvtsy3swB5q/5KP5 bN7prSkWhEgUJTMAJeqFBoHJNzgrfq2e9CLddv/T0yWWSA0/0mTD2MGPyh9gTP6sIB4K EV2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=z2LXbrHOldUTY/jAdGPp9j2Yl3u+b4VB1Kty9L2vXX0=; b=svm6chVD4qKoGptrbC0d8PIStiDQEpFpnxjnKort4JnJ309ifHBlywL9x430b0H2M3 I7L2HrRmTKUhinN0TXTUHinGxkkaMJVkf9MBUKU/5X/p2clReq80awGleYvkS2k9JF/B va4NxaEX9T0W5KIOf4tgr/2+ac0+zbGKseNt66obu0EBsZSA/3RXUmGAqQn2gLlOcMMy blfmufvBtpUhPbxwAZSF2UYwxQwWG3LQ9M2UZAMsttXE0G+1Kj6YdRNsAFJ2HsmN18X8 0sa8cdjNfCba82a0gYFVBAshWdgYmQcZzyarxlIBmoPKfMfSfQFixTCu3c73q2EgE2XD WxSw== X-Gm-Message-State: AHQUAubkCXz5F+8qDgHaR+cWCzxDvuvVueuok7nZnw7wd+/F4dARwPJS KKiN3JIFUngaMmnrmcvQ0rY+AevOkvEtqipdzKfBVA== X-Received: by 2002:a19:5205:: with SMTP id m5mr18907054lfb.61.1550632378836; Tue, 19 Feb 2019 19:12:58 -0800 (PST) MIME-Version: 1.0 References: <20190219122027.GA21884@vkoul-mobl> In-Reply-To: <20190219122027.GA21884@vkoul-mobl> From: Baolin Wang Date: Wed, 20 Feb 2019 11:12:47 +0800 Message-ID: Subject: Re: [PATCH 1/3] dt-bindings: dmaengine: Add one new cell to present hardware slave id To: Vinod Koul Cc: Geert Uytterhoeven , Arnd Bergmann , Rob Herring , Mark Rutland , Olof Johansson , Orson Zhai , Lyra Zhang , Dan Williams , DTML , arm-soc , Linux ARM , Linux Kernel Mailing List , dmaengine@vger.kernel.org, eric.long@unisoc.com, Mark Brown 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 Tue, 19 Feb 2019 at 20:20, Vinod Koul wrote: > > On 19-02-19, 17:49, Baolin Wang wrote: > > Hi Geert, > > > > On Tue, 19 Feb 2019 at 17:30, Geert Uytterhoeven wrote: > > > > > > Hi Baolin, > > > > > > On Tue, Feb 19, 2019 at 4:15 AM Baolin Wang wrote: > > > > On Mon, 18 Feb 2019 at 20:23, Arnd Bergmann wrote: > > > > > On Mon, Feb 18, 2019 at 11:52 AM Baolin Wang wrote: > > > > > > On Mon, 18 Feb 2019 at 18:31, Arnd Bergmann wrote: > > > > > > > > > > > > > > On Tue, Feb 12, 2019 at 9:25 AM Baolin Wang wrote: > > > > > > > > On Fri, 1 Feb 2019 at 19:53, Baolin Wang wrote: > > > > > > > > > On Thu, 31 Jan 2019 at 00:52, Arnd Bergmann wrote: > > > > > > > > > > On Tue, Jan 22, 2019 at 2:21 PM Baolin Wang wrote: > > > > > > > > > > > > > > > > > > > > > > Client: > > > > > > > > > > > DMA clients connected to the Spreadtrum DMA controller must use the format > > > > > > > > > > > -described in the dma.txt file, using a two-cell specifier for each channel. > > > > > > > > > > > -The two cells in order are: > > > > > > > > > > > +described in the dma.txt file, using a three-cell specifier for each channel. > > > > > > > > > > > +The three cells in order are: > > > > > > > > > > > 1. A phandle pointing to the DMA controller. > > > > > > > > > > > 2. The channel id. > > > > > > > > > > > +3. The hardware slave id which is used for clients to trigger DMA engine > > > > > > > > > > > +automatically. > > > > > > > > > > > > > > > > > > > > I notice that this is an incompatible binding change. Is that necessary? > > > > > > > > > > If the current code works, I'd suggest allowing both #dma-cells=<2> > > > > > > > > > > and <3>, and then implementing both in the driver. > > > > > > > > > > > > > > > > > > Yes, this is necessary. > > > > > > > > > > > > > > > > > > Yes, current code can work, but the problem is that the DMA clients > > > > > > > > > must add one property (something like "sprd,slave-id") to specify the > > > > > > > > > slave id. So considering this, we want to change the dma-cells to 2, > > > > > > > > > including dma channel and dma slave id, which can avoid introducing > > > > > > > > > some similar properties for DMA clients. > > > > > > > > > > > > > > > > > > Now there are no DMA clients in mainline for Spreadtrum platform, and > > > > > > > > > we want to upstream our first DMA clients: SPI controller. So no other > > > > > > > > > drivers need to change when we changing dma cells. Thanks. > > > > > > > > > > > > > > > > Do you have any other concerns about this patch set? If not, I think > > > > > > > > Vinod can apply this patch set. Thanks. > > > > > > > > > > > > > > Sorry for the late reply. Yes, this makes sense since there are no > > > > > > > existing users then. For the DT changes going through the dmaengine > > > > > > > tree > > > > > > > > > > > > > > Acked-by: Arnd Bergmann > > > > > > > > > > > > Thanks for your reviewing. > > > > > > > > > > > > > > > > > > > > One more question, to make sure we don't need to edit it again: > > > > > > > Why do you need both a 'channel id' and a 'slave id' here? Is this > > > > > > > a strict hardware requirement for your DMA engine? In many > > > > > > > other designs, only a DMA request line number needs to > > > > > > > be described, and I think this would correspond to what you > > > > > > > call the 'hardware slave id' in your documentation. > > > > > > > > > > > > I try to explain why we need the slave id. > > > > > > > > > > > > For our DMA engine driver, we have software request mode and hardware > > > > > > request mode. For software request mode, the DMA engine driver need > > > > > > trigger DMA to start transfer manually. But for hardware request mode, > > > > > > we just set one unique slave id corresponding to the slave hardware to > > > > > > the DMA engine, then the slave hardware can trigger DMA automatically. > > > > > > And the slave id is not always same with the channel id according to > > > > > > the SoC design, so we add one cell to specify the slave id. > > > > > > > > > > I did understand the need for a slave-id, I was instead wondering about > > > > > the channel-id number. On many SoCs, all channels are equal, and you > > > > > just have to pick one of those with the right capabilities for a particular > > > > > slave. > > > > > > > > Yes, all channels are equal. We just set a unique slave id for the > > > > channel for a particular slave. For example, the SPI slave can use > > > > channel 10 for tx transfer by setting slave id 11, or it also can use > > > > channel 9 for tx transfer by setting same slave id 11. > > > > > > So the channel selection is software policy, not hardware description, and > > > thus doesn't belong in DT? > > > > > > Can't the DMA engine driver allocate channels dynamically, removing the > > > need to specify this in DT? > > > > In theory we can do as you suggested. But we still want to > > manage/assign the DMA channel resources manually for one SoC, we can > > make sure some important DMA slaves (such as audio) can request a DMA > > channel at runtime firstly, another benefit is that it is easy to > > debug since we can easily know which channel is assigned for this > > slave. > > Are you suggesting that you have more users than channels available? Until now we have not met this issue, but we can not make sure if this can happen in future. Moreover DMA channel resources are belonging to the DMA engine's hardware resources, I think it should be described in DT like many other drivers did. > I dont think it is hard to debug if channels are dynamic in > nature (for example we can print channel number and you know which one > are you talking about, fwiw i have worked on a such a system where we > grabbed the free channel) > > -- > ~Vinod -- Baolin Wang Best Regards