int do_fastboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { int ret = 1; unsigned long val; /* Initialize the board specific support */ if (0 == fastboot_init(&interface)) { printf ("Fastboot entered...\n"); run_command("setgreenled 50", 0); fastboot_countdown = CFG_FASTBOOT_COUNTDOWN; /* If we got this far, we are a success */ ret = 0; val = getbootmode(); /* On disconnect or error, polling returns non zero */ /* Always delay for fastboot unless we're in bootmode 4002 * or using the "factory" cable */ if((0x4002 != val) && !(__raw_readl(0x48055138) & 0x00100000)){ while (fastboot_countdown) { if (!fastboot_confirmed) { fastboot_countdown--; } if (fastboot_poll()) break; /* if we're holding down the button to get into * recovery, don't wait for the fastboot timeout so we don't * accidentally power off. short circuit 49999/50000 times * through to keep from overwhelming the twl6030 */ if (!(fastboot_countdown % 50000) && (0 == twl6030_get_power_button_status())) { fastboot_wait_power_button_abort = 1; break; } } }else{ while (1) { if (fastboot_poll()) break; } } } /* Reset the board specific support */ fastboot_shutdown(); /* If we're in 4003, go on to OMAP boot over USB */ if(0x4003 == val){ printf ("setting boot sequence first to USB.\nreboot...\n"); set_SWBootingCfg(); } return ret; }
int do_fastboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { int ret = 1; unsigned long val; /* Initialize the board specific support */ if (0 == fastboot_init(&interface)) { showimage(FASTBOOT); printf ("Fastboot entered...\n"); fastboot_countdown = CFG_FASTBOOT_COUNTDOWN; /* If we got this far, we are a success */ ret = 0; val = idme_get_bootmode(); /* On disconnect or error, polling returns non zero */ if((5 == val) && !(__raw_readl(0x48055138) & 0x00100000)){ while (fastboot_countdown) { if (!fastboot_confirmed) { fastboot_countdown--; } if (fastboot_poll()) break; } }else{ while (1) { if (fastboot_poll()) break; } } } /* Reset the board specific support */ fastboot_shutdown(); if(5 == val){ printf ("setting boot sequence first to USB.\nreboot...\n"); set_SWBootingCfg(); } printf ("Fastboot exited...\n"); return ret; }
/* Send a status reply to the client app buffer does not have to be null terminated. buffer_size must be not be larger than what is returned by fastboot_fifo_size Returns 0 on success Returns 1 on failure */ int fastboot_tx_status(const char *buffer, unsigned int buffer_size, const u32 need_sync_flag) { /* fastboot client only reads back at most 64 */ transfer_size = MIN(64, buffer_size); //------------------------------ kdj //printf(" Response - \"%s\" (%d bytes)\n", buffer, buffer_size); reply_msg = buffer; fboot_response_flag=1; if (need_sync_flag) { while(fboot_response_flag) fastboot_poll(); } return 1; }
int do_fastboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { int ret = 1; char fbparts[4096], *env; int check_timeout = 0; uint64_t timeout_endtime = 0; uint64_t timeout_ticks = 0; long timeout_seconds = -1; int continue_from_disconnect = 0; /* * Place the runtime partitions at the end of the * static paritions. First save the start off so * it can be saved from run to run. */ if (static_pcount >= 0) { /* Reset */ pcount = static_pcount; } else { /* Save */ static_pcount = pcount; } env = getenv("fbparts"); if (env) { unsigned int len; len = strlen(env); if (len && len < 4096) { char *s, *e; memcpy(&fbparts[0], env, len + 1); printf("Fastboot: Adding partitions from environment\n"); s = &fbparts[0]; e = s + len; while (s < e) { if (add_partition_from_environment(s, &s)) { printf("Error:Fastboot: Abort adding partitions\n"); /* reset back to static */ pcount = static_pcount; break; } /* Skip a bunch of delimiters */ while (s < e) { if ((' ' == *s) || ('\t' == *s) || ('\n' == *s) || ('\r' == *s) || (',' == *s)) { s++; } else { break; } } } } } /* Time out */ if (2 == argc) { long try_seconds; char *try_seconds_end; /* Check for timeout */ try_seconds = simple_strtol(argv[1], &try_seconds_end, 10); if ((try_seconds_end != argv[1]) && (try_seconds >= 0)) { check_timeout = 1; timeout_seconds = try_seconds; printf("Fastboot inactivity timeout %ld seconds\n", timeout_seconds); } } if (1 == check_timeout) { timeout_ticks = (uint64_t) (timeout_seconds * get_tbclk()); } do { continue_from_disconnect = 0; /* Initialize the board specific support */ if (0 == fastboot_init(&interface)) { int poll_status; /* If we got this far, we are a success */ ret = 0; printf("fastboot initialized\n"); timeout_endtime = get_ticks(); timeout_endtime += timeout_ticks; while (1) { uint64_t current_time = 0; poll_status = fastboot_poll(); if (1 == check_timeout) current_time = get_ticks(); if (FASTBOOT_ERROR == poll_status) { /* Error */ break; } else if (FASTBOOT_DISCONNECT == poll_status) { /* beak, cleanup and re-init */ printf("Fastboot disconnect detected\n"); continue_from_disconnect = 1; break; } else if ((1 == check_timeout) && (FASTBOOT_INACTIVE == poll_status)) { /* No activity */ if (current_time >= timeout_endtime) { printf("Fastboot inactivity detected\n"); break; } } else { /* Something happened */ if (1 == check_timeout) { /* Update the timeout endtime */ timeout_endtime = current_time; timeout_endtime += timeout_ticks; } } /* Check if the user wanted to terminate with ^C */ if ((FASTBOOT_INACTIVE == poll_status) && (ctrlc())) { printf("Fastboot ended by user\n"); break; } /* * Check if the fastboot client wanted to * continue booting */ if (continue_booting) { printf("Fastboot ended by client\n"); break; } /* Check if there is something to upload */ tx_handler(); } } /* Reset the board specific support */ fastboot_shutdown(); /* restart the loop if a disconnect was detected */ } while (continue_from_disconnect); return ret; }
int do_fastboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { int ret = 1; #if defined(CONFIG_MACH_BOWSER_SUBTYPE_TATE) unsigned long val; #endif /* Initialize the board specific support */ if (0 == fastboot_init(&interface)) { printf ("Fastboot entered...\n"); #if defined(CONFIG_FASTBOOT_COUNTDOWN) fastboot_countdown = CFG_FASTBOOT_COUNTDOWN; #endif /* If we got this far, we are a success */ ret = 0; #if defined(CONFIG_MACH_BOWSER_SUBTYPE_TATE) val = getbootmode(); #endif /* On disconnect or error, polling returns non zero */ #if defined(CONFIG_FASTBOOT_COUNTDOWN) if((3 == flag) ){ while (fastboot_countdown--) { if (fastboot_poll()) break; if (fastboot_confirmed == 1) { show_fastboot(); while (1) { if (fastboot_poll()) break; } } else { if (fastboot_poll()) break; } } }else{ show_fastboot(); while (1) { if (fastboot_poll()) break; } } #else show_fastboot(); while (1) { if (fastboot_poll()) break; } #endif } /* Reset the board specific support */ fastboot_shutdown(); #if defined(CONFIG_MACH_BOWSER_SUBTYPE_TATE) if(0x5 == val) { printf ("setting boot sequence first to USB.\nreboot...\n"); set_SWBootingCfg(); } #endif return ret; }