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

Commit 8905cc77 authored by Dov Levenglick's avatar Dov Levenglick
Browse files

usb: dwc3: msm: change dbm ep reset assertion time



The necessary delay between asserting and deasserting the
dbm ep reset is based on thenumber of active endpoints.
If there is more than one endpoint,a 1 msec delay is required.
Otherwise, a shorter delay will suffice.

CRs-Fixed: 662695
Change-Id: Ic742e2ca58d5a5332c94b4fd642f80cfc13787f3
Signed-off-by: default avatarDov Levenglick <dovl@codeaurora.org>
parent ca30ec37
Loading
Loading
Loading
Loading
+26 −19
Original line number Diff line number Diff line
@@ -250,6 +250,21 @@ static int ep_config(u8 usb_ep, u8 bam_pipe, bool producer, bool disable_wb,
	return dbm_ep;
}

/**
 * Return number of configured DBM endpoints.
 */
static int get_num_of_eps_configured(void)
{
	int i;
	int count = 0;

	for (i = 0; i < dbm_data->dbm_num_eps; i++)
		if (dbm_data->ep_num_mapping[i])
			count++;

	return count;
}

/**
 * Configure a USB DBM ep to work in normal mode.
 *
@@ -279,31 +294,23 @@ static int ep_unconfig(u8 usb_ep)
	/* Reset the dbm endpoint */
	ep_soft_reset(dbm_ep, true);
	/*
	 * 10 usec delay is required before deasserting DBM endpoint reset
	 * according to hardware programming guide.
	 * The necessary delay between asserting and deasserting the dbm ep
	 * reset is based on the number of active endpoints. If there is more
	 * than one endpoint, a 1 msec delay is required. Otherwise, a shorter
	 * delay will suffice.
	 *
	 * As this function can be called in atomic context, sleeping variants
	 * for delay are not possible - albeit a 1ms delay.
	 */
	if (get_num_of_eps_configured() > 1)
		udelay(1000);
	else
		udelay(10);
	ep_soft_reset(dbm_ep, false);

	return 0;
}

/**
 * Return number of configured DBM endpoints.
 *
 */
static int get_num_of_eps_configured(void)
{
	int i;
	int count = 0;

	for (i = 0; i < dbm_data->dbm_num_eps; i++)
		if (dbm_data->ep_num_mapping[i])
			count++;

	return count;
}

/**
 * Configure the DBM with the USB3 core event buffer.
 * This function is called by the SNPS UDC upon initialization.
+8 −3
Original line number Diff line number Diff line
@@ -456,9 +456,14 @@ static int __dwc3_msm_dbm_ep_reset(struct dwc3_msm *mdwc, struct dwc3_ep *dep)
	}

	/*
	 * 10 usec delay is required before deasserting DBM endpoint reset
	 * according to hardware programming guide.
	 * The necessary delay between asserting and deasserting the dbm ep
	 * reset is based on the number of active endpoints. If there is more
	 * than one endpoint, a 1 msec delay is required. Otherwise, a shorter
	 * delay will suffice.
	 */
	if (dbm_get_num_of_eps_configured(mdwc->dbm) > 1)
		usleep_range(1000, 1200);
	else
		udelay(10);
	ret = dbm_ep_soft_reset(mdwc->dbm, dep->number, false);
	if (ret) {