From patchwork Tue Oct 9 05:47:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 10631947 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 3B67A933 for ; Tue, 9 Oct 2018 05:50:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2A0BD28A41 for ; Tue, 9 Oct 2018 05:50:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1851B28A46; Tue, 9 Oct 2018 05:50:11 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E899428A41 for ; Tue, 9 Oct 2018 05:50:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FUmQ3OONFHt0A+gZOVkuybqXzYVJfCgAPjL3qLfZWho=; b=bc2Czt3U8WKWys HxA37isI87cFibss9dFIN86QIDqJZAcX+jl09Uo6o5jzNFk99yGPt13vVuP5wuF0WWf27baM/9GvU wAlWCx6bF3UiSWtOsUGbXouvbhDaQ9jO44S9J8PWrt1OswJyJfVAu794PS3UkJt5dofKsxXA7RUDQ MhkX0RgQ+ziAXdbJkVen/B8/mK3m37ivPc0JDB7xwHeyVYqm++veSk797j6ZrxcNREc5L/dYEsr2Q CMIQ1Un7fqjotH+5f+aW6/Iaf5kaAYx4ZoZ4IlB8SeubuqEgmtFQjkh9W1FYKsvF+7Gms/cSRriY6 ZFu7vAaDaakUG4vXxciA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g9ku3-0006QJ-Oe; Tue, 09 Oct 2018 05:49:55 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g9ksT-0005jQ-HP for linux-arm-kernel@lists.infradead.org; Tue, 09 Oct 2018 05:48:20 +0000 Received: by mail-pf1-x443.google.com with SMTP id l81-v6so262702pfg.3 for ; Mon, 08 Oct 2018 22:48:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eW4Ce55VjYsIH9MyeML3hQXQKFMbk+C12X1qFn1Si2o=; b=J1OJ/NVro04YDIAp7uO6GxnlBPMf1qK+Ic3H2mdbGT/Kv7P8/1DO7uFd/YM3Xr+TH+ U3UoZYhjaONyVNE0CehGK5Cab0SyxQdG6Ncr1jt5ebuxk+t3nydeOnqrYnQIntIKf8P8 EvqWWmTLjxjo6Zeb070B2LlGwhrrmu5njWm4E= 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:mime-version:content-transfer-encoding; bh=eW4Ce55VjYsIH9MyeML3hQXQKFMbk+C12X1qFn1Si2o=; b=r7klBsGad/p6YBDIchmv7tH4gaFh0ZVug8cmFjK4ImeOgbDJO+Uv5pslCnu8oGh3Sc vTosuGK5pYA9Z9+AfADc77g7OIZuLOv2uOa7RTqepGgFXu0eiZ19ttTFc/BFqv7iof3r S9xTD5n6iHCJ/2msm1RwPyKfTQgi8WAW2JBswJHR94Ctmt96xXjcsb0oR1GnpZ7rOtxq 1k41omvQ82PCRZ9pwVgRzc9Ln1w6S7d9fPHn5atdllYMtAQvTGW1+cfKMlWy/N3XzA4u Qw97A4Jy/4FN2+64kPXPpW8MAdm1bgeci1l5IxSltjDCTbhdwJpEmHNaBD3jjbOGNXhe gcWQ== X-Gm-Message-State: ABuFfohsaoHfZwJBrukuRZVp42Fupwe57wXlBCnh2bSIyCNgiascB+3I JpzEgCt61EbxvuHKVvUsyjjxiQ== X-Google-Smtp-Source: ACcGV63EUVAsXYPZ5xjm8SPgh4vzszjNQFzT/4eUBdu1yH33jc3pRXBDGQ88mZGVAc8WaDgUkHJwlQ== X-Received: by 2002:a63:c5a:: with SMTP id 26-v6mr24278770pgm.372.1539064086528; Mon, 08 Oct 2018 22:48:06 -0700 (PDT) Received: from joelaf.mtv.corp.google.com ([2620:0:1000:1601:3aef:314f:b9ea:889f]) by smtp.gmail.com with ESMTPSA id a15-v6sm16886234pff.8.2018.10.08.22.48.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Oct 2018 22:48:05 -0700 (PDT) From: "Joel Fernandes (Google)" To: stable@vger.kernel.org Subject: [PATCH 1/7] dmaengine: stm32-dma: threshold manages with bitfield feature Date: Mon, 8 Oct 2018 22:47:46 -0700 Message-Id: <20181009054752.145978-2-joel@joelfernandes.org> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog In-Reply-To: <20181009054752.145978-1-joel@joelfernandes.org> References: <20181009054752.145978-1-joel@joelfernandes.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181008_224817_623639_C3125161 X-CRM114-Status: GOOD ( 13.79 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Torgue , Vinod Koul , gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, Pierre Yves MORDRET , "Joel Fernandes \(Google\)" , Maxime Coquelin , dmaengine@vger.kernel.org, Dan Williams , "moderated list:ARM/STM32 ARCHITECTURE" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Pierre Yves MORDRET >From now on, DMA bitfield is to manage DMA FIFO Threshold. Signed-off-by: Pierre-Yves MORDRET Signed-off-by: Vinod Koul --- drivers/dma/stm32-dma.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/dma/stm32-dma.c b/drivers/dma/stm32-dma.c index 786fc8fcc38e..4099948b6914 100644 --- a/drivers/dma/stm32-dma.c +++ b/drivers/dma/stm32-dma.c @@ -116,6 +116,10 @@ #define STM32_DMA_MAX_DATA_PARAM 0x03 #define STM32_DMA_MAX_BURST 16 +/* DMA Features */ +#define STM32_DMA_THRESHOLD_FTR_MASK GENMASK(1, 0) +#define STM32_DMA_THRESHOLD_FTR_GET(n) ((n) & STM32_DMA_THRESHOLD_FTR_MASK) + enum stm32_dma_width { STM32_DMA_BYTE, STM32_DMA_HALF_WORD, @@ -129,11 +133,18 @@ enum stm32_dma_burst_size { STM32_DMA_BURST_INCR16, }; +/** + * struct stm32_dma_cfg - STM32 DMA custom configuration + * @channel_id: channel ID + * @request_line: DMA request + * @stream_config: 32bit mask specifying the DMA channel configuration + * @features: 32bit mask specifying the DMA Feature list + */ struct stm32_dma_cfg { u32 channel_id; u32 request_line; u32 stream_config; - u32 threshold; + u32 features; }; struct stm32_dma_chan_reg { @@ -171,6 +182,7 @@ struct stm32_dma_chan { u32 next_sg; struct dma_slave_config dma_sconfig; struct stm32_dma_chan_reg chan_reg; + u32 threshold; }; struct stm32_dma_device { @@ -976,7 +988,8 @@ static void stm32_dma_set_config(struct stm32_dma_chan *chan, /* Enable Interrupts */ chan->chan_reg.dma_scr |= STM32_DMA_SCR_TEIE | STM32_DMA_SCR_TCIE; - chan->chan_reg.dma_sfcr = cfg->threshold & STM32_DMA_SFCR_FTH_MASK; + chan->threshold = STM32_DMA_THRESHOLD_FTR_GET(cfg->features); + chan->chan_reg.dma_sfcr = STM32_DMA_SFCR_FTH(chan->threshold); } static struct dma_chan *stm32_dma_of_xlate(struct of_phandle_args *dma_spec, @@ -996,7 +1009,7 @@ static struct dma_chan *stm32_dma_of_xlate(struct of_phandle_args *dma_spec, cfg.channel_id = dma_spec->args[0]; cfg.request_line = dma_spec->args[1]; cfg.stream_config = dma_spec->args[2]; - cfg.threshold = dma_spec->args[3]; + cfg.features = dma_spec->args[3]; if ((cfg.channel_id >= STM32_DMA_MAX_CHANNELS) || (cfg.request_line >= STM32_DMA_MAX_REQUEST_ID)) {