Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2867c05d authored by Doug Anderson's avatar Doug Anderson Committed by Greg Kroah-Hartman
Browse files

usb: dwc2: Read GNPTXFSIZ when in forced HOST mode.



The documentation for GNPTXFSIZ says that "For host mode, this field
is always valid."  Since we're already switching to host mode for
HPTXFSIZ, let's also read GNPTXFSIZ in host mode.

On an rk3288 SoC, without this change we see this at bootup:
  dwc2 ff580000.usb: gnptxfsiz=00100400
  dwc2 ff580000.usb: 128 invalid for host_nperio_tx_fifo_size. Check HW configuration.

After this change we see:
  dwc2 ff580000.usb: gnptxfsiz=04000400

Signed-off-by: default avatarDoug Anderson <dianders@chromium.org>
Acked-by: default avatarPaul Zimmerman <paulz@synopsys.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 95083146
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -2674,23 +2674,23 @@ int dwc2_get_hwparams(struct dwc2_hsotg *hsotg)
	hwcfg2 = readl(hsotg->regs + GHWCFG2);
	hwcfg2 = readl(hsotg->regs + GHWCFG2);
	hwcfg3 = readl(hsotg->regs + GHWCFG3);
	hwcfg3 = readl(hsotg->regs + GHWCFG3);
	hwcfg4 = readl(hsotg->regs + GHWCFG4);
	hwcfg4 = readl(hsotg->regs + GHWCFG4);
	gnptxfsiz = readl(hsotg->regs + GNPTXFSIZ);
	grxfsiz = readl(hsotg->regs + GRXFSIZ);
	grxfsiz = readl(hsotg->regs + GRXFSIZ);


	dev_dbg(hsotg->dev, "hwcfg1=%08x\n", hwcfg1);
	dev_dbg(hsotg->dev, "hwcfg1=%08x\n", hwcfg1);
	dev_dbg(hsotg->dev, "hwcfg2=%08x\n", hwcfg2);
	dev_dbg(hsotg->dev, "hwcfg2=%08x\n", hwcfg2);
	dev_dbg(hsotg->dev, "hwcfg3=%08x\n", hwcfg3);
	dev_dbg(hsotg->dev, "hwcfg3=%08x\n", hwcfg3);
	dev_dbg(hsotg->dev, "hwcfg4=%08x\n", hwcfg4);
	dev_dbg(hsotg->dev, "hwcfg4=%08x\n", hwcfg4);
	dev_dbg(hsotg->dev, "gnptxfsiz=%08x\n", gnptxfsiz);
	dev_dbg(hsotg->dev, "grxfsiz=%08x\n", grxfsiz);
	dev_dbg(hsotg->dev, "grxfsiz=%08x\n", grxfsiz);


	/* Force host mode to get HPTXFSIZ exact power on value */
	/* Force host mode to get HPTXFSIZ / GNPTXFSIZ exact power on value */
	gusbcfg = readl(hsotg->regs + GUSBCFG);
	gusbcfg = readl(hsotg->regs + GUSBCFG);
	gusbcfg |= GUSBCFG_FORCEHOSTMODE;
	gusbcfg |= GUSBCFG_FORCEHOSTMODE;
	writel(gusbcfg, hsotg->regs + GUSBCFG);
	writel(gusbcfg, hsotg->regs + GUSBCFG);
	usleep_range(100000, 150000);
	usleep_range(100000, 150000);


	gnptxfsiz = readl(hsotg->regs + GNPTXFSIZ);
	hptxfsiz = readl(hsotg->regs + HPTXFSIZ);
	hptxfsiz = readl(hsotg->regs + HPTXFSIZ);
	dev_dbg(hsotg->dev, "gnptxfsiz=%08x\n", gnptxfsiz);
	dev_dbg(hsotg->dev, "hptxfsiz=%08x\n", hptxfsiz);
	dev_dbg(hsotg->dev, "hptxfsiz=%08x\n", hptxfsiz);
	gusbcfg = readl(hsotg->regs + GUSBCFG);
	gusbcfg = readl(hsotg->regs + GUSBCFG);
	gusbcfg &= ~GUSBCFG_FORCEHOSTMODE;
	gusbcfg &= ~GUSBCFG_FORCEHOSTMODE;