mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
usb: dwc3: Add dwc pointer to dwc3_readl/writel
Use dwc pointer in dwc3_readl() dwc3_writel() instead of passing the dwc->regs. This would help us access the dwc structure and log the base address in traces. There's no functional changes in this patch, just refactoring existing APIs. Signed-off-by: Prashanth K <prashanth.k@oss.qualcomm.com> Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com> Link: https://patch.msgid.link/20260114100748.2950103-3-prashanth.k@oss.qualcomm.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
abdd1eef04
commit
9accc68b1c
+97
-97
File diff suppressed because it is too large
Load Diff
+16
-16
@@ -296,14 +296,14 @@ static void dwc3_host_lsp(struct seq_file *s)
|
||||
|
||||
reg = DWC3_GDBGLSPMUX_HOSTSELECT(sel);
|
||||
|
||||
dwc3_writel(dwc->regs, DWC3_GDBGLSPMUX, reg);
|
||||
val = dwc3_readl(dwc->regs, DWC3_GDBGLSP);
|
||||
dwc3_writel(dwc, DWC3_GDBGLSPMUX, reg);
|
||||
val = dwc3_readl(dwc, DWC3_GDBGLSP);
|
||||
seq_printf(s, "GDBGLSP[%d] = 0x%08x\n", sel, val);
|
||||
|
||||
if (dbc_enabled && sel < 256) {
|
||||
reg |= DWC3_GDBGLSPMUX_ENDBC;
|
||||
dwc3_writel(dwc->regs, DWC3_GDBGLSPMUX, reg);
|
||||
val = dwc3_readl(dwc->regs, DWC3_GDBGLSP);
|
||||
dwc3_writel(dwc, DWC3_GDBGLSPMUX, reg);
|
||||
val = dwc3_readl(dwc, DWC3_GDBGLSP);
|
||||
seq_printf(s, "GDBGLSP_DBC[%d] = 0x%08x\n", sel, val);
|
||||
}
|
||||
}
|
||||
@@ -316,8 +316,8 @@ static void dwc3_gadget_lsp(struct seq_file *s)
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
reg = DWC3_GDBGLSPMUX_DEVSELECT(i);
|
||||
dwc3_writel(dwc->regs, DWC3_GDBGLSPMUX, reg);
|
||||
reg = dwc3_readl(dwc->regs, DWC3_GDBGLSP);
|
||||
dwc3_writel(dwc, DWC3_GDBGLSPMUX, reg);
|
||||
reg = dwc3_readl(dwc, DWC3_GDBGLSP);
|
||||
seq_printf(s, "GDBGLSP[%d] = 0x%08x\n", i, reg);
|
||||
}
|
||||
}
|
||||
@@ -335,7 +335,7 @@ static int dwc3_lsp_show(struct seq_file *s, void *unused)
|
||||
return ret;
|
||||
|
||||
spin_lock_irqsave(&dwc->lock, flags);
|
||||
reg = dwc3_readl(dwc->regs, DWC3_GSTS);
|
||||
reg = dwc3_readl(dwc, DWC3_GSTS);
|
||||
current_mode = DWC3_GSTS_CURMOD(reg);
|
||||
|
||||
switch (current_mode) {
|
||||
@@ -406,7 +406,7 @@ static int dwc3_mode_show(struct seq_file *s, void *unused)
|
||||
return ret;
|
||||
|
||||
spin_lock_irqsave(&dwc->lock, flags);
|
||||
reg = dwc3_readl(dwc->regs, DWC3_GCTL);
|
||||
reg = dwc3_readl(dwc, DWC3_GCTL);
|
||||
spin_unlock_irqrestore(&dwc->lock, flags);
|
||||
|
||||
mode = DWC3_GCTL_PRTCAP(reg);
|
||||
@@ -478,7 +478,7 @@ static int dwc3_testmode_show(struct seq_file *s, void *unused)
|
||||
return ret;
|
||||
|
||||
spin_lock_irqsave(&dwc->lock, flags);
|
||||
reg = dwc3_readl(dwc->regs, DWC3_DCTL);
|
||||
reg = dwc3_readl(dwc, DWC3_DCTL);
|
||||
reg &= DWC3_DCTL_TSTCTRL_MASK;
|
||||
reg >>= 1;
|
||||
spin_unlock_irqrestore(&dwc->lock, flags);
|
||||
@@ -577,7 +577,7 @@ static int dwc3_link_state_show(struct seq_file *s, void *unused)
|
||||
return ret;
|
||||
|
||||
spin_lock_irqsave(&dwc->lock, flags);
|
||||
reg = dwc3_readl(dwc->regs, DWC3_GSTS);
|
||||
reg = dwc3_readl(dwc, DWC3_GSTS);
|
||||
if (DWC3_GSTS_CURMOD(reg) != DWC3_GSTS_CURMOD_DEVICE) {
|
||||
seq_puts(s, "Not available\n");
|
||||
spin_unlock_irqrestore(&dwc->lock, flags);
|
||||
@@ -585,7 +585,7 @@ static int dwc3_link_state_show(struct seq_file *s, void *unused)
|
||||
return 0;
|
||||
}
|
||||
|
||||
reg = dwc3_readl(dwc->regs, DWC3_DSTS);
|
||||
reg = dwc3_readl(dwc, DWC3_DSTS);
|
||||
state = DWC3_DSTS_USBLNKST(reg);
|
||||
speed = reg & DWC3_DSTS_CONNECTSPD;
|
||||
|
||||
@@ -639,14 +639,14 @@ static ssize_t dwc3_link_state_write(struct file *file,
|
||||
return ret;
|
||||
|
||||
spin_lock_irqsave(&dwc->lock, flags);
|
||||
reg = dwc3_readl(dwc->regs, DWC3_GSTS);
|
||||
reg = dwc3_readl(dwc, DWC3_GSTS);
|
||||
if (DWC3_GSTS_CURMOD(reg) != DWC3_GSTS_CURMOD_DEVICE) {
|
||||
spin_unlock_irqrestore(&dwc->lock, flags);
|
||||
pm_runtime_put_sync(dwc->dev);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
reg = dwc3_readl(dwc->regs, DWC3_DSTS);
|
||||
reg = dwc3_readl(dwc, DWC3_DSTS);
|
||||
speed = reg & DWC3_DSTS_CONNECTSPD;
|
||||
|
||||
if (speed < DWC3_DSTS_SUPERSPEED &&
|
||||
@@ -942,10 +942,10 @@ static int dwc3_ep_info_register_show(struct seq_file *s, void *unused)
|
||||
|
||||
spin_lock_irqsave(&dwc->lock, flags);
|
||||
reg = DWC3_GDBGLSPMUX_EPSELECT(dep->number);
|
||||
dwc3_writel(dwc->regs, DWC3_GDBGLSPMUX, reg);
|
||||
dwc3_writel(dwc, DWC3_GDBGLSPMUX, reg);
|
||||
|
||||
lower_32_bits = dwc3_readl(dwc->regs, DWC3_GDBGEPINFO0);
|
||||
upper_32_bits = dwc3_readl(dwc->regs, DWC3_GDBGEPINFO1);
|
||||
lower_32_bits = dwc3_readl(dwc, DWC3_GDBGEPINFO0);
|
||||
upper_32_bits = dwc3_readl(dwc, DWC3_GDBGEPINFO1);
|
||||
|
||||
ep_info = ((u64)upper_32_bits << 32) | lower_32_bits;
|
||||
seq_printf(s, "0x%016llx\n", ep_info);
|
||||
|
||||
+38
-38
@@ -18,25 +18,25 @@
|
||||
|
||||
static void dwc3_otg_disable_events(struct dwc3 *dwc, u32 disable_mask)
|
||||
{
|
||||
u32 reg = dwc3_readl(dwc->regs, DWC3_OEVTEN);
|
||||
u32 reg = dwc3_readl(dwc, DWC3_OEVTEN);
|
||||
|
||||
reg &= ~(disable_mask);
|
||||
dwc3_writel(dwc->regs, DWC3_OEVTEN, reg);
|
||||
dwc3_writel(dwc, DWC3_OEVTEN, reg);
|
||||
}
|
||||
|
||||
static void dwc3_otg_enable_events(struct dwc3 *dwc, u32 enable_mask)
|
||||
{
|
||||
u32 reg = dwc3_readl(dwc->regs, DWC3_OEVTEN);
|
||||
u32 reg = dwc3_readl(dwc, DWC3_OEVTEN);
|
||||
|
||||
reg |= (enable_mask);
|
||||
dwc3_writel(dwc->regs, DWC3_OEVTEN, reg);
|
||||
dwc3_writel(dwc, DWC3_OEVTEN, reg);
|
||||
}
|
||||
|
||||
static void dwc3_otg_clear_events(struct dwc3 *dwc)
|
||||
{
|
||||
u32 reg = dwc3_readl(dwc->regs, DWC3_OEVT);
|
||||
u32 reg = dwc3_readl(dwc, DWC3_OEVT);
|
||||
|
||||
dwc3_writel(dwc->regs, DWC3_OEVTEN, reg);
|
||||
dwc3_writel(dwc, DWC3_OEVTEN, reg);
|
||||
}
|
||||
|
||||
#define DWC3_OTG_ALL_EVENTS (DWC3_OEVTEN_XHCIRUNSTPSETEN | \
|
||||
@@ -72,18 +72,18 @@ static irqreturn_t dwc3_otg_irq(int irq, void *_dwc)
|
||||
struct dwc3 *dwc = _dwc;
|
||||
irqreturn_t ret = IRQ_NONE;
|
||||
|
||||
reg = dwc3_readl(dwc->regs, DWC3_OEVT);
|
||||
reg = dwc3_readl(dwc, DWC3_OEVT);
|
||||
if (reg) {
|
||||
/* ignore non OTG events, we can't disable them in OEVTEN */
|
||||
if (!(reg & DWC3_OTG_ALL_EVENTS)) {
|
||||
dwc3_writel(dwc->regs, DWC3_OEVT, reg);
|
||||
dwc3_writel(dwc, DWC3_OEVT, reg);
|
||||
return IRQ_NONE;
|
||||
}
|
||||
|
||||
if (dwc->current_otg_role == DWC3_OTG_ROLE_HOST &&
|
||||
!(reg & DWC3_OEVT_DEVICEMODE))
|
||||
dwc->otg_restart_host = true;
|
||||
dwc3_writel(dwc->regs, DWC3_OEVT, reg);
|
||||
dwc3_writel(dwc, DWC3_OEVT, reg);
|
||||
ret = IRQ_WAKE_THREAD;
|
||||
}
|
||||
|
||||
@@ -100,23 +100,23 @@ static void dwc3_otgregs_init(struct dwc3 *dwc)
|
||||
* the signal outputs sent to the PHY, the OTG FSM logic of the
|
||||
* core and also the resets to the VBUS filters inside the core.
|
||||
*/
|
||||
reg = dwc3_readl(dwc->regs, DWC3_OCFG);
|
||||
reg = dwc3_readl(dwc, DWC3_OCFG);
|
||||
reg |= DWC3_OCFG_SFTRSTMASK;
|
||||
dwc3_writel(dwc->regs, DWC3_OCFG, reg);
|
||||
dwc3_writel(dwc, DWC3_OCFG, reg);
|
||||
|
||||
/* Disable hibernation for simplicity */
|
||||
reg = dwc3_readl(dwc->regs, DWC3_GCTL);
|
||||
reg = dwc3_readl(dwc, DWC3_GCTL);
|
||||
reg &= ~DWC3_GCTL_GBLHIBERNATIONEN;
|
||||
dwc3_writel(dwc->regs, DWC3_GCTL, reg);
|
||||
dwc3_writel(dwc, DWC3_GCTL, reg);
|
||||
|
||||
/*
|
||||
* Initialize OTG registers as per
|
||||
* Figure 11-4 OTG Driver Overall Programming Flow
|
||||
*/
|
||||
/* OCFG.SRPCap = 0, OCFG.HNPCap = 0 */
|
||||
reg = dwc3_readl(dwc->regs, DWC3_OCFG);
|
||||
reg = dwc3_readl(dwc, DWC3_OCFG);
|
||||
reg &= ~(DWC3_OCFG_SRPCAP | DWC3_OCFG_HNPCAP);
|
||||
dwc3_writel(dwc->regs, DWC3_OCFG, reg);
|
||||
dwc3_writel(dwc, DWC3_OCFG, reg);
|
||||
/* OEVT = FFFF */
|
||||
dwc3_otg_clear_events(dwc);
|
||||
/* OEVTEN = 0 */
|
||||
@@ -127,11 +127,11 @@ static void dwc3_otgregs_init(struct dwc3 *dwc)
|
||||
* OCTL.PeriMode = 1, OCTL.DevSetHNPEn = 0, OCTL.HstSetHNPEn = 0,
|
||||
* OCTL.HNPReq = 0
|
||||
*/
|
||||
reg = dwc3_readl(dwc->regs, DWC3_OCTL);
|
||||
reg = dwc3_readl(dwc, DWC3_OCTL);
|
||||
reg |= DWC3_OCTL_PERIMODE;
|
||||
reg &= ~(DWC3_OCTL_DEVSETHNPEN | DWC3_OCTL_HSTSETHNPEN |
|
||||
DWC3_OCTL_HNPREQ);
|
||||
dwc3_writel(dwc->regs, DWC3_OCTL, reg);
|
||||
dwc3_writel(dwc, DWC3_OCTL, reg);
|
||||
}
|
||||
|
||||
static int dwc3_otg_get_irq(struct dwc3 *dwc)
|
||||
@@ -175,9 +175,9 @@ void dwc3_otg_init(struct dwc3 *dwc)
|
||||
/* GCTL.PrtCapDir=2'b11 */
|
||||
dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_OTG, true);
|
||||
/* GUSB2PHYCFG0.SusPHY=0 */
|
||||
reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
|
||||
reg = dwc3_readl(dwc, DWC3_GUSB2PHYCFG(0));
|
||||
reg &= ~DWC3_GUSB2PHYCFG_SUSPHY;
|
||||
dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
|
||||
dwc3_writel(dwc, DWC3_GUSB2PHYCFG(0), reg);
|
||||
|
||||
/* Initialize OTG registers */
|
||||
dwc3_otgregs_init(dwc);
|
||||
@@ -203,17 +203,17 @@ void dwc3_otg_host_init(struct dwc3 *dwc)
|
||||
* OCTL.PeriMode=0, OCTL.TermSelDLPulse = 0,
|
||||
* OCTL.DevSetHNPEn = 0, OCTL.HstSetHNPEn = 0
|
||||
*/
|
||||
reg = dwc3_readl(dwc->regs, DWC3_OCTL);
|
||||
reg = dwc3_readl(dwc, DWC3_OCTL);
|
||||
reg &= ~(DWC3_OCTL_PERIMODE | DWC3_OCTL_TERMSELIDPULSE |
|
||||
DWC3_OCTL_DEVSETHNPEN | DWC3_OCTL_HSTSETHNPEN);
|
||||
dwc3_writel(dwc->regs, DWC3_OCTL, reg);
|
||||
dwc3_writel(dwc, DWC3_OCTL, reg);
|
||||
|
||||
/*
|
||||
* OCFG.DisPrtPwrCutoff = 0/1
|
||||
*/
|
||||
reg = dwc3_readl(dwc->regs, DWC3_OCFG);
|
||||
reg = dwc3_readl(dwc, DWC3_OCFG);
|
||||
reg &= ~DWC3_OCFG_DISPWRCUTTOFF;
|
||||
dwc3_writel(dwc->regs, DWC3_OCFG, reg);
|
||||
dwc3_writel(dwc, DWC3_OCFG, reg);
|
||||
|
||||
/*
|
||||
* OCFG.SRPCap = 1, OCFG.HNPCap = GHWPARAMS6.HNP_CAP
|
||||
@@ -229,15 +229,15 @@ void dwc3_otg_host_init(struct dwc3 *dwc)
|
||||
|
||||
/* GUSB2PHYCFG.ULPIAutoRes = 1/0, GUSB2PHYCFG.SusPHY = 1 */
|
||||
if (!dwc->dis_u2_susphy_quirk) {
|
||||
reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
|
||||
reg = dwc3_readl(dwc, DWC3_GUSB2PHYCFG(0));
|
||||
reg |= DWC3_GUSB2PHYCFG_SUSPHY;
|
||||
dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
|
||||
dwc3_writel(dwc, DWC3_GUSB2PHYCFG(0), reg);
|
||||
}
|
||||
|
||||
/* Set Port Power to enable VBUS: OCTL.PrtPwrCtl = 1 */
|
||||
reg = dwc3_readl(dwc->regs, DWC3_OCTL);
|
||||
reg = dwc3_readl(dwc, DWC3_OCTL);
|
||||
reg |= DWC3_OCTL_PRTPWRCTL;
|
||||
dwc3_writel(dwc->regs, DWC3_OCTL, reg);
|
||||
dwc3_writel(dwc, DWC3_OCTL, reg);
|
||||
}
|
||||
|
||||
/* should be called after Host controller driver is stopped */
|
||||
@@ -258,9 +258,9 @@ static void dwc3_otg_host_exit(struct dwc3 *dwc)
|
||||
*/
|
||||
|
||||
/* OCTL.HstSetHNPEn = 0, OCTL.PrtPwrCtl=0 */
|
||||
reg = dwc3_readl(dwc->regs, DWC3_OCTL);
|
||||
reg = dwc3_readl(dwc, DWC3_OCTL);
|
||||
reg &= ~(DWC3_OCTL_HSTSETHNPEN | DWC3_OCTL_PRTPWRCTL);
|
||||
dwc3_writel(dwc->regs, DWC3_OCTL, reg);
|
||||
dwc3_writel(dwc, DWC3_OCTL, reg);
|
||||
}
|
||||
|
||||
/* should be called before the gadget controller driver is started */
|
||||
@@ -274,27 +274,27 @@ static void dwc3_otg_device_init(struct dwc3 *dwc)
|
||||
* OCFG.HNPCap = GHWPARAMS6.HNP_CAP, OCFG.SRPCap = 1
|
||||
* but we keep them 0 for simple dual-role operation.
|
||||
*/
|
||||
reg = dwc3_readl(dwc->regs, DWC3_OCFG);
|
||||
reg = dwc3_readl(dwc, DWC3_OCFG);
|
||||
/* OCFG.OTGSftRstMsk = 0/1 */
|
||||
reg |= DWC3_OCFG_SFTRSTMASK;
|
||||
dwc3_writel(dwc->regs, DWC3_OCFG, reg);
|
||||
dwc3_writel(dwc, DWC3_OCFG, reg);
|
||||
/*
|
||||
* OCTL.PeriMode = 1
|
||||
* OCTL.TermSelDLPulse = 0/1, OCTL.HNPReq = 0
|
||||
* OCTL.DevSetHNPEn = 0, OCTL.HstSetHNPEn = 0
|
||||
*/
|
||||
reg = dwc3_readl(dwc->regs, DWC3_OCTL);
|
||||
reg = dwc3_readl(dwc, DWC3_OCTL);
|
||||
reg |= DWC3_OCTL_PERIMODE;
|
||||
reg &= ~(DWC3_OCTL_TERMSELIDPULSE | DWC3_OCTL_HNPREQ |
|
||||
DWC3_OCTL_DEVSETHNPEN | DWC3_OCTL_HSTSETHNPEN);
|
||||
dwc3_writel(dwc->regs, DWC3_OCTL, reg);
|
||||
dwc3_writel(dwc, DWC3_OCTL, reg);
|
||||
/* OEVTEN.OTGBDevSesVldDetEvntEn = 1 */
|
||||
dwc3_otg_enable_events(dwc, DWC3_OEVTEN_BDEVSESSVLDDETEN);
|
||||
/* GUSB2PHYCFG.ULPIAutoRes = 0, GUSB2PHYCFG0.SusPHY = 1 */
|
||||
if (!dwc->dis_u2_susphy_quirk) {
|
||||
reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
|
||||
reg = dwc3_readl(dwc, DWC3_GUSB2PHYCFG(0));
|
||||
reg |= DWC3_GUSB2PHYCFG_SUSPHY;
|
||||
dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
|
||||
dwc3_writel(dwc, DWC3_GUSB2PHYCFG(0), reg);
|
||||
}
|
||||
/* GCTL.GblHibernationEn = 0. Already 0. */
|
||||
}
|
||||
@@ -319,10 +319,10 @@ static void dwc3_otg_device_exit(struct dwc3 *dwc)
|
||||
DWC3_OEVTEN_BDEVBHOSTENDEN);
|
||||
|
||||
/* OCTL.DevSetHNPEn = 0, OCTL.HNPReq = 0, OCTL.PeriMode=1 */
|
||||
reg = dwc3_readl(dwc->regs, DWC3_OCTL);
|
||||
reg = dwc3_readl(dwc, DWC3_OCTL);
|
||||
reg &= ~(DWC3_OCTL_DEVSETHNPEN | DWC3_OCTL_HNPREQ);
|
||||
reg |= DWC3_OCTL_PERIMODE;
|
||||
dwc3_writel(dwc->regs, DWC3_OCTL, reg);
|
||||
dwc3_writel(dwc, DWC3_OCTL, reg);
|
||||
}
|
||||
|
||||
void dwc3_otg_update(struct dwc3 *dwc, bool ignore_idstatus)
|
||||
@@ -341,7 +341,7 @@ void dwc3_otg_update(struct dwc3 *dwc, bool ignore_idstatus)
|
||||
return;
|
||||
|
||||
if (!ignore_idstatus) {
|
||||
reg = dwc3_readl(dwc->regs, DWC3_OSTS);
|
||||
reg = dwc3_readl(dwc, DWC3_OSTS);
|
||||
id = !!(reg & DWC3_OSTS_CONIDSTS);
|
||||
|
||||
dwc->desired_otg_role = id ? DWC3_OTG_ROLE_DEVICE :
|
||||
|
||||
+10
-10
@@ -361,7 +361,7 @@ static int dwc3_ep0_handle_status(struct dwc3 *dwc,
|
||||
|
||||
if ((dwc->speed == DWC3_DSTS_SUPERSPEED) ||
|
||||
(dwc->speed == DWC3_DSTS_SUPERSPEED_PLUS)) {
|
||||
reg = dwc3_readl(dwc->regs, DWC3_DCTL);
|
||||
reg = dwc3_readl(dwc, DWC3_DCTL);
|
||||
if (reg & DWC3_DCTL_INITU1ENA)
|
||||
usb_status |= 1 << USB_DEV_STAT_U1_ENABLED;
|
||||
if (reg & DWC3_DCTL_INITU2ENA)
|
||||
@@ -417,12 +417,12 @@ static int dwc3_ep0_handle_u1(struct dwc3 *dwc, enum usb_device_state state,
|
||||
if (set && dwc->dis_u1_entry_quirk)
|
||||
return -EINVAL;
|
||||
|
||||
reg = dwc3_readl(dwc->regs, DWC3_DCTL);
|
||||
reg = dwc3_readl(dwc, DWC3_DCTL);
|
||||
if (set)
|
||||
reg |= DWC3_DCTL_INITU1ENA;
|
||||
else
|
||||
reg &= ~DWC3_DCTL_INITU1ENA;
|
||||
dwc3_writel(dwc->regs, DWC3_DCTL, reg);
|
||||
dwc3_writel(dwc, DWC3_DCTL, reg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -441,12 +441,12 @@ static int dwc3_ep0_handle_u2(struct dwc3 *dwc, enum usb_device_state state,
|
||||
if (set && dwc->dis_u2_entry_quirk)
|
||||
return -EINVAL;
|
||||
|
||||
reg = dwc3_readl(dwc->regs, DWC3_DCTL);
|
||||
reg = dwc3_readl(dwc, DWC3_DCTL);
|
||||
if (set)
|
||||
reg |= DWC3_DCTL_INITU2ENA;
|
||||
else
|
||||
reg &= ~DWC3_DCTL_INITU2ENA;
|
||||
dwc3_writel(dwc->regs, DWC3_DCTL, reg);
|
||||
dwc3_writel(dwc, DWC3_DCTL, reg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -612,10 +612,10 @@ static int dwc3_ep0_set_address(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
reg = dwc3_readl(dwc->regs, DWC3_DCFG);
|
||||
reg = dwc3_readl(dwc, DWC3_DCFG);
|
||||
reg &= ~(DWC3_DCFG_DEVADDR_MASK);
|
||||
reg |= DWC3_DCFG_DEVADDR(addr);
|
||||
dwc3_writel(dwc->regs, DWC3_DCFG, reg);
|
||||
dwc3_writel(dwc, DWC3_DCFG, reg);
|
||||
|
||||
if (addr)
|
||||
usb_gadget_set_state(dwc->gadget, USB_STATE_ADDRESS);
|
||||
@@ -672,12 +672,12 @@ static int dwc3_ep0_set_config(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl)
|
||||
* Enable transition to U1/U2 state when
|
||||
* nothing is pending from application.
|
||||
*/
|
||||
reg = dwc3_readl(dwc->regs, DWC3_DCTL);
|
||||
reg = dwc3_readl(dwc, DWC3_DCTL);
|
||||
if (!dwc->dis_u1_entry_quirk)
|
||||
reg |= DWC3_DCTL_ACCEPTU1ENA;
|
||||
if (!dwc->dis_u2_entry_quirk)
|
||||
reg |= DWC3_DCTL_ACCEPTU2ENA;
|
||||
dwc3_writel(dwc->regs, DWC3_DCTL, reg);
|
||||
dwc3_writel(dwc, DWC3_DCTL, reg);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -717,7 +717,7 @@ static void dwc3_ep0_set_sel_cmpl(struct usb_ep *ep, struct usb_request *req)
|
||||
dwc->u2sel = le16_to_cpu(timing.u2sel);
|
||||
dwc->u2pel = le16_to_cpu(timing.u2pel);
|
||||
|
||||
reg = dwc3_readl(dwc->regs, DWC3_DCTL);
|
||||
reg = dwc3_readl(dwc, DWC3_DCTL);
|
||||
if (reg & DWC3_DCTL_INITU2ENA)
|
||||
param = dwc->u2pel;
|
||||
if (reg & DWC3_DCTL_INITU1ENA)
|
||||
|
||||
+80
-80
File diff suppressed because it is too large
Load Diff
@@ -132,7 +132,7 @@ static inline void dwc3_gadget_ep_get_transfer_index(struct dwc3_ep *dep)
|
||||
{
|
||||
u32 res_id;
|
||||
|
||||
res_id = dwc3_readl(dep->dwc->regs, DWC3_DEPCMD(dep->number));
|
||||
res_id = dwc3_readl(dep->dwc, DWC3_DEPCMD(dep->number));
|
||||
dep->resource_index = DWC3_DEPCMD_GET_RSC_IDX(res_id);
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ static inline void dwc3_gadget_ep_get_transfer_index(struct dwc3_ep *dep)
|
||||
static inline void dwc3_gadget_dctl_write_safe(struct dwc3 *dwc, u32 value)
|
||||
{
|
||||
value &= ~DWC3_DCTL_ULSTCHNGREQ_MASK;
|
||||
dwc3_writel(dwc->regs, DWC3_DCTL, value);
|
||||
dwc3_writel(dwc, DWC3_DCTL, value);
|
||||
}
|
||||
|
||||
#endif /* __DRIVERS_USB_DWC3_GADGET_H */
|
||||
|
||||
@@ -16,9 +16,10 @@
|
||||
#include "debug.h"
|
||||
#include "core.h"
|
||||
|
||||
static inline u32 dwc3_readl(void __iomem *base, u32 offset)
|
||||
static inline u32 dwc3_readl(struct dwc3 *dwc, u32 offset)
|
||||
{
|
||||
u32 value;
|
||||
void __iomem *base = dwc->regs;
|
||||
|
||||
/*
|
||||
* We requested the mem region starting from the Globals address
|
||||
@@ -37,8 +38,10 @@ static inline u32 dwc3_readl(void __iomem *base, u32 offset)
|
||||
return value;
|
||||
}
|
||||
|
||||
static inline void dwc3_writel(void __iomem *base, u32 offset, u32 value)
|
||||
static inline void dwc3_writel(struct dwc3 *dwc, u32 offset, u32 value)
|
||||
{
|
||||
void __iomem *base = dwc->regs;
|
||||
|
||||
/*
|
||||
* We requested the mem region starting from the Globals address
|
||||
* space, see dwc3_probe in core.c.
|
||||
|
||||
@@ -33,13 +33,13 @@ static int dwc3_ulpi_busyloop(struct dwc3 *dwc, u8 addr, bool read)
|
||||
if (read)
|
||||
ns += DWC3_ULPI_BASE_DELAY;
|
||||
|
||||
reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
|
||||
reg = dwc3_readl(dwc, DWC3_GUSB2PHYCFG(0));
|
||||
if (reg & DWC3_GUSB2PHYCFG_SUSPHY)
|
||||
usleep_range(1000, 1200);
|
||||
|
||||
while (count--) {
|
||||
ndelay(ns);
|
||||
reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYACC(0));
|
||||
reg = dwc3_readl(dwc, DWC3_GUSB2PHYACC(0));
|
||||
if (reg & DWC3_GUSB2PHYACC_DONE)
|
||||
return 0;
|
||||
cpu_relax();
|
||||
@@ -55,13 +55,13 @@ static int dwc3_ulpi_read(struct device *dev, u8 addr)
|
||||
int ret;
|
||||
|
||||
reg = DWC3_GUSB2PHYACC_NEWREGREQ | DWC3_ULPI_ADDR(addr);
|
||||
dwc3_writel(dwc->regs, DWC3_GUSB2PHYACC(0), reg);
|
||||
dwc3_writel(dwc, DWC3_GUSB2PHYACC(0), reg);
|
||||
|
||||
ret = dwc3_ulpi_busyloop(dwc, addr, true);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYACC(0));
|
||||
reg = dwc3_readl(dwc, DWC3_GUSB2PHYACC(0));
|
||||
|
||||
return DWC3_GUSB2PHYACC_DATA(reg);
|
||||
}
|
||||
@@ -73,7 +73,7 @@ static int dwc3_ulpi_write(struct device *dev, u8 addr, u8 val)
|
||||
|
||||
reg = DWC3_GUSB2PHYACC_NEWREGREQ | DWC3_ULPI_ADDR(addr);
|
||||
reg |= DWC3_GUSB2PHYACC_WRITE | val;
|
||||
dwc3_writel(dwc->regs, DWC3_GUSB2PHYACC(0), reg);
|
||||
dwc3_writel(dwc, DWC3_GUSB2PHYACC(0), reg);
|
||||
|
||||
return dwc3_ulpi_busyloop(dwc, addr, false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user