s5pc1xx: usbd: add watchdog timer reset
authorMinkyu Kang <mk7.kang@samsung.com>
Fri, 12 Mar 2010 04:47:36 +0000 (13:47 +0900)
committerMinkyu Kang <mk7.kang@samsung.com>
Fri, 12 Mar 2010 04:47:36 +0000 (13:47 +0900)
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
common/cmd_usbd.c
cpu/arm_cortexa8/s5pc1xx/usb_downloader.c
include/usbd.h

index 926ea61..0fa4208 100644 (file)
@@ -740,7 +740,11 @@ static int process_data(struct usbd_ops *usbd)
                /* Stop USB */
                usbd->usb_stop();
 
-               do_reset();
+               if (usbd->cpu_reset)
+                       usbd->cpu_reset();
+               else
+                       do_reset();
+
                return 0;
 
        /* Error */
index 62bd04a..ed5f48e 100644 (file)
@@ -47,6 +47,23 @@ extern int s5p_no_lcd_support(void);
 extern void s5pc_fimd_lcd_off(unsigned int win_id);
 extern void s5pc_fimd_window_off(unsigned int win_id);
 
+void s5pc1xx_wdt_reset(void)
+{
+       unsigned long wdt_base;
+
+       if (cpu_is_s5pc110())
+               wdt_base = S5PC110_WATCHDOG_BASE;
+       else
+               wdt_base = S5PC100_WATCHDOG_BASE;
+
+       /*
+        * WTCON
+        * Watchdog timer[5]    : 0(disable) / 1(enable)
+        * Reset[0]             : 0(disable) / 1(enable)
+        */
+       writel((1 << 5) | (1 << 0), wdt_base);
+}
+
 /* clear download informations */
 static void s5p_usb_clear_dnfile_info(void)
 {
@@ -193,6 +210,7 @@ struct usbd_ops *usbd_set_interface(struct usbd_ops *usbd)
 #ifdef CONFIG_GENERIC_MMC
        usbd_set_mmc_dev(usbd);
 #endif
+       usbd->cpu_reset = s5pc1xx_wdt_reset;
 
        return usbd;
 }
index 10e6174..2728ee5 100644 (file)
@@ -116,6 +116,7 @@ struct usbd_ops {
        ulong mmc_total;
 
        void (*set_progress)(int);
+       void (*cpu_reset)(void);
 };
 
 /* This function is interfaced between USB Device Controller and USB Downloader