aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/layerscape/patches-5.4/804-crypto-0030-crypto-caam-add-functionality-used-by-the-caam_dma-d.patch
diff options
context:
space:
mode:
authorYangbo Lu <yangbo.lu@nxp.com>2020-04-10 10:47:05 +0800
committerPetr Štetiar <ynezz@true.cz>2020-05-07 12:53:06 +0200
commitcddd4591404fb4c53dc0b3c0b15b942cdbed4356 (patch)
tree392c1179de46b0f804e3789edca19069b64e6b44 /target/linux/layerscape/patches-5.4/804-crypto-0030-crypto-caam-add-functionality-used-by-the-caam_dma-d.patch
parentd1d2c0b5579ea4f69a42246c9318539d61ba1999 (diff)
downloadupstream-cddd4591404fb4c53dc0b3c0b15b942cdbed4356.tar.gz
upstream-cddd4591404fb4c53dc0b3c0b15b942cdbed4356.tar.bz2
upstream-cddd4591404fb4c53dc0b3c0b15b942cdbed4356.zip
layerscape: add patches-5.4
Add patches for linux-5.4. The patches are from NXP LSDK-20.04 release which was tagged LSDK-20.04-V5.4. https://source.codeaurora.org/external/qoriq/qoriq-components/linux/ For boards LS1021A-IOT, and Traverse-LS1043 which are not involved in LSDK, port the dts patches from 4.14. The patches are sorted into the following categories: 301-arch-xxxx 302-dts-xxxx 303-core-xxxx 701-net-xxxx 801-audio-xxxx 802-can-xxxx 803-clock-xxxx 804-crypto-xxxx 805-display-xxxx 806-dma-xxxx 807-gpio-xxxx 808-i2c-xxxx 809-jailhouse-xxxx 810-keys-xxxx 811-kvm-xxxx 812-pcie-xxxx 813-pm-xxxx 814-qe-xxxx 815-sata-xxxx 816-sdhc-xxxx 817-spi-xxxx 818-thermal-xxxx 819-uart-xxxx 820-usb-xxxx 821-vfio-xxxx Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Diffstat (limited to 'target/linux/layerscape/patches-5.4/804-crypto-0030-crypto-caam-add-functionality-used-by-the-caam_dma-d.patch')
-rw-r--r--target/linux/layerscape/patches-5.4/804-crypto-0030-crypto-caam-add-functionality-used-by-the-caam_dma-d.patch122
1 files changed, 122 insertions, 0 deletions
diff --git a/target/linux/layerscape/patches-5.4/804-crypto-0030-crypto-caam-add-functionality-used-by-the-caam_dma-d.patch b/target/linux/layerscape/patches-5.4/804-crypto-0030-crypto-caam-add-functionality-used-by-the-caam_dma-d.patch
new file mode 100644
index 0000000000..6e4323987a
--- /dev/null
+++ b/target/linux/layerscape/patches-5.4/804-crypto-0030-crypto-caam-add-functionality-used-by-the-caam_dma-d.patch
@@ -0,0 +1,122 @@
+From 20f552cafd7dda6f5d25128bbc04ea2c91d9f5d1 Mon Sep 17 00:00:00 2001
+From: Radu Alexe <radu.alexe@nxp.com>
+Date: Thu, 26 Oct 2017 10:45:14 +0300
+Subject: [PATCH] crypto: caam - add functionality used by the caam_dma driver
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The caam_dma is a memcpy DMA driver based on the DMA functionality of
+the CAAM hardware block. It creates a DMA channel for each JR of the
+CAAM. This patch adds functionality that is used by the caam_dma that is
+not yet part of the JR driver.
+
+Signed-off-by: Radu Alexe <radu.alexe@nxp.com>
+Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
+---
+ drivers/crypto/caam/desc.h | 2 ++
+ drivers/crypto/caam/jr.c | 41 +++++++++++++++++++++++++++++++++++++++++
+ drivers/crypto/caam/jr.h | 2 ++
+ 3 files changed, 45 insertions(+)
+
+--- a/drivers/crypto/caam/desc.h
++++ b/drivers/crypto/caam/desc.h
+@@ -364,6 +364,7 @@
+ #define FIFOLD_TYPE_PK_N (0x08 << FIFOLD_TYPE_SHIFT)
+ #define FIFOLD_TYPE_PK_A (0x0c << FIFOLD_TYPE_SHIFT)
+ #define FIFOLD_TYPE_PK_B (0x0d << FIFOLD_TYPE_SHIFT)
++#define FIFOLD_TYPE_IFIFO (0x0f << FIFOLD_TYPE_SHIFT)
+
+ /* Other types. Need to OR in last/flush bits as desired */
+ #define FIFOLD_TYPE_MSG_MASK (0x38 << FIFOLD_TYPE_SHIFT)
+@@ -1522,6 +1523,7 @@
+ #define MATH_SRC1_INFIFO (0x0a << MATH_SRC1_SHIFT)
+ #define MATH_SRC1_OUTFIFO (0x0b << MATH_SRC1_SHIFT)
+ #define MATH_SRC1_ONE (0x0c << MATH_SRC1_SHIFT)
++#define MATH_SRC1_ZERO (0x0f << MATH_SRC1_SHIFT)
+
+ /* Destination selectors */
+ #define MATH_DEST_SHIFT 8
+--- a/drivers/crypto/caam/jr.c
++++ b/drivers/crypto/caam/jr.c
+@@ -62,6 +62,14 @@ algs_unlock:
+ mutex_unlock(&algs_lock);
+ }
+
++static int jr_driver_probed;
++
++int caam_jr_driver_probed(void)
++{
++ return jr_driver_probed;
++}
++EXPORT_SYMBOL(caam_jr_driver_probed);
++
+ static int caam_reset_hw_jr(struct device *dev)
+ {
+ struct caam_drv_private_jr *jrp = dev_get_drvdata(dev);
+@@ -147,6 +155,8 @@ static int caam_jr_remove(struct platfor
+ if (ret)
+ dev_err(jrdev, "Failed to shut down job ring\n");
+
++ jr_driver_probed--;
++
+ return ret;
+ }
+
+@@ -311,6 +321,36 @@ struct device *caam_jr_alloc(void)
+ EXPORT_SYMBOL(caam_jr_alloc);
+
+ /**
++ * caam_jridx_alloc() - Alloc a specific job ring based on its index.
++ *
++ * returns : pointer to the newly allocated physical
++ * JobR dev can be written to if successful.
++ **/
++struct device *caam_jridx_alloc(int idx)
++{
++ struct caam_drv_private_jr *jrpriv;
++ struct device *dev = ERR_PTR(-ENODEV);
++
++ spin_lock(&driver_data.jr_alloc_lock);
++
++ if (list_empty(&driver_data.jr_list))
++ goto end;
++
++ list_for_each_entry(jrpriv, &driver_data.jr_list, list_node) {
++ if (jrpriv->ridx == idx) {
++ atomic_inc(&jrpriv->tfm_count);
++ dev = jrpriv->dev;
++ break;
++ }
++ }
++
++end:
++ spin_unlock(&driver_data.jr_alloc_lock);
++ return dev;
++}
++EXPORT_SYMBOL(caam_jridx_alloc);
++
++/**
+ * caam_jr_free() - Free the Job Ring
+ * @rdev - points to the dev that identifies the Job ring to
+ * be released.
+@@ -565,6 +605,7 @@ static int caam_jr_probe(struct platform
+ device_set_wakeup_enable(&pdev->dev, false);
+
+ register_algs(jrdev->parent);
++ jr_driver_probed++;
+
+ return 0;
+ }
+--- a/drivers/crypto/caam/jr.h
++++ b/drivers/crypto/caam/jr.h
+@@ -9,7 +9,9 @@
+ #define JR_H
+
+ /* Prototypes for backend-level services exposed to APIs */
++int caam_jr_driver_probed(void);
+ struct device *caam_jr_alloc(void);
++struct device *caam_jridx_alloc(int idx);
+ void caam_jr_free(struct device *rdev);
+ int caam_jr_enqueue(struct device *dev, u32 *desc,
+ void (*cbk)(struct device *dev, u32 *desc, u32 status,