diff options
author | wpaul <wpaul@FreeBSD.org> | 1999-03-30 17:07:20 +0000 |
---|---|---|
committer | wpaul <wpaul@FreeBSD.org> | 1999-03-30 17:07:20 +0000 |
commit | 0f59dbfc93580b06f192d9301a562057a773c075 (patch) | |
tree | 6f3719dbc622fd310dde1dbbab79a1f28f872915 /sys/pci/if_tlreg.h | |
parent | c3ead1bc25f2dc8da2e3b55231ec7a1132fcbd4f (diff) | |
download | FreeBSD-src-0f59dbfc93580b06f192d9301a562057a773c075.zip FreeBSD-src-0f59dbfc93580b06f192d9301a562057a773c075.tar.gz |
Various updates for the ThunderLAN driver:
- When trying to map ports, if mapping TL_PCI_LOIO or TL_PCI_LOMEM fails,
try mapping the other one. Apparently, some ThunderLAN parts swap these
two registers while others don't.
- Add support for bitrate (non-MII) PHYs. If no MII-based PHY is found,
program the chip for bitrate mode. This is required for the TNETE110
part, which doesn't have MII support. (It's also obsolete, but there
are still some people out there who have them.) With this change and the
change above, the Compaq Netflex-3/P 10baseT/BNC board works correctly.
(Thanks to Matthew Dodd for getting me one of these cards.)
- Convert to bus_space_foo() for register accesses.
- Add changes to support FreeBSD/Alpha. I still have to actually test
this in my Alpha box so I'm not going to update /sys/alpha/conf/GENERIC
yet.
Diffstat (limited to 'sys/pci/if_tlreg.h')
-rw-r--r-- | sys/pci/if_tlreg.h | 61 |
1 files changed, 24 insertions, 37 deletions
diff --git a/sys/pci/if_tlreg.h b/sys/pci/if_tlreg.h index b8b3769..c5e76c9 100644 --- a/sys/pci/if_tlreg.h +++ b/sys/pci/if_tlreg.h @@ -29,7 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: if_tlreg.h,v 1.6 1998/09/23 05:08:54 wpaul Exp $ + * $Id: if_tlreg.h,v 1.14 1999/03/30 16:57:26 wpaul Exp $ */ @@ -111,11 +111,8 @@ struct tl_chain_data { struct tl_softc { struct arpcom arpcom; /* interface info */ struct ifmedia ifmedia; /* media info */ -#ifdef TL_USEIOSPACE - u_int32_t iobase; -#else - volatile caddr_t csr; /* pointer to register map */ -#endif + bus_space_handle_t tl_bhandle; + bus_space_tag_t tl_btag; struct tl_type *tl_dinfo; /* ThunderLAN adapter info */ struct tl_type *tl_pinfo; /* PHY info struct */ u_int8_t tl_ctlr; /* chip number */ @@ -131,10 +128,8 @@ struct tl_softc { caddr_t tl_ldata_ptr; struct tl_list_data *tl_ldata; /* TX/RX lists and mbufs */ struct tl_chain_data tl_cdata; - int tl_txeoc; -#ifdef TL_DEBUG - u_int8_t tl_event[20]; -#endif + u_int8_t tl_txeoc; + u_int8_t tl_bitrate; struct callout_handle tl_stat_ch; }; @@ -532,38 +527,30 @@ struct tl_stats { }; /* + * ACOMMIT register bits. These are used only when a bitrate + * PHY is selected ('bitrate' bit in netconfig register is set). + */ +#define TL_AC_MTXER 0x01 /* reserved */ +#define TL_AC_MTXD1 0x02 /* 0 == 10baseT 1 == AUI */ +#define TL_AC_MTXD2 0x04 /* loopback disable */ +#define TL_AC_MTXD3 0x08 /* full duplex disable */ + +/* * register space access macros */ -#ifdef TL_USEIOSPACE #define CSR_WRITE_4(sc, reg, val) \ - outl(sc->iobase + (u_int32_t)(reg), val) + bus_space_write_4(sc->tl_btag, sc->tl_bhandle, reg, val) #define CSR_WRITE_2(sc, reg, val) \ - outw(sc->iobase + (u_int32_t)(reg), val) + bus_space_write_2(sc->tl_btag, sc->tl_bhandle, reg, val) #define CSR_WRITE_1(sc, reg, val) \ - outb(sc->iobase + (u_int32_t)(reg), val) - -#define CSR_READ_4(sc, reg) \ - inl(sc->iobase + (u_int32_t)(reg)) -#define CSR_READ_2(sc, reg) \ - inw(sc->iobase + (u_int32_t)(reg)) -#define CSR_READ_1(sc, reg) \ - inb(sc->iobase + (u_int32_t)(reg)) -#else -#define CSR_WRITE_4(sc, reg, val) \ - ((*(u_int32_t*)((sc)->csr + (u_int32_t)(reg))) = (u_int32_t)(val)) -#define CSR_WRITE_2(sc, reg, val) \ - ((*(u_int16_t*)((sc)->csr + (u_int32_t)(reg))) = (u_int16_t)(val)) -#define CSR_WRITE_1(sc, reg, val) \ - ((*(u_int8_t*)((sc)->csr + (u_int32_t)(reg))) = (u_int8_t)(val)) - -#define CSR_READ_4(sc, reg) \ - (*(u_int32_t *)((sc)->csr + (u_int32_t)(reg))) -#define CSR_READ_2(sc, reg) \ - (*(u_int16_t *)((sc)->csr + (u_int32_t)(reg))) -#define CSR_READ_1(sc, reg) \ - (*(u_int8_t *)((sc)->csr + (u_int32_t)(reg))) -#endif - + bus_space_write_1(sc->tl_btag, sc->tl_bhandle, reg, val) + +#define CSR_READ_4(sc, reg) \ + bus_space_read_4(sc->tl_btag, sc->tl_bhandle, reg) +#define CSR_READ_2(sc, reg) \ + bus_space_read_2(sc->tl_btag, sc->tl_bhandle, reg) +#define CSR_READ_1(sc, reg) \ + bus_space_read_1(sc->tl_btag, sc->tl_bhandle, reg) #define CMD_PUT(sc, x) CSR_WRITE_4(sc, TL_HOSTCMD, x) #define CMD_SET(sc, x) \ |