From patchwork Thu Nov 21 10:16:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 179923 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp3375172ilf; Thu, 21 Nov 2019 02:16:25 -0800 (PST) X-Google-Smtp-Source: APXvYqz//OJZasY4b2vob9cTvOSFDzfDm6rgrw4HBRP6O2oWNe6NuDbJfVUElWdli7rzoLTmcTM+ X-Received: by 2002:a17:906:3710:: with SMTP id d16mr12985769ejc.132.1574331385178; Thu, 21 Nov 2019 02:16:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574331385; cv=none; d=google.com; s=arc-20160816; b=H5GGzNRMwTXeSH4gvFlLXUbxJ4pCVzR9Y2Gc8k7a9AkjxbSI7RjDsjNvsdWMqsR+IG Gi0K5MGOWdGHqONd0pOD/1mf2OGSTqslzpiEnXxi7q9Ahbei3eHnCnD4nnreynSmqMbb 2pmOCFKr0/Rwd/Jh8SNQXevNaby653KEyzmqbsyISF6Ut36CO58UTPJ7Xqx2pbB2BSfF wqPQEuilC8YPZXcghMpsbt512AIkdRHmJ+L4d3pDiUWJbEgJje8dbjNbfcqUYb/LbUWT rCFdS2WwAw+Rwgo+Y8gGSK8TeH+uj1H/4LnkEOhBjkbqt9Oh2j51EghTGXuznouMbNcG Hu7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=XnVgtIGZIbTs/l5ZJ/zrcJQ2aeyG9tflJUgP5IVOAAQ=; b=M9zTbvNV+RCf95mNWiagh9F3AlXnRCQDLIceb7czt+7yUbUN6NQg+deNn/bnQ/0e/p ODh4RbSHUdB1Owm5F61DAP6nuIk+x8EyJg9L6PI3F2k2NkSLgFYKb6nmB9VUlng+I5Zq 4vQA+8NCiimKUp7/bQT8AByHmZRQq19i+9k9NW9UyVvvuHuI9RiLRHriK7c/PWIoZv8r XDjE5j7CjifdbM5nad36joC7St97fn3Nu3oq5r3whspGd/uphmUfNyRCRGjOholr5i08 hCPUx97IK3MMJS+B0mUmv21P3gsdKHMIu4eACNPrOe6iJbh1SBpp9ggagbPUtdwI7HHn 0vEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=s3lSlrmL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f21si1267910ede.253.2019.11.21.02.16.24; Thu, 21 Nov 2019 02:16:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=s3lSlrmL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727104AbfKUKQX (ORCPT + 26 others); Thu, 21 Nov 2019 05:16:23 -0500 Received: from lelv0143.ext.ti.com ([198.47.23.248]:39814 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726132AbfKUKQU (ORCPT ); Thu, 21 Nov 2019 05:16:20 -0500 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id xALAG9EA088314; Thu, 21 Nov 2019 04:16:09 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1574331369; bh=XnVgtIGZIbTs/l5ZJ/zrcJQ2aeyG9tflJUgP5IVOAAQ=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=s3lSlrmLeVGp/iGr5GEC3Gj8QRQESu7/ZJSbhrsVlrlzNWHGxe8Gi5cfy0A9HAWjy +2U9596E6gyv4xQxZPGQ4oS1g2wr3cA99JDoA6zGI6R1hFy5LJXmQB/8GKEkkPMM0S AO/AU2CQUfVas4/08myLQmhN/y5GTKPD2N9suXe4= Received: from DFLE103.ent.ti.com (dfle103.ent.ti.com [10.64.6.24]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id xALAG81b010703 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 21 Nov 2019 04:16:09 -0600 Received: from DFLE115.ent.ti.com (10.64.6.36) by DFLE103.ent.ti.com (10.64.6.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Thu, 21 Nov 2019 04:16:08 -0600 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3 via Frontend Transport; Thu, 21 Nov 2019 04:16:08 -0600 Received: from feketebors.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id xALAG3b5105173; Thu, 21 Nov 2019 04:16:06 -0600 From: Peter Ujfalusi To: , , , , CC: , , , Subject: [PATCH v2 1/3] crypto: atmel-aes - Retire dma_request_slave_channel_compat() Date: Thu, 21 Nov 2019 12:16:00 +0200 Message-ID: <20191121101602.21941-2-peter.ujfalusi@ti.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191121101602.21941-1-peter.ujfalusi@ti.com> References: <20191121101602.21941-1-peter.ujfalusi@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The driver no longer boots in legacy mode, only via DT. This makes the dma_request_slave_channel_compat() redundant. If ever the filter function would be executed it will return false as the dma_slave is not really initialized. Switch to use dma_request_chan() which would allow legacy boot if ever needed again by configuring dma_slave_map for the DMA driver. At the same time skip allocating memory for dma_slave as it is not used anymore. Signed-off-by: Peter Ujfalusi --- drivers/crypto/atmel-aes.c | 50 ++++++++------------------------------ 1 file changed, 10 insertions(+), 40 deletions(-) -- Peter Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki diff --git a/drivers/crypto/atmel-aes.c b/drivers/crypto/atmel-aes.c index 3c88c164c3dc..30c41598fa2a 100644 --- a/drivers/crypto/atmel-aes.c +++ b/drivers/crypto/atmel-aes.c @@ -38,7 +38,6 @@ #include #include #include -#include #include "atmel-aes-regs.h" #include "atmel-authenc.h" @@ -2364,39 +2363,23 @@ static void atmel_aes_buff_cleanup(struct atmel_aes_dev *dd) free_page((unsigned long)dd->buf); } -static bool atmel_aes_filter(struct dma_chan *chan, void *slave) -{ - struct at_dma_slave *sl = slave; - - if (sl && sl->dma_dev == chan->device->dev) { - chan->private = sl; - return true; - } else { - return false; - } -} - static int atmel_aes_dma_init(struct atmel_aes_dev *dd, struct crypto_platform_data *pdata) { - struct at_dma_slave *slave; - dma_cap_mask_t mask; - - dma_cap_zero(mask); - dma_cap_set(DMA_SLAVE, mask); + int ret; /* Try to grab 2 DMA channels */ - slave = &pdata->dma_slave->rxdata; - dd->src.chan = dma_request_slave_channel_compat(mask, atmel_aes_filter, - slave, dd->dev, "tx"); - if (!dd->src.chan) + dd->src.chan = dma_request_chan(dd->dev, "tx"); + if (IS_ERR(dd->src.chan)) { + ret = PTR_ERR(dd->src.chan); goto err_dma_in; + } - slave = &pdata->dma_slave->txdata; - dd->dst.chan = dma_request_slave_channel_compat(mask, atmel_aes_filter, - slave, dd->dev, "rx"); - if (!dd->dst.chan) + dd->dst.chan = dma_request_chan(dd->dev, "rx"); + if (IS_ERR(dd->dst.chan)) { + ret = PTR_ERR(dd->dst.chan); goto err_dma_out; + } return 0; @@ -2404,7 +2387,7 @@ static int atmel_aes_dma_init(struct atmel_aes_dev *dd, dma_release_channel(dd->src.chan); err_dma_in: dev_warn(dd->dev, "no DMA channel available\n"); - return -ENODEV; + return ret; } static void atmel_aes_dma_cleanup(struct atmel_aes_dev *dd) @@ -2592,14 +2575,6 @@ static struct crypto_platform_data *atmel_aes_of_init(struct platform_device *pd if (!pdata) return ERR_PTR(-ENOMEM); - pdata->dma_slave = devm_kzalloc(&pdev->dev, - sizeof(*(pdata->dma_slave)), - GFP_KERNEL); - if (!pdata->dma_slave) { - devm_kfree(&pdev->dev, pdata); - return ERR_PTR(-ENOMEM); - } - return pdata; } #else @@ -2626,11 +2601,6 @@ static int atmel_aes_probe(struct platform_device *pdev) } } - if (!pdata->dma_slave) { - err = -ENXIO; - goto aes_dd_err; - } - aes_dd = devm_kzalloc(&pdev->dev, sizeof(*aes_dd), GFP_KERNEL); if (aes_dd == NULL) { err = -ENOMEM; From patchwork Thu Nov 21 10:16:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 179925 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp3375301ilf; Thu, 21 Nov 2019 02:16:32 -0800 (PST) X-Google-Smtp-Source: APXvYqwcvpDuNQwIIlxSEa7kurBuZxNimOFRx+L+zVVR+xlZxJ5FTNozwa0fZAOorQzVyt/q4hFW X-Received: by 2002:a05:651c:1066:: with SMTP id y6mr6849124ljm.96.1574331392461; Thu, 21 Nov 2019 02:16:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574331392; cv=none; d=google.com; s=arc-20160816; b=ybP1KMaw6riRiOg+EDCKQEmStw0c58upOd5rJ/zkxqDNejW+k16e4djWTDwVvkM6NF DfgYeEcHWOH6W0RnDX89uYy2qrEUJTmJcbO+ABZeBb5aaCo/9c5l8H12DwTSrhcpA5xk aELs/Ip4/7rdqUj5G/Nsg+m+JL8/4LBWFwPm1nI9AnBWbJlR3T8dXBhslf/4osCq5MnN inkwSpa0PP33Aebq/3avmuZ+Q7LF5zXsgIs6AskHMsfqL9UtF5OugrntwBVEVP7tFkxS bLzZI5IL1Uzr0R63K74COIIN9Su8rqYFCJc9T9W0rCGMQuDoGwak9eIDz3jsHWU/OyjQ BQcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=EeSIzZP6KADvh/f9LO5V0lquKd/w+xeZwK/dgc5hXNE=; b=J+3qu4RGH5d+pw/JgJgRkLwumDJV0hDKeHkry6gg3er9JmBmgeiauN8AiSJBaXjsaC mlXLCE2ef2Fr45DmSLOHARJY9lXbwW4k6M6ZK6lwKWAT4OGbDD/W9ZSySkXuCwcpjpmp 8IvUQ1/6QuXIWcV1XWbHb/ff729iWB2IxAf5vEh6OwuAJbOgYcjwEeJVUY+uD6ilNNa2 Q9HRuFJG0lUVomMH0HW1PnOGwSadQHInQdMWL42QKKYKuD5fZTjk+u+Qr3z04ASgzAI/ Yr4diAWObdptYo+BqZhUkJCZFTnoGcOTNQJ1PjFgHNUbHPSPQTBuwO5JiFuQBHh2Tem+ 7IQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=AqW9t2yj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v16si1977319edc.142.2019.11.21.02.16.32; Thu, 21 Nov 2019 02:16:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=AqW9t2yj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727166AbfKUKQ3 (ORCPT + 26 others); Thu, 21 Nov 2019 05:16:29 -0500 Received: from fllv0015.ext.ti.com ([198.47.19.141]:33384 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727125AbfKUKQ1 (ORCPT ); Thu, 21 Nov 2019 05:16:27 -0500 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id xALAGEIi026633; Thu, 21 Nov 2019 04:16:14 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1574331374; bh=EeSIzZP6KADvh/f9LO5V0lquKd/w+xeZwK/dgc5hXNE=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=AqW9t2yjijXuUy2mcWi28Ldp2oswwej1CG0cB5ACOJngz+xK07GTKQT2NEdAIqral PDdOh3Y+wn03XMf1tDuDpnN9/vl2Jb+els2MJOi2qVb3IjQUbJeFPw1MMowVFOgi8p 1k5p7fs1byhnPBUCuTPYtIBuKmssMDp8r7Lj44e0= Received: from DLEE107.ent.ti.com (dlee107.ent.ti.com [157.170.170.37]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id xALAGExM019076 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 21 Nov 2019 04:16:14 -0600 Received: from DLEE115.ent.ti.com (157.170.170.26) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Thu, 21 Nov 2019 04:16:14 -0600 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3 via Frontend Transport; Thu, 21 Nov 2019 04:16:13 -0600 Received: from feketebors.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id xALAG3b7105173; Thu, 21 Nov 2019 04:16:11 -0600 From: Peter Ujfalusi To: , , , , CC: , , , Subject: [PATCH v2 3/3] crypto: atmel-tdes - Retire dma_request_slave_channel_compat() Date: Thu, 21 Nov 2019 12:16:02 +0200 Message-ID: <20191121101602.21941-4-peter.ujfalusi@ti.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191121101602.21941-1-peter.ujfalusi@ti.com> References: <20191121101602.21941-1-peter.ujfalusi@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The driver no longer boots in legacy mode, only via DT. This makes the dma_request_slave_channel_compat() redundant. If ever the filter function would be executed it will return false as the dma_slave is not really initialized. Switch to use dma_request_chan() which would allow legacy boot if ever needed again by configuring dma_slave_map for the DMA driver. At the same time skip allocating memory for dma_slave as it is not used anymore. Signed-off-by: Peter Ujfalusi --- drivers/crypto/atmel-tdes.c | 47 ++++++++++--------------------------- 1 file changed, 13 insertions(+), 34 deletions(-) -- Peter Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki diff --git a/drivers/crypto/atmel-tdes.c b/drivers/crypto/atmel-tdes.c index bb7c0a387c04..fbc76edaef3e 100644 --- a/drivers/crypto/atmel-tdes.c +++ b/drivers/crypto/atmel-tdes.c @@ -703,31 +703,17 @@ static int atmel_tdes_crypt(struct skcipher_request *req, unsigned long mode) return atmel_tdes_handle_queue(ctx->dd, req); } -static bool atmel_tdes_filter(struct dma_chan *chan, void *slave) -{ - struct at_dma_slave *sl = slave; - - if (sl && sl->dma_dev == chan->device->dev) { - chan->private = sl; - return true; - } else { - return false; - } -} - static int atmel_tdes_dma_init(struct atmel_tdes_dev *dd, struct crypto_platform_data *pdata) { - dma_cap_mask_t mask; - - dma_cap_zero(mask); - dma_cap_set(DMA_SLAVE, mask); + int ret; /* Try to grab 2 DMA channels */ - dd->dma_lch_in.chan = dma_request_slave_channel_compat(mask, - atmel_tdes_filter, &pdata->dma_slave->rxdata, dd->dev, "tx"); - if (!dd->dma_lch_in.chan) + dd->dma_lch_in.chan = dma_request_chan(dd->dev, "tx"); + if (IS_ERR(dd->dma_lch_in.chan)) { + ret = PTR_ERR(dd->dma_lch_in.chan); goto err_dma_in; + } dd->dma_lch_in.dma_conf.direction = DMA_MEM_TO_DEV; dd->dma_lch_in.dma_conf.dst_addr = dd->phys_base + @@ -740,10 +726,11 @@ static int atmel_tdes_dma_init(struct atmel_tdes_dev *dd, DMA_SLAVE_BUSWIDTH_4_BYTES; dd->dma_lch_in.dma_conf.device_fc = false; - dd->dma_lch_out.chan = dma_request_slave_channel_compat(mask, - atmel_tdes_filter, &pdata->dma_slave->txdata, dd->dev, "rx"); - if (!dd->dma_lch_out.chan) + dd->dma_lch_out.chan = dma_request_chan(dd->dev, "rx"); + if (IS_ERR(dd->dma_lch_out.chan)) { + ret = PTR_ERR(dd->dma_lch_out.chan); goto err_dma_out; + } dd->dma_lch_out.dma_conf.direction = DMA_DEV_TO_MEM; dd->dma_lch_out.dma_conf.src_addr = dd->phys_base + @@ -761,8 +748,9 @@ static int atmel_tdes_dma_init(struct atmel_tdes_dev *dd, err_dma_out: dma_release_channel(dd->dma_lch_in.chan); err_dma_in: - dev_warn(dd->dev, "no DMA channel available\n"); - return -ENODEV; + if (ret != -EPROBE_DEFER) + dev_warn(dd->dev, "no DMA channel available\n"); + return ret; } static void atmel_tdes_dma_cleanup(struct atmel_tdes_dev *dd) @@ -1193,12 +1181,6 @@ static struct crypto_platform_data *atmel_tdes_of_init(struct platform_device *p if (!pdata) return ERR_PTR(-ENOMEM); - pdata->dma_slave = devm_kzalloc(&pdev->dev, - sizeof(*(pdata->dma_slave)), - GFP_KERNEL); - if (!pdata->dma_slave) - return ERR_PTR(-ENOMEM); - return pdata; } #else /* CONFIG_OF */ @@ -1292,10 +1274,7 @@ static int atmel_tdes_probe(struct platform_device *pdev) goto err_pdata; } } - if (!pdata->dma_slave) { - err = -ENXIO; - goto err_pdata; - } + err = atmel_tdes_dma_init(tdes_dd, pdata); if (err) goto err_tdes_dma;