/*	$NetBSD: octeon_usbcreg.h,v 1.1 2015/04/29 08:32:01 hikaru Exp $	*/

/*
 * Copyright (c) 2007 Internet Initiative Japan, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

/*
 * USBC Registers
 */

#ifndef _OCTEON_USBCREG_H_
#define _OCTEON_USBCREG_H_

/* ---- register addresses */

#define USBC_GOTGCTL				0x00016F0010000000ULL
#define USBC_GOTGINT				0x00016F0010000004ULL
#define USBC_GAHBCFG				0x00016F0010000008ULL
#define USBC_GUSBCFG				0x00016F001000000CULL
#define USBC_GRSTCTL				0x00016F0010000010ULL
#define USBC_GINTSTS				0x00016F0010000014ULL
#define USBC_GINTMSK				0x00016F0010000018ULL
#define USBC_GRXSTSRH				0x00016F001000001CULL
#define USBC_GRXSTSPH				0x00016F0010000020ULL
#define USBC_GRXFSIZ				0x00016F0010000024ULL
#define USBC_GNPTXFSIZ				0x00016F0010000028ULL
#define USBC_GNPTXSTS				0x00016F001000002CULL
#define USBC_GSNPSID				0x00016F0010000040ULL
#define USBC_GHWCFG1				0x00016F0010000044ULL
#define USBC_GHWCFG2				0x00016F0010000048ULL
#define USBC_GHWCFG3				0x00016F001000004CULL
#define USBC_GHWCFG4				0x00016F0010000050ULL
#define USBC_HPTXFSIZ				0x00016F0010000100ULL
#define USBC_DPTXFSIZ1				0x00016F0010000104ULL
#define USBC_DPTXFSIZ2				0x00016F0010000108ULL
#define USBC_DPTXFSIZ3				0x00016F001000010CULL
#define USBC_DPTXFSIZ4				0x00016F0010000110ULL
#define USBC_HCFG				0x00016F0010000400ULL
#define USBC_HFIR				0x00016F0010000404ULL
#define USBC_HFNUM				0x00016F0010000408ULL
#define USBC_HPTXSTS				0x00016F0010000410ULL
#define USBC_HAINT				0x00016F0010000414ULL
#define USBC_HAINTMSK				0x00016F0010000418ULL
#define USBC_HPRT				0x00016F0010000440ULL
#define USBC_HCCHAR0				0x00016F0010000500ULL
#define USBC_HCCHAR1				0x00016F0010000520ULL
#define USBC_HCCHAR2				0x00016F0010000540ULL
#define USBC_HCCHAR3				0x00016F0010000560ULL
#define USBC_HCCHAR4				0x00016F0010000580ULL
#define USBC_HCCHAR5				0x00016F00100005A0ULL
#define USBC_HCCHAR6				0x00016F00100005C0ULL
#define USBC_HCCHAR7				0x00016F00100005E0ULL
#define USBC_HCSPLT0				0x00016F0010000504ULL
#define USBC_HCSPLT1				0x00016F0010000524ULL
#define USBC_HCSPLT2				0x00016F0010000544ULL
#define USBC_HCSPLT3				0x00016F0010000564ULL
#define USBC_HCSPLT4				0x00016F0010000584ULL
#define USBC_HCSPLT5				0x00016F00100005A4ULL
#define USBC_HCSPLT6				0x00016F00100005C4ULL
#define USBC_HCSPLT7				0x00016F00100005E4ULL
#define USBC_HCINT0				0x00016F0010000508ULL
#define USBC_HCINT1				0x00016F0010000528ULL
#define USBC_HCINT2				0x00016F0010000548ULL
#define USBC_HCINT3				0x00016F0010000568ULL
#define USBC_HCINT4				0x00016F0010000588ULL
#define USBC_HCINT5				0x00016F00100005A8ULL
#define USBC_HCINT6				0x00016F00100005C8ULL
#define USBC_HCINT7				0x00016F00100005E8ULL
#define USBC_HCINTMSK0				0x00016F001000050CULL
#define USBC_HCINTMSK1				0x00016F001000052CULL
#define USBC_HCINTMSK2				0x00016F001000054CULL
#define USBC_HCINTMSK3				0x00016F001000056CULL
#define USBC_HCINTMSK4				0x00016F001000058CULL
#define USBC_HCINTMSK5				0x00016F00100005ACULL
#define USBC_HCINTMSK6				0x00016F00100005CCULL
#define USBC_HCINTMSK7				0x00016F00100005ECULL
#define USBC_HCTSIZ0				0x00016F0010000510ULL
#define USBC_HCTSIZ1				0x00016F0010000530ULL
#define USBC_HCTSIZ2				0x00016F0010000550ULL
#define USBC_HCTSIZ3				0x00016F0010000570ULL
#define USBC_HCTSIZ4				0x00016F0010000590ULL
#define USBC_HCTSIZ5				0x00016F00100005B0ULL
#define USBC_HCTSIZ6				0x00016F00100005D0ULL
#define USBC_HCTSIZ7				0x00016F00100005F0ULL
#define USBC_DCFG				0x00016F0010000800ULL
#define USBC_DCTL				0x00016F0010000804ULL
#define USBC_DSTS				0x00016F0010000808ULL
#define USBC_DIEPMSK				0x00016F0010000810ULL
#define USBC_DOEPMSK				0x00016F0010000814ULL
#define USBC_DAINT				0x00016F0010000818ULL
#define USBC_DAINTMSK				0x00016F001000081CULL
#define USBC_DTKNQR1				0x00016F0010000820ULL
#define USBC_DTKNQR2				0x00016F0010000824ULL
#define USBC_DTKNQR3				0x00016F0010000830ULL
#define USBC_DTKNQR4				0x00016F0010000834ULL
#define USBC_DIEPCTL0				0x00016F0010000900ULL
#define USBC_DIEPCTL1				0x00016F0010000920ULL
#define USBC_DIEPCTL2				0x00016F0010000940ULL
#define USBC_DIEPCTL3				0x00016F0010000960ULL
#define USBC_DIEPCTL4				0x00016F0010000980ULL
#define USBC_DIEPINT0				0x00016F0010000908ULL
#define USBC_DIEPINT1				0x00016F0010000928ULL
#define USBC_DIEPINT2				0x00016F0010000948ULL
#define USBC_DIEPINT3				0x00016F0010000968ULL
#define USBC_DIEPINT4				0x00016F0010000988ULL
#define USBC_DIEPTSIZ0				0x00016F0010000910ULL
#define USBC_DIEPTSIZ1				0x00016F0010000930ULL
#define USBC_DIEPTSIZ2				0x00016F0010000950ULL
#define USBC_DIEPTSIZ3				0x00016F0010000970ULL
#define USBC_DIEPTSIZ4				0x00016F0010000990ULL
#define USBC_OEPCTL0				0x00016F0010000B00ULL
#define USBC_OEPCTL1				0x00016F0010000B20ULL
#define USBC_OEPCTL2				0x00016F0010000B40ULL
#define USBC_OEPCTL3				0x00016F0010000B60ULL
#define USBC_OEPCTL4				0x00016F0010000B80ULL
#define USBC_OEPINT0				0x00016F0010000B08ULL
#define USBC_OEPINT1				0x00016F0010000B28ULL
#define USBC_OEPINT2				0x00016F0010000B48ULL
#define USBC_OEPINT3				0x00016F0010000B68ULL
#define USBC_OEPINT4				0x00016F0010000B88ULL
#define USBC_OEPTSIZ0				0x00016F0010000B10ULL
#define USBC_OEPTSIZ1				0x00016F0010000B30ULL
#define USBC_OEPTSIZ2				0x00016F0010000B50ULL
#define USBC_OEPTSIZ3				0x00016F0010000B70ULL
#define USBC_OEPTSIZ4				0x00016F0010000B90ULL
#define USBC_PCGCCTL				0x00016F0010000E00ULL
#define USBC_NPTXDFIFO0				0x00016F0010001000ULL
#define USBC_NPTXDFIFO1				0x00016F0010002000ULL
#define USBC_NPTXDFIFO2				0x00016F0010003000ULL
#define USBC_NPTXDFIFO3				0x00016F0010004000ULL
#define USBC_NPTXDFIFO4				0x00016F0010005000ULL
#define USBC_NPTXDFIFO5				0x00016F0010006000ULL
#define USBC_NPTXDFIFO6				0x00016F0010007000ULL
#define USBC_NPTXDFIFO7				0x00016F0010008000ULL
#define USBC_GRXSTSRD				0x00016F001004001CULL
#define USBC_GRXSTSPD				0x00016F0010040020ULL

/* ---- register bits */

#define USBC_GOTGCTL_XXX_31_21			0xffe00000
#define USBC_GOTGCTL_XXX_20			UINT32_C(0x00100000)
#define USBC_GOTGCTL_BSESVLD			UINT32_C(0x00080000)
#define USBC_GOTGCTL_ASESVLD			UINT32_C(0x00040000)
#define USBC_GOTGCTL_DBNCTIME			UINT32_C(0x00020000)
#define USBC_GOTGCTL_CONIDSTS			UINT32_C(0x00010000)
#define USBC_GOTGCTL_XXX_15_12			0x0000f000
#define USBC_GOTGCTL_DEVHNPEN			UINT32_C(0x00000800)
#define USBC_GOTGCTL_HSTSETHNPEN		UINT32_C(0x00000400)
#define USBC_GOTGCTL_HNPREQ			UINT32_C(0x00000200)
#define USBC_GOTGCTL_HSTNEGSCS			UINT32_C(0x00000100)
#define USBC_GOTGCTL_XXX_7_2			0x000000fc
#define USBC_GOTGCTL_SESREQ			UINT32_C(0x00000002)
#define USBC_GOTGCTL_SESREQSCS			UINT32_C(0x00000001)

#define USBC_GOTGINT_XXX_31_20			0xfff00000
#define USBC_GOTGINT_DBNCEDONE			UINT32_C(0x00080000)
#define USBC_GOTGINT_ADEVTOUTCHG		UINT32_C(0x00040000)
#define USBC_GOTGINT_HSTNEGDET			UINT32_C(0x00020000)
#define USBC_GOTGINT_XXX_16_10			0x0001fc00
#define USBC_GOTGINT_HSTNEGSUCSTSCHNG		UINT32_C(0x00000200)
#define USBC_GOTGINT_SESREQSUCSTSCHNG		UINT32_C(0x00000100)
#define USBC_GOTGINT_XXX_7_3			0x000000f8
#define USBC_GOTGINT_SESENDDET			UINT32_C(0x00000004)
#define USBC_GOTGINT_XXX_1			UINT32_C(0x00000002)
#define USBC_GOTGINT_XXX_0			UINT32_C(0x00000001)

#define USBC_GAHBCFG_XXX_31_9			0xfffffe00
#define USBC_GAHBCFG_PTXFEMPLVL			UINT32_C(0x00000100)
#define USBC_GAHBCFG_NPTXFEMPLVL		UINT32_C(0x00000080)
#define USBC_GAHBCFG_XXX_6			UINT32_C(0x00000040)
#define USBC_GAHBCFG_DMAEN			UINT32_C(0x00000020)
#define USBC_GAHBCFG_HBSTLEN			0x0000001e
#define USBC_GAHBCFG_HBSTLEN_OFFSET		1
#define USBC_GAHBCFG_GLBLINTRMSK		UINT32_C(0x00000001)

#define USBC_GUSBCFG_XXX_31_17			0xfffe0000
#define USBC_GUSBCFG_OTGI2CSEL			UINT32_C(0x00010000)
#define USBC_GUSBCFG_PHYLPWRCLKSEL		UINT32_C(0x00008000)
#define USBC_GUSBCFG_XXX_14			UINT32_C(0x00004000)
#define USBC_GUSBCFG_USBTRDTIM			0x00003c00
#define USBC_GUSBCFG_USBTRDTIM_OFFSET		10
#define USBC_GUSBCFG_HNPCAP			UINT32_C(0x00000200)
#define USBC_GUSBCFG_SRPCAP			UINT32_C(0x00000100)
#define USBC_GUSBCFG_DDRSEL			UINT32_C(0x00000080)
#define USBC_GUSBCFG_PHYSEL			UINT32_C(0x00000040)
#define USBC_GUSBCFG_FSINTF			UINT32_C(0x00000020)
#define USBC_GUSBCFG_ULPI_UTMI_SEL		UINT32_C(0x00000010)
#define USBC_GUSBCFG_PHYIF			UINT32_C(0x00000008)
#define USBC_GUSBCFG_TOUTCAL			0x00000007
#define USBC_GUSBCFG_TOUTCAL_OFFSET		0

#define USBC_GRSTCTL_AHBIDLE			UINT32_C(0x80000000)
#define USBC_GRSTCTL_DMAREQ			UINT32_C(0x40000000)
#define USBC_GRSTCTL_XXX_29_11			0x3ffff800
#define USBC_GRSTCTL_TXFNUM			0x000007c0
#define USBC_GRSTCTL_TXFNUM_OFFSET		6
#define USBC_GRSTCTL_TXFFLSH			UINT32_C(0x00000020)
#define USBC_GRSTCTL_RXFFLSH			UINT32_C(0x00000010)
#define USBC_GRSTCTL_INTKNQFLSH			UINT32_C(0x00000008)
#define USBC_GRSTCTL_FRMCNTRRST			UINT32_C(0x00000004)
#define USBC_GRSTCTL_HSFTRST			UINT32_C(0x00000002)
#define USBC_GRSTCTL_CSFTRST			UINT32_C(0x00000001)

#define USBC_GINTSTS_WKUPINT			UINT32_C(0x80000000)
#define USBC_GINTSTS_SESSREQINT			UINT32_C(0x40000000)
#define USBC_GINTSTS_DISCONNINT			UINT32_C(0x20000000)
#define USBC_GINTSTS_CONIDSTSCHNG		UINT32_C(0x10000000)
#define USBC_GINTSTS_XXX_27			UINT32_C(0x08000000)
#define USBC_GINTSTS_PTXFEMP			UINT32_C(0x04000000)
#define USBC_GINTSTS_HCHINT			UINT32_C(0x02000000)
#define USBC_GINTSTS_PRTINT			UINT32_C(0x01000000)
#define USBC_GINTSTS_XXX_23			UINT32_C(0x00800000)
#define USBC_GINTSTS_FETSUSP			UINT32_C(0x00400000)
#define USBC_GINTSTS_INCOMPLP			UINT32_C(0x00200000)
#define USBC_GINTSTS_INCOMPISOIN		UINT32_C(0x00100000)
#define USBC_GINTSTS_OEPINT			UINT32_C(0x00080000)
#define USBC_GINTSTS_IEPINT			UINT32_C(0x00040000)
#define USBC_GINTSTS_EPMIS			UINT32_C(0x00020000)
#define USBC_GINTSTS_XXX_16			UINT32_C(0x00010000)
#define USBC_GINTSTS_EOPF			UINT32_C(0x00008000)
#define USBC_GINTSTS_ISOOUTDROP			UINT32_C(0x00004000)
#define USBC_GINTSTS_ENUMDONE			UINT32_C(0x00002000)
#define USBC_GINTSTS_USBRST			UINT32_C(0x00001000)
#define USBC_GINTSTS_USBSUSP			UINT32_C(0x00000800)
#define USBC_GINTSTS_ERLYSUSP			UINT32_C(0x00000400)
#define USBC_GINTSTS_I2CINT			UINT32_C(0x00000200)
#define USBC_GINTSTS_ULPICKINT			UINT32_C(0x00000100)
#define USBC_GINTSTS_GOUTNAKEFF			UINT32_C(0x00000080)
#define USBC_GINTSTS_GINNAKEFF			UINT32_C(0x00000040)
#define USBC_GINTSTS_NPTXFEMP			UINT32_C(0x00000020)
#define USBC_GINTSTS_RXFLVL			UINT32_C(0x00000010)
#define USBC_GINTSTS_SOF			UINT32_C(0x00000008)
#define USBC_GINTSTS_OTGINT			UINT32_C(0x00000004)
#define USBC_GINTSTS_MODEMIS			UINT32_C(0x00000002)
#define USBC_GINTSTS_CURMOD			UINT32_C(0x00000001)
#define USBC_GINTSTS_CURMOD_OFFSET		0
#define  USBC_GINTSTS_CURMOD_DEVICE		0x0
#define  USBC_GINTSTS_CURMOD_HOST		0x1

