]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/arm/mach-at91/at91sam9263.c
[ARM] 4903/1: [AT91] SAM9/CAP9 system shutdown
[linux-2.6-omap-h63xx.git] / arch / arm / mach-at91 / at91sam9263.c
index 0e89a7fca3fa53df2bdbe2e799526903847d8477..052074a9f2d30334cada72af48903f64d5801292 100644 (file)
  */
 
 #include <linux/module.h>
+#include <linux/pm.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 #include <asm/arch/at91sam9263.h>
 #include <asm/arch/at91_pmc.h>
 #include <asm/arch/at91_rstc.h>
+#include <asm/arch/at91_shdwc.h>
 
 #include "generic.h"
 #include "clock.h"
@@ -87,6 +89,11 @@ static struct clk mmc1_clk = {
        .pmc_mask       = 1 << AT91SAM9263_ID_MCI1,
        .type           = CLK_TYPE_PERIPHERAL,
 };
+static struct clk can_clk = {
+       .name           = "can_clk",
+       .pmc_mask       = 1 << AT91SAM9263_ID_CAN,
+       .type           = CLK_TYPE_PERIPHERAL,
+};
 static struct clk twi_clk = {
        .name           = "twi_clk",
        .pmc_mask       = 1 << AT91SAM9263_ID_TWI,
@@ -102,16 +109,46 @@ static struct clk spi1_clk = {
        .pmc_mask       = 1 << AT91SAM9263_ID_SPI1,
        .type           = CLK_TYPE_PERIPHERAL,
 };
+static struct clk ssc0_clk = {
+       .name           = "ssc0_clk",
+       .pmc_mask       = 1 << AT91SAM9263_ID_SSC0,
+       .type           = CLK_TYPE_PERIPHERAL,
+};
+static struct clk ssc1_clk = {
+       .name           = "ssc1_clk",
+       .pmc_mask       = 1 << AT91SAM9263_ID_SSC1,
+       .type           = CLK_TYPE_PERIPHERAL,
+};
+static struct clk ac97_clk = {
+       .name           = "ac97_clk",
+       .pmc_mask       = 1 << AT91SAM9263_ID_AC97C,
+       .type           = CLK_TYPE_PERIPHERAL,
+};
 static struct clk tcb_clk = {
        .name           = "tcb_clk",
        .pmc_mask       = 1 << AT91SAM9263_ID_TCB,
        .type           = CLK_TYPE_PERIPHERAL,
 };
+static struct clk pwmc_clk = {
+       .name           = "pwmc_clk",
+       .pmc_mask       = 1 << AT91SAM9263_ID_PWMC,
+       .type           = CLK_TYPE_PERIPHERAL,
+};
 static struct clk macb_clk = {
        .name           = "macb_clk",
        .pmc_mask       = 1 << AT91SAM9263_ID_EMAC,
        .type           = CLK_TYPE_PERIPHERAL,
 };
+static struct clk dma_clk = {
+       .name           = "dma_clk",
+       .pmc_mask       = 1 << AT91SAM9263_ID_DMA,
+       .type           = CLK_TYPE_PERIPHERAL,
+};
+static struct clk twodge_clk = {
+       .name           = "2dge_clk",
+       .pmc_mask       = 1 << AT91SAM9263_ID_2DGE,
+       .type           = CLK_TYPE_PERIPHERAL,
+};
 static struct clk udc_clk = {
        .name           = "udc_clk",
        .pmc_mask       = 1 << AT91SAM9263_ID_UDP,
@@ -142,20 +179,21 @@ static struct clk *periph_clocks[] __initdata = {
        &usart2_clk,
        &mmc0_clk,
        &mmc1_clk,
-       // can
+       &can_clk,
        &twi_clk,
        &spi0_clk,
        &spi1_clk,
-       // ssc0 .. ssc1
-       // ac97
+       &ssc0_clk,
+       &ssc1_clk,
+       &ac97_clk,
        &tcb_clk,
-       // pwmc
+       &pwmc_clk,
        &macb_clk,
-       // 2dge
+       &twodge_clk,
        &udc_clk,
        &isi_clk,
        &lcdc_clk,
-       // dma
+       &dma_clk,
        &ohci_clk,
        // irq0 .. irq1
 };
@@ -235,6 +273,11 @@ static void at91sam9263_reset(void)
        at91_sys_write(AT91_RSTC_CR, AT91_RSTC_KEY | AT91_RSTC_PROCRST | AT91_RSTC_PERRST);
 }
 
+static void at91sam9263_poweroff(void)
+{
+       at91_sys_write(AT91_SHDW_CR, AT91_SHDW_KEY | AT91_SHDW_SHDW);
+}
+
 
 /* --------------------------------------------------------------------
  *  AT91SAM9263 processor initialization
@@ -246,6 +289,7 @@ void __init at91sam9263_initialize(unsigned long main_clock)
        iotable_init(at91sam9263_io_desc, ARRAY_SIZE(at91sam9263_io_desc));
 
        at91_arch_reset = at91sam9263_reset;
+       pm_power_off = at91sam9263_poweroff;
        at91_extern_irq = (1 << AT91SAM9263_ID_IRQ0) | (1 << AT91SAM9263_ID_IRQ1);
 
        /* Init clock subsystem */
@@ -268,34 +312,34 @@ void __init at91sam9263_initialize(unsigned long main_clock)
 static unsigned int at91sam9263_default_irq_priority[NR_AIC_IRQS] __initdata = {
        7,      /* Advanced Interrupt Controller (FIQ) */
        7,      /* System Peripherals */
-       0,      /* Parallel IO Controller A */
-       0,      /* Parallel IO Controller B */
-       0,      /* Parallel IO Controller C, D and E */
+       1,      /* Parallel IO Controller A */
+       1,      /* Parallel IO Controller B */
+       1,      /* Parallel IO Controller C, D and E */
        0,
        0,
-       6,      /* USART 0 */
-       6,      /* USART 1 */
-       6,      /* USART 2 */
+       5,      /* USART 0 */
+       5,      /* USART 1 */
+       5,      /* USART 2 */
        0,      /* Multimedia Card Interface 0 */
        0,      /* Multimedia Card Interface 1 */
-       4,      /* CAN */
-       0,      /* Two-Wire Interface */
-       6,      /* Serial Peripheral Interface 0 */
-       6,      /* Serial Peripheral Interface 1 */
-       5,      /* Serial Synchronous Controller 0 */
-       5,      /* Serial Synchronous Controller 1 */
-       6,      /* AC97 Controller */
+       3,      /* CAN */
+       6,      /* Two-Wire Interface */
+       5,      /* Serial Peripheral Interface 0 */
+       5,      /* Serial Peripheral Interface 1 */
+       4,      /* Serial Synchronous Controller 0 */
+       4,      /* Serial Synchronous Controller 1 */
+       5,      /* AC97 Controller */
        0,      /* Timer Counter 0, 1 and 2 */
        0,      /* Pulse Width Modulation Controller */
        3,      /* Ethernet */
        0,
        0,      /* 2D Graphic Engine */
-       3,      /* USB Device Port */
+       2,      /* USB Device Port */
        0,      /* Image Sensor Interface */
        3,      /* LDC Controller */
        0,      /* DMA Controller */
        0,
-       3,      /* USB Host port */
+       2,      /* USB Host port */
        0,      /* Advanced Interrupt Controller (IRQ0) */
        0,      /* Advanced Interrupt Controller (IRQ1) */
 };