diff options
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/davinci_emac.c | 11 | ||||
-rw-r--r-- | drivers/net/mvgbe.c | 1 | ||||
-rw-r--r-- | drivers/net/pcnet.c | 17 | ||||
-rw-r--r-- | drivers/net/rtl8139.c | 49 | ||||
-rw-r--r-- | drivers/net/rtl8169.c | 3 |
5 files changed, 32 insertions, 49 deletions
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c index 7dacb2368d..fa31159a0e 100644 --- a/drivers/net/davinci_emac.c +++ b/drivers/net/davinci_emac.c @@ -53,6 +53,11 @@ unsigned int emac_dbg = 0; #define emac_gigabit_enable(phy_addr) /* no gigabit to enable */ #endif +#if !defined(CONFIG_SYS_EMAC_TI_CLKDIV) +#define CONFIG_SYS_EMAC_TI_CLKDIV ((EMAC_MDIO_BUS_FREQ / \ + EMAC_MDIO_CLOCK_FREQ) - 1) +#endif + static void davinci_eth_mdio_enable(void); static int gen_init_phy(int phy_addr); @@ -131,7 +136,7 @@ static void davinci_eth_mdio_enable(void) { u_int32_t clkdiv; - clkdiv = (EMAC_MDIO_BUS_FREQ / EMAC_MDIO_CLOCK_FREQ) - 1; + clkdiv = CONFIG_SYS_EMAC_TI_CLKDIV; writel((clkdiv & 0xff) | MDIO_CONTROL_ENABLE | @@ -473,7 +478,7 @@ static int davinci_eth_open(struct eth_device *dev, bd_t *bis) #endif /* Init MDIO & get link state */ - clkdiv = (EMAC_MDIO_BUS_FREQ / EMAC_MDIO_CLOCK_FREQ) - 1; + clkdiv = CONFIG_SYS_EMAC_TI_CLKDIV; writel((clkdiv & 0xff) | MDIO_CONTROL_ENABLE | MDIO_CONTROL_FAULT, &adap_mdio->CONTROL); @@ -809,7 +814,7 @@ int davinci_emac_initialize(void) phy[i].auto_negotiate = gen_auto_negotiate; } - debug("Ethernet PHY: %s\n", phy.name); + debug("Ethernet PHY: %s\n", phy[i].name); miiphy_register(phy[i].name, davinci_mii_phy_read, davinci_mii_phy_write); diff --git a/drivers/net/mvgbe.c b/drivers/net/mvgbe.c index c7f74467b9..fd13428b4e 100644 --- a/drivers/net/mvgbe.c +++ b/drivers/net/mvgbe.c @@ -37,6 +37,7 @@ #include <asm/types.h> #include <asm/system.h> #include <asm/byteorder.h> +#include <asm/arch/cpu.h> #if defined(CONFIG_KIRKWOOD) #include <asm/arch/kirkwood.h> diff --git a/drivers/net/pcnet.c b/drivers/net/pcnet.c index e994cb6901..45066c8fea 100644 --- a/drivers/net/pcnet.c +++ b/drivers/net/pcnet.c @@ -30,21 +30,12 @@ #include <asm/io.h> #include <pci.h> -#if 0 #define PCNET_DEBUG_LEVEL 0 /* 0=off, 1=init, 2=rx/tx */ -#endif -#if PCNET_DEBUG_LEVEL > 0 -#define PCNET_DEBUG1(fmt,args...) printf (fmt ,##args) -#if PCNET_DEBUG_LEVEL > 1 -#define PCNET_DEBUG2(fmt,args...) printf (fmt ,##args) -#else -#define PCNET_DEBUG2(fmt,args...) -#endif -#else -#define PCNET_DEBUG1(fmt,args...) -#define PCNET_DEBUG2(fmt,args...) -#endif +#define PCNET_DEBUG1(fmt,args...) \ + debug_cond(PCNET_DEBUG_LEVEL > 0, fmt ,##args) +#define PCNET_DEBUG2(fmt,args...) \ + debug_cond(PCNET_DEBUG_LEVEL > 1, fmt ,##args) #if !defined(CONF_PCNET_79C973) && defined(CONF_PCNET_79C975) #error "Macro for PCnet chip version is not defined!" diff --git a/drivers/net/rtl8139.c b/drivers/net/rtl8139.c index c2779db0a5..e3feef849c 100644 --- a/drivers/net/rtl8139.c +++ b/drivers/net/rtl8139.c @@ -95,10 +95,9 @@ #define RX_BUF_LEN_IDX 0 /* 0, 1, 2 is allowed - 8,16,32K rx buffer */ #define RX_BUF_LEN (8192 << RX_BUF_LEN_IDX) -#undef DEBUG_TX -#undef DEBUG_RX +#define DEBUG_TX 0 /* set to 1 to enable debug code */ +#define DEBUG_RX 0 /* set to 1 to enable debug code */ -#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) @@ -253,7 +252,6 @@ int rtl8139_initialize(bd_t *bis) static int rtl8139_probe(struct eth_device *dev, bd_t *bis) { int i; - int speed10, fullduplex; int addr_len; unsigned short *ap = (unsigned short *)dev->enetaddr; @@ -266,9 +264,6 @@ static int rtl8139_probe(struct eth_device *dev, bd_t *bis) for (i = 0; i < 3; i++) *ap++ = le16_to_cpu (read_eeprom(i + 7, addr_len)); - speed10 = inb(ioaddr + MediaStatus) & MSRSpeed10; - fullduplex = inw(ioaddr + MII_BMCR) & BMCRDuplex; - rtl_reset(dev); if (inb(ioaddr + MediaStatus) & MSRLinkFail) { @@ -389,9 +384,8 @@ static void rtl_reset(struct eth_device *dev) * from the configuration EEPROM default, because the card manufacturer * should have set that to match the card. */ -#ifdef DEBUG_RX - printf("rx ring address is %X\n",(unsigned long)rx_ring); -#endif + debug_cond(DEBUG_RX, + "rx ring address is %lX\n",(unsigned long)rx_ring); flush_cache((unsigned long)rx_ring, RX_BUF_LEN); outl(phys_to_bus((int)rx_ring), ioaddr + RxBuf); @@ -424,9 +418,7 @@ static int rtl_transmit(struct eth_device *dev, volatile void *packet, int lengt memcpy((char *)tx_buffer, (char *)packet, (int)length); -#ifdef DEBUG_TX - printf("sending %d bytes\n", len); -#endif + debug_cond(DEBUG_TX, "sending %d bytes\n", len); /* Note: RTL8139 doesn't auto-pad, send minimum payload (another 4 * bytes are sent automatically for the FCS, totalling to 64 bytes). */ @@ -453,16 +445,18 @@ static int rtl_transmit(struct eth_device *dev, volatile void *packet, int lengt if (status & TxOK) { cur_tx = (cur_tx + 1) % NUM_TX_DESC; -#ifdef DEBUG_TX - printf("tx done (%d ticks), status %hX txstatus %X\n", - to-currticks(), status, txstatus); -#endif + + debug_cond(DEBUG_TX, + "tx done, status %hX txstatus %lX\n", + status, txstatus); + return length; } else { -#ifdef DEBUG_TX - printf("tx timeout/error (%d usecs), status %hX txstatus %X\n", - 10*i, status, txstatus); -#endif + + debug_cond(DEBUG_TX, + "tx timeout/error (%d usecs), status %hX txstatus %lX\n", + 10*i, status, txstatus); + rtl_reset(dev); return 0; @@ -486,9 +480,7 @@ static int rtl_poll(struct eth_device *dev) /* See below for the rest of the interrupt acknowledges. */ outw(status & ~(RxFIFOOver | RxOverflow | RxOK), ioaddr + IntrStatus); -#ifdef DEBUG_RX - printf("rtl_poll: int %hX ", status); -#endif + debug_cond(DEBUG_RX, "rtl_poll: int %hX ", status); ring_offs = cur_rx % RX_BUF_LEN; /* ring_offs is guaranteed being 4-byte aligned */ @@ -513,14 +505,11 @@ static int rtl_poll(struct eth_device *dev) memcpy(&(rxdata[semi_count]), rx_ring, rx_size-4-semi_count); NetReceive(rxdata, length); -#ifdef DEBUG_RX - printf("rx packet %d+%d bytes", semi_count,rx_size-4-semi_count); -#endif + debug_cond(DEBUG_RX, "rx packet %d+%d bytes", + semi_count, rx_size-4-semi_count); } else { NetReceive(rx_ring + ring_offs + 4, length); -#ifdef DEBUG_RX - printf("rx packet %d bytes", rx_size-4); -#endif + debug_cond(DEBUG_RX, "rx packet %d bytes", rx_size-4); } flush_cache((unsigned long)rx_ring, RX_BUF_LEN); diff --git a/drivers/net/rtl8169.c b/drivers/net/rtl8169.c index b81dcad2ce..1ad13bddd5 100644 --- a/drivers/net/rtl8169.c +++ b/drivers/net/rtl8169.c @@ -739,7 +739,6 @@ INIT - Look for an adapter, this routine's visible to the outside static int rtl_init(struct eth_device *dev, bd_t *bis) { static int board_idx = -1; - static int printed_version = 0; int i, rc; int option = -1, Cap10_100 = 0, Cap1000 = 0; @@ -751,8 +750,6 @@ static int rtl_init(struct eth_device *dev, bd_t *bis) board_idx++; - printed_version = 1; - /* point to private storage */ tpc = &tpx; |