#define USBC_GINTMSK_WKUPINTMSK			UINT32_C(0x80000000)
#define USBC_GINTMSK_SESSREQINTMSK		UINT32_C(0x40000000)
#define USBC_GINTMSK_DISCONNINTMSK		UINT32_C(0x20000000)
#define USBC_GINTMSK_CONIDSTSTCHNGMSK		UINT32_C(0x10000000)
#define USBC_GINTMSK_XXX_27			UINT32_C(0x08000000)
#define USBC_GINTMSK_PTXFEMPMSK			UINT32_C(0x04000000)
#define USBC_GINTMSK_HCHINTMSK			UINT32_C(0x02000000)
#define USBC_GINTMSK_PRTINTMSK			UINT32_C(0x01000000)
#define USBC_GINTMSK_XXX_23			UINT32_C(0x00800000)
#define USBC_GINTMSK_FETSUSPMSK			UINT32_C(0x00400000)
#define USBC_GINTMSK_INCOMPISOOUTMSK		UINT32_C(0x00200000)
#define USBC_GINTMSK_INCOMPISOINMSK		UINT32_C(0x00100000)
#define USBC_GINTMSK_OEPINTMSK			UINT32_C(0x00080000)
#define USBC_GINTMSK_INEPINTMSK			UINT32_C(0x00040000)
#define USBC_GINTMSK_EPMISMSK			UINT32_C(0x00020000)
#define USBC_GINTMSK_XXX_16			UINT32_C(0x00010000)
#define USBC_GINTMSK_EOPFMSK			UINT32_C(0x00008000)
#define USBC_GINTMSK_ISOOUTDROPMSK		UINT32_C(0x00004000)
#define USBC_GINTMSK_ENUMDONEMSK		UINT32_C(0x00002000)
#define USBC_GINTMSK_USBRSTMSK			UINT32_C(0x00001000)
#define USBC_GINTMSK_USBSUSPMSK			UINT32_C(0x00000800)
#define USBC_GINTMSK_ERLYSUSPMSK		UINT32_C(0x00000400)
#define USBC_GINTMSK_I2CINT			UINT32_C(0x00000200)
#define USBC_GINTMSK_ULPICKINTMSK		UINT32_C(0x00000100)
#define USBC_GINTMSK_GOUTNAKEFFMSK		UINT32_C(0x00000080)
#define USBC_GINTMSK_GINNAKEFFMSK		UINT32_C(0x00000040)
#define USBC_GINTMSK_NPTXFEMPMSK		UINT32_C(0x00000020)
#define USBC_GINTMSK_RXFLVLMSK			UINT32_C(0x00000010)
#define USBC_GINTMSK_SOFMSK			UINT32_C(0x00000008)
#define USBC_GINTMSK_OTGINTMSK			UINT32_C(0x00000004)
#define USBC_GINTMSK_MODEMISMSK			UINT32_C(0x00000002)
#define USBC_GINTMSK_XXX_0			UINT32_C(0x00000001)

#define USBC_GRXSTSRH_XXX_31_21			0xffe00000
#define USBC_GRXSTSRH_PKTSTS			0x001e0000
#define USBC_GRXSTSRH_PKTSTS_OFFSET		17
#define USBC_GRXSTSRH_DPID			0x00018000
#define USBC_GRXSTSRH_DPID_OFFSET		15
#define  USBC_GRXSTSRH_DPID_DATA0		0x00
#define  USBC_GRXSTSRH_DPID_DATA1		0x10
#define  USBC_GRXSTSRH_DPID_DATA2		0x01
#define  USBC_GRXSTSRH_DPID_MDATA		0x11
#define USBC_GRXSTSRH_BCNT			0x00007ff0
#define USBC_GRXSTSRH_BCNT_OFFSET		4
#define USBC_GRXSTSRH_CHNUM			0x0000000f
#define USBC_GRXSTSRH_CHNUM_OFFSET		0

#define USBC_GRXSTSPH_XXX_31_21			0xffe00000
#define USBC_GRXSTSPH_PKTSTS			0x001e0000
#define USBC_GRXSTSPH_PKTSTS_OFFSET		17
#define  USBC_GRXSTSPH_PKTSTS_IN_DATA_RECV	0x2
#define  USBC_GRXSTSPH_PKTSTS_IN_XFER_COMPL	0x3
#define  USBC_GRXSTSPH_PKTSTS_TGL_ERR		0x5
#define  USBC_GRXSTSPH_PKTSTS_CH_HLTD		0x7
#define USBC_GRXSTSPH_DPID			0x00018000
#define USBC_GRXSTSPH_DPID_OFFSET		15
#define  USBC_GRXSTSPH_DPID_DATA0		0x00
#define  USBC_GRXSTSPH_DPID_DATA1		0x10
#define  USBC_GRXSTSPH_DPID_DATA2		0x01
#define  USBC_GRXSTSPH_DPID_MDATA		0x11
#define USBC_GRXSTSPH_BCNT			0x00007ff0
#define USBC_GRXSTSPH_BCNT_OFFSET		4
#define USBC_GRXSTSPH_CHNUM			0x0000000f
#define USBC_GRXSTSPH_CHNUM_OFFSET		0

#define USBC_GRXSTSRD_XXX_31_25			0xfe000000
#define USBC_GRXSTSRD_FN			0x01e00000
#define USBC_GRXSTSRD_PKTSTS			0x001e0000
#define USBC_GRXSTSRD_DPID			0x00018000
#define USBC_GRXSTSRD_BCNT			0x00007ff0
#define USBC_GRXSTSRD_EPNUM			0x0000000f

#define USBC_GRXSTSPD_XXX_31_25			0xfe000000
#define USBC_GRXSTSPD_FN			0x01e00000
#define USBC_GRXSTSPD_PKTSTS			0x001e0000
#define USBC_GRXSTSPD_DPID			0x00018000
#define USBC_GRXSTSPD_BCNT			0x00007ff0
#define USBC_GRXSTSPD_EPNUM			0x0000000f

#define USBC_GRXFSIZ_XXX_31_16			0xffff0000
#define USBC_GRXFSIZ_RXFDEP			0x0000ffff

#define USBC_GNPTXFSIZ_NPTXFEDP			0xffff0000
#define USBC_GNPTXFSIZ_NPTXFEDP_OFFSET		16
#define USBC_GNPTXFSIZ_NPTXFSTADDR		0x0000ffff

#define USBC_GNPTXSTS_XXX_31			UINT32_C(0x80000000)
#define USBC_GNPTXSTS_NPTXQTOP_CHNUM		0x78000000
#define USBC_GNPTXSTS_NPTXQTOP_ENTRY		0x06000000
#define USBC_GNPTXSTS_NPTXQTOP_TERMINATE	UINT32_C(0x01000000)
#define USBC_GNPTXSTS_NPTXQSPCAVAIL		0x00ff0000
#define USBC_GNPTXSTS_NPTXQSPCAVAIL_OFFSET	16
#define USBC_GNPTXSTS_NPTXFSPCAVAIL		0x0000ffff
#define USBC_GNPTXSTS_NPTXFSPCAVAIL_OFFSET	0

#define USBC_GSNPSID_SYNOPSYSID			0xffffffff

#define USBC_GHWCFG1_EPDIR			0xffffffff

#define USBC_GHWCFG2_XXX_31			UINT32_C(0x80000000)
#define USBC_GHWCFG2_TKNQDEPTH			0x7c000000
#define USBC_GHWCFG2_PTXQDEPTH			0x03000000
#define USBC_GHWCFG2_PTXQDEPTH_OFFSET		24
#define USBC_GHWCFG2_NPTXQDEPTH			0x00c00000
#define USBC_GHWCFG2_NPTXQDEPTH_OFFSET		22
#define USBC_GHWCFG2_XXX_21_20			0x00300000
#define USBC_GHWCFG2_DYNFIFOSIZING		UINT32_C(0x00080000)
#define USBC_GHWCFG2_PERIOSUPPORT		UINT32_C(0x00040000)
#define USBC_GHWCFG2_NUMHSTCHN1			0x0003c000
#define USBC_GHWCFG2_NUMHSTCHN1_OFFSET		14
#define USBC_GHWCFG2_NUMDEVEPS			0x00003c00
#define USBC_GHWCFG2_FSPHYTYPE			0x00000300
#define USBC_GHWCFG2_HSPHYTYPE			0x000000c0
#define USBC_GHWCFG2_SINGPNT			UINT32_C(0x00000020)
#define USBC_GHWCFG2_OTGARCH			0x00000018
#define USBC_GHWCFG2_OTGARCH_OFFSET		3
#define  USBC_GHWCFG2_OTGARCH_SLAVEONLY		0x0
#define  USBC_GHWCFG2_OTGARCH_EXTERNALDMA	0x1
#define  USBC_GHWCFG2_OTGARCH_INTERNALDMA	0x2
#define  USBC_GHWCFG2_OTGARCH_RESERVED		0x3
#define USBC_GHWCFG2_OTGMODE			0x00000007

#define USBC_GHWCFG3_DFIFODEPTH			0xffff0000
#define USBC_GHWCFG3_DFIFODEPTH_OFFSET		16
#define USBC_GHWCFG3_XXX_15_13			0x0000e000
#define USBC_GHWCFG3_AHBPHYSYNC			UINT32_C(0x00001000)
#define USBC_GHWCFG3_RSTTYPE			UINT32_C(0x00000800)
#define USBC_GHWCFG3_OPTFEATURE			UINT32_C(0x00000400)
#define USBC_GHWCFG3_VENDOR_CONTROL_INTERFACE_SUPPORT	UINT32_C(0x00000200)
#define USBC_GHWCFG3_I2C_SELECTION		UINT32_C(0x00000100)
#define USBC_GHWCFG3_OTGEN			UINT32_C(0x00000080)
#define USBC_GHWCFG3_PKTSIZEWIDTH		0x00000070
#define USBC_GHWCFG3_XFERSIZEWIDTH		0x0000000f

#define USBC_GHWCFG4_XXX_31_25			0xfe000000
#define USBC_GHWCFG4_SESSENDFLTR		UINT32_C(0x01000000)
#define USBC_GHWCFG4_BVAILDFLTR			UINT32_C(0x01000000)
#define USBC_GHWCFG4_AVAILDFLTR			UINT32_C(0x00800000)
#define USBC_GHWCFG4_VBUSVALIDFLTR		UINT32_C(0x00400000)
#define USBC_GHWCFG4_IDDGFLTR			UINT32_C(0x00200000)
#define USBC_GHWCFG4_NUMCTLEPS			0x000f0000
#define USBC_GHWCFG4_PHYDATAWIDTH		0x0000c000
#define USBC_GHWCFG4_XXX_13_6			0x00003fc0
#define USBC_GHWCFG4_AHBFREQ			UINT32_C(0x00000020)
#define USBC_GHWCFG4_ENABLEPWROPT		UINT32_C(0x00000010)
#define USBC_GHWCFG4_NUMDEVPERIOEPS		0x0000000f

#define USBC_HPTXFSIZ_PTXFSIZE			0xffff0000
#define USBC_HPTXFSIZ_PTXFSIZE_OFFSET		16
#define	USBC_HPTXFSIZ_PTXFSTADDR		0x0000ffff
#define USBC_HPTXFSIZ_PTXFSTADDR_OFFSET		0

/* for USBC_DPTXFSIZ(1..4) */
#define USBC_DPTXFSIZX_DPTXFSIZE		0xffff0000
#define USBC_DPTXFSIZX_PTXFSTADDR		0x0000ffff

#define USBC_HCFG_XXX_31_3			0xfffffff8
#define USBC_HCFG_FSLSSUPP			UINT32_C(0x00000004)
#define USBC_HCFG_FSLSPCLKSEL			0x00000003
#define USBC_HCFG_FSLSPCLKSEL_OFFSET		0
#define  USBC_HCFG_FSLSPCLKSEL_30_60_MHZ	0x00
#define  USBC_HCFG_FSLSPCLKSEL_48_MHZ		0x01
#define  USBC_HCFG_FSLSPCLKSEL_6_MHZ		0x10

#define USBC_HFIR_XXX_31_16			0xffff0000
#define USBC_HFIR_FRINT				0x0000ffff
#define USBC_HFIR_FRINT_OFFSET			0

#define USBC_HFNUM_FRREM			0xffff0000
#define USBC_HFNUM_FRNUM			0x0000ffff

#define USBC_HPTXSTS_PTXQTOP			0xff000000
#define USBC_HPTXSTS_PTXQSPCAVAIL		0x00ff0000
#define USBC_HPTXSTS_PTXQSPCAVAIL_OFFSET	16
#define USBC_HPTXSTS_PTXFSPCAVAIL		0x0000ffff
#define USBC_HPTXSTS_PTXFSPCAVAIL_OFFSET	0

#define USBC_HAINT_XXX_31_16			0xffff0000
/* #define USBC_HAINT_HAINT			__BITS32(15, 0) */
#define USBC_HAINT_HAINT_F			UINT32_C(0x00008000)
#define USBC_HAINT_HAINT_E			UINT32_C(0x00004000)
#define USBC_HAINT_HAINT_D			UINT32_C(0x00002000)
#define USBC_HAINT_HAINT_C			UINT32_C(0x00001000)
#define USBC_HAINT_HAINT_B			UINT32_C(0x00000800)
#define USBC_HAINT_HAINT_A			UINT32_C(0x00000400)
#define USBC_HAINT_HAINT_9			UINT32_C(0x00000200)
#define USBC_HAINT_HAINT_8			UINT32_C(0x00000100)
#define USBC_HAINT_HAINT_7			UINT32_C(0x00000080)
#define USBC_HAINT_HAINT_6			UINT32_C(0x00000040)
#define USBC_HAINT_HAINT_5			UINT32_C(0x00000020)
#define USBC_HAINT_HAINT_4			UINT32_C(0x00000010)
#define USBC_HAINT_HAINT_3			UINT32_C(0x00000008)
#define USBC_HAINT_HAINT_2			UINT32_C(0x00000004)
#define USBC_HAINT_HAINT_1			UINT32_C(0x00000002)
#define USBC_HAINT_HAINT_0			UINT32_C(0x00000001)

#define USBC_HAINTMSK_XXX_31_16			0xffff0000
/*#define USBC_HAINTMSK_HAINTMSK			__BITS32(15, 0) */
#define USBC_HAINTMSK_HAINTMSK_F		UINT32_C(0x00008000)
#define USBC_HAINTMSK_HAINTMSK_E		UINT32_C(0x00004000)
#define USBC_HAINTMSK_HAINTMSK_D		UINT32_C(0x00002000)
#define USBC_HAINTMSK_HAINTMSK_C		UINT32_C(0x00001000)
#define USBC_HAINTMSK_HAINTMSK_B		UINT32_C(0x00000800)
#define USBC_HAINTMSK_HAINTMSK_A		UINT32_C(0x00000400)
#define USBC_HAINTMSK_HAINTMSK_9		UINT32_C(0x00000200)
#define USBC_HAINTMSK_HAINTMSK_8		UINT32_C(0x00000100)
#define USBC_HAINTMSK_HAINTMSK_7		UINT32_C(0x00000080)
#define USBC_HAINTMSK_HAINTMSK_6		UINT32_C(0x00000040)
#define USBC_HAINTMSK_HAINTMSK_5		UINT32_C(0x00000020)
#define USBC_HAINTMSK_HAINTMSK_4		UINT32_C(0x00000010)
#define USBC_HAINTMSK_HAINTMSK_3		UINT32_C(0x00000008)
#define USBC_HAINTMSK_HAINTMSK_2		UINT32_C(0x00000004)
#define USBC_HAINTMSK_HAINTMSK_1		UINT32_C(0x00000002)
#define USBC_HAINTMSK_HAINTMSK_0		UINT32_C(0x00000001)

