Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp350431imp; Wed, 20 Feb 2019 01:10:13 -0800 (PST) X-Google-Smtp-Source: AHgI3IZraglItFizJsiqMjl5IuIrI24veOlf5mbxa/kvRiZpcNGgd65YPG/jZAXNpG8tGOd1V9Jg X-Received: by 2002:a63:1408:: with SMTP id u8mr28436155pgl.271.1550653813695; Wed, 20 Feb 2019 01:10:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550653813; cv=none; d=google.com; s=arc-20160816; b=CajWH0+TIWnhD9ekD8aDRQCgKAObnitDXCQxjwL2PhMnFJkxHyRIuVmQAMP45kfPI9 n6hHNtw1yatOcmM7F/ahsNoHr7qVCZ6PtK7yBKH/ij1yYu6wIMEOMyKfw7j9x6+uB+0w Bc3OdK20B09QR4pa5YAmppoMyq8N3nJ57QPFPoV8r97cCdKYSSKxTxUDbpWINMrsaF10 mAPB6A1Z8s90w6kZwYq9iIqHnk3Oi1BEc8tiDVrZiGP072Tmp8/5TQ2reTh7iNVdVBfx e0Zgu3qBB+ZQHeOPJRuJfuVuWkJ5v0kHxVsJ6dq4gkmlfPrkkE084C9IBd/QRvj+9c3+ evHw== 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; bh=5mUECuGflbT+3OtT6Ql/vTgnLCOiUQ5tsdWlat+sv/Y=; b=WNVctJT9893fwIUaUXlDWdA+28CYHXggi9MRz7VhbQy5kfYFVTfxKf5RJo5exH8Att HhkyHpXDBcZDJ+KNDa9mdexM0RaQX4jINOhpCMoiBPdq3QUH1AeDqsGrw/dsb9+cDj1Y B2Mb6Cu8JO9UyMd5UPRDRZNUQlotalNUDsYaQclE6EV6uc42vPgilt7UJaNs5vYcyrAI 1qac/yF302dQ0QDGIGD9WBFdfOwryThZXV8BQHKAO47IQDuZ335kiHikGDcmtKL2ioWn yv/Q94PWyYSKKy9sLJSEIgXFW3OVr3vqCpQwFspic+suKakcwF9w5+dO2wWoSkTqa6WU Fbtw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cv2si20818160plb.192.2019.02.20.01.09.58; Wed, 20 Feb 2019 01:10:13 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726725AbfBTJIE (ORCPT + 99 others); Wed, 20 Feb 2019 04:08:04 -0500 Received: from mail-qt1-f193.google.com ([209.85.160.193]:42163 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725885AbfBTJIE (ORCPT ); Wed, 20 Feb 2019 04:08:04 -0500 Received: by mail-qt1-f193.google.com with SMTP id b8so26317082qtr.9; Wed, 20 Feb 2019 01:08:03 -0800 (PST) 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=5mUECuGflbT+3OtT6Ql/vTgnLCOiUQ5tsdWlat+sv/Y=; b=G7doco4S0uSlTFap4JtpMtDxSRGPTtXJTyAf1Pr5Jh1VFIjaN4tfcb5vOGeqmOozdK pIp7iYsPwtGqhqKa8nzdsm5xGVMtQ4CyZOCyFxiez1K59NIQLf7uzYy8z4zyL91unTU5 Qp2a/qsRt7ItaTDwYvcejYHoOOYfZy7JWFdlA+tQJiqWQQZJw7tzHjguS0nc2bFtPeZg EHl5LkhMWIjbAyej7DwrA0Nh4QRXjERSen+wb2IUKLNsriPqzi5lKJSkvcVJ+YOcc+Tm YdXvGzaSti5H2yF6WfhlN526OIRag5hcQEJBBfVHs8Tw5eSc3gi8mWh6+YBCfw/ywFQt uCEg== X-Gm-Message-State: AHQUAuY+hS/2UMq1jvLJbMHuSCm13a0D2D6U8ypJQwv8O3BasEd0wzMN qahMQLYBreMzUEJ3DHnjacgDZguFFu7KXZwXb0s= X-Received: by 2002:ac8:445a:: with SMTP id m26mr25849852qtn.212.1550653682931; Wed, 20 Feb 2019 01:08:02 -0800 (PST) MIME-Version: 1.0 References: <20190219122027.GA21884@vkoul-mobl> In-Reply-To: From: Arnd Bergmann Date: Wed, 20 Feb 2019 10:07:45 +0100 Message-ID: Subject: Re: [PATCH 1/3] dt-bindings: dmaengine: Add one new cell to present hardware slave id To: Baolin Wang Cc: Vinod Koul , Geert Uytterhoeven , 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 Wed, Feb 20, 2019 at 4:13 AM Baolin Wang wrote: > On Tue, 19 Feb 2019 at 20:20, Vinod Koul wrote: > > On 19-02-19, 17:49, Baolin Wang wrote: > > > On Tue, 19 Feb 2019 at 17:30, Geert Uytterhoeven wrote: > > > > 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: > > > > > > 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. As far as I can tell, most platforms do not describe the assignment of resources in DT for dma engines, the numbers in there are meant to describe whatever is fixed, and most platforms should do it that way. The naming is sometimes a bit confusing, as a dma request line assignment can be called a slave-id or a channel-id depending whose documentation you read. The drivers/dma/virt-dma.c implementation is used in some cases to represent request numbers as virtual channels, so a dmaengine driver can allow one dma_request_chan() per slave, and then assign the hardware channels dynamically while doing a transfer, rather than having a fixed channel assignment when we first ask for a channel. Arnd