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

Commit f76a9841 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "usb: gadget: u_qdss: Add chipidea support"

parents d9f94854 ac7fdb24
Loading
Loading
Loading
Loading
+29 −8
Original line number Diff line number Diff line
/*
 * Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
 * Copyright (c) 2012-2017, 2020 The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -21,6 +21,7 @@ static int alloc_sps_req(struct usb_ep *data_ep)
{
	struct usb_request *req = NULL;
	struct f_qdss *qdss = data_ep->driver_data;
	struct usb_gadget *gadget = qdss->gadget;
	u32 sps_params = 0;

	pr_debug("send_sps_req\n");
@@ -31,9 +32,17 @@ static int alloc_sps_req(struct usb_ep *data_ep)
		return -ENOMEM;
	}

	if (!gadget->is_chipidea) {
		req->length = 32*1024;
		sps_params = MSM_SPS_MODE | MSM_DISABLE_WB |
				qdss->bam_info.usb_bam_pipe_idx;
	} else {
		/* non DWC3 BAM requires req->length to be 0 */
		req->length = 0;
		sps_params = (MSM_SPS_MODE | qdss->bam_info.usb_bam_pipe_idx |
				MSM_VENDOR_ID) & ~MSM_IS_FINITE_TRANSFER;
	}

	req->udc_priv = sps_params;
	qdss->endless_req = req;

@@ -107,6 +116,7 @@ int set_qdss_data_connection(struct f_qdss *qdss, int enable)
				NULL, bam_info.data_fifo, NULL);

		alloc_sps_req(qdss->port.data);
		if (!gadget->is_chipidea)
			msm_data_fifo_config(qdss->port.data,
				bam_info.data_fifo->iova,
				bam_info.data_fifo->size,
@@ -132,8 +142,14 @@ int set_qdss_data_connection(struct f_qdss *qdss, int enable)
static int init_data(struct usb_ep *ep)
{
	struct f_qdss *qdss = ep->driver_data;
	struct usb_gadget *gadget = qdss->gadget;
	int res = 0;

	if (gadget->is_chipidea) {
		pr_debug("QDSS is used with non DWC3 core\n");
		return res;
	}

	pr_debug("%s\n", __func__);

	res = msm_ep_config(ep, qdss->endless_req);
@@ -145,8 +161,13 @@ static int init_data(struct usb_ep *ep)

int uninit_data(struct usb_ep *ep)
{
	struct f_qdss *qdss = ep->driver_data;
	struct usb_gadget *gadget = qdss->gadget;
	int res = 0;

	if (gadget->is_chipidea)
		return res;

	pr_debug("%s\n", __func__);

	res = msm_ep_unconfig(ep);