#define USBC_HPRT_XXX_31_19			0xfff80000
#define USBC_HPRT_PRTSPD			0x00060000
#define USBC_HPRT_PRTSPD_OFFSET			17
#define  USBC_HPRT_PRTSPD_HIGH			0x0
#define  USBC_HPRT_PRTSPD_FULL			0x1
#define  USBC_HPRT_PRTSPD_LOW			0x2
#define  USBC_HPRT_PRTSPD_RESERVED		0x3
#define USBC_HPRT_PRTTSTCTL			0x0001e000
#define USBC_HPRT_PRTPWR			UINT32_C(0x00001000)
#define USBC_HPRT_PRTLNSTS			0x00000c00
#define USBC_HPRT_XXX_9				UINT32_C(0x00000200)
#define USBC_HPRT_PRTRST			UINT32_C(0x00000100)
#define USBC_HPRT_PRTSUSP			UINT32_C(0x00000080)
#define USBC_HPRT_PRTRES			UINT32_C(0x00000040)
#define USBC_HPRT_PRTOVRCURRCHNG		UINT32_C(0x00000020)
#define USBC_HPRT_PRTOVRCURRACT			UINT32_C(0x00000010)
#define USBC_HPRT_PRTENCHNG			UINT32_C(0x00000008)
#define USBC_HPRT_PRTENA			UINT32_C(0x00000004)
#define USBC_HPRT_PRTCONNDET			UINT32_C(0x00000002)
#define USBC_HPRT_PRTCONNSTS			UINT32_C(0x00000001)

/* for USBC_HCCHAR(0..7) */
#define USBC_HCCHARX_CHENA			UINT32_C(0x80000000)
#define USBC_HCCHARX_CHDIS			UINT32_C(0x40000000)
#define USBC_HCCHARX_ODDFRM			UINT32_C(0x20000000)
#define USBC_HCCHARX_DEVADDR			0x1fc00000
#define USBC_HCCHARX_DEVADDR_OFFSET		22
#define USBC_HCCHARX_EC				0x00300000
#define USBC_HCCHARX_EC_OFFSET			20
#define USBC_HCCHARX_EPTYPE			0x000c0000
#define USBC_HCCHARX_EPTYPE_OFFSET		18
#define  USBC_HCCHARX_EPTYPE_CONTROL		0x00
#define  USBC_HCCHARX_EPTYPE_ISOCHRONOUS	0x01
#define  USBC_HCCHARX_EPTYPE_BULK		0x02
#define  USBC_HCCHARX_EPTYPE_INTERRUPT		0x03
#define USBC_HCCHARX_LSPDDEV			UINT32_C(0x00020000)
#define USBC_HCCHARX_XXX_16			UINT32_C(0x00010000)
#define USBC_HCCHARX_EPDIR			UINT32_C(0x00008000)
#define USBC_HCCHARX_EPNUM			0x00007800
#define USBC_HCCHARX_EPNUM_OFFSET		11
#define USBC_HCCHARX_MPS			0x000007ff
#define USBC_HCCHARX_MPS_OFFSET			0

/* for USBC_HCSPLT(0..7) */
#define USBC_HCSPLTX_SPLTENA			UINT32_C(0x80000000)
#define USBC_HCSPLTX_XXX_30_17			0x7ffe0000
#define USBC_HCSPLTX_COMPSPLT			UINT32_C(0x00010000)
#define USBC_HCSPLTX_XACTPOS			0x0000c000
#define USBC_HCSPLTX_HUBADDR			0x00003f80
#define USBC_HCSPLTX_PRTADDR			0x0000007f

/* for USBC_HCINT(0..7) */
#define USBC_HCINTX_XXX_31_11			0xfffff800
#define	USBC_HCINTX_DATATGLERR			UINT32_C(0x00000400)
#define	USBC_HCINTX_FRMOVRUN			UINT32_C(0x00000200)
#define	USBC_HCINTX_BBLERR			UINT32_C(0x00000100)
#define	USBC_HCINTX_XACTERR			UINT32_C(0x00000080)
#define	USBC_HCINTX_NYET			UINT32_C(0x00000040)
#define	USBC_HCINTX_ACK				UINT32_C(0x00000020)
#define	USBC_HCINTX_NAK				UINT32_C(0x00000010)
#define	USBC_HCINTX_STALL			UINT32_C(0x00000008)
#define	USBC_HCINTX_AHBERR			UINT32_C(0x00000004)
#define	USBC_HCINTX_CHHLTD			UINT32_C(0x00000002)
#define	USBC_HCINTX_XFERCOMPL			UINT32_C(0x00000001)

/* for USBC_HCINTMSK(0..7) */
#define USBC_HCINTMSKX_XXX_31_11		0xfffff800
#define	USBC_HCINTMSKX_DATATGLERRMSK		UINT32_C(0x00000400)
#define	USBC_HCINTMSKX_FRMOVRUNMSK		UINT32_C(0x00000200)
#define	USBC_HCINTMSKX_BBLERRMSK		UINT32_C(0x00000100)
#define	USBC_HCINTMSKX_XACTERRMSK		UINT32_C(0x00000080)
#define	USBC_HCINTMSKX_NYETMSK			UINT32_C(0x00000040)
#define	USBC_HCINTMSKX_ACKMSK			UINT32_C(0x00000020)
#define	USBC_HCINTMSKX_NAKMSK			UINT32_C(0x00000010)
#define	USBC_HCINTMSKX_STALLMSK			UINT32_C(0x00000008)
#define	USBC_HCINTMSKX_AHBERRMSK		UINT32_C(0x00000004)
#define	USBC_HCINTMSKX_CHHLTDMSK		UINT32_C(0x00000002)
#define	USBC_HCINTMSKX_XFERCOMPLMSK		UINT32_C(0x00000001)

/* for USBC_HCTSIZ(0..7) */
#define USBC_HCTSIZX_DOPNG			UINT32_C(0x80000000)
#define USBC_HCTSIZX_PID			0x60000000
#define USBC_HCTSIZX_PID_OFFSET			29
#define  USBC_HCTSIZX_PID_DATA0			0x00
#define  USBC_HCTSIZX_PID_DATA2			0x01
#define  USBC_HCTSIZX_PID_DATA1			0x02
#define  USBC_HCTSIZX_PID_MDATA_SETUP		0x03
#define USBC_HCTSIZX_PKTCNT			0x1ff80000
#define USBC_HCTSIZX_PKTCNT_OFFSET		19
#define USBC_HCTSIZX_XFERSIZE			0x0007ffff
#define USBC_HCTSIZX_XFERSIZE_OFFSET		0

/* XXX Device Mode Registers */



/* for USBC_NPTXDFIFO(0..7) */
#define USBC_NPTXDFIFOX_DATA			0xffffffff

/* ---- snprintb */

#define	USBC_GOTGINT_BITS \
	"\177"		/* new format */ \
	"\020"		/* hex display */ \
	"\020"		/* %016x format */ \
	"b\x13"		"DBNCEDONE\0" \
	"b\x12"		"ADEVTOUTCHG\0" \
	"b\x11"		"HSTNEGDET\0" \
	"b\x09"		"HSTNEGSUCSTSCHNG\0" \
	"b\x08"		"SESREQSUCSTSCHNG\0" \
	"b\x02"		"SESENDDET\0"

#define	USBC_GINTSTS_BITS \
	"\177"		/* new format */ \
	"\020"		/* hex display */ \
	"\020"		/* %016x format */ \
	"b\x1f"		"WKUPINT\0" \
	"b\x1e"		"SESSREQINT\0" \
	"b\x1d"		"DISCONNINT\0" \
	"b\x1c"		"CONIDSTSCHNG\0" \
	"b\x1a"		"PTXFEMP\0" \
	"b\x19"		"HCHINT\0" \
	"b\x18"		"PRTINT\0" \
	"b\x16"		"FETSUSP\0" \
	"b\x15"		"INCOMPLP\0" \
	"b\x14"		"INCOMPISOIN\0" \
	"b\x13"		"OEPINT\0" \
	"b\x12"		"IEPINT\0" \
	"b\x11"		"EPMIS\0" \
	"b\x0f"		"EOPF\0" \
	"b\x0e"		"ISOOUTDROP\0" \
	"b\x0d"		"ENUMDONE\0" \
	"b\x0c"		"USBRST\0" \
	"b\x0b"		"USBSUSP\0" \
	"b\x0a"		"ERLYSUSP\0" \
	"b\x09"		"I2CINT\0" \
	"b\x08"		"ULPICKINT\0" \
	"b\x07"		"GOUTNAKEFF\0" \
	"b\x06"		"GINNAKEFF\0" \
	"b\x05"		"NPTXFEMP\0" \
	"b\x04"		"RXFLVL\0" \
	"b\x03"		"SOF\0" \
	"b\x02"		"OTGINT\0" \
	"b\x01"		"MODEMIS\0" \
	"b\x00"		"CURMOD\0"

#define	USBC_GINTMSK_BITS \
	"\177"		/* new format */ \
	"\020"		/* hex display */ \
	"\020"		/* %016x format */ \
	"b\x1f"		"WKUPINTMSK\0" \
	"b\x1e"		"SESSREQINTMSK\0" \
	"b\x1d"		"DISCONNINTMSK\0" \
	"b\x1c"		"CONIDSTSTCHNGMSK\0" \
	"b\x1a"		"PTXFEMPMSK\0" \
	"b\x19"		"HCHINTMSK\0" \
	"b\x18"		"PRTINTMSK\0" \
	"b\x16"		"FETSUSPMSK\0" \
	"b\x15"		"INCOMPISOOUTMSK\0" \
	"b\x14"		"INCOMPISOINMSK\0" \
	"b\x13"		"OEPINTMSK\0" \
	"b\x12"		"INEPINTMSK\0" \
	"b\x11"		"EPMISMSK\0" \
	"b\x0f"		"EOPFMSK\0" \
	"b\x0e"		"ISOOUTDROPMSK\0" \
	"b\x0d"		"ENUMDONEMSK\0" \
	"b\x0c"		"USBRSTMSK\0" \
	"b\x0b"		"USBSUSPMSK\0" \
	"b\x0a"		"ERLYSUSPMSK\0" \
	"b\x09"		"I2CINT\0" \
	"b\x08"		"ULPICKINTMSK\0" \
	"b\x07"		"GOUTNAKEFFMSK\0" \
	"b\x06"		"GINNAKEFFMSK\0" \
	"b\x05"		"NPTXFEMPMSK\0" \
	"b\x04"		"RXFLVLMSK\0" \
	"b\x03"		"SOFMSK\0" \
	"b\x02"		"OTGINTMSK\0" \
	"b\x01"		"MODEMISMSK\0"

#define	USBC_GRXSTSRH_BITS \
	"\177"		/* new format */ \
	"\020"		/* hex display */ \
	"\020"		/* %016x format */ \
	"f\x11\x04"	"PKTSTS\0" \
	"f\x0f\x02"	"DPID\0" \
	"f\x04\x0b"	"BCNT\0" \
	"f\x00\x04"	"CHNUM\0"

#define	USBC_GRXSTSPH_BITS \
	"\177"		/* new format */ \
	"\020"		/* hex display */ \
	"\020"		/* %016x format */ \
	"f\x11\x04"	"PKTSTS\0" \
	"f\x0f\x02"	"DPID\0" \
	"f\x04\x0b"	"BCNT\0" \
	"f\x00\x04"	"CHNUM\0"

#define	USBC_GUSBCFG_BITS \
	"\177"		/* new format */ \
	"\020"		/* hex display */ \
	"\020"		/* %016x format */ \
	"b\x10"		"OTGI2CSEL\0" \
	"b\x0f"		"PHYLPWRCLKSEL\0" \
	"f\x0a\x04"	"USBTRDTIM\0" \
	"b\x09"		"HNPCAP\0" \
	"b\x08"		"SRPCAP\0" \
	"b\x07"		"DDRSEL\0" \
	"b\x06"		"PHYSEL\0" \
	"b\x05"		"FSINTF\0" \
	"b\x04"		"ULPI_UTMI_SEL\0" \
	"b\x03"		"PHYIF\0" \
	"f\x00\x03"	"TOUTCAL\0"

#define	USBC_GRSTCTL_BITS \
	"\177"		/* new format */ \
	"\020"		/* hex display */ \
	"\020"		/* %016x format */ \
	"b\x1f"		"AHBIDLE\0" \
	"b\x1e"		"DMAREQ\0" \
	"f\x06\x05"	"TXFNUM\0" \
	"b\x05"		"TXFFLSH\0" \
	"b\x04"		"RXFFLSH\0" \
	"b\x03"		"INTKNQFLSH\0" \
	"b\x02"		"FRMCNTRRST\0" \
	"b\x01"		"HSFTRST\0" \
	"b\x00"		"CSFTRST\0"

#define	USBC_GAHBCFG_BITS \
	"\177"		/* new format */ \
	"\020"		/* hex display */ \
	"\020"		/* %016x format */ \
	"b\x08"		"PTXFEMPLVL\0" \
	"b\x07"		"NPTXFEMPLVL\0" \
	"b\x05"		"DMAEN\0" \
	"f\x01\x04"	"HBSTLEN\0" \
	"b\x00"		"GLBLINTRMSK\0"

#define	USBC_GRXFSIZ_BITS \
	"\177"		/* new format */ \
	"\020"		/* hex display */ \
	"\020"		/* %016x format */ \
	"f\x00\x10"	"RXFDEP\0"

#define	USBC_GNPTXFSIZ_BITS \
	"\177"		/* new format */ \
	"\020"		/* hex display */ \
	"\020"		/* %016x format */ \
	"f\x10\x10"	"NPTXFEDP\0" \
	"f\x00\x10"	"NPTXFSTADDR\0"

#define	USBC_GNPTXSTS_BITS \
	"\177"		/* new format */ \
	"\020"		/* hex display */ \
	"\020"		/* %016x format */ \
	"f\x1b\x04"	"NPTXQTOP_CHNUM\0" \
	"f\x19\x02"	"NPTXQTOP_ENTRY\0" \
	"b\x18"		"NPTXQTOP_TERMINATE\0" \
	"f\x10\x08"	"NPTXQSPCAVAIL\0" \
	"f\x00\x10"	"NPTXFSPCAVAIL\0"

#define	USBC_GHWCFG1_BITS \
	"\177"		/* new format */ \
	"\020"		/* hex display */ \
	"\020"		/* %016x format */ \
	"f\x00\x20"	"EPDIR\0"

#define	USBC_GHWCFG2_BITS \
	"\177"		/* new format */ \
	"\020"		/* hex display */ \
	"\020"		/* %016x format */ \
	"f\x1a\x05"	"TKNQDEPTH\0" \
	"f\x18\x02"	"PTXQDEPTH\0" \
	"f\x16\x02"	"NPTXQDEPTH\0" \
	"b\x13"		"DYNFIFOSIZING\0" \
	"b\x12"		"PERIOSUPPORT\0" \
	"f\x0e\x04"	"NUMHSTCHN1\0" \
	"f\x0a\x04"	"NUMDEVEPS\0" \
	"f\x08\x02"	"FSPHYTYPE\0" \
	"f\x06\x02"	"HSPHYTYPE\0" \
	"b\x05"		"SINGPNT\0" \
	"f\x03\x02"	"OTGARCH\0" \
	"f\x00\x03"	"OTGMODE\0"

#define	USBC_GHWCFG3_BITS \
	"\177"		/* new format */ \
	"\020"		/* hex display */ \
	"\020"		/* %016x format */ \
	"f\x10\x10"	"DFIFODEPTH\0" \
	"b\x0c"		"AHBPHYSYNC\0" \
	"b\x0b"		"RSTTYPE\0" \
	"b\x0a"		"OPTFEATURE\0" \
	"b\x09"		"VENDOR_CONTROL_INTERFACE_SUPPORT\0" \
	"b\x08"		"I2C_SELECTION\0" \
	"b\x07"		"OTGEN\0" \
	"f\x04\x03"	"PKTSIZEWIDTH\0" \
	"f\x00\x04"	"XFERSIZEWIDTH\0"

#define	USBC_GHWCFG4_BITS \
	"\177"		/* new format */ \
	"\020"		/* hex display */ \
	"\020"		/* %016x format */ \
	"b\x18"		"SESSENDFLTR\0" \
	"b\x18"		"BVAILDFLTR\0" \
	"b\x17"		"AVAILDFLTR\0" \
	"b\x16"		"VBUSVALIDFLTR\0" \
	"b\x15"		"IDDGFLTR\0" \
	"f\x10\x04"	"NUMCTLEPS\0" \
	"f\x0e\x02"	"PHYDATAWIDTH\0" \
	"b\x05"		"AHBFREQ\0" \
	"b\x04"		"ENABLEPWROPT\0" \
	"f\x00\x04"	"NUMDEVPERIOEPS\0"

#define	USBC_HCFG_BITS \
	"\177"		/* new format */ \
	"\020"		/* hex display */ \
	"\020"		/* %016x format */ \
	"b\x02"		"FSLSSUPP\0" \
	"f\x00\x02"	"FSLSPCLKSEL\0"

