From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V5 03/18] usb: echi-hcd: add usb_lowlevel_init_device
Date: Fri, 27 Sep 2013 22:41:07 +0200 [thread overview]
Message-ID: <201309272241.07870.marex@denx.de> (raw)
In-Reply-To: <5245E492.8000602@boundarydevices.com>
Dear Troy Kisky,
> On 9/27/2013 10:54 AM, Marek Vasut wrote:
> > Dear Troy Kisky,
> >
> >> Use this function so that we can verify the OTG_ID
> >> pin is high and device mode should be activated.
> >>
> >> Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
> >>
> >> ---
> >> v5: new patch
> >> ---
> >>
> >> drivers/usb/gadget/mv_udc.c | 2 +-
> >> drivers/usb/host/ehci-hcd.c | 13 +++++++++++++
> >> include/usb.h | 1 +
> >> 3 files changed, 15 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/usb/gadget/mv_udc.c b/drivers/usb/gadget/mv_udc.c
> >> index b87119c..ecd11d7 100644
> >> --- a/drivers/usb/gadget/mv_udc.c
> >> +++ b/drivers/usb/gadget/mv_udc.c
> >> @@ -684,7 +684,7 @@ int usb_gadget_register_driver(struct
> >> usb_gadget_driver *driver) if (driver->speed != USB_SPEED_FULL &&
> >> driver->speed != USB_SPEED_HIGH) return -EINVAL;
> >>
> >> - ret = usb_lowlevel_init(0, (void **)&controller.ctrl);
> >> + ret = usb_lowlevel_init_device(0, (void **)&controller.ctrl);
> >
> > You're crafting a new undocumented API here :-(
> >
> >> if (ret)
> >>
> >> return ret;
> >>
> >> diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
> >> index fdad739..dbea756 100644
> >> --- a/drivers/usb/host/ehci-hcd.c
> >> +++ b/drivers/usb/host/ehci-hcd.c
> >> @@ -1004,6 +1004,19 @@ int usb_lowlevel_init(int index, void
> >> **controller)
> >>
> >> return 0;
> >>
> >> }
> >>
> >> +int usb_lowlevel_init_device(int index, void **controller)
> >> +{
> >> + int rc = ehci_hcd_init(index, &ehcic[index].hccr, &ehcic[index].hcor);
> >> +
> >> + /* rc == 0 means host mode, failure for us */
> >
> > This looks pretty error-prone. A much better idea would be to use
> > usb_lowlevel_init() and add a flag to init the controller in either
> > device or host mode. That way you'd not even have to craft this strange
> > new API.
>
> How would you like the last parameter?
>
> Like "[PATCH v4] usb: new board-specific USB init interface"
>
> enum board_usb_init_type {
> USB_INIT_HOST,
> USB_INIT_DEVICE
> };
>
> Or just a plain int device_mode ?
>
> Should I wait for you to apply the above referenced patch before resending
> ?
Which one? I applied and pushed all I could.
> Should I add the same parameter to ehci_hcd_init ?
Makes sense, no ?
> And just to be perfectly clear, you want me to add the parameter to all 19
> current occurrences of usb_lowlevel_init ?
Yes, it does make sense, does it not? But look at the last take of this patch
here:
http://patchwork.ozlabs.org/patch/273911/
I'm sure some cooperation on this API would be in place now
[...]
Best regards,
Marek Vasut
next prev parent reply other threads:[~2013-09-27 20:41 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-26 1:41 [U-Boot] [PATCH V5 00/18] Make mv_udc work for i.mx6 Troy Kisky
2013-09-26 1:41 ` [U-Boot] [PATCH V5 01/18] usb: gadget: mv_udc: don't check CONFIG_USB_MAX_CONTROLLER_COUNT Troy Kisky
2013-09-26 1:41 ` [U-Boot] [PATCH V5 02/18] usb: ehci-mx6: add support for host mode otg port Troy Kisky
2013-09-27 17:50 ` Marek Vasut
2013-09-27 19:47 ` Troy Kisky
2013-09-27 20:42 ` Marek Vasut
2013-09-27 22:22 ` Troy Kisky
2013-09-28 0:57 ` Marek Vasut
2013-09-26 1:41 ` [U-Boot] [PATCH V5 03/18] usb: echi-hcd: add usb_lowlevel_init_device Troy Kisky
2013-09-27 17:54 ` Marek Vasut
2013-09-27 20:03 ` Troy Kisky
2013-09-27 20:41 ` Marek Vasut [this message]
2013-09-26 1:41 ` [U-Boot] [PATCH V5 04/18] usb: gadget: ether set wMaxPacketSize Troy Kisky
2013-09-27 17:54 ` Marek Vasut
2013-09-26 1:41 ` [U-Boot] [PATCH V5 05/18] usb: gadget: ether: return error from rx_submit if no request Troy Kisky
2013-09-27 17:55 ` Marek Vasut
2013-09-26 1:41 ` [U-Boot] [PATCH V5 06/18] usb: gadget: mv_udc: split mv_udc.h file Troy Kisky
2013-09-26 1:41 ` [U-Boot] [PATCH V5 07/18] usb: udc: add udc.h include file Troy Kisky
2013-09-27 17:57 ` Marek Vasut
2013-09-27 20:07 ` Troy Kisky
2013-09-26 1:41 ` [U-Boot] [PATCH V5 08/18] usb: gadget: mv_udc: fix typo in error message Troy Kisky
2013-09-27 17:58 ` Marek Vasut
2013-09-26 1:41 ` [U-Boot] [PATCH V5 09/18] usb: gadget: mv_udc: set is_dualspeed = 1 Troy Kisky
2013-09-27 17:58 ` Marek Vasut
2013-09-26 1:41 ` [U-Boot] [PATCH V5 10/18] usb: gadget: mv_udc: fix full speed connections Troy Kisky
2013-09-27 18:00 ` Marek Vasut
2013-09-27 20:13 ` Troy Kisky
2013-09-27 20:38 ` Marek Vasut
2013-09-26 1:41 ` [U-Boot] [PATCH V5 11/18] usb: gadget: mv_udc: optimize bounce Troy Kisky
2013-09-26 1:41 ` [U-Boot] [PATCH V5 12/18] usb: gadget: mv_udc: flush item before head Troy Kisky
2013-09-27 18:01 ` Marek Vasut
2013-09-26 1:41 ` [U-Boot] [PATCH V5 13/18] usb: gadget: mv_udc: optimize ep_enable Troy Kisky
2013-09-26 1:41 ` [U-Boot] [PATCH V5 14/18] usb: gadget: mv_udc: zero transfer descriptor memory on probe Troy Kisky
2013-09-27 18:01 ` Marek Vasut
2013-09-26 1:41 ` [U-Boot] [PATCH V5 15/18] usb: gadget: mv_udc: clear desc upon ep_disable Troy Kisky
2013-09-27 18:02 ` Marek Vasut
2013-09-26 1:41 ` [U-Boot] [PATCH V5 16/18] mx6: iomux: add GPR1 defines for use with nitrogen6x Troy Kisky
2013-09-26 1:41 ` [U-Boot] [PATCH V5 17/18] nitrogen6x: add otg usb host/device mode support Troy Kisky
2013-09-26 1:41 ` [U-Boot] [PATCH V5 18/18] nitrogen6x: add CONFIG_MV_UDC Troy Kisky
2013-09-26 16:18 ` [U-Boot] [PATCH V5 00/18] Make mv_udc work for i.mx6 Stefano Babic
2013-09-26 19:13 ` Troy Kisky
2013-09-26 20:24 ` Marek Vasut
2013-09-27 18:03 ` Marek Vasut
2013-09-27 20:14 ` Troy Kisky
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=201309272241.07870.marex@denx.de \
--to=marex@denx.de \
--cc=u-boot@lists.denx.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox