Merge branch 'master' of git://git.denx.de/u-boot-usb
diff --git a/board/trizepsiv/eeprom.c b/board/trizepsiv/eeprom.c
index 63f1c6c..9fa7aef 100644
--- a/board/trizepsiv/eeprom.c
+++ b/board/trizepsiv/eeprom.c
@@ -23,17 +23,17 @@
 
 #include <common.h>
 #include <command.h>
-
-extern u16 read_srom_word(int);
-extern void write_srom_word(int offset, u16 val);
+#include <dm9000.h>
 
 static int do_read_dm9000_eeprom ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) {
-	int i;
+	unsigned int i;
+	u8 data[2];
 
 	for (i=0; i < 0x40; i++) {
 		if (!(i % 0x10))
-			printf("\n%08lx:", i);
-		printf(" %04x", read_srom_word(i));
+			printf("\n%08x:", i);
+		dm9000_read_srom_word(i, data);
+		printf(" %02x%02x", data[1], data[0]);
 	}
 	printf ("\n");
 	return (0);
@@ -54,7 +54,7 @@
 		cmd_usage(cmdtp);
 		return 1;
 	}
-	write_srom_word(offset, value);
+	dm9000_write_srom_word(offset, value);
 	return (0);
 }
 
diff --git a/drivers/net/4xx_enet.c b/drivers/net/4xx_enet.c
index 918373b..7bf3e0a 100644
--- a/drivers/net/4xx_enet.c
+++ b/drivers/net/4xx_enet.c
@@ -871,6 +871,7 @@
     defined(CONFIG_440SP) || defined(CONFIG_440SPE) || \
     defined(CONFIG_460EX) || defined(CONFIG_460GT) || \
     defined(CONFIG_405EX)
+	u32 opbfreq;
 	sys_info_t sysinfo;
 #if defined(CONFIG_440GX) || defined(CONFIG_440SPE) || \
     defined(CONFIG_440EPX) || defined(CONFIG_440GRX) || \
@@ -997,12 +998,13 @@
 	/* Whack the M1 register */
 	mode_reg = 0x0;
 	mode_reg &= ~0x00000038;
-	if (sysinfo.freqOPB <= 50000000);
-	else if (sysinfo.freqOPB <= 66666667)
+	opbfreq = sysinfo.freqOPB / 1000000;
+	if (opbfreq <= 50);
+	else if (opbfreq <= 66)
 		mode_reg |= EMAC_M1_OBCI_66;
-	else if (sysinfo.freqOPB <= 83333333)
+	else if (opbfreq <= 83)
 		mode_reg |= EMAC_M1_OBCI_83;
-	else if (sysinfo.freqOPB <= 100000000)
+	else if (opbfreq <= 100)
 		mode_reg |= EMAC_M1_OBCI_100;
 	else
 		mode_reg |= EMAC_M1_OBCI_GT100;
diff --git a/drivers/net/dm9000x.c b/drivers/net/dm9000x.c
index 8ca2bf7..f139435 100644
--- a/drivers/net/dm9000x.c
+++ b/drivers/net/dm9000x.c
@@ -53,7 +53,7 @@
 			  notes (i.e. double reset)
 			- some minor code cleanups
 			These changes are tested with DM9000{A,EP,E} together
-			with a 200MHz Atmel AT91SAM92161 core
+			with a 200MHz Atmel AT91SAM9261 core
 
 TODO: external MII is not functional, only internal at the moment.
 */
@@ -62,6 +62,7 @@
 #include <command.h>
 #include <net.h>
 #include <asm/io.h>
+#include <dm9000.h>
 
 #include "dm9000x.h"
 
@@ -113,7 +114,6 @@
 static int dm9000_probe(void);
 static u16 phy_read(int);
 static void phy_write(int, u16);
-static void read_srom_word(int, u8 *);
 static u8 DM9000_ior(int);
 static void DM9000_iow(int reg, u8 value);
 
@@ -347,9 +347,9 @@
 
 	/* Set Node address */
 	if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
-#if !defined(CONFIG_AT91SAM9261EK)
+#if !defined(CONFIG_DM9000_NO_SROM)
 		for (i = 0; i < 3; i++)
