]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
split CPC45 board-specific IDE functions from cmd_ide.c
authorPavel Herrmann <morpheus.ibis@gmail.com>
Sun, 7 Oct 2012 05:56:09 +0000 (05:56 +0000)
committerTom Rini <trini@ti.com>
Wed, 17 Oct 2012 14:59:08 +0000 (07:59 -0700)
Move input_data() and friends to board/cpc45/ide.c, as overrides for weak
aliases in cmd_ide.c

note: checkpatch emits warnings about using volatile

Signed-off-by: Pavel Herrmann <morpheus.ibis@gmail.com>
board/cpc45/Makefile
board/cpc45/ide.c [new file with mode: 0644]
common/cmd_ide.c

index 5c6b78f704616f9730634a5cf9ad150c963e309d..ac1d17440f2a22d6c31128c6de33ef06a4e7d985 100644 (file)
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
 
 LIB    = $(obj)lib$(BOARD).o
 
-COBJS  = $(BOARD).o flash.o plx9030.o pd67290.o
+COBJS  = $(BOARD).o flash.o plx9030.o pd67290.o ide.o
 
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(COBJS))
diff --git a/board/cpc45/ide.c b/board/cpc45/ide.c
new file mode 100644 (file)
index 0000000..7b7237b
--- /dev/null
@@ -0,0 +1,130 @@
+/*
+ * (C) Copyright 2001
+ * Rob Taylor, Flying Pig Systems. robt@flyingpig.com.
+ *
+ * (C) Copyright 2000-2011
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <ide.h>
+#include <ata.h>
+
+#define EIEIO          __asm__ volatile ("eieio")
+#define SYNC           __asm__ volatile ("sync")
+
+void ide_input_swap_data(int dev, ulong *sect_buf, int words)
+{
+       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);
+       ushort *dbuf = (ushort *) sect_buf;
+
+       while (words--) {
+               for (i = 0; i < 2; i++) {
+                       *(((uchar *) (dbuf)) + 1) = *pbuf_even;
+                       *(uchar *) dbuf = *pbuf_odd;
+                       dbuf += 1;
+               }
+       }
+}
+
+void ide_input_data(int dev, ulong *sect_buf, int words)
+{
+       uchar *dbuf;
+       volatile uchar *pbuf_even;
+       volatile uchar *pbuf_odd;
+
+       pbuf_even = (uchar *) (ATA_CURR_BASE(dev) + ATA_DATA_EVEN);
+       pbuf_odd = (uchar *) (ATA_CURR_BASE(dev) + ATA_DATA_ODD);
+       dbuf = (uchar *) sect_buf;
+       while (words--) {
+               *dbuf++ = *pbuf_even;
+               EIEIO;
+               SYNC;
+               *dbuf++ = *pbuf_odd;
+               EIEIO;
+               SYNC;
+               *dbuf++ = *pbuf_even;
+               EIEIO;
+               SYNC;
+               *dbuf++ = *pbuf_odd;
+               EIEIO;
+               SYNC;
+       }
+}
+
+void ide_input_data_shorts(int dev, ushort *sect_buf, int shorts)
+{
+       uchar *dbuf;
+       volatile uchar *pbuf_even;
+       volatile uchar *pbuf_odd;
+
+       pbuf_even = (uchar *) (ATA_CURR_BASE(dev) + ATA_DATA_EVEN);
+       pbuf_odd = (uchar *) (ATA_CURR_BASE(dev) + ATA_DATA_ODD);
+       dbuf = (uchar *) sect_buf;
+       while (shorts--) {
+               EIEIO;
+               *dbuf++ = *pbuf_even;
+               EIEIO;
+               *dbuf++ = *pbuf_odd;
+       }
+}
+
+void ide_output_data(int dev, const ulong *sect_buf, int words)
+{
+       uchar *dbuf;
+       volatile uchar *pbuf_even;
+       volatile uchar *pbuf_odd;
+
+       pbuf_even = (uchar *) (ATA_CURR_BASE(dev) + ATA_DATA_EVEN);
+       pbuf_odd = (uchar *) (ATA_CURR_BASE(dev) + ATA_DATA_ODD);
+       dbuf = (uchar *) sect_buf;
+       while (words--) {
+               EIEIO;
+               *pbuf_even = *dbuf++;
+               EIEIO;
+               *pbuf_odd = *dbuf++;
+               EIEIO;
+               *pbuf_even = *dbuf++;
+               EIEIO;
+               *pbuf_odd = *dbuf++;
+       }
+}
+
+void ide_output_data_shorts(int dev, ushort *sect_buf, int shorts)
+{
+       uchar *dbuf;
+       volatile uchar *pbuf_even;
+       volatile uchar *pbuf_odd;
+
+       pbuf_even = (uchar *) (ATA_CURR_BASE(dev) + ATA_DATA_EVEN);
+       pbuf_odd = (uchar *) (ATA_CURR_BASE(dev) + ATA_DATA_ODD);
+       dbuf = (uchar *) sect_buf;
+       while (shorts--) {
+               EIEIO;
+               *pbuf_even = *dbuf++;
+               EIEIO;
+               *pbuf_odd = *dbuf++;
+       }
+}
index b9feb8046a112dc7f3557517470b1939368ad615..ab790f67537d7de4e9a78a98bbc84cc01c3d8881 100644 (file)
@@ -500,22 +500,6 @@ void __ide_input_swap_data(int dev, ulong *sect_buf, int words)
 #else
 void __ide_input_swap_data(int dev, ulong *sect_buf, int words)
 {
-#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);
-       ushort *dbuf = (ushort *) sect_buf;
-
-       while (words--) {
-               for (i = 0; i < 2; i++) {
-                       *(((uchar *) (dbuf)) + 1) = *pbuf_even;
-                       *(uchar *) dbuf = *pbuf_odd;
-                       dbuf += 1;
-               }
-       }
-#else
        volatile ushort *pbuf =
                (ushort *) (ATA_CURR_BASE(dev) + ATA_DATA_REG);
        ushort *dbuf = (ushort *) sect_buf;
@@ -535,7 +519,6 @@ void __ide_input_swap_data(int dev, ulong *sect_buf, int words)
                *dbuf++ = ld_le16(pbuf);
 #endif /* !MIPS */
        }
