summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/dc2114x.c4
-rw-r--r--drivers/net/eepro100.c4
-rw-r--r--drivers/net/macb.c4
-rw-r--r--drivers/net/ne2000.c7
-rw-r--r--drivers/net/pcnet.c4
-rw-r--r--drivers/net/rtl8139.c4
-rw-r--r--drivers/net/rtl8169.c103
-rw-r--r--drivers/net/sk98lin/Makefile2
-rw-r--r--drivers/net/tsec.c12
-rw-r--r--drivers/net/tsi108_eth.c4
-rw-r--r--drivers/net/uli526x.c6
11 files changed, 77 insertions, 77 deletions
diff --git a/drivers/net/dc2114x.c b/drivers/net/dc2114x.c
index d5275dc..7238922 100644
--- a/drivers/net/dc2114x.c
+++ b/drivers/net/dc2114x.c
@@ -332,7 +332,7 @@ static int dc21x4x_init(struct eth_device* dev, bd_t* bis)
if ((INL(dev, DE4X5_STS) & (STS_TS | STS_RS)) != 0) {
printf("Error: Cannot reset ethernet controller.\n");
- return 0;
+ return -1;
}
#ifdef CONFIG_TULIP_SELECT_MEDIA
@@ -382,7 +382,7 @@ static int dc21x4x_init(struct eth_device* dev, bd_t* bis)
send_setup_frame(dev, bis);
- return 1;
+ return 0;
}
static int dc21x4x_send(struct eth_device* dev, volatile void *packet, int length)
diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c
index 738146e..96ed271 100644
--- a/drivers/net/eepro100.c
+++ b/drivers/net/eepro100.c
@@ -485,7 +485,7 @@ int eepro100_initialize (bd_t * bis)
static int eepro100_init (struct eth_device *dev, bd_t * bis)
{
- int i, status = 0;
+ int i, status = -1;
int tx_cur;
struct descriptor *ias_cmd, *cfg_cmd;
@@ -598,7 +598,7 @@ static int eepro100_init (struct eth_device *dev, bd_t * bis)
goto Done;
}
- status = 1;
+ status = 0;
Done:
return status;
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 95cdc49..6657d22 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -423,12 +423,12 @@ static int macb_init(struct eth_device *netdev, bd_t *bd)
#endif
if (!macb_phy_init(macb))
- return 0;
+ return -1;
/* Enable TX and RX */
macb_writel(macb, NCR, MACB_BIT(TE) | MACB_BIT(RE));
- return 1;
+ return 0;
}
static void macb_halt(struct eth_device *netdev)
diff --git a/drivers/net/ne2000.c b/drivers/net/ne2000.c
index c978d62..b100657 100644
--- a/drivers/net/ne2000.c
+++ b/drivers/net/ne2000.c
@@ -839,7 +839,7 @@ void uboot_push_packet_len(int len) {
}
dp83902a_recv(&pbuf[0], len);
- /*Just pass it to the upper layer*/
+ /* Just pass it to the upper layer */
NetReceive(&pbuf[0], len);
}
@@ -902,7 +902,6 @@ int eth_init(bd_t *bd) {
}
void eth_halt() {
-
PRINTK("### eth_halt\n");
if(initialized)
dp83902a_stop();
@@ -910,8 +909,8 @@ void eth_halt() {
}
int eth_rx() {
-dp83902a_poll();
-return 1;
+ dp83902a_poll();
+ return 1;
}
int eth_send(volatile void *packet, int length) {
diff --git a/drivers/net/pcnet.c b/drivers/net/pcnet.c
index 2af0e8f..4e270c9 100644
--- a/drivers/net/pcnet.c
+++ b/drivers/net/pcnet.c
@@ -402,7 +402,7 @@ static int pcnet_init(struct eth_device* dev, bd_t *bis)
if (i <= 0) {
printf("%s: TIMEOUT: controller init failed\n", dev->name);
pcnet_reset (dev);
- return 0;
+ return -1;
}
/*
@@ -410,7 +410,7 @@ static int pcnet_init(struct eth_device* dev, bd_t *bis)
*/
pcnet_write_csr (dev, 0, 0x0002);
- return 1;
+ return 0;
}
static int pcnet_send(struct eth_device* dev, volatile void *packet, int pkt_len)
diff --git a/drivers/net/rtl8139.c b/drivers/net/rtl8139.c
index 2367180..4c24805 100644
--- a/drivers/net/rtl8139.c
+++ b/drivers/net/rtl8139.c
@@ -273,10 +273,10 @@ static int rtl8139_probe(struct eth_device *dev, bd_t *bis)
if (inb(ioaddr + MediaStatus) & MSRLinkFail) {
printf("Cable not connected or other link failure\n");
- return(0);
+ return -1 ;
}
- return 1;
+ return 0;
}
/* Serial EEPROM section. */
diff --git a/drivers/net/rtl8169.c b/drivers/net/rtl8169.c
index 63ea2cc..57ccbd9 100644
--- a/drivers/net/rtl8169.c
+++ b/drivers/net/rtl8169.c
@@ -48,7 +48,10 @@
*
* Indent Options: indent -kr -i8
***************************************************************************/
-
+/*
+ * 26 August 2006 Mihai Georgian <u-boot@linuxnotincluded.org.uk>
+ * Modified to use le32_to_cpu and cpu_to_le32 properly
+ */
#include <common.h>
#include <malloc.h>
#include <net.h>
@@ -68,12 +71,7 @@
static u32 ioaddr;
/* Condensed operations for readability. */
-#define virt_to_le32desc(addr) cpu_to_le32(virt_to_bus(addr))
-#define le32desc_to_virt(addr) bus_to_virt(le32_to_cpu(addr))
-
#define currticks() get_timer(0)
-#define bus_to_phys(a) pci_mem_to_phys((pci_dev_t)dev->priv, a)
-#define phys_to_bus(a) pci_phys_to_mem((pci_dev_t)dev->priv, a)
/* media options */
#define MAX_UNITS 8
@@ -102,7 +100,7 @@ static int media[MAX_UNITS] = { -1, -1, -1, -1, -1, -1, -1, -1 };
#define RTL_MIN_IO_SIZE 0x80
#define TX_TIMEOUT (6*HZ)
-/* write/read MMIO register */
+/* write/read MMIO register. Notice: {read,write}[wl] do the necessary swapping */
#define RTL_W8(reg, val8) writeb ((val8), ioaddr + (reg))
#define RTL_W16(reg, val16) writew ((val16), ioaddr + (reg))
#define RTL_W32(reg, val32) writel ((val32), ioaddr + (reg))
@@ -218,7 +216,7 @@ enum RTL8169_register_content {
PHY_Enable_Auto_Nego = 0x1000,
/* PHY_STAT_REG = 1; */
- PHY_Auto_Neco_Comp = 0x0020,
+ PHY_Auto_Nego_Comp = 0x0020,
/* PHY_AUTO_NEGO_REG = 4; */
PHY_Cap_10_Half = 0x0020,
@@ -413,23 +411,23 @@ static int rtl_recv(struct eth_device *dev)
ioaddr = dev->iobase;
cur_rx = tpc->cur_rx;
- if ((tpc->RxDescArray[cur_rx].status & OWNbit) == 0) {
- if (!(tpc->RxDescArray[cur_rx].status & RxRES)) {
+ if ((le32_to_cpu(tpc->RxDescArray[cur_rx].status) & OWNbit) == 0) {
+ if (!(le32_to_cpu(tpc->RxDescArray[cur_rx].status) & RxRES)) {
unsigned char rxdata[RX_BUF_LEN];
- length = (int) (tpc->RxDescArray[cur_rx].
- status & 0x00001FFF) - 4;
+ length = (int) (le32_to_cpu(tpc->RxDescArray[cur_rx].
+ status) & 0x00001FFF) - 4;
memcpy(rxdata, tpc->RxBufferRing[cur_rx], length);
NetReceive(rxdata, length);
if (cur_rx == NUM_RX_DESC - 1)
tpc->RxDescArray[cur_rx].status =
- (OWNbit | EORbit) + RX_BUF_SIZE;
+ cpu_to_le32((OWNbit | EORbit) + RX_BUF_SIZE);
else
tpc->RxDescArray[cur_rx].status =
- OWNbit + RX_BUF_SIZE;
+ cpu_to_le32(OWNbit + RX_BUF_SIZE);
tpc->RxDescArray[cur_rx].buf_addr =
- virt_to_bus(tpc->RxBufferRing[cur_rx]);
+ cpu_to_le32(tpc->RxBufferRing[cur_rx]);
} else {
puts("Error Rx");
}
@@ -454,6 +452,7 @@ static int rtl_send(struct eth_device *dev, volatile void *packet, int length)
u8 *ptxb;
int entry = tpc->cur_tx % NUM_TX_DESC;
u32 len = length;
+ int ret;
#ifdef DEBUG_RTL8169_TX
int stime = currticks();
@@ -470,34 +469,38 @@ static int rtl_send(struct eth_device *dev, volatile void *packet, int length)
while (len < ETH_ZLEN)
ptxb[len++] = '\0';
- tpc->TxDescArray[entry].buf_addr = virt_to_bus(ptxb);
+ tpc->TxDescArray[entry].buf_addr = cpu_to_le32(ptxb);
if (entry != (NUM_TX_DESC - 1)) {
tpc->TxDescArray[entry].status =
- (OWNbit | FSbit | LSbit) | ((len > ETH_ZLEN) ?
- len : ETH_ZLEN);
+ cpu_to_le32((OWNbit | FSbit | LSbit) |
+ ((len > ETH_ZLEN) ? len : ETH_ZLEN));
} else {
tpc->TxDescArray[entry].status =
- (OWNbit | EORbit | FSbit | LSbit) |
- ((len > ETH_ZLEN) ? length : ETH_ZLEN);
+ cpu_to_le32((OWNbit | EORbit | FSbit | LSbit) |
+ ((len > ETH_ZLEN) ? len : ETH_ZLEN));
}
RTL_W8(TxPoll, 0x40); /* set polling bit */
tpc->cur_tx++;
to = currticks() + TX_TIMEOUT;
- while ((tpc->TxDescArray[entry].status & OWNbit) && (currticks() < to)); /* wait */
+ while ((le32_to_cpu(tpc->TxDescArray[entry].status) & OWNbit)
+ && (currticks() < to)); /* wait */
if (currticks() >= to) {
#ifdef DEBUG_RTL8169_TX
puts ("tx timeout/error\n");
printf ("%s elapsed time : %d\n", __FUNCTION__, currticks()-stime);
#endif
- return 0;
+ ret = 0;
} else {
#ifdef DEBUG_RTL8169_TX
puts("tx done\n");
#endif
- return length;
+ ret = length;
}
+ /* Delay to make net console (nc) work properly */
+ udelay(20);
+ return ret;
}
static void rtl8169_set_rx_mode(struct eth_device *dev)
@@ -564,8 +567,8 @@ static void rtl8169_hw_start(struct eth_device *dev)
tpc->cur_rx = 0;
- RTL_W32(TxDescStartAddr, virt_to_le32desc(tpc->TxDescArray));
- RTL_W32(RxDescStartAddr, virt_to_le32desc(tpc->RxDescArray));
+ RTL_W32(TxDescStartAddr, tpc->TxDescArray);
+ RTL_W32(RxDescStartAddr, tpc->RxDescArray);
RTL_W8(Cfg9346, Cfg9346_Lock);
udelay(10);
@@ -603,13 +606,14 @@ static void rtl8169_init_ring(struct eth_device *dev)
for (i = 0; i < NUM_RX_DESC; i++) {
if (i == (NUM_RX_DESC - 1))
tpc->RxDescArray[i].status =
- (OWNbit | EORbit) + RX_BUF_SIZE;
+ cpu_to_le32((OWNbit | EORbit) + RX_BUF_SIZE);
else
- tpc->RxDescArray[i].status = OWNbit + RX_BUF_SIZE;
+ tpc->RxDescArray[i].status =
+ cpu_to_le32(OWNbit + RX_BUF_SIZE);
tpc->RxBufferRing[i] = &rxb[i * RX_BUF_SIZE];
tpc->RxDescArray[i].buf_addr =
- virt_to_bus(tpc->RxBufferRing[i]);
+ cpu_to_le32(tpc->RxBufferRing[i]);
}
#ifdef DEBUG_RTL8169
@@ -620,11 +624,9 @@ static void rtl8169_init_ring(struct eth_device *dev)
/**************************************************************************
RESET - Finish setting up the ethernet interface
***************************************************************************/
-static void rtl_reset(struct eth_device *dev, bd_t *bis)
+static int rtl_reset(struct eth_device *dev, bd_t *bis)
{
int i;
- u8 diff;
- u32 TxPhyAddr, RxPhyAddr;
#ifdef DEBUG_RTL8169
int stime = currticks();
@@ -632,25 +634,14 @@ static void rtl_reset(struct eth_device *dev, bd_t *bis)
#endif
tpc->TxDescArrays = tx_ring;
- if (tpc->TxDescArrays == 0)
- puts("Allot Error");
/* Tx Desscriptor needs 256 bytes alignment; */
- TxPhyAddr = virt_to_bus(tpc->TxDescArrays);
- diff = 256 - (TxPhyAddr - ((TxPhyAddr >> 8) << 8));
- TxPhyAddr += diff;
- tpc->TxDescArray = (struct TxDesc *) (tpc->TxDescArrays + diff);
+ tpc->TxDescArray = (struct TxDesc *) ((unsigned long)(tpc->TxDescArrays +
+ 255) & ~255);
tpc->RxDescArrays = rx_ring;
/* Rx Desscriptor needs 256 bytes alignment; */
- RxPhyAddr = virt_to_bus(tpc->RxDescArrays);
- diff = 256 - (RxPhyAddr - ((RxPhyAddr >> 8) << 8));
- RxPhyAddr += diff;
- tpc->RxDescArray = (struct RxDesc *) (tpc->RxDescArrays + diff);
-
- if (tpc->TxDescArrays == NULL || tpc->RxDescArrays == NULL) {
- puts("Allocate RxDescArray or TxDescArray failed\n");
- return;
- }
+ tpc->RxDescArray = (struct RxDesc *) ((unsigned long)(tpc->RxDescArrays +
+ 255) & ~255);
rtl8169_init_ring(dev);
rtl8169_hw_start(dev);
@@ -669,6 +660,7 @@ static void rtl_reset(struct eth_device *dev, bd_t *bis)
#ifdef DEBUG_RTL8169
printf ("%s elapsed time : %d\n", __FUNCTION__, currticks()-stime);
#endif
+ return 0;
}
/**************************************************************************
@@ -733,7 +725,7 @@ static int rtl_init(struct eth_device *dev, bd_t *bis)
/* Get MAC address. FIXME: read EEPROM */
for (i = 0; i < MAC_ADDR_LEN; i++)
- dev->enetaddr[i] = RTL_R8(MAC0 + i);
+ bis->bi_enetaddr[i] = dev->enetaddr[i] = RTL_R8(MAC0 + i);
#ifdef DEBUG_RTL8169
printf("MAC Address");
@@ -808,7 +800,7 @@ static int rtl_init(struct eth_device *dev, bd_t *bis)
/* wait for auto-negotiation process */
for (i = 10000; i > 0; i--) {
/* check if auto-negotiation complete */
- if (mdio_read(PHY_STAT_REG) & PHY_Auto_Neco_Comp) {
+ if (mdio_read(PHY_STAT_REG) & PHY_Auto_Nego_Comp) {
udelay(100);
option = RTL_R8(PHYstatus);
if (option & _1000bpsF) {
@@ -818,13 +810,12 @@ static int rtl_init(struct eth_device *dev, bd_t *bis)
#endif
} else {
#ifdef DEBUG_RTL8169
- printf
- ("%s: %sMbps %s-duplex operation.\n",
- dev->name,
- (option & _100bps) ? "100" :
- "10",
- (option & FullDup) ? "Full" :
- "Half");
+ printf("%s: %sMbps %s-duplex operation.\n",
+ dev->name,
+ (option & _100bps) ? "100" :
+ "10",
+ (option & FullDup) ? "Full" :
+ "Half");
#endif
}
break;
@@ -869,7 +860,7 @@ int rtl8169_initialize(bd_t *bis)
sprintf (dev->name, "RTL8169#%d", card_number);
dev->priv = (void *) devno;
- dev->iobase = (int)bus_to_phys(iobase);
+ dev->iobase = (int)pci_mem_to_phys(devno, iobase);
dev->init = rtl_reset;
dev->halt = rtl_halt;
diff --git a/drivers/net/sk98lin/Makefile b/drivers/net/sk98lin/Makefile
index a7d4a3b..8b83fae 100644
--- a/drivers/net/sk98lin/Makefile
+++ b/drivers/net/sk98lin/Makefile
@@ -20,7 +20,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#
-# File: drivers/sk98lin/Makefile
+# File: drivers/net/sk98lin/Makefile
#
# Makefile for the SysKonnect SK-98xx device driver.
#
diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
index ca6284b..25392f6 100644
--- a/drivers/net/tsec.c
+++ b/drivers/net/tsec.c
@@ -232,7 +232,7 @@ int tsec_init(struct eth_device *dev, bd_t * bd)
startup_tsec(dev);
/* If there's no link, fail */
- return priv->link;
+ return (priv->link ? 0 : -1);
}
@@ -674,6 +674,15 @@ uint mii_cis8204_setmode(uint mii_reg, struct tsec_private * priv)
return MIIM_CIS8204_EPHYCON_INIT;
}
+uint mii_m88e1111s_setmode(uint mii_reg, struct tsec_private *priv)
+{
+ uint mii_data = read_phy_reg(priv, mii_reg);
+
+ if (priv->flags & TSEC_REDUCED)
+ mii_data = (mii_data & 0xfff0) | 0x000b;
+ return mii_data;
+}
+
/* Initialized required registers to appropriate values, zeroing
* those we don't care about (unless zero is bad, in which case,
* choose a more appropriate value)
@@ -1034,6 +1043,7 @@ struct phy_info phy_info_M88E1111S = {
(struct phy_cmd[]){ /* config */
/* Reset and configure the PHY */
{MIIM_CONTROL, MIIM_CONTROL_RESET, NULL},
+ {0x1b, 0x848f, &mii_m88e1111s_setmode},
{0x14, 0x0cd2, NULL}, /* Delay RGMII TX and RX */
{MIIM_GBIT_CONTROL, MIIM_GBIT_CONTROL_INIT, NULL},
{MIIM_ANAR, MIIM_ANAR_INIT, NULL},
diff --git a/drivers/net/tsi108_eth.c b/drivers/net/tsi108_eth.c
index 524e9da..a09115e 100644
--- a/drivers/net/tsi108_eth.c
+++ b/drivers/net/tsi108_eth.c
@@ -792,7 +792,7 @@ static int tsi108_eth_probe (struct eth_device *dev, bd_t * bis)
(dev->enetaddr[0] << 16);
if (marvell_88e_phy_config(dev, &speed, &duplex) == 0)
- return 0;
+ return -1;
value =
MAC_CONFIG_2_PREAMBLE_LENGTH(7) | MAC_CONFIG_2_PAD_CRC |
@@ -864,7 +864,7 @@ static int tsi108_eth_probe (struct eth_device *dev, bd_t * bis)
/* enable TX queue */
reg_TX_CONTROL(base) = TX_CONTROL_GO | 0x01;
- return 1;
+ return 0;
}
/*
diff --git a/drivers/net/uli526x.c b/drivers/net/uli526x.c
index 1267c57..8460f69 100644
--- a/drivers/net/uli526x.c
+++ b/drivers/net/uli526x.c
@@ -279,12 +279,12 @@ static int uli526x_init_one(struct eth_device *dev, bd_t *bis)
db->desc_pool_ptr = (uchar *)&desc_pool_array[0];
db->desc_pool_dma_ptr = (dma_addr_t)&desc_pool_array[0];
if (db->desc_pool_ptr == NULL)
- return 0;
+ return -1;
db->buf_pool_ptr = &buf_pool[0];
db->buf_pool_dma_ptr = (dma_addr_t)&buf_pool[0];
if (db->buf_pool_ptr == NULL)
- return 0;
+ return -1;
db->first_tx_desc = (struct tx_desc *) db->desc_pool_ptr;
db->first_tx_desc_dma = db->desc_pool_dma_ptr;
@@ -331,7 +331,7 @@ static int uli526x_init_one(struct eth_device *dev, bd_t *bis)
db->cr6_data |= ULI526X_TXTH_256;
db->cr0_data = CR0_DEFAULT;
uli526x_init(dev);
- return 1;
+ return 0;
}
static void uli526x_disable(struct eth_device *dev)