Lines Matching +full:keystone +full:- +full:dwc3

4  * (C) Copyright 2012-2014
7 * SPDX-License-Identifier: GPL-2.0+
15 #include <linux/usb/dwc3.h>
16 #include <asm/arch/xhci-keystone.h>
38 struct dwc3 *dwc3_reg;
44 struct keystone_xhci keystone; variable
55 val = readl(&phy->phy_clock); in keystone_xhci_phy_set()
58 writel(val, &phy->phy_clock); in keystone_xhci_phy_set()
66 val = readl(&phy->phy_clock); in keystone_xhci_phy_unset()
68 writel(val, &phy->phy_clock); in keystone_xhci_phy_unset()
71 static int keystone_xhci_core_init(struct dwc3 *dwc3_reg) in keystone_xhci_core_init()
78 return -EINVAL; in keystone_xhci_core_init()
81 /* We are hard-coding DWC3 core to Host Mode */ in keystone_xhci_core_init()
101 val = readl(&(phy->phy_clock)); in xhci_hcd_init()
103 writel(val, &phy->phy_clock); in xhci_hcd_init()
111 return -1; in xhci_hcd_init()
120 writel(1, &usbss->sysconfig); in xhci_hcd_init()
121 while (readl(&usbss->sysconfig) & 1) in xhci_hcd_init()
124 val = readl(&usbss->revision); in xhci_hcd_init()
129 keystone.dwc3_reg = (struct dwc3 *)(CONFIG_USB_HOST_XHCI_BASE + in xhci_hcd_init()
132 keystone_xhci_core_init(keystone.dwc3_reg); in xhci_hcd_init()
136 HC_LENGTH(readl(&hcd->cr_capbase))); in xhci_hcd_init()
138 debug("Keystone2-xhci: init hccr %08x and hcor %08x hc_length %d\n", in xhci_hcd_init()
140 (u32)HC_LENGTH(xhci_readl(&hcd->cr_capbase))); in xhci_hcd_init()
142 keystone.usbss = usbss; in xhci_hcd_init()
143 keystone.phy = phy; in xhci_hcd_init()
144 keystone.hcd = hcd; in xhci_hcd_init()
145 keystone.hcor = hcor; in xhci_hcd_init()
160 struct dwc3 *dwc3_reg = keystone.dwc3_reg; in keystone_xhci_phy_suspend()
163 hcor = keystone.hcor; in keystone_xhci_phy_suspend()
167 writel(val, &dwc3_reg->g_ctl); in keystone_xhci_phy_suspend()
170 val = readl(&dwc3_reg->g_usb2phycfg[0]); in keystone_xhci_phy_suspend()
174 writel(val, &dwc3_reg->g_usb2phycfg[0]); in keystone_xhci_phy_suspend()
177 val = readl(&dwc3_reg->g_usb3pipectl[0]); in keystone_xhci_phy_suspend()
184 writel(val, &dwc3_reg->g_usb3pipectl[0]); in keystone_xhci_phy_suspend()
189 * - Init DCFG[2:0] (DevSpd) to: 1=FS in keystone_xhci_phy_suspend()
190 * - Init GEVNTADR0 to point to an eventQ in keystone_xhci_phy_suspend()
191 * - Init GEVNTSIZ0 to 0x0100 to specify the size of the eventQ in keystone_xhci_phy_suspend()
192 * - Init DCTL::Run_nStop = 1 in keystone_xhci_phy_suspend()
194 writel(0x00020001, &dwc3_reg->d_cfg); in keystone_xhci_phy_suspend()
196 writel((u32)&event_q, &dwc3_reg->g_evnt_buf[0].g_evntadrlo); in keystone_xhci_phy_suspend()
197 writel(0, &dwc3_reg->g_evnt_buf[0].g_evntadrhi); in keystone_xhci_phy_suspend()
198 writel(0x4, &dwc3_reg->g_evnt_buf[0].g_evntsiz); in keystone_xhci_phy_suspend()
200 writel(DWC3_DCTL_RUN_STOP, &dwc3_reg->d_ctl); in keystone_xhci_phy_suspend()
205 portsc_1 = (uint32_t *)(&hcor->portregs[0].or_portsc); in keystone_xhci_phy_suspend()
206 portsc_2 = (uint32_t *)(&hcor->portregs[1].or_portsc); in keystone_xhci_phy_suspend()
216 debug("USB suspend failed - PLS USB2=%02x, USB3=%02x\n", in keystone_xhci_phy_suspend()
218 return -1; in keystone_xhci_phy_suspend()
221 debug("USB2 and USB3 PLS - Disabled, loop_cnt=%d\n", loop_cnt); in keystone_xhci_phy_suspend()
237 keystone_xhci_phy_unset(keystone.phy); in xhci_hcd_stop()
239 /* memset(&keystone, 0, sizeof(struct keystone_xhci)); */ in xhci_hcd_stop()