#define	USBC_HPRT_BITS \
	"\177"		/* new format */ \
	"\020"		/* hex display */ \
	"\020"		/* %016x format */ \
	"f\x11\x02"	"PRTSPD\0" \
	"f\x0d\x04"	"PRTTSTCTL\0" \
	"b\x0c"		"PRTPWR\0" \
	"f\x0a\x02"	"PRTLNSTS\0" \
	"b\x08"		"PRTRST\0" \
	"b\x07"		"PRTSUSP\0" \
	"b\x06"		"PRTRES\0" \
	"b\x05"		"PRTOVRCURRCHNG\0" \
	"b\x04"		"PRTOVRCURRACT\0" \
	"b\x03"		"PRTENCHNG\0" \
	"b\x02"		"PRTENA\0" \
	"b\x01"		"PRTCONNDET\0" \
	"b\x00"		"PRTCONNSTS\0"

#define	USBC_HFIR_BITS \
	"\177"		/* new format */ \
	"\020"		/* hex display */ \
	"\020"		/* %016x format */ \
	"f\x00\x10"	"FRINT\0"

#define	USBC_HAINT_BITS \
	"\177"		/* new format */ \
	"\020"		/* hex display */ \
	"\020"		/* %016x format */ \
	"b\x0f"		"HAINT_F\0" \
	"b\x0e"		"HAINT_E\0" \
	"b\x0d"		"HAINT_D\0" \
	"b\x0c"		"HAINT_C\0" \
	"b\x0b"		"HAINT_B\0" \
	"b\x0a"		"HAINT_A\0" \
	"b\x09"		"HAINT_9\0" \
	"b\x08"		"HAINT_8\0" \
	"b\x07"		"HAINT_7\0" \
	"b\x06"		"HAINT_6\0" \
	"b\x05"		"HAINT_5\0" \
	"b\x04"		"HAINT_4\0" \
	"b\x03"		"HAINT_3\0" \
	"b\x02"		"HAINT_2\0" \
	"b\x01"		"HAINT_1\0" \
	"b\x00"		"HAINT_0\0"

#define	USBC_HAINTMSK_BITS \
	"\177"		/* new format */ \
	"\020"		/* hex display */ \
	"\020"		/* %016x format */ \
	"b\x0f"		"HAINTMSK_F\0" \
	"b\x0e"		"HAINTMSK_E\0" \
	"b\x0d"		"HAINTMSK_D\0" \
	"b\x0c"		"HAINTMSK_C\0" \
	"b\x0b"		"HAINTMSK_B\0" \
	"b\x0a"		"HAINTMSK_A\0" \
	"b\x09"		"HAINTMSK_9\0" \
	"b\x08"		"HAINTMSK_8\0" \
	"b\x07"		"HAINTMSK_7\0" \
	"b\x06"		"HAINTMSK_6\0" \
	"b\x05"		"HAINTMSK_5\0" \
	"b\x04"		"HAINTMSK_4\0" \
	"b\x03"		"HAINTMSK_3\0" \
	"b\x02"		"HAINTMSK_2\0" \
	"b\x01"		"HAINTMSK_1\0" \
	"b\x00"		"HAINTMSK_0\0"

#define	USBC_HCINTX_BITS \
	"\177"		/* new format */ \
	"\020"		/* hex display */ \
	"\020"		/* %016x format */ \
	"b\x0a"		"DATATGLERR\0" \
	"b\x09"		"FRMOVRUN\0" \
	"b\x08"		"BBLERR\0" \
	"b\x07"		"XACTERR\0" \
	"b\x06"		"NYET\0" \
	"b\x05"		"ACK\0" \
	"b\x04"		"NAK\0" \
	"b\x03"		"STALL\0" \
	"b\x02"		"AHBERR\0" \
	"b\x01"		"CHHLTD\0" \
	"b\x00"		"XFERCOMPL\0"
#define USBC_HCINT0_BITS	USBC_HCINTX_BITS
#define USBC_HCINT1_BITS	USBC_HCINTX_BITS
#define USBC_HCINT2_BITS	USBC_HCINTX_BITS
#define USBC_HCINT3_BITS	USBC_HCINTX_BITS
#define USBC_HCINT4_BITS	USBC_HCINTX_BITS
#define USBC_HCINT5_BITS	USBC_HCINTX_BITS
#define USBC_HCINT6_BITS	USBC_HCINTX_BITS
#define USBC_HCINT7_BITS	USBC_HCINTX_BITS

#define	USBC_HCINTMSKX_BITS \
	"\177"		/* new format */ \
	"\020"		/* hex display */ \
	"\020"		/* %016x format */ \
	"b\x0a"		"DATATGLERRMSK\0" \
	"b\x09"		"FRMOVRUNMSK\0" \
	"b\x08"		"BBLERRMSK\0" \
	"b\x07"		"XACTERRMSK\0" \
	"b\x06"		"NYETMSK\0" \
	"b\x05"		"ACKMSK\0" \
	"b\x04"		"NAKMSK\0" \
	"b\x03"		"STALLMSK\0" \
	"b\x02"		"AHBERRMSK\0" \
	"b\x01"		"CHHLTDMSK\0" \
	"b\x00"		"XFERCOMPLMSK\0"
#define USBC_HCINTMSK0_BITS	USBC_HCINTMSKX_BITS
#define USBC_HCINTMSK1_BITS	USBC_HCINTMSKX_BITS
#define USBC_HCINTMSK2_BITS	USBC_HCINTMSKX_BITS
#define USBC_HCINTMSK3_BITS	USBC_HCINTMSKX_BITS
#define USBC_HCINTMSK4_BITS	USBC_HCINTMSKX_BITS
#define USBC_HCINTMSK5_BITS	USBC_HCINTMSKX_BITS
#define USBC_HCINTMSK6_BITS	USBC_HCINTMSKX_BITS
#define USBC_HCINTMSK7_BITS	USBC_HCINTMSKX_BITS

#define	USBC_HCCHARX_BITS \
	"\177"		/* new format */ \
	"\020"		/* hex display */ \
	"\020"		/* %016x format */ \
	"b\x1f"		"CHENA\0" \
	"b\x1e"		"CHDIS\0" \
	"b\x1d"		"ODDFRM\0" \
	"f\x16\x07"	"DEVADDR\0" \
	"f\x14\x02"	"EC\0" \
	"f\x12\x02"	"EPTYPE\0" \
	"b\x11"		"LSPDDEV\0" \
	"b\x0f"		"EPDIR\0" \
	"f\x0b\x04"	"EPNUM\0" \
	"f\x00\x0b"	"MPS\0"
#define USBC_HCCHAR0_BITS	USBC_HCCHARX_BITS
#define USBC_HCCHAR1_BITS	USBC_HCCHARX_BITS
#define USBC_HCCHAR2_BITS	USBC_HCCHARX_BITS
#define USBC_HCCHAR3_BITS	USBC_HCCHARX_BITS
#define USBC_HCCHAR4_BITS	USBC_HCCHARX_BITS
#define USBC_HCCHAR5_BITS	USBC_HCCHARX_BITS
#define USBC_HCCHAR6_BITS	USBC_HCCHARX_BITS
#define USBC_HCCHAR7_BITS	USBC_HCCHARX_BITS

#define	USBC_HCTSIZX_BITS \
	"\177"		/* new format */ \
	"\020"		/* hex display */ \
	"\020"		/* %016x format */ \
	"b\x1f"		"DOPNG\0" \
	"f\x1d\x02"	"PID\0" \
	"f\x13\x0a"	"PKTCNT\0" \
	"f\x00\x13"	"XFERSIZE\0"
#define USBC_HCTSIZ0_BITS	USBC_HCTSIZX_BITS
#define USBC_HCTSIZ1_BITS	USBC_HCTSIZX_BITS
#define USBC_HCTSIZ2_BITS	USBC_HCTSIZX_BITS
#define USBC_HCTSIZ3_BITS	USBC_HCTSIZX_BITS
#define USBC_HCTSIZ4_BITS	USBC_HCTSIZX_BITS
#define USBC_HCTSIZ5_BITS	USBC_HCTSIZX_BITS
#define USBC_HCTSIZ6_BITS	USBC_HCTSIZX_BITS
#define USBC_HCTSIZ7_BITS	USBC_HCTSIZX_BITS

