linux/drivers/usb/mtu3/mtu3_hw_regs.h

/* SPDX-License-Identifier: GPL-2.0 */
/*
 * mtu3_hw_regs.h - MediaTek USB3 DRD register and field definitions
 *
 * Copyright (C) 2016 MediaTek Inc.
 *
 * Author: Chunfeng Yun <[email protected]>
 */

#ifndef _SSUSB_HW_REGS_H_
#define _SSUSB_HW_REGS_H_

/* segment offset of MAC register */
#define SSUSB_DEV_BASE
#define SSUSB_EPCTL_CSR_BASE
#define SSUSB_USB3_MAC_CSR_BASE
#define SSUSB_USB3_SYS_CSR_BASE
#define SSUSB_USB2_CSR_BASE

/* IPPC register in Infra */
#define SSUSB_SIFSLV_IPPC_BASE

/* --------------- SSUSB_DEV REGISTER DEFINITION --------------- */

#define U3D_LV1ISR
#define U3D_LV1IER
#define U3D_LV1IESR
#define U3D_LV1IECR

#define U3D_EPISR
#define U3D_EPIER
#define U3D_EPIESR
#define U3D_EPIECR

#define U3D_EP0CSR
#define U3D_RXCOUNT0
#define U3D_RESERVED
#define U3D_TX1CSR0
#define U3D_TX1CSR1
#define U3D_TX1CSR2

#define U3D_RX1CSR0
#define U3D_RX1CSR1
#define U3D_RX1CSR2

#define U3D_FIFO0

#define U3D_QCR0
#define U3D_QCR1
#define U3D_QCR2
#define U3D_QCR3
#define U3D_QFCR
#define U3D_TXQHIAR1
#define U3D_RXQHIAR1

#define U3D_TXQCSR1
#define U3D_TXQSAR1
#define U3D_TXQCPR1

#define U3D_RXQCSR1
#define U3D_RXQSAR1
#define U3D_RXQCPR1
#define U3D_RXQLDPR1

#define U3D_QISAR0
#define U3D_QIER0
#define U3D_QIESR0
#define U3D_QIECR0
#define U3D_QISAR1
#define U3D_QIER1
#define U3D_QIESR1
#define U3D_QIECR1

#define U3D_TQERRIR0
#define U3D_TQERRIER0
#define U3D_TQERRIESR0
#define U3D_TQERRIECR0
#define U3D_RQERRIR0
#define U3D_RQERRIER0
#define U3D_RQERRIESR0
#define U3D_RQERRIECR0
#define U3D_RQERRIR1
#define U3D_RQERRIER1
#define U3D_RQERRIESR1
#define U3D_RQERRIECR1

#define U3D_CAP_EP0FFSZ
#define U3D_CAP_EPNTXFFSZ
#define U3D_CAP_EPNRXFFSZ
#define U3D_CAP_EPINFO
#define U3D_MISC_CTRL

/*---------------- SSUSB_DEV FIELD DEFINITION ---------------*/

/* U3D_LV1ISR */
#define EP_CTRL_INTR
#define MAC2_INTR
#define DMA_INTR
#define MAC3_INTR
#define QMU_INTR
#define BMU_INTR

/* U3D_LV1IECR */
#define LV1IECR_MSK

/* U3D_EPISR */
#define EPRISR(x)
#define SETUPENDISR
#define EPTISR(x)
#define EP0ISR

/* U3D_EP0CSR */
#define EP0_SENDSTALL
#define EP0_FIFOFULL
#define EP0_SENTSTALL
#define EP0_DPHTX
#define EP0_DATAEND
#define EP0_TXPKTRDY
#define EP0_SETUPPKTRDY
#define EP0_RXPKTRDY
#define EP0_MAXPKTSZ_MSK
#define EP0_MAXPKTSZ(x)
#define EP0_W1C_BITS

