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

Commit 415741a3 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "usb_bam: Get rid of usb_bam_set_qdss_core and usb_bam_get_qdss_idx"

parents c22fe3da 50e8326c
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -969,6 +969,7 @@
			qcom,src-bam-pipe-index = <1>;
			qcom,data-fifo-size = <0x8000>;
			qcom,descriptor-fifo-size = <0x2000>;
			qcom,reset-bam-on-disconnect;
		};
		qcom,pipe1 {
			label = "hsusb-ipa-in-0";
@@ -981,6 +982,7 @@
			qcom,dst-bam-pipe-index = <0>;
			qcom,data-fifo-size = <0x8000>;
			qcom,descriptor-fifo-size = <0x2000>;
			qcom,reset-bam-on-disconnect;
		};

		qcom,pipe2 {
@@ -998,6 +1000,7 @@
			qcom,data-fifo-size = <0xe00>;
			qcom,descriptor-fifo-offset = <0xe00>;
			qcom,descriptor-fifo-size = <0x200>;
			qcom,reset-bam-on-disconnect;
		};

		/* USB BAM pipe (consumer) configuration for accelerated DPL */
@@ -1012,6 +1015,7 @@
			qcom,dst-bam-pipe-index = <3>;
			qcom,data-fifo-size = <0x8000>;
			qcom,descriptor-fifo-size = <0x2000>;
			qcom,reset-bam-on-disconnect;
		};
	};

