forked from Imagelibrary/rtems
2006-01-09 Ralf Corsepius <ralf.corsepius@rtems.org>
* libchip/network/open_eth.c, libchip/network/open_eth.h: Merger from rtems-4-6-branch.
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
2006-01-09 Ralf Corsepius <ralf.corsepius@rtems.org>
|
||||||
|
|
||||||
|
* libchip/network/open_eth.c, libchip/network/open_eth.h:
|
||||||
|
Merger from rtems-4-6-branch.
|
||||||
|
|
||||||
2006-01-09 Ralf Corsepius <ralf.corsepius@rtems.org>
|
2006-01-09 Ralf Corsepius <ralf.corsepius@rtems.org>
|
||||||
|
|
||||||
* libchip/network/smc91111.c
|
* libchip/network/smc91111.c
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
#include <bsp.h>
|
#include <bsp.h>
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
@@ -105,8 +106,6 @@ struct MDRX
|
|||||||
#define OETH_SUSPEND_NOTXBUF
|
#define OETH_SUSPEND_NOTXBUF
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define OETH_RATE_10MHZ
|
|
||||||
|
|
||||||
#if (MCLBYTES < RBUF_SIZE)
|
#if (MCLBYTES < RBUF_SIZE)
|
||||||
# error "Driver must have MCLBYTES > RBUF_SIZE"
|
# error "Driver must have MCLBYTES > RBUF_SIZE"
|
||||||
#endif
|
#endif
|
||||||
@@ -132,7 +131,7 @@ struct open_eth_softc
|
|||||||
struct MDTX *txdesc;
|
struct MDTX *txdesc;
|
||||||
struct MDRX *rxdesc;
|
struct MDRX *rxdesc;
|
||||||
rtems_vector_number vector;
|
rtems_vector_number vector;
|
||||||
|
unsigned int en100MHz;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Statistics
|
* Statistics
|
||||||
@@ -234,19 +233,13 @@ open_eth_initialize_hardware (struct open_eth_softc *sc)
|
|||||||
regs->moder = 0; /* Reset OFF */
|
regs->moder = 0; /* Reset OFF */
|
||||||
|
|
||||||
/* reset PHY and wait for complettion */
|
/* reset PHY and wait for complettion */
|
||||||
mii_cr = read_mii(0);
|
mii_cr = 0x3300;
|
||||||
mii_cr = 0x3320;
|
if (!sc->en100MHz) mii_cr = 0;
|
||||||
#ifdef OETH_RATE_10MHZ
|
|
||||||
mii_cr = 0;
|
|
||||||
#endif
|
|
||||||
write_mii(0, mii_cr | 0x8000);
|
write_mii(0, mii_cr | 0x8000);
|
||||||
while (read_mii(0) & 0x8000) {}
|
while (read_mii(0) & 0x8000) {}
|
||||||
write_mii(20, 0x1422);
|
if (!sc->en100MHz) write_mii(0, 0);
|
||||||
#ifdef OETH_RATE_10MHZ
|
mii_cr = read_mii(0);
|
||||||
mii_cr = 0;
|
printf("open_eth: driver attached, PHY config : 0x%04" PRIx32 "\n", read_mii(0));
|
||||||
#endif
|
|
||||||
write_mii(0, mii_cr);
|
|
||||||
printf("open_eth: driver attached, PHY config : 0x%04x\n", read_mii(0));
|
|
||||||
|
|
||||||
#ifdef OPEN_ETH_DEBUG
|
#ifdef OPEN_ETH_DEBUG
|
||||||
printf("mii_cr: %04x\n", mii_cr);
|
printf("mii_cr: %04x\n", mii_cr);
|
||||||
@@ -499,6 +492,7 @@ sendpacket (struct ifnet *ifp, struct mbuf *m)
|
|||||||
len_status &= ~OETH_TX_BD_PAD;
|
len_status &= ~OETH_TX_BD_PAD;
|
||||||
|
|
||||||
/* write buffer descriptor length and status */
|
/* write buffer descriptor length and status */
|
||||||
|
len_status &= 0x0000ffff;
|
||||||
len_status |= (len << 16) | (OETH_TX_BD_READY | OETH_TX_BD_CRC);
|
len_status |= (len << 16) | (OETH_TX_BD_READY | OETH_TX_BD_CRC);
|
||||||
dp->regs->xd[dp->tx_ptr].len_status = len_status;
|
dp->regs->xd[dp->tx_ptr].len_status = len_status;
|
||||||
dp->tx_ptr = (dp->tx_ptr + 1) % dp->txbufs;
|
dp->tx_ptr = (dp->tx_ptr + 1) % dp->txbufs;
|
||||||
@@ -725,6 +719,7 @@ rtems_open_eth_driver_attach (struct rtems_bsdnet_ifconfig *config,
|
|||||||
sc->vector = chip->vector;
|
sc->vector = chip->vector;
|
||||||
sc->txbufs = chip->txd_count;
|
sc->txbufs = chip->txd_count;
|
||||||
sc->rxbufs = chip->rxd_count;
|
sc->rxbufs = chip->rxd_count;
|
||||||
|
sc->en100MHz = chip->en100MHz;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ typedef struct {
|
|||||||
uint32_t vector;
|
uint32_t vector;
|
||||||
uint32_t txd_count;
|
uint32_t txd_count;
|
||||||
uint32_t rxd_count;
|
uint32_t rxd_count;
|
||||||
|
uint32_t en100MHz;
|
||||||
} open_eth_configuration_t;
|
} open_eth_configuration_t;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user