Home | History | Annotate | Line # | Download | only in ic
      1 /*	$NetBSD: lan9118var.h,v 1.6 2017/06/01 16:59:20 jmcneill 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 <sys/rndsource.h>
     32 
     33 #define LAN9118_DEFAULT_TX_FIF_SZ	5 /*kB*/
     34 
     35 #ifndef LAN9118_TX_FIF_SZ
     36 #define LAN9118_TX_FIF_SZ	LAN9118_DEFAULT_TX_FIF_SZ
     37 #endif
     38 #define LAN9118_TX_DATA_FIFO_SIZE	(LAN9118_TX_FIF_SZ * 1024 - 512)
     39 /*
     40  * LAN9118 has FIFO buffer, total size is 16kB.  That is using TX and RX
     41  * buffers.  We can set TX FIFO Size.  Also TX Status FIFO size is fixed
     42  * at 512 Bytes.
     43  *
     44  *  TX FIFO Size		: LAN9118_TX_FIF_SZ
     45  *   TX Status FIFO Size	: 512 Bytes (fixed)
     46  *   TX Data FIFO Size		: LAN9118_TX_FIF_SZ - TX Status FIFO Size
     47  *
     48  *  RX FIFO Size		: 16kB - LAN9118_TX_FIF_SZ
     49  *   RX Status FIFO Size	: RX FIFO Size / 16
     50  *   RX Data FIFO Size		: RX FIFO Size - RX Status FIFO Size
     51  */
     52 
     53 
     54 struct lan9118_softc {
     55 	device_t sc_dev;		/* generic device glue */
     56 	struct ethercom sc_ec;		/* ethernet common glue */
     57 	struct mii_data sc_mii;
     58 
     59 	bus_space_tag_t sc_iot;
     60 	bus_space_handle_t sc_ioh;
     61 
     62 	uint16_t sc_id;
     63 	uint16_t sc_rev;
     64 	uint8_t sc_enaddr[ETHER_ADDR_LEN];
     65 
     66 	uint32_t sc_afc_cfg;		/* AFC_CFG configuration */
     67 	int sc_use_extphy;
     68 	struct callout sc_tick;
     69 
     70 	int sc_flags;
     71 #define LAN9118_FLAGS_SWAP	0x00000001
     72 #define LAN9118_FLAGS_NO_EEPROM	0x00000002
     73 #define LAN9118_FLAGS_IRQ_ACTHI	0x00000004
     74 #define LAN9118_FLAGS_IRQ_PP	0x00000008
     75 
     76 	krndsource_t rnd_source;
     77 };
     78 
     79 
     80 int lan9118_attach(struct lan9118_softc *);
     81 int lan9118_intr(void *);
     82 
     83 #endif	/* _SMSC9118VAR_H_ */
     84