usbd: Add modem ubi image checking
authorJoonyoung Shim <jy0922.shim@samsung.com>
Tue, 12 Oct 2010 10:20:39 +0000 (19:20 +0900)
committerJoonyoung Shim <jy0922.shim@samsung.com>
Tue, 12 Oct 2010 10:29:21 +0000 (19:29 +0900)
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
common/cmd_usbd.c

index 16fb02c..945717e 100644 (file)
@@ -1108,6 +1108,14 @@ static int process_data(struct usbd_ops *usbd)
                sprintf(offset, "%x", parts[part_id]->offset);
                sprintf(length, "%x", parts[part_id]->size);
 
+               /* Check ubi image, 0x23494255 is UBI# */
+               {
+                       long *img_header = (long *)down_ram_addr;
+
+                       if (*img_header == 0x23494255)
+                               goto ubi_img;
+               }
+
                /* Erase */
                if (!arg)
                        nand_cmd(0, offset, length, NULL);
@@ -1164,6 +1172,8 @@ static int process_data(struct usbd_ops *usbd)
 
                len = (unsigned int) ubi_dest_size;
 #endif
+
+ubi_img:
                /* Write : arg (0 Modem) / (1 CSA) */
                if (!arg) {
                        sprintf(length, "%x", (unsigned int) len);