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