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

Commit c497f8d1 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull USB fixes from Greg KH:
 "Here are a few small USB fixes for 4.10-rc5.

  Most of these are gadget/dwc2 fixes for reported issues, all of these
  have been in linux-next for a while. The last one is a single xhci
  WARN_ON removal to handle an issue that the dwc3 driver is hitting in
  the 4.10-rc tree. The warning is harmless and needs to be removed, and
  a "real" fix that is more complex will show up in 4.11-rc1 for this
  device.

  That last patch hasn't been in linux-next yet due to the weekend
  timing, but it's a "simple" WARN_ON() removal so what could go wrong?
  :)"

Famous last words.

* tag 'usb-4.10-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
  xhci: remove WARN_ON if dma mask is not set for platform devices
  usb: dwc2: host: fix Wmaybe-uninitialized warning
  usb: dwc2: gadget: Fix GUSBCFG.USBTRDTIM value
  usb: gadget: udc: atmel: remove memory leak
  usb: dwc3: exynos fix axius clock error path to do cleanup
  usb: dwc2: Avoid suspending if we're in gadget mode
  usb: dwc2: use u32 for DT binding parameters
  usb: gadget: f_fs: Fix iterations on endpoints.
  usb: dwc2: gadget: Fix DMA memory freeing
  usb: gadget: composite: Fix function used to free memory
parents f68d8531 488dc164
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -513,8 +513,8 @@ struct dwc2_core_params {
	/* Gadget parameters */
	bool g_dma;
	bool g_dma_desc;
	u16 g_rx_fifo_size;
	u16 g_np_tx_fifo_size;
	u32 g_rx_fifo_size;
	u32 g_np_tx_fifo_size;
	u32 g_tx_fifo_size[MAX_EPS_CHANNELS];
};

