18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * mtu3_hw_regs.h - MediaTek USB3 DRD register and field definitions
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2016 MediaTek Inc.
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Author: Chunfeng Yun <chunfeng.yun@mediatek.com>
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#ifndef _SSUSB_HW_REGS_H_
118c2ecf20Sopenharmony_ci#define _SSUSB_HW_REGS_H_
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci/* segment offset of MAC register */
148c2ecf20Sopenharmony_ci#define SSUSB_DEV_BASE		0x0000
158c2ecf20Sopenharmony_ci#define SSUSB_EPCTL_CSR_BASE	0x0800
168c2ecf20Sopenharmony_ci#define SSUSB_USB3_MAC_CSR_BASE	0x1400
178c2ecf20Sopenharmony_ci#define SSUSB_USB3_SYS_CSR_BASE	0x1400
188c2ecf20Sopenharmony_ci#define SSUSB_USB2_CSR_BASE	0x2400
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci/* IPPC register in Infra */
218c2ecf20Sopenharmony_ci#define SSUSB_SIFSLV_IPPC_BASE	0x0000
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci/* --------------- SSUSB_DEV REGISTER DEFINITION --------------- */
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci#define U3D_LV1ISR		(SSUSB_DEV_BASE + 0x0000)
268c2ecf20Sopenharmony_ci#define U3D_LV1IER		(SSUSB_DEV_BASE + 0x0004)
278c2ecf20Sopenharmony_ci#define U3D_LV1IESR		(SSUSB_DEV_BASE + 0x0008)
288c2ecf20Sopenharmony_ci#define U3D_LV1IECR		(SSUSB_DEV_BASE + 0x000C)
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci#define U3D_EPISR		(SSUSB_DEV_BASE + 0x0080)
318c2ecf20Sopenharmony_ci#define U3D_EPIER		(SSUSB_DEV_BASE + 0x0084)
328c2ecf20Sopenharmony_ci#define U3D_EPIESR		(SSUSB_DEV_BASE + 0x0088)
338c2ecf20Sopenharmony_ci#define U3D_EPIECR		(SSUSB_DEV_BASE + 0x008C)
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#define U3D_EP0CSR		(SSUSB_DEV_BASE + 0x0100)
368c2ecf20Sopenharmony_ci#define U3D_RXCOUNT0		(SSUSB_DEV_BASE + 0x0108)
378c2ecf20Sopenharmony_ci#define U3D_RESERVED		(SSUSB_DEV_BASE + 0x010C)
388c2ecf20Sopenharmony_ci#define U3D_TX1CSR0		(SSUSB_DEV_BASE + 0x0110)
398c2ecf20Sopenharmony_ci#define U3D_TX1CSR1		(SSUSB_DEV_BASE + 0x0114)
408c2ecf20Sopenharmony_ci#define U3D_TX1CSR2		(SSUSB_DEV_BASE + 0x0118)
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci#define U3D_RX1CSR0		(SSUSB_DEV_BASE + 0x0210)
438c2ecf20Sopenharmony_ci#define U3D_RX1CSR1		(SSUSB_DEV_BASE + 0x0214)
448c2ecf20Sopenharmony_ci#define U3D_RX1CSR2		(SSUSB_DEV_BASE + 0x0218)
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci#define U3D_FIFO0		(SSUSB_DEV_BASE + 0x0300)
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci#define U3D_QCR0		(SSUSB_DEV_BASE + 0x0400)
498c2ecf20Sopenharmony_ci#define U3D_QCR1		(SSUSB_DEV_BASE + 0x0404)
508c2ecf20Sopenharmony_ci#define U3D_QCR2		(SSUSB_DEV_BASE + 0x0408)
518c2ecf20Sopenharmony_ci#define U3D_QCR3		(SSUSB_DEV_BASE + 0x040C)
528c2ecf20Sopenharmony_ci#define U3D_QFCR		(SSUSB_DEV_BASE + 0x0428)
538c2ecf20Sopenharmony_ci#define U3D_TXQHIAR1		(SSUSB_DEV_BASE + 0x0484)
548c2ecf20Sopenharmony_ci#define U3D_RXQHIAR1		(SSUSB_DEV_BASE + 0x04C4)
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci#define U3D_TXQCSR1		(SSUSB_DEV_BASE + 0x0510)
578c2ecf20Sopenharmony_ci#define U3D_TXQSAR1		(SSUSB_DEV_BASE + 0x0514)
588c2ecf20Sopenharmony_ci#define U3D_TXQCPR1		(SSUSB_DEV_BASE + 0x0518)
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci#define U3D_RXQCSR1		(SSUSB_DEV_BASE + 0x0610)
618c2ecf20Sopenharmony_ci#define U3D_RXQSAR1		(SSUSB_DEV_BASE + 0x0614)
628c2ecf20Sopenharmony_ci#define U3D_RXQCPR1		(SSUSB_DEV_BASE + 0x0618)
638c2ecf20Sopenharmony_ci#define U3D_RXQLDPR1		(SSUSB_DEV_BASE + 0x061C)
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci#define U3D_QISAR0		(SSUSB_DEV_BASE + 0x0700)
668c2ecf20Sopenharmony_ci#define U3D_QIER0		(SSUSB_DEV_BASE + 0x0704)
678c2ecf20Sopenharmony_ci#define U3D_QIESR0		(SSUSB_DEV_BASE + 0x0708)
688c2ecf20Sopenharmony_ci#define U3D_QIECR0		(SSUSB_DEV_BASE + 0x070C)
698c2ecf20Sopenharmony_ci#define U3D_QISAR1		(SSUSB_DEV_BASE + 0x0710)
708c2ecf20Sopenharmony_ci#define U3D_QIER1		(SSUSB_DEV_BASE + 0x0714)
718c2ecf20Sopenharmony_ci#define U3D_QIESR1		(SSUSB_DEV_BASE + 0x0718)
728c2ecf20Sopenharmony_ci#define U3D_QIECR1		(SSUSB_DEV_BASE + 0x071C)
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci#define U3D_TQERRIR0		(SSUSB_DEV_BASE + 0x0780)
758c2ecf20Sopenharmony_ci#define U3D_TQERRIER0		(SSUSB_DEV_BASE + 0x0784)
768c2ecf20Sopenharmony_ci#define U3D_TQERRIESR0		(SSUSB_DEV_BASE + 0x0788)
778c2ecf20Sopenharmony_ci#define U3D_TQERRIECR0		(SSUSB_DEV_BASE + 0x078C)
788c2ecf20Sopenharmony_ci#define U3D_RQERRIR0		(SSUSB_DEV_BASE + 0x07C0)
798c2ecf20Sopenharmony_ci#define U3D_RQERRIER0		(SSUSB_DEV_BASE + 0x07C4)
808c2ecf20Sopenharmony_ci#define U3D_RQERRIESR0		(SSUSB_DEV_BASE + 0x07C8)
818c2ecf20Sopenharmony_ci#define U3D_RQERRIECR0		(SSUSB_DEV_BASE + 0x07CC)
828c2ecf20Sopenharmony_ci#define U3D_RQERRIR1		(SSUSB_DEV_BASE + 0x07D0)
838c2ecf20Sopenharmony_ci#define U3D_RQERRIER1		(SSUSB_DEV_BASE + 0x07D4)
848c2ecf20Sopenharmony_ci#define U3D_RQERRIESR1		(SSUSB_DEV_BASE + 0x07D8)
858c2ecf20Sopenharmony_ci#define U3D_RQERRIECR1		(SSUSB_DEV_BASE + 0x07DC)
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci#define U3D_CAP_EP0FFSZ		(SSUSB_DEV_BASE + 0x0C04)
888c2ecf20Sopenharmony_ci#define U3D_CAP_EPNTXFFSZ	(SSUSB_DEV_BASE + 0x0C08)
898c2ecf20Sopenharmony_ci#define U3D_CAP_EPNRXFFSZ	(SSUSB_DEV_BASE + 0x0C0C)
908c2ecf20Sopenharmony_ci#define U3D_CAP_EPINFO		(SSUSB_DEV_BASE + 0x0C10)
918c2ecf20Sopenharmony_ci#define U3D_MISC_CTRL		(SSUSB_DEV_BASE + 0x0C84)
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci/*---------------- SSUSB_DEV FIELD DEFINITION ---------------*/
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci/* U3D_LV1ISR */
968c2ecf20Sopenharmony_ci#define EP_CTRL_INTR		BIT(5)
978c2ecf20Sopenharmony_ci#define MAC2_INTR		BIT(4)
988c2ecf20Sopenharmony_ci#define DMA_INTR		BIT(3)
998c2ecf20Sopenharmony_ci#define MAC3_INTR		BIT(2)
1008c2ecf20Sopenharmony_ci#define QMU_INTR		BIT(1)
1018c2ecf20Sopenharmony_ci#define BMU_INTR		BIT(0)
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci/* U3D_LV1IECR */
1048c2ecf20Sopenharmony_ci#define LV1IECR_MSK		GENMASK(31, 0)
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci/* U3D_EPISR */
1078c2ecf20Sopenharmony_ci#define EPRISR(x)		(BIT(16) << (x))
1088c2ecf20Sopenharmony_ci#define SETUPENDISR		BIT(16)
1098c2ecf20Sopenharmony_ci#define EPTISR(x)		(BIT(0) << (x))
1108c2ecf20Sopenharmony_ci#define EP0ISR			BIT(0)
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ci/* U3D_EP0CSR */
1138c2ecf20Sopenharmony_ci#define EP0_SENDSTALL		BIT(25)
1148c2ecf20Sopenharmony_ci#define EP0_FIFOFULL		BIT(23)
1158c2ecf20Sopenharmony_ci#define EP0_SENTSTALL		BIT(22)
1168c2ecf20Sopenharmony_ci#define EP0_DPHTX		BIT(20)
1178c2ecf20Sopenharmony_ci#define EP0_DATAEND		BIT(19)
1188c2ecf20Sopenharmony_ci#define EP0_TXPKTRDY		BIT(18)
1198c2ecf20Sopenharmony_ci#define EP0_SETUPPKTRDY		BIT(17)
1208c2ecf20Sopenharmony_ci#define EP0_RXPKTRDY		BIT(16)
1218c2ecf20Sopenharmony_ci#define EP0_MAXPKTSZ_MSK	GENMASK(9, 0)
1228c2ecf20Sopenharmony_ci#define EP0_MAXPKTSZ(x)		((x) & EP0_MAXPKTSZ_MSK)
1238c2ecf20Sopenharmony_ci#define EP0_W1C_BITS	(~(EP0_RXPKTRDY | EP0_SETUPPKTRDY | EP0_SENTSTALL))
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_ci/* U3D_TX1CSR0 */
1268c2ecf20Sopenharmony_ci#define TX_DMAREQEN		BIT(29)
1278c2ecf20Sopenharmony_ci#define TX_FIFOFULL		BIT(25)
1288c2ecf20Sopenharmony_ci#define TX_FIFOEMPTY		BIT(24)
1298c2ecf20Sopenharmony_ci#define TX_SENTSTALL		BIT(22)
1308c2ecf20Sopenharmony_ci#define TX_SENDSTALL		BIT(21)
1318c2ecf20Sopenharmony_ci#define TX_TXPKTRDY		BIT(16)
1328c2ecf20Sopenharmony_ci#define TX_TXMAXPKTSZ_MSK	GENMASK(10, 0)
1338c2ecf20Sopenharmony_ci#define TX_TXMAXPKTSZ(x)	((x) & TX_TXMAXPKTSZ_MSK)
1348c2ecf20Sopenharmony_ci#define TX_W1C_BITS		(~(TX_SENTSTALL))
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_ci/* U3D_TX1CSR1 */
1378c2ecf20Sopenharmony_ci#define TX_MAX_PKT_G2(x)	(((x) & 0xff) << 24)
1388c2ecf20Sopenharmony_ci#define TX_MULT_G2(x)		(((x) & 0x7) << 21)
1398c2ecf20Sopenharmony_ci#define TX_MULT_OG(x)		(((x) & 0x3) << 22)
1408c2ecf20Sopenharmony_ci#define TX_MAX_PKT_OG(x)	(((x) & 0x3f) << 16)
1418c2ecf20Sopenharmony_ci#define TX_SLOT(x)		(((x) & 0x3f) << 8)
1428c2ecf20Sopenharmony_ci#define TX_TYPE(x)		(((x) & 0x3) << 4)
1438c2ecf20Sopenharmony_ci#define TX_SS_BURST(x)		(((x) & 0xf) << 0)
1448c2ecf20Sopenharmony_ci#define TX_MULT(g2c, x)		\
1458c2ecf20Sopenharmony_ci({				\
1468c2ecf20Sopenharmony_ci	typeof(x) x_ = (x);	\
1478c2ecf20Sopenharmony_ci	(g2c) ? TX_MULT_G2(x_) : TX_MULT_OG(x_);	\
1488c2ecf20Sopenharmony_ci})
1498c2ecf20Sopenharmony_ci#define TX_MAX_PKT(g2c, x)	\
1508c2ecf20Sopenharmony_ci({				\
1518c2ecf20Sopenharmony_ci	typeof(x) x_ = (x);	\
1528c2ecf20Sopenharmony_ci	(g2c) ? TX_MAX_PKT_G2(x_) : TX_MAX_PKT_OG(x_);	\
1538c2ecf20Sopenharmony_ci})
1548c2ecf20Sopenharmony_ci
1558c2ecf20Sopenharmony_ci/* for TX_TYPE & RX_TYPE */
1568c2ecf20Sopenharmony_ci#define TYPE_BULK		(0x0)
1578c2ecf20Sopenharmony_ci#define TYPE_INT		(0x1)
1588c2ecf20Sopenharmony_ci#define TYPE_ISO		(0x2)
1598c2ecf20Sopenharmony_ci#define TYPE_MASK		(0x3)
1608c2ecf20Sopenharmony_ci
1618c2ecf20Sopenharmony_ci/* U3D_TX1CSR2 */
1628c2ecf20Sopenharmony_ci#define TX_BINTERVAL(x)		(((x) & 0xff) << 24)
1638c2ecf20Sopenharmony_ci#define TX_FIFOSEGSIZE(x)	(((x) & 0xf) << 16)
1648c2ecf20Sopenharmony_ci#define TX_FIFOADDR(x)		(((x) & 0x1fff) << 0)
1658c2ecf20Sopenharmony_ci
1668c2ecf20Sopenharmony_ci/* U3D_RX1CSR0 */
1678c2ecf20Sopenharmony_ci#define RX_DMAREQEN		BIT(29)
1688c2ecf20Sopenharmony_ci#define RX_SENTSTALL		BIT(22)
1698c2ecf20Sopenharmony_ci#define RX_SENDSTALL		BIT(21)
1708c2ecf20Sopenharmony_ci#define RX_RXPKTRDY		BIT(16)
1718c2ecf20Sopenharmony_ci#define RX_RXMAXPKTSZ_MSK	GENMASK(10, 0)
1728c2ecf20Sopenharmony_ci#define RX_RXMAXPKTSZ(x)	((x) & RX_RXMAXPKTSZ_MSK)
1738c2ecf20Sopenharmony_ci#define RX_W1C_BITS		(~(RX_SENTSTALL | RX_RXPKTRDY))
1748c2ecf20Sopenharmony_ci
1758c2ecf20Sopenharmony_ci/* U3D_RX1CSR1 */
1768c2ecf20Sopenharmony_ci#define RX_MAX_PKT_G2(x)	(((x) & 0xff) << 24)
1778c2ecf20Sopenharmony_ci#define RX_MULT_G2(x)		(((x) & 0x7) << 21)
1788c2ecf20Sopenharmony_ci#define RX_MULT_OG(x)		(((x) & 0x3) << 22)
1798c2ecf20Sopenharmony_ci#define RX_MAX_PKT_OG(x)	(((x) & 0x3f) << 16)
1808c2ecf20Sopenharmony_ci#define RX_SLOT(x)		(((x) & 0x3f) << 8)
1818c2ecf20Sopenharmony_ci#define RX_TYPE(x)		(((x) & 0x3) << 4)
1828c2ecf20Sopenharmony_ci#define RX_SS_BURST(x)		(((x) & 0xf) << 0)
1838c2ecf20Sopenharmony_ci#define RX_MULT(g2c, x)		\
1848c2ecf20Sopenharmony_ci({				\
1858c2ecf20Sopenharmony_ci	typeof(x) x_ = (x);	\
1868c2ecf20Sopenharmony_ci	(g2c) ? RX_MULT_G2(x_) : RX_MULT_OG(x_);	\
1878c2ecf20Sopenharmony_ci})
1888c2ecf20Sopenharmony_ci#define RX_MAX_PKT(g2c, x)	\
1898c2ecf20Sopenharmony_ci({				\
1908c2ecf20Sopenharmony_ci	typeof(x) x_ = (x);	\
1918c2ecf20Sopenharmony_ci	(g2c) ? RX_MAX_PKT_G2(x_) : RX_MAX_PKT_OG(x_);	\
1928c2ecf20Sopenharmony_ci})
1938c2ecf20Sopenharmony_ci
1948c2ecf20Sopenharmony_ci/* U3D_RX1CSR2 */
1958c2ecf20Sopenharmony_ci#define RX_BINTERVAL(x)		(((x) & 0xff) << 24)
1968c2ecf20Sopenharmony_ci#define RX_FIFOSEGSIZE(x)	(((x) & 0xf) << 16)
1978c2ecf20Sopenharmony_ci#define RX_FIFOADDR(x)		(((x) & 0x1fff) << 0)
1988c2ecf20Sopenharmony_ci
1998c2ecf20Sopenharmony_ci/* U3D_QCR0 */
2008c2ecf20Sopenharmony_ci#define QMU_RX_CS_EN(x)		(BIT(16) << (x))
2018c2ecf20Sopenharmony_ci#define QMU_TX_CS_EN(x)		(BIT(0) << (x))
2028c2ecf20Sopenharmony_ci#define QMU_CS16B_EN		BIT(0)
2038c2ecf20Sopenharmony_ci
2048c2ecf20Sopenharmony_ci/* U3D_QCR1 */
2058c2ecf20Sopenharmony_ci#define QMU_TX_ZLP(x)		(BIT(0) << (x))
2068c2ecf20Sopenharmony_ci
2078c2ecf20Sopenharmony_ci/* U3D_QCR3 */
2088c2ecf20Sopenharmony_ci#define QMU_RX_COZ(x)		(BIT(16) << (x))
2098c2ecf20Sopenharmony_ci#define QMU_RX_ZLP(x)		(BIT(0) << (x))
2108c2ecf20Sopenharmony_ci
2118c2ecf20Sopenharmony_ci/* U3D_TXQHIAR1 */
2128c2ecf20Sopenharmony_ci/* U3D_RXQHIAR1 */
2138c2ecf20Sopenharmony_ci#define QMU_LAST_DONE_PTR_HI(x)	(((x) >> 16) & 0xf)
2148c2ecf20Sopenharmony_ci#define QMU_CUR_GPD_ADDR_HI(x)	(((x) >> 8) & 0xf)
2158c2ecf20Sopenharmony_ci#define QMU_START_ADDR_HI_MSK	GENMASK(3, 0)
2168c2ecf20Sopenharmony_ci#define QMU_START_ADDR_HI(x)	(((x) & 0xf) << 0)
2178c2ecf20Sopenharmony_ci
2188c2ecf20Sopenharmony_ci/* U3D_TXQCSR1 */
2198c2ecf20Sopenharmony_ci/* U3D_RXQCSR1 */
2208c2ecf20Sopenharmony_ci#define QMU_Q_ACTIVE		BIT(15)
2218c2ecf20Sopenharmony_ci#define QMU_Q_STOP		BIT(2)
2228c2ecf20Sopenharmony_ci#define QMU_Q_RESUME		BIT(1)
2238c2ecf20Sopenharmony_ci#define QMU_Q_START		BIT(0)
2248c2ecf20Sopenharmony_ci
2258c2ecf20Sopenharmony_ci/* U3D_QISAR0, U3D_QIER0, U3D_QIESR0, U3D_QIECR0 */
2268c2ecf20Sopenharmony_ci#define QMU_RX_DONE_INT(x)	(BIT(16) << (x))
2278c2ecf20Sopenharmony_ci#define QMU_TX_DONE_INT(x)	(BIT(0) << (x))
2288c2ecf20Sopenharmony_ci
2298c2ecf20Sopenharmony_ci/* U3D_QISAR1, U3D_QIER1, U3D_QIESR1, U3D_QIECR1 */
2308c2ecf20Sopenharmony_ci#define RXQ_ZLPERR_INT		BIT(20)
2318c2ecf20Sopenharmony_ci#define RXQ_LENERR_INT		BIT(18)
2328c2ecf20Sopenharmony_ci#define RXQ_CSERR_INT		BIT(17)
2338c2ecf20Sopenharmony_ci#define RXQ_EMPTY_INT		BIT(16)
2348c2ecf20Sopenharmony_ci#define TXQ_LENERR_INT		BIT(2)
2358c2ecf20Sopenharmony_ci#define TXQ_CSERR_INT		BIT(1)
2368c2ecf20Sopenharmony_ci#define TXQ_EMPTY_INT		BIT(0)
2378c2ecf20Sopenharmony_ci
2388c2ecf20Sopenharmony_ci/* U3D_TQERRIR0, U3D_TQERRIER0, U3D_TQERRIESR0, U3D_TQERRIECR0 */
2398c2ecf20Sopenharmony_ci#define QMU_TX_LEN_ERR(x)	(BIT(16) << (x))
2408c2ecf20Sopenharmony_ci#define QMU_TX_CS_ERR(x)	(BIT(0) << (x))
2418c2ecf20Sopenharmony_ci
2428c2ecf20Sopenharmony_ci/* U3D_RQERRIR0, U3D_RQERRIER0, U3D_RQERRIESR0, U3D_RQERRIECR0 */
2438c2ecf20Sopenharmony_ci#define QMU_RX_LEN_ERR(x)	(BIT(16) << (x))
2448c2ecf20Sopenharmony_ci#define QMU_RX_CS_ERR(x)	(BIT(0) << (x))
2458c2ecf20Sopenharmony_ci
2468c2ecf20Sopenharmony_ci/* U3D_RQERRIR1, U3D_RQERRIER1, U3D_RQERRIESR1, U3D_RQERRIECR1 */
2478c2ecf20Sopenharmony_ci#define QMU_RX_ZLP_ERR(n)	(BIT(16) << (n))
2488c2ecf20Sopenharmony_ci
2498c2ecf20Sopenharmony_ci/* U3D_CAP_EPINFO */
2508c2ecf20Sopenharmony_ci#define CAP_RX_EP_NUM(x)	(((x) >> 8) & 0x1f)
2518c2ecf20Sopenharmony_ci#define CAP_TX_EP_NUM(x)	((x) & 0x1f)
2528c2ecf20Sopenharmony_ci
2538c2ecf20Sopenharmony_ci/* U3D_MISC_CTRL */
2548c2ecf20Sopenharmony_ci#define DMA_ADDR_36BIT		BIT(31)
2558c2ecf20Sopenharmony_ci#define VBUS_ON			BIT(1)
2568c2ecf20Sopenharmony_ci#define VBUS_FRC_EN		BIT(0)
2578c2ecf20Sopenharmony_ci
2588c2ecf20Sopenharmony_ci
2598c2ecf20Sopenharmony_ci/*---------------- SSUSB_EPCTL_CSR REGISTER DEFINITION ----------------*/
2608c2ecf20Sopenharmony_ci
2618c2ecf20Sopenharmony_ci#define U3D_DEVICE_CONF			(SSUSB_EPCTL_CSR_BASE + 0x0000)
2628c2ecf20Sopenharmony_ci#define U3D_EP_RST			(SSUSB_EPCTL_CSR_BASE + 0x0004)
2638c2ecf20Sopenharmony_ci
2648c2ecf20Sopenharmony_ci#define U3D_DEV_LINK_INTR_ENABLE	(SSUSB_EPCTL_CSR_BASE + 0x0050)
2658c2ecf20Sopenharmony_ci#define U3D_DEV_LINK_INTR		(SSUSB_EPCTL_CSR_BASE + 0x0054)
2668c2ecf20Sopenharmony_ci
2678c2ecf20Sopenharmony_ci/*---------------- SSUSB_EPCTL_CSR FIELD DEFINITION ----------------*/
2688c2ecf20Sopenharmony_ci
2698c2ecf20Sopenharmony_ci/* U3D_DEVICE_CONF */
2708c2ecf20Sopenharmony_ci#define DEV_ADDR_MSK		GENMASK(30, 24)
2718c2ecf20Sopenharmony_ci#define DEV_ADDR(x)		((0x7f & (x)) << 24)
2728c2ecf20Sopenharmony_ci#define HW_USB2_3_SEL		BIT(18)
2738c2ecf20Sopenharmony_ci#define SW_USB2_3_SEL_EN	BIT(17)
2748c2ecf20Sopenharmony_ci#define SW_USB2_3_SEL		BIT(16)
2758c2ecf20Sopenharmony_ci#define SSUSB_DEV_SPEED(x)	((x) & 0x7)
2768c2ecf20Sopenharmony_ci
2778c2ecf20Sopenharmony_ci/* U3D_EP_RST */
2788c2ecf20Sopenharmony_ci#define EP1_IN_RST		BIT(17)
2798c2ecf20Sopenharmony_ci#define EP1_OUT_RST		BIT(1)
2808c2ecf20Sopenharmony_ci#define EP_RST(is_in, epnum)	(((is_in) ? BIT(16) : BIT(0)) << (epnum))
2818c2ecf20Sopenharmony_ci#define EP0_RST			BIT(0)
2828c2ecf20Sopenharmony_ci
2838c2ecf20Sopenharmony_ci/* U3D_DEV_LINK_INTR_ENABLE */
2848c2ecf20Sopenharmony_ci/* U3D_DEV_LINK_INTR */
2858c2ecf20Sopenharmony_ci#define SSUSB_DEV_SPEED_CHG_INTR	BIT(0)
2868c2ecf20Sopenharmony_ci
2878c2ecf20Sopenharmony_ci
2888c2ecf20Sopenharmony_ci/*---------------- SSUSB_USB3_MAC_CSR REGISTER DEFINITION ----------------*/
2898c2ecf20Sopenharmony_ci
2908c2ecf20Sopenharmony_ci#define U3D_LTSSM_CTRL		(SSUSB_USB3_MAC_CSR_BASE + 0x0010)
2918c2ecf20Sopenharmony_ci#define U3D_USB3_CONFIG		(SSUSB_USB3_MAC_CSR_BASE + 0x001C)
2928c2ecf20Sopenharmony_ci
2938c2ecf20Sopenharmony_ci#define U3D_LINK_STATE_MACHINE	(SSUSB_USB3_MAC_CSR_BASE + 0x0134)
2948c2ecf20Sopenharmony_ci#define U3D_LTSSM_INTR_ENABLE	(SSUSB_USB3_MAC_CSR_BASE + 0x013C)
2958c2ecf20Sopenharmony_ci#define U3D_LTSSM_INTR		(SSUSB_USB3_MAC_CSR_BASE + 0x0140)
2968c2ecf20Sopenharmony_ci
2978c2ecf20Sopenharmony_ci#define U3D_U3U2_SWITCH_CTRL	(SSUSB_USB3_MAC_CSR_BASE + 0x0170)
2988c2ecf20Sopenharmony_ci
2998c2ecf20Sopenharmony_ci/*---------------- SSUSB_USB3_MAC_CSR FIELD DEFINITION ----------------*/
3008c2ecf20Sopenharmony_ci
3018c2ecf20Sopenharmony_ci/* U3D_LTSSM_CTRL */
3028c2ecf20Sopenharmony_ci#define FORCE_POLLING_FAIL	BIT(4)
3038c2ecf20Sopenharmony_ci#define FORCE_RXDETECT_FAIL	BIT(3)
3048c2ecf20Sopenharmony_ci#define SOFT_U3_EXIT_EN		BIT(2)
3058c2ecf20Sopenharmony_ci#define COMPLIANCE_EN		BIT(1)
3068c2ecf20Sopenharmony_ci#define U1_GO_U2_EN		BIT(0)
3078c2ecf20Sopenharmony_ci
3088c2ecf20Sopenharmony_ci/* U3D_USB3_CONFIG */
3098c2ecf20Sopenharmony_ci#define USB3_EN			BIT(0)
3108c2ecf20Sopenharmony_ci
3118c2ecf20Sopenharmony_ci/* U3D_LINK_STATE_MACHINE */
3128c2ecf20Sopenharmony_ci#define LTSSM_STATE(x)	((x) & 0x1f)
3138c2ecf20Sopenharmony_ci
3148c2ecf20Sopenharmony_ci/* U3D_LTSSM_INTR_ENABLE */
3158c2ecf20Sopenharmony_ci/* U3D_LTSSM_INTR */
3168c2ecf20Sopenharmony_ci#define U3_RESUME_INTR		BIT(18)
3178c2ecf20Sopenharmony_ci#define U3_LFPS_TMOUT_INTR	BIT(17)
3188c2ecf20Sopenharmony_ci#define VBUS_FALL_INTR		BIT(16)
3198c2ecf20Sopenharmony_ci#define VBUS_RISE_INTR		BIT(15)
3208c2ecf20Sopenharmony_ci#define RXDET_SUCCESS_INTR	BIT(14)
3218c2ecf20Sopenharmony_ci#define EXIT_U3_INTR		BIT(13)
3228c2ecf20Sopenharmony_ci#define EXIT_U2_INTR		BIT(12)
3238c2ecf20Sopenharmony_ci#define EXIT_U1_INTR		BIT(11)
3248c2ecf20Sopenharmony_ci#define ENTER_U3_INTR		BIT(10)
3258c2ecf20Sopenharmony_ci#define ENTER_U2_INTR		BIT(9)
3268c2ecf20Sopenharmony_ci#define ENTER_U1_INTR		BIT(8)
3278c2ecf20Sopenharmony_ci#define ENTER_U0_INTR		BIT(7)
3288c2ecf20Sopenharmony_ci#define RECOVERY_INTR		BIT(6)
3298c2ecf20Sopenharmony_ci#define WARM_RST_INTR		BIT(5)
3308c2ecf20Sopenharmony_ci#define HOT_RST_INTR		BIT(4)
3318c2ecf20Sopenharmony_ci#define LOOPBACK_INTR		BIT(3)
3328c2ecf20Sopenharmony_ci#define COMPLIANCE_INTR		BIT(2)
3338c2ecf20Sopenharmony_ci#define SS_DISABLE_INTR		BIT(1)
3348c2ecf20Sopenharmony_ci#define SS_INACTIVE_INTR	BIT(0)
3358c2ecf20Sopenharmony_ci
3368c2ecf20Sopenharmony_ci/* U3D_U3U2_SWITCH_CTRL */
3378c2ecf20Sopenharmony_ci#define SOFTCON_CLR_AUTO_EN	BIT(0)
3388c2ecf20Sopenharmony_ci
3398c2ecf20Sopenharmony_ci/*---------------- SSUSB_USB3_SYS_CSR REGISTER DEFINITION ----------------*/
3408c2ecf20Sopenharmony_ci
3418c2ecf20Sopenharmony_ci#define U3D_LINK_UX_INACT_TIMER	(SSUSB_USB3_SYS_CSR_BASE + 0x020C)
3428c2ecf20Sopenharmony_ci#define U3D_LINK_POWER_CONTROL	(SSUSB_USB3_SYS_CSR_BASE + 0x0210)
3438c2ecf20Sopenharmony_ci#define U3D_LINK_ERR_COUNT	(SSUSB_USB3_SYS_CSR_BASE + 0x0214)
3448c2ecf20Sopenharmony_ci
3458c2ecf20Sopenharmony_ci/*---------------- SSUSB_USB3_SYS_CSR FIELD DEFINITION ----------------*/
3468c2ecf20Sopenharmony_ci
3478c2ecf20Sopenharmony_ci/* U3D_LINK_UX_INACT_TIMER */
3488c2ecf20Sopenharmony_ci#define DEV_U2_INACT_TIMEOUT_MSK	GENMASK(23, 16)
3498c2ecf20Sopenharmony_ci#define DEV_U2_INACT_TIMEOUT_VALUE(x)	(((x) & 0xff) << 16)
3508c2ecf20Sopenharmony_ci#define U2_INACT_TIMEOUT_MSK		GENMASK(15, 8)
3518c2ecf20Sopenharmony_ci#define U1_INACT_TIMEOUT_MSK		GENMASK(7, 0)
3528c2ecf20Sopenharmony_ci#define U1_INACT_TIMEOUT_VALUE(x)	((x) & 0xff)
3538c2ecf20Sopenharmony_ci
3548c2ecf20Sopenharmony_ci/* U3D_LINK_POWER_CONTROL */
3558c2ecf20Sopenharmony_ci#define SW_U2_ACCEPT_ENABLE	BIT(9)
3568c2ecf20Sopenharmony_ci#define SW_U1_ACCEPT_ENABLE	BIT(8)
3578c2ecf20Sopenharmony_ci#define UX_EXIT			BIT(5)
3588c2ecf20Sopenharmony_ci#define LGO_U3			BIT(4)
3598c2ecf20Sopenharmony_ci#define LGO_U2			BIT(3)
3608c2ecf20Sopenharmony_ci#define LGO_U1			BIT(2)
3618c2ecf20Sopenharmony_ci#define SW_U2_REQUEST_ENABLE	BIT(1)
3628c2ecf20Sopenharmony_ci#define SW_U1_REQUEST_ENABLE	BIT(0)
3638c2ecf20Sopenharmony_ci
3648c2ecf20Sopenharmony_ci/* U3D_LINK_ERR_COUNT */
3658c2ecf20Sopenharmony_ci#define CLR_LINK_ERR_CNT	BIT(16)
3668c2ecf20Sopenharmony_ci#define LINK_ERROR_COUNT	GENMASK(15, 0)
3678c2ecf20Sopenharmony_ci
3688c2ecf20Sopenharmony_ci/*---------------- SSUSB_USB2_CSR REGISTER DEFINITION ----------------*/
3698c2ecf20Sopenharmony_ci
3708c2ecf20Sopenharmony_ci#define U3D_POWER_MANAGEMENT		(SSUSB_USB2_CSR_BASE + 0x0004)
3718c2ecf20Sopenharmony_ci#define U3D_DEVICE_CONTROL		(SSUSB_USB2_CSR_BASE + 0x000C)
3728c2ecf20Sopenharmony_ci#define U3D_USB2_TEST_MODE		(SSUSB_USB2_CSR_BASE + 0x0014)
3738c2ecf20Sopenharmony_ci#define U3D_COMMON_USB_INTR_ENABLE	(SSUSB_USB2_CSR_BASE + 0x0018)
3748c2ecf20Sopenharmony_ci#define U3D_COMMON_USB_INTR		(SSUSB_USB2_CSR_BASE + 0x001C)
3758c2ecf20Sopenharmony_ci#define U3D_LINK_RESET_INFO		(SSUSB_USB2_CSR_BASE + 0x0024)
3768c2ecf20Sopenharmony_ci#define U3D_USB20_FRAME_NUM		(SSUSB_USB2_CSR_BASE + 0x003C)
3778c2ecf20Sopenharmony_ci#define U3D_USB20_LPM_PARAMETER		(SSUSB_USB2_CSR_BASE + 0x0044)
3788c2ecf20Sopenharmony_ci#define U3D_USB20_MISC_CONTROL		(SSUSB_USB2_CSR_BASE + 0x004C)
3798c2ecf20Sopenharmony_ci#define U3D_USB20_OPSTATE		(SSUSB_USB2_CSR_BASE + 0x0060)
3808c2ecf20Sopenharmony_ci
3818c2ecf20Sopenharmony_ci/*---------------- SSUSB_USB2_CSR FIELD DEFINITION ----------------*/
3828c2ecf20Sopenharmony_ci
3838c2ecf20Sopenharmony_ci/* U3D_POWER_MANAGEMENT */
3848c2ecf20Sopenharmony_ci#define LPM_BESL_STALL		BIT(14)
3858c2ecf20Sopenharmony_ci#define LPM_BESLD_STALL		BIT(13)
3868c2ecf20Sopenharmony_ci#define LPM_RWP			BIT(11)
3878c2ecf20Sopenharmony_ci#define LPM_HRWE		BIT(10)
3888c2ecf20Sopenharmony_ci#define LPM_MODE(x)		(((x) & 0x3) << 8)
3898c2ecf20Sopenharmony_ci#define ISO_UPDATE		BIT(7)
3908c2ecf20Sopenharmony_ci#define SOFT_CONN		BIT(6)
3918c2ecf20Sopenharmony_ci#define HS_ENABLE		BIT(5)
3928c2ecf20Sopenharmony_ci#define RESUME			BIT(2)
3938c2ecf20Sopenharmony_ci#define SUSPENDM_ENABLE		BIT(0)
3948c2ecf20Sopenharmony_ci
3958c2ecf20Sopenharmony_ci/* U3D_DEVICE_CONTROL */
3968c2ecf20Sopenharmony_ci#define DC_HOSTREQ		BIT(1)
3978c2ecf20Sopenharmony_ci#define DC_SESSION		BIT(0)
3988c2ecf20Sopenharmony_ci
3998c2ecf20Sopenharmony_ci/* U3D_USB2_TEST_MODE */
4008c2ecf20Sopenharmony_ci#define U2U3_AUTO_SWITCH	BIT(10)
4018c2ecf20Sopenharmony_ci#define LPM_FORCE_STALL		BIT(8)
4028c2ecf20Sopenharmony_ci#define FIFO_ACCESS		BIT(6)
4038c2ecf20Sopenharmony_ci#define FORCE_FS		BIT(5)
4048c2ecf20Sopenharmony_ci#define FORCE_HS		BIT(4)
4058c2ecf20Sopenharmony_ci#define TEST_PACKET_MODE	BIT(3)
4068c2ecf20Sopenharmony_ci#define TEST_K_MODE		BIT(2)
4078c2ecf20Sopenharmony_ci#define TEST_J_MODE		BIT(1)
4088c2ecf20Sopenharmony_ci#define TEST_SE0_NAK_MODE	BIT(0)
4098c2ecf20Sopenharmony_ci
4108c2ecf20Sopenharmony_ci/* U3D_COMMON_USB_INTR_ENABLE */
4118c2ecf20Sopenharmony_ci/* U3D_COMMON_USB_INTR */
4128c2ecf20Sopenharmony_ci#define LPM_RESUME_INTR		BIT(9)
4138c2ecf20Sopenharmony_ci#define LPM_INTR		BIT(8)
4148c2ecf20Sopenharmony_ci#define DISCONN_INTR		BIT(5)
4158c2ecf20Sopenharmony_ci#define CONN_INTR		BIT(4)
4168c2ecf20Sopenharmony_ci#define SOF_INTR		BIT(3)
4178c2ecf20Sopenharmony_ci#define RESET_INTR		BIT(2)
4188c2ecf20Sopenharmony_ci#define RESUME_INTR		BIT(1)
4198c2ecf20Sopenharmony_ci#define SUSPEND_INTR		BIT(0)
4208c2ecf20Sopenharmony_ci
4218c2ecf20Sopenharmony_ci/* U3D_LINK_RESET_INFO */
4228c2ecf20Sopenharmony_ci#define WTCHRP_MSK		GENMASK(19, 16)
4238c2ecf20Sopenharmony_ci
4248c2ecf20Sopenharmony_ci/* U3D_USB20_LPM_PARAMETER */
4258c2ecf20Sopenharmony_ci#define LPM_BESLCK_U3(x)	(((x) & 0xf) << 12)
4268c2ecf20Sopenharmony_ci#define LPM_BESLCK(x)		(((x) & 0xf) << 8)
4278c2ecf20Sopenharmony_ci#define LPM_BESLDCK(x)		(((x) & 0xf) << 4)
4288c2ecf20Sopenharmony_ci#define LPM_BESL		GENMASK(3, 0)
4298c2ecf20Sopenharmony_ci
4308c2ecf20Sopenharmony_ci/* U3D_USB20_MISC_CONTROL */
4318c2ecf20Sopenharmony_ci#define LPM_U3_ACK_EN		BIT(0)
4328c2ecf20Sopenharmony_ci
4338c2ecf20Sopenharmony_ci/*---------------- SSUSB_SIFSLV_IPPC REGISTER DEFINITION ----------------*/
4348c2ecf20Sopenharmony_ci
4358c2ecf20Sopenharmony_ci#define U3D_SSUSB_IP_PW_CTRL0	(SSUSB_SIFSLV_IPPC_BASE + 0x0000)
4368c2ecf20Sopenharmony_ci#define U3D_SSUSB_IP_PW_CTRL1	(SSUSB_SIFSLV_IPPC_BASE + 0x0004)
4378c2ecf20Sopenharmony_ci#define U3D_SSUSB_IP_PW_CTRL2	(SSUSB_SIFSLV_IPPC_BASE + 0x0008)
4388c2ecf20Sopenharmony_ci#define U3D_SSUSB_IP_PW_CTRL3	(SSUSB_SIFSLV_IPPC_BASE + 0x000C)
4398c2ecf20Sopenharmony_ci#define U3D_SSUSB_IP_PW_STS1	(SSUSB_SIFSLV_IPPC_BASE + 0x0010)
4408c2ecf20Sopenharmony_ci#define U3D_SSUSB_IP_PW_STS2	(SSUSB_SIFSLV_IPPC_BASE + 0x0014)
4418c2ecf20Sopenharmony_ci#define U3D_SSUSB_OTG_STS	(SSUSB_SIFSLV_IPPC_BASE + 0x0018)
4428c2ecf20Sopenharmony_ci#define U3D_SSUSB_OTG_STS_CLR	(SSUSB_SIFSLV_IPPC_BASE + 0x001C)
4438c2ecf20Sopenharmony_ci#define U3D_SSUSB_IP_XHCI_CAP	(SSUSB_SIFSLV_IPPC_BASE + 0x0024)
4448c2ecf20Sopenharmony_ci#define U3D_SSUSB_IP_DEV_CAP	(SSUSB_SIFSLV_IPPC_BASE + 0x0028)
4458c2ecf20Sopenharmony_ci#define U3D_SSUSB_OTG_INT_EN	(SSUSB_SIFSLV_IPPC_BASE + 0x002C)
4468c2ecf20Sopenharmony_ci#define U3D_SSUSB_U3_CTRL_0P	(SSUSB_SIFSLV_IPPC_BASE + 0x0030)
4478c2ecf20Sopenharmony_ci#define U3D_SSUSB_U2_CTRL_0P	(SSUSB_SIFSLV_IPPC_BASE + 0x0050)
4488c2ecf20Sopenharmony_ci#define U3D_SSUSB_REF_CK_CTRL	(SSUSB_SIFSLV_IPPC_BASE + 0x008C)
4498c2ecf20Sopenharmony_ci#define U3D_SSUSB_DEV_RST_CTRL	(SSUSB_SIFSLV_IPPC_BASE + 0x0098)
4508c2ecf20Sopenharmony_ci#define U3D_SSUSB_HW_ID		(SSUSB_SIFSLV_IPPC_BASE + 0x00A0)
4518c2ecf20Sopenharmony_ci#define U3D_SSUSB_HW_SUB_ID	(SSUSB_SIFSLV_IPPC_BASE + 0x00A4)
4528c2ecf20Sopenharmony_ci#define U3D_SSUSB_IP_TRUNK_VERS	(U3D_SSUSB_HW_SUB_ID)
4538c2ecf20Sopenharmony_ci#define U3D_SSUSB_PRB_CTRL0	(SSUSB_SIFSLV_IPPC_BASE + 0x00B0)
4548c2ecf20Sopenharmony_ci#define U3D_SSUSB_PRB_CTRL1	(SSUSB_SIFSLV_IPPC_BASE + 0x00B4)
4558c2ecf20Sopenharmony_ci#define U3D_SSUSB_PRB_CTRL2	(SSUSB_SIFSLV_IPPC_BASE + 0x00B8)
4568c2ecf20Sopenharmony_ci#define U3D_SSUSB_PRB_CTRL3	(SSUSB_SIFSLV_IPPC_BASE + 0x00BC)
4578c2ecf20Sopenharmony_ci#define U3D_SSUSB_PRB_CTRL4	(SSUSB_SIFSLV_IPPC_BASE + 0x00C0)
4588c2ecf20Sopenharmony_ci#define U3D_SSUSB_PRB_CTRL5	(SSUSB_SIFSLV_IPPC_BASE + 0x00C4)
4598c2ecf20Sopenharmony_ci#define U3D_SSUSB_IP_SPARE0	(SSUSB_SIFSLV_IPPC_BASE + 0x00C8)
4608c2ecf20Sopenharmony_ci
4618c2ecf20Sopenharmony_ci/*---------------- SSUSB_SIFSLV_IPPC FIELD DEFINITION ----------------*/
4628c2ecf20Sopenharmony_ci
4638c2ecf20Sopenharmony_ci/* U3D_SSUSB_IP_PW_CTRL0 */
4648c2ecf20Sopenharmony_ci#define SSUSB_IP_SW_RST			BIT(0)
4658c2ecf20Sopenharmony_ci
4668c2ecf20Sopenharmony_ci/* U3D_SSUSB_IP_PW_CTRL1 */
4678c2ecf20Sopenharmony_ci#define SSUSB_IP_HOST_PDN		BIT(0)
4688c2ecf20Sopenharmony_ci
4698c2ecf20Sopenharmony_ci/* U3D_SSUSB_IP_PW_CTRL2 */
4708c2ecf20Sopenharmony_ci#define SSUSB_IP_DEV_PDN		BIT(0)
4718c2ecf20Sopenharmony_ci
4728c2ecf20Sopenharmony_ci/* U3D_SSUSB_IP_PW_CTRL3 */
4738c2ecf20Sopenharmony_ci#define SSUSB_IP_PCIE_PDN		BIT(0)
4748c2ecf20Sopenharmony_ci
4758c2ecf20Sopenharmony_ci/* U3D_SSUSB_IP_PW_STS1 */
4768c2ecf20Sopenharmony_ci#define SSUSB_IP_SLEEP_STS		BIT(30)
4778c2ecf20Sopenharmony_ci#define SSUSB_U3_MAC_RST_B_STS		BIT(16)
4788c2ecf20Sopenharmony_ci#define SSUSB_XHCI_RST_B_STS		BIT(11)
4798c2ecf20Sopenharmony_ci#define SSUSB_SYS125_RST_B_STS		BIT(10)
4808c2ecf20Sopenharmony_ci#define SSUSB_REF_RST_B_STS		BIT(8)
4818c2ecf20Sopenharmony_ci#define SSUSB_SYSPLL_STABLE		BIT(0)
4828c2ecf20Sopenharmony_ci
4838c2ecf20Sopenharmony_ci/* U3D_SSUSB_IP_PW_STS2 */
4848c2ecf20Sopenharmony_ci#define SSUSB_U2_MAC_SYS_RST_B_STS	BIT(0)
4858c2ecf20Sopenharmony_ci
4868c2ecf20Sopenharmony_ci/* U3D_SSUSB_OTG_STS */
4878c2ecf20Sopenharmony_ci#define SSUSB_VBUS_VALID		BIT(9)
4888c2ecf20Sopenharmony_ci
4898c2ecf20Sopenharmony_ci/* U3D_SSUSB_OTG_STS_CLR */
4908c2ecf20Sopenharmony_ci#define SSUSB_VBUS_INTR_CLR		BIT(6)
4918c2ecf20Sopenharmony_ci
4928c2ecf20Sopenharmony_ci/* U3D_SSUSB_IP_XHCI_CAP */
4938c2ecf20Sopenharmony_ci#define SSUSB_IP_XHCI_U2_PORT_NUM(x)	(((x) >> 8) & 0xff)
4948c2ecf20Sopenharmony_ci#define SSUSB_IP_XHCI_U3_PORT_NUM(x)	((x) & 0xff)
4958c2ecf20Sopenharmony_ci
4968c2ecf20Sopenharmony_ci/* U3D_SSUSB_IP_DEV_CAP */
4978c2ecf20Sopenharmony_ci#define SSUSB_IP_DEV_U3_PORT_NUM(x)	((x) & 0xff)
4988c2ecf20Sopenharmony_ci
4998c2ecf20Sopenharmony_ci/* U3D_SSUSB_OTG_INT_EN */
5008c2ecf20Sopenharmony_ci#define SSUSB_VBUS_CHG_INT_A_EN		BIT(7)
5018c2ecf20Sopenharmony_ci#define SSUSB_VBUS_CHG_INT_B_EN		BIT(6)
5028c2ecf20Sopenharmony_ci
5038c2ecf20Sopenharmony_ci/* U3D_SSUSB_U3_CTRL_0P */
5048c2ecf20Sopenharmony_ci#define SSUSB_U3_PORT_SSP_SPEED	BIT(9)
5058c2ecf20Sopenharmony_ci#define SSUSB_U3_PORT_DUAL_MODE	BIT(7)
5068c2ecf20Sopenharmony_ci#define SSUSB_U3_PORT_HOST_SEL		BIT(2)
5078c2ecf20Sopenharmony_ci#define SSUSB_U3_PORT_PDN		BIT(1)
5088c2ecf20Sopenharmony_ci#define SSUSB_U3_PORT_DIS		BIT(0)
5098c2ecf20Sopenharmony_ci
5108c2ecf20Sopenharmony_ci/* U3D_SSUSB_U2_CTRL_0P */
5118c2ecf20Sopenharmony_ci#define SSUSB_U2_PORT_RG_IDDIG		BIT(12)
5128c2ecf20Sopenharmony_ci#define SSUSB_U2_PORT_FORCE_IDDIG	BIT(11)
5138c2ecf20Sopenharmony_ci#define SSUSB_U2_PORT_VBUSVALID	BIT(9)
5148c2ecf20Sopenharmony_ci#define SSUSB_U2_PORT_OTG_SEL		BIT(7)
5158c2ecf20Sopenharmony_ci#define SSUSB_U2_PORT_HOST		BIT(2)
5168c2ecf20Sopenharmony_ci#define SSUSB_U2_PORT_PDN		BIT(1)
5178c2ecf20Sopenharmony_ci#define SSUSB_U2_PORT_DIS		BIT(0)
5188c2ecf20Sopenharmony_ci#define SSUSB_U2_PORT_HOST_SEL	(SSUSB_U2_PORT_VBUSVALID | SSUSB_U2_PORT_HOST)
5198c2ecf20Sopenharmony_ci
5208c2ecf20Sopenharmony_ci/* U3D_SSUSB_DEV_RST_CTRL */
5218c2ecf20Sopenharmony_ci#define SSUSB_DEV_SW_RST		BIT(0)
5228c2ecf20Sopenharmony_ci
5238c2ecf20Sopenharmony_ci/* U3D_SSUSB_IP_TRUNK_VERS */
5248c2ecf20Sopenharmony_ci#define IP_TRUNK_VERS(x)		(((x) >> 16) & 0xffff)
5258c2ecf20Sopenharmony_ci
5268c2ecf20Sopenharmony_ci#endif	/* _SSUSB_HW_REGS_H_ */
527