-			read_srom_word(i, enetaddr + 2 * i);
+			dm9000_read_srom_word(i, enetaddr + 2 * i);
 		eth_setenv_enetaddr("ethaddr", enetaddr);
 #endif
 	}
@@ -541,7 +541,8 @@
 /*
   Read a word data from SROM
 */
-static void read_srom_word(int offset, u8 *to)
+#if !defined(CONFIG_DM9000_NO_SROM)
+void dm9000_read_srom_word(int offset, u8 *to)
 {
 	DM9000_iow(DM9000_EPAR, offset);
 	DM9000_iow(DM9000_EPCR, 0x4);
@@ -551,8 +552,7 @@
 	to[1] = DM9000_ior(DM9000_EPDRH);
 }
 
-void
-write_srom_word(int offset, u16 val)
+void dm9000_write_srom_word(int offset, u16 val)
 {
 	DM9000_iow(DM9000_EPAR, offset);
 	DM9000_iow(DM9000_EPDRH, ((val >> 8) & 0xff));
@@ -561,7 +561,7 @@
 	udelay(8000);
 	DM9000_iow(DM9000_EPCR, 0);
 }
-
+#endif
 
 /*
    Read a byte from I/O port
diff --git a/drivers/net/rtl8169.c b/drivers/net/rtl8169.c
index 83a05b4..e45d1a5 100644
--- a/drivers/net/rtl8169.c
+++ b/drivers/net/rtl8169.c
@@ -110,6 +110,9 @@
 #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 @@
 				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 @@
 		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 @@
 
 	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 @@
 
 		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);
 	}
 
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index 8c9a2a8..455b055 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -117,6 +117,27 @@
 	return 0;
 }
 
+static void smc911x_shutdown(void)
+{
+	unsigned int cr;
+
+	/* Turn of Rx and TX */
+	cr = smc911x_get_mac_csr(MAC_CR);
+	cr &= ~(MAC_CR_TXEN | MAC_CR_RXEN | MAC_CR_HBDIS);
+	smc911x_set_mac_csr(MAC_CR, cr);
+
+	/* Stop Transmission */
+	cr = smc911x_get_mac_csr(TX_CFG);
+	cr &= ~(TX_CFG_STOP_TX);
+	smc911x_set_mac_csr(TX_CFG, cr);
+	/* Stop receiving packets */
+	cr = smc911x_get_mac_csr(RX_CFG);
+	cr &= ~(RX_CFG_RXDOFF);
+	smc911x_set_mac_csr(RX_CFG, cr);
+
+}
+
+
 static void smc911x_phy_configure(void)
 {
 	int timeout;
@@ -225,7 +246,7 @@
 
 void eth_halt(void)
 {
-	smc911x_reset();
+	smc911x_shutdown();
 }
 
 int eth_rx(void)
diff --git a/include/configs/at91sam9261ek.h b/include/configs/at91sam9261ek.h
index fdaa71c..9621b7c 100644
--- a/include/configs/at91sam9261ek.h
+++ b/include/configs/at91sam9261ek.h
@@ -137,6 +137,7 @@
 #define DM9000_IO			CONFIG_DM9000_BASE
 #define DM9000_DATA			(CONFIG_DM9000_BASE + 4)
 #define CONFIG_DM9000_USE_16BIT		1
+#define CONFIG_DM9000_NO_SROM		1
 #define CONFIG_NET_RETRY_COUNT		20
 #define CONFIG_RESET_PHY_R		1
 
diff --git a/include/dm9000.h b/include/dm9000.h
new file mode 100644
index 0000000..76f9bfd
--- /dev/null
+++ b/include/dm9000.h
@@ -0,0 +1,20 @@
+/*
+ * NOTE:        DAVICOM DM9000 ethernet driver interface
+ *
+ * Authors:     Remy Bohmer <linux@bohmer.net>
+ *
+ *              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.
+ */
+#ifndef __DM9000_H__
+#define __DM9000_H__
+
+/******************  function prototypes **********************/
+#if !defined(CONFIG_DM9000_NO_SROM)
+void dm9000_write_srom_word(int offset, u16 val);
+void dm9000_read_srom_word(int offset, u8 *to);
+#endif
+
+#endif /* __DM9000_H__ */