/* U3D_TX1CSR0 */
#define TX_DMAREQEN
#define TX_FIFOFULL
#define TX_FIFOEMPTY
#define TX_SENTSTALL
#define TX_SENDSTALL
#define TX_FLUSHFIFO
#define TX_TXPKTRDY
#define TX_TXMAXPKTSZ_MSK
#define TX_TXMAXPKTSZ(x)
#define TX_W1C_BITS

/* U3D_TX1CSR1 */
#define TX_MAX_PKT_G2(x)
#define TX_MULT_G2(x)
#define TX_MULT_OG(x)
#define TX_MAX_PKT_OG(x)
#define TX_SLOT(x)
#define TX_TYPE(x)
#define TX_SS_BURST(x)
#define TX_MULT(g2c, x)
#define TX_MAX_PKT(g2c, x)

/* for TX_TYPE & RX_TYPE */
#define TYPE_BULK
#define TYPE_INT
#define TYPE_ISO
#define TYPE_MASK

/* U3D_TX1CSR2 */
#define TX_BINTERVAL(x)
#define TX_FIFOSEGSIZE(x)
#define TX_FIFOADDR(x)

/* U3D_RX1CSR0 */
#define RX_DMAREQEN
#define RX_SENTSTALL
#define RX_SENDSTALL
#define RX_RXPKTRDY
#define RX_RXMAXPKTSZ_MSK
#define RX_RXMAXPKTSZ(x)
#define RX_W1C_BITS

/* U3D_RX1CSR1 */
#define RX_MAX_PKT_G2(x)
#define RX_MULT_G2(x)
#define RX_MULT_OG(x)
#define RX_MAX_PKT_OG(x)
#define RX_SLOT(x)
#define RX_TYPE(x)
#define RX_SS_BURST(x)
#define RX_MULT(g2c, x)
#define RX_MAX_PKT(g2c, x)

/* U3D_RX1CSR2 */
#define RX_BINTERVAL(x)
#define RX_FIFOSEGSIZE(x)
#define RX_FIFOADDR(x)

/* U3D_QCR0 */
#define QMU_RX_CS_EN(x)
#define QMU_TX_CS_EN(x)
#define QMU_CS16B_EN

/* U3D_QCR1 */
#define QMU_TX_ZLP(x)

/* U3D_QCR3 */
#define QMU_RX_COZ(x)
#define QMU_RX_ZLP(x)

/* U3D_TXQHIAR1 */
/* U3D_RXQHIAR1 */
#define QMU_LAST_DONE_PTR_HI(x)
#define QMU_CUR_GPD_ADDR_HI(x)
#define QMU_START_ADDR_HI_MSK
#define QMU_START_ADDR_HI(x)

/* U3D_TXQCSR1 */
/* U3D_RXQCSR1 */
#define QMU_Q_ACTIVE
#define QMU_Q_STOP
#define QMU_Q_RESUME
#define QMU_Q_START

/* U3D_QISAR0, U3D_QIER0, U3D_QIESR0, U3D_QIECR0 */
#define QMU_RX_DONE_INT(x)
#define QMU_TX_DONE_INT(x)

/* U3D_QISAR1, U3D_QIER1, U3D_QIESR1, U3D_QIECR1 */
#define RXQ_ZLPERR_INT
#define RXQ_LENERR_INT
#define RXQ_CSERR_INT
#define RXQ_EMPTY_INT
#define TXQ_LENERR_INT
#define TXQ_CSERR_INT
#define TXQ_EMPTY_INT

/* U3D_TQERRIR0, U3D_TQERRIER0, U3D_TQERRIESR0, U3D_TQERRIECR0 */
#define QMU_TX_LEN_ERR(x)
#define QMU_TX_CS_ERR(x)

/* U3D_RQERRIR0, U3D_RQERRIER0, U3D_RQERRIESR0, U3D_RQERRIECR0 */
#define QMU_RX_LEN_ERR(x)
#define QMU_RX_CS_ERR(x)

