From: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] rtl8169: fix PCI system memory address
Date: Wed, 25 Feb 2009 14:27:29 +0900 [thread overview]
Message-ID: <49A4D6C1.2010806@renesas.com> (raw)
When PCI device use system memory, some PCI host controller should be
set physical memory address.
Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
---
drivers/net/rtl8169.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/drivers/net/rtl8169.c b/drivers/net/rtl8169.c
index b441ec4..4eee97f 100644
--- a/drivers/net/rtl8169.c
+++ b/drivers/net/rtl8169.c
@@ -110,6 +110,9 @@ static int media[MAX_UNITS] = { -1, -1, -1, -1, -1, -1, -1, -1 };
#define ETH_ALEN MAC_ADDR_LEN
#define ETH_ZLEN 60
+#define bus_to_phys(a) pci_mem_to_phys((pci_dev_t)dev->priv, (pci_addr_t)a)
+#define phys_to_bus(a) pci_phys_to_mem((pci_dev_t)dev->priv, (phys_addr_t)a)
+
enum RTL8169_registers {
MAC0 = 0, /* Ethernet hardware address. */
MAR0 = 8, /* Multicast filter. */
@@ -438,7 +441,7 @@ static int rtl_recv(struct eth_device *dev)
tpc->RxDescArray[cur_rx].status =
cpu_to_le32(OWNbit + RX_BUF_SIZE);
tpc->RxDescArray[cur_rx].buf_addr =
- cpu_to_le32((unsigned long)tpc->RxBufferRing[cur_rx]);
+ cpu_to_le32(bus_to_phys(tpc->RxBufferRing[cur_rx]));
flush_cache((unsigned long)tpc->RxBufferRing[cur_rx],
RX_BUF_SIZE);
} else {
@@ -488,7 +491,7 @@ static int rtl_send(struct eth_device *dev, volatile void *packet, int length)
ptxb[len++] = '\0';
tpc->TxDescArray[entry].buf_Haddr = 0;
- tpc->TxDescArray[entry].buf_addr = cpu_to_le32((unsigned long)ptxb);
+ tpc->TxDescArray[entry].buf_addr = cpu_to_le32(bus_to_phys(ptxb));
if (entry != (NUM_TX_DESC - 1)) {
tpc->TxDescArray[entry].status =
cpu_to_le32((OWNbit | FSbit | LSbit) |
@@ -593,9 +596,9 @@ static void rtl8169_hw_start(struct eth_device *dev)
tpc->cur_rx = 0;
- RTL_W32(TxDescStartAddrLow, (unsigned long)tpc->TxDescArray);
+ RTL_W32(TxDescStartAddrLow, bus_to_phys(tpc->TxDescArray));
RTL_W32(TxDescStartAddrHigh, (unsigned long)0);
- RTL_W32(RxDescStartAddrLow, (unsigned long)tpc->RxDescArray);
+ RTL_W32(RxDescStartAddrLow, bus_to_phys(tpc->RxDescArray));
RTL_W32(RxDescStartAddrHigh, (unsigned long)0);
/* RTL-8169sc/8110sc or later version */
@@ -646,7 +649,7 @@ static void rtl8169_init_ring(struct eth_device *dev)
tpc->RxBufferRing[i] = &rxb[i * RX_BUF_SIZE];
tpc->RxDescArray[i].buf_addr =
- cpu_to_le32((unsigned long)tpc->RxBufferRing[i]);
+ cpu_to_le32(bus_to_phys(tpc->RxBufferRing[i]));
flush_cache((unsigned long)tpc->RxBufferRing[i], RX_BUF_SIZE);
}
--
1.5.5
reply other threads:[~2009-02-25 5:27 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=49A4D6C1.2010806@renesas.com \
--to=shimoda.yoshihiro@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox