1*682fe370SBharat Gooty /* 2*682fe370SBharat Gooty * Copyright (c) 2019 - 2021, Broadcom 3*682fe370SBharat Gooty * 4*682fe370SBharat Gooty * SPDX-License-Identifier: BSD-3-Clause 5*682fe370SBharat Gooty */ 6*682fe370SBharat Gooty 7*682fe370SBharat Gooty #ifndef SR_USB_H 8*682fe370SBharat Gooty #define SR_USB_H 9*682fe370SBharat Gooty 10*682fe370SBharat Gooty #define CDRU_PM_RESET_N_R BIT(CDRU_MISC_RESET_CONTROL__CDRU_PM_RESET_N_R) 11*682fe370SBharat Gooty #define CDRU_USBSS_RESET_N BIT(CDRU_MISC_RESET_CONTROL__CDRU_USBSS_RESET_N) 12*682fe370SBharat Gooty #define CDRU_MISC_CLK_USBSS \ 13*682fe370SBharat Gooty BIT(CDRU_MISC_CLK_ENABLE_CONTROL__CDRU_USBSS_CLK_EN_R) 14*682fe370SBharat Gooty 15*682fe370SBharat Gooty #define RESCAL_I_RSTB BIT(26) 16*682fe370SBharat Gooty #define RESCAL_I_PWRDNB BIT(27) 17*682fe370SBharat Gooty 18*682fe370SBharat Gooty #define DRDU3_U3PHY_CTRL 0x68500014 19*682fe370SBharat Gooty #define PHY_RESET BIT(1) 20*682fe370SBharat Gooty #define POR_RESET BIT(28) 21*682fe370SBharat Gooty #define MDIO_RESET BIT(29) 22*682fe370SBharat Gooty 23*682fe370SBharat Gooty #define DRDU3_PWR_CTRL 0x6850002c 24*682fe370SBharat Gooty #define POWER_CTRL_OVRD BIT(2) 25*682fe370SBharat Gooty 26*682fe370SBharat Gooty #define USB3H_U3PHY_CTRL 0x68510014 27*682fe370SBharat Gooty #define USB3H_U3SOFT_RST_N BIT(30) 28*682fe370SBharat Gooty 29*682fe370SBharat Gooty #define USB3H_PWR_CTRL 0x68510028 30*682fe370SBharat Gooty 31*682fe370SBharat Gooty #define USB3_PHY_MDIO_BLOCK_BASE_REG 0x1f 32*682fe370SBharat Gooty #define BDC_AXI_SOFT_RST_N_OFFSET 0 33*682fe370SBharat Gooty #define XHC_AXI_SOFT_RST_N_OFFSET 1 34*682fe370SBharat Gooty #define MDIO_BUS_ID 3 35*682fe370SBharat Gooty #define USB3H_PHY_ID 5 36*682fe370SBharat Gooty #define USB3DRD_PHY_ID 2 37*682fe370SBharat Gooty 38*682fe370SBharat Gooty #define USB3_PHY_RXPMD_BLOCK_BASE 0x8020 39*682fe370SBharat Gooty #define USB3_PHY_RXPMD_REG1 0x1 40*682fe370SBharat Gooty #define USB3_PHY_RXPMD_REG2 0x2 41*682fe370SBharat Gooty #define USB3_PHY_RXPMD_REG5 0x5 42*682fe370SBharat Gooty #define USB3_PHY_RXPMD_REG7 0x7 43*682fe370SBharat Gooty 44*682fe370SBharat Gooty #define USB3_PHY_TXPMD_BLOCK_BASE 0x8040 45*682fe370SBharat Gooty #define USB3_PHY_TXPMD_REG1 0x1 46*682fe370SBharat Gooty #define USB3_PHY_TXPMD_REG2 0x2 47*682fe370SBharat Gooty 48*682fe370SBharat Gooty #define USB3_PHY_ANA_BLOCK_BASE 0x8090 49*682fe370SBharat Gooty #define USB3_PHY_ANA_REG0 0x0 50*682fe370SBharat Gooty #define USB3_PHY_ANA_REG1 0x1 51*682fe370SBharat Gooty #define USB3_PHY_ANA_REG2 0x2 52*682fe370SBharat Gooty #define USB3_PHY_ANA_REG5 0x5 53*682fe370SBharat Gooty #define USB3_PHY_ANA_REG8 0x8 54*682fe370SBharat Gooty #define USB3_PHY_ANA_REG11 0xb 55*682fe370SBharat Gooty 56*682fe370SBharat Gooty #define USB3_PHY_AEQ_BLOCK_BASE 0x80e0 57*682fe370SBharat Gooty #define USB3_PHY_AEQ_REG1 0x1 58*682fe370SBharat Gooty #define USB3_PHY_AEQ_REG3 0x3 59*682fe370SBharat Gooty 60*682fe370SBharat Gooty #ifdef USB_DMA_COHERENT 61*682fe370SBharat Gooty #define DRDU3_U3XHC_SOFT_RST_N BIT(31) 62*682fe370SBharat Gooty #define DRDU3_U3BDC_SOFT_RST_N BIT(30) 63*682fe370SBharat Gooty 64*682fe370SBharat Gooty #define DRDU3_SOFT_RESET_CTRL 0x68500030 65*682fe370SBharat Gooty #define DRDU3_XHC_AXI_SOFT_RST_N BIT(1) 66*682fe370SBharat Gooty #define DRDU3_BDC_AXI_SOFT_RST_N BIT(0) 67*682fe370SBharat Gooty 68*682fe370SBharat Gooty #define DRDU2_PHY_CTRL 0x6852000c 69*682fe370SBharat Gooty #define DRDU2_U2SOFT_RST_N BIT(29) 70*682fe370SBharat Gooty 71*682fe370SBharat Gooty #define USB3H_SOFT_RESET_CTRL 0x6851002c 72*682fe370SBharat Gooty #define USB3H_XHC_AXI_SOFT_RST_N BIT(1) 73*682fe370SBharat Gooty 74*682fe370SBharat Gooty #define DRDU2_SOFT_RESET_CTRL 0x68520020 75*682fe370SBharat Gooty #define DRDU2_BDC_AXI_SOFT_RST_N BIT(0) 76*682fe370SBharat Gooty 77*682fe370SBharat Gooty #define DRD2U3H_XHC_REGS_AXIWRA 0x68511c08 78*682fe370SBharat Gooty #define DRD2U3H_XHC_REGS_AXIRDA 0x68511c0c 79*682fe370SBharat Gooty #define DRDU2D_BDC_REGS_AXIWRA 0x68521c08 80*682fe370SBharat Gooty #define DRDU2D_BDC_REGS_AXIRDA 0x68521c0c 81*682fe370SBharat Gooty #define DRDU3H_XHC_REGS_AXIWRA 0x68501c08 82*682fe370SBharat Gooty #define DRDU3H_XHC_REGS_AXIRDA 0x68501c0c 83*682fe370SBharat Gooty #define DRDU3D_BDC_REGS_AXIWRA 0x68502c08 84*682fe370SBharat Gooty #define DRDU3D_BDC_REGS_AXIRDA 0x68502c0c 85*682fe370SBharat Gooty /* cacheable write-back, allocate on both reads and writes */ 86*682fe370SBharat Gooty #define USBAXI_AWCACHE 0xf 87*682fe370SBharat Gooty #define USBAXI_ARCACHE 0xf 88*682fe370SBharat Gooty /* non-secure */ 89*682fe370SBharat Gooty #define USBAXI_AWPROT 0x8 90*682fe370SBharat Gooty #define USBAXI_ARPROT 0x8 91*682fe370SBharat Gooty #define USBAXIWR_SA_VAL ((USBAXI_AWCACHE << 4 | USBAXI_AWPROT) << 0) 92*682fe370SBharat Gooty #define USBAXIWR_SA_MASK ((0xf << 4 | 0xf) << 0) 93*682fe370SBharat Gooty #define USBAXIWR_UA_VAL ((USBAXI_AWCACHE << 4 | USBAXI_AWPROT) << 16) 94*682fe370SBharat Gooty #define USBAXIWR_UA_MASK ((0xf << 4 | 0xf) << 0) 95*682fe370SBharat Gooty #define USBAXIRD_SA_VAL ((USBAXI_ARCACHE << 4 | USBAXI_ARPROT) << 0) 96*682fe370SBharat Gooty #define USBAXIRD_SA_MASK ((0xf << 4 | 0xf) << 0) 97*682fe370SBharat Gooty #define USBAXIRD_UA_VAL ((USBAXI_ARCACHE << 4 | USBAXI_ARPROT) << 16) 98*682fe370SBharat Gooty #define USBAXIRD_UA_MASK ((0xf << 4 | 0xf) << 0) 99*682fe370SBharat Gooty #endif /* USB_DMA_COHERENT */ 100*682fe370SBharat Gooty 101*682fe370SBharat Gooty #define ICFG_DRDU3_SID_CTRL 0x6850001c 102*682fe370SBharat Gooty #define ICFG_USB3H_SID_CTRL 0x6851001c 103*682fe370SBharat Gooty #define ICFG_DRDU2_SID_CTRL 0x68520010 104*682fe370SBharat Gooty #define ICFG_USB_SID_SHIFT 5 105*682fe370SBharat Gooty #define ICFG_USB_SID_AWADDR_OFFSET 0x0 106*682fe370SBharat Gooty #define ICFG_USB_SID_ARADDR_OFFSET 0x4 107*682fe370SBharat Gooty 108*682fe370SBharat Gooty #define USBIC_GPV_BASE 0x68600000 109*682fe370SBharat Gooty #define USBIC_GPV_SECURITY0 (USBIC_GPV_BASE + 0x8) 110*682fe370SBharat Gooty #define USBIC_GPV_SECURITY0_FIELD BIT(0) 111*682fe370SBharat Gooty #define USBIC_GPV_SECURITY1 (USBIC_GPV_BASE + 0xc) 112*682fe370SBharat Gooty #define USBIC_GPV_SECURITY1_FIELD (BIT(0) | BIT(1)) 113*682fe370SBharat Gooty #define USBIC_GPV_SECURITY2 (USBIC_GPV_BASE + 0x10) 114*682fe370SBharat Gooty #define USBIC_GPV_SECURITY2_FIELD (BIT(0) | BIT(1)) 115*682fe370SBharat Gooty #define USBIC_GPV_SECURITY4 (USBIC_GPV_BASE + 0x18) 116*682fe370SBharat Gooty #define USBIC_GPV_SECURITY4_FIELD BIT(0) 117*682fe370SBharat Gooty #define USBIC_GPV_SECURITY10 (USBIC_GPV_BASE + 0x30) 118*682fe370SBharat Gooty #define USBIC_GPV_SECURITY10_FIELD (0x7 << 0) 119*682fe370SBharat Gooty 120*682fe370SBharat Gooty #define USBSS_TZPCDECPROT_BASE 0x68540800 121*682fe370SBharat Gooty #define USBSS_TZPCDECPROT0set (USBSS_TZPCDECPROT_BASE + 0x4) 122*682fe370SBharat Gooty #define USBSS_TZPCDECPROT0clr (USBSS_TZPCDECPROT_BASE + 0x8) 123*682fe370SBharat Gooty #define DECPROT0_USBSS_DRD2U3H BIT(3) 124*682fe370SBharat Gooty #define DECPROT0_USBSS_DRDU2H BIT(2) 125*682fe370SBharat Gooty #define DECPROT0_USBSS_DRDU3D BIT(1) 126*682fe370SBharat Gooty #define DECPROT0_USBSS_DRDU2D BIT(0) 127*682fe370SBharat Gooty #define USBSS_TZPCDECPROT0 \ 128*682fe370SBharat Gooty (DECPROT0_USBSS_DRD2U3H | \ 129*682fe370SBharat Gooty DECPROT0_USBSS_DRDU2H | \ 130*682fe370SBharat Gooty DECPROT0_USBSS_DRDU3D | \ 131*682fe370SBharat Gooty DECPROT0_USBSS_DRDU2D) 132*682fe370SBharat Gooty 133*682fe370SBharat Gooty int32_t usb_device_init(unsigned int); 134*682fe370SBharat Gooty 135*682fe370SBharat Gooty #endif /* SR_USB_H */ 136