Merge branch 'master' of git://www.denx.de/git/u-boot-mpc83xx
[oweals/u-boot.git] / common / cmd_ide.c
index 6a67dd69f31d3674c93b1413efcec315181028f4..cac99d5fe765e866c4df2af085b21a4db6977530 100644 (file)
 # include <status_led.h>
 #endif
 
-#ifndef __PPC__
-#include <asm/io.h>
-#endif
-
 #ifdef CONFIG_IDE_8xx_DIRECT
 DECLARE_GLOBAL_DATA_PTR;
 #endif
@@ -470,9 +466,11 @@ int do_diskboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
        case IMAGE_FORMAT_FIT:
                fit_hdr = (const void *)addr;
                if (!fit_check_format (fit_hdr)) {
+                       show_boot_progress (-140);
                        puts ("** Bad FIT image format\n");
                        return 1;
                }
+               show_boot_progress (141);
                puts ("Fit image detected...\n");
 
                cnt = fit_get_size (fit_hdr);
@@ -1262,7 +1260,7 @@ ulong ide_read (int device, lbaint_t blknr, ulong blkcnt, void *buffer)
 #ifdef CONFIG_LBA48
        unsigned char lba48 = 0;
 
-       if (blknr & 0x0000fffff0000000) {
+       if (blknr & 0x0000fffff0000000ULL) {
                /* more than 28 bits used, use 48bit mode */
                lba48 = 1;
        }
@@ -1316,8 +1314,13 @@ ulong ide_read (int device, lbaint_t blknr, ulong blkcnt, void *buffer)
                        /* write high bits */
                        ide_outb (device, ATA_SECT_CNT, 0);
                        ide_outb (device, ATA_LBA_LOW,  (blknr >> 24) & 0xFF);
+#ifdef CFG_64BIT_LBA
                        ide_outb (device, ATA_LBA_MID,  (blknr >> 32) & 0xFF);
                        ide_outb (device, ATA_LBA_HIGH, (blknr >> 40) & 0xFF);
+#else
+                       ide_outb (device, ATA_LBA_MID,  0);
+                       ide_outb (device, ATA_LBA_HIGH, 0);
+#endif
                }
 #endif
                ide_outb (device, ATA_SECT_CNT, 1);
@@ -1381,7 +1384,7 @@ ulong ide_write (int device, lbaint_t blknr, ulong blkcnt, void *buffer)
 #ifdef CONFIG_LBA48
        unsigned char lba48 = 0;
 
-       if (blknr & 0x0000fffff0000000) {
+       if (blknr & 0x0000fffff0000000ULL) {
                /* more than 28 bits used, use 48bit mode */
                lba48 = 1;
        }
@@ -1406,8 +1409,13 @@ ulong ide_write (int device, lbaint_t blknr, ulong blkcnt, void *buffer)
                        /* write high bits */
                        ide_outb (device, ATA_SECT_CNT, 0);
                        ide_outb (device, ATA_LBA_LOW,  (blknr >> 24) & 0xFF);
+#ifdef CFG_64BIT_LBA
                        ide_outb (device, ATA_LBA_MID,  (blknr >> 32) & 0xFF);
                        ide_outb (device, ATA_LBA_HIGH, (blknr >> 40) & 0xFF);
+#else
+                       ide_outb (device, ATA_LBA_MID,  0);
+                       ide_outb (device, ATA_LBA_HIGH, 0);
+#endif
                }
 #endif
                ide_outb (device, ATA_SECT_CNT, 1);
@@ -1527,6 +1535,9 @@ static void ide_reset (void)
 
        ide_set_reset (1); /* assert reset */
 
+       /* the reset signal shall be asserted for et least 25 us */
+       udelay(25);
+
        WATCHDOG_RESET();
 
 #ifdef CFG_PB_12V_ENABLE