public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Pavel Herrmann <morpheus.ibis@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 09/10] split PCS440EP specific code from cmd_ide.c
Date: Sun,  7 Oct 2012 17:56:13 +0200	[thread overview]
Message-ID: <1349625374-12391-10-git-send-email-morpheus.ibis@gmail.com> (raw)
In-Reply-To: <1349625374-12391-1-git-send-email-morpheus.ibis@gmail.com>

Move specific ide_input_data and friends to board-specific file.

Signed-off-by: Pavel Herrmann <morpheus.ibis@gmail.com>
---
 board/pcs440ep/pcs440ep.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++
 common/cmd_ide.c          | 18 ---------------
 2 files changed, 56 insertions(+), 18 deletions(-)

diff --git a/board/pcs440ep/pcs440ep.c b/board/pcs440ep/pcs440ep.c
index 52da053..f8345dd 100644
--- a/board/pcs440ep/pcs440ep.c
+++ b/board/pcs440ep/pcs440ep.c
@@ -32,6 +32,7 @@
 #include <sha1.h>
 #include <asm/io.h>
 #include <net.h>
+#include <ata.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -713,3 +714,58 @@ void ide_set_reset (int idereset)
 	udelay (10000);
 }
 #endif /* defined (CONFIG_CMD_IDE) && defined (CONFIG_IDE_RESET) */
+
+
+/* this is motly the same as it should, causing a little code duplication */
+#if defined(CONFIG_CMD_IDE)
+#define EIEIO		__asm__ volatile ("eieio")
+
+void ide_input_swap_data(int dev, ulong *sect_buf, int words)
+{
+	volatile ushort *pbuf =
+		(ushort *) (ATA_CURR_BASE(dev) + ATA_DATA_REG);
+	ushort *dbuf = (ushort *) sect_buf;
+
+	debug("in input swap data base for read is %lx\n",
+		(unsigned long) pbuf);
+
+	while (words--) {
+		*dbuf++ = *pbuf;
+		*dbuf++ = *pbuf;
+	}
+}
+
+void ide_output_data(int dev, const ulong *sect_buf, int words)
+{
+	ushort *dbuf;
+	volatile ushort *pbuf;
+
+	pbuf = (ushort *) (ATA_CURR_BASE(dev) + ATA_DATA_REG);
+	dbuf = (ushort *) sect_buf;
+	while (words--) {
+		EIEIO;
+		*pbuf = ld_le16(dbuf++);
+		EIEIO;
+		*pbuf = ld_le16(dbuf++);
+	}
+}
+
+void ide_input_data(int dev, ulong *sect_buf, int words)
+{
+	ushort *dbuf;
+	volatile ushort *pbuf;
+
+	pbuf = (ushort *) (ATA_CURR_BASE(dev) + ATA_DATA_REG);
+	dbuf = (ushort *) sect_buf;
+
+	debug("in input data base for read is %lx\n", (unsigned long) pbuf);
+
+	while (words--) {
+		EIEIO;
+		*dbuf++ = ld_le16(pbuf);
+		EIEIO;
+		*dbuf++ = ld_le16(pbuf);
+	}
+}
+
+#endif
diff --git a/common/cmd_ide.c b/common/cmd_ide.c
index 7c8f866..4f3ff54 100644
--- a/common/cmd_ide.c
+++ b/common/cmd_ide.c
@@ -522,9 +522,6 @@ void __ide_input_swap_data(int dev, ulong *sect_buf, int words)
 #ifdef __MIPS__
 		*dbuf++ = swab16p((u16 *) pbuf);
 		*dbuf++ = swab16p((u16 *) pbuf);
-#elif defined(CONFIG_PCS440EP)
-		*dbuf++ = *pbuf;
-		*dbuf++ = *pbuf;
 #else
 		*dbuf++ = ld_le16(pbuf);
 		*dbuf++ = ld_le16(pbuf);
