Home | History | Annotate | Line # | Download | only in xscale
ixp425_if_npereg.h revision 1.1.64.1
      1  1.1.64.1  skrll /*	$NetBSD: ixp425_if_npereg.h,v 1.1.64.1 2009/04/28 07:33:46 skrll Exp $	*/
      2       1.1    scw 
      3       1.1    scw /*-
      4       1.1    scw  * Copyright (c) 2006 Sam Leffler, Errno Consulting
      5       1.1    scw  * All rights reserved.
      6       1.1    scw  *
      7       1.1    scw  * Redistribution and use in source and binary forms, with or without
      8       1.1    scw  * modification, are permitted provided that the following conditions
      9       1.1    scw  * are met:
     10       1.1    scw  * 1. Redistributions of source code must retain the above copyright
     11       1.1    scw  *    notice, this list of conditions and the following disclaimer,
     12       1.1    scw  *    without modification.
     13       1.1    scw  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
     14       1.1    scw  *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
     15       1.1    scw  *    redistribution must be conditioned upon including a substantially
     16       1.1    scw  *    similar Disclaimer requirement for further binary redistribution.
     17       1.1    scw  *
     18       1.1    scw  * NO WARRANTY
     19       1.1    scw  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     20       1.1    scw  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     21       1.1    scw  * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
     22       1.1    scw  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
     23       1.1    scw  * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
     24       1.1    scw  * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25       1.1    scw  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26       1.1    scw  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
     27       1.1    scw  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28       1.1    scw  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
     29       1.1    scw  * THE POSSIBILITY OF SUCH DAMAGES.
     30       1.1    scw  *
     31       1.1    scw  * $FreeBSD: src/sys/arm/xscale/ixp425/if_npereg.h,v 1.1 2006/11/19 23:55:23 sam Exp $
     32       1.1    scw  */
     33       1.1    scw 
     34       1.1    scw /*
     35       1.1    scw  * Copyright (c) 2001-2005, Intel Corporation.
     36       1.1    scw  * All rights reserved.
     37       1.1    scw  *
     38       1.1    scw  * Redistribution and use in source and binary forms, with or without
     39       1.1    scw  * modification, are permitted provided that the following conditions
     40       1.1    scw  * are met:
     41       1.1    scw  * 1. Redistributions of source code must retain the above copyright
     42       1.1    scw  *    notice, this list of conditions and the following disclaimer.
     43       1.1    scw  * 2. Redistributions in binary form must reproduce the above copyright
     44       1.1    scw  *    notice, this list of conditions and the following disclaimer in the
     45       1.1    scw  *    documentation and/or other materials provided with the distribution.
     46       1.1    scw  * 3. Neither the name of the Intel Corporation nor the names of its contributors
     47       1.1    scw  *    may be used to endorse or promote products derived from this software
     48       1.1    scw  *    without specific prior written permission.
     49       1.1    scw  *
     50       1.1    scw  *
     51       1.1    scw  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
     52       1.1    scw  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     53       1.1    scw  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     54       1.1    scw  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
     55       1.1    scw  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     56       1.1    scw  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     57       1.1    scw  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     58       1.1    scw  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     59       1.1    scw  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     60       1.1    scw  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     61       1.1    scw  * SUCH DAMAGE.
     62       1.1    scw  */
     63       1.1    scw 
     64       1.1    scw #ifndef ARM_XSCALE_IF_NPEREG_H
     65       1.1    scw #define	ARM_XSCALE_IF_NPEREG_H
     66       1.1    scw 
     67       1.1    scw /*
     68       1.1    scw  * NPE/NPE tx/rx descriptor format.  This is just the area
     69       1.1    scw  * shared with ucode running in the NPE; the driver-specific
     70       1.1    scw  * state is defined in the driver.  The shared area must be
     71       1.1    scw  * cacheline-aligned.  We allocate NPE_MAXSEG "descriptors"
     72       1.1    scw  * per buffer; this allows us to do minimal s/g.  The number
     73       1.1    scw  * of descriptors can be expanded but doing so uses memory
     74       1.1    scw  * so should be done with care.
     75       1.1    scw  *
     76       1.1    scw  * The driver sets up buffers in uncached memory.
     77       1.1    scw  */
     78       1.1    scw #define	NPE_MAXSEG	3		/* empirically selected */
     79       1.1    scw 
     80       1.1    scw struct npehwbuf {
     81       1.1    scw 	struct {			/* NPE shared area, cacheline aligned */
     82       1.1    scw 		uint32_t next;		/* phys addr of next segment */
     83       1.1    scw 		uint32_t len;		/* buffer/segment length (bytes) */
     84       1.1    scw 		uint32_t data;		/* phys addr of data segment */
     85       1.1    scw 		uint32_t pad[5];	/* pad to cacheline */
     86       1.1    scw 	} ix_ne[NPE_MAXSEG];
     87       1.1    scw };
     88       1.1    scw 
     89       1.1    scw /* NPE ID's */
     90       1.1    scw #define	NPE_A		0
     91       1.1    scw #define	NPE_B		1
     92       1.1    scw #define	NPE_C		2
     93       1.1    scw #define	NPE_MAX		(NPE_C+1)
     94       1.1    scw 
     95       1.1    scw #define NPE_PORTS_MAX		2	/* logical ports */
     96       1.1    scw #define NPE_FRAME_SIZE_DEFAULT	1536
     97       1.1    scw #define NPE_FRAME_SIZE_MAX	(65536-64)
     98       1.1    scw #define NPE_FRAME_SIZE_MIN	64
     99       1.1    scw 
    100       1.1    scw /*
    101       1.1    scw  * Queue Manager-related definitions.
    102       1.1    scw  *
    103       1.1    scw  * These define the layout of 32-bit Q entries passed
    104       1.1    scw  * between the host cpu and the NPE's.
    105       1.1    scw  */
    106       1.1    scw #define	NPE_QM_Q_NPE(e)		(((e)>>0)&0x3)		/* NPE ID */
    107       1.1    scw #define	NPE_QM_Q_PORT(e)	(((e)>>3)&0x1)		/* Port ID */
    108       1.1    scw #define	NPE_QM_Q_PRIO(e)	(((e)>>0)&0x3)		/* 802.1d priority */
    109       1.1    scw #define	NPE_QM_Q_ADDR(e)	((e)&0xffffffe0u)	/* phys address */
    110       1.1    scw 
    111       1.1    scw /*
    112       1.1    scw  * Host->NPE requests written to the shared mailbox.
    113       1.1    scw  * The NPE writes the same value back as an ACK.
    114       1.1    scw  */
    115       1.1    scw #define	NPE_GETSTATUS		0x00	/* get firmware revision */
    116       1.1    scw #define	NPE_SETPORTADDRESS	0x01	/* set port id and mac address */
    117       1.1    scw #define	NPE_GETMACADDRDB	0x02	/* upload filter database */
    118       1.1    scw #define	NPE_SETMACADDRDB	0x03	/* download filter database */
    119       1.1    scw #define	NPE_GETSTATS		0x04	/* get statistics */
    120       1.1    scw #define	NPE_RESETSTATS		0x05	/* reset stats + return result */
    121       1.1    scw #define	NPE_SETMAXFRAME		0x06	/* configure max tx/rx frame lengths */
    122       1.1    scw #define	NPE_SETRXTAGMODE	0x07	/* configure VLAN rx operating mode */
    123       1.1    scw #define	NPE_SETDEFRXVID		0x08	/* set def VLAN tag + traffic class */
    124       1.1    scw #define	NPE_SETRXQOSENTRY	0x0b	/* map user pri -> QoS class+rx qid */
    125       1.1    scw #define	NPE_SETFIREWALLMODE	0x0e	/* config firewall services */
    126       1.1    scw #define	NPE_SETLOOPBACK		0x12	/* enable/disable loopback */
    127  1.1.64.1  skrll #define	NPE_ADDRESSFILTERCONFIG	0x14	/* update multicast filter */
    128  1.1.64.1  skrll #define	NPE_NOTIFYMACRECOVERYDONE 0x16	/* MAC has been recovered */
    129  1.1.64.1  skrll #define	NPE_MACRECOVERYSTART	0x17	/* message from NPE to recover MAC*/
    130       1.1    scw /* ... XXX more */
    131       1.1    scw 
    132       1.1    scw #define	NPE_MAC_MSGID_SHL	24
    133       1.1    scw #define	NPE_MAC_PORTID_SHL	16
    134       1.1    scw 
    135       1.1    scw /*
    136       1.1    scw  * MAC register definitions; see section
    137       1.1    scw  * 15.2 of the Intel Developers Manual.
    138       1.1    scw  */
    139       1.1    scw #define	NPE_MAC_TX_CNTRL1	0x000
    140       1.1    scw #define	NPE_MAC_TX_CNTRL2	0x004
    141       1.1    scw #define	NPE_MAC_RX_CNTRL1	0x010
    142       1.1    scw #define	NPE_MAC_RX_CNTRL2	0x014
    143       1.1    scw #define	NPE_MAC_RANDOM_SEED	0x020
    144       1.1    scw #define	NPE_MAC_THRESH_P_EMPTY	0x030
    145       1.1    scw #define	NPE_MAC_THRESH_P_FULL	0x038
    146       1.1    scw #define	NPE_MAC_BUF_SIZE_TX	0x040
    147       1.1    scw #define	NPE_MAC_TX_DEFER	0x050
    148       1.1    scw #define	NPE_MAC_RX_DEFER	0x054
    149       1.1    scw #define	NPE_MAC_TX_TWO_DEFER_1	0x060
    150       1.1    scw #define	NPE_MAC_TX_TWO_DEFER_2	0x064
    151       1.1    scw #define	NPE_MAC_SLOT_TIME	0x070
    152       1.1    scw #define	NPE_MAC_MDIO_CMD_1	0x080
    153       1.1    scw #define	NPE_MAC_MDIO_CMD_2	0x084
    154       1.1    scw #define	NPE_MAC_MDIO_CMD_3	0x088
    155       1.1    scw #define	NPE_MAC_MDIO_CMD_4	0x08c
    156       1.1    scw #define	NPE_MAC_MDIO_STS_1	0x090
    157       1.1    scw #define	NPE_MAC_MDIO_STS_2	0x094
    158       1.1    scw #define	NPE_MAC_MDIO_STS_3	0x098
    159       1.1    scw #define	NPE_MAC_MDIO_STS_4	0x09c
    160       1.1    scw #define	NPE_MAC_ADDR_MASK_1	0x0A0
    161       1.1    scw #define	NPE_MAC_ADDR_MASK_2	0x0A4
    162       1.1    scw #define	NPE_MAC_ADDR_MASK_3	0x0A8
    163       1.1    scw #define	NPE_MAC_ADDR_MASK_4	0x0AC
    164       1.1    scw #define	NPE_MAC_ADDR_MASK_5	0x0B0
    165       1.1    scw #define	NPE_MAC_ADDR_MASK_6	0x0B4
    166       1.1    scw #define	NPE_MAC_ADDR_1		0x0C0
    167       1.1    scw #define	NPE_MAC_ADDR_2		0x0C4
    168       1.1    scw #define	NPE_MAC_ADDR_3		0x0C8
    169       1.1    scw #define	NPE_MAC_ADDR_4		0x0CC
    170       1.1    scw #define	NPE_MAC_ADDR_5		0x0D0
    171       1.1    scw #define	NPE_MAC_ADDR_6		0x0D4
    172       1.1    scw #define	NPE_MAC_INT_CLK_THRESH	0x0E0
    173       1.1    scw #define	NPE_MAC_UNI_ADDR_1	0x0F0
    174       1.1    scw #define	NPE_MAC_UNI_ADDR_2	0x0F4
    175       1.1    scw #define	NPE_MAC_UNI_ADDR_3	0x0F8
    176       1.1    scw #define	NPE_MAC_UNI_ADDR_4	0x0FC
    177       1.1    scw #define	NPE_MAC_UNI_ADDR_5	0x100
    178       1.1    scw #define	NPE_MAC_UNI_ADDR_6	0x104
    179       1.1    scw #define	NPE_MAC_CORE_CNTRL	0x1FC
    180       1.1    scw 
    181       1.1    scw #define	NPE_MAC_ADDR_MASK(i)    (NPE_MAC_ADDR_MASK_1 + ((i)<<2))
    182       1.1    scw #define	NPE_MAC_ADDR(i)     	(NPE_MAC_ADDR_1 + ((i)<<2))
    183       1.1    scw #define	NPE_MAC_UNI_ADDR(i)    	(NPE_MAC_UNI_ADDR_1 + ((i)<<2))
    184       1.1    scw 
    185       1.1    scw /*
    186       1.1    scw  * Bit definitions
    187       1.1    scw  */
    188       1.1    scw 
    189       1.1    scw /* TX Control Register 1*/
    190       1.1    scw #define	NPE_TX_CNTRL1_TX_EN		0x01	/* enable TX engine */
    191       1.1    scw #define	NPE_TX_CNTRL1_DUPLEX		0x02	/* select half duplex */
    192       1.1    scw #define	NPE_TX_CNTRL1_RETRY		0x04	/* auto-retry on collision */
    193       1.1    scw #define	NPE_TX_CNTRL1_PAD_EN		0x08	/* pad frames <64 bytes */
    194       1.1    scw #define	NPE_TX_CNTRL1_FCS_EN		0x10	/* append FCS */
    195       1.1    scw #define	NPE_TX_CNTRL1_2DEFER		0x20	/* select 2-part deferral */
    196       1.1    scw #define	NPE_TX_CNTRL1_RMII		0x40
    197       1.1    scw 
    198       1.1    scw /* TX Control Register 2 */
    199       1.1    scw #define	NPE_TX_CNTRL2_RETRIES_MASK	0xf	/* max retry count */
    200       1.1    scw 
    201       1.1    scw /* RX Control Register 1 */
    202       1.1    scw #define	NPE_RX_CNTRL1_RX_EN		0x01	/* enable RX engine */
    203       1.1    scw #define	NPE_RX_CNTRL1_PADSTRIP_EN	0x02	/* strip frame padding */
    204       1.1    scw #define	NPE_RX_CNTRL1_CRC_EN		0x04	/* include CRC in RX frame */
    205       1.1    scw #define	NPE_RX_CNTRL1_PAUSE_EN		0x08	/* detect Pause frames */
    206       1.1    scw #define	NPE_RX_CNTRL1_LOOP_EN		0x10	/* loopback tx/rx */
    207       1.1    scw #define	NPE_RX_CNTRL1_ADDR_FLTR_EN	0x20	/* enable address filtering */
    208       1.1    scw #define	NPE_RX_CNTRL1_RX_RUNT_EN	0x40	/* enable RX of runt frames */
    209       1.1    scw #define	NPE_RX_CNTRL1_BCAST_DIS		0x80	/* discard broadcast frames */
    210       1.1    scw 
    211       1.1    scw /* RX Control Register 2 */
    212       1.1    scw #define	NPE_RX_CNTRL2_DEFER_EN	0x01
    213       1.1    scw 
    214       1.1    scw /* Core Control Register */
    215       1.1    scw #define	NPE_CORE_RESET			0x01	/* MAC reset state */
    216       1.1    scw #define	NPE_CORE_RX_FIFO_FLUSH		0x02	/* flush RX FIFO */
    217       1.1    scw #define	NPE_CORE_TX_FIFO_FLUSH		0x04	/* flush TX FIFO */
    218       1.1    scw #define	NPE_CORE_SEND_JAM		0x08	/* send JAM on packet RX */
    219       1.1    scw #define	NPE_CORE_MDC_EN			0x10	/* IXP42X drives MDC clock */
    220       1.1    scw 
    221       1.1    scw /*
    222       1.1    scw  * Stat block returned by NPE with NPE_GETSTATS msg.
    223       1.1    scw  */
    224       1.1    scw struct npestats {
    225       1.1    scw 	uint32_t dot3StatsAlignmentErrors;
    226       1.1    scw 	uint32_t dot3StatsFCSErrors;
    227       1.1    scw 	uint32_t dot3StatsInternalMacReceiveErrors;
    228       1.1    scw 	uint32_t RxOverrunDiscards;
    229       1.1    scw 	uint32_t RxLearnedEntryDiscards;
    230       1.1    scw 	uint32_t RxLargeFramesDiscards;
    231       1.1    scw 	uint32_t RxSTPBlockedDiscards;
    232       1.1    scw 	uint32_t RxVLANTypeFilterDiscards;
    233       1.1    scw 	uint32_t RxVLANIdFilterDiscards;
    234       1.1    scw 	uint32_t RxInvalidSourceDiscards;
    235       1.1    scw 	uint32_t RxBlackListDiscards;
    236       1.1    scw 	uint32_t RxWhiteListDiscards;
    237       1.1    scw 	uint32_t RxUnderflowEntryDiscards;
    238       1.1    scw 	uint32_t dot3StatsSingleCollisionFrames;
    239       1.1    scw 	uint32_t dot3StatsMultipleCollisionFrames;
    240       1.1    scw 	uint32_t dot3StatsDeferredTransmissions;
    241       1.1    scw 	uint32_t dot3StatsLateCollisions;
    242       1.1    scw 	uint32_t dot3StatsExcessiveCollisions;
    243       1.1    scw 	uint32_t dot3StatsInternalMacTransmitErrors;
    244       1.1    scw 	uint32_t dot3StatsCarrierSenseErrors;
    245       1.1    scw 	uint32_t TxLargeFrameDiscards;
    246       1.1    scw 	uint32_t TxVLANIdFilterDiscards;
    247       1.1    scw };
    248       1.1    scw 
    249       1.1    scw /*
    250       1.1    scw  * Default values
    251       1.1    scw  */
    252       1.1    scw #define NPE_MAC_INT_CLK_THRESH_DEFAULT  0x1
    253       1.1    scw 
    254       1.1    scw #define NPE_MAC_RESET_DELAY    1
    255       1.1    scw 
    256  1.1.64.1  skrll /* Slot time */
    257  1.1.64.1  skrll #define NPE_MAC_SLOT_TIME_MII_DEFAULT	0x80
    258       1.1    scw #define NPE_MAC_SLOT_TIME_RMII_DEFAULT  0xFF
    259       1.1    scw 
    260  1.1.64.1  skrll /* TX fifo threshold */
    261  1.1.64.1  skrll #define NPE_MAC_BUF_SIZE_TX_DEFAULT	0x18	/* CSR 2 or higher */
    262  1.1.64.1  skrll 
    263       1.1    scw /*
    264       1.1    scw  * MII definitions - these have been verified against the LXT971 and LXT972 PHYs
    265       1.1    scw  */
    266       1.1    scw #define	NPE_MII_REG_SHL		16
    267       1.1    scw #define	NPE_MII_ADDR_SHL	21
    268       1.1    scw 
    269       1.1    scw /* NB: shorthands for mii bus mdio routines */
    270       1.1    scw #define	NPE_MAC_MDIO_CMD	NPE_MAC_MDIO_CMD_1
    271       1.1    scw #define	NPE_MAC_MDIO_STS	NPE_MAC_MDIO_STS_1
    272       1.1    scw 
    273       1.1    scw #define NPE_MII_GO                  (1<<31)
    274       1.1    scw #define NPE_MII_WRITE               (1<<26)
    275       1.1    scw #define NPE_MII_TIMEOUT_10TH_SECS        5
    276       1.1    scw #define NPE_MII_10TH_SEC_IN_MILLIS     100
    277       1.1    scw #define NPE_MII_READ_FAIL           (1<<31)
    278       1.1    scw 
    279       1.1    scw #define NPE_MII_PHY_DEF_DELAY	300	/* max delay before link up, etc. */
    280       1.1    scw #define NPE_MII_PHY_NO_DELAY	0x0	/* do not delay */
    281       1.1    scw #define NPE_MII_PHY_NULL	0xff	/* PHY is not present */
    282       1.1    scw #define NPE_MII_PHY_DEF_ADDR	0x0	/* default PHY's logical address */
    283       1.1    scw 
    284       1.1    scw /* Register definition */
    285       1.1    scw #define NPE_MII_CTRL_REG	0x0	/* Control Register */
    286       1.1    scw #define NPE_MII_STAT_REG	0x1	/* Status Register */
    287       1.1    scw #define NPE_MII_PHY_ID1_REG	0x2	/* PHY identifier 1 Register */
    288       1.1    scw #define NPE_MII_PHY_ID2_REG	0x3	/* PHY identifier 2 Register */
    289       1.1    scw #define NPE_MII_AN_ADS_REG	0x4	/* Auto-Negotiation 	  */
    290       1.1    scw 					/* Advertisement Register */
    291       1.1    scw #define NPE_MII_AN_PRTN_REG	0x5	/* Auto-Negotiation 	    */
    292       1.1    scw 					/* partner ability Register */
    293       1.1    scw #define NPE_MII_AN_EXP_REG	0x6	/* Auto-Negotiation   */
    294       1.1    scw 					/* Expansion Register */
    295       1.1    scw #define NPE_MII_AN_NEXT_REG	0x7	/* Auto-Negotiation 	       */
    296       1.1    scw 					/* next-page transmit Register */
    297       1.1    scw #endif /* ARM_XSCALE_IF_NPEREG_H */
    298