From patchwork Thu May 2 10:49:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 16583 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f199.google.com (mail-ob0-f199.google.com [209.85.214.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2F139238EC for ; Thu, 2 May 2013 10:50:21 +0000 (UTC) Received: by mail-ob0-f199.google.com with SMTP id 16sf2557119obc.10 for ; Thu, 02 May 2013 03:50:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-beenthere:x-received:received-spf :x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=P2wpC+7Mf3icQhshV6+FFuuCHiYWb3/Dnw9yfXFKFyc=; b=DXh0blXqXnpstvLB/XNzED6/IPd8Fh7x6YiXBvNYNQYZ5oxThUjLyHRiz6PWp3GXC6 k5PKCTr8AcxN5cUUaHrGTjiS301UamGM+QTqP65Xb/nhhlN1etUxJoPBq8iLqnlEX41J WZQZG2F/Gt8J/0jtM8n+9yYb44JIOKwrKCdH9V5w/Tzncp5K9u3w29TQ1WboDqzydtsv aJLAvk7JHKr1MxmkHe6aVi1Oz+vi8m8fkIdJiSJnVE5h2aLF4UvT5RFeSI4JmJhkPYqb XScYaoAvKYEVA/t6Z0vzCS3grsaBL2W00FcbsHIvoCJnV1eXA1JWfsbP7GMGokVHFI8y wvzA== X-Received: by 10.182.61.4 with SMTP id l4mr5148753obr.9.1367491813582; Thu, 02 May 2013 03:50:13 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.73.39 with SMTP id i7ls1219977qev.48.gmail; Thu, 02 May 2013 03:50:13 -0700 (PDT) X-Received: by 10.58.188.82 with SMTP id fy18mr1950732vec.41.1367491813324; Thu, 02 May 2013 03:50:13 -0700 (PDT) Received: from mail-ve0-x22c.google.com (mail-ve0-x22c.google.com [2607:f8b0:400c:c01::22c]) by mx.google.com with ESMTPS id b4si2643333vdw.135.2013.05.02.03.50.13 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 02 May 2013 03:50:13 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::22c is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c01::22c; Received: by mail-ve0-f172.google.com with SMTP id da11so348606veb.17 for ; Thu, 02 May 2013 03:50:13 -0700 (PDT) X-Received: by 10.220.169.78 with SMTP id x14mr1974558vcy.41.1367491813132; Thu, 02 May 2013 03:50:13 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.127.98 with SMTP id nf2csp195693veb; Thu, 2 May 2013 03:50:12 -0700 (PDT) X-Received: by 10.194.143.50 with SMTP id sb18mr7038010wjb.44.1367491812138; Thu, 02 May 2013 03:50:12 -0700 (PDT) Received: from mail-we0-x22d.google.com (mail-we0-x22d.google.com [2a00:1450:400c:c03::22d]) by mx.google.com with ESMTPS id m9si1784752wjx.253.2013.05.02.03.50.11 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 02 May 2013 03:50:12 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c03::22d is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=2a00:1450:400c:c03::22d; Received: by mail-we0-f173.google.com with SMTP id r3so344917wey.4 for ; Thu, 02 May 2013 03:50:11 -0700 (PDT) X-Received: by 10.180.86.38 with SMTP id m6mr12025273wiz.25.1367491811706; Thu, 02 May 2013 03:50:11 -0700 (PDT) Received: from localhost.localdomain (cpc34-aztw25-2-0-cust250.18-1.cable.virginmedia.com. [86.16.136.251]) by mx.google.com with ESMTPSA id x13sm9665546wib.3.2013.05.02.03.50.10 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 02 May 2013 03:50:10 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: arnd@arndb.de, linus.walleij@stericsson.com, srinidhi.kasagar@stericsson.com, Lee Jones , Herbert Xu , "David S. Miller" , Andreas Westin , linux-crypto@vger.kernel.org Subject: [PATCH 5/8] crypto: ux500/cryp - Set DMA configuration though dma_slave_config() Date: Thu, 2 May 2013 11:49:47 +0100 Message-Id: <1367491790-9727-6-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1367491790-9727-1-git-send-email-lee.jones@linaro.org> References: <1367491790-9727-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQmIl7eqOxXGoXBKORJpw3NQbGMhhA2Osu2YqPMCaTHkBRjk4pzl7zU32KQ6OccSdFGip2/x X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::22c is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The DMA controller currently takes configuration information from information passed though dma_channel_request(), but it shouldn't. Using the API, the DMA channel should only be configured during a dma_slave_config() call. Cc: Herbert Xu Cc: David S. Miller Cc: Andreas Westin Cc: linux-crypto@vger.kernel.org Acked-by: Arnd Bergmann Acked-by: Linus Walleij Signed-off-by: Lee Jones --- drivers/crypto/ux500/cryp/cryp.h | 7 ++++++- drivers/crypto/ux500/cryp/cryp_core.c | 17 +++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/ux500/cryp/cryp.h b/drivers/crypto/ux500/cryp/cryp.h index 14cfd05..d1d6606 100644 --- a/drivers/crypto/ux500/cryp/cryp.h +++ b/drivers/crypto/ux500/cryp/cryp.h @@ -114,6 +114,9 @@ enum cryp_status_id { }; /* Cryp DMA interface */ +#define CRYP_DMA_TX_FIFO 0x08 +#define CRYP_DMA_RX_FIFO 0x10 + enum cryp_dma_req_type { CRYP_DMA_DISABLE_BOTH, CRYP_DMA_ENABLE_IN_DATA, @@ -217,7 +220,8 @@ struct cryp_dma { /** * struct cryp_device_data - structure for a cryp device. - * @base: Pointer to the hardware base address. + * @base: Pointer to virtual base address of the cryp device. + * @phybase: Pointer to physical memory location of the cryp device. * @dev: Pointer to the devices dev structure. * @clk: Pointer to the device's clock control. * @pwr_regulator: Pointer to the device's power control. @@ -232,6 +236,7 @@ struct cryp_dma { */ struct cryp_device_data { struct cryp_register __iomem *base; + phys_addr_t phybase; struct device *dev; struct clk *clk; struct regulator *pwr_regulator; diff --git a/drivers/crypto/ux500/cryp/cryp_core.c b/drivers/crypto/ux500/cryp/cryp_core.c index bf78d60..4b90493 100644 --- a/drivers/crypto/ux500/cryp/cryp_core.c +++ b/drivers/crypto/ux500/cryp/cryp_core.c @@ -476,6 +476,19 @@ static int cryp_get_device_data(struct cryp_ctx *ctx, static void cryp_dma_setup_channel(struct cryp_device_data *device_data, struct device *dev) { + struct dma_slave_config mem2cryp = { + .direction = DMA_MEM_TO_DEV, + .dst_addr = device_data->phybase + CRYP_DMA_TX_FIFO, + .dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES, + .dst_maxburst = 4, + }; + struct dma_slave_config cryp2mem = { + .direction = DMA_DEV_TO_MEM, + .src_addr = device_data->phybase + CRYP_DMA_RX_FIFO, + .src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES, + .src_maxburst = 4, + }; + dma_cap_zero(device_data->dma.mask); dma_cap_set(DMA_SLAVE, device_data->dma.mask); @@ -491,6 +504,9 @@ static void cryp_dma_setup_channel(struct cryp_device_data *device_data, stedma40_filter, device_data->dma.cfg_cryp2mem); + dmaengine_slave_config(device_data->dma.chan_mem2cryp, &mem2cryp); + dmaengine_slave_config(device_data->dma.chan_cryp2mem, &cryp2mem); + init_completion(&device_data->dma.cryp_dma_complete); } @@ -1432,6 +1448,7 @@ static int ux500_cryp_probe(struct platform_device *pdev) goto out_kfree; } + device_data->phybase = res->start; device_data->base = ioremap(res->start, resource_size(res)); if (!device_data->base) { dev_err(dev, "[%s]: ioremap failed!", __func__);