162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * bits.h - register bits of the ChipIdea USB IP core 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright (C) 2008 Chipidea - MIPS Technologies, Inc. All rights reserved. 662306a36Sopenharmony_ci * 762306a36Sopenharmony_ci * Author: David Lopo 862306a36Sopenharmony_ci */ 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci#ifndef __DRIVERS_USB_CHIPIDEA_BITS_H 1162306a36Sopenharmony_ci#define __DRIVERS_USB_CHIPIDEA_BITS_H 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ci#include <linux/usb/ehci_def.h> 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ci/* 1662306a36Sopenharmony_ci * ID 1762306a36Sopenharmony_ci * For 1.x revision, bit24 - bit31 are reserved 1862306a36Sopenharmony_ci * For 2.x revision, bit25 - bit28 are 0x2 1962306a36Sopenharmony_ci */ 2062306a36Sopenharmony_ci#define TAG (0x1F << 16) 2162306a36Sopenharmony_ci#define REVISION (0xF << 21) 2262306a36Sopenharmony_ci#define VERSION (0xF << 25) 2362306a36Sopenharmony_ci#define CIVERSION (0x7 << 29) 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ci/* SBUSCFG */ 2662306a36Sopenharmony_ci#define AHBBRST_MASK 0x7 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_ci/* HCCPARAMS */ 2962306a36Sopenharmony_ci#define HCCPARAMS_LEN BIT(17) 3062306a36Sopenharmony_ci 3162306a36Sopenharmony_ci/* DCCPARAMS */ 3262306a36Sopenharmony_ci#define DCCPARAMS_DEN (0x1F << 0) 3362306a36Sopenharmony_ci#define DCCPARAMS_DC BIT(7) 3462306a36Sopenharmony_ci#define DCCPARAMS_HC BIT(8) 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_ci/* TESTMODE */ 3762306a36Sopenharmony_ci#define TESTMODE_FORCE BIT(0) 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci/* USBCMD */ 4062306a36Sopenharmony_ci#define USBCMD_RS BIT(0) 4162306a36Sopenharmony_ci#define USBCMD_RST BIT(1) 4262306a36Sopenharmony_ci#define USBCMD_SUTW BIT(13) 4362306a36Sopenharmony_ci#define USBCMD_ATDTW BIT(14) 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ci/* USBSTS & USBINTR */ 4662306a36Sopenharmony_ci#define USBi_UI BIT(0) 4762306a36Sopenharmony_ci#define USBi_UEI BIT(1) 4862306a36Sopenharmony_ci#define USBi_PCI BIT(2) 4962306a36Sopenharmony_ci#define USBi_URI BIT(6) 5062306a36Sopenharmony_ci#define USBi_SLI BIT(8) 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_ci/* DEVICEADDR */ 5362306a36Sopenharmony_ci#define DEVICEADDR_USBADRA BIT(24) 5462306a36Sopenharmony_ci#define DEVICEADDR_USBADR (0x7FUL << 25) 5562306a36Sopenharmony_ci 5662306a36Sopenharmony_ci/* TTCTRL */ 5762306a36Sopenharmony_ci#define TTCTRL_TTHA_MASK (0x7fUL << 24) 5862306a36Sopenharmony_ci/* Set non-zero value for internal TT Hub address representation */ 5962306a36Sopenharmony_ci#define TTCTRL_TTHA (0x7fUL << 24) 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ci/* BURSTSIZE */ 6262306a36Sopenharmony_ci#define RX_BURST_MASK 0xff 6362306a36Sopenharmony_ci#define TX_BURST_MASK 0xff00 6462306a36Sopenharmony_ci 6562306a36Sopenharmony_ci/* PORTSC */ 6662306a36Sopenharmony_ci#define PORTSC_CCS BIT(0) 6762306a36Sopenharmony_ci#define PORTSC_CSC BIT(1) 6862306a36Sopenharmony_ci#define PORTSC_PEC BIT(3) 6962306a36Sopenharmony_ci#define PORTSC_OCC BIT(5) 7062306a36Sopenharmony_ci#define PORTSC_FPR BIT(6) 7162306a36Sopenharmony_ci#define PORTSC_SUSP BIT(7) 7262306a36Sopenharmony_ci#define PORTSC_HSP BIT(9) 7362306a36Sopenharmony_ci#define PORTSC_PP BIT(12) 7462306a36Sopenharmony_ci#define PORTSC_PTC (0x0FUL << 16) 7562306a36Sopenharmony_ci#define PORTSC_WKCN BIT(20) 7662306a36Sopenharmony_ci#define PORTSC_PHCD(d) ((d) ? BIT(22) : BIT(23)) 7762306a36Sopenharmony_ci/* PTS and PTW for non lpm version only */ 7862306a36Sopenharmony_ci#define PORTSC_PFSC BIT(24) 7962306a36Sopenharmony_ci#define PORTSC_PTS(d) \ 8062306a36Sopenharmony_ci (u32)((((d) & 0x3) << 30) | (((d) & 0x4) ? BIT(25) : 0)) 8162306a36Sopenharmony_ci#define PORTSC_PTW BIT(28) 8262306a36Sopenharmony_ci#define PORTSC_STS BIT(29) 8362306a36Sopenharmony_ci 8462306a36Sopenharmony_ci#define PORTSC_W1C_BITS \ 8562306a36Sopenharmony_ci (PORTSC_CSC | PORTSC_PEC | PORTSC_OCC) 8662306a36Sopenharmony_ci 8762306a36Sopenharmony_ci/* DEVLC */ 8862306a36Sopenharmony_ci#define DEVLC_PFSC BIT(23) 8962306a36Sopenharmony_ci#define DEVLC_PSPD (0x03UL << 25) 9062306a36Sopenharmony_ci#define DEVLC_PSPD_HS (0x02UL << 25) 9162306a36Sopenharmony_ci#define DEVLC_PTW BIT(27) 9262306a36Sopenharmony_ci#define DEVLC_STS BIT(28) 9362306a36Sopenharmony_ci#define DEVLC_PTS(d) (u32)(((d) & 0x7) << 29) 9462306a36Sopenharmony_ci 9562306a36Sopenharmony_ci/* Encoding for DEVLC_PTS and PORTSC_PTS */ 9662306a36Sopenharmony_ci#define PTS_UTMI 0 9762306a36Sopenharmony_ci#define PTS_ULPI 2 9862306a36Sopenharmony_ci#define PTS_SERIAL 3 9962306a36Sopenharmony_ci#define PTS_HSIC 4 10062306a36Sopenharmony_ci 10162306a36Sopenharmony_ci/* OTGSC */ 10262306a36Sopenharmony_ci#define OTGSC_IDPU BIT(5) 10362306a36Sopenharmony_ci#define OTGSC_HADP BIT(6) 10462306a36Sopenharmony_ci#define OTGSC_HABA BIT(7) 10562306a36Sopenharmony_ci#define OTGSC_ID BIT(8) 10662306a36Sopenharmony_ci#define OTGSC_AVV BIT(9) 10762306a36Sopenharmony_ci#define OTGSC_ASV BIT(10) 10862306a36Sopenharmony_ci#define OTGSC_BSV BIT(11) 10962306a36Sopenharmony_ci#define OTGSC_BSE BIT(12) 11062306a36Sopenharmony_ci#define OTGSC_IDIS BIT(16) 11162306a36Sopenharmony_ci#define OTGSC_AVVIS BIT(17) 11262306a36Sopenharmony_ci#define OTGSC_ASVIS BIT(18) 11362306a36Sopenharmony_ci#define OTGSC_BSVIS BIT(19) 11462306a36Sopenharmony_ci#define OTGSC_BSEIS BIT(20) 11562306a36Sopenharmony_ci#define OTGSC_1MSIS BIT(21) 11662306a36Sopenharmony_ci#define OTGSC_DPIS BIT(22) 11762306a36Sopenharmony_ci#define OTGSC_IDIE BIT(24) 11862306a36Sopenharmony_ci#define OTGSC_AVVIE BIT(25) 11962306a36Sopenharmony_ci#define OTGSC_ASVIE BIT(26) 12062306a36Sopenharmony_ci#define OTGSC_BSVIE BIT(27) 12162306a36Sopenharmony_ci#define OTGSC_BSEIE BIT(28) 12262306a36Sopenharmony_ci#define OTGSC_1MSIE BIT(29) 12362306a36Sopenharmony_ci#define OTGSC_DPIE BIT(30) 12462306a36Sopenharmony_ci#define OTGSC_INT_EN_BITS (OTGSC_IDIE | OTGSC_AVVIE | OTGSC_ASVIE \ 12562306a36Sopenharmony_ci | OTGSC_BSVIE | OTGSC_BSEIE | OTGSC_1MSIE \ 12662306a36Sopenharmony_ci | OTGSC_DPIE) 12762306a36Sopenharmony_ci#define OTGSC_INT_STATUS_BITS (OTGSC_IDIS | OTGSC_AVVIS | OTGSC_ASVIS \ 12862306a36Sopenharmony_ci | OTGSC_BSVIS | OTGSC_BSEIS | OTGSC_1MSIS \ 12962306a36Sopenharmony_ci | OTGSC_DPIS) 13062306a36Sopenharmony_ci 13162306a36Sopenharmony_ci/* USBMODE */ 13262306a36Sopenharmony_ci#define USBMODE_CM (0x03UL << 0) 13362306a36Sopenharmony_ci#define USBMODE_CM_DC (0x02UL << 0) 13462306a36Sopenharmony_ci#define USBMODE_SLOM BIT(3) 13562306a36Sopenharmony_ci#define USBMODE_CI_SDIS BIT(4) 13662306a36Sopenharmony_ci 13762306a36Sopenharmony_ci/* ENDPTCTRL */ 13862306a36Sopenharmony_ci#define ENDPTCTRL_RXS BIT(0) 13962306a36Sopenharmony_ci#define ENDPTCTRL_RXT (0x03UL << 2) 14062306a36Sopenharmony_ci#define ENDPTCTRL_RXR BIT(6) /* reserved for port 0 */ 14162306a36Sopenharmony_ci#define ENDPTCTRL_RXE BIT(7) 14262306a36Sopenharmony_ci#define ENDPTCTRL_TXS BIT(16) 14362306a36Sopenharmony_ci#define ENDPTCTRL_TXT (0x03UL << 18) 14462306a36Sopenharmony_ci#define ENDPTCTRL_TXR BIT(22) /* reserved for port 0 */ 14562306a36Sopenharmony_ci#define ENDPTCTRL_TXE BIT(23) 14662306a36Sopenharmony_ci 14762306a36Sopenharmony_ci#endif /* __DRIVERS_USB_CHIPIDEA_BITS_H */ 148