From patchwork Thu May 2 10:49:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 16580 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ea0-f199.google.com (mail-ea0-f199.google.com [209.85.215.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 19605238EC for ; Thu, 2 May 2013 10:50:17 +0000 (UTC) Received: by mail-ea0-f199.google.com with SMTP id q10sf669777eaj.2 for ; Thu, 02 May 2013 03:50:09 -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=zueEh5wRQRJvOtFvz3GTXBGCNMeVpi0pH4+JTpu+nuY=; b=IaXkdNEz9Gv2lrrW11Ioi17v388qVJqaanjs40iCox1SDkznpo980TZb4eGPjRBMEZ D12hEHJhmZ1Duto9PZJ4UnwZ//CORfZa65Jl0mVDK2HMeSkHYRJAHGzYwLH5ZtYCCFgu p1kaFkuHoWQ2vOBiUOBVlogZUNHCD/E8W2PGhspbEy5Jrcz96MEbPjVGuZWeSg6FHdxx lSx6/nDVTnB0nUgfjU439JPm17DjIoiJ3P/gF+sQor0MK9HhNxFlPkKs/lkivkRdu/rY 5IFrkU9CxuNDEhpTzVhT3VkPjQTSTQDsoh4jjy+3ClpreJ8umXFXMFR9rOslfSARPQPM nL1A== X-Received: by 10.180.212.113 with SMTP id nj17mr7720082wic.7.1367491809023; Thu, 02 May 2013 03:50:09 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.180.211.73 with SMTP id na9ls714853wic.15.gmail; Thu, 02 May 2013 03:50:08 -0700 (PDT) X-Received: by 10.194.104.168 with SMTP id gf8mr7010983wjb.58.1367491808863; Thu, 02 May 2013 03:50:08 -0700 (PDT) Received: from mail-ve0-x232.google.com (mail-ve0-x232.google.com [2607:f8b0:400c:c01::232]) by mx.google.com with ESMTPS id f3si1791810wjy.206.2013.05.02.03.50.08 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 02 May 2013 03:50:08 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::232 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::232; Received: by mail-ve0-f178.google.com with SMTP id jy13so351196veb.9 for ; Thu, 02 May 2013 03:50:07 -0700 (PDT) X-Received: by 10.58.144.231 with SMTP id sp7mr1970556veb.34.1367491807795; Thu, 02 May 2013 03:50:07 -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 nf2csp195688veb; Thu, 2 May 2013 03:50:07 -0700 (PDT) X-Received: by 10.194.123.168 with SMTP id mb8mr7132131wjb.24.1367491806794; Thu, 02 May 2013 03:50:06 -0700 (PDT) Received: from mail-wg0-x231.google.com (mail-wg0-x231.google.com [2a00:1450:400c:c00::231]) by mx.google.com with ESMTPS id by16si1809865wjb.63.2013.05.02.03.50.06 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 02 May 2013 03:50:06 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c00::231 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=2a00:1450:400c:c00::231; Received: by mail-wg0-f49.google.com with SMTP id j13so434580wgh.16 for ; Thu, 02 May 2013 03:50:06 -0700 (PDT) X-Received: by 10.194.122.166 with SMTP id lt6mr7120304wjb.14.1367491806370; Thu, 02 May 2013 03:50:06 -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.04 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 02 May 2013 03:50:05 -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 2/8] crypto: ux500/hash - Set DMA configuration though dma_slave_config() Date: Thu, 2 May 2013 11:49:44 +0100 Message-Id: <1367491790-9727-3-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: ALoCoQn0oOvCjgbmMF6fVfbxmuFVOw4G4mGzU06JheggTR/Qj74cGS06GbBC2OFn8xC/nBE8bRpI X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::232 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 Signed-off-by: Lee Jones --- drivers/crypto/ux500/hash/hash_alg.h | 5 ++++- drivers/crypto/ux500/hash/hash_core.c | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/ux500/hash/hash_alg.h b/drivers/crypto/ux500/hash/hash_alg.h index cd9351c..be6eb54 100644 --- a/drivers/crypto/ux500/hash/hash_alg.h +++ b/drivers/crypto/ux500/hash/hash_alg.h @@ -11,6 +11,7 @@ #include #define HASH_BLOCK_SIZE 64 +#define HASH_DMA_FIFO 4 #define HASH_DMA_ALIGN_SIZE 4 #define HASH_DMA_PERFORMANCE_MIN_SIZE 1024 #define HASH_BYTES_PER_WORD 4 @@ -347,7 +348,8 @@ struct hash_req_ctx { /** * struct hash_device_data - structure for a hash device. - * @base: Pointer to the hardware base address. + * @base: Pointer to virtual base address of the hash device. + * @phybase: Pointer to physical memory location of the hash device. * @list_node: For inclusion in klist. * @dev: Pointer to the device dev structure. * @ctx_lock: Spinlock for current_ctx. @@ -361,6 +363,7 @@ struct hash_req_ctx { */ struct hash_device_data { struct hash_register __iomem *base; + phys_addr_t phybase; struct klist_node list_node; struct device *dev; struct spinlock ctx_lock; diff --git a/drivers/crypto/ux500/hash/hash_core.c b/drivers/crypto/ux500/hash/hash_core.c index 1e8b2f3..5d8a7f3 100644 --- a/drivers/crypto/ux500/hash/hash_core.c +++ b/drivers/crypto/ux500/hash/hash_core.c @@ -123,6 +123,13 @@ static void hash_dma_setup_channel(struct hash_device_data *device_data, struct device *dev) { struct hash_platform_data *platform_data = dev->platform_data; + struct dma_slave_config conf = { + .direction = DMA_MEM_TO_DEV, + .dst_addr = device_data->phybase + HASH_DMA_FIFO, + .dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES, + .dst_maxburst = 16, + }; + dma_cap_zero(device_data->dma.mask); dma_cap_set(DMA_SLAVE, device_data->dma.mask); @@ -132,6 +139,8 @@ static void hash_dma_setup_channel(struct hash_device_data *device_data, platform_data->dma_filter, device_data->dma.cfg_mem2hash); + dmaengine_slave_config(device_data->dma.chan_mem2hash, &conf); + init_completion(&device_data->dma.complete); } @@ -1700,6 +1709,7 @@ static int ux500_hash_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!",