crypto: tegra-se: Use proper rsa key slot
venkatajagadish [Thu, 31 Jan 2013 08:50:06 +0000 (13:50 +0530)]
This change fixes the S.E time out errors while
executing RSA test

Bug 1218410

Change-Id: Icbbcdd7b3d86a259dc3ff19ebb4b3a7374135e47
Signed-off-by: venkatajagadish <vjagadish@nvidia.com>
Reviewed-on: http://git-master/r/195912
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Shravani D <shravanid@nvidia.com>
Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>

drivers/crypto/tegra-se.c
drivers/crypto/tegra-se.h

index 9dbd4a5..88084ee 100644 (file)
@@ -885,13 +885,16 @@ static void tegra_se_process_new_req(struct crypto_async_request *async_req)
 static irqreturn_t tegra_se_irq(int irq, void *dev)
 {
        struct tegra_se_dev *se_dev = dev;
-       u32 val;
+       u32 val, err_stat;
 
        val = se_readl(se_dev, SE_INT_STATUS_REG_OFFSET);
        se_writel(se_dev, val, SE_INT_STATUS_REG_OFFSET);
 
-       if (val & SE_INT_ERROR(INT_SET))
-               dev_err(se_dev->dev, "tegra_se_irq::error");
+       if (val & SE_INT_ERROR(INT_SET)) {
+               err_stat = se_readl(se_dev, SE_ERR_STATUS_0);
+               dev_err(se_dev->dev, "tegra_se_irq::error status is %x\n",
+                                                               err_stat);
+       }
 
        if (val & SE_INT_OP_DONE(INT_SET))
                complete(&se_dev->complete);
@@ -1850,7 +1853,7 @@ static struct tegra_se_rsa_slot *tegra_se_alloc_rsa_key_slot(void)
        bool found = false;
 
        spin_lock(&rsa_key_slot_lock);
-       list_for_each_entry(slot, &key_slot, node) {
+       list_for_each_entry(slot, &rsa_key_slot, node) {
                if (slot->available) {
                        slot->available = false;
                        found = true;
@@ -1877,7 +1880,7 @@ static int tegra_init_rsa_key_slot(struct tegra_se_dev *se_dev)
                se_dev->rsa_slot_list[i].available = true;
                se_dev->rsa_slot_list[i].slot_num = i;
                INIT_LIST_HEAD(&se_dev->rsa_slot_list[i].node);
-               list_add_tail(&se_dev->rsa_slot_list[i].node, &key_slot);
+               list_add_tail(&se_dev->rsa_slot_list[i].node, &rsa_key_slot);
        }
        spin_unlock(&rsa_key_slot_lock);
 
index 88df933..abbb35e 100644 (file)
 #define SE_INT_OP_DONE(x)                      (x << SE_INT_OP_DONE_SHIFT)
 #define SE_INT_ERROR_SHIFT             16
 #define SE_INT_ERROR(x)                        (x << SE_INT_ERROR_SHIFT)
+#define SE_ERR_STATUS_0                        0x804
 
 #define SE_CRYPTO_KEYTABLE_DST_REG_OFFSET      0X330
 #define SE_CRYPTO_KEYTABLE_DST_WORD_QUAD_SHIFT         0