1 /* $NetBSD: lan9118var.h,v 1.2 2009/11/28 08:44:00 kiyohara Exp $ */ 2 /* 3 * Copyright (c) 2008 KIYOHARA Takashi 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 19 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 21 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 23 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 24 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 * POSSIBILITY OF SUCH DAMAGE. 26 */ 27 28 #ifndef _LAN9118VAR_H_ 29 #define _LAN9118VAR_H_ 30 31 #include "rnd.h" 32 33 #if NRND > 0 34 #include <sys/rnd.h> 35 #endif 36 37 #define LAN9118_DEFAULT_TX_FIF_SZ 5 /*kB*/ 38 39 #ifndef LAN9118_TX_FIF_SZ 40 #define LAN9118_TX_FIF_SZ LAN9118_DEFAULT_TX_FIF_SZ 41 #endif 42 #define LAN9118_TX_DATA_FIFO_SIZE (LAN9118_TX_FIF_SZ * 1024 - 512) 43 /* 44 * LAN9118 has FIFO buffer, total size is 16kB. That is using TX and RX 45 * buffers. We can set TX FIFO Size. Also TX Status FIFO size is fixed 46 * at 512 Bytes. 47 * 48 * TX FIFO Size : LAN9118_TX_FIF_SZ 49 * TX Status FIFO Size : 512 Bytes (fixed) 50 * TX Data FIFO Size : LAN9118_TX_FIF_SZ - TX Status FIFO Size 51 * 52 * RX FIFO Size : 16kB - LAN9118_TX_FIF_SZ 53 * RX Status FIFO Size : RX FIFO Size / 16 54 * RX Data FIFO Size : RX FIFO Size - RX Status FIFO Size 55 */ 56 57 58 struct lan9118_softc { 59 device_t sc_dev; /* generic device glue */ 60 struct ethercom sc_ec; /* ethernet common glue */ 61 struct mii_data sc_mii; 62 63 bus_space_tag_t sc_iot; 64 bus_space_handle_t sc_ioh; 65 66 uint16_t sc_id; 67 uint16_t sc_rev; 68 uint8_t sc_enaddr[ETHER_ADDR_LEN]; 69 70 uint32_t sc_afc_cfg; /* AFC_CFG configuration */ 71 int sc_use_extphy; 72 struct callout sc_tick; 73 74 int sc_flags; 75 #define LAN9118_FLAGS_SWAP 0x00000001 76 #define LAN9118_FLAGS_NO_EEPROM 0x00000002 77 78 #if NRND > 0 79 rndsource_element_t rnd_source; 80 #endif 81 }; 82 83 84 int lan9118_attach(struct lan9118_softc *); 85 int lan9118_intr(void *); 86 87 #endif /* _SMSC9118VAR_H_ */ 88