-#endif
 }
 #endif /* __LITTLE_ENDIAN || CONFIG_AU1X00 */
 
@@ -543,25 +526,6 @@ void __ide_input_swap_data(int dev, ulong *sect_buf, int words)
 #if defined(CONFIG_IDE_SWAP_IO)
 void __ide_output_data(int dev, const ulong *sect_buf, int words)
 {
-#if defined(CONFIG_CPC45)
-       uchar *dbuf;
-       volatile uchar *pbuf_even;
-       volatile uchar *pbuf_odd;
-
-       pbuf_even = (uchar *) (ATA_CURR_BASE(dev) + ATA_DATA_EVEN);
-       pbuf_odd = (uchar *) (ATA_CURR_BASE(dev) + ATA_DATA_ODD);
-       dbuf = (uchar *) sect_buf;
-       while (words--) {
-               EIEIO;
-               *pbuf_even = *dbuf++;
-               EIEIO;
-               *pbuf_odd = *dbuf++;
-               EIEIO;
-               *pbuf_even = *dbuf++;
-               EIEIO;
-               *pbuf_odd = *dbuf++;
-       }
-#else
        ushort *dbuf;
        volatile ushort *pbuf;
 
@@ -581,7 +545,6 @@ void __ide_output_data(int dev, const ulong *sect_buf, int words)
                *pbuf = *dbuf++;
 #endif
        }
-#endif
 }
 #else  /* ! CONFIG_IDE_SWAP_IO */
 void __ide_output_data(int dev, const ulong *sect_buf, int words)
@@ -597,29 +560,6 @@ void __ide_output_data(int dev, const ulong *sect_buf, int words)
 #if defined(CONFIG_IDE_SWAP_IO)
 void __ide_input_data(int dev, ulong *sect_buf, int words)
 {
-#if defined(CONFIG_CPC45)
-       uchar *dbuf;
-       volatile uchar *pbuf_even;
-       volatile uchar *pbuf_odd;
-
-       pbuf_even = (uchar *) (ATA_CURR_BASE(dev) + ATA_DATA_EVEN);
-       pbuf_odd = (uchar *) (ATA_CURR_BASE(dev) + ATA_DATA_ODD);
-       dbuf = (uchar *) sect_buf;
-       while (words--) {
-               *dbuf++ = *pbuf_even;
-               EIEIO;
-               SYNC;
-               *dbuf++ = *pbuf_odd;
-               EIEIO;
-               SYNC;
-               *dbuf++ = *pbuf_even;
-               EIEIO;
-               SYNC;
-               *dbuf++ = *pbuf_odd;
-               EIEIO;
-               SYNC;
-       }
-#else
        ushort *dbuf;
        volatile ushort *pbuf;
 
@@ -641,7 +581,6 @@ void __ide_input_data(int dev, ulong *sect_buf, int words)
                *dbuf++ = *pbuf;
 #endif
        }
-#endif
 }
 #else  /* ! CONFIG_IDE_SWAP_IO */
 void __ide_input_data(int dev, ulong *sect_buf, int words)
@@ -1254,20 +1193,6 @@ void ide_output_data_shorts(int dev, ushort *sect_buf, int shorts)
  * we have our own transfer functions, 2 bytes alligned */
 void __ide_output_data_shorts(int dev, ushort *sect_buf, int shorts)
 {
-#if defined(CONFIG_CPC45)
-       uchar *dbuf;
-       volatile uchar *pbuf_even;
-       volatile uchar *pbuf_odd;
-
-       pbuf_even = (uchar *) (ATA_CURR_BASE(dev) + ATA_DATA_EVEN);
-       pbuf_odd = (uchar *) (ATA_CURR_BASE(dev) + ATA_DATA_ODD);
-       while (shorts--) {
-               EIEIO;
-               *pbuf_even = *dbuf++;
-               EIEIO;
-               *pbuf_odd = *dbuf++;
-       }
-#else
        ushort *dbuf;
        volatile ushort *pbuf;
 
@@ -1281,25 +1206,10 @@ void __ide_output_data_shorts(int dev, ushort *sect_buf, int shorts)
                EIEIO;
                *pbuf = *dbuf++;
        }
-#endif
 }
 
 void __ide_input_data_shorts(int dev, ushort *sect_buf, int shorts)
 {
-#if defined(CONFIG_CPC45)
-       uchar *dbuf;
-       volatile uchar *pbuf_even;
-       volatile uchar *pbuf_odd;
-
-       pbuf_even = (uchar *) (ATA_CURR_BASE(dev) + ATA_DATA_EVEN);
-       pbuf_odd = (uchar *) (ATA_CURR_BASE(dev) + ATA_DATA_ODD);
-       while (shorts--) {
-               EIEIO;
-               *dbuf++ = *pbuf_even;
-               EIEIO;
-               *dbuf++ = *pbuf_odd;
-       }
-#else
        ushort *dbuf;
        volatile ushort *pbuf;
 
@@ -1313,7 +1223,6 @@ void __ide_input_data_shorts(int dev, ushort *sect_buf, int shorts)
                EIEIO;
                *dbuf++ = *pbuf;
        }
-#endif
 }
 
 #else  /* ! CONFIG_IDE_SWAP_IO */