From: andrew@lunn.ch (Andrew Lunn)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv2 12/15] [orion] Consolidate setup of the crypto engine.
Date: Sun, 15 May 2011 13:32:51 +0200 [thread overview]
Message-ID: <1305459174-25517-13-git-send-email-andrew@lunn.ch> (raw)
In-Reply-To: <1305459174-25517-1-git-send-email-andrew@lunn.ch>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
arch/arm/mach-kirkwood/common.c | 30 +----------------------
arch/arm/mach-orion5x/common.c | 36 +++++-----------------------
arch/arm/plat-orion/common.c | 31 +++++++++++++++++++++++++
arch/arm/plat-orion/include/plat/common.h | 5 ++++
4 files changed, 45 insertions(+), 57 deletions(-)
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index e96ec4e..f3248cf 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
@@ -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);
}
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c
index 8bbf497c..0ab531d 100644
--- a/arch/arm/mach-orion5x/common.c
+++ b/arch/arm/mach-orion5x/common.c
@@ -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);
}
/*****************************************************************************
diff --git a/arch/arm/plat-orion/common.c b/arch/arm/plat-orion/common.c
index d1cf7c3..9e5451b 100644
--- a/arch/arm/plat-orion/common.c
+++ b/arch/arm/plat-orion/common.c
@@ -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);
+}
diff --git a/arch/arm/plat-orion/include/plat/common.h b/arch/arm/plat-orion/include/plat/common.h
index 0ec6b66..a63c357 100644
--- a/arch/arm/plat-orion/include/plat/common.h
+++ b/arch/arm/plat-orion/include/plat/common.h
@@ -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
--
1.7.4.4
next prev parent reply other threads:[~2011-05-15 11:32 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-15 11:32 [PATCHv2 00/15] Consolidate Orion platform information setup Andrew Lunn
2011-05-15 11:32 ` [PATCHv2 01/15] [Orion] Rename some constants to macros to make code more identical Andrew Lunn
2011-05-15 11:32 ` [PATCHv2 02/15] [orion] Consolidate the creation of the uart platform data Andrew Lunn
2011-05-15 11:32 ` [PATCHv2 03/15] [orion] Consolidate the creation of the RTC " Andrew Lunn
2011-05-15 11:32 ` [PATCHv2 04/15] [kirkwood] Add support for RTC interrupts which allows RTC alarms Andrew Lunn
2011-05-15 11:32 ` [PATCHv2 05/15] [orion] Consolidate ethernet platform data Andrew Lunn
2011-05-15 11:32 ` [PATCHv2 06/15] [orion] Consolidate I2C initialization Andrew Lunn
2011-05-15 11:32 ` [PATCHv2 07/15] [orion] Consolidate SPI initialization Andrew Lunn
2011-05-15 11:32 ` [PATCHv2 08/15] [orion] Consolidate the platform data setup for the watchdog Andrew Lunn
2011-05-15 11:32 ` [PATCHv2 09/15] [orion] Consolidate the XOR platform setup code Andrew Lunn
2011-05-15 11:32 ` [PATCHv2 10/15] [orion] Consolidate USB " Andrew Lunn
2011-05-15 11:32 ` [PATCHv2 11/15] [orion] Consolidate SATA platform setup Andrew Lunn
2011-05-15 11:32 ` Andrew Lunn [this message]
2011-05-15 11:32 ` [PATCHv2 13/15] [orion] Refactor the MPP code. Common code in the orion platform Andrew Lunn
2011-05-15 11:32 ` [PATCHv2 14/15] [orion5x] Refactor mpp code to use common orion platform mpp Andrew Lunn
2011-05-15 11:32 ` [PATCHv2 15/15] [dove] Consolidate mpp code with " Andrew Lunn
2011-05-16 20:31 ` [PATCHv2 00/15] Consolidate Orion platform information setup Nicolas Pitre
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1305459174-25517-13-git-send-email-andrew@lunn.ch \
--to=andrew@lunn.ch \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).