summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorJimmy Zhang <jimmzhang@nvidia.com>2016-03-14 19:42:47 -0700
committerStephen Warren <swarren@nvidia.com>2016-03-15 11:16:07 -0600
commitcb6a710e0452d45376b3460e454a271bbd212fdf (patch)
tree1548af9c91284e29bdcbd71e98d94fffbb9d021f /src/main.c
parent918e0fd8fce2b4450686e2bd0effceb73b33f2ae (diff)
downloadtegrarcm-cb6a710e0452d45376b3460e454a271bbd212fdf.tar.gz
Add option --usb-timeout=<value>
RCM communication sometimes fails if the USB timeout is short. The default timeout is 1000ms. Increasing the timeout value may avoid this issue. The exact cause is not yet diagnosed. This patch implements a --usb-timeout option to allow the value to be configured. A value of 0 means unlimited timeout. Example: $ sudo tegrarcm --bct=jetson-tk1-bct.bct --bootloader=u-boot.bin \ --loadaddr=0x83d88000 --pkc=rsa_priv.der --usb-timeout=5000 Signed-off-by: Jimmy Zhang <jimmzhang@nvidia.com> (swarren, commit description fixes) Signed-off-by: Stephen Warren <swarren@nvidia.com>
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 57cd2d8..f20ab3a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -87,6 +87,7 @@ static void set_platform_info(nv3p_platform_info_t *info);
static uint32_t get_op_mode(void);
static nv3p_platform_info_t *g_platform_info = NULL;
+extern uint32_t usb_timeout;
enum cmdline_opts {
OPT_BCT,
@@ -105,6 +106,7 @@ enum cmdline_opts {
OPT_SIGNED_MSGS_FILE,
OPT_SOC,
OPT_DOWNLOAD_SIGNED_MSGS,
+ OPT_USB_TIMEOUT,
OPT_END,
};
@@ -155,6 +157,8 @@ static void usage(char *progname)
fprintf(stderr, "\t\tSpecify Tegra SoC chip model number, ie, 124.\n");
fprintf(stderr, "\t--download-signed-msgs\n");
fprintf(stderr, "\t\tDownload signed messages\n");
+ fprintf(stderr, "\t--usb-timeout=<timeout_ms>\n");
+ fprintf(stderr, "\t\tSpecify usb transfer timeout value in ms, 0 for unlimited timeout\n");
fprintf(stderr, "\n");
}
@@ -259,6 +263,7 @@ int main(int argc, char **argv)
[OPT_SIGNED_MSGS_FILE] = {"signed-msgs-file", 1, 0, 0},
[OPT_SOC] = {"soc", 1, 0, 0},
[OPT_DOWNLOAD_SIGNED_MSGS] = {"download-signed-msgs", 0, 0, 0},
+ [OPT_USB_TIMEOUT] = {"usb-timeout", 1, 0, 0},
[OPT_END] = {0, 0, 0, 0}
};
// parse command line args
@@ -316,6 +321,9 @@ int main(int argc, char **argv)
case OPT_DOWNLOAD_SIGNED_MSGS:
download_signed_msgs = true;
break;
+ case OPT_USB_TIMEOUT:
+ usb_timeout = strtoul(optarg, NULL, 0);
+ break;
case OPT_HELP:
default:
usage(argv[0]);