From 9fcb8f5efa8905f5154b93e3fe1f4661cbc59a8a Mon Sep 17 00:00:00 2001 From: Donghwa Lee Date: Thu, 26 Aug 2010 09:04:49 +0900 Subject: [PATCH] s5pc210: universal: support auto download using volume down and hold key --- arch/arm/include/asm/arch-s5pc2xx/gpio.h | 2 +- board/samsung/universal_c210/universal.c | 35 ++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/arch/arm/include/asm/arch-s5pc2xx/gpio.h b/arch/arm/include/asm/arch-s5pc2xx/gpio.h index 1a824db..05e5b3e 100644 --- a/arch/arm/include/asm/arch-s5pc2xx/gpio.h +++ b/arch/arm/include/asm/arch-s5pc2xx/gpio.h @@ -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; diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c index 82d6bfe..4298e53 100644 --- a/board/samsung/universal_c210/universal.c +++ b/board/samsung/universal_c210/universal.c @@ -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; } -- 2.7.4