/* U3D_RQERRIR1, U3D_RQERRIER1, U3D_RQERRIESR1, U3D_RQERRIECR1 */
#define QMU_RX_ZLP_ERR(n)

/* U3D_CAP_EPINFO */
#define CAP_RX_EP_NUM(x)
#define CAP_TX_EP_NUM(x)

/* U3D_MISC_CTRL */
#define DMA_ADDR_36BIT
#define VBUS_ON
#define VBUS_FRC_EN


/*---------------- SSUSB_EPCTL_CSR REGISTER DEFINITION ----------------*/

#define U3D_DEVICE_CONF
#define U3D_EP_RST

#define U3D_DEV_LINK_INTR_ENABLE
#define U3D_DEV_LINK_INTR

/*---------------- SSUSB_EPCTL_CSR FIELD DEFINITION ----------------*/

/* U3D_DEVICE_CONF */
#define DEV_ADDR_MSK
#define DEV_ADDR(x)
#define HW_USB2_3_SEL
#define SW_USB2_3_SEL_EN
#define SW_USB2_3_SEL
#define SSUSB_DEV_SPEED(x)

/* U3D_EP_RST */
#define EP1_IN_RST
#define EP1_OUT_RST
#define EP_RST(is_in, epnum)
#define EP0_RST

/* U3D_DEV_LINK_INTR_ENABLE */
/* U3D_DEV_LINK_INTR */
#define SSUSB_DEV_SPEED_CHG_INTR


/*---------------- SSUSB_USB3_MAC_CSR REGISTER DEFINITION ----------------*/

#define U3D_LTSSM_CTRL
#define U3D_USB3_CONFIG

#define U3D_LINK_STATE_MACHINE
#define U3D_LTSSM_INTR_ENABLE
#define U3D_LTSSM_INTR

#define U3D_U3U2_SWITCH_CTRL

/*---------------- SSUSB_USB3_MAC_CSR FIELD DEFINITION ----------------*/

/* U3D_LTSSM_CTRL */
#define FORCE_POLLING_FAIL
#define FORCE_RXDETECT_FAIL
#define SOFT_U3_EXIT_EN
#define COMPLIANCE_EN
#define U1_GO_U2_EN

/* U3D_USB3_CONFIG */
#define USB3_EN

/* U3D_LINK_STATE_MACHINE */
#define LTSSM_STATE(x)

/* U3D_LTSSM_INTR_ENABLE */
/* U3D_LTSSM_INTR */
#define U3_RESUME_INTR
#define U3_LFPS_TMOUT_INTR
#define VBUS_FALL_INTR
#define VBUS_RISE_INTR
#define RXDET_SUCCESS_INTR
#define EXIT_U3_INTR
#define EXIT_U2_INTR
#define EXIT_U1_INTR
#define ENTER_U3_INTR
#define ENTER_U2_INTR
#define ENTER_U1_INTR
#define ENTER_U0_INTR
#define RECOVERY_INTR
#define WARM_RST_INTR
#define HOT_RST_INTR
#define LOOPBACK_INTR
#define COMPLIANCE_INTR
#define SS_DISABLE_INTR
#define SS_INACTIVE_INTR

/* U3D_U3U2_SWITCH_CTRL */
#define SOFTCON_CLR_AUTO_EN

/*---------------- SSUSB_USB3_SYS_CSR REGISTER DEFINITION ----------------*/

#define U3D_LINK_UX_INACT_TIMER
#define U3D_LINK_POWER_CONTROL
#define U3D_LINK_ERR_COUNT
#define U3D_DEV_NOTIF_0
#define U3D_DEV_NOTIF_1

/*---------------- SSUSB_USB3_SYS_CSR FIELD DEFINITION ----------------*/

/* U3D_LINK_UX_INACT_TIMER */
#define DEV_U2_INACT_TIMEOUT_MSK
#define DEV_U2_INACT_TIMEOUT_VALUE(x)
#define U2_INACT_TIMEOUT_MSK
#define U1_INACT_TIMEOUT_MSK
#define U1_INACT_TIMEOUT_VALUE(x)

