aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAndrew Lunn <andrew@lunn.ch>2011-05-15 07:32:51 -0400
committerNicolas Pitre <nico@fluxnic.net>2011-05-16 15:16:17 -0400
commit44350061905b2a502579d3827eacaf8efa393aad (patch)
tree33c66c67205e2fd48cae80dd29db1c755ddb94fb /arch
parent9e613f8a7904f2b7516eed08f413463c579325bd (diff)
ARM: orion: Consolidate setup of the crypto engine.
Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-kirkwood/common.c30
-rw-r--r--arch/arm/mach-orion5x/common.c36
-rw-r--r--arch/arm/plat-orion/common.c31
-rw-r--r--arch/arm/plat-orion/include/plat/common.h5
4 files changed, 45 insertions, 57 deletions
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index e96ec4e61615..f3248cfbe51d 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)
270/***************************************************************************** 270/*****************************************************************************
271 * Cryptographic Engines and Security Accelerator (CESA) 271 * Cryptographic Engines and Security Accelerator (CESA)
272 ****************************************************************************/ 272 ****************************************************************************/
273
274static struct resource kirkwood_crypto_res[] = {
275 {
276 .name = "regs",
277 .start = CRYPTO_PHYS_BASE,
278 .end = CRYPTO_PHYS_BASE + 0xffff,
279 .flags = IORESOURCE_MEM,
280 }, {
281 .name = "sram",
282 .start = KIRKWOOD_SRAM_PHYS_BASE,
283 .end = KIRKWOOD_SRAM_PHYS_BASE + KIRKWOOD_SRAM_SIZE - 1,
284 .flags = IORESOURCE_MEM,
285 }, {
286 .name = "crypto interrupt",
287 .start = IRQ_KIRKWOOD_CRYPTO,
288 .end = IRQ_KIRKWOOD_CRYPTO,
289 .flags = IORESOURCE_IRQ,
290 },
291};
292
293static struct platform_device kirkwood_crypto_device = {
294 .name = "mv_crypto",
295 .id = -1,
296 .num_resources = ARRAY_SIZE(kirkwood_crypto_res),
297 .resource = kirkwood_crypto_res,
298};
299
300void __init kirkwood_crypto_init(void) 273void __init kirkwood_crypto_init(void)
301{ 274{
302 kirkwood_clk_ctrl |= CGC_CRYPTO; 275 kirkwood_clk_ctrl |= CGC_CRYPTO;
303 platform_device_register(&kirkwood_crypto_device); 276 orion_crypto_init(CRYPTO_PHYS_BASE, KIRKWOOD_SRAM_PHYS_BASE,
277 KIRKWOOD_SRAM_SIZE, IRQ_KIRKWOOD_CRYPTO);
304} 278}
305 279
306 280
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c
index 8bbf497cc5f1..0ab531d047fc 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)
164 IRQ_ORION5X_XOR0, IRQ_ORION5X_XOR1); 164 IRQ_ORION5X_XOR0, IRQ_ORION5X_XOR1);
165} 165}
166 166
167static struct resource orion5x_crypto_res[] = { 167/*****************************************************************************
168 { 168 * Cryptographic Engines and Security Accelerator (CESA)
169 .name = "regs", 169 ****************************************************************************/
170 .start = ORION5X_CRYPTO_PHYS_BASE, 170static void __init orion5x_crypto_init(void)
171 .end = ORION5X_CRYPTO_PHYS_BASE + 0xffff,
172 .flags = IORESOURCE_MEM,
173 }, {
174 .name = "sram",
175 .start = ORION5X_SRAM_PHYS_BASE,
176 .end = ORION5X_SRAM_PHYS_BASE + SZ_8K - 1,
177 .flags = IORESOURCE_MEM,
178 }, {
179 .name = "crypto interrupt",
180 .start = IRQ_ORION5X_CESA,
181 .end = IRQ_ORION5X_CESA,
182 .flags = IORESOURCE_IRQ,
183 },
184};
185
186static struct platform_device orion5x_crypto_device = {
187 .name = "mv_crypto",
188 .id = -1,
189 .num_resources = ARRAY_SIZE(orion5x_crypto_res),
190 .resource = orion5x_crypto_res,
191};
192
193static int __init orion5x_crypto_init(void)
194{ 171{
195 int ret; 172 int ret;
196 173
197 ret = orion5x_setup_sram_win(); 174 ret = orion5x_setup_sram_win();
198 if (ret) 175 if (ret)
199 return ret; 176 return;
200 177
201 return platform_device_register(&orion5x_crypto_device); 178 orion_crypto_init(ORION5X_CRYPTO_PHYS_BASE, ORION5X_SRAM_PHYS_BASE,
179 SZ_8K, IRQ_ORION5X_CESA);
202} 180}
203 181
204/***************************************************************************** 182/*****************************************************************************
diff --git a/arch/arm/plat-orion/common.c b/arch/arm/plat-orion/common.c
index d1cf7c3fb744..9e5451b3c8e3 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,
923 platform_device_register(&orion_sata); 923 platform_device_register(&orion_sata);
924} 924}
925 925
926/*****************************************************************************
927 * Cryptographic Engines and Security Accelerator (CESA)
928 ****************************************************************************/
929static struct resource orion_crypto_resources[] = {
930 {
931 .name = "regs",
932 }, {
933 .name = "crypto interrupt",
934 }, {
935 .name = "sram",
936 .flags = IORESOURCE_MEM,
937 },
938};
926 939
940static struct platform_device orion_crypto = {
941 .name = "mv_crypto",
942 .id = -1,
943};
944
945void __init orion_crypto_init(unsigned long mapbase,
946 unsigned long srambase,
947 unsigned long sram_size,
948 unsigned long irq)
949{
950 fill_resources(&orion_crypto, orion_crypto_resources,
951 mapbase, 0xffff, irq);
952 orion_crypto.num_resources = 3;
953 orion_crypto_resources[2].start = srambase;
954 orion_crypto_resources[2].end = srambase + sram_size - 1;
955
956 platform_device_register(&orion_crypto);
957}
diff --git a/arch/arm/plat-orion/include/plat/common.h b/arch/arm/plat-orion/include/plat/common.h
index 0ec6b663a834..a63c357e2ab1 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,
109 struct mbus_dram_target_info *mbus_dram_info, 109 struct mbus_dram_target_info *mbus_dram_info,
110 unsigned long mapbase, 110 unsigned long mapbase,
111 unsigned long irq); 111 unsigned long irq);
112
113void __init orion_crypto_init(unsigned long mapbase,
114 unsigned long srambase,
115 unsigned long sram_size,
116 unsigned long irq);
112#endif 117#endif