From patchwork Tue Jul 15 10:51:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 4553071 X-Patchwork-Delegate: vinod.koul@intel.com Return-Path: X-Original-To: patchwork-dmaengine@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 56B3F9F463 for ; Tue, 15 Jul 2014 10:51:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 644DE20155 for ; Tue, 15 Jul 2014 10:51:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6D88B2012D for ; Tue, 15 Jul 2014 10:51:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758685AbaGOKvZ (ORCPT ); Tue, 15 Jul 2014 06:51:25 -0400 Received: from kirsty.vergenet.net ([202.4.237.240]:51392 "EHLO kirsty.vergenet.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758651AbaGOKvW (ORCPT ); Tue, 15 Jul 2014 06:51:22 -0400 Received: from ayumi.isobedori.kobe.vergenet.net (p8205-ipbfp1004kobeminato.hyogo.ocn.ne.jp [118.10.146.205]) by kirsty.vergenet.net (Postfix) with ESMTP id 74D4425BE67; Tue, 15 Jul 2014 20:51:17 +1000 (EST) Received: by ayumi.isobedori.kobe.vergenet.net (Postfix, from userid 7100) id E48DFEDE5CF; Tue, 15 Jul 2014 19:51:15 +0900 (JST) From: Simon Horman To: Vinod Koul Cc: dmaengine@vger.kernel.org, linux-sh@vger.kernel.org, Magnus Damm , Kuninori Morimoto , Simon Horman Subject: [PATCH 1/3] dma: rcar-audmapp: enable .set_slave Date: Tue, 15 Jul 2014 19:51:06 +0900 Message-Id: <016b10f4ea76ba2189d476b4a5f7168e57a8d7ad.1405401560.git.horms+renesas@verge.net.au> X-Mailer: git-send-email 2.0.0 In-Reply-To: References: In-Reply-To: References: Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Kuninori Morimoto Current .set_slave callback did nothing, since it assumed src/dst address come from platform settings. But, it isn't good match to DT probing. This patch enables .set_slave callback to this issue. Signed-off-by: Kuninori Morimoto Signed-off-by: Simon Horman --- drivers/dma/sh/rcar-audmapp.c | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/drivers/dma/sh/rcar-audmapp.c b/drivers/dma/sh/rcar-audmapp.c index 2de7728..858483b 100644 --- a/drivers/dma/sh/rcar-audmapp.c +++ b/drivers/dma/sh/rcar-audmapp.c @@ -47,6 +47,7 @@ struct audmapp_chan { struct shdma_chan shdma_chan; struct audmapp_slave_config *config; void __iomem *base; + dma_addr_t slave_addr; }; struct audmapp_device { @@ -56,7 +57,14 @@ struct audmapp_device { void __iomem *chan_reg; }; +struct audmapp_desc { + struct shdma_desc shdma_desc; + dma_addr_t src; + dma_addr_t dst; +}; + #define to_chan(chan) container_of(chan, struct audmapp_chan, shdma_chan) +#define to_desc(sdesc) container_of(sdesc, struct audmapp_desc, shdma_desc) #define to_dev(chan) container_of(chan->shdma_chan.dma_chan.device, \ struct audmapp_device, shdma_dev.dma_dev) @@ -90,19 +98,20 @@ static void audmapp_halt(struct shdma_chan *schan) } static void audmapp_start_xfer(struct shdma_chan *schan, - struct shdma_desc *sdecs) + struct shdma_desc *sdesc) { struct audmapp_chan *auchan = to_chan(schan); struct audmapp_device *audev = to_dev(auchan); + struct audmapp_desc *desc = to_desc(sdesc); struct audmapp_slave_config *cfg = auchan->config; struct device *dev = audev->dev; u32 chcr = cfg->chcr | PDMACHCR_DE; - dev_dbg(dev, "src/dst/chcr = %pad/%pad/%x\n", - &cfg->src, &cfg->dst, cfg->chcr); + dev_dbg(dev, "src/dst/chcr = %pad/%pad/%08x\n", + &desc->src, &desc->dst, chcr); - audmapp_write(auchan, cfg->src, PDMASAR); - audmapp_write(auchan, cfg->dst, PDMADAR); + audmapp_write(auchan, desc->src, PDMASAR); + audmapp_write(auchan, desc->dst, PDMADAR); audmapp_write(auchan, chcr, PDMACHCR); } @@ -137,14 +146,16 @@ static int audmapp_set_slave(struct shdma_chan *schan, int slave_id, return 0; auchan->config = cfg; + auchan->slave_addr = slave_addr ? : cfg->dst; return 0; } static int audmapp_desc_setup(struct shdma_chan *schan, - struct shdma_desc *sdecs, + struct shdma_desc *sdesc, dma_addr_t src, dma_addr_t dst, size_t *len) { + struct audmapp_desc *desc = to_desc(sdesc); struct audmapp_chan *auchan = to_chan(schan); struct audmapp_slave_config *cfg = auchan->config; @@ -154,6 +165,9 @@ static int audmapp_desc_setup(struct shdma_chan *schan, if (*len > (size_t)AUDMAPP_LEN_MAX) *len = (size_t)AUDMAPP_LEN_MAX; + desc->src = src; + desc->dst = dst; + return 0; } @@ -164,7 +178,9 @@ static void audmapp_setup_xfer(struct shdma_chan *schan, static dma_addr_t audmapp_slave_addr(struct shdma_chan *schan) { - return 0; /* always fixed address */ + struct audmapp_chan *auchan = to_chan(schan); + + return auchan->slave_addr; } static bool audmapp_channel_busy(struct shdma_chan *schan) @@ -183,7 +199,7 @@ static bool audmapp_desc_completed(struct shdma_chan *schan, static struct shdma_desc *audmapp_embedded_desc(void *buf, int i) { - return &((struct shdma_desc *)buf)[i]; + return &((struct audmapp_desc *)buf)[i].shdma_desc; } static const struct shdma_ops audmapp_shdma_ops = { @@ -260,7 +276,7 @@ static int audmapp_probe(struct platform_device *pdev) sdev = &audev->shdma_dev; sdev->ops = &audmapp_shdma_ops; - sdev->desc_size = sizeof(struct shdma_desc); + sdev->desc_size = sizeof(struct audmapp_desc); dma_dev = &sdev->dma_dev; dma_dev->copy_align = LOG2_DEFAULT_XFER_SIZE;