Merge v5.14-rc3 into usb-next
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 26 Jul 2021 09:16:46 +0000 (11:16 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 26 Jul 2021 09:16:46 +0000 (11:16 +0200)
We need the fixes in here, and this resolves a merge issue with
drivers/usb/dwc3/gadget.c

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1  2 
drivers/usb/dwc2/core.h
drivers/usb/dwc2/gadget.c
drivers/usb/dwc3/core.h
drivers/usb/dwc3/ep0.c
drivers/usb/dwc3/gadget.c
drivers/usb/host/xhci-pci-renesas.c
drivers/usb/host/xhci-pci.c

Simple merge
Simple merge
@@@ -1288,12 -1279,9 +1288,13 @@@ struct dwc3 
        unsigned                dis_metastability_quirk:1;
  
        unsigned                dis_split_quirk:1;
+       unsigned                async_callbacks:1;
  
        u16                     imod_interval;
 +
 +      int                     max_cfg_eps;
 +      int                     last_fifo_depth;
 +      int                     num_ep_resized;
  };
  
  #define INCRX_BURST_MODE 0
Simple merge
@@@ -2771,51 -2585,16 +2771,61 @@@ static int dwc3_gadget_vbus_draw(struc
        return ret;
  }
  
 +/**
 + * dwc3_gadget_check_config - ensure dwc3 can support the USB configuration
 + * @g: pointer to the USB gadget
 + *
 + * Used to record the maximum number of endpoints being used in a USB composite
 + * device. (across all configurations)  This is to be used in the calculation
 + * of the TXFIFO sizes when resizing internal memory for individual endpoints.
 + * It will help ensured that the resizing logic reserves enough space for at
 + * least one max packet.
 + */
 +static int dwc3_gadget_check_config(struct usb_gadget *g)
 +{
 +      struct dwc3 *dwc = gadget_to_dwc(g);
 +      struct usb_ep *ep;
 +      int fifo_size = 0;
 +      int ram1_depth;
 +      int ep_num = 0;
 +
 +      if (!dwc->do_fifo_resize)
 +              return 0;
 +
 +      list_for_each_entry(ep, &g->ep_list, ep_list) {
 +              /* Only interested in the IN endpoints */
 +              if (ep->claimed && (ep->address & USB_DIR_IN))
 +                      ep_num++;
 +      }
 +
 +      if (ep_num <= dwc->max_cfg_eps)
 +              return 0;
 +
 +      /* Update the max number of eps in the composition */
 +      dwc->max_cfg_eps = ep_num;
 +
 +      fifo_size = dwc3_gadget_calc_tx_fifo_size(dwc, dwc->max_cfg_eps);
 +      /* Based on the equation, increment by one for every ep */
 +      fifo_size += dwc->max_cfg_eps;
 +
 +      /* Check if we can fit a single fifo per endpoint */
 +      ram1_depth = DWC3_RAM1_DEPTH(dwc->hwparams.hwparams7);
 +      if (fifo_size > ram1_depth)
 +              return -ENOMEM;
 +
 +      return 0;
 +}
 +
+ static void dwc3_gadget_async_callbacks(struct usb_gadget *g, bool enable)
+ {
+       struct dwc3             *dwc = gadget_to_dwc(g);
+       unsigned long           flags;
+       spin_lock_irqsave(&dwc->lock, flags);
+       dwc->async_callbacks = enable;
+       spin_unlock_irqrestore(&dwc->lock, flags);
+ }
  static const struct usb_gadget_ops dwc3_gadget_ops = {
        .get_frame              = dwc3_gadget_get_frame,
        .wakeup                 = dwc3_gadget_wakeup,
        .udc_set_ssp_rate       = dwc3_gadget_set_ssp_rate,
        .get_config_params      = dwc3_gadget_config_params,
        .vbus_draw              = dwc3_gadget_vbus_draw,
 +      .check_config           = dwc3_gadget_check_config,
+       .udc_async_callbacks    = dwc3_gadget_async_callbacks,
  };
  
  /* -------------------------------------------------------------------------- */
Simple merge
Simple merge