common: Enable serial for PXA250
[oweals/u-boot.git] / common / cmd_ide.c
index d486697bb4aa70ec335d40d22df31db4c53bd519..ea0f4a718592e2f52f1906a3d58808a5af551553 100644 (file)
@@ -25,6 +25,7 @@
 /*
  * IDE support
  */
+
 #include <common.h>
 #include <config.h>
 #include <watchdog.h>
 #include <mpc5xxx.h>
 #endif
 
+#ifdef CONFIG_ORION5X
+#include <asm/arch/orion5x.h>
+#elif defined CONFIG_KIRKWOOD
+#include <asm/arch/kirkwood.h>
+#endif
+
 #include <ide.h>
 #include <ata.h>
 
@@ -179,8 +186,7 @@ int do_ide (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
     switch (argc) {
     case 0:
     case 1:
-       cmd_usage(cmdtp);
-       return 1;
+       return cmd_usage(cmdtp);
     case 2:
        if (strncmp(argv[1],"res",3) == 0) {
                puts ("\nReset IDE"
@@ -229,8 +235,7 @@ int do_ide (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                }
                return rcode;
        }
-       cmd_usage(cmdtp);
-       return 1;
+       return cmd_usage(cmdtp);
     case 3:
        if (strncmp(argv[1],"dev",3) == 0) {
                int dev = (int)simple_strtoul(argv[2], NULL, 10);
@@ -278,8 +283,7 @@ int do_ide (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 #endif
        }
 
-       cmd_usage(cmdtp);
-       return 1;
+       return cmd_usage(cmdtp);
     default:
        /* at least 4 args */
 
@@ -332,14 +336,12 @@ int do_ide (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
                printf ("%ld blocks written: %s\n",
                        n, (n==cnt) ? "OK" : "ERROR");
-               if (n==cnt) {
+               if (n==cnt)
                        return 0;
-               } else {
+               else
                        return 1;
-               }
        } else {
-               cmd_usage(cmdtp);
-               rcode = 1;
+               return cmd_usage(cmdtp);
        }
 
        return rcode;
@@ -374,9 +376,8 @@ int do_diskboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                boot_device = argv[2];
                break;
        default:
-               cmd_usage(cmdtp);
                show_boot_progress (-42);
-               return 1;
+               return cmd_usage(cmdtp);
        }
        show_boot_progress (42);
 
@@ -817,7 +818,7 @@ set_pcmcia_timing (int pmode)
 static void
 input_swap_data(int dev, ulong *sect_buf, int words)
 {
-#if defined(CONFIG_HMI10) || defined(CONFIG_CPC45)
+#if defined(CONFIG_CPC45)
        uchar i;
        volatile uchar *pbuf_even = (uchar *)(ATA_CURR_BASE(dev)+ATA_DATA_EVEN);
        volatile uchar *pbuf_odd  = (uchar *)(ATA_CURR_BASE(dev)+ATA_DATA_ODD);
@@ -853,11 +854,11 @@ input_swap_data(int dev, ulong *sect_buf, int words)
 #endif /* __LITTLE_ENDIAN || CONFIG_AU1X00 */
 
 
-#if defined(__PPC__) || defined(CONFIG_PXA_PCMCIA) || defined(CONFIG_SH)
+#if defined(CONFIG_IDE_SWAP_IO)
 static void
 output_data(int dev, ulong *sect_buf, int words)
 {
-#if defined(CONFIG_HMI10) || defined(CONFIG_CPC45)
+#if defined(CONFIG_CPC45)
        uchar   *dbuf;
        volatile uchar  *pbuf_even;
        volatile uchar  *pbuf_odd;
@@ -897,19 +898,19 @@ output_data(int dev, ulong *sect_buf, int words)
        }
 #endif
 }
-#else  /* ! __PPC__ */
+#else  /* ! CONFIG_IDE_SWAP_IO */
 static void
 output_data(int dev, ulong *sect_buf, int words)
 {
        outsw(ATA_CURR_BASE(dev)+ATA_DATA_REG, sect_buf, words<<1);
 }
-#endif /* __PPC__ */
+#endif /* CONFIG_IDE_SWAP_IO */
 
-#if defined(__PPC__) || defined(CONFIG_PXA_PCMCIA) || defined(CONFIG_SH)
+#if defined(CONFIG_IDE_SWAP_IO)
 static void
 input_data(int dev, ulong *sect_buf, int words)
 {
-#if defined(CONFIG_HMI10) || defined(CONFIG_CPC45)
+#if defined(CONFIG_CPC45)
        uchar   *dbuf;
        volatile uchar  *pbuf_even;
        volatile uchar  *pbuf_odd;
@@ -955,14 +956,14 @@ input_data(int dev, ulong *sect_buf, int words)
        }
 #endif
 }
-#else  /* ! __PPC__ */
+#else  /* ! CONFIG_IDE_SWAP_IO */
 static void
 input_data(int dev, ulong *sect_buf, int words)
 {
        insw(ATA_CURR_BASE(dev)+ATA_DATA_REG, sect_buf, words << 1);
 }
 
-#endif /* __PPC__ */
+#endif /* CONFIG_IDE_SWAP_IO */
 
 /* -------------------------------------------------------------------------
  */
@@ -1543,7 +1544,6 @@ static void ide_reset (void)
 
 #if defined(CONFIG_IDE_LED)    && \
    !defined(CONFIG_CPC45)      && \
-   !defined(CONFIG_HMI10)      && \
    !defined(CONFIG_KUP4K)      && \
    !defined(CONFIG_KUP4X)
 
@@ -1579,13 +1579,13 @@ int ide_device_present(int dev)
  * ATAPI Support
  */
 
-#if defined(__PPC__) || defined(CONFIG_PXA_PCMCIA)
+#if defined(CONFIG_IDE_SWAP_IO)
 /* since ATAPI may use commands with not 4 bytes alligned length
  * we have our own transfer functions, 2 bytes alligned */
 static void
 output_data_shorts(int dev, ushort *sect_buf, int shorts)
 {
-#if defined(CONFIG_HMI10) || defined(CONFIG_CPC45)
+#if defined(CONFIG_CPC45)
        uchar   *dbuf;
        volatile uchar  *pbuf_even;
        volatile uchar  *pbuf_odd;
@@ -1617,7 +1617,7 @@ output_data_shorts(int dev, ushort *sect_buf, int shorts)
 static void
 input_data_shorts(int dev, ushort *sect_buf, int shorts)
 {
-#if defined(CONFIG_HMI10) || defined(CONFIG_CPC45)
+#if defined(CONFIG_CPC45)
        uchar   *dbuf;
        volatile uchar  *pbuf_even;
        volatile uchar  *pbuf_odd;
@@ -1646,7 +1646,7 @@ input_data_shorts(int dev, ushort *sect_buf, int shorts)
 #endif
 }
 
-#else  /* ! __PPC__ */
+#else  /* ! CONFIG_IDE_SWAP_IO */
 static void
 output_data_shorts(int dev, ushort *sect_buf, int shorts)
 {
@@ -1659,7 +1659,7 @@ input_data_shorts(int dev, ushort *sect_buf, int shorts)
        insw(ATA_CURR_BASE(dev)+ATA_DATA_REG, sect_buf, shorts);
 }
 
-#endif /* __PPC__ */
+#endif /* CONFIG_IDE_SWAP_IO */
 
 /*
  * Wait until (Status & mask) == res, or timeout (in ms)