@@ -543,18 +540,10 @@ void __ide_output_data(int dev, const ulong *sect_buf, int words)
 	pbuf = (ushort *) (ATA_CURR_BASE(dev) + ATA_DATA_REG);
 	dbuf = (ushort *) sect_buf;
 	while (words--) {
-#if defined(CONFIG_PCS440EP)
-		/* not tested, because CF was write protected */
-		EIEIO;
-		*pbuf = ld_le16(dbuf++);
-		EIEIO;
-		*pbuf = ld_le16(dbuf++);
-#else
 		EIEIO;
 		*pbuf = *dbuf++;
 		EIEIO;
 		*pbuf = *dbuf++;
-#endif
 	}
 }
 #else  /* ! CONFIG_IDE_SWAP_IO */
@@ -580,17 +569,10 @@ void __ide_input_data(int dev, ulong *sect_buf, int words)
 	debug("in input data base for read is %lx\n", (unsigned long) pbuf);
 
 	while (words--) {
-#if defined(CONFIG_PCS440EP)
-		EIEIO;
-		*dbuf++ = ld_le16(pbuf);
-		EIEIO;
-		*dbuf++ = ld_le16(pbuf);
-#else
 		EIEIO;
 		*dbuf++ = *pbuf;
 		EIEIO;
 		*dbuf++ = *pbuf;
-#endif
 	}
 }
 #else  /* ! CONFIG_IDE_SWAP_IO */
-- 
1.7.12

  parent reply	other threads:[~2012-10-07 15:56 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-07 15:56 [U-Boot] [PATCH 00/10] IDE code cleanup Pavel Herrmann
2012-10-07 15:56 ` [U-Boot] [PATCH 01/10] remove CONFIG_SC3 from cmd_ide.c Pavel Herrmann
2012-10-17 15:02   ` [U-Boot] [U-Boot,01/10] " Tom Rini
2012-10-07 15:56 ` [U-Boot] [PATCH 02/10] split mpc8xx hooks " Pavel Herrmann
2012-10-07 18:09   ` Marek Vasut
2012-10-07 18:09   ` Marek Vasut
2012-10-09 17:01   ` [U-Boot] [PATCH v2 " Pavel Herrmann
2012-10-07 15:56 ` [U-Boot] [PATCH 03/10] split IVM power " Pavel Herrmann
2012-10-07 15:56 ` [U-Boot] [PATCH 04/10] change all versions of input_data() and output_data() to global weak aliases Pavel Herrmann
2012-10-07 18:14   ` Marek Vasut
2012-10-09 13:42     ` Pavel Herrmann
2012-10-09 17:13       ` Marek Vasut
2012-10-09 17:04   ` [U-Boot] [PATCH v2 " Pavel Herrmann
2012-10-07 15:56 ` [U-Boot] [PATCH 05/10] split CPC45 board-specific IDE functions from cmd_ide.c Pavel Herrmann
2012-10-07 18:20   ` Marek Vasut
2012-10-09 13:38     ` Pavel Herrmann
2012-10-09 17:13       ` Marek Vasut
2012-10-07 15:56 ` [U-Boot] [PATCH 06/10] make ide_led() a weak alias Pavel Herrmann
2012-10-07 15:56 ` [U-Boot] [PATCH 07/10] move CPC45 ide_led to the same file as other IDE hooks Pavel Herrmann
2012-10-07 18:21   ` Marek Vasut
2012-10-09 17:06   ` [U-Boot] [PATCH v2 " Pavel Herrmann
2012-10-07 15:56 ` [U-Boot] [PATCH 08/10] split AU1X00 specific code from cmd_ide.c Pavel Herrmann
2012-10-08 23:38   ` Tom Rini
2012-10-09 13:35     ` Pavel Herrmann
2012-10-09 17:10   ` [U-Boot] [PATCH v2 " Pavel Herrmann
2012-10-07 15:56 ` Pavel Herrmann [this message]
2012-10-07 15:56 ` [U-Boot] [PATCH 10/10] remove unnecessary includes " Pavel Herrmann
2012-10-07 18:23 ` [U-Boot] [PATCH 00/10] IDE code cleanup Marek Vasut

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1349625374-12391-10-git-send-email-morpheus.ibis@gmail.com \
    --to=morpheus.ibis@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox