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

Commit 174645cc authored by Chunfeng Yun's avatar Chunfeng Yun Committed by Greg Kroah-Hartman
Browse files

usb: xhci-mtk: allow multiple Start-Split in a microframe



[ Upstream commit d3997fce189fc4423169c51a81ba5ca01144d886 ]

This patch is used to relax bandwidth schedule by allowing multiple
Start-Split in the same microframe.

Reviewed-and-Tested-by: default avatarIkjoon Jang <ikjn@chromium.org>
Signed-off-by: default avatarChunfeng Yun <chunfeng.yun@mediatek.com>
Link: https://lore.kernel.org/r/1623995165-25759-1-git-send-email-chunfeng.yun@mediatek.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Stable-dep-of: 548011957d1d ("usb: xhci-mtk: relax TT periodic bandwidth allocation")
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 6cfde07c
Loading
Loading
Loading
Loading
+0 −18
Original line number Diff line number Diff line
@@ -430,11 +430,9 @@ static int check_fs_bus_bw(struct mu3h_sch_ep_info *sch_ep, int offset)
static int check_sch_tt(struct usb_device *udev,
	struct mu3h_sch_ep_info *sch_ep, u32 offset)
{
	struct mu3h_sch_tt *tt = sch_ep->sch_tt;
	u32 extra_cs_count;
	u32 start_ss, last_ss;
	u32 start_cs, last_cs;
	int i;

	start_ss = offset % 8;

@@ -448,10 +446,6 @@ static int check_sch_tt(struct usb_device *udev,
		if (!(start_ss == 7 || last_ss < 6))
			return -ESCH_SS_Y6;

		for (i = 0; i < sch_ep->cs_count; i++)
			if (test_bit(offset + i, tt->ss_bit_map))
				return -ESCH_SS_OVERLAP;

	} else {
		u32 cs_count = DIV_ROUND_UP(sch_ep->maxpkt, FS_PAYLOAD_MAX);

@@ -478,9 +472,6 @@ static int check_sch_tt(struct usb_device *udev,
		if (cs_count > 7)
			cs_count = 7; /* HW limit */

		if (test_bit(offset, tt->ss_bit_map))
			return -ESCH_SS_OVERLAP;

		sch_ep->cs_count = cs_count;
		/* one for ss, the other for idle */
		sch_ep->num_budget_microframes = cs_count + 2;
@@ -502,11 +493,9 @@ static void update_sch_tt(struct usb_device *udev,
	struct mu3h_sch_tt *tt = sch_ep->sch_tt;
	u32 base, num_esit;
	int bw_updated;
	int bits;
	int i, j;

	num_esit = XHCI_MTK_MAX_ESIT / sch_ep->esit;
	bits = (sch_ep->ep_type == ISOC_OUT_EP) ? sch_ep->cs_count : 1;

	if (used)
		bw_updated = sch_ep->bw_cost_per_microframe;
@@ -516,13 +505,6 @@ static void update_sch_tt(struct usb_device *udev,
	for (i = 0; i < num_esit; i++) {
		base = sch_ep->offset + i * sch_ep->esit;

		for (j = 0; j < bits; j++) {
			if (used)
				set_bit(base + j, tt->ss_bit_map);
			else
				clear_bit(base + j, tt->ss_bit_map);
		}

		for (j = 0; j < sch_ep->cs_count; j++)
			tt->fs_bus_bw[base + j] += bw_updated;
	}
+0 −2
Original line number Diff line number Diff line
@@ -20,14 +20,12 @@
#define XHCI_MTK_MAX_ESIT	64

/**
 * @ss_bit_map: used to avoid start split microframes overlay
 * @fs_bus_bw: array to keep track of bandwidth already used for FS
 * @ep_list: Endpoints using this TT
 * @usb_tt: usb TT related
 * @tt_port: TT port number
 */
struct mu3h_sch_tt {
	DECLARE_BITMAP(ss_bit_map, XHCI_MTK_MAX_ESIT);
	u32 fs_bus_bw[XHCI_MTK_MAX_ESIT];
	struct list_head ep_list;
	struct usb_tt *usb_tt;