/* U3D_LINK_POWER_CONTROL */
#define SW_U2_ACCEPT_ENABLE
#define SW_U1_ACCEPT_ENABLE
#define UX_EXIT
#define LGO_U3
#define LGO_U2
#define LGO_U1
#define SW_U2_REQUEST_ENABLE
#define SW_U1_REQUEST_ENABLE

/* U3D_LINK_ERR_COUNT */
#define CLR_LINK_ERR_CNT
#define LINK_ERROR_COUNT

/* U3D_DEV_NOTIF_0 */
#define DEV_NOTIF_TYPE_SPECIFIC_LOW_MSK
#define DEV_NOTIF_VAL_FW(x)
#define DEV_NOTIF_VAL_LTM(x)
#define DEV_NOTIF_VAL_IAM(x)
#define DEV_NOTIF_TYPE_MSK
/* Notification Type */
#define TYPE_FUNCTION_WAKE
#define TYPE_LATENCY_TOLERANCE_MESSAGE
#define TYPE_BUS_INTERVAL_ADJUST_MESSAGE
#define TYPE_HOST_ROLE_REQUEST
#define TYPE_SUBLINK_SPEED
#define SEND_DEV_NOTIF

/*---------------- SSUSB_USB2_CSR REGISTER DEFINITION ----------------*/

#define U3D_POWER_MANAGEMENT
#define U3D_DEVICE_CONTROL
#define U3D_USB2_TEST_MODE
#define U3D_COMMON_USB_INTR_ENABLE
#define U3D_COMMON_USB_INTR
#define U3D_LINK_RESET_INFO
#define U3D_USB20_FRAME_NUM
#define U3D_USB20_LPM_PARAMETER
#define U3D_USB20_MISC_CONTROL
#define U3D_USB20_OPSTATE

/*---------------- SSUSB_USB2_CSR FIELD DEFINITION ----------------*/

/* U3D_POWER_MANAGEMENT */
#define LPM_BESL_STALL
#define LPM_BESLD_STALL
#define LPM_RWP
#define LPM_HRWE
#define LPM_MODE(x)
#define ISO_UPDATE
#define SOFT_CONN
#define HS_ENABLE
#define RESUME
#define SUSPENDM_ENABLE

/* U3D_DEVICE_CONTROL */
#define DC_HOSTREQ
#define DC_SESSION

/* U3D_USB2_TEST_MODE */
#define U2U3_AUTO_SWITCH
#define LPM_FORCE_STALL
#define FIFO_ACCESS
#define FORCE_FS
#define FORCE_HS
#define TEST_PACKET_MODE
#define TEST_K_MODE
#define TEST_J_MODE
#define TEST_SE0_NAK_MODE

/* U3D_COMMON_USB_INTR_ENABLE */
/* U3D_COMMON_USB_INTR */
#define LPM_RESUME_INTR
#define LPM_INTR
#define DISCONN_INTR
#define CONN_INTR
#define SOF_INTR
#define RESET_INTR
#define RESUME_INTR
#define SUSPEND_INTR

/* U3D_LINK_RESET_INFO */
#define WTCHRP_MSK

/* U3D_USB20_LPM_PARAMETER */
#define LPM_BESLCK_U3(x)
#define LPM_BESLCK(x)
#define LPM_BESLDCK(x)
#define LPM_BESL

/* U3D_USB20_MISC_CONTROL */
#define LPM_U3_ACK_EN

/*---------------- SSUSB_SIFSLV_IPPC REGISTER DEFINITION ----------------*/

