usbd: support bootloader downloading on MMC raw sector
authorMinkyu Kang <mk7.kang@samsung.com>
Wed, 1 Dec 2010 06:16:35 +0000 (15:16 +0900)
committerMinkyu Kang <mk7.kang@samsung.com>
Wed, 1 Dec 2010 06:16:35 +0000 (15:16 +0900)
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
common/cmd_usbd.c
include/usbd.h

index eba0950..e47b755 100644 (file)
@@ -1019,10 +1019,8 @@ static int process_data(struct usbd_ops *usbd)
 
        case COMMAND_WRITE_IMG_1:
                printf("COMMAND_WRITE_BOOTLOADER\n");
-               /* TODO: Not support yet, just return */
-               *((ulong *) usbd->tx_data) = STATUS_DONE;
-               usbd->send_data(usbd->tx_data, usbd->tx_len);
-               return 1;
+               img_type = IMG_BOOTLOADER;
+               break;
 
        case COMMAND_WRITE_IMG_2:
                printf("COMMAND_WRITE_KERNEL\n");
@@ -1345,6 +1343,12 @@ out:
                set_mbr_info(usbd, (char *)down_ram_addr, len);
                break;
 
+       case IMG_BOOTLOADER:
+               sprintf(offset, "0x%x", 0x80);
+               sprintf(length, "0x%x", len / usbd->mmc_blk + 1);
+               ret = mmc_cmd(OPS_WRITE, ramaddr, offset, length);
+               break;
+
        default:
                /* Retry? */
                write_part--;
index d7d0ba4..685921a 100644 (file)
@@ -38,6 +38,7 @@ enum {
        IMG_MMC,
        IMG_V2,
        IMG_MBR,
+       IMG_BOOTLOADER, /* bootloader on mmc raw sector */
 };
 
 /* Download command definition */