From patchwork Mon Mar 13 14:16:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: M'boumba Cedric Madianga X-Patchwork-Id: 9621013 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 359A560414 for ; Mon, 13 Mar 2017 14:18:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 28772267EC for ; Mon, 13 Mar 2017 14:18:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1D592284F3; Mon, 13 Mar 2017 14:18:44 +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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable 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 C6388267EC for ; Mon, 13 Mar 2017 14:18:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753303AbdCMORK (ORCPT ); Mon, 13 Mar 2017 10:17:10 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:33240 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752852AbdCMOQZ (ORCPT ); Mon, 13 Mar 2017 10:16:25 -0400 Received: by mail-wr0-f194.google.com with SMTP id g10so20268166wrg.0; Mon, 13 Mar 2017 07:16:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5btPVNZzhHNllrCkIBC+c/s4WYo/guYf4QKA6Yyua8I=; b=cVuVzZ4SfpKgCxFkoCN4z68fwg+KYBPP5+sVb56a4hZ0n+qTXsWJDb94inHejvdzLG gyi1JrDfxb4+pLhpn8xVEAQKN5Wxb6NuZHXQ8q2NU5OIO2CCnXxhez5rpEe2klLrISt/ ydeMQ3wnWjmIuNY/s4V+ufbXqUMaOepmwyVRVudE7JQONmZORPhq3ma1VXg0wDVNTR2h cm8pjF/ewlY42kNa2z0/bm/jkqAX2bjxg36Rgx7WlR39/iRCg+qxJJ9mLKJEcg+1/NiT 47WZCQcerMnYbYnHGQN3nnd7HRBNzOnRPd9c26Bvw4/yjW01FG8Rj4M+K9UzfjWElCOs CV+w== 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=5btPVNZzhHNllrCkIBC+c/s4WYo/guYf4QKA6Yyua8I=; b=oynxvydZpt6mpTcsgNuKHteJGpMGF2vDkVTWF/6SJyhWm1Nu7xZYtkUgU4qzhqNCf/ rYGoeYWn1Xt78p0UisJ8Uvb1EYCuQZguyEHUu03jS9MbPYIpbmF22QopLaL8M9oAhxHm X8FGQZ3w2AHC+KD6vX3fTcio+E1lIzcuvPwcuvYIolU5DX9zKADnW2GDTKQTnxXVBNpe caDD2i4mr4NWlUlDOG5F0CcnYwy61vDK3q+GDzET06MPlo0TXwKwweU8vedlCOGjjT3B T+b1F3H69AhoDu8T36XwHhsyhd+zhuz+xVbUIFkz38LnHJzV6Rm+AaT7QHgAaXsGakMJ clQw== X-Gm-Message-State: AMke39kv5xHKhwMmCTqdISaeMJj5r8WAJjYBczEzP+pLyxngm/9kTP019R3rl6EeFHm7yg== X-Received: by 10.223.175.238 with SMTP id y46mr26771328wrd.63.1489414583140; Mon, 13 Mar 2017 07:16:23 -0700 (PDT) Received: from lmenx29w.st.com. ([37.171.147.92]) by smtp.gmail.com with ESMTPSA id t103sm25283741wrc.43.2017.03.13.07.16.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 13 Mar 2017 07:16:22 -0700 (PDT) From: M'boumba Cedric Madianga To: vinod.koul@intel.com, robh+dt@kernel.org, mark.rutland@arm.com, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com, dan.j.williams@intel.com, dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: M'boumba Cedric Madianga Subject: [PATCH 4/5] dmaengine: stm32-dma: Add support for STM32 DMAMUX Date: Mon, 13 Mar 2017 15:16:00 +0100 Message-Id: <1489414561-28912-5-git-send-email-cedric.madianga@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1489414561-28912-1-git-send-email-cedric.madianga@gmail.com> References: <1489414561-28912-1-git-send-email-cedric.madianga@gmail.com> Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds support for STM32 DMAMUX. When the STM32 DMA controller is behind a STM32 DMAMUX the request line number has not to be handled by DMA but DMAMUX. Signed-off-by: M'boumba Cedric Madianga --- drivers/dma/stm32-dma.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/dma/stm32-dma.c b/drivers/dma/stm32-dma.c index 786fc8f..3bf2893 100644 --- a/drivers/dma/stm32-dma.c +++ b/drivers/dma/stm32-dma.c @@ -179,6 +179,7 @@ struct stm32_dma_device { struct clk *clk; struct reset_control *rst; bool mem2mem; + bool dmamux; struct stm32_dma_chan chan[STM32_DMA_MAX_CHANNELS]; }; @@ -968,10 +969,14 @@ static void stm32_dma_desc_free(struct virt_dma_desc *vdesc) static void stm32_dma_set_config(struct stm32_dma_chan *chan, struct stm32_dma_cfg *cfg) { + struct stm32_dma_device *dmadev = stm32_dma_get_dev(chan); + stm32_dma_clear_reg(&chan->chan_reg); chan->chan_reg.dma_scr = cfg->stream_config & STM32_DMA_SCR_CFG_MASK; - chan->chan_reg.dma_scr |= STM32_DMA_SCR_REQ(cfg->request_line); + + if (!dmadev->dmamux) + chan->chan_reg.dma_scr |= STM32_DMA_SCR_REQ(cfg->request_line); /* Enable Interrupts */ chan->chan_reg.dma_scr |= STM32_DMA_SCR_TEIE | STM32_DMA_SCR_TCIE; @@ -998,8 +1003,8 @@ static struct dma_chan *stm32_dma_of_xlate(struct of_phandle_args *dma_spec, cfg.stream_config = dma_spec->args[2]; cfg.threshold = dma_spec->args[3]; - if ((cfg.channel_id >= STM32_DMA_MAX_CHANNELS) || - (cfg.request_line >= STM32_DMA_MAX_REQUEST_ID)) { + if ((!dmadev->dmamux && cfg.request_line >= STM32_DMA_MAX_REQUEST_ID) || + (cfg.channel_id >= STM32_DMA_MAX_CHANNELS)) { dev_err(dev, "Bad channel and/or request id\n"); return NULL; } @@ -1058,6 +1063,8 @@ static int stm32_dma_probe(struct platform_device *pdev) dmadev->mem2mem = of_property_read_bool(pdev->dev.of_node, "st,mem2mem"); + dmadev->dmamux = of_property_read_bool(pdev->dev.of_node, "st,dmamux"); + dmadev->rst = devm_reset_control_get(&pdev->dev, NULL); if (!IS_ERR(dmadev->rst)) { reset_control_assert(dmadev->rst);