#include <common.h>
#include <malloc.h>
#include <net.h>
+#include <netdev.h>
#include <asm/io.h>
#include <pci.h>
enum RTL8169_registers {
MAC0 = 0, /* Ethernet hardware address. */
MAR0 = 8, /* Multicast filter. */
- TxDescStartAddr = 0x20,
- TxHDescStartAddr = 0x28,
+ TxDescStartAddrLow = 0x20,
+ TxDescStartAddrHigh = 0x24,
+ TxHDescStartAddrLow = 0x28,
+ TxHDescStartAddrHigh = 0x2c,
FLASH = 0x30,
ERSR = 0x36,
ChipCmd = 0x37,
PHYstatus = 0x6C,
RxMaxSize = 0xDA,
CPlusCmd = 0xE0,
- RxDescStartAddr = 0xE4,
+ RxDescStartAddrLow = 0xE4,
+ RxDescStartAddrHigh = 0xE8,
EarlyTxThres = 0xEC,
FuncEvent = 0xF0,
FuncEventMask = 0xF4,
/* if unknown chip, assume array element #0, original RTL-8169 in this case */
printf("PCI device %s: unknown chip version, assuming RTL-8169\n", dev->name);
- printf("PCI device: TxConfig = 0x%hX\n", (unsigned long) RTL_R32(TxConfig));
+ printf("PCI device: TxConfig = 0x%lX\n", (unsigned long) RTL_R32(TxConfig));
tpc->chipset = 0;
match:
while (len < ETH_ZLEN)
ptxb[len++] = '\0';
+ tpc->TxDescArray[entry].buf_Haddr = 0;
tpc->TxDescArray[entry].buf_addr = cpu_to_le32((unsigned long)ptxb);
if (entry != (NUM_TX_DESC - 1)) {
tpc->TxDescArray[entry].status =
#endif
RTL_W8(Cfg9346, Cfg9346_Unlock);
- RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb);
+
+ /* RTL-8169sb/8110sb or previous version */
+ if (tpc->chipset <= 5)
+ RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb);
+
RTL_W8(EarlyTxThres, EarlyTxThld);
/* For gigabit rtl8169 */
tpc->cur_rx = 0;
- RTL_W32(TxDescStartAddr, (unsigned long)tpc->TxDescArray);
- RTL_W32(RxDescStartAddr, (unsigned long)tpc->RxDescArray);
+ RTL_W32(TxDescStartAddrLow, (unsigned long)tpc->TxDescArray);
+ RTL_W32(TxDescStartAddrHigh, (unsigned long)0);
+ RTL_W32(RxDescStartAddrLow, (unsigned long)tpc->RxDescArray);
+ RTL_W32(RxDescStartAddrHigh, (unsigned long)0);
+
+ /* RTL-8169sc/8110sc or later version */
+ if (tpc->chipset > 5)
+ RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb);
+
RTL_W8(Cfg9346, Cfg9346_Lock);
udelay(10);
bis->bi_enetaddr[i] = dev->enetaddr[i] = RTL_R8(MAC0 + i);
#ifdef DEBUG_RTL8169
+ printf("chipset = %d\n", tpc->chipset);
printf("MAC Address");
for (i = 0; i < MAC_ADDR_LEN; i++)
printf(":%02x", dev->enetaddr[i]);