[USB] add ramdisk boot mode
authorMinkyu Kang <mk7.kang@samsung.com>
Wed, 17 Jun 2009 07:26:58 +0000 (16:26 +0900)
committerMinkyu Kang <mk7.kang@samsung.com>
Wed, 17 Jun 2009 07:26:58 +0000 (16:26 +0900)
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
common/cmd_usbd.c
include/configs/s5pc100_universal.h
include/usbd.h

index e932b07..5db3dae 100644 (file)
@@ -142,6 +142,12 @@ static void boot_cmd(char *addr)
        do_bootm(NULL, 0, 2, argv);
 }
 
+static void run_cmd(char *cmd)
+{
+       char *argv[] = { "run", cmd };
+       do_run(NULL, 0, 2, argv);
+}
+
 #if defined(CONFIG_CMD_NAND)
 extern int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
 #elif defined(CONFIG_CMD_ONENAND)
@@ -470,6 +476,18 @@ static int process_data(struct usbd_ops *usbd)
                boot_cmd(ramaddr);
                return 0;
 
+       case COMMAND_RAMDISK_MODE:
+               printf("COMMAND_RAMDISK_MODE\n");
+#ifdef CONFIG_RAMDISK_ADDR
+               if (arg) {
+                       down_ram_addr = usbd->ram_addr;
+               } else {
+                       down_ram_addr = CONFIG_RAMDISK_ADDR;
+                       run_cmd("ramboot");
+               }
+#endif
+               return 1;
+
 #ifdef CONFIG_DOWN_PHONE
        case COMMAND_DOWN_PHONE:
                printf("COMMAND_RESET_PHONE\n");
index 451a29f..95fdfd5 100644 (file)
 #define CONFIG_SAMSUNG_USB
 #define CONFIG_OTG_CLK_OSCC
 #define CONFIG_SYS_DOWN_ADDR   CONFIG_SYS_SDRAM_BASE
+#define CONFIG_RAMDISK_ADDR    0x23000000
 
 #endif /* __CONFIG_H */
index 99b4bb7..87b6de9 100644 (file)
@@ -45,6 +45,7 @@ enum {
 #define COMMAND_RESET_PDA      214
 #define COMMAND_RESET_USB      215
 #define COMMAND_RAM_BOOT       216
+#define COMMAND_RAMDISK_MODE   217
 #ifdef CONFIG_DOWN_PHONE
 #define COMMAND_DOWN_PHONE     220
 #define COMMAND_CHANGE_USB     221
@@ -52,16 +53,16 @@ enum {
 
 /*
  * USB Downloader Operations
- * usb_init            : initialize the USB Controller and check the connection
- * usb_stop            : stop and release USB
+ * usb_init    : initialize the USB Controller and check the connection
+ * usb_stop    : stop and release USB
  * send_data   : send the data (BULK ONLY!!)
  * recv_data   : receive the data and returns received size (BULK ONLY!!)
  * recv_setup  : setup download address, length and DMA setting for receive
- * tx_data             : send data address
- * rx_data             : receive data address
- * tx_len              : size of send data
- * rx_len              : size of receive data
- * ram_addr            : address of will be stored data on RAM
+ * tx_data     : send data address
+ * rx_data     : receive data address
+ * tx_len      : size of send data
+ * rx_len      : size of receive data
+ * ram_addr    : address of will be stored data on RAM
  */
 struct usbd_ops {
        void (*usb_init) (void);