summaryrefslogtreecommitdiff
path: root/drivers/fastboot
diff options
context:
space:
mode:
authorSammy He <r62914@freescale.com>2011-01-27 21:57:04 +0800
committerSammy He <r62914@freescale.com>2011-01-28 01:16:58 +0800
commita069e6b2ca7e8f0ad39375ca12bec11bb0d41ba4 (patch)
tree29f6e3d6a7b3c29b679a45e813ac4be87be5ecb0 /drivers/fastboot
parente5a0219ac0190ec7ed472f515987bcfaee2cfb9c (diff)
downloadu-boot-imx-a069e6b2ca7e8f0ad39375ca12bec11bb0d41ba4.zip
u-boot-imx-a069e6b2ca7e8f0ad39375ca12bec11bb0d41ba4.tar.gz
u-boot-imx-a069e6b2ca7e8f0ad39375ca12bec11bb0d41ba4.tar.bz2
ENGR00138549 Android fastboot: Support eMMC4.4 on imx53_smdrel_imx_2.6.35_11.01.00
Support eMMC4.4 storage on imx53_smd android fastboot, using environment to control it, the command is: > setenv fastboot_dev mmc1 Signed-off-by: Sammy He <r62914@freescale.com>
Diffstat (limited to 'drivers/fastboot')
-rw-r--r--drivers/fastboot/fastboot.c58
1 files changed, 45 insertions, 13 deletions
diff --git a/drivers/fastboot/fastboot.c b/drivers/fastboot/fastboot.c
index 36e7474..6613550 100644
--- a/drivers/fastboot/fastboot.c
+++ b/drivers/fastboot/fastboot.c
@@ -81,6 +81,8 @@ enum {
PTN_RECOVERY_INDEX
};
+struct fastboot_device_info fastboot_devinfo;
+
/* defined and used by gadget/ep0.c */
extern struct usb_string_descriptor **usb_strings;
@@ -229,6 +231,26 @@ static void str2wide(char *str, u16 * wide)
}
/*
+ Get mmc control number from passed string, eg, "mmc1" mean device 1. Only
+ support "mmc0" to "mmc9" currently. It will be treated as device 0 for
+ other string.
+*/
+static int get_mmc_no(char *env_str)
+{
+ int digit = 0;
+ unsigned char a;
+
+ if (env_str && (strlen(env_str) >= 4) &&
+ !strncmp(env_str, "mmc", 3)) {
+ a = env_str[3];
+ if (a >= '0' && a <= '9')
+ digit = a - '0';
+ }
+
+ return digit;
+}
+
+/*
* Initialize fastboot
*/
int fastboot_init(struct cmd_fastboot_interface *interface)
@@ -269,19 +291,9 @@ static int fastboot_init_mmc_sata_ptable(void)
fastboot_ptentry ptable[PTN_RECOVERY_INDEX + 1];
fastboot_env = getenv("fastboot_dev");
- if ((fastboot_env == NULL) || strcmp(fastboot_env, "sata")) {
- puts("flash target is SD card\n");
- mmc = find_mmc_device(CONFIG_FASTBOOT_MMC_NO);
- if (mmc && mmc_init(mmc))
- printf("MMC card init failed!\n");
-
- dev_desc = get_dev("mmc", CONFIG_FASTBOOT_MMC_NO);
- if (NULL == dev_desc) {
- printf("** Block device MMC %d not supported\n",
- CONFIG_FASTBOOT_MMC_NO);
- return -1;
- }
- } else {
+ /* sata case in env */
+ if (fastboot_env && !strcmp(fastboot_env, "sata")) {
+ fastboot_devinfo.type = DEV_SATA;
#ifdef CONFIG_CMD_SATA
puts("flash target is SATA\n");
if (sata_initialize())
@@ -297,6 +309,25 @@ static int fastboot_init_mmc_sata_ptable(void)
puts("SATA isn't buildin\n");
return -1;
#endif
+ } else {
+ int mmc_no = 0;
+
+ mmc_no = get_mmc_no(fastboot_env);
+
+ fastboot_devinfo.type = DEV_MMC;
+ fastboot_devinfo.dev_id = mmc_no;
+
+ printf("flash target is MMC:%d\n", mmc_no);
+ mmc = find_mmc_device(mmc_no);
+ if (mmc && mmc_init(mmc))
+ printf("MMC card init failed!\n");
+
+ dev_desc = get_dev("mmc", mmc_no);
+ if (NULL == dev_desc) {
+ printf("** Block device MMC %d not supported\n",
+ mmc_no);
+ return -1;
+ }
}
memset((char *)ptable, 0,
@@ -724,3 +755,4 @@ int fastboot_cdc_setup(struct usb_device_request *request, struct urb *urb)
{
return 0;
}
+