diff mbox

crypto: driver for tegra AES hardware

Message ID 20111104135436.GA29112@mail.familie-heinold.de
State Superseded, archived
Headers show

Commit Message

Henning Heinold Nov. 4, 2011, 1:54 p.m. UTC
Hi Varun,

thanks that you come up with an "official" patch for the aes-stuff.

Against which tree you did test the patch?

I tested it against  git://git.kernel.org/pub/scm/linux/kernel/git/olof/tegra.git for-next
choose to build it as module and got the following errors:

drivers/crypto/tegra-aes.c: In function 'aes_start_crypt':
drivers/crypto/tegra-aes.c:226:13: error: 'eng' undeclared (first use in this function)
drivers/crypto/tegra-aes.c:226:13: note: each undeclared identifier is reported only once for each function it appears in
drivers/crypto/tegra-aes.c: In function 'aes_irq':
drivers/crypto/tegra-aes.c:614:18: error: 'intr_err_mask' undeclared (first use in this function)
drivers/crypto/tegra-aes.c:620:1: warning: label 'done' defined but not used

Which are problems inside the driver it self, which can be easy fixed:

-       aes_writel(eng, 0xFFFFFFFF, INTR_STATUS);
+       aes_writel(dd, 0xFFFFFFFF, INTR_STATUS);

-       aes_writel(dd, intr_err_mask, INTR_STATUS);
+       aes_writel(dd, INT_ERROR_MASK, INTR_STATUS);

Second problem it don't build as modul 

first:
typo in
MODULE_LICENSE("GPLv2") it needs a space MODULE_LICENSE("GPL v2")

second:
tegra_chip_uid function is not exported

I have attched patch which fixes all the stuff besides the not used variable. 
I did not runtime test it for 3.x kernels, but works backported to
the 2.6.38-chromeos tree.

Bye Henning

Comments

Varun Wadekar Nov. 5, 2011, 7:28 a.m. UTC | #1
On Friday 04 November 2011 07:24 PM, Henning Heinold wrote:
> Hi Varun,
>
> thanks that you come up with an "official" patch for the aes-stuff.
>
> Against which tree you did test the patch?

I tested it against Linus's master branch but unfortunately, some other
changes crept inside this patch due to which you saw that compilation
errors.

> I tested it against  git://git.kernel.org/pub/scm/linux/kernel/git/olof/tegra.git for-next
> choose to build it as module and got the following errors:
>
> drivers/crypto/tegra-aes.c: In function 'aes_start_crypt':
> drivers/crypto/tegra-aes.c:226:13: error: 'eng' undeclared (first use in this function)
> drivers/crypto/tegra-aes.c:226:13: note: each undeclared identifier is reported only once for each function it appears in
> drivers/crypto/tegra-aes.c: In function 'aes_irq':
> drivers/crypto/tegra-aes.c:614:18: error: 'intr_err_mask' undeclared (first use in this function)
> drivers/crypto/tegra-aes.c:620:1: warning: label 'done' defined but not used
>
> Which are problems inside the driver it self, which can be easy fixed:
>
> -       aes_writel(eng, 0xFFFFFFFF, INTR_STATUS);
> +       aes_writel(dd, 0xFFFFFFFF, INTR_STATUS);
>
> -       aes_writel(dd, intr_err_mask, INTR_STATUS);
> +       aes_writel(dd, INT_ERROR_MASK, INTR_STATUS);
>
> Second problem it don't build as modul 
>
> first:
> typo in
> MODULE_LICENSE("GPLv2") it needs a space MODULE_LICENSE("GPL v2")

All the above changes will be present in my next patch.

> second:
> tegra_chip_uid function is not exported

Will submit a different patch to Olof and Stephen to get this change in
the mach-tegra tree. If you want to post the fuse changes to them
yourself, please go ahead.

> I have attched patch which fixes all the stuff besides the not used variable. 
> I did not runtime test it for 3.x kernels, but works backported to
> the 2.6.38-chromeos tree.

Thanks for your help.

> Bye Henning 

--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

From 96d513a1688e4d1f53f79d099950cb0ad2899848 Mon Sep 17 00:00:00 2001
From: Henning Heinold <heinold@inf.fu-berlin.de>
Date: Fri, 4 Nov 2011 14:52:58 +0100
Subject: [PATCH] arm:tegra:aes: fix building as module

Signed-off-by: Henning Heinold <heinold@inf.fu-berlin.de>
---
 arch/arm/mach-tegra/fuse.c |    2 ++
 drivers/crypto/tegra-aes.c |    6 +++---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-tegra/fuse.c b/arch/arm/mach-tegra/fuse.c
index 1fa26d9..ea49bd9 100644
--- a/arch/arm/mach-tegra/fuse.c
+++ b/arch/arm/mach-tegra/fuse.c
@@ -19,6 +19,7 @@ 
 
 #include <linux/kernel.h>
 #include <linux/io.h>
+#include <linux/module.h>
 
 #include <mach/iomap.h>
 
@@ -58,6 +59,7 @@  unsigned long long tegra_chip_uid(void)
 	hi = fuse_readl(FUSE_UID_HIGH);
 	return (hi << 32ull) | lo;
 }
+EXPORT_SYMBOL(tegra_chip_uid);
 
 int tegra_sku_id(void)
 {
diff --git a/drivers/crypto/tegra-aes.c b/drivers/crypto/tegra-aes.c
index b180a93..c34bc94 100644
--- a/drivers/crypto/tegra-aes.c
+++ b/drivers/crypto/tegra-aes.c
@@ -223,7 +223,7 @@  static int aes_start_crypt(struct tegra_aes_dev *dd, u32 in_addr, u32 out_addr,
 	u32 value;
 
 	/* reset all the interrupt bits */
-	aes_writel(eng, 0xFFFFFFFF, INTR_STATUS);
+	aes_writel(dd, 0xFFFFFFFF, INTR_STATUS);
 
 	/* enable error, dma xfer complete interrupts */
 	aes_writel(dd, 0x33, INT_ENB);
@@ -611,7 +611,7 @@  static irqreturn_t aes_irq(int irq, void *dev_id)
 
 	dev_dbg(dd->dev, "irq_stat: 0x%x", value);
 	if (value & INT_ERROR_MASK)
-		aes_writel(dd, intr_err_mask, INTR_STATUS);
+		aes_writel(dd, INT_ERROR_MASK, INTR_STATUS);
 
 	value = aes_readl(dd, INTR_STATUS);
 	if (!(value & ENGINE_BUSY_FIELD))
@@ -1117,4 +1117,4 @@  module_exit(tegra_aes_module_exit);
 
 MODULE_DESCRIPTION("Tegra AES/OFB/CPRNG hw acceleration support.");
 MODULE_AUTHOR("NVIDIA Corporation");
-MODULE_LICENSE("GPLv2");
+MODULE_LICENSE("GPL v2");
-- 
1.7.7.1