Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1200681
| Path | csiph.com!goblin1!goblin.stu.neva.ru!eternal-september.org!feeder.eternal-september.org!newsfeed.Update.UU.SE!news.Update.UU.SE!itgate.net!bofh.it!news.nic.it!robomod |
|---|---|
| From | Robert Baldyga <r.baldyga@samsung.com> |
| Newsgroups | linux.kernel |
| Subject | [PATCH v6 6/8] usb: gadget: goku_udc: add goku_match_ep() function |
| Date | Wed, 05 Aug 2015 14:10:03 +0200 |
| Message-ID | <pU5Gb-P2-29@gated-at.bofh.it> (permalink) |
| References | <pU5G9-P2-9@gated-at.bofh.it> |
| X-Original-To | balbi@ti.com |
| X-Auditid | cbfee61a-f79a06d000005c6f-c4-55c1fb5d0466 |
| X-Mailer | git-send-email 1.9.1 |
| X-Brightmail-Tracker | H4sIAAAAAAAAA+NgFmpnluLIzCtJLcpLzFFi42I5/e+xgG7s74OhBnefG1kcvF9v0bx4PZvF 5V1z2CwWLWtltnhweCe7A6vH/rlr2D36tqxi9Dh+YzuTx+dNcgEsUVw2Kak5mWWpRfp2CVwZ 8283sRcsl6poXbyLqYFxr2gXIweHhICJxMlXIl2MnECmmMSFe+vZuhi5OIQEljJKbPu5nhHC +ckosWbCHSaQKjYBHYkt3ycwgtgiAgIS619cYgcpYhZoZJR49LCdFSQhLOAtsWndY7AiFgFV iVnL/7OB2LwCrhIfW5uZINbJSZw8NhmsnlPATeLgs7NgNUJANb/abrNNYORdwMiwilEitSC5 oDgpPdcwL7Vcrzgxt7g0L10vOT93EyM4eJ5J7WA8uMv9EKMAB6MSD+8H54OhQqyJZcWVuYcY JTiYlUR41/0ACvGmJFZWpRblxxeV5qQWH2KU5mBREueV3bA5VEggPbEkNTs1tSC1CCbLxMEp 1cB4Sa52S9gCm5b6aPP1P/tW/+TaNFsv/uvyZbcKzql3aZ+zu/emVHbrgWA28e8TjntWzrv8 Yp2IgpfPvLQ9wgedNlQof7DiLs78pTLLYQ3T+l9Rnb+uO7+5F7/fvXGu193EgpP/fSu2LtGX X7royjO9uL/5329ZHg6NfpjIfvOA213vdREvmLRSlViKMxINtZiLihMBkK/uLRoCAAA= |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 102 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Robert Baldyga <r.baldyga@samsung.com> |
| X-Original-Date | Wed, 05 Aug 2015 14:02:08 +0200 |
| X-Original-Message-ID | <1438776130-29716-7-git-send-email-r.baldyga@samsung.com> |
| X-Original-References | <1438776130-29716-1-git-send-email-r.baldyga@samsung.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1200681 |
Show key headers only | View raw
Add 'match_ep' callback to utilize chip-specific knowledge in endpoint matching
process. Function does the same that was done by chip-specific code inside
of epautoconf. Now this code can be removed from there to separate generic code
from platform specific logic.
Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
---
drivers/usb/gadget/epautoconf.c | 20 ++------------------
drivers/usb/gadget/udc/goku_udc.c | 25 +++++++++++++++++++++++++
2 files changed, 27 insertions(+), 18 deletions(-)
diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c
index 0ff5134..574b6a4 100644
--- a/drivers/usb/gadget/epautoconf.c
+++ b/drivers/usb/gadget/epautoconf.c
@@ -86,24 +86,8 @@ struct usb_ep *usb_ep_autoconfig_ss(
/* First, apply chip-specific "best usage" knowledge.
* This might make a good usb_gadget_ops hook ...
*/
- if (gadget_is_goku(gadget)) {
- if (USB_ENDPOINT_XFER_INT == type) {
- /* single buffering is enough */
- ep = gadget_find_ep_by_name(gadget, "ep3-bulk");
- if (ep && usb_gadget_ep_match_desc(gadget,
- ep, desc, ep_comp))
- goto found_ep;
- } else if (USB_ENDPOINT_XFER_BULK == type
- && (USB_DIR_IN & desc->bEndpointAddress)) {
- /* DMA may be available */
- ep = gadget_find_ep_by_name(gadget, "ep2-bulk");
- if (ep && usb_gadget_ep_match_desc(gadget,
- ep, desc, ep_comp))
- goto found_ep;
- }
-
#ifdef CONFIG_BLACKFIN
- } else if (gadget_is_musbhdrc(gadget)) {
+ if (gadget_is_musbhdrc(gadget)) {
if ((USB_ENDPOINT_XFER_BULK == type) ||
(USB_ENDPOINT_XFER_ISOC == type)) {
if (USB_DIR_IN & desc->bEndpointAddress)
@@ -119,8 +103,8 @@ struct usb_ep *usb_ep_autoconfig_ss(
ep = NULL;
if (ep && usb_gadget_ep_match_desc(gadget, ep, desc, ep_comp))
goto found_ep;
-#endif
}
+#endif
/* Second, look at endpoints until an unclaimed one looks usable */
list_for_each_entry (ep, &gadget->ep_list, ep_list) {
diff --git a/drivers/usb/gadget/udc/goku_udc.c b/drivers/usb/gadget/udc/goku_udc.c
index 46b8d14..d5a93ea 100644
--- a/drivers/usb/gadget/udc/goku_udc.c
+++ b/drivers/usb/gadget/udc/goku_udc.c
@@ -990,6 +990,30 @@ static int goku_get_frame(struct usb_gadget *_gadget)
return -EOPNOTSUPP;
}
+static struct usb_ep *goku_match_ep(struct usb_gadget *g,
+ struct usb_endpoint_descriptor *desc,
+ struct usb_ss_ep_comp_descriptor *ep_comp)
+{
+ struct goku_udc *dev = to_goku_udc(g);
+ struct usb_ep *ep;
+ u8 type = usb_endpoint_type(desc);
+
+ if (type == USB_ENDPOINT_XFER_INT) {
+ /* single buffering is enough */
+ ep = &dev->ep[3].ep;
+ if (ep && usb_gadget_ep_match_desc(g, ep, desc, ep_comp))
+ return ep;
+ } else if (type == USB_ENDPOINT_XFER_BULK
+ && usb_endpoint_dir_in(desc)) {
+ /* DMA may be available */
+ ep = &dev->ep[2].ep;
+ if (ep && usb_gadget_ep_match_desc(g, ep, desc, ep_comp))
+ return ep;
+ }
+
+ return NULL;
+}
+
static int goku_udc_start(struct usb_gadget *g,
struct usb_gadget_driver *driver);
static int goku_udc_stop(struct usb_gadget *g);
@@ -998,6 +1022,7 @@ static const struct usb_gadget_ops goku_ops = {
.get_frame = goku_get_frame,
.udc_start = goku_udc_start,
.udc_stop = goku_udc_stop,
+ .match_ep = goku_match_ep,
// no remote wakeup
// not selfpowered
};
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH v6 0/8] usb: gadget: rework ep matching and claiming mechanism Robert Baldyga <r.baldyga@samsung.com> - 2015-08-05 14:10 +0200 [PATCH v6 8/8] usb: gadget: remove gadget_chips.h Robert Baldyga <r.baldyga@samsung.com> - 2015-08-05 14:10 +0200 [PATCH v6 6/8] usb: gadget: goku_udc: add goku_match_ep() function Robert Baldyga <r.baldyga@samsung.com> - 2015-08-05 14:10 +0200
csiph-web