Skip to content

Commit

Permalink
ARM: orion: Consolidate setup of the crypto engine.
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
  • Loading branch information
Andrew Lunn authored and Nicolas Pitre committed May 16, 2011
1 parent 9e613f8 commit 4435006
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 57 deletions.
30 changes: 2 additions & 28 deletions arch/arm/mach-kirkwood/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}


Expand Down
36 changes: 7 additions & 29 deletions arch/arm/mach-orion5x/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/*****************************************************************************
Expand Down
31 changes: 31 additions & 0 deletions arch/arm/plat-orion/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
5 changes: 5 additions & 0 deletions arch/arm/plat-orion/include/plat/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 4435006

Please sign in to comment.