summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorNitin Garg <nitin.garg@freescale.com>2012-12-11 11:10:36 -0600
committerNitin Garg <nitin.garg@freescale.com>2012-12-11 11:10:36 -0600
commitd31df11541ea0d1a0bf1ed7463fd30a25b65f98c (patch)
tree993a632a3ffa39be0f042fb036d1db53633aac16 /board
parent07663772b10318e3d7f0aa3e410f0ff840780806 (diff)
downloadu-boot-imx-d31df11541ea0d1a0bf1ed7463fd30a25b65f98c.zip
u-boot-imx-d31df11541ea0d1a0bf1ed7463fd30a25b65f98c.tar.gz
u-boot-imx-d31df11541ea0d1a0bf1ed7463fd30a25b65f98c.tar.bz2
ENGR00236620: Add Android fastboot and recovery reboot support
Add support for Android fastboot and recovery reboot commands for iMX5. Signed-off-by: Nitin Garg <nitin.garg@freescale.com>
Diffstat (limited to 'board')
-rw-r--r--board/freescale/mx53_smd/mx53_smd.c92
1 files changed, 10 insertions, 82 deletions
diff --git a/board/freescale/mx53_smd/mx53_smd.c b/board/freescale/mx53_smd/mx53_smd.c
index f3a5bb2..73dc165 100644
--- a/board/freescale/mx53_smd/mx53_smd.c
+++ b/board/freescale/mx53_smd/mx53_smd.c
@@ -70,6 +70,7 @@
#include <linux/mtd/partitions.h>
#include <ubi_uboot.h>
#include <jffs2/load_kernel.h>
+#define GPIO_VOL_DN_KEY 14
#endif
DECLARE_GLOBAL_DATA_PTR;
@@ -1286,100 +1287,27 @@ int board_init(void)
int check_recovery_cmd_file(void)
{
- disk_partition_t info;
int button_pressed = 0;
- ulong part_length;
- int filelen = 0;
- char *env;
+ int recovery_mode = 0;
u32 reg;
- int i;
- /* For test only */
- /* When detecting android_recovery_switch,
- * enter recovery mode directly */
- env = getenv("android_recovery_switch");
- if (!strcmp(env, "1")) {
- printf("Env recovery detected!\nEnter recovery mode!\n");
- return 1;
- }
+ /* Enter Recovery Mode if Recovery Switch is set. */
+ recovery_mode = check_and_clean_recovery_flag();
- printf("Checking for recovery command file...\n");
- switch (get_boot_device()) {
- case MMC_BOOT:
- case SD_BOOT:
- {
- for (i = 0; i < 2; i++) {
- block_dev_desc_t *dev_desc = NULL;
- struct mmc *mmc = find_mmc_device(i);
-
- dev_desc = get_dev("mmc", i);
-
- if (NULL == dev_desc) {
- printf("** Block device MMC %d not supported\n", i);
- continue;
- }
-
- mmc_init(mmc);
-
- if (get_partition_info(dev_desc,
- CONFIG_ANDROID_CACHE_PARTITION_MMC,
- &info)) {
- printf("** Bad partition %d **\n",
- CONFIG_ANDROID_CACHE_PARTITION_MMC);
- continue;
- }
-
- part_length = ext2fs_set_blk_dev(dev_desc,
- CONFIG_ANDROID_CACHE_PARTITION_MMC);
- if (part_length == 0) {
- printf("** Bad partition - mmc %d:%d **\n", i,
- CONFIG_ANDROID_CACHE_PARTITION_MMC);
- ext2fs_close();
- continue;
- }
-
- if (!ext2fs_mount(part_length)) {
- printf("** Bad ext2 partition or "
- "disk - mmc %d:%d **\n",
- i, CONFIG_ANDROID_CACHE_PARTITION_MMC);
- ext2fs_close();
- continue;
- }
-
- filelen = ext2fs_open(CONFIG_ANDROID_RECOVERY_CMD_FILE);
-
- ext2fs_close();
- break;
- }
- }
- break;
- case NAND_BOOT:
- return 0;
- break;
- case SPI_NOR_BOOT:
- return 0;
- break;
- case UNKNOWN_BOOT:
- default:
- return 0;
- break;
- }
-
- /* Check Recovery Combo Button press or not.
- * @TODO: Need At least Two key, but in SMD board,
- * only can use one Volume key. */
+ /* Check Recovery Combo Button press or not. */
mxc_request_iomux(MX53_PIN_ATA_DATA14, IOMUX_CONFIG_ALT1);
+ /* Set GPIO direction to INPUT */
reg = readl(GPIO2_BASE_ADDR + GPIO_GDIR);
- reg &= ~(1<<14);
+ reg &= ~(1 << GPIO_VOL_DN_KEY);
writel(reg, GPIO2_BASE_ADDR + GPIO_GDIR);
+ /* Read GPIO status */
reg = readl(GPIO2_BASE_ADDR + GPIO_PSR);
- if (!(reg & (1 << 14))) { /* Vol - is low assert */
+ if (!(reg & (1 << GPIO_VOL_DN_KEY))) { /* Vol - is low assert */
button_pressed = 1;
printf("Recovery key pressed\n");
}
- return (filelen > 0 || button_pressed);
-
+ return recovery_mode || button_pressed;
}
#endif