xref: /rk3399_rockchip-uboot/include/linux/usb/xhci-omap.h (revision ba55453ccf6d82c46b9f3eef5b958aac58adb6fb)
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 
1341b667b8SDan Murphy #define OMAP_XHCI_BASE 0x4a030000
1441b667b8SDan Murphy #define OMAP_OCP1_SCP_BASE 0x4a084c00
1541b667b8SDan Murphy #define OMAP_OTG_WRAPPER_BASE 0x4A020000
1641b667b8SDan Murphy 
1741b667b8SDan Murphy /* Phy register MACRO definitions */
1841b667b8SDan Murphy #define	PLL_REGM_MASK		0x001FFE00
1941b667b8SDan Murphy #define	PLL_REGM_SHIFT		0x9
2041b667b8SDan Murphy #define	PLL_REGM_F_MASK		0x0003FFFF
2141b667b8SDan Murphy #define	PLL_REGM_F_SHIFT	0x0
2241b667b8SDan Murphy #define	PLL_REGN_MASK		0x000001FE
2341b667b8SDan Murphy #define	PLL_REGN_SHIFT		0x1
2441b667b8SDan Murphy #define	PLL_SELFREQDCO_MASK	0x0000000E
2541b667b8SDan Murphy #define	PLL_SELFREQDCO_SHIFT	0x1
2641b667b8SDan Murphy #define	PLL_SD_MASK		0x0003FC00
2741b667b8SDan Murphy #define	PLL_SD_SHIFT		0x9
2841b667b8SDan Murphy #define	SET_PLL_GO		0x1
2941b667b8SDan Murphy #define	PLL_TICOPWDN		0x10000
3041b667b8SDan Murphy #define	PLL_LOCK		0x2
3141b667b8SDan Murphy #define	PLL_IDLE		0x1
3241b667b8SDan Murphy 
3341b667b8SDan Murphy #define USB3_PWRCTL_CLK_CMD_MASK	0x3FE000
3441b667b8SDan Murphy #define USB3_PWRCTL_CLK_FREQ_MASK	0xFFC
3541b667b8SDan Murphy #define USB3_PHY_PARTIAL_RX_POWERON     (1 << 6)
3641b667b8SDan Murphy #define USB3_PHY_RX_POWERON		(1 << 14)
3741b667b8SDan Murphy #define USB3_PHY_TX_POWERON		(1 << 15)
3841b667b8SDan Murphy #define USB3_PHY_TX_RX_POWERON	(USB3_PHY_RX_POWERON | USB3_PHY_TX_POWERON)
3941b667b8SDan Murphy #define USB3_PWRCTL_CLK_CMD_SHIFT   14
4041b667b8SDan Murphy #define USB3_PWRCTL_CLK_FREQ_SHIFT	22
4141b667b8SDan Murphy 
4241b667b8SDan Murphy /* USBOTGSS_WRAPPER definitions */
4341b667b8SDan Murphy #define USBOTGSS_WRAPRESET	(1 << 17)
4441b667b8SDan Murphy #define USBOTGSS_DMADISABLE (1 << 16)
4541b667b8SDan Murphy #define USBOTGSS_STANDBYMODE_NO_STANDBY (1 << 4)
4641b667b8SDan Murphy #define USBOTGSS_STANDBYMODE_SMRT		(1 << 5)
4741b667b8SDan Murphy #define USBOTGSS_STANDBYMODE_SMRT_WKUP (0x3 << 4)
4841b667b8SDan Murphy #define USBOTGSS_IDLEMODE_NOIDLE (1 << 2)
4941b667b8SDan Murphy #define USBOTGSS_IDLEMODE_SMRT (1 << 3)
5041b667b8SDan Murphy #define USBOTGSS_IDLEMODE_SMRT_WKUP (0x3 << 2)
5141b667b8SDan Murphy 
5241b667b8SDan Murphy /* USBOTGSS_IRQENABLE_SET_0 bit */
5341b667b8SDan Murphy #define USBOTGSS_COREIRQ_EN	(1 << 0)
5441b667b8SDan Murphy 
5541b667b8SDan Murphy /* USBOTGSS_IRQENABLE_SET_1 bits */
5641b667b8SDan Murphy #define USBOTGSS_IRQ_SET_1_IDPULLUP_FALL_EN	(1 << 0)
5741b667b8SDan Murphy #define USBOTGSS_IRQ_SET_1_DISCHRGVBUS_FALL_EN	(1 << 3)
5841b667b8SDan Murphy #define USBOTGSS_IRQ_SET_1_CHRGVBUS_FALL_EN	(1 << 4)
5941b667b8SDan Murphy #define USBOTGSS_IRQ_SET_1_DRVVBUS_FALL_EN	(1 << 5)
6041b667b8SDan Murphy #define USBOTGSS_IRQ_SET_1_IDPULLUP_RISE_EN	(1 << 8)
6141b667b8SDan Murphy #define USBOTGSS_IRQ_SET_1_DISCHRGVBUS_RISE_EN	(1 << 11)
6241b667b8SDan Murphy #define USBOTGSS_IRQ_SET_1_CHRGVBUS_RISE_EN	(1 << 12)
6341b667b8SDan Murphy #define USBOTGSS_IRQ_SET_1_DRVVBUS_RISE_EN	(1 << 13)
6441b667b8SDan Murphy #define USBOTGSS_IRQ_SET_1_OEVT_EN	(1 << 16)
6541b667b8SDan Murphy #define USBOTGSS_IRQ_SET_1_DMADISABLECLR_EN	(1 << 17)
6641b667b8SDan Murphy 
6741b667b8SDan Murphy /*
6841b667b8SDan Murphy  * USBOTGSS_WRAPPER registers
6941b667b8SDan Murphy  */
7041b667b8SDan Murphy struct omap_dwc_wrapper {
7141b667b8SDan Murphy 	u32 revision;
7241b667b8SDan Murphy 
7341b667b8SDan Murphy 	u32 reserve_1[3];
7441b667b8SDan Murphy 
7541b667b8SDan Murphy 	u32 sysconfig; /* offset of 0x10 */
7641b667b8SDan Murphy 
7741b667b8SDan Murphy 	u32 reserve_2[3];
7841b667b8SDan Murphy 	u16 reserve_3;
7941b667b8SDan Murphy 
8041b667b8SDan Murphy 	u32 irqstatus_raw_0; /* offset of 0x24 */
8141b667b8SDan Murphy 	u32 irqstatus_0;
8241b667b8SDan Murphy 	u32 irqenable_set_0;
8341b667b8SDan Murphy 	u32 irqenable_clr_0;
8441b667b8SDan Murphy 
8541b667b8SDan Murphy 	u32 irqstatus_raw_1; /* offset of 0x34 */
8641b667b8SDan Murphy 	u32 irqstatus_1;
8741b667b8SDan Murphy 	u32 irqenable_set_1;
8841b667b8SDan Murphy 	u32 irqenable_clr_1;
8941b667b8SDan Murphy 
9041b667b8SDan Murphy 	u32 reserve_4[15];
9141b667b8SDan Murphy 
9241b667b8SDan Murphy 	u32 utmi_otg_ctrl; /* offset of 0x80 */
9341b667b8SDan Murphy 	u32 utmi_otg_status;
9441b667b8SDan Murphy 
9541b667b8SDan Murphy 	u32 reserve_5[30];
9641b667b8SDan Murphy 
9741b667b8SDan Murphy 	u32 mram_offset; /* offset of 0x100 */
9841b667b8SDan Murphy 	u32 fladj;
9941b667b8SDan Murphy 	u32 dbg_config;
10041b667b8SDan Murphy 	u32 dbg_data;
10141b667b8SDan Murphy 	u32 dev_ebc_en;
10241b667b8SDan Murphy };
10341b667b8SDan Murphy 
10441b667b8SDan Murphy /* XHCI PHY register structure */
10541b667b8SDan Murphy struct omap_usb3_phy {
10641b667b8SDan Murphy 	u32 reserve1;
10741b667b8SDan Murphy 	u32 pll_status;
10841b667b8SDan Murphy 	u32 pll_go;
10941b667b8SDan Murphy 	u32 pll_config_1;
11041b667b8SDan Murphy 	u32 pll_config_2;
11141b667b8SDan Murphy 	u32 pll_config_3;
11241b667b8SDan Murphy 	u32 pll_ssc_config_1;
11341b667b8SDan Murphy 	u32 pll_ssc_config_2;
11441b667b8SDan Murphy 	u32 pll_config_4;
11541b667b8SDan Murphy };
11641b667b8SDan Murphy 
11741b667b8SDan Murphy struct omap_xhci {
11841b667b8SDan Murphy 	struct omap_dwc_wrapper *otg_wrapper;
11941b667b8SDan Murphy 	struct omap_usb3_phy *usb3_phy;
12041b667b8SDan Murphy 	struct xhci_hccr *hcd;
12141b667b8SDan Murphy 	struct dwc3 *dwc3_reg;
12241b667b8SDan Murphy };
12341b667b8SDan Murphy 
124*ba55453cSDan Murphy /* USB PHY functions */
125*ba55453cSDan Murphy void omap_enable_phy_clocks(struct omap_xhci *omap);
126*ba55453cSDan Murphy void omap_usb3_phy_init(struct omap_usb3_phy *phy_regs);
127*ba55453cSDan Murphy void omap_reset_usb_phy(struct dwc3 *dwc3_reg);
128*ba55453cSDan Murphy void usb3_phy_power(int on);
129*ba55453cSDan Murphy 
13041b667b8SDan Murphy #endif /* _ASM_ARCH_XHCI_OMAP_H_ */
131