Better working USB bootloader mode for H300

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12514 a1c6a512-1295-4272-9138-f99709370657
diff --git a/bootloader/main.c b/bootloader/main.c
index 27e3a8b..930a67c 100644
--- a/bootloader/main.c
+++ b/bootloader/main.c
@@ -501,16 +501,6 @@
 
     usb_init();
 
-    rc = ata_init();
-    if(rc)
-    {
-        reset_screen();
-        printf("ATA error: %d", rc);
-        printf("Insert USB cable and press");
-        printf("a button");
-        while(!(button_get(true) & BUTTON_REL));
-    }
-
     /* A hack to enter USB mode without using the USB thread */
     if(usb_detect())
     {
@@ -521,10 +511,6 @@
         lcd_putsxy((LCD_WIDTH-w)/2, (LCD_HEIGHT-h)/2, msg);
         lcd_update();
 
-#ifdef IRIVER_H300_SERIES
-        sleep(HZ);
-#endif
-
 #ifdef HAVE_EEPROM_SETTINGS
         if (firmware_settings.initialized)
         {
@@ -532,8 +518,9 @@
             eeprom_settings_store();
         }
 #endif
-        ata_spin();
+        ide_power_enable(true);
         ata_enable(false);
+        sleep(HZ/20);
         usb_enable(true);
         cpu_idle_mode(true);
         while (usb_detect())
@@ -551,12 +538,22 @@
 
         cpu_idle_mode(false);
         usb_enable(false);
-        ata_init(); /* Reinitialize ATA and continue booting */
 
         reset_screen();
         lcd_update();
     }
 
+    rc = ata_init();
+    if(rc)
+    {
+        reset_screen();
+        printf("ATA error: %d", rc);
+        printf("Insert USB cable and press");
+        printf("a button");
+        while(!(button_get(true) & BUTTON_REL));
+    }
+
+
     disk_init();
 
     rc = disk_mount_all();