[ARM] orion5x: add sram support for crypto
[safe/jmp/linux-2.6] / arch / arm / mach-orion5x / common.c
index 8a0e49d..eafcc49 100644 (file)
@@ -31,6 +31,7 @@
 #include <plat/ehci-orion.h>
 #include <plat/mv_xor.h>
 #include <plat/orion_nand.h>
+#include <plat/orion_wdt.h>
 #include <plat/time.h>
 #include "common.h"
 
@@ -187,6 +188,9 @@ static struct platform_device orion5x_eth = {
        .id             = 0,
        .num_resources  = 1,
        .resource       = orion5x_eth_resources,
+       .dev            = {
+               .coherent_dma_mask      = 0xffffffff,
+       },
 };
 
 void __init orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data)
@@ -219,14 +223,17 @@ static struct platform_device orion5x_switch_device = {
 
 void __init orion5x_eth_switch_init(struct dsa_platform_data *d, int irq)
 {
+       int i;
+
        if (irq != NO_IRQ) {
                orion5x_switch_resources[0].start = irq;
                orion5x_switch_resources[0].end = irq;
                orion5x_switch_device.num_resources = 1;
        }
 
-       d->mii_bus = &orion5x_eth_shared.dev;
        d->netdev = &orion5x_eth.dev;
+       for (i = 0; i < d->nr_chips; i++)
+               d->chip[i].mii_bus = &orion5x_eth_shared.dev;
        orion5x_switch_device.dev.platform_data = d;
 
        platform_device_register(&orion5x_switch_device);
@@ -244,12 +251,10 @@ static struct mv64xxx_i2c_pdata orion5x_i2c_pdata = {
 
 static struct resource orion5x_i2c_resources[] = {
        {
-               .name   = "i2c base",
                .start  = I2C_PHYS_BASE,
                .end    = I2C_PHYS_BASE + 0x1f,
                .flags  = IORESOURCE_MEM,
        }, {
-               .name   = "i2c irq",
                .start  = IRQ_ORION5X_I2C,
                .end    = IRQ_ORION5X_I2C,
                .flags  = IORESOURCE_IRQ,
@@ -459,7 +464,7 @@ static struct platform_device orion5x_xor_shared = {
        .resource       = orion5x_xor_shared_resources,
 };
 
-static u64 orion5x_xor_dmamask = DMA_32BIT_MASK;
+static u64 orion5x_xor_dmamask = DMA_BIT_MASK(32);
 
 static struct resource orion5x_xor0_resources[] = {
        [0] = {
@@ -482,7 +487,7 @@ static struct platform_device orion5x_xor0_channel = {
        .resource       = orion5x_xor0_resources,
        .dev            = {
                .dma_mask               = &orion5x_xor_dmamask,
-               .coherent_dma_mask      = DMA_64BIT_MASK,
+               .coherent_dma_mask      = DMA_BIT_MASK(64),
                .platform_data          = (void *)&orion5x_xor0_data,
        },
 };
@@ -508,7 +513,7 @@ static struct platform_device orion5x_xor1_channel = {
        .resource       = orion5x_xor1_resources,
        .dev            = {
                .dma_mask               = &orion5x_xor_dmamask,
-               .coherent_dma_mask      = DMA_64BIT_MASK,
+               .coherent_dma_mask      = DMA_BIT_MASK(64),
                .platform_data          = (void *)&orion5x_xor1_data,
        },
 };
@@ -531,6 +536,65 @@ void __init orion5x_xor_init(void)
        platform_device_register(&orion5x_xor1_channel);
 }
 
+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,
+};
+
+int __init orion5x_crypto_init(void)
+{
+       int ret;
+
+       ret = orion5x_setup_sram_win();
+       if (ret)
+               return ret;
+
+       return platform_device_register(&orion5x_crypto_device);
+}
+
+/*****************************************************************************
+ * Watchdog
+ ****************************************************************************/
+static struct orion_wdt_platform_data orion5x_wdt_data = {
+       .tclk                   = 0,
+};
+
+static struct platform_device orion5x_wdt_device = {
+       .name           = "orion_wdt",
+       .id             = -1,
+       .dev            = {
+               .platform_data  = &orion5x_wdt_data,
+       },
+       .num_resources  = 0,
+};
+
+void __init orion5x_wdt_init(void)
+{
+       orion5x_wdt_data.tclk = orion5x_tclk;
+       platform_device_register(&orion5x_wdt_device);
+}
+
 
 /*****************************************************************************
  * Time handling
@@ -631,6 +695,11 @@ void __init orion5x_init(void)
                printk(KERN_INFO "Orion: Applying 5281 D0 WFI workaround.\n");
                disable_hlt();
        }
+
+       /*
+        * Register watchdog driver
+        */
+       orion5x_wdt_init();
 }
 
 /*