+1 −2
Original line number Diff line number Diff line
@@ -522,8 +522,7 @@ static void tmc_etr_fill_usb_bam_data(struct tmc_drvdata *drvdata)
{
	struct tmc_etr_bam_data *bamdata = drvdata->bamdata;

	get_bam2bam_connection_info(usb_bam_get_qdss_idx(0),
				    &bamdata->dest,
	get_qdss_bam_connection_info(&bamdata->dest,
				    &bamdata->dest_pipe_idx,
				    &bamdata->src_pipe_idx,
				    &bamdata->desc_fifo,
+59 −30
Original line number Diff line number Diff line
@@ -100,8 +100,7 @@ struct usb_bam_sps_type {
*	case the usb bam uses its private memory for the pipes.
* @mem_iface_clk: Clock that controls the usb bam private memory in
*	case the usb bam uses its private memory for the pipes.
* @qdss_core_name: Stores the name of the core ("ssusb", "hsusb" or "hsic")
*	that it used as a peer of the qdss in bam2bam mode.
* @qdss_usb_bam_type: USB bam type used as a peer of the qdss in bam2bam mode.
* @h_bam: This array stores for each BAM ("ssusb", "hsusb" or "hsic") the
*	handle/device of the sps driver.
* @pipes_enabled_per_bam: This array stores for each BAM
@@ -120,7 +119,7 @@ struct usb_bam_ctx_type {
	u8 max_connections;
	struct clk *mem_clk;
	struct clk *mem_iface_clk;
	char qdss_core_name[USB_BAM_MAX_STR_LEN];
	enum usb_ctrl qdss_usb_bam_type;
	unsigned long h_bam[MAX_BAMS];
	u8 pipes_enabled_per_bam[MAX_BAMS];
	u32 inactivity_timer_ms[MAX_BAMS];
@@ -2657,6 +2656,8 @@ int usb_bam_disconnect_pipe(u8 idx)
{
	struct usb_bam_pipe_connect *pipe_connect;
	int ret;
	struct msm_usb_bam_platform_data *pdata =
					ctx.usb_bam_pdev->dev.platform_data;

	pipe_connect = &usb_bam_connections[idx];

@@ -2682,6 +2683,22 @@ int usb_bam_disconnect_pipe(u8 idx)
	spin_unlock(&usb_bam_lock);
	log_event(1, "%s: success disconnecting pipe %d\n",
			 __func__, idx);

	if ((pdata->reset_on_disconnect[pipe_connect->bam_type] == true) &&
		(ctx.pipes_enabled_per_bam[pipe_connect->bam_type] == 0)) {
		if (pipe_connect->bam_type == CI_CTRL)
			msm_hw_bam_disable(1);

		sps_device_reset(ctx.h_bam[pipe_connect->bam_type]);

		if (pipe_connect->bam_type == CI_CTRL)
			msm_hw_bam_disable(0);
		/* Enable usb irq here which is disabled in function drivers
		 * during disconnect after BAM reset.
		 */
		if (pipe_connect->bam_type == CI_CTRL)
			msm_usb_irq_disable(false);
	}
	return 0;
}

@@ -2752,7 +2769,6 @@ int usb_bam_disconnect_ipa(struct usb_bam_connect_ipa_params *ipa_params)
				IPA_RM_RESOURCE_RELEASED,
				ipa_rm_resource_cons[cur_bam]);
		}

	}

out:
@@ -2830,7 +2846,7 @@ static struct msm_usb_bam_platform_data *usb_bam_dt_to_pdata(
	struct device_node *node = pdev->dev.of_node;
	int rc = 0;
	u8 i = 0;
	bool reset_bam;
	bool reset_bam, reset_bam_on_disconnect;
	u32 bam;
	u32 addr;
	u32 threshold;
@@ -2951,6 +2967,10 @@ static struct msm_usb_bam_platform_data *usb_bam_dt_to_pdata(
				__func__);
			goto err;
		}
		/* Store USB bam_type to be used with QDSS */
		if (usb_bam_connections[i].peer_bam == QDSS_P_BAM)
			ctx.qdss_usb_bam_type = usb_bam_connections[i].bam_type;

		rc = of_property_read_u32(node, "qcom,dir",
			&usb_bam_connections[i].dir);
		if (rc) {
@@ -2978,6 +2998,11 @@ static struct msm_usb_bam_platform_data *usb_bam_dt_to_pdata(
		if (reset_bam)
			pdata->reset_on_connect[bam] = true;

		reset_bam_on_disconnect = of_property_read_bool(node,
			"qcom,reset-bam-on-disconnect");
		if (reset_bam_on_disconnect)
			pdata->reset_on_disconnect[bam] = true;

		of_property_read_u32(node, "qcom,src-bam-physical-address",
			&usb_bam_connections[i].src_phy_addr);

@@ -3333,13 +3358,6 @@ static int usb_bam_probe(struct platform_device *pdev)
	return ret;
}

int usb_bam_get_qdss_idx(u8 num)
{
	return usb_bam_get_connection_idx(ctx.qdss_core_name, QDSS_P_BAM,
		PEER_PERIPHERAL_TO_USB, USB_BAM_DEVICE, num);
}
EXPORT_SYMBOL(usb_bam_get_qdss_idx);

bool usb_bam_get_prod_granted(u8 idx)
{
	struct usb_bam_pipe_connect *pipe_connect = &usb_bam_connections[idx];
@@ -3349,12 +3367,6 @@ bool usb_bam_get_prod_granted(u8 idx)
}
EXPORT_SYMBOL(usb_bam_get_prod_granted);


void usb_bam_set_qdss_core(const char *qdss_core)
{
	strlcpy(ctx.qdss_core_name, qdss_core, USB_BAM_MAX_STR_LEN);
}

int get_bam2bam_connection_info(u8 idx, unsigned long *usb_bam_handle,
	u32 *usb_bam_pipe_idx, u32 *peer_pipe_idx,
	struct sps_mem_buffer *desc_fifo, struct sps_mem_buffer *data_fifo,
@@ -3387,19 +3399,28 @@ int get_bam2bam_connection_info(u8 idx, unsigned long *usb_bam_handle,
}
EXPORT_SYMBOL(get_bam2bam_connection_info);

int get_qdss_bam_connection_info(unsigned long *usb_bam_handle,
	u32 *usb_bam_pipe_idx, u32 *peer_pipe_idx,
	struct sps_mem_buffer *desc_fifo, struct sps_mem_buffer *data_fifo,
	enum usb_pipe_mem_type *mem_type)
{
	u8 idx;

	/* QDSS uses only one pipe */
	idx = usb_bam_get_connection_idx(ctx.qdss_usb_bam_type, QDSS_P_BAM,
		PEER_PERIPHERAL_TO_USB, USB_BAM_DEVICE, 0);

	get_bam2bam_connection_info(idx, usb_bam_handle, usb_bam_pipe_idx,
			peer_pipe_idx, desc_fifo, data_fifo, mem_type);

int usb_bam_get_connection_idx(const char *core_name, enum peer_bam client,
	return 0;
}
EXPORT_SYMBOL(get_qdss_bam_connection_info);

int usb_bam_get_connection_idx(enum usb_ctrl bam_type, enum peer_bam client,
	enum usb_bam_pipe_dir dir, enum usb_bam_mode bam_mode, u32 num)
{
	u8 i;
	int bam_type;

	bam_type = get_bam_type_from_core_name(core_name);
	if (bam_type < 0 || bam_type >= MAX_BAMS) {
		pr_err("%s: Invalid bam, type=%d, name=%s\n",
			__func__, bam_type, core_name);
		return -EINVAL;
	}

	for (i = 0; i < ctx.max_connections; i++)
		if (usb_bam_connections[i].bam_type == bam_type &&
@@ -3411,14 +3432,22 @@ int usb_bam_get_connection_idx(const char *core_name, enum peer_bam client,
			return i;
		}

	pr_err("%s: failed for %s\n", __func__, core_name);
	pr_err("%s: failed for %d\n", __func__, bam_type);
	return -ENODEV;
}
EXPORT_SYMBOL(usb_bam_get_connection_idx);

int usb_bam_get_bam_type(int connection_idx)
int usb_bam_get_bam_type(const char *core_name)
{
	return usb_bam_connections[connection_idx].bam_type;
	int bam_type = get_bam_type_from_core_name(core_name);

	if (bam_type < 0 || bam_type >= MAX_BAMS) {
		pr_err("%s: Invalid bam, type=%d, name=%s\n",
			__func__, bam_type, core_name);
		return -EINVAL;
	}

	return bam_type;
}
EXPORT_SYMBOL(usb_bam_get_bam_type);

+11 −2
Original line number Diff line number Diff line
@@ -591,6 +591,12 @@ static void qdss_disable(struct usb_function *f)
	case USB_GADGET_XPORT_BAM2BAM_IPA:
	case USB_GADGET_XPORT_BAM_DMUX:
		spin_unlock_irqrestore(&qdss->lock, flags);
		/* Disable usb irq for CI gadget. It will be enabled in
		 * usb_bam_disconnect_pipe() after disconnecting all pipes
		 * and USB BAM reset is done.
		 */
		if (!gadget_is_dwc3(qdss->cdev->gadget))
			msm_usb_irq_disable(true);
		usb_qdss_disconnect_work(&qdss->disconnect_w);
		return;
	default:
@@ -602,6 +608,8 @@ static void qdss_disable(struct usb_function *f)
	/*cancell all active xfers*/
	qdss_eps_disable(f);
	msm_bam_set_qdss_usb_active(true);
	if (!gadget_is_dwc3(qdss->cdev->gadget))
		msm_usb_irq_disable(true);
	queue_work(qdss->wq, &qdss->disconnect_w);
}

@@ -613,7 +621,7 @@ static int qdss_dpl_ipa_connect(int port_num)
	struct gqdss *g_qdss;
	struct gadget_ipa_port *gp;
	struct usb_gadget *gadget;
	enum peer_bam bam_name = IPA_P_BAM;
	enum usb_ctrl usb_bam_type;
	unsigned long flags;

	ipa_data_port_select(port_num, USB_GADGET_DPL);
@@ -631,7 +639,8 @@ static int qdss_dpl_ipa_connect(int port_num)

	spin_unlock_irqrestore(&qdss->lock, flags);

	dst_connection_idx = usb_bam_get_connection_idx(gadget->name, bam_name,
	usb_bam_type = usb_bam_get_bam_type(gadget->name);
	dst_connection_idx = usb_bam_get_connection_idx(usb_bam_type, IPA_P_BAM,
				PEER_PERIPHERAL_TO_USB, USB_BAM_DEVICE, 1);
	if (dst_connection_idx < 0) {
		pr_err("usb_bam_get_connection_idx failed\n");
+5 −3
Original line number Diff line number Diff line
@@ -379,6 +379,7 @@ static int gport_rmnet_connect(struct f_rmnet *dev, unsigned intf)
	enum transport_type	dxport = rmnet_ports[dev->port_num].data_xport;
	int			src_connection_idx = 0, dst_connection_idx = 0;
	struct usb_gadget	*gadget = dev->cdev->gadget;
	enum usb_ctrl		usb_bam_type;
	void			*net;

	pr_debug("%s: ctrl xport: %s data xport: %s dev: %p portno: %d\n",
@@ -434,10 +435,11 @@ static int gport_rmnet_connect(struct f_rmnet *dev, unsigned intf)
		}
		break;
	case USB_GADGET_XPORT_BAM2BAM_IPA:
		src_connection_idx = usb_bam_get_connection_idx(gadget->name,
		usb_bam_type = usb_bam_get_bam_type(gadget->name);
		src_connection_idx = usb_bam_get_connection_idx(usb_bam_type,
			IPA_P_BAM, USB_TO_PEER_PERIPHERAL, USB_BAM_DEVICE,
			port_num);
		dst_connection_idx = usb_bam_get_connection_idx(gadget->name,
		dst_connection_idx = usb_bam_get_connection_idx(usb_bam_type,
			IPA_P_BAM, PEER_PERIPHERAL_TO_USB, USB_BAM_DEVICE,
			port_num);
		if (dst_connection_idx < 0 || src_connection_idx < 0) {
Loading