/* Return the maximum data that can be queued in one go on a given endpoint so that transfers that are too long can be split.  */
static unsigned get_ep_limit(struct s3c_hsotg_ep *hs_ep)
/* Return the maximum data that can be queued in one go on a given endpoint so that transfers that are too long can be split.  */
static unsigned get_ep_limit(struct s3c_hsotg_ep *hs_ep)
{
	int index = hs_ep->index;
	unsigned maxsize;
	unsigned maxpkt;
	if (index != 0) {
		maxsize = DXEPTSIZ_XFERSIZE_LIMIT + 1;
		maxpkt = DXEPTSIZ_PKTCNT_LIMIT + 1;
	} else {
		maxsize = 64+64;
		if (hs_ep->dir_in)
			maxpkt = DIEPTSIZ0_PKTCNT_LIMIT + 1;
		else
			maxpkt = 2;
	}
	maxpkt--;
	maxsize--;
	if ((maxpkt * hs_ep->ep.maxpacket) < maxsize)
		maxsize = maxpkt * hs_ep->ep.maxpacket;
	return maxsize;
}