summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfang hui <hui.fang@nxp.com>2016-09-21 13:02:07 +0800
committerfang hui <hui.fang@nxp.com>2016-09-21 13:15:54 +0800
commita2b5fb188a81337336a4fd0989a00e79fd755e2b (patch)
treeb1ad315872e773b57296fe0b0d50644c7cd5721d
parent79290e222f8c8212dbaeb89a96f8b003a4383ff5 (diff)
downloadu-boot-imx-a2b5fb188a81337336a4fd0989a00e79fd755e2b.zip
u-boot-imx-a2b5fb188a81337336a4fd0989a00e79fd755e2b.tar.gz
u-boot-imx-a2b5fb188a81337336a4fd0989a00e79fd755e2b.tar.bz2
MA-8757 - support "fastboot update"
Get valid serialno. Product name should be set according to the special board. The default name set to "NXP i.MX", For picoimx board, use "picoimx". Signed-off-by: fang hui <hui.fang@nxp.com>
-rw-r--r--drivers/usb/gadget/f_fastboot.c23
-rw-r--r--include/configs/picosom-imx6ul.h2
2 files changed, 23 insertions, 2 deletions
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 1fd551c..7ece685 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -2258,6 +2258,25 @@ static int get_block_size(void)
return dev_desc->blksz;
}
+
+static char *get_serial(void)
+{
+#ifdef CONFIG_SERIAL_TAG
+ struct tag_serialnr serialnr;
+ static char serial[32];
+ get_board_serial(&serialnr);
+ sprintf(serial, "%08x%08x", serialnr.high, serialnr.low);
+
+ return serial;
+#else
+ return NULL;
+#endif
+}
+
+#if !defined(PRODUCT_NAME)
+#define PRODUCT_NAME "NXP i.MX"
+#endif
+
static void cb_getvar(struct usb_ep *ep, struct usb_request *req)
{
char *cmd = req->buf;
@@ -2336,13 +2355,13 @@ static void cb_getvar(struct usb_ep *ep, struct usb_request *req)
sprintf(str_num, "0x%08x", CONFIG_USB_FASTBOOT_BUF_SIZE);
strncat(response, str_num, chars_left);
} else if (!strcmp_l1("serialno", cmd)) {
- s = getenv("serial#");
+ s = get_serial();
if (s)
strncat(response, s, chars_left);
else
strcpy(response, "FAILValue not set");
} else if (!strcmp_l1("product", cmd)) {
- strncat(response, "Freescale i.MX", chars_left);
+ strncat(response, PRODUCT_NAME, chars_left);
}
#ifdef CONFIG_FASTBOOT_LOCK
else if (!strcmp_l1("secure", cmd)) {
diff --git a/include/configs/picosom-imx6ul.h b/include/configs/picosom-imx6ul.h
index 5056a47..b169eef 100644
--- a/include/configs/picosom-imx6ul.h
+++ b/include/configs/picosom-imx6ul.h
@@ -391,4 +391,6 @@
#define CONFIG_USB_FASTBOOT_BUF_SIZE 0xc800000
#endif
+#define PRODUCT_NAME "picoimx"
+
#endif