]> git.kernelconcepts.de Git - mv-sheeva.git/commitdiff
Add pm_power_off() to call IPM for cutting power (and formatting cleanups)
authorNils Faerber <nils.faerber@kernelconcepts.de>
Thu, 27 Jan 2011 11:14:32 +0000 (12:14 +0100)
committerNils Faerber <nils.faerber@kernelconcepts.de>
Thu, 27 Jan 2011 11:14:32 +0000 (12:14 +0100)
arch/arm/mach-mv78xx0/rdstor-setup.c

index 648d362be15fad9ffd57d74f76783574fe89cc22..9b6121436c7aedb7a8f86b6c535f234df0c2419c 100644 (file)
@@ -78,11 +78,11 @@ static unsigned int rdstor_mpp_config[] __initdata = {
  * GigE
  */
 static struct mv643xx_eth_platform_data db78x00_ge00_data = {
-       .phy_addr       = MV643XX_ETH_PHY_ADDR(0 /*8*/),
+       .phy_addr       = MV643XX_ETH_PHY_ADDR(0),
 };
 
 static struct mv643xx_eth_platform_data db78x00_ge01_data = {
-       .phy_addr       = MV643XX_ETH_PHY_ADDR(1 /*9*/),
+       .phy_addr       = MV643XX_ETH_PHY_ADDR(1),
 };
 
 
@@ -131,19 +131,19 @@ static struct mtd_partition rdstor_nand_parts[] = {
                .name = "nand-kernel",
                .offset = 0,
                .size = SZ_4M,
-               // .mask_flags = MTD_WRITEABLE
+               /* .mask_flags = MTD_WRITEABLE */
        },
        {
                .name = "nand-kernel-fallback",
                .offset = MTDPART_OFS_APPEND,
                .size = SZ_4M,
-               // .mask_flags = MTD_WRITEABLE
+               /* .mask_flags = MTD_WRITEABLE */
        },
        {
                .name = "nand-rootfs",
                .offset = MTDPART_OFS_APPEND,
                .size = MTDPART_SIZ_FULL,
-               // .mask_flags = MTD_WRITEABLE
+               /* .mask_flags = MTD_WRITEABLE */
        }
 };
 
@@ -211,13 +211,13 @@ static struct mtd_partition rdstor_nor_parts[] = {
                .name = "nor-user",
                .offset = 0,
                .size = 0x3f60000,
-               //.mask_flags = MTD_WRITEABLE
+               /* .mask_flags = MTD_WRITEABLE */
        },
        {
                .name = "nor-uboot-env",
                .offset = MTDPART_OFS_APPEND,
                .size = 0x20000,
-               // .mask_flags = MTD_WRITEABLE
+               /* .mask_flags = MTD_WRITEABLE */
        },
        {
                .name = "nor-uboot",
@@ -251,7 +251,7 @@ static struct mtd_partition rdstor_dataflash_partitions[] = {
                .name = "dataflash",
                .offset = 0,
                .size = MTDPART_SIZ_FULL,
-               // .mask_flags = MTD_WRITEABLE
+               /* .mask_flags = MTD_WRITEABLE */
        }
 };
 
@@ -272,6 +272,38 @@ static struct spi_board_info rdstor_spi_devices[] = {
        },
 };
 
+static void rdstor_poweroff(void)
+{
+       struct i2c_msg msg;
+       struct i2c_adapter *adap = i2c_get_adapter(1);
+       unsigned char buf[2];
+
+       if (!adap) {
+               printk(KERN_ERR "I2C adapter 1 not found\n");
+               return;
+       }
+
+       buf[0] = 0x01;  /* cmd arg offset */
+       buf[1] = 0x00;  /* 0 seconds delay */
+       msg.addr = 0x38;
+       msg.flags = 0;
+       msg.len = 2;
+       msg.buf = buf;
+
+       i2c_transfer(adap, &msg, 1);
+
+       printk(KERN_INFO "RDStor powering off...\n");
+
+       buf[0] = 0x00;  /* cmd offset */
+       buf[1] = 0x02;  /* shutdown cmd */
+       msg.addr = 0x38;
+       msg.flags = 0;
+       msg.len = 2;
+       msg.buf = buf;
+
+       i2c_transfer(adap, &msg, 1);
+}
+
 static void __init db78x00_init(void)
 {
        /*
@@ -288,6 +320,7 @@ static void __init db78x00_init(void)
         * all peripherals are assigned to core #0.
         */
        if (mv78xx0_core_index() == 0) {
+               /* first CPU core */
                mv78xx0_uart0_init();
                mv78xx0_uart1_init();
                mv78xx0_uart2_init();
@@ -331,8 +364,10 @@ static void __init db78x00_init(void)
 
                mv78xx0_xor0_init();
 
-               mv78xx0_wdt_init();
+               /* mv78xx0_wdt_init(); */
+               pm_power_off = rdstor_poweroff;
        } else {
+               /* second CPU core */
        }
 }