#define U3D_SSUSB_IP_PW_CTRL0
#define U3D_SSUSB_IP_PW_CTRL1
#define U3D_SSUSB_IP_PW_CTRL2
#define U3D_SSUSB_IP_PW_CTRL3
#define U3D_SSUSB_IP_PW_STS1
#define U3D_SSUSB_IP_PW_STS2
#define U3D_SSUSB_OTG_STS
#define U3D_SSUSB_OTG_STS_CLR
#define U3D_SSUSB_IP_XHCI_CAP
#define U3D_SSUSB_IP_DEV_CAP
#define U3D_SSUSB_OTG_INT_EN
#define U3D_SSUSB_U3_CTRL_0P
#define U3D_SSUSB_U2_CTRL_0P
#define U3D_SSUSB_REF_CK_CTRL
#define U3D_SSUSB_DEV_RST_CTRL
#define U3D_SSUSB_HW_ID
#define U3D_SSUSB_HW_SUB_ID
#define U3D_SSUSB_IP_TRUNK_VERS
#define U3D_SSUSB_PRB_CTRL0
#define U3D_SSUSB_PRB_CTRL1
#define U3D_SSUSB_PRB_CTRL2
#define U3D_SSUSB_PRB_CTRL3
#define U3D_SSUSB_PRB_CTRL4
#define U3D_SSUSB_PRB_CTRL5
#define U3D_SSUSB_IP_SPARE0

/*---------------- SSUSB_SIFSLV_IPPC FIELD DEFINITION ----------------*/

/* U3D_SSUSB_IP_PW_CTRL0 */
#define SSUSB_IP_SW_RST

/* U3D_SSUSB_IP_PW_CTRL1 */
#define SSUSB_IP_HOST_PDN

/* U3D_SSUSB_IP_PW_CTRL2 */
#define SSUSB_IP_DEV_PDN

/* U3D_SSUSB_IP_PW_CTRL3 */
#define SSUSB_IP_PCIE_PDN

/* U3D_SSUSB_IP_PW_STS1 */
#define SSUSB_IP_SLEEP_STS
#define SSUSB_U3_MAC_RST_B_STS
#define SSUSB_XHCI_RST_B_STS
#define SSUSB_SYS125_RST_B_STS
#define SSUSB_REF_RST_B_STS
#define SSUSB_SYSPLL_STABLE

/* U3D_SSUSB_IP_PW_STS2 */
#define SSUSB_U2_MAC_SYS_RST_B_STS

/* U3D_SSUSB_OTG_STS */
#define SSUSB_VBUS_VALID

/* U3D_SSUSB_OTG_STS_CLR */
#define SSUSB_VBUS_INTR_CLR

/* U3D_SSUSB_IP_XHCI_CAP */
#define SSUSB_IP_XHCI_U2_PORT_NUM(x)
#define SSUSB_IP_XHCI_U3_PORT_NUM(x)

/* U3D_SSUSB_IP_DEV_CAP */
#define SSUSB_IP_DEV_U3_PORT_NUM(x)

/* U3D_SSUSB_OTG_INT_EN */
#define SSUSB_VBUS_CHG_INT_A_EN
#define SSUSB_VBUS_CHG_INT_B_EN

/* U3D_SSUSB_U3_CTRL_0P */
#define SSUSB_U3_PORT_SSP_SPEED
#define SSUSB_U3_PORT_DUAL_MODE
#define SSUSB_U3_PORT_HOST_SEL
#define SSUSB_U3_PORT_PDN
#define SSUSB_U3_PORT_DIS

/* U3D_SSUSB_U2_CTRL_0P */
#define SSUSB_U2_PORT_RG_IDDIG
#define SSUSB_U2_PORT_FORCE_IDDIG
#define SSUSB_U2_PORT_VBUSVALID
#define SSUSB_U2_PORT_OTG_SEL
#define SSUSB_U2_PORT_HOST
#define SSUSB_U2_PORT_PDN
#define SSUSB_U2_PORT_DIS
#define SSUSB_U2_PORT_HOST_SEL

/* U3D_SSUSB_DEV_RST_CTRL */
#define SSUSB_DEV_SW_RST

/* U3D_SSUSB_IP_TRUNK_VERS */
#define IP_TRUNK_VERS(x)

#endif	/* _SSUSB_HW_REGS_H_ */