+5 −13
Original line number Diff line number Diff line
@@ -3169,7 +3169,7 @@ void dwc2_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg,
	/* keep other bits untouched (so e.g. forced modes are not lost) */
	usbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
	usbcfg &= ~(GUSBCFG_TOUTCAL_MASK | GUSBCFG_PHYIF16 | GUSBCFG_SRPCAP |
		GUSBCFG_HNPCAP);
		GUSBCFG_HNPCAP | GUSBCFG_USBTRDTIM_MASK);

	if (hsotg->params.phy_type == DWC2_PHY_TYPE_PARAM_FS &&
	    (hsotg->params.speed == DWC2_SPEED_PARAM_FULL ||
@@ -3749,8 +3749,8 @@ static int dwc2_hsotg_ep_enable(struct usb_ep *ep,
		__func__, epctrl, epctrl_reg);

	/* Allocate DMA descriptor chain for non-ctrl endpoints */
	if (using_desc_dma(hsotg)) {
		hs_ep->desc_list = dma_alloc_coherent(hsotg->dev,
	if (using_desc_dma(hsotg) && !hs_ep->desc_list) {
		hs_ep->desc_list = dmam_alloc_coherent(hsotg->dev,
			MAX_DMA_DESC_NUM_GENERIC *
			sizeof(struct dwc2_dma_desc),
			&hs_ep->desc_list_dma, GFP_ATOMIC);
@@ -3872,7 +3872,7 @@ static int dwc2_hsotg_ep_enable(struct usb_ep *ep,

error2:
	if (ret && using_desc_dma(hsotg) && hs_ep->desc_list) {
		dma_free_coherent(hsotg->dev, MAX_DMA_DESC_NUM_GENERIC *
		dmam_free_coherent(hsotg->dev, MAX_DMA_DESC_NUM_GENERIC *
			sizeof(struct dwc2_dma_desc),
			hs_ep->desc_list, hs_ep->desc_list_dma);
		hs_ep->desc_list = NULL;
@@ -3902,14 +3902,6 @@ static int dwc2_hsotg_ep_disable(struct usb_ep *ep)
		return -EINVAL;
	}

	/* Remove DMA memory allocated for non-control Endpoints */
	if (using_desc_dma(hsotg)) {
		dma_free_coherent(hsotg->dev, MAX_DMA_DESC_NUM_GENERIC *
				  sizeof(struct dwc2_dma_desc),
				  hs_ep->desc_list, hs_ep->desc_list_dma);
		hs_ep->desc_list = NULL;
	}

	epctrl_reg = dir_in ? DIEPCTL(index) : DOEPCTL(index);

	spin_lock_irqsave(&hsotg->lock, flags);
@@ -4131,7 +4123,7 @@ static void dwc2_hsotg_init(struct dwc2_hsotg *hsotg)
	/* keep other bits untouched (so e.g. forced modes are not lost) */
	usbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
	usbcfg &= ~(GUSBCFG_TOUTCAL_MASK | GUSBCFG_PHYIF16 | GUSBCFG_SRPCAP |
		GUSBCFG_HNPCAP);
		GUSBCFG_HNPCAP | GUSBCFG_USBTRDTIM_MASK);

	/* set the PLL on, remove the HNP/SRP and set the PHY */
	trdtim = (hsotg->phyif == GUSBCFG_PHYIF8) ? 9 : 5;
+5 −2
Original line number Diff line number Diff line
@@ -4367,6 +4367,9 @@ static int _dwc2_hcd_suspend(struct usb_hcd *hcd)
	if (!HCD_HW_ACCESSIBLE(hcd))
		goto unlock;

	if (hsotg->op_state == OTG_STATE_B_PERIPHERAL)
		goto unlock;

	if (!hsotg->params.hibernation)
		goto skip_power_saving;

@@ -4489,8 +4492,8 @@ static void dwc2_dump_urb_info(struct usb_hcd *hcd, struct urb *urb,
{
#ifdef VERBOSE_DEBUG
	struct dwc2_hsotg *hsotg = dwc2_hcd_to_hsotg(hcd);
	char *pipetype;
	char *speed;
	char *pipetype = NULL;
	char *speed = NULL;

	dev_vdbg(hsotg->dev, "%s, urb %p\n", fn_name, urb);
	dev_vdbg(hsotg->dev, "  Device address: %d\n",
+5 −5
Original line number Diff line number Diff line
@@ -385,16 +385,16 @@ static void dwc2_set_param(struct dwc2_hsotg *hsotg, void *param,
}

/**
 * dwc2_set_param_u16() - Set a u16 parameter
 * dwc2_set_param_u32() - Set a u32 parameter
 *
 * See dwc2_set_param().
 */
static void dwc2_set_param_u16(struct dwc2_hsotg *hsotg, u16 *param,
static void dwc2_set_param_u32(struct dwc2_hsotg *hsotg, u32 *param,
			       bool lookup, char *property, u16 legacy,
			       u16 def, u16 min, u16 max)
{
	dwc2_set_param(hsotg, param, lookup, property,
		       legacy, def, min, max, 2);
		       legacy, def, min, max, 4);
}

/**
@@ -1178,12 +1178,12 @@ static void dwc2_set_parameters(struct dwc2_hsotg *hsotg,
		 * auto-detect if the hardware does not support the
		 * default.
		 */
		dwc2_set_param_u16(hsotg, &p->g_rx_fifo_size,
		dwc2_set_param_u32(hsotg, &p->g_rx_fifo_size,
				   true, "g-rx-fifo-size", 2048,
				   hw->rx_fifo_size,
				   16, hw->rx_fifo_size);

		dwc2_set_param_u16(hsotg, &p->g_np_tx_fifo_size,
		dwc2_set_param_u32(hsotg, &p->g_np_tx_fifo_size,
				   true, "g-np-tx-fifo-size", 1024,
				   hw->dev_nperio_tx_fifo_size,
				   16, hw->dev_nperio_tx_fifo_size);
+3 −1
Original line number Diff line number Diff line
@@ -138,7 +138,8 @@ static int dwc3_exynos_probe(struct platform_device *pdev)
		exynos->axius_clk = devm_clk_get(dev, "usbdrd30_axius_clk");
		if (IS_ERR(exynos->axius_clk)) {
			dev_err(dev, "no AXI UpScaler clk specified\n");
			return -ENODEV;
			ret = -ENODEV;
			goto axius_clk_err;
		}
		clk_prepare_enable(exynos->axius_clk);
	} else {
@@ -196,6 +197,7 @@ static int dwc3_exynos_probe(struct platform_device *pdev)
	regulator_disable(exynos->vdd33);
err2:
	clk_disable_unprepare(exynos->axius_clk);
axius_clk_err:
	clk_disable_unprepare(exynos->susp_clk);
	clk_disable_unprepare(exynos->clk);
	return ret;
Loading