aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSandeep Paulraj <s-paulraj@ti.com>2012-09-11 14:29:50 -0400
committerCyril Chemparathy <cyril@ti.com>2012-09-19 16:04:56 -0400
commit7c28855a746fed437706b191c32989084d003b64 (patch)
treed5a18d7b901aa309da57f7fa35f78eea208e2ac7
parent17555e89424867e5d8d63bfbcd6bb4601452f8e8 (diff)
downloadlinux-keystone-rebuild/26-drivers-misc.tar.gz
crypto: add stub keystone crypto accelerator driverrebuild/26-drivers-misc
This driver only enables the clock for now. Signed-off-by: Cyril Chemparathy <cyril@ti.com>
-rw-r--r--drivers/crypto/Kconfig9
-rw-r--r--drivers/crypto/Makefile1
-rw-r--r--drivers/crypto/keystone-sa.c96
3 files changed, 106 insertions, 0 deletions
diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig
index 7d74d092aa8fe1..a6f3dcb9ddf389 100644
--- a/drivers/crypto/Kconfig
+++ b/drivers/crypto/Kconfig
@@ -258,6 +258,15 @@ config CRYPTO_DEV_OMAP_AES
OMAP processors have AES module accelerator. Select this if you
want to use the OMAP module for AES algorithms.
+config CRYPTO_DEV_KEYSTONE
+ tristate "Support for TI Keystone security accelerator"
+ depends on TI_KEYSTONE
+ default y if TI_KEYSTONE
+ help
+ Keystone devices include a security accelerator engine that may be
+ used for crypto offload. Select this if you want to use hardware
+ acceleration for cryptographic algorithms on these devices.
+
config CRYPTO_DEV_PICOXCELL
tristate "Support for picoXcell IPSEC and Layer2 crypto engines"
depends on ARCH_PICOXCELL && HAVE_CLK
diff --git a/drivers/crypto/Makefile b/drivers/crypto/Makefile
index 880a47b0b02360..7a373d06bab8b7 100644
--- a/drivers/crypto/Makefile
+++ b/drivers/crypto/Makefile
@@ -11,6 +11,7 @@ obj-$(CONFIG_CRYPTO_DEV_IXP4XX) += ixp4xx_crypto.o
obj-$(CONFIG_CRYPTO_DEV_PPC4XX) += amcc/
obj-$(CONFIG_CRYPTO_DEV_OMAP_SHAM) += omap-sham.o
obj-$(CONFIG_CRYPTO_DEV_OMAP_AES) += omap-aes.o
+obj-$(CONFIG_CRYPTO_DEV_KEYSTONE) += keystone-sa.o
obj-$(CONFIG_CRYPTO_DEV_PICOXCELL) += picoxcell_crypto.o
obj-$(CONFIG_CRYPTO_DEV_S5P) += s5p-sss.o
obj-$(CONFIG_CRYPTO_DEV_TEGRA_AES) += tegra-aes.o
diff --git a/drivers/crypto/keystone-sa.c b/drivers/crypto/keystone-sa.c
new file mode 100644
index 00000000000000..990326d3ba4890
--- /dev/null
+++ b/drivers/crypto/keystone-sa.c
@@ -0,0 +1,96 @@
+/*
+ * Keystone crypto accelerator driver
+ *
+ * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com
+ * Contact: Sandeep Nair <sandeep_n@ti.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ */
+
+#include <linux/clk.h>
+#include <linux/err.h>
+#include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+
+struct keystone_crypto_data {
+ struct clk *clk;
+};
+
+static int __devinit keystone_crypto_probe(struct platform_device *pdev)
+{
+ struct device *dev = &pdev->dev;
+ struct keystone_crypto_data *crypto;
+ int ret;
+
+ crypto = devm_kzalloc(dev, sizeof(*crypto), GFP_KERNEL);
+ if (!crypto)
+ return -ENOMEM;
+
+ crypto->clk = clk_get(dev, NULL);
+ if (IS_ERR_OR_NULL(crypto->clk))
+ return -ENODEV;
+
+ ret = clk_prepare_enable(crypto->clk);
+ if (ret < 0) {
+ clk_put(crypto->clk);
+ return ret;
+ }
+
+ platform_set_drvdata(pdev, crypto);
+ dev_info(dev, "crypto accelerator enabled\n");
+
+ return 0;
+}
+
+static int __devexit keystone_crypto_remove(struct platform_device *pdev)
+{
+ struct keystone_crypto_data *crypto = platform_get_drvdata(pdev);
+
+ clk_disable_unprepare(crypto->clk);
+ clk_put(crypto->clk);
+ kfree(crypto);
+ return 0;
+}
+
+static struct of_device_id __devinitdata of_match[] = {
+ { .compatible = "ti,keystone-crypto", },
+ {},
+};
+MODULE_DEVICE_TABLE(of, of_match);
+
+static struct platform_driver keystone_crypto_driver = {
+ .probe = keystone_crypto_probe,
+ .remove = __devexit_p(keystone_crypto_remove),
+ .driver = {
+ .name = "keystone-crypto",
+ .owner = THIS_MODULE,
+ .of_match_table = of_match,
+ },
+};
+
+static int __init keystone_crypto_mod_init(void)
+{
+ return platform_driver_register(&keystone_crypto_driver);
+}
+
+static void __exit keystone_crypto_mod_exit(void)
+{
+ platform_driver_unregister(&keystone_crypto_driver);
+}
+
+module_init(keystone_crypto_mod_init);
+module_exit(keystone_crypto_mod_exit);
+
+MODULE_DESCRIPTION("Keystone crypto acceleration support.");
+MODULE_LICENSE("GPL v2");
+MODULE_AUTHOR("Sandeep Nair <sandeep_n@ti.com>");
+