s5pc210: universal: support auto download using volume down and hold key
authorDonghwa Lee <dh09.lee@samsung.com>
Thu, 26 Aug 2010 00:04:49 +0000 (09:04 +0900)
committerDonghwa Lee <dh09.lee@samsung.com>
Thu, 26 Aug 2010 00:04:49 +0000 (09:04 +0900)
arch/arm/include/asm/arch-s5pc2xx/gpio.h
board/samsung/universal_c210/universal.c

index 1a824db..05e5b3e 100644 (file)
@@ -68,7 +68,7 @@ struct s5pc210_gpio_part2 {
        struct s5p_gpio_bank y4;
        struct s5p_gpio_bank y5;
        struct s5p_gpio_bank y6;
-       struct s5p_gpio_bank res1[50];
+       struct s5p_gpio_bank res1[80];
        struct s5p_gpio_bank x0;
        struct s5p_gpio_bank x1;
        struct s5p_gpio_bank x2;
index 82d6bfe..4298e53 100644 (file)
@@ -207,6 +207,40 @@ static void check_auto_burn(void)
        memset((void *)magic_base, 0, 2);
 }
 
+static int power_key_check(void)
+{
+       unsigned char addr, val[2];
+
+       addr = 0xCC >> 1;
+       i2c_set_bus_num(I2C_5);
+
+       if (i2c_probe(addr)) {
+               puts("Can't found lp3974\n");
+               return 1;
+       }
+
+       /* power_key check */
+       i2c_read(addr, 0x00, 1, val, 1);
+       return (~val[0] & (1 << 6)) >> 6;
+}
+
+static void check_keypad(void)
+{
+       unsigned int val = 0;
+       unsigned int power_key, auto_download = 0;
+       unsigned int base = S5PC210_GPIO_PART2_BASE;
+
+       val = (~readl(&gpio2->x2.dat) & (1 << 1));
+
+       power_key = power_key_check();
+
+       if (power_key && (val && 0x2))
+               auto_download = 1;
+
+       if (auto_download)
+               setenv("bootcmd", "usbdown");
+}
+
 #define LP3974_REG_ONOFF1      0x11
 #define LP3974_REG_ONOFF2      0x12
 #define LP3974_REG_ONOFF3      0x13
@@ -602,6 +636,7 @@ int misc_init_r(void)
        init_pmic_max8952();
 
        check_hw_revision();
+       check_keypad();
 
        return 0;
 }