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

Commit d03e5bc2 authored by Mayank Rana's avatar Mayank Rana
Browse files

usb: gadget: Don't perform start xfer with USB BAM endpoint



usb_ep_enable() API performs start xfer command in addition to setting
endpoint configuration. USB BAM endpoint is reconfigured with endless
data transfer with msm_ep_queue() API which performs USB start xfer
command. This command fails as already start xfer command is invoked
previously. With this USB BAM related endpoint won't be configured as
endless. Fix this issue by adding endless flag with USB BAM endpoint.

Change-Id: Ib6ceead6d7e8e49e95ef2953e9140a43adffc0cf
Signed-off-by: default avatarMayank Rana <mrana@codeaurora.org>
parent 59d3346d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -778,6 +778,7 @@ struct dwc3_ep {
	unsigned		direction:1;
	unsigned		stream_capable:1;
	unsigned		gsi:1;
	unsigned int		endless:1;

	/* For isochronous START TRANSFER workaround only */
	u8			combo_num;
+10 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
 */

#include <linux/module.h>
@@ -2060,6 +2060,15 @@ int msm_ep_unconfig(struct usb_ep *ep)
	return 0;
}
EXPORT_SYMBOL(msm_ep_unconfig);

void msm_ep_set_endless(struct usb_ep *ep, bool set_clear)
{
	struct dwc3_ep *dep = to_dwc3_ep(ep);

	dep->endless = !!set_clear;
}
EXPORT_SYMBOL(msm_ep_set_endless);

#endif /* (CONFIG_USB_DWC3_GADGET) || (CONFIG_USB_DWC3_DUAL_ROLE) */

static void dwc3_resume_work(struct work_struct *w);
+2 −2
Original line number Diff line number Diff line
@@ -778,8 +778,8 @@ static int __dwc3_gadget_ep_enable(struct dwc3_ep *dep, unsigned int action)
	 * Issue StartTransfer here with no-op TRB so we can always rely on No
	 * Response Update Transfer command.
	 */
	if ((usb_endpoint_xfer_bulk(desc) && !dep->stream_capable) ||
			usb_endpoint_xfer_int(desc)) {
	if ((usb_endpoint_xfer_bulk(desc) && !dep->stream_capable
			&& !dep->endless) || usb_endpoint_xfer_int(desc)) {
		struct dwc3_gadget_ep_cmd_params params;
		struct dwc3_trb	*trb;
		dma_addr_t trb_dma;
+8 −2
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
/*
 * f_qdss.c -- QDSS function Driver
 *
 * Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
 */

#include <linux/init.h>
@@ -11,6 +11,7 @@
#include <linux/device.h>
#include <linux/usb/usb_qdss.h>
#include <linux/usb/cdc.h>
#include <linux/usb/dwc3-msm.h>

#include "f_qdss.h"

@@ -374,9 +375,11 @@ static void clear_eps(struct usb_function *f)
		qdss->port.ctrl_in->driver_data = NULL;
	if (qdss->port.ctrl_out)
		qdss->port.ctrl_out->driver_data = NULL;
	if (qdss->port.data)
	if (qdss->port.data) {
		msm_ep_set_endless(qdss->port.data, false);
		qdss->port.data->driver_data = NULL;
	}
}

static void clear_desc(struct usb_gadget *gadget, struct usb_function *f)
{
@@ -443,6 +446,9 @@ static int qdss_bind(struct usb_configuration *c, struct usb_function *f)
	qdss->port.data = ep;
	ep->driver_data = qdss;

	if (!strcmp(qdss->ch.name, USB_QDSS_CH_MSM))
		msm_ep_set_endless(qdss->port.data, true);

	if (qdss->debug_inface_enabled) {
		ep = usb_ep_autoconfig_ss(gadget, &qdss_ss_ctrl_in_desc,
			&qdss_ctrl_in_ep_comp_desc);
+4 −1
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
 */

#ifndef __LINUX_USB_DWC3_MSM_H
@@ -115,6 +115,7 @@ struct usb_ep *usb_ep_autoconfig_by_name(struct usb_gadget *gadget,
int usb_gsi_ep_op(struct usb_ep *ep, void *op_data, enum gsi_ep_op op);
int msm_ep_config(struct usb_ep *ep, struct usb_request *request, u32 bam_opts);
int msm_ep_unconfig(struct usb_ep *ep);
void msm_ep_set_endless(struct usb_ep *ep, bool set_clear);
void dwc3_tx_fifo_resize_request(struct usb_ep *ep, bool qdss_enable);
int msm_data_fifo_config(struct usb_ep *ep, unsigned long addr, u32 size,
	u8 dst_pipe_idx);
@@ -136,6 +137,8 @@ static inline int msm_ep_config(struct usb_ep *ep, struct usb_request *request,
{ return -ENODEV; }
static inline int msm_ep_unconfig(struct usb_ep *ep)
{ return -ENODEV; }
static inline void msm_ep_set_endless(struct usb_ep *ep, bool set_clear)
{ }
static inline void dwc3_tx_fifo_resize_request(struct usb_ep *ep,
	bool qdss_enable)
{ }