From 530349908d2cc3e7beb493c09cbca4de37b143fa Mon Sep 17 00:00:00 2001 From: Kyungmin Park Date: Sat, 29 Aug 2009 11:02:32 +0900 Subject: [PATCH] USB: Fix modem partition write Signed-off-by: Kyungmin Park --- common/cmd_usbd.c | 19 +++++++++++++++---- cpu/arm_cortexa8/s5pc1xx/usb_downloader.c | 6 +++--- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/common/cmd_usbd.c b/common/cmd_usbd.c index 84cb16a..51087fe 100644 --- a/common/cmd_usbd.c +++ b/common/cmd_usbd.c @@ -362,7 +362,6 @@ static int process_data(struct usbd_ops *usbd) case COMMAND_PARTITION_SYNC: part_id = arg; - printf("COMMAND_PARTITION_SYNC - Part%d\n", part_id); #ifdef CONFIG_CMD_UBI if (ubi_mode) { if (part_id == RAMDISK_PART_ID || @@ -377,16 +376,17 @@ static int process_data(struct usbd_ops *usbd) get_part_info(); } } +#endif if (part_id == FILESYSTEM3_PART_ID) part_id = get_part_id("UBI", FILESYSTEM_PART_ID); else if (part_id == MODEM_PART_ID) part_id = get_part_id("modem", MODEM_PART_ID); -#endif #ifdef CONFIG_MIRAGE if (part_id) part_id--; #endif + printf("COMMAND_PARTITION_SYNC - Part%d\n", part_id); blocks = parts[part_id]->size / 1024 / 128; printf("COMMAND_PARTITION_SYNC - Part%d, %d blocks\n", @@ -444,7 +444,7 @@ static int process_data(struct usbd_ops *usbd) case COMMAND_WRITE_PART_8: printf("COMMAND_WRITE_MODEM\n"); - part_id = get_part_id("modem", MODEM_PART_ID); + part_id = MODEM_PART_ID; break; case COMMAND_WRITE_UBI_INFO: @@ -539,7 +539,6 @@ static int process_data(struct usbd_ops *usbd) nand_cmd(0, offset, length, NULL); #endif case KERNEL_PART_ID: - case MODEM_PART_ID: sprintf(offset, "%x", parts[part_id]->offset); sprintf(length, "%x", parts[part_id]->size); @@ -557,6 +556,18 @@ static int process_data(struct usbd_ops *usbd) ret = write_file_system(ramaddr, len, offset, length, part_id, ubi_update); break; + + case MODEM_PART_ID: + part_id = get_part_id("modem", MODEM_PART_ID); + + sprintf(offset, "%x", parts[part_id]->offset); + sprintf(length, "%x", parts[part_id]->size); + + /* Erase */ + nand_cmd(0, offset, length, NULL); + /* Write */ + ret = nand_cmd(1, ramaddr, offset, length); + break; default: /* Retry? */ diff --git a/cpu/arm_cortexa8/s5pc1xx/usb_downloader.c b/cpu/arm_cortexa8/s5pc1xx/usb_downloader.c index 47027eb..0279953 100644 --- a/cpu/arm_cortexa8/s5pc1xx/usb_downloader.c +++ b/cpu/arm_cortexa8/s5pc1xx/usb_downloader.c @@ -40,12 +40,12 @@ extern int s5p_receive_done; extern int s5p_usb_connected; extern otg_dev_t otg; -int __usb_board_init(void) +static int __usb_board_init(void) { return 0; } -int usb_board_init(void) - __attribute__((weak, alias("__usb_board_init"))); + +int usb_board_init(void) __attribute__((weak, alias("__usb_board_init"))); /* This function is interfaced between * USB Device Controller and USB Downloader -- 2.7.4