All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] sh: rsk7203: Add support pkt_data_pull and pkt_data_push function
Date: Thu, 28 Aug 2008 13:40:52 +0900	[thread overview]
Message-ID: <48B62C54.20103@renesas.com> (raw)

Add function of smc911x, pkt_data_pull and pkt_data_push.

Signed-off-by: Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>
---
 board/rsk7203/rsk7203.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/board/rsk7203/rsk7203.c b/board/rsk7203/rsk7203.c
index beb943e..99cc10a 100644
--- a/board/rsk7203/rsk7203.c
+++ b/board/rsk7203/rsk7203.c
@@ -48,3 +48,23 @@ int dram_init(void)
 void led_set_state(unsigned short value)
 {
 }
+
+/*
+ * The RSK board has the SMSC9118 wired up 'incorrectly'.
+ * Byte-swapping is necessary, and so poor performance is inevitable.
+ * This problem cannot evade by the swap function of CHIP, this can
+ * evade by software Byte-swapping.
+ * And this has problem by FIFO access only. pkt_data_pull/pkt_data_push
+ * functions necessary to solve this problem.
+ */
+u32 pkt_data_pull(u32 addr)
+{
+	volatile u16 *addr_16 = (u16 *)addr;
+	return (((swab16(*addr_16) << 16) & 0xFFFF0000)|swab16(*(addr_16 + 1)));
+}
+
+void pkt_data_push(u32 addr, u32 val)
+{
+	*(volatile u16 *)(addr + 2) = swab16((u16)val);
+	*(volatile u16 *)(addr) = swab16((u16)(val >> 16));
+}
-- 
1.5.6.3

                 reply	other threads:[~2008-08-28  4:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=48B62C54.20103@renesas.com \
    --to=iwamatsu.nobuhiro@renesas.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.