Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2182884imu; Thu, 10 Jan 2019 09:36:11 -0800 (PST) X-Google-Smtp-Source: ALg8bN6pt6wCYteFwbI82HkrWS/5WOlk4LO5l+AHvRp190W6CfjxTbNpsrI9zzbYCrdiGJ0aHj59 X-Received: by 2002:a17:902:d697:: with SMTP id v23mr11041671ply.261.1547141771856; Thu, 10 Jan 2019 09:36:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547141771; cv=none; d=google.com; s=arc-20160816; b=cvQaSIaykllzFp6J50shM499EuWnPulA1Znt5fI81GISzGfJjWPZkK+VRYL9WIvU8g Zwu9KRoi4cvNLUvMgRLlIU9hGQ15MKPje0RAIniu8We6uG+9hqqHPbpUchcUMjNHrBaP pDynflPXjZ4LWnoBAH2Wjre9m4BDTb0m41/C6ymy6wk2H+rrZ5fcREjdNZVsbtjy9Fz6 S79NKku/RSxFV+vTH+G2PiQ4xMNghvmxnMEOXGQ0+Iz4ufHVcpQUeoYHikOmFeP9OCtJ uODi4N5jDTF57uECMm06dyoY5PQxuA/2YZuxBLh5HN9hCMxFlQm57JexNyyZwOUhMDkV rSrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=Acz25rUAnYOwtdV3EAKACd8ebfPIsH2pLWOoO+LfHkQ=; b=yygfaIMwfyggINDk2l81liT9lGPMe5I6MxpFItlUVxDV0WiiPlKeX+UiVTLjsDu0yT Nzph+bOJR00lxZRGwee4VePOypfLx4w5No7gJn1Aj42fCh+WeEO00B2hU+m+BqGlAVJ3 rUzkJ5ztRqQJ1OFMZKVQRFHHfgN2V18rMckoY5+GiG9cRji1co37s09at/8+3sLZwZzy iSTXwwWlaJh1MTHbdUhjrIjmx5Ig0JjXHO3VmkDCesinMwlQaN0sw9wl/izCzdIP5n60 U6CnToLuVDoTus+5ZOsvGSKEkf3cS3UcV7WkSUv727hSk5aBvQoHUKAWioMzJwhv0UM4 M/zQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HL6eVqd3; 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 k25si4100910pfe.10.2019.01.10.09.35.56; Thu, 10 Jan 2019 09:36:11 -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=HL6eVqd3; 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 S1730517AbfAJRe1 (ORCPT + 99 others); Thu, 10 Jan 2019 12:34:27 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:44116 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730488AbfAJReZ (ORCPT ); Thu, 10 Jan 2019 12:34:25 -0500 Received: by mail-pg1-f196.google.com with SMTP id t13so5091371pgr.11 for ; Thu, 10 Jan 2019 09:34:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Acz25rUAnYOwtdV3EAKACd8ebfPIsH2pLWOoO+LfHkQ=; b=HL6eVqd3VAGtKA/ZqhGwc7urfTA9PFdcn3E/aLw3sh22SI6JuaZf+Uh1/+13tBxK9V cOpJ3YGxuk1q1H1+yU4KXo3S6zRVKketPHzEQHMzaXd8LyG1ZpaG2wgofDWOjiJ8+ipG Q8DSr1kPEWC26HS7YbYJUnNvAClIakTFeHkTs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Acz25rUAnYOwtdV3EAKACd8ebfPIsH2pLWOoO+LfHkQ=; b=BfhZQRNk1uJIr2Ypf9k3hgeqhb9B91d1e2YZVEqZQBwYZa9B0TytlqLVOxrE6/zCgl Q/Uo6DbRp7OuoE6ZbVfID2rnWn+eZ+jf2vOG0mPWowJiMlDoLXbooq9L5B5baqGnCKGX j43gueLI7I9FAOXBGZcllOdFaomo0tzpTy2/uqKJaSdPrm2HVeLirMlHeImVueloZIC8 LUnqmYfPkDg8wTw/Uszvo3sQ7zWZnlYLbbYGWbxUHFBm93nXggBGk9CmMdF5gMtz8M3n FJR1OwTVL0VdLJDj2mafBrXIzEjTcxvrbmo43TeWGmKfHjppSRaB1X3rCAwDRHw2ODbr P+dg== X-Gm-Message-State: AJcUukdDlUYXuUNp/klAXItWSgv9DlTDamAeGkZmo61WMcXQTm/iaL6M jBOV6bzffV2mcOLM3CnW2GqllHLDQujt2w== X-Received: by 2002:a63:a91a:: with SMTP id u26mr10042588pge.349.1547141663245; Thu, 10 Jan 2019 09:34:23 -0800 (PST) Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id k15sm125977409pfb.147.2019.01.10.09.34.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 Jan 2019 09:34:22 -0800 (PST) From: John Stultz To: lkml Cc: Dan Williams , Vinod Koul , Tanglei Han , Zhuangluan Su , Ryan Grachek , Manivannan Sadhasivam , Guodong Xu , dmaengine@vger.kernel.org, Li Yu , John Stultz Subject: [PATCH 5/8 v3] dma: k3dma: Add support for hisi-dma-avail-chan Date: Thu, 10 Jan 2019 09:34:09 -0800 Message-Id: <1547141652-8660-6-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1547141652-8660-1-git-send-email-john.stultz@linaro.org> References: <1547141652-8660-1-git-send-email-john.stultz@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Li Yu Add hisi-dma-avail-chan as a property for k3dma, it defines available dma channels which a non-secure mode driver can use. One sample usage of this is in Hi3660 SoC. DMA channel 0 is reserved to lpm3, which is a coprocessor for power management. So as a result, any request in kernel (which runs on main processor and in non-secure mode) should start from at least channel 1. Cc: Dan Williams Cc: Vinod Koul Cc: Tanglei Han Cc: Zhuangluan Su Cc: Ryan Grachek Cc: Manivannan Sadhasivam Cc: Guodong Xu Cc: dmaengine@vger.kernel.org Signed-off-by: Li Yu [jstultz: Reworked to use a channel mask] Signed-off-by: John Stultz --- v3: Rename to hisi-dma-avail-chan --- drivers/dma/k3dma.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/dma/k3dma.c b/drivers/dma/k3dma.c index b2060bf..f4001ca 100644 --- a/drivers/dma/k3dma.c +++ b/drivers/dma/k3dma.c @@ -111,6 +111,7 @@ struct k3_dma_dev { struct dma_pool *pool; u32 dma_channels; u32 dma_requests; + u32 dma_avail_chan; unsigned int irq; }; @@ -318,6 +319,9 @@ static void k3_dma_tasklet(unsigned long arg) /* check new channel request in d->chan_pending */ spin_lock_irq(&d->lock); for (pch = 0; pch < d->dma_channels; pch++) { + if (!(d->dma_avail_chan & (1<phy[pch]; if (p->vchan == NULL && !list_empty(&d->chan_pending)) { @@ -335,6 +339,9 @@ static void k3_dma_tasklet(unsigned long arg) spin_unlock_irq(&d->lock); for (pch = 0; pch < d->dma_channels; pch++) { + if (!(d->dma_avail_chan & (1<phy[pch]; c = p->vchan; @@ -855,6 +862,13 @@ static int k3_dma_probe(struct platform_device *op) "dma-channels", &d->dma_channels); of_property_read_u32((&op->dev)->of_node, "dma-requests", &d->dma_requests); + ret = of_property_read_u32((&op->dev)->of_node, + "hisi-dma-avail-chan", &d->dma_avail_chan); + if (ret) { + dev_warn(&op->dev, + "hisi-dma-avail-chan doesn't exist, considering all as available.\n"); + d->dma_avail_chan = (u32)~0UL; + } } if (!(soc_data->flags & K3_FLAG_NOCLK)) { @@ -886,8 +900,12 @@ static int k3_dma_probe(struct platform_device *op) return -ENOMEM; for (i = 0; i < d->dma_channels; i++) { - struct k3_dma_phy *p = &d->phy[i]; + struct k3_dma_phy *p; + + if (!(d->dma_avail_chan & (1<phy[i]; p->idx = i; p->base = d->base + i * 0x40; } -- 2.7.4