xref: /rk3399_rockchip-uboot/include/linux/usb/xhci-omap.h (revision 834e91af432479e3808e9cbd1d38199f724fc5aa)
141b667b8SDan Murphy /*
241b667b8SDan Murphy  * (C) Copyright 2013
341b667b8SDan Murphy  * Texas Instruments Inc, <www.ti.com>
441b667b8SDan Murphy  *
541b667b8SDan Murphy  * Author: Dan Murphy <dmurphy@ti.com>
641b667b8SDan Murphy  *
741b667b8SDan Murphy  * SPDX-License-Identifier:	GPL-2.0+
841b667b8SDan Murphy  */
941b667b8SDan Murphy 
1041b667b8SDan Murphy #ifndef _ASM_ARCH_XHCI_OMAP_H_
1141b667b8SDan Murphy #define _ASM_ARCH_XHCI_OMAP_H_
1241b667b8SDan Murphy 
13*834e91afSDan Murphy #ifdef CONFIG_DRA7XX
14*834e91afSDan Murphy #define OMAP_XHCI_BASE 0x488d0000
15*834e91afSDan Murphy #define OMAP_OCP1_SCP_BASE 0x4A081000
16*834e91afSDan Murphy #define OMAP_OTG_WRAPPER_BASE 0x488c0000
17*834e91afSDan Murphy #else
18*834e91afSDan Murphy /* Default to the OMAP5 XHCI defines */
1941b667b8SDan Murphy #define OMAP_XHCI_BASE 0x4a030000
2041b667b8SDan Murphy #define OMAP_OCP1_SCP_BASE 0x4a084c00
2141b667b8SDan Murphy #define OMAP_OTG_WRAPPER_BASE 0x4A020000
22*834e91afSDan Murphy #endif
2341b667b8SDan Murphy 
2441b667b8SDan Murphy /* Phy register MACRO definitions */
2541b667b8SDan Murphy #define	PLL_REGM_MASK		0x001FFE00
2641b667b8SDan Murphy #define	PLL_REGM_SHIFT		0x9
2741b667b8SDan Murphy #define	PLL_REGM_F_MASK		0x0003FFFF
2841b667b8SDan Murphy #define	PLL_REGM_F_SHIFT	0x0
2941b667b8SDan Murphy #define	PLL_REGN_MASK		0x000001FE
3041b667b8SDan Murphy #define	PLL_REGN_SHIFT		0x1
3141b667b8SDan Murphy #define	PLL_SELFREQDCO_MASK	0x0000000E
3241b667b8SDan Murphy #define	PLL_SELFREQDCO_SHIFT	0x1
3341b667b8SDan Murphy #define	PLL_SD_MASK		0x0003FC00
3441b667b8SDan Murphy #define	PLL_SD_SHIFT		0x9
3541b667b8SDan Murphy #define	SET_PLL_GO		0x1
3641b667b8SDan Murphy #define	PLL_TICOPWDN		0x10000
3741b667b8SDan Murphy #define	PLL_LOCK		0x2
3841b667b8SDan Murphy #define	PLL_IDLE		0x1
3941b667b8SDan Murphy 
4041b667b8SDan Murphy #define USB3_PWRCTL_CLK_CMD_MASK	0x3FE000
4141b667b8SDan Murphy #define USB3_PWRCTL_CLK_FREQ_MASK	0xFFC
4241b667b8SDan Murphy #define USB3_PHY_PARTIAL_RX_POWERON     (1 << 6)
4341b667b8SDan Murphy #define USB3_PHY_RX_POWERON		(1 << 14)
4441b667b8SDan Murphy #define USB3_PHY_TX_POWERON		(1 << 15)
4541b667b8SDan Murphy #define USB3_PHY_TX_RX_POWERON	(USB3_PHY_RX_POWERON | USB3_PHY_TX_POWERON)
4641b667b8SDan Murphy #define USB3_PWRCTL_CLK_CMD_SHIFT   14
4741b667b8SDan Murphy #define USB3_PWRCTL_CLK_FREQ_SHIFT	22
4841b667b8SDan Murphy 
4941b667b8SDan Murphy /* USBOTGSS_WRAPPER definitions */
5041b667b8SDan Murphy #define USBOTGSS_WRAPRESET	(1 << 17)
5141b667b8SDan Murphy #define USBOTGSS_DMADISABLE (1 << 16)
5241b667b8SDan Murphy #define USBOTGSS_STANDBYMODE_NO_STANDBY (1 << 4)
5341b667b8SDan Murphy #define USBOTGSS_STANDBYMODE_SMRT		(1 << 5)
5441b667b8SDan Murphy #define USBOTGSS_STANDBYMODE_SMRT_WKUP (0x3 << 4)
5541b667b8SDan Murphy #define USBOTGSS_IDLEMODE_NOIDLE (1 << 2)
5641b667b8SDan Murphy #define USBOTGSS_IDLEMODE_SMRT (1 << 3)
5741b667b8SDan Murphy #define USBOTGSS_IDLEMODE_SMRT_WKUP (0x3 << 2)
5841b667b8SDan Murphy 
5941b667b8SDan Murphy /* USBOTGSS_IRQENABLE_SET_0 bit */
6041b667b8SDan Murphy #define USBOTGSS_COREIRQ_EN	(1 << 0)
6141b667b8SDan Murphy 
6241b667b8SDan Murphy /* USBOTGSS_IRQENABLE_SET_1 bits */
6341b667b8SDan Murphy #define USBOTGSS_IRQ_SET_1_IDPULLUP_FALL_EN	(1 << 0)
6441b667b8SDan Murphy #define USBOTGSS_IRQ_SET_1_DISCHRGVBUS_FALL_EN	(1 << 3)
6541b667b8SDan Murphy #define USBOTGSS_IRQ_SET_1_CHRGVBUS_FALL_EN	(1 << 4)
6641b667b8SDan Murphy #define USBOTGSS_IRQ_SET_1_DRVVBUS_FALL_EN	(1 << 5)
6741b667b8SDan Murphy #define USBOTGSS_IRQ_SET_1_IDPULLUP_RISE_EN	(1 << 8)
6841b667b8SDan Murphy #define USBOTGSS_IRQ_SET_1_DISCHRGVBUS_RISE_EN	(1 << 11)
6941b667b8SDan Murphy #define USBOTGSS_IRQ_SET_1_CHRGVBUS_RISE_EN	(1 << 12)
7041b667b8SDan Murphy #define USBOTGSS_IRQ_SET_1_DRVVBUS_RISE_EN	(1 << 13)
7141b667b8SDan Murphy #define USBOTGSS_IRQ_SET_1_OEVT_EN	(1 << 16)
7241b667b8SDan Murphy #define USBOTGSS_IRQ_SET_1_DMADISABLECLR_EN	(1 << 17)
7341b667b8SDan Murphy 
7441b667b8SDan Murphy /*
7541b667b8SDan Murphy  * USBOTGSS_WRAPPER registers
7641b667b8SDan Murphy  */
7741b667b8SDan Murphy struct omap_dwc_wrapper {
7841b667b8SDan Murphy 	u32 revision;
7941b667b8SDan Murphy 
8041b667b8SDan Murphy 	u32 reserve_1[3];
8141b667b8SDan Murphy 
8241b667b8SDan Murphy 	u32 sysconfig; /* offset of 0x10 */
8341b667b8SDan Murphy 
8441b667b8SDan Murphy 	u32 reserve_2[3];
8541b667b8SDan Murphy 	u16 reserve_3;
8641b667b8SDan Murphy 
8741b667b8SDan Murphy 	u32 irqstatus_raw_0; /* offset of 0x24 */
8841b667b8SDan Murphy 	u32 irqstatus_0;
8941b667b8SDan Murphy 	u32 irqenable_set_0;
9041b667b8SDan Murphy 	u32 irqenable_clr_0;
9141b667b8SDan Murphy 
9241b667b8SDan Murphy 	u32 irqstatus_raw_1; /* offset of 0x34 */
9341b667b8SDan Murphy 	u32 irqstatus_1;
9441b667b8SDan Murphy 	u32 irqenable_set_1;
9541b667b8SDan Murphy 	u32 irqenable_clr_1;
9641b667b8SDan Murphy 
9741b667b8SDan Murphy 	u32 reserve_4[15];
9841b667b8SDan Murphy 
9941b667b8SDan Murphy 	u32 utmi_otg_ctrl; /* offset of 0x80 */
10041b667b8SDan Murphy 	u32 utmi_otg_status;
10141b667b8SDan Murphy 
10241b667b8SDan Murphy 	u32 reserve_5[30];
10341b667b8SDan Murphy 
10441b667b8SDan Murphy 	u32 mram_offset; /* offset of 0x100 */
10541b667b8SDan Murphy 	u32 fladj;
10641b667b8SDan Murphy 	u32 dbg_config;
10741b667b8SDan Murphy 	u32 dbg_data;
10841b667b8SDan Murphy 	u32 dev_ebc_en;
10941b667b8SDan Murphy };
11041b667b8SDan Murphy 
11141b667b8SDan Murphy /* XHCI PHY register structure */
11241b667b8SDan Murphy struct omap_usb3_phy {
11341b667b8SDan Murphy 	u32 reserve1;
11441b667b8SDan Murphy 	u32 pll_status;
11541b667b8SDan Murphy 	u32 pll_go;
11641b667b8SDan Murphy 	u32 pll_config_1;
11741b667b8SDan Murphy 	u32 pll_config_2;
11841b667b8SDan Murphy 	u32 pll_config_3;
11941b667b8SDan Murphy 	u32 pll_ssc_config_1;
12041b667b8SDan Murphy 	u32 pll_ssc_config_2;
12141b667b8SDan Murphy 	u32 pll_config_4;
12241b667b8SDan Murphy };
12341b667b8SDan Murphy 
12441b667b8SDan Murphy struct omap_xhci {
12541b667b8SDan Murphy 	struct omap_dwc_wrapper *otg_wrapper;
12641b667b8SDan Murphy 	struct omap_usb3_phy *usb3_phy;
12741b667b8SDan Murphy 	struct xhci_hccr *hcd;
12841b667b8SDan Murphy 	struct dwc3 *dwc3_reg;
12941b667b8SDan Murphy };
13041b667b8SDan Murphy 
131ba55453cSDan Murphy /* USB PHY functions */
132*834e91afSDan Murphy void omap_enable_phy(struct omap_xhci *omap);
133ba55453cSDan Murphy void omap_reset_usb_phy(struct dwc3 *dwc3_reg);
134*834e91afSDan Murphy void usb_phy_power(int on);
135ba55453cSDan Murphy 
13641b667b8SDan Murphy #endif /* _ASM_ARCH_XHCI_OMAP_H_ */
137