diff options
author | Shravani Dingari <shravanid@nvidia.com> | 2013-11-26 11:34:54 +0530 |
---|---|---|
committer | Shravani Dingari <shravanid@nvidia.com> | 2013-12-12 21:18:23 -0800 |
commit | 1b5f4039648cd18bd3c19d244ef58bb0d4b5c40a (patch) | |
tree | 18499c9eee4bdff237231d0cd79e92e23bedda7e /drivers/crypto | |
parent | 4cbfd388ceb67f72572ff7d5e89ee1d50d78903f (diff) |
crypto: tegra-se: Add DT support
Add DT support for SE driver
Bug 1369830
Change-Id: Iebd0a7f58d0ee6eb3ebc7f75f81690bc1ec972c0
Signed-off-by: Shravani Dingari <shravanid@nvidia.com>
Reviewed-on: http://git-master/r/334930
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>
Diffstat (limited to 'drivers/crypto')
-rw-r--r-- | drivers/crypto/tegra-se.c | 86 |
1 files changed, 53 insertions, 33 deletions
diff --git a/drivers/crypto/tegra-se.c b/drivers/crypto/tegra-se.c index 196450f4dcc8..0488527b9c79 100644 --- a/drivers/crypto/tegra-se.c +++ b/drivers/crypto/tegra-se.c @@ -30,6 +30,8 @@ #include <linux/scatterlist.h> #include <linux/dma-mapping.h> #include <linux/io.h> +#include <linux/of.h> +#include <linux/of_device.h> #include <linux/mutex.h> #include <linux/interrupt.h> #include <linux/types.h> @@ -2555,10 +2557,46 @@ bool isAlgoSupported(struct tegra_se_dev *se_dev, const char *algo) return true; } +static struct tegra_se_chipdata tegra_se_chipdata = { + .rsa_supported = false, + .cprng_supported = true, + .drbg_supported = false, + .aes_freq = 300000000, + .rng_freq = 300000000, + .sha1_freq = 300000000, + .sha224_freq = 300000000, + .sha256_freq = 300000000, + .sha384_freq = 300000000, + .sha512_freq = 300000000, +}; + +static struct tegra_se_chipdata tegra11_se_chipdata = { + .rsa_supported = true, + .cprng_supported = false, + .drbg_supported = true, + .aes_freq = 150000000, + .rng_freq = 150000000, + .sha1_freq = 200000000, + .sha224_freq = 250000000, + .sha256_freq = 250000000, + .sha384_freq = 150000000, + .sha512_freq = 150000000, + .rsa_freq = 350000000, +}; + +static struct of_device_id tegra_se_of_match[] = { + { + .compatible = "nvidia,tegra124-se", + .data = &tegra11_se_chipdata, + }, +}; +MODULE_DEVICE_TABLE(of, tegra_se_of_match); + static int tegra_se_probe(struct platform_device *pdev) { struct tegra_se_dev *se_dev = NULL; struct resource *res = NULL; + const struct of_device_id *match; int err = 0, i = 0, j = 0, k = 0; se_dev = kzalloc(sizeof(struct tegra_se_dev), GFP_KERNEL); @@ -2566,6 +2604,18 @@ static int tegra_se_probe(struct platform_device *pdev) dev_err(&pdev->dev, "memory allocation failed\n"); return -ENOMEM; } + if (pdev->dev.of_node) { + match = of_match_device(of_match_ptr(tegra_se_of_match), + &pdev->dev); + if (!match) { + dev_err(&pdev->dev, "Error: No device match found\n"); + return -ENODEV; + } + se_dev->chipdata = (struct tegra_se_chipdata *)match->data; + } else { + se_dev->chipdata = + (struct tegra_se_chipdata *)pdev->id_entry->driver_data; + } spin_lock_init(&se_dev->lock); crypto_init_queue(&se_dev->queue, TEGRA_SE_CRYPTO_QUEUE_LENGTH); @@ -2607,9 +2657,6 @@ static int tegra_se_probe(struct platform_device *pdev) goto err_irq; } - se_dev->chipdata = - (struct tegra_se_chipdata *)pdev->id_entry->driver_data; - /* Initialize the clock */ se_dev->pclk = clk_get(se_dev->dev, "se"); if (IS_ERR(se_dev->pclk)) { @@ -3450,42 +3497,14 @@ static const struct dev_pm_ops tegra_se_dev_pm_ops = { }; #endif -static struct tegra_se_chipdata tegra_se_chipdata = { - .rsa_supported = false, - .cprng_supported = true, - .drbg_supported = false, - .aes_freq = 300000000, - .rng_freq = 300000000, - .sha1_freq = 300000000, - .sha224_freq = 300000000, - .sha256_freq = 300000000, - .sha384_freq = 300000000, - .sha512_freq = 300000000, -}; - -static struct tegra_se_chipdata tegra11_se_chipdata = { - .rsa_supported = true, - .cprng_supported = false, - .drbg_supported = true, - .aes_freq = 150000000, - .rng_freq = 150000000, - .sha1_freq = 200000000, - .sha224_freq = 250000000, - .sha256_freq = 250000000, - .sha384_freq = 150000000, - .sha512_freq = 150000000, - .rsa_freq = 350000000, - -}; - static struct platform_device_id tegra_dev_se_devtype[] = { { .name = "tegra-se", .driver_data = (unsigned long)&tegra_se_chipdata, }, { - .name = "tegra11-se", - .driver_data = (unsigned long)&tegra11_se_chipdata, + .name = "tegra11-se", + .driver_data = (unsigned long)&tegra11_se_chipdata, }, { .name = "tegra12-se", @@ -3502,6 +3521,7 @@ static struct platform_driver tegra_se_driver = { .owner = THIS_MODULE, #if defined(CONFIG_PM_RUNTIME) .pm = &tegra_se_dev_pm_ops, + .of_match_table = of_match_ptr(tegra_se_of_match), #endif }, }; |