public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Lucas Jin <lucasjin@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [patch] fix bugs in rtl8139.c
Date: Mon, 15 Oct 2007 22:40:14 +0800	[thread overview]
Message-ID: <200710152239511864357@gmail.com> (raw)

Signed-off-by: Lucas Jin <lucasjin@gmail.com>

bug 1: "rx_ring" and "tx_buffer" are in local memory space, so they shouldn't be translated by "phys_to_bus".

bug 2: macro KSEG1ADDR is just for MIPS, so we can use "le32_to_cpu" as a common way.

------------------------------

--- ./drivers/rtl8139.c.orig	2007-10-12 22:17:52.000000000 +0800
+++ ./drivers/rtl8139.c	2007-10-15 22:46:59.991316984 +0800
@@ -76,6 +76,7 @@
 #include <net.h>
 #include <asm/io.h>
 #include <pci.h>
+#include <linux/byteorder/generic.h>
 
 #if (CONFIG_COMMANDS & CFG_CMD_NET) && defined(CONFIG_NET_MULTI) && \
 	defined(CONFIG_RTL8139)
@@ -383,7 +384,7 @@
 #ifdef	DEBUG_RX
 	printf("rx ring address is %X\n",(unsigned long)rx_ring);
 #endif
-	outl(phys_to_bus((int)rx_ring), ioaddr + RxBuf);
+	outl((int)rx_ring, ioaddr + RxBuf);
 
 	/* If we add multicast support, the MAR0 register would have to be
 	 * initialized to 0xffffffffffffffff (two 32 bit accesses).  Etherboot
@@ -423,7 +424,7 @@
 		tx_buffer[len++] = '\0';
 	}
 
-	outl(phys_to_bus((int)tx_buffer), ioaddr + TxAddr0 + cur_tx*4);
+	outl((int)tx_buffer, ioaddr + TxAddr0 + cur_tx*4);
 	outl(((TX_FIFO_THRESH<<11) & 0x003f0000) | len,
 		ioaddr + TxStatus0 + cur_tx*4);
 
@@ -480,7 +481,7 @@
 #endif
 
 	ring_offs = cur_rx % RX_BUF_LEN;
-	rx_status = *(unsigned int*)KSEG1ADDR((rx_ring + ring_offs));
+	rx_status = le32_to_cpu(*(unsigned int*)(rx_ring + ring_offs));
 	rx_size = rx_status >> 16;
 	rx_status &= 0xffff;
 
 				
--------------
Lucas Jin

                 reply	other threads:[~2007-10-15 14: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=200710152239511864357@gmail.com \
    --to=lucasjin@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