Re: [PATCH 1/2] usb: gadget: introduce flag for large request

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Macpaul Lin <macpaul.lin@xxxxxxxxxxxx> writes:
> Some USB hardware like DMA engine can help to process (split) the data
> of each URB request into small packets. For example, the max packet size
> of high speed is 512 bytes. These kinds of hardware can help to split
> the continue Tx/Rx data requests into packets just at the max packet
> size during transmission. Hence upper layer software can reduce some
> effort for queueing many requests back and forth for larger data.
>
> Here we introduce "can_exceed_maxp" flag in gadget when these kinds of
> hardware is ready to support these operations.
>
> Signed-off-by: Macpaul Lin <macpaul.lin@xxxxxxxxxxxx>
> ---
>  drivers/usb/mtu3/mtu3_qmu.c |   11 ++++++++++-
>  include/linux/usb/gadget.h  |    1 +
>  2 files changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/mtu3/mtu3_qmu.c b/drivers/usb/mtu3/mtu3_qmu.c
> index 3f414f9..2b51a20 100644
> --- a/drivers/usb/mtu3/mtu3_qmu.c
> +++ b/drivers/usb/mtu3/mtu3_qmu.c
> @@ -620,7 +620,7 @@ irqreturn_t mtu3_qmu_isr(struct mtu3 *mtu)
>  
>  int mtu3_qmu_init(struct mtu3 *mtu)
>  {
> -
> +	int i;
>  	compiletime_assert(QMU_GPD_SIZE == 16, "QMU_GPD size SHOULD be 16B");
>  
>  	mtu->qmu_gpd_pool = dma_pool_create("QMU_GPD", mtu->dev,
> @@ -629,10 +629,19 @@ int mtu3_qmu_init(struct mtu3 *mtu)
>  	if (!mtu->qmu_gpd_pool)
>  		return -ENOMEM;
>  
> +	/* Let gadget know we can process request larger than max packet */
> +	for (i = 1; i < mtu->num_eps; i++)
> +		mtu->ep_array[i].ep.can_exceed_maxp = 1;
> +
>  	return 0;
>  }
>  
>  void mtu3_qmu_exit(struct mtu3 *mtu)
>  {
> +	int i;
>  	dma_pool_destroy(mtu->qmu_gpd_pool);
> +
> +	/* Disable large request support */
> +	for (i = 1; i < mtu->num_eps; i++)
> +		mtu->ep_array[i].ep.can_exceed_maxp = 0;
>  }
> diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
> index 6a17817..60e0645 100644
> --- a/include/linux/usb/gadget.h
> +++ b/include/linux/usb/gadget.h
> @@ -236,6 +236,7 @@ struct usb_ep {
>  	unsigned		max_streams:16;
>  	unsigned		mult:2;
>  	unsigned		maxburst:5;
> +	unsigned		can_exceed_maxp:1;

every driver does this without this flag. This is unnecessary.

-- 
balbi

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux