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

Commit 44b79ab7 authored by Manu Gautam's avatar Manu Gautam Committed by Ajay Agarwal
Browse files

usb: gadget: qdss: Add support for CI 2.0 gadget



QDSS function driver currently works only with DWC3
core which uses DBM APIs for bam2bam mode of opearation.

Allow this driver to work with CI gadget by determining
the type of gadget it is operating with (DWC3 or CI) at
runtime and then submit the usb_request accordingly.

Change-Id: I2f0ce4092e55c6d2cabbfcc74251637a540be61f
Signed-off-by: default avatarManu Gautam <mgautam@codeaurora.org>
Signed-off-by: default avatarAjay Agarwal <ajaya@codeaurora.org>
parent 20f19243
Loading
Loading
Loading
Loading
+30 −8
Original line number Diff line number Diff line
/*
 * Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
 * Copyright (c) 2012-2018, 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
@@ -20,6 +20,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");
@@ -30,9 +31,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,10 +116,12 @@ 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,
				bam_info.usb_bam_pipe_idx);

		init_data(qdss->port.data);

		res = usb_bam_connect(usb_bam_type, idx,
@@ -132,8 +143,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("init_data\n");

	res = msm_ep_config(ep, qdss->endless_req);
@@ -145,8 +162,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_err("uninit_data\n");

	res = msm_ep_unconfig(ep);