diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/4xx_enet.c | 10 | ||||
-rw-r--r-- | drivers/net/dm9000x.c | 16 | ||||
-rw-r--r-- | drivers/net/rtl8169.c | 13 | ||||
-rw-r--r-- | drivers/net/smc911x.c | 23 |
4 files changed, 44 insertions, 18 deletions
diff --git a/drivers/net/4xx_enet.c b/drivers/net/4xx_enet.c index 918373bd1f7..7bf3e0a96d1 100644 --- a/drivers/net/4xx_enet.c +++ b/drivers/net/4xx_enet.c @@ -871,6 +871,7 @@ static int ppc_4xx_eth_init (struct eth_device *dev, bd_t * bis) 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 @@ static int ppc_4xx_eth_init (struct eth_device *dev, bd_t * bis) /* 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 8ca2bf715c0..f1394354eb3 100644 --- a/drivers/net/dm9000x.c +++ b/drivers/net/dm9000x.c @@ -53,7 +53,7 @@ v1.2 03/18/2003 Weilun Huang <weilun_huang@davicom.com.tw>: 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 @@ TODO: external MII is not functional, only internal at the moment. #include <command.h> #include <net.h> #include <asm/io.h> +#include <dm9000.h> #include "dm9000x.h" @@ -113,7 +114,6 @@ void eth_halt(void); 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 @@ eth_init(bd_t * bd) /* 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 @@ eth_rx(void) /* 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 @@ static void read_srom_word(int offset, u8 *to) 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 @@ write_srom_word(int offset, u16 val) 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 83a05b45b9e..e45d1a52212 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); } diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c index 8c9a2a8a057..455b055a9c1 100644 --- a/drivers/net/smc911x.c +++ b/drivers/net/smc911x.c @@ -117,6 +117,27 @@ static int smc911x_phy_reset(void) 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 @@ int eth_send(volatile void *packet, int length) void eth_halt(void) { - smc911x_reset(); + smc911x_shutdown(); } int eth_rx(void) |