]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
ARM: orion: Consolidate setup of the crypto engine.
authorAndrew Lunn <andrew@lunn.ch>
Sun, 15 May 2011 11:32:51 +0000 (13:32 +0200)
committerNicolas Pitre <nico@fluxnic.net>
Mon, 16 May 2011 19:16:17 +0000 (15:16 -0400)
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
arch/arm/mach-kirkwood/common.c
arch/arm/mach-orion5x/common.c
arch/arm/plat-orion/common.c
arch/arm/plat-orion/include/plat/common.h

index e96ec4e616152d40126bf3c4be069da415915f41..f3248cfbe51d058f79812d5247125fc98c2c2af6 100644 (file)
@@ -270,37 +270,11 @@ void __init kirkwood_uart1_init(void)
 /*****************************************************************************
  * Cryptographic Engines and Security Accelerator (CESA)
  ****************************************************************************/
-
-static struct resource kirkwood_crypto_res[] = {
-       {
-               .name   = "regs",
-               .start  = CRYPTO_PHYS_BASE,
-               .end    = CRYPTO_PHYS_BASE + 0xffff,
-               .flags  = IORESOURCE_MEM,
-       }, {
-               .name   = "sram",
-               .start  = KIRKWOOD_SRAM_PHYS_BASE,
-               .end    = KIRKWOOD_SRAM_PHYS_BASE + KIRKWOOD_SRAM_SIZE - 1,
-               .flags  = IORESOURCE_MEM,
-       }, {
-               .name   = "crypto interrupt",
-               .start  = IRQ_KIRKWOOD_CRYPTO,
-               .end    = IRQ_KIRKWOOD_CRYPTO,
-               .flags  = IORESOURCE_IRQ,
-       },
-};
-
-static struct platform_device kirkwood_crypto_device = {
-       .name           = "mv_crypto",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(kirkwood_crypto_res),
-       .resource       = kirkwood_crypto_res,
-};
-
 void __init kirkwood_crypto_init(void)
 {
        kirkwood_clk_ctrl |= CGC_CRYPTO;
-       platform_device_register(&kirkwood_crypto_device);
+       orion_crypto_init(CRYPTO_PHYS_BASE, KIRKWOOD_SRAM_PHYS_BASE,
+                         KIRKWOOD_SRAM_SIZE, IRQ_KIRKWOOD_CRYPTO);
 }
 
 
index 8bbf497cc5f1b314e45a81d73c9f2363c8a29d9d..0ab531d047fc7a32f56f49d2ce75cd1e479272c5 100644 (file)
@@ -164,41 +164,19 @@ void __init orion5x_xor_init(void)
                        IRQ_ORION5X_XOR0, IRQ_ORION5X_XOR1);
 }
 
-static struct resource orion5x_crypto_res[] = {
-       {
-               .name   = "regs",
-               .start  = ORION5X_CRYPTO_PHYS_BASE,
-               .end    = ORION5X_CRYPTO_PHYS_BASE + 0xffff,
-               .flags  = IORESOURCE_MEM,
-       }, {
-               .name   = "sram",
-               .start  = ORION5X_SRAM_PHYS_BASE,
-               .end    = ORION5X_SRAM_PHYS_BASE + SZ_8K - 1,
-               .flags  = IORESOURCE_MEM,
-       }, {
-               .name   = "crypto interrupt",
-               .start  = IRQ_ORION5X_CESA,
-               .end    = IRQ_ORION5X_CESA,
-               .flags  = IORESOURCE_IRQ,
-       },
-};
-
-static struct platform_device orion5x_crypto_device = {
-       .name           = "mv_crypto",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(orion5x_crypto_res),
-       .resource       = orion5x_crypto_res,
-};
-
-static int __init orion5x_crypto_init(void)
+/*****************************************************************************
+ * Cryptographic Engines and Security Accelerator (CESA)
+ ****************************************************************************/
+static void __init orion5x_crypto_init(void)
 {
        int ret;
 
        ret = orion5x_setup_sram_win();
        if (ret)
-               return ret;
+               return;
 
-       return platform_device_register(&orion5x_crypto_device);
+       orion_crypto_init(ORION5X_CRYPTO_PHYS_BASE, ORION5X_SRAM_PHYS_BASE,
+                         SZ_8K, IRQ_ORION5X_CESA);
 }
 
 /*****************************************************************************
index d1cf7c3fb7442de06f0608227e7d85401f869833..9e5451b3c8e3be92c441dc977c906b63715544a5 100644 (file)
@@ -923,4 +923,35 @@ void __init orion_sata_init(struct mv_sata_platform_data *sata_data,
        platform_device_register(&orion_sata);
 }
 
+/*****************************************************************************
+ * Cryptographic Engines and Security Accelerator (CESA)
+ ****************************************************************************/
+static struct resource orion_crypto_resources[] = {
+       {
+               .name   = "regs",
+       }, {
+               .name   = "crypto interrupt",
+       }, {
+               .name   = "sram",
+               .flags  = IORESOURCE_MEM,
+       },
+};
 
+static struct platform_device orion_crypto = {
+       .name           = "mv_crypto",
+       .id             = -1,
+};
+
+void __init orion_crypto_init(unsigned long mapbase,
+                             unsigned long srambase,
+                             unsigned long sram_size,
+                             unsigned long irq)
+{
+       fill_resources(&orion_crypto, orion_crypto_resources,
+                      mapbase, 0xffff, irq);
+       orion_crypto.num_resources = 3;
+       orion_crypto_resources[2].start = srambase;
+       orion_crypto_resources[2].end = srambase + sram_size - 1;
+
+       platform_device_register(&orion_crypto);
+}
index 0ec6b663a834606c636706617d927d5cdad6d0b4..a63c357e2ab1a89320d0fe0e55880319fb43fea6 100644 (file)
@@ -109,4 +109,9 @@ void __init orion_sata_init(struct mv_sata_platform_data *sata_data,
                            struct mbus_dram_target_info *mbus_dram_info,
                            unsigned long mapbase,
                            unsigned long irq);
+
+void __init orion_crypto_init(unsigned long mapbase,
+                             unsigned long srambase,
+                             unsigned long sram_size,
+                             unsigned long irq);
 #endif