All of lore.kernel.org
 help / color / mirror / Atom feed
From: Macpaul Lin <macpaul.lin@mediatek.com>
To: "Chunfeng Yun" <chunfeng.yun@mediatek.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Felipe Balbi" <balbi@kernel.org>,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	"Michał Mirosław" <mirq-linux@rere.qmqm.pl>,
	"Sergey Organov" <sorganov@gmail.com>,
	"Fabrice Gasnier" <fabrice.gasnier@st.com>,
	linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org
Cc: Mediatek WSD Upstream <wsd_upstream@mediatek.com>,
	Macpaul Lin <macpaul.lin@mediatek.com>,
	Macpaul Lin <macpaul.lin@gmail.com>
Subject: [PATCH 1/2] usb: gadget: introduce flag for large request
Date: Tue, 16 Jun 2020 20:34:43 +0800	[thread overview]
Message-ID: <1592310884-4307-1-git-send-email-macpaul.lin@mediatek.com> (raw)

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@mediatek.com>
---
 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;
 	u8			address;
 	const struct usb_endpoint_descriptor	*desc;
 	const struct usb_ss_ep_comp_descriptor	*comp_desc;
-- 
1.7.9.5

WARNING: multiple messages have this Message-ID (diff)
From: Macpaul Lin <macpaul.lin@mediatek.com>
To: "Chunfeng Yun" <chunfeng.yun@mediatek.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Felipe Balbi" <balbi@kernel.org>,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	"Michał Mirosław" <mirq-linux@rere.qmqm.pl>,
	"Sergey Organov" <sorganov@gmail.com>,
	"Fabrice Gasnier" <fabrice.gasnier@st.com>,
	linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org
Cc: Macpaul Lin <macpaul.lin@gmail.com>,
	Macpaul Lin <macpaul.lin@mediatek.com>,
	Mediatek WSD Upstream <wsd_upstream@mediatek.com>
Subject: [PATCH 1/2] usb: gadget: introduce flag for large request
Date: Tue, 16 Jun 2020 20:34:43 +0800	[thread overview]
Message-ID: <1592310884-4307-1-git-send-email-macpaul.lin@mediatek.com> (raw)

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@mediatek.com>
---
 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;
 	u8			address;
 	const struct usb_endpoint_descriptor	*desc;
 	const struct usb_ss_ep_comp_descriptor	*comp_desc;
-- 
1.7.9.5
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

WARNING: multiple messages have this Message-ID (diff)
From: Macpaul Lin <macpaul.lin@mediatek.com>
To: "Chunfeng Yun" <chunfeng.yun@mediatek.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Felipe Balbi" <balbi@kernel.org>,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	"Michał Mirosław" <mirq-linux@rere.qmqm.pl>,
	"Sergey Organov" <sorganov@gmail.com>,
	"Fabrice Gasnier" <fabrice.gasnier@st.com>,
	linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org
Cc: Macpaul Lin <macpaul.lin@gmail.com>,
	Macpaul Lin <macpaul.lin@mediatek.com>,
	Mediatek WSD Upstream <wsd_upstream@mediatek.com>
Subject: [PATCH 1/2] usb: gadget: introduce flag for large request
Date: Tue, 16 Jun 2020 20:34:43 +0800	[thread overview]
Message-ID: <1592310884-4307-1-git-send-email-macpaul.lin@mediatek.com> (raw)

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@mediatek.com>
---
 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;
 	u8			address;
 	const struct usb_endpoint_descriptor	*desc;
 	const struct usb_ss_ep_comp_descriptor	*comp_desc;
-- 
1.7.9.5
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

             reply	other threads:[~2020-06-16 12:35 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-16 12:34 Macpaul Lin [this message]
2020-06-16 12:34 ` [PATCH 1/2] usb: gadget: introduce flag for large request Macpaul Lin
2020-06-16 12:34 ` Macpaul Lin
2020-06-16 12:34 ` [PATCH 2/2] usb: gadget: u_serial: improve performance for large data Macpaul Lin
2020-06-16 12:34   ` Macpaul Lin
2020-06-16 12:34   ` Macpaul Lin
2020-06-24  6:48   ` Felipe Balbi
2020-06-24  6:48     ` Felipe Balbi
2020-06-24  6:48     ` Felipe Balbi
2020-06-16 14:02 ` [PATCH 1/2] usb: gadget: introduce flag for large request Alan Stern
2020-06-16 14:02   ` Alan Stern
2020-06-16 14:02   ` Alan Stern
2020-06-17  2:27   ` Macpaul Lin
2020-06-17  2:27     ` Macpaul Lin
2020-06-17  2:27     ` Macpaul Lin
2020-06-17  2:46 ` [PATCH v2] usb: gadget: u_serial: improve performance for large data Macpaul Lin
2020-06-17  2:46   ` Macpaul Lin
2020-06-17  2:46   ` Macpaul Lin
2020-06-17  5:14   ` Greg Kroah-Hartman
2020-06-17  5:14     ` Greg Kroah-Hartman
2020-06-17  5:14     ` Greg Kroah-Hartman
2020-06-17  5:34     ` Macpaul Lin
2020-06-17  5:34       ` Macpaul Lin
2020-06-17  5:34       ` Macpaul Lin
2020-06-17  5:42   ` [PATCH v3] " Macpaul Lin
2020-06-17  5:42     ` Macpaul Lin
2020-06-17  5:42     ` Macpaul Lin
2020-06-24  6:50     ` Felipe Balbi
2020-06-24  6:50       ` Felipe Balbi
2020-06-24  6:50       ` Felipe Balbi
2020-06-24  6:47 ` [PATCH 1/2] usb: gadget: introduce flag for large request Felipe Balbi
2020-06-24  6:47   ` Felipe Balbi
2020-06-24  6:47   ` Felipe Balbi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1592310884-4307-1-git-send-email-macpaul.lin@mediatek.com \
    --to=macpaul.lin@mediatek.com \
    --cc=balbi@kernel.org \
    --cc=chunfeng.yun@mediatek.com \
    --cc=fabrice.gasnier@st.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=macpaul.lin@gmail.com \
    --cc=matthias.bgg@gmail.com \
    --cc=mirq-linux@rere.qmqm.pl \
    --cc=sorganov@gmail.com \
    --cc=wsd_upstream@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.