/* ---- bus_space */

#define	USBC_BASE				0x00016F0010000000ULL
#define USBC_SIZE				0x40020

#define USBC_GOTGCTL_OFFSET			0x00000000
#define USBC_GOTGINT_OFFSET			0x00000004
#define USBC_GAHBCFG_OFFSET			0x00000008
#define USBC_GUSBCFG_OFFSET			0x0000000C
#define USBC_GRSTCTL_OFFSET			0x00000010
#define USBC_GINTSTS_OFFSET			0x00000014
#define USBC_GINTMSK_OFFSET			0x00000018
#define USBC_GRXSTSRH_OFFSET			0x0000001C
#define USBC_GRXSTSPH_OFFSET			0x00000020
#define USBC_GRXFSIZ_OFFSET			0x00000024
#define USBC_GNPTXFSIZ_OFFSET			0x00000028
#define USBC_GNPTXSTS_OFFSET			0x0000002C
#define USBC_GSNPSID_OFFSET			0x00000040
#define USBC_GHWCFG1_OFFSET			0x00000044
#define USBC_GHWCFG2_OFFSET			0x00000048
#define USBC_GHWCFG3_OFFSET			0x0000004C
#define USBC_GHWCFG4_OFFSET			0x00000050
#define USBC_HPTXFSIZ_OFFSET			0x00000100
#define USBC_DPTXFSIZ1_OFFSET			0x00000104
#define USBC_DPTXFSIZ2_OFFSET			0x00000108
#define USBC_DPTXFSIZ3_OFFSET			0x0000010C
#define USBC_DPTXFSIZ4_OFFSET			0x00000110
#define USBC_HCFG_OFFSET			0x00000400
#define USBC_HFIR_OFFSET			0x00000404
#define USBC_HFNUM_OFFSET			0x00000408
#define USBC_HPTXSTS_OFFSET			0x00000410
#define USBC_HAINT_OFFSET			0x00000414
#define USBC_HAINTMSK_OFFSET			0x00000418
#define USBC_HPRT_OFFSET			0x00000440
#define USBC_HCCHAR0_OFFSET			0x00000500
#define USBC_HCCHAR1_OFFSET			0x00000520
#define USBC_HCCHAR2_OFFSET			0x00000540
#define USBC_HCCHAR3_OFFSET			0x00000560
#define USBC_HCCHAR4_OFFSET			0x00000580
#define USBC_HCCHAR5_OFFSET			0x000005A0
#define USBC_HCCHAR6_OFFSET			0x000005C0
#define USBC_HCCHAR7_OFFSET			0x000005E0
#define USBC_HCSPLT0_OFFSET			0x00000504
#define USBC_HCSPLT1_OFFSET			0x00000524
#define USBC_HCSPLT2_OFFSET			0x00000544
#define USBC_HCSPLT3_OFFSET			0x00000564
#define USBC_HCSPLT4_OFFSET			0x00000584
#define USBC_HCSPLT5_OFFSET			0x000005A4
#define USBC_HCSPLT6_OFFSET			0x000005C4
#define USBC_HCSPLT7_OFFSET			0x000005E4
#define USBC_HCINT0_OFFSET			0x00000508
#define USBC_HCINT1_OFFSET			0x00000528
#define USBC_HCINT2_OFFSET			0x00000548
#define USBC_HCINT3_OFFSET			0x00000568
#define USBC_HCINT4_OFFSET			0x00000588
#define USBC_HCINT5_OFFSET			0x000005A8
#define USBC_HCINT6_OFFSET			0x000005C8
#define USBC_HCINT7_OFFSET			0x000005E8
#define USBC_HCINTMSK0_OFFSET			0x0000050C
#define USBC_HCINTMSK1_OFFSET			0x0000052C
#define USBC_HCINTMSK2_OFFSET			0x0000054C
#define USBC_HCINTMSK3_OFFSET			0x0000056C
#define USBC_HCINTMSK4_OFFSET			0x0000058C
#define USBC_HCINTMSK5_OFFSET			0x000005AC
#define USBC_HCINTMSK6_OFFSET			0x000005CC
#define USBC_HCINTMSK7_OFFSET			0x000005EC
#define USBC_HCTSIZ0_OFFSET			0x00000510
#define USBC_HCTSIZ1_OFFSET			0x00000530
#define USBC_HCTSIZ2_OFFSET			0x00000550
#define USBC_HCTSIZ3_OFFSET			0x00000570
#define USBC_HCTSIZ4_OFFSET			0x00000590
#define USBC_HCTSIZ5_OFFSET			0x000005B0
#define USBC_HCTSIZ6_OFFSET			0x000005D0
#define USBC_HCTSIZ7_OFFSET			0x000005F0
#define USBC_DCFG_OFFSET			0x00000800
#define USBC_DCTL_OFFSET			0x00000804
#define USBC_DSTS_OFFSET			0x00000808
#define USBC_DIEPMSK_OFFSET			0x00000810
#define USBC_DOEPMSK_OFFSET			0x00000814
#define USBC_DAINT_OFFSET			0x00000818
#define USBC_DAINTMSK_OFFSET			0x0000081C
#define USBC_DTKNQR1_OFFSET			0x00000820
#define USBC_DTKNQR2_OFFSET			0x00000824
#define USBC_DTKNQR3_OFFSET			0x00000830
#define USBC_DTKNQR4_OFFSET			0x00000834
#define USBC_DIEPCTL0_OFFSET			0x00000900
#define USBC_DIEPCTL1_OFFSET			0x00000920
#define USBC_DIEPCTL2_OFFSET			0x00000940
#define USBC_DIEPCTL3_OFFSET			0x00000960
#define USBC_DIEPCTL4_OFFSET			0x00000980
#define USBC_DIEPINT0_OFFSET			0x00000908
#define USBC_DIEPINT1_OFFSET			0x00000928
#define USBC_DIEPINT2_OFFSET			0x00000948
#define USBC_DIEPINT3_OFFSET			0x00000968
#define USBC_DIEPINT4_OFFSET			0x00000988
#define USBC_DIEPTSIZ0_OFFSET			0x00000910
#define USBC_DIEPTSIZ1_OFFSET			0x00000930
#define USBC_DIEPTSIZ2_OFFSET			0x00000950
#define USBC_DIEPTSIZ3_OFFSET			0x00000970
#define USBC_DIEPTSIZ4_OFFSET			0x00000990
#define USBC_OEPCTL0_OFFSET			0x00000B00
#define USBC_OEPCTL1_OFFSET			0x00000B20
#define USBC_OEPCTL2_OFFSET			0x00000B40
#define USBC_OEPCTL3_OFFSET			0x00000B60
#define USBC_OEPCTL4_OFFSET			0x00000B80
#define USBC_OEPINT0_OFFSET			0x00000B08
#define USBC_OEPINT1_OFFSET			0x00000B28
#define USBC_OEPINT2_OFFSET			0x00000B48
#define USBC_OEPINT3_OFFSET			0x00000B68
#define USBC_OEPINT4_OFFSET			0x00000B88
#define USBC_OEPTSIZ0_OFFSET			0x00000B10
#define USBC_OEPTSIZ1_OFFSET			0x00000B30
#define USBC_OEPTSIZ2_OFFSET			0x00000B50
#define USBC_OEPTSIZ3_OFFSET			0x00000B70
#define USBC_OEPTSIZ4_OFFSET			0x00000B90
#define USBC_PCGCCTL_OFFSET			0x00000E00
#define USBC_NPTXDFIFO0_OFFSET			0x00001000
#define USBC_NPTXDFIFO1_OFFSET			0x00002000
#define USBC_NPTXDFIFO2_OFFSET			0x00003000
#define USBC_NPTXDFIFO3_OFFSET			0x00004000
#define USBC_NPTXDFIFO4_OFFSET			0x00005000
#define USBC_NPTXDFIFO5_OFFSET			0x00006000
#define USBC_NPTXDFIFO6_OFFSET			0x00007000
#define USBC_NPTXDFIFO7_OFFSET			0x00008000
#define USBC_GRXSTSRD_OFFSET			0x0004001C
#define USBC_GRXSTSPD_OFFSET			0x00040020

#endif /* _OCTEON_USBCREG_H_ */
