Home | History | Annotate | Line # | Download | only in usb
ehcireg.h revision 1.6
      1 /*	$NetBSD: ehcireg.h,v 1.6 2001/11/16 01:57:08 augustss Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 2001 The NetBSD Foundation, Inc.
      5  * All rights reserved.
      6  *
      7  * This code is derived from software contributed to The NetBSD Foundation
      8  * by Lennart Augustsson (lennart (at) augustsson.net).
      9  *
     10  * Redistribution and use in source and binary forms, with or without
     11  * modification, are permitted provided that the following conditions
     12  * are met:
     13  * 1. Redistributions of source code must retain the above copyright
     14  *    notice, this list of conditions and the following disclaimer.
     15  * 2. Redistributions in binary form must reproduce the above copyright
     16  *    notice, this list of conditions and the following disclaimer in the
     17  *    documentation and/or other materials provided with the distribution.
     18  * 3. All advertising materials mentioning features or use of this software
     19  *    must display the following acknowledgement:
     20  *        This product includes software developed by the NetBSD
     21  *        Foundation, Inc. and its contributors.
     22  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  *    contributors may be used to endorse or promote products derived
     24  *    from this software without specific prior written permission.
     25  *
     26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  * POSSIBILITY OF SUCH DAMAGE.
     37  */
     38 
     39 /*
     40  * EHCI 0.96 spec can be found at
     41  * http://developer.intel.com/technology/usb/download/ehci-r096.pdf
     42  */
     43 
     44 #ifndef _DEV_PCI_EHCIREG_H_
     45 #define _DEV_PCI_EHCIREG_H_
     46 
     47 /*** PCI config registers ***/
     48 
     49 #define PCI_CBMEM		0x10	/* configuration base MEM */
     50 
     51 #define PCI_INTERFACE_EHCI	0x20
     52 
     53 #define PCI_USBREV		0x60	/* RO USB protocol revision */
     54 #define  PCI_USBREV_MASK	0xff
     55 #define  PCI_USBREV_PRE_1_0	0x00
     56 #define  PCI_USBREV_1_0		0x10
     57 #define  PCI_USBREV_1_1		0x11
     58 #define  PCI_USBREV_2_0		0x20
     59 
     60 #define PCI_EHCI_FLADJ		0x61	/*RW Frame len adj, SOF=59488+6*fladj */
     61 
     62 #define PCI_EHCI_PORTWAKECAP	0x62	/* RW Port wake caps (opt)  */
     63 
     64 /* Regs ar EECP + offset */
     65 #define PCI_EHCI_USBLEGSUP	0x00
     66 #define PCI_EHCI_USBLEGCTLSTS	0x04
     67 
     68 /*** EHCI capability registers ***/
     69 
     70 #define EHCI_CAPLENGTH		0x00	/*RO Capability register length field */
     71 /* reserved			0x01 */
     72 #define EHCI_HCIVERSION		0x02	/* RO Interface version number */
     73 
     74 #define EHCI_HCSPARAMS		0x04	/* RO Structural parameters */
     75 #define  EHCI_HCS_DEBUGPORT(x)	(((x) >> 20) & 0xf)
     76 #define  EHCI_HCS_P_INCICATOR(x) ((x) & 0x10000)
     77 #define  EHCI_HCS_N_CC(x)	(((x) >> 12) & 0xf) /* # of companion ctlrs */
     78 #define  EHCI_HCS_N_PCC(x)	(((x) >> 8) & 0xf) /* # of ports per comp. */
     79 #define  EHCI_HCS_PPC(x)	((x) & 0x10) /* port power control */
     80 #define  EHCI_HCS_N_PORTS(x)	((x) & 0xf) /* # of ports */
     81 
     82 #define EHCI_HCCPARAMS		0x08	/* RO Capability parameters */
     83 #define  EHCI_HCC_EECP(x)	(((x) >> 8) & 0xff) /* extended ports caps */
     84 #define  EHCI_HCC_IST(x)	(((x) >> 4) & 0xf) /* isoc sched threshold */
     85 #define  EHCI_HCC_ASPC(x)	((x) & 0x4) /* async sched park cap */
     86 #define  EHCI_HCC_PFLF(x)	((x) & 0x2) /* prog frame list flag */
     87 #define  EHCI_HCC_64BIT(x)	((x) & 0x1) /* 64 bit address cap */
     88 
     89 #define EHCI_HCSP_PORTROUTE	0x0c	/*RO Companion port route description */
     90 
     91 /* EHCI operational registers.  Offset given by EHCI_CAPLENGTH register */
     92 #define EHCI_USBCMD		0x00	/* RO, RW, WO Command register */
     93 #define  EHCI_CMD_ITC_M		0x00ff0000 /* RW interrupt threshold ctrl */
     94 #define   EHCI_CMD_ITC_1	0x00010000
     95 #define   EHCI_CMD_ITC_2	0x00020000
     96 #define   EHCI_CMD_ITC_4	0x00040000
     97 #define   EHCI_CMD_ITC_8	0x00080000
     98 #define   EHCI_CMD_ITC_16	0x00100000
     99 #define   EHCI_CMD_ITC_32	0x00200000
    100 #define   EHCI_CMD_ITC_64	0x00400000
    101 #define  EHCI_CMD_ASPME		0x00000800 /* RW/RO async park enable */
    102 #define  EHCI_CMD_ASPMC		0x00000300 /* RW/RO async park count */
    103 #define  EHCI_CMD_LHCR		0x00000080 /* RW light host ctrl reset */
    104 #define  EHCI_CMD_IAAD		0x00000040 /* RW intr on async adv door bell */
    105 #define  EHCI_CMD_ASE		0x00000020 /* RW async sched enable */
    106 #define  EHCI_CMD_PSE		0x00000010 /* RW periodic sched enable */
    107 #define  EHCI_CMD_FLS_M		0x0000000c /* RW/RO frame list size */
    108 #define  EHCI_CMD_FLS(x)	(((x) >> 2) & 3) /* RW/RO frame list size */
    109 #define  EHCI_CMD_HCRESET	0x00000002 /* RW reset */
    110 #define  EHCI_CMD_RS		0x00000001 /* RW run/stop */
    111 
    112 #define EHCI_USBSTS		0x04	/* RO, RW, RWC Status register */
    113 #define  EHCI_STS_ASS		0x00008000 /* RO async sched status */
    114 #define  EHCI_STS_PSS		0x00004000 /* RO periodic sched status */
    115 #define  EHCI_STS_REC		0x00002000 /* RO reclamation */
    116 #define  EHCI_STS_HCH		0x00001000 /* RO host controller halted */
    117 #define  EHCI_STS_IAA		0x00000020 /* RWC interrupt on async adv */
    118 #define  EHCI_STS_HSE		0x00000010 /* RWC host system error */
    119 #define  EHCI_STS_FLR		0x00000008 /* RWC frame list rollover */
    120 #define  EHCI_STS_PCD		0x00000004 /* RWC port change detect */
    121 #define  EHCI_STS_ERRINT	0x00000002 /* RWC error interrupt */
    122 #define  EHCI_STS_INT		0x00000001 /* RWC interrupt */
    123 #define  EHCI_STS_INTRS(x)	((x) & 0x2f)
    124 
    125 #define EHCI_NORMAL_INTRS (EHCI_STS_IAA | EHCI_STS_HSE | EHCI_STS_PCD | EHCI_STS_ERRINT | EHCI_STS_INT)
    126 
    127 #define EHCI_USBINTR		0x08	/* RW Interrupt register */
    128 #define EHCI_INTR_IAAE		0x00000020 /* interrupt on async advance ena */
    129 #define EHCI_INTR_HSEE		0x00000010 /* host system error ena */
    130 #define EHCI_INTR_FLRE		0x00000008 /* frame list rollover ena */
    131 #define EHCI_INTR_PCIE		0x00000004 /* port change ena */
    132 #define EHCI_INTR_UEIE		0x00000002 /* USB error intr ena */
    133 #define EHCI_INTR_UIE		0x00000001 /* USB intr ena */
    134 
    135 #define EHCI_FRINDEX		0x0c	/* RW Frame Index register */
    136 
    137 #define EHCI_CTRLDSSEGMENT	0x10	/* RW Control Data Structure Segment */
    138 
    139 #define EHCI_PERIODICLISTBASE	0x14	/* RW Periodic List Base */
    140 #define EHCI_ASYNCLISTADDR	0x18	/* RW Async List Base */
    141 
    142 #define EHCI_CONFIGFLAG		0x40	/* RW Configure Flag register */
    143 #define  EHCI_CONF_CF		0x00000001 /* RW configure flag */
    144 
    145 #define EHCI_PORTSC(n)		(0x40+4*(n)) /* RO, RW, RWC Port Status reg */
    146 #define  EHCI_PS_WKOC_E		0x00400000 /* RW wake on over current ena */
    147 #define  EHCI_PS_WKDSCNNT_E	0x00200000 /* RW wake on disconnect ena */
    148 #define  EHCI_PS_WKCNNT_E	0x00100000 /* RW wake on connect ena */
    149 #define  EHCI_PS_PTC		0x000f0000 /* RW port test control */
    150 #define  EHCI_PS_PIC		0x0000c000 /* RW port indicator control */
    151 #define  EHCI_PS_PO		0x00002000 /* RW port owner */
    152 #define  EHCI_PS_PP		0x00001000 /* RW,RO port power */
    153 #define  EHCI_PS_LS		0x00000c00 /* RO line status */
    154 #define  EHCI_PS_IS_LOWSPEED(x)	(((x) & EHCI_PS_LS) == 0x00000400)
    155 #define  EHCI_PS_PR		0x00000100 /* RW port reset */
    156 #define  EHCI_PS_SUSP		0x00000080 /* RW suspend */
    157 #define  EHCI_PS_FPR		0x00000040 /* RW force port resume */
    158 #define  EHCI_PS_OCC		0x00000020 /* RWC over current change */
    159 #define  EHCI_PS_OCA		0x00000010 /* RO over current active */
    160 #define  EHCI_PS_PEC		0x00000008 /* RWC port enable change */
    161 #define  EHCI_PS_PE		0x00000004 /* RW port enable */
    162 #define  EHCI_PS_CSC		0x00000002 /* RWC connect status change */
    163 #define  EHCI_PS_CS		0x00000001 /* RO connect status */
    164 #define  EHCI_PS_CLEAR		(EHCI_PS_OCC|EHCI_PS_PEC|EHCI_PS_CSC)
    165 
    166 #define EHCI_FLALIGN_ALIGN	0x1000
    167 
    168 #endif /* _DEV_PCI_EHCIREG_H_ */
    169