From patchwork Thu Jan 10 17:34:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10756445 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A44106C5 for ; Thu, 10 Jan 2019 17:35:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8C9AE26E54 for ; Thu, 10 Jan 2019 17:35:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7CA5429A86; Thu, 10 Jan 2019 17:35:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6CBAB26E54 for ; Thu, 10 Jan 2019 17:35:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730453AbfAJReS (ORCPT ); Thu, 10 Jan 2019 12:34:18 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:38013 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729801AbfAJReS (ORCPT ); Thu, 10 Jan 2019 12:34:18 -0500 Received: by mail-pl1-f195.google.com with SMTP id e5so5473769plb.5 for ; Thu, 10 Jan 2019 09:34:17 -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=dcx6eEjMVOZ+Ig9EyGz6+bvTiD4bhQGrPgBuNC1183Y=; b=fGVrZvxGT+yjviq8KD9D7HKXW4EY6Ys3/5ws/n/XoWTXQppyNScmId8EqcbWnONL/E IujSXBN5v3qOF046m5ve9AtsWNKUsd9gFjJCDNdYJMb08b7YGy3R3UFz8lBSJIa8D3Kd S+tq1y5uxy/frm0cy+P+rvdjZgp4P7ERWrRBk= 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=dcx6eEjMVOZ+Ig9EyGz6+bvTiD4bhQGrPgBuNC1183Y=; b=sANuqgxBQCf3i+6ZYZjwjk5PCen80QMRcT6P7S1Wd8CQJiPoTya68fn0GaYcuoGKt8 DvwICYG/xtQYcu/wE7Zhs6ExmqAbLVkPcQBDkPhDBWzsv/BSZb/AN34yw2iOq926nuuz vz5DuNJ1r4363CTgobMqCJ6onc54gNX6B5uo13Wf7DbeSnNHmZLztCiGa1fgwt+0e3VC Ju9h1WBNqwS+FbSuugexGsFuqFWDI4rRPdK6RSZ1V7CWiGWCMned98xTXNmvjKCXSCLU XcQoTYWiB07oL0YUwEDLLZ/cz0iM73xghuOC8wRbhfE3PCsssFqkyLKcGdGfx1QEP4Xg 726w== X-Gm-Message-State: AJcUukffnKZWuquv79O6A+ikaEyb7SzaQDQQm0E7T5Z0ZItq8TyZ0Ayz tQGgyi2OHdq9U/76kqIaQRiMWw== X-Google-Smtp-Source: ALg8bN43bqvvSkmwC5b9V3zV4AWPhWXkrMz8YcRTGfeFnh+77pA+FXTl3p5vE0SAtBsKTqyzKZelyQ== X-Received: by 2002:a17:902:850c:: with SMTP id bj12mr10995603plb.46.1547141657129; Thu, 10 Jan 2019 09:34:17 -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.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 Jan 2019 09:34:16 -0800 (PST) From: John Stultz To: lkml Cc: Vinod Koul , Rob Herring , Mark Rutland , Zhuangluan Su , Tanglei Han , Ryan Grachek , Manivannan Sadhasivam , dmaengine@vger.kernel.org, devicetree@vger.kernel.org, Youlin Wang , John Stultz Subject: [PATCH 1/8 v3] Documentation: bindings: k3dma: Extend the k3dma driver binding to support hisi-asp Date: Thu, 10 Jan 2019 09:34:05 -0800 Message-Id: <1547141652-8660-2-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: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Youlin Wang Extend the k3dma driver binding to support hisi-asp hardware variants. Cc: Vinod Koul Cc: Rob Herring Cc: Mark Rutland Cc: Zhuangluan Su Cc: Tanglei Han Cc: Ryan Grachek Cc: Manivannan Sadhasivam Cc: dmaengine@vger.kernel.org Cc: devicetree@vger.kernel.org Signed-off-by: Youlin Wang Signed-off-by: Tanglei Han Signed-off-by: John Stultz Reviewed-by: Rob Herring --- v2: Simplify patch, removing extranious examples --- Documentation/devicetree/bindings/dma/k3dma.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/dma/k3dma.txt b/Documentation/devicetree/bindings/dma/k3dma.txt index 4945aea..10a2f15 100644 --- a/Documentation/devicetree/bindings/dma/k3dma.txt +++ b/Documentation/devicetree/bindings/dma/k3dma.txt @@ -3,7 +3,9 @@ See dma.txt first Required properties: -- compatible: Should be "hisilicon,k3-dma-1.0" +- compatible: Must be one of +- "hisilicon,k3-dma-1.0" +- "hisilicon,hisi-pcm-asp-dma-1.0" - reg: Should contain DMA registers location and length. - interrupts: Should contain one interrupt shared by all channel - #dma-cells: see dma.txt, should be 1, para number From patchwork Thu Jan 10 17:34:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10756443 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C76EA6C2 for ; Thu, 10 Jan 2019 17:34:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B4FFA26E54 for ; Thu, 10 Jan 2019 17:34:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A8BF929A86; Thu, 10 Jan 2019 17:34:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3DDC126E54 for ; Thu, 10 Jan 2019 17:34:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730464AbfAJReT (ORCPT ); Thu, 10 Jan 2019 12:34:19 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:38896 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730454AbfAJReT (ORCPT ); Thu, 10 Jan 2019 12:34:19 -0500 Received: by mail-pg1-f196.google.com with SMTP id g189so5108063pgc.5 for ; Thu, 10 Jan 2019 09:34:18 -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=scRXab2BdItzSN7N1dJ/E1JYLmZRr6aPorQ+GwZ0j2A=; b=Td7fbzWkPt9bckm0kS6rnBoYHYHCKlvh7QFb6oOn+CCUeIMD/22IHUq8NnzFbeQurk MZxTslUUWDC/6JSxlE8MF0x5AoQbDiXjD8B51boKY3w3AvatDNBwIxZT1dzm0KD4COmg /iMTRtaWvDAc7EhrwQ7ncDznFDiLAtBfNTxlo= 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=scRXab2BdItzSN7N1dJ/E1JYLmZRr6aPorQ+GwZ0j2A=; b=mCXgIK09WmvDKx7lVxZokIQx8hnKyMtzK3C+Bgdleqsdu8racZH+dzi6giyyWbndZ/ 3hE5Q/mrLgF8UUaA9P7FBYQSaVcseJOPhiFA4nGJHKie7AfSOwcExd3+KtF1F2VdtBdo aGcI6NxwZIU2tIiI2cAgsGxgwDkrhgVQgph3hp/vdqbw8yy4622OVMxmNmzqqwgjK2Yt QXWuJVjaGl+927J53ctJ2Pa+bSwgcW5ggxwKvtAwjYeFPYVxGJeLGL2Aa6T2jgO0zkKq rnF3wDSrW3sgffxwtTI5Pxhg/edArqRbPQZbe4wIVPgka6QRU66dE81sZJ7PM0ZFC+Y6 tBWQ== X-Gm-Message-State: AJcUukffmrJilbSi1MWCfUpJL3k5sehYGME9TapyfM+kJeQitw//4IPK EOnGdiY88NFOCVF0CvMW0PLp6g== X-Google-Smtp-Source: ALg8bN4pGFoTbckpuD5ANArZkBTvgy0LhUQwq8LqprlEYCoap08zvU2dN6+zVMogZ3wsWiy0xyRPBQ== X-Received: by 2002:a63:5518:: with SMTP id j24mr10037682pgb.208.1547141658464; Thu, 10 Jan 2019 09:34:18 -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.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 Jan 2019 09:34:17 -0800 (PST) From: John Stultz To: lkml Cc: Vinod Koul , Rob Herring , Mark Rutland , Tanglei Han , Zhuangluan Su , Ryan Grachek , Manivannan Sadhasivam , dmaengine@vger.kernel.org, devicetree@vger.kernel.org, John Stultz Subject: [PATCH 2/8 v3] Documentation: bindings: k3dma: Add binding for hisi-dma-avail-chan Date: Thu, 10 Jan 2019 09:34:06 -0800 Message-Id: <1547141652-8660-3-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: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some dma channels can be reserved for secure mode or other hardware on the SoC, so provide a binding for a bitmask listing the available channels for the kernel to use. Cc: Vinod Koul Cc: Rob Herring Cc: Mark Rutland Cc: Tanglei Han Cc: Zhuangluan Su Cc: Ryan Grachek Cc: Manivannan Sadhasivam Cc: dmaengine@vger.kernel.org Cc: devicetree@vger.kernel.org Signed-off-by: John Stultz --- v3: Renamed to hisi-dma-avail-chan --- Documentation/devicetree/bindings/dma/k3dma.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/dma/k3dma.txt b/Documentation/devicetree/bindings/dma/k3dma.txt index 10a2f15..38825d4 100644 --- a/Documentation/devicetree/bindings/dma/k3dma.txt +++ b/Documentation/devicetree/bindings/dma/k3dma.txt @@ -14,6 +14,9 @@ Required properties: have specific request line - clocks: clock required +Optional properties: +- hisi-dma-avail-chan: Bitmask of available physical channels + Example: Controller: From patchwork Thu Jan 10 17:34:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10756439 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F37356C2 for ; Thu, 10 Jan 2019 17:34:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DEE8726E54 for ; Thu, 10 Jan 2019 17:34:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D303B29A86; Thu, 10 Jan 2019 17:34:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5720626E54 for ; Thu, 10 Jan 2019 17:34:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730483AbfAJReW (ORCPT ); Thu, 10 Jan 2019 12:34:22 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:46604 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730471AbfAJReV (ORCPT ); Thu, 10 Jan 2019 12:34:21 -0500 Received: by mail-pf1-f195.google.com with SMTP id c73so5597686pfe.13 for ; Thu, 10 Jan 2019 09:34:20 -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=GvaGd5Qa7PcuxUq/r8GFXFG1FEuIWEy4GqPFolG9iUI=; b=jxSRrtciAFsvPrLOdNPhoVjarHW2x/2/ieNzhzFow+FU0K8BMwZLOe2a4Smu9h1k0R PKW4LIHA2T7w2pM2l3KXg2pwa3HsvR+0UOWMXVWL33Ev0NGPfMeEWNyUEwjuxpLdOihY joAfF444bcis6IgH48l+ZKHNIc3ECmaj1WIeY= 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=GvaGd5Qa7PcuxUq/r8GFXFG1FEuIWEy4GqPFolG9iUI=; b=D0tEuwIGpCaZmaj6/fy5Q8RQalQSl0rh4491Y15EXrNzMq97cQgeHXn8fvekLPHOQr xrpPJsyROxykOag1kT4vs4qhwjaWdzPPLAMqBMAAhoshrs3ZSbdU5Nkvk1iYQQyj53ZZ 9vJtdxIpAH1UeWA6RvmDZCXS71kInpozwIz9eGNj41oJ5Q74KF/rA5QuBUhGyFS3I1lX 9ZLFGLM9ZH+wTPClFc6p8Wcn/7v5BE8UcCqSBDBh1dlYjmYDQAPQRkdM7FtajORLX11o /Gb6Dp1AIJwv9Byk5AKFw1tVKOJQjzgq5X6zJ34ia7LhV7GjPdUosQJcnEUEJ6giFMyb E7rw== X-Gm-Message-State: AJcUukfAJTatawip/Jj154VgSyaBCC3y6FefPyPSQfqWCadZmY2JIePn sRmlBQI4FD6rJznS8dW/2Lb1IA== X-Google-Smtp-Source: ALg8bN4hH6OpNpCbHKtQeZyVFIwzVI9NPTlgoq4ItvQtEK7rYgtlbysusiurz+Jp1hkGwNWFvLMIbw== X-Received: by 2002:a63:83c1:: with SMTP id h184mr4506117pge.437.1547141660281; Thu, 10 Jan 2019 09:34:20 -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.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 Jan 2019 09:34:19 -0800 (PST) From: John Stultz To: lkml Cc: Dan Williams , Vinod Koul , Zhuangluan Su , Ryan Grachek , Manivannan Sadhasivam , dmaengine@vger.kernel.org, Youlin Wang , Tanglei Han , John Stultz Subject: [PATCH 3/8 v3] dma: k3dma: Upgrade k3dma driver to support hisi_asp_dma hardware Date: Thu, 10 Jan 2019 09:34:07 -0800 Message-Id: <1547141652-8660-4-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: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Youlin Wang On the hi3660 hardware there are two (at least) DMA controllers, the DMA-P (Peripherial DMA) and the DMA-A (Audio DMA). The two blocks are similar, but have some slight differences. This resulted in the vendor implementing two separate drivers, which after review, they have been able to condense and re-use the existing k3dma driver. Thus, this patch adds support for the new "hisi-pcm-asp-dma-1.0" compatible string in the binding. One difference with the DMA-A controller, is that it does not need to initialize a clock. So we skip this by adding and using soc data flags. After above this driver will support both k3 and hisi_asp dma hardware. Cc: Dan Williams Cc: Vinod Koul Cc: Zhuangluan Su Cc: Ryan Grachek Cc: Manivannan Sadhasivam Cc: dmaengine@vger.kernel.org Acked-by: Manivannan Sadhasivam Signed-off-by: Youlin Wang Signed-off-by: Tanglei Han [jstultz: Reworked to use of_match_data, commit msg improvements] Signed-off-by: John Stultz --- v2: * Reworked to use of_match_data v3: * Further rework of the commit message --- drivers/dma/k3dma.c | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/drivers/dma/k3dma.c b/drivers/dma/k3dma.c index fdec2b6..df61406 100644 --- a/drivers/dma/k3dma.c +++ b/drivers/dma/k3dma.c @@ -116,6 +116,13 @@ struct k3_dma_dev { unsigned int irq; }; + +#define K3_FLAG_NOCLK (1<<0) +struct k3dma_soc_data { + unsigned long flags; +}; + + #define to_k3_dma(dmadev) container_of(dmadev, struct k3_dma_dev, slave) static int k3_dma_config_write(struct dma_chan *chan, @@ -790,8 +797,21 @@ static int k3_dma_transfer_resume(struct dma_chan *chan) return 0; } +static const struct k3dma_soc_data k3_v1_dma_data = { + .flags = 0, +}; + +static const struct k3dma_soc_data asp_v1_dma_data = { + .flags = K3_FLAG_NOCLK, +}; + static const struct of_device_id k3_pdma_dt_ids[] = { - { .compatible = "hisilicon,k3-dma-1.0", }, + { .compatible = "hisilicon,k3-dma-1.0", + .data = &k3_v1_dma_data + }, + { .compatible = "hisilicon,hisi-pcm-asp-dma-1.0", + .data = &asp_v1_dma_data + }, {} }; MODULE_DEVICE_TABLE(of, k3_pdma_dt_ids); @@ -810,6 +830,7 @@ static struct dma_chan *k3_of_dma_simple_xlate(struct of_phandle_args *dma_spec, static int k3_dma_probe(struct platform_device *op) { + const struct k3dma_soc_data *soc_data; struct k3_dma_dev *d; const struct of_device_id *of_id; struct resource *iores; @@ -823,6 +844,10 @@ static int k3_dma_probe(struct platform_device *op) if (!d) return -ENOMEM; + soc_data = device_get_match_data(&op->dev); + if (!soc_data) + return -EINVAL; + d->base = devm_ioremap_resource(&op->dev, iores); if (IS_ERR(d->base)) return PTR_ERR(d->base); @@ -835,10 +860,12 @@ static int k3_dma_probe(struct platform_device *op) "dma-requests", &d->dma_requests); } - d->clk = devm_clk_get(&op->dev, NULL); - if (IS_ERR(d->clk)) { - dev_err(&op->dev, "no dma clk\n"); - return PTR_ERR(d->clk); + if (!(soc_data->flags & K3_FLAG_NOCLK)) { + d->clk = devm_clk_get(&op->dev, NULL); + if (IS_ERR(d->clk)) { + dev_err(&op->dev, "no dma clk\n"); + return PTR_ERR(d->clk); + } } irq = platform_get_irq(op, 0); From patchwork Thu Jan 10 17:34:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10756441 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AF0176C2 for ; Thu, 10 Jan 2019 17:34:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9BC1526E54 for ; Thu, 10 Jan 2019 17:34:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8F9A629A86; Thu, 10 Jan 2019 17:34:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 34B8C26E54 for ; Thu, 10 Jan 2019 17:34:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730127AbfAJRe4 (ORCPT ); Thu, 10 Jan 2019 12:34:56 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:35842 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730476AbfAJReW (ORCPT ); Thu, 10 Jan 2019 12:34:22 -0500 Received: by mail-pf1-f193.google.com with SMTP id b85so5620980pfc.3 for ; Thu, 10 Jan 2019 09:34:22 -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=9+fP/xi0ogaPcZ5aUHlMSoUJnZJ6VWVBpkuoagJMFKE=; b=VWO7NR8wXtFW4Qlf63tIXxHJOiol4rHIv6edeuFVZUZGFLoaQ/L5sMXEC6Gnj0ecqg ntEl4sSyjfnQ6ux4tIHo4pTkDDOIB7JgToE7egW6Jvdnh8YnlDOzaw7XERuLV+tUBlUl uK6+LA6fjyzNrvXKDqGMTLvkzZztdPd9Jy5/Q= 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=9+fP/xi0ogaPcZ5aUHlMSoUJnZJ6VWVBpkuoagJMFKE=; b=kNv7vTU4kv9J6YXwY6npD++vrxpT3Qg9jYTBdxjh251GSG6dOrvhBXZHcSyAfPZ2YH FB5mQDJJoP0NvkscXwX76dLkDB0UEDxHnLsrwslmNV0eqL4IsbvC+kcQwF9gBshJGk6R PXo5BodumSxESnQ6jl2tZyXEzlCC5lg3K+aH2WfSIj8/jw5PpBtqoO5CcRcjCFXpbr4r ihVGA+d/ZXETOytdGA/H8yJB7cz3W6IDrVBwjBOZic5BT6iiyh5ET+UyQnutaByl3KWr zwK1hfrjDv+bj9PjXy5UD3dRwwYyMDdZmcnGuO+Hdiwm09m7ML25n/5Yr7J79No8cSWQ jXzw== X-Gm-Message-State: AJcUukdYvjB0PTzITC0HeDOtz3gLWSzDY+N5u4tynsVEAHm636pAvhgM oCuiQEOt38UjaIyHvBn1rc/Qng== X-Google-Smtp-Source: ALg8bN55NhBvyLBl8QSVRq6gfls6ISMWyizSgdLOnG4pIi6rCxlD/gk0Mu3cye+141YUVCqSqC9gTg== X-Received: by 2002:a63:ac46:: with SMTP id z6mr10182577pgn.162.1547141661687; Thu, 10 Jan 2019 09:34:21 -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.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 Jan 2019 09:34:20 -0800 (PST) From: John Stultz To: lkml Cc: Dan Williams , Vinod Koul , Tanglei Han , Zhuangluan Su , Ryan Grachek , Manivannan Sadhasivam , dmaengine@vger.kernel.org, Li Yu , Guodong Xu , John Stultz Subject: [PATCH 4/8 v3] dma: k3dma: Delete axi_config Date: Thu, 10 Jan 2019 09:34:08 -0800 Message-Id: <1547141652-8660-5-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: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Li Yu Axi_config controls whether DMA resources can be accessed in non-secure mode, such as linux kernel. The register should be set by the bootloader stage and depends on the device. Thus, this patch removes axi_config from k3dma driver. Cc: Dan Williams Cc: Vinod Koul Cc: Tanglei Han Cc: Zhuangluan Su Cc: Ryan Grachek Cc: Manivannan Sadhasivam Cc: dmaengine@vger.kernel.org Acked-by: Manivannan Sadhasivam Signed-off-by: Li Yu Signed-off-by: Guodong Xu [jstultz: Minor tweaks to commit message] Signed-off-by: John Stultz --- drivers/dma/k3dma.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/dma/k3dma.c b/drivers/dma/k3dma.c index df61406..b2060bf 100644 --- a/drivers/dma/k3dma.c +++ b/drivers/dma/k3dma.c @@ -52,8 +52,6 @@ #define CX_SRC 0x814 #define CX_DST 0x818 #define CX_CFG 0x81c -#define AXI_CFG 0x820 -#define AXI_CFG_DEFAULT 0x201201 #define CX_LLI_CHAIN_EN 0x2 #define CX_CFG_EN 0x1 @@ -168,7 +166,6 @@ static void k3_dma_set_desc(struct k3_dma_phy *phy, struct k3_desc_hw *hw) writel_relaxed(hw->count, phy->base + CX_CNT0); writel_relaxed(hw->saddr, phy->base + CX_SRC); writel_relaxed(hw->daddr, phy->base + CX_DST); - writel_relaxed(AXI_CFG_DEFAULT, phy->base + AXI_CFG); writel_relaxed(hw->config, phy->base + CX_CFG); } From patchwork Thu Jan 10 17:34:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10756437 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A9DAD159A for ; Thu, 10 Jan 2019 17:34:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 94C5E26E54 for ; Thu, 10 Jan 2019 17:34:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8853829A86; Thu, 10 Jan 2019 17:34:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2320C26E54 for ; Thu, 10 Jan 2019 17:34:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729877AbfAJRet (ORCPT ); Thu, 10 Jan 2019 12:34:49 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:38899 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730368AbfAJReY (ORCPT ); Thu, 10 Jan 2019 12:34:24 -0500 Received: by mail-pg1-f193.google.com with SMTP id g189so5108135pgc.5 for ; Thu, 10 Jan 2019 09:34:23 -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=l32M1hyO4sVhHxAC4wa8f3NhTtqYQnkV1u+Gtaba/6Q+7HzWccaoG2AkSOoRVb1LH5 DB/BYSbTGmEarn983WVsfulrxGHJJCNRQ7CwBJYS+PpTyU2DKHwNfo1ijFq1vzZN5X7F qtajPS8ezi/d2ygWdnZzphFinrOsyYjsFdUS3WHR/h2CpyrtDx5kAT+J+FF+uGXXIN9B HI2+qVWqCha8wggjOHHVYu+IhyJzwpMoPOyO3oF0sVBRFHgNzbudgFO+CQtADCOzvmyw KzIuMBPACfv/1XIioWRlmF8O81yCycZ4gAblbiipgZReNVC31E8/jZBldsSBXXV5YiWw E1qw== X-Gm-Message-State: AJcUuke1T6dvUXcRvJB4eQEHNanwGGLAFvHWHXnIZCy8EiycjgE1EzIi gjjDdaGRNB1NvdEcpALoqpi9tw== X-Google-Smtp-Source: ALg8bN5fReUPM9X00AxvG4rgs5k/K0xAWLkVnBzRFck8uyETLJK1JUIVJXlP/2orbsTSEM9dCxJDwA== 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: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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; }