Home | History | Annotate | Line # | Download | only in ic
dm9000reg.h revision 1.4
      1  1.4  nisimura /*	$NetBSD: dm9000reg.h,v 1.4 2020/03/31 02:32:25 nisimura Exp $	*/
      2  1.1     ahoka 
      3  1.1     ahoka /*
      4  1.1     ahoka  * Copyright (c) 2009 Paul Fleischer
      5  1.1     ahoka  * All rights reserved.
      6  1.1     ahoka  *
      7  1.1     ahoka  * 1. Redistributions of source code must retain the above copyright
      8  1.1     ahoka  *    notice, this list of conditions and the following disclaimer.
      9  1.1     ahoka  * 2. Redistributions in binary form must reproduce the above copyright
     10  1.1     ahoka  *    notice, this list of conditions and the following disclaimer in the
     11  1.1     ahoka  *    documentation and/or other materials provided with the distribution.
     12  1.1     ahoka  * 3. The name of the company nor the name of the author may be used to
     13  1.1     ahoka  *    endorse or promote products derived from this software without specific
     14  1.1     ahoka  *    prior written permission.
     15  1.1     ahoka  *
     16  1.1     ahoka  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
     17  1.1     ahoka  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
     18  1.1     ahoka  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     19  1.1     ahoka  * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
     20  1.1     ahoka  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     21  1.1     ahoka  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
     22  1.1     ahoka  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     23  1.1     ahoka  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     24  1.1     ahoka  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     25  1.1     ahoka  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     26  1.1     ahoka  * SUCH DAMAGE.
     27  1.1     ahoka  */
     28  1.1     ahoka 
     29  1.4  nisimura #ifndef _DEV_IC_DM9000REG_H_
     30  1.4  nisimura #define _DEV_IC_DM9000REG_H_
     31  1.1     ahoka 
     32  1.4  nisimura /*
     33  1.4  nisimura  * Registers accesible on the DM9000, extracted from pp. 11-12 from
     34  1.4  nisimura  * the data sheet
     35  1.4  nisimura  */
     36  1.4  nisimura 
     37  1.4  nisimura /*
     38  1.4  nisimura  * There are two interesting addresses for the DM9000 (at least in
     39  1.4  nisimura  * the context of the FriendlyARM MINI2440) The I/O or register select
     40  1.4  nisimura  * address, which is the base address.  The DATA address, which is
     41  1.4  nisimura  * located at offset 4 from the base address.
     42  1.1     ahoka  *
     43  1.4  nisimura  * Chances are that this will not work generally, as it really depends
     44  1.4  nisimura  * on how the address lines are mapped from the CPU to the DM9000.
     45  1.4  nisimura  * But for now it is a good starting point.
     46  1.1     ahoka  */
     47  1.4  nisimura 
     48  1.4  nisimura #define DM9000_IOSIZE 4
     49  1.1     ahoka 
     50  1.1     ahoka #define DM9000_NCR		0x00
     51  1.3  nisimura #define  DM9000_NCR_RST		(1<<0)	/* reset chip, self clear */
     52  1.1     ahoka #define  DM9000_NCR_LBK_MASK	(0x06)
     53  1.1     ahoka #define  DM9000_NCR_LBK_SHIFT	(1)
     54  1.3  nisimura #define  DM9000_NCR_LBK_MAC_INTERNAL (1<<DM9000_NCR_LBK_SHIFT)
     55  1.3  nisimura #define  DM9000_NCR_LBK_NORMAL	(0<<DM9000_NCR_LBK_SHIFT)
     56  1.3  nisimura #define  DM9000_NCR_LBK_INT_PHY (2<<DM9000_NCR_LBK_SHIFT)
     57  1.3  nisimura #define  DM9000_NCR_FDX		(1<<3)	/* activate PAUSE flow control */
     58  1.3  nisimura #define  DM9000_NCR_FCOL	(1<<4)
     59  1.3  nisimura #define  DM9000_NCR_WAKEEN	(1<<6)
     60  1.3  nisimura #define  DM9000_NCR_EXY_PHY	(1<<7)
     61  1.1     ahoka #define DM9000_NSR		0x01
     62  1.3  nisimura #define  DM9000_NSR_RXOV	(1<<1)	/* receive overflow deteced */
     63  1.3  nisimura #define  DM9000_NSR_TX1END	(1<<2)	/* transmit 1 completed */
     64  1.3  nisimura #define  DM9000_NSR_TX2END	(1<<3) 	/* transmit 2 completed */
     65  1.3  nisimura #define  DM9000_NSR_WAKEST	(1<<5)
     66  1.3  nisimura #define  DM9000_NSR_LINKST	(1<<6)	/* link up detected */
     67  1.3  nisimura #define  DM9000_NSR_SPEED	(1<<7)	/* 1: 100Mbps, 0: 10Mbps */
     68  1.1     ahoka #define DM9000_TCR		0x02
     69  1.3  nisimura #define  DM9000_TCR_TXREQ	(1<<0)	/* request to start Tx, self clear */
     70  1.3  nisimura #define  DM9000_TCR_CRC_DIS1	(1<<1)
     71  1.3  nisimura #define  DM9000_TCR_PAD_DIS1	(1<<2)
     72  1.3  nisimura #define  DM9000_TCR_CRC_DIS2	(1<<3)
     73  1.3  nisimura #define  DM9000_TCR_PAD_DIS2	(1<<4)
     74  1.3  nisimura #define  DM9000_TCR_EXCECM	(1<<5)
     75  1.3  nisimura #define  DM9000_TCR_TJDIS	(1<<6)
     76  1.3  nisimura #define DM9000_TSR1		0x03	/* transmit completion status 1 */
     77  1.3  nisimura #define DM9000_TSR2		0x04	/* transmit completion status 2 */
     78  1.1     ahoka #define DM9000_RCR		0x05
     79  1.3  nisimura #define  DM9000_RCR_RXEN	(1<<0)	/* activate Rx */
     80  1.3  nisimura #define  DM9000_RCR_PRMSC	(1<<1)	/* enable promisc mode */
     81  1.3  nisimura #define  DM9000_RCR_RUNT	(1<<2)	/* allow to receive runt frame */
     82  1.3  nisimura #define  DM9000_RCR_ALL		(1<<3)	/* accept all multicast */
     83  1.3  nisimura #define  DM9000_RCR_DIS_CRC	(1<<4)	/* drop bad CRC frame */
     84  1.3  nisimura #define  DM9000_RCR_DIS_LONG	(1<<5)	/* drop too long frame (>1522) */
     85  1.3  nisimura #define  DM9000_RCR_WTDIS	(1<<6)	/* disable Rx watchdog timer */
     86  1.1     ahoka #define DM9000_RSR		0x06
     87  1.3  nisimura #define  DM9000_RSR_FOE		(1<<0)	/* Rx FIFO overflow detected */
     88  1.1     ahoka #define  DM9000_RSR_CE		(1<<1)
     89  1.1     ahoka #define  DM9000_RSR_AE		(1<<2)
     90  1.1     ahoka #define  DM9000_RSR_PLE		(1<<3)
     91  1.1     ahoka #define  DM9000_RSR_RWTO	(1<<4)
     92  1.1     ahoka #define  DM9000_RSR_LCS		(1<<5)
     93  1.3  nisimura #define  DM9000_RSR_MF		(1<<6)	/* mcast/bcast frame received */
     94  1.3  nisimura #define  DM9000_RSR_RF		(1<<7)	/* runt frame received (<64 bytes) */
     95  1.1     ahoka #define DM9000_ROCR		0x07
     96  1.1     ahoka #define DM9000_BPTR		0x08
     97  1.1     ahoka #define DM9000_FCTR		0x09
     98  1.1     ahoka #define DM9000_FCR		0x0A
     99  1.3  nisimura #define  DM9000_FCR_FLCE	(1<<0)	/* flow control enable */
    100  1.3  nisimura #define  DM9000_FCR_RXPCS	(1<<1)	/* Rx PAUSE current status */
    101  1.3  nisimura #define  DM9000_FCR_RXPS	(1<<2)	/* Rx PAUSE status, read to clear */
    102  1.3  nisimura #define  DM9000_FCR_BKPM	(1<<3)
    103  1.3  nisimura #define  DM9000_FCR_BKPA	(1<<4)
    104  1.3  nisimura #define  DM9000_FCR_TXPEN	(1<<5)	/* force PAUSE/unPAUSE */
    105  1.3  nisimura #define  DM9000_FCR_TXPF	(1<<6)	/* Tx PAUSE packet (when full */
    106  1.3  nisimura #define  DM9000_FCR_TXP0	(1<<7)	/* Tx PAUSE packet (when empty) */
    107  1.1     ahoka #define DM9000_EPCR		0x0B
    108  1.3  nisimura #define  DM9000_EPCR_ERRE	(1<<0)	/* operation in progress, busy bit */
    109  1.3  nisimura #define  DM9000_EPCR_ERPRW	(1<<1)	/* instruct to write */
    110  1.3  nisimura #define  DM9000_EPCR_ERPRR	(1<<2)	/* instruct to read */
    111  1.3  nisimura #define  DM9000_EPCR_EPOS_EEPROM (0<<3)	/* 1: PHY op, 0: EEPROM op */
    112  1.3  nisimura #define  DM9000_EPCR_EPOS_PHY    (1<<3)
    113  1.3  nisimura #define  DM9000_EPCR_WEP	(1<<4)
    114  1.3  nisimura #define  DM9000_EPCR_REEP	(1<<5)
    115  1.3  nisimura #define DM9000_EPAR		0x0C	/* 7:6 (!!) PHY id, 5:0 reg num */
    116  1.3  nisimura #define  DM9000_EPAR_EROA_MASK	0x3F	/* bits 0-5 */
    117  1.3  nisimura #define  DM9000_EPAR_INT_PHY	0x40	/* EPAR[7:6] = 01 for internal PHY */
    118  1.3  nisimura #define DM9000_EPDRL		0x0D	/* data 7:0 */
    119  1.3  nisimura #define DM9000_EPDRH		0x0E	/* data 15:8 */
    120  1.1     ahoka #define DM9000_WCR		0x0F
    121  1.1     ahoka 
    122  1.3  nisimura #define DM9000_PAB0		0x10	/* my station address 7:0 */
    123  1.1     ahoka #define DM9000_PAB1		0x11
    124  1.1     ahoka #define DM9000_PAB2		0x12
    125  1.1     ahoka #define DM9000_PAB3		0x13
    126  1.1     ahoka #define DM9000_PAB4		0x14
    127  1.3  nisimura #define DM9000_PAB5		0x15	/* my station address 47:40 */
    128  1.1     ahoka 
    129  1.3  nisimura #define DM9000_MAB0		0x16	/* 64bit mcast hash filter 7:0 */
    130  1.1     ahoka #define DM9000_MAB1		0x17
    131  1.1     ahoka #define DM9000_MAB2		0x18
    132  1.1     ahoka #define DM9000_MAB3		0x19
    133  1.1     ahoka #define DM9000_MAB4		0x1A
    134  1.1     ahoka #define DM9000_MAB5		0x1B
    135  1.1     ahoka #define DM9000_MAB6		0x1C
    136  1.3  nisimura #define DM9000_MAB7		0x1D	/* 63:56, needs 0x80 to catch bcast */
    137  1.1     ahoka 
    138  1.1     ahoka #define DM9000_GPCR		0x1E
    139  1.3  nisimura #define  DM9000_GPCR_GPIO0_OUT	(1<<0)
    140  1.1     ahoka #define DM9000_GPR		0x1F
    141  1.3  nisimura #define  DM9000_GPR_PHY_PWROFF	(1<<0)	/* power down internal PHY */
    142  1.1     ahoka #define DM9000_TRPAL		0x22
    143  1.1     ahoka #define DM9000_TRPAH		0x23
    144  1.3  nisimura #define DM9000_RWPAL		0x24
    145  1.3  nisimura #define DM9000_RWPAH		0x25
    146  1.1     ahoka 
    147  1.3  nisimura #define DM9000_VID0	0x28	/* vender ID 7:0 */
    148  1.3  nisimura #define DM9000_VID1	0x29	/* vender ID 15:8 */
    149  1.3  nisimura #define DM9000_PID0	0x2A	/* product ID 7:0 */
    150  1.3  nisimura #define DM9000_PID1	0x2B	/* product ID 15:8 */
    151  1.1     ahoka 
    152  1.1     ahoka #define DM9000_CHIPR	0x2C
    153  1.1     ahoka #define DM9000_SMCR	0x2F
    154  1.3  nisimura #define DM9000_MRCMDX	0xF0	/* "no increment"   read byte */
    155  1.3  nisimura #define DM9000_MRCMD	0xF2	/* "auto increment" read byte */
    156  1.1     ahoka #define DM9000_MRRL	0xF4
    157  1.1     ahoka #define DM9000_MRRH	0xF5
    158  1.3  nisimura #define DM9000_MWCMDX	0xF6	/* "no increment"   write byte */
    159  1.3  nisimura #define DM9000_MWCMD	0xF8	/* "auto increment" write byte */
    160  1.1     ahoka #define DM9000_MWRL	0xFA
    161  1.1     ahoka #define DM9000_MWRH	0xFB
    162  1.3  nisimura #define DM9000_TXPLL	0xFC	/* frame len 7:0 to transmit */
    163  1.3  nisimura #define DM9000_TXPLH	0xFD	/* frame len 15:8 to transmit */
    164  1.3  nisimura #define DM9000_ISR	0xFE	/* interrupt status report */
    165  1.1     ahoka #define  DM9000_IOMODE_MASK	0xC0
    166  1.1     ahoka #define  DM9000_IOMODE_SHIFT	6
    167  1.3  nisimura #define  DM9000_ISR_PRS		(1<<0)	/* receive completed */
    168  1.3  nisimura #define  DM9000_ISR_PTS		(1<<1)	/* transmit completed */
    169  1.1     ahoka #define  DM9000_ISR_ROS		(1<<2)
    170  1.1     ahoka #define  DM9000_ISR_ROOS	(1<<3)
    171  1.3  nisimura #define  DM9000_ISR_UNDERRUN	(1<<4)	/* Tx underrun detected */
    172  1.3  nisimura #define  DM9000_ISR_LNKCHNG	(1<<5)	/* link status change detected */
    173  1.1     ahoka #define DM9000_IMR	0xFF
    174  1.1     ahoka #define  DM9000_IMR_PRM 	(1<<0)
    175  1.1     ahoka #define  DM9000_IMR_PTM 	(1<<1)
    176  1.1     ahoka #define  DM9000_IMR_ROM 	(1<<2)
    177  1.1     ahoka #define  DM9000_IMR_ROOM	(1<<3)
    178  1.3  nisimura #define  DM9000_IMR_PAR 	(1<<7)	/* use 3/13K SRAM w/ auto wrap */
    179  1.1     ahoka 
    180  1.4  nisimura #endif
    181