From patchwork Thu Apr 18 10:27:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 16227 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f69.google.com (mail-vb0-f69.google.com [209.85.212.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2D97C23974 for ; Thu, 18 Apr 2013 10:28:18 +0000 (UTC) Received: by mail-vb0-f69.google.com with SMTP id p12sf4399807vbe.0 for ; Thu, 18 Apr 2013 03:27:41 -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=qj2bRRZQWJn1SBOkZwWNRB1/njFybsTL6pBmZb+kuZ0=; b=WBYwrZ4Ri7LoP/LwxK93YxJFUeOBTKLAJ+6WH6XsW2nLKPyxHy/r8W3RMjH0P5YJB2 /AxL4/3cATUF3BkD2bvrd8DktuQaJ5DESuDlv2r72n0CKZBgRDEBkJglNNS9SDcE43GN rP5jfi4f26aHIFVM6tApyRO4J4MXrPgyD3PBWjHBnoK8fbzfSiKa+MMM26d6i7g1oIoH VH8CpznWSTnJXj3qQccoiPbzHlVnbMCrizPFeqZ1IrKjomyc712HVN32DH+UbRjLAkAb egM95lWrLACyty/torEowSyrvXpFMG/kPz8yL59s6GGbcg9GZx36U2aVjRv8lPDxc+dV UAug== X-Received: by 10.58.145.38 with SMTP id sr6mr4342789veb.15.1366280861053; Thu, 18 Apr 2013 03:27:41 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.0.174 with SMTP id 14ls1388495qef.44.gmail; Thu, 18 Apr 2013 03:27:40 -0700 (PDT) X-Received: by 10.220.150.74 with SMTP id x10mr7750952vcv.68.1366280860918; Thu, 18 Apr 2013 03:27:40 -0700 (PDT) Received: from mail-vb0-x230.google.com (mail-vb0-x230.google.com [2607:f8b0:400c:c02::230]) by mx.google.com with ESMTPS id bs2si5623519veb.5.2013.04.18.03.27.40 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 18 Apr 2013 03:27:40 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::230 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:c02::230; Received: by mail-vb0-f48.google.com with SMTP id p13so2170867vbe.35 for ; Thu, 18 Apr 2013 03:27:40 -0700 (PDT) X-Received: by 10.52.228.71 with SMTP id sg7mr6375543vdc.51.1366280860780; Thu, 18 Apr 2013 03:27:40 -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 nf2csp116333veb; Thu, 18 Apr 2013 03:27:40 -0700 (PDT) X-Received: by 10.180.97.132 with SMTP id ea4mr17042793wib.23.1366280859618; Thu, 18 Apr 2013 03:27:39 -0700 (PDT) Received: from mail-we0-x22b.google.com (mail-we0-x22b.google.com [2a00:1450:400c:c03::22b]) by mx.google.com with ESMTPS id fu6si3445438wjb.138.2013.04.18.03.27.39 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 18 Apr 2013 03:27:39 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c03::22b is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=2a00:1450:400c:c03::22b; Received: by mail-we0-f171.google.com with SMTP id i48so2060067wef.2 for ; Thu, 18 Apr 2013 03:27:39 -0700 (PDT) X-Received: by 10.194.133.198 with SMTP id pe6mr17580431wjb.9.1366280859215; Thu, 18 Apr 2013 03:27:39 -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 ESMTPS id o5sm15168504wix.3.2013.04.18.03.27.37 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 18 Apr 2013 03:27:38 -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, Lee Jones , Herbert Xu , "David S. Miller" , Andreas Westin , linux-crypto@vger.kernel.org Subject: [PATCH 6/9] crypto: ux500/cryp - Set DMA configuration though dma_slave_config() Date: Thu, 18 Apr 2013 11:27:02 +0100 Message-Id: <1366280825-31136-7-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1366280825-31136-1-git-send-email-lee.jones@linaro.org> References: <1366280825-31136-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQnUQCPIGdGygIr8Dp/M4BcS+jKj9FgvjdawjFCEmi7n/WZGS3D2cOGuzI9QFjDeksk5v+iS X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::230 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 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..49b2095 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 HASH_DMA_TX_FIFO 0x08 +#define HASH_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 444deaf..6c4f872 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 + HASH_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 + HASH_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__);