diff mbox

[U-Boot,V2] USB: Add usb_event_poll() to get keyboards working with EHCI

Message ID 1316977676-10284-1-git-send-email-marek.vasut@gmail.com
State Changes Requested
Headers show

Commit Message

Marek Vasut Sept. 25, 2011, 7:07 p.m. UTC
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Remy Bohmer <linux@bohmer.net>
---
 drivers/usb/host/ehci-hcd.c |   33 ++++++++++++++++++++++++++++++++-
 1 files changed, 32 insertions(+), 1 deletions(-)

V2: Drop redundant bogus header.

Comments

Wolfgang Denk Oct. 6, 2011, 9:21 p.m. UTC | #1
Dear Marek Vasut,

In message <1316977676-10284-1-git-send-email-marek.vasut@gmail.com> you wrote:
> Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
> Cc: Remy Bohmer <linux@bohmer.net>
> ---
>  drivers/usb/host/ehci-hcd.c |   33 ++++++++++++++++++++++++++++++++-
>  1 files changed, 32 insertions(+), 1 deletions(-)
> 
> V2: Drop redundant bogus header.

Checkpatch says:

total: 0 errors, 1 warnings, 43 lines checked

Please clean up and resubmit.  Thanks.

Best regards,

Wolfgang Denk
Marek Vasut Oct. 6, 2011, 11:30 p.m. UTC | #2
Dear Wolfgang Denk,

> Dear Marek Vasut,
> 
> In message <1316977676-10284-1-git-send-email-marek.vasut@gmail.com> you 
wrote:
> > Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
> > Cc: Remy Bohmer <linux@bohmer.net>
> > ---
> > 
> >  drivers/usb/host/ehci-hcd.c |   33 ++++++++++++++++++++++++++++++++-
> >  1 files changed, 32 insertions(+), 1 deletions(-)
> > 
> > V2: Drop redundant bogus header.
> 
> Checkpatch says:
> 
> total: 0 errors, 1 warnings, 43 lines checked
> 
> Please clean up and resubmit.  Thanks.
> 
> Best regards,
> 
> Wolfgang Denk

The extern-stuff checkpatch is complaining about is a problem with usbkbd.c . 
The file needs cleanup, badly, only then we can get rid of those externs.

I'd prefer to get this applied and then cleanup the usbkbd.c. The musb driver 
suffers the same trouble, so it can be cleaned up with this together.

Cheers
Wolfgang Denk Oct. 7, 2011, 5:25 a.m. UTC | #3
Dear Marek Vasut,

In message <201110070130.14881.marek.vasut@gmail.com> you wrote:
> 
> > Checkpatch says:
> > 
> > total: 0 errors, 1 warnings, 43 lines checked
> > 
> > Please clean up and resubmit.  Thanks.
...
> The extern-stuff checkpatch is complaining about is a problem with usbkbd.c . 
> The file needs cleanup, badly, only then we can get rid of those externs.
> 
> I'd prefer to get this applied and then cleanup the usbkbd.c. The musb driver 
> suffers the same trouble, so it can be cleaned up with this together.

If Remy accepts this, I'm fine with it, too.

Best regards,

Wolfgang Denk
Marek Vasut Oct. 7, 2011, 8:55 a.m. UTC | #4
On Friday, October 07, 2011 07:25:22 AM Wolfgang Denk wrote:
> Dear Marek Vasut,
> 
> In message <201110070130.14881.marek.vasut@gmail.com> you wrote:
> > > Checkpatch says:
> > > 
> > > total: 0 errors, 1 warnings, 43 lines checked
> > > 
> > > Please clean up and resubmit.  Thanks.
> 
> ...
> 
> > The extern-stuff checkpatch is complaining about is a problem with
> > usbkbd.c . The file needs cleanup, badly, only then we can get rid of
> > those externs.
> > 
> > I'd prefer to get this applied and then cleanup the usbkbd.c. The musb
> > driver suffers the same trouble, so it can be cleaned up with this
> > together.
> 
> If Remy accepts this, I'm fine with it, too.

I'm adding the cleanup to my todo.
Remy Bohmer Oct. 8, 2011, 6:27 p.m. UTC | #5
Hi Marek,

2011/10/7 Marek Vasut <marek.vasut@gmail.com>:
> On Friday, October 07, 2011 07:25:22 AM Wolfgang Denk wrote:
>> Dear Marek Vasut,
>>
>> In message <201110070130.14881.marek.vasut@gmail.com> you wrote:
>> > > Checkpatch says:
>> > >
>> > > total: 0 errors, 1 warnings, 43 lines checked
>> > >
>> > > Please clean up and resubmit.  Thanks.
>>
>> ...
>>
>> > The extern-stuff checkpatch is complaining about is a problem with
>> > usbkbd.c . The file needs cleanup, badly, only then we can get rid of
>> > those externs.
>> >
>> > I'd prefer to get this applied and then cleanup the usbkbd.c. The musb
>> > driver suffers the same trouble, so it can be cleaned up with this
>> > together.
>>
>> If Remy accepts this, I'm fine with it, too.
>
> I'm adding the cleanup to my todo.

I am looking forward to the cleanup.
In the mean time I will pull it in.

Kind regards,

Remy
Remy Bohmer Oct. 8, 2011, 6:28 p.m. UTC | #6
Hi,

2011/9/25 Marek Vasut <marek.vasut@gmail.com>:
> Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
> Cc: Remy Bohmer <linux@bohmer.net>
> ---
>  drivers/usb/host/ehci-hcd.c |   33 ++++++++++++++++++++++++++++++++-
>  1 files changed, 32 insertions(+), 1 deletions(-)
>
> V2: Drop redundant bogus header.
>

Applied to u-boot-usb

Kind regards,

Remy
diff mbox

Patch

diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 83ac8b1..41928a2 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -26,6 +26,10 @@ 
 #include <asm/io.h>
 #include <malloc.h>
 #include <watchdog.h>
+#ifdef CONFIG_USB_KEYBOARD
+#include <stdio_dev.h>
+extern unsigned char new[];
+#endif
 
 #include "ehci.h"
 
@@ -911,5 +915,32 @@  submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
 
 	debug("dev=%p, pipe=%lu, buffer=%p, length=%d, interval=%d",
 	      dev, pipe, buffer, length, interval);
-	return -1;
+	return ehci_submit_async(dev, pipe, buffer, length, NULL);
+}
+
+#ifdef CONFIG_SYS_USB_EVENT_POLL
+/*
+ * This function polls for USB keyboard data.
+ */
+void usb_event_poll()
+{
+	struct stdio_dev *dev;
+	struct usb_device *usb_kbd_dev;
+	struct usb_interface *iface;
+	struct usb_endpoint_descriptor *ep;
+	int pipe;
+	int maxp;
+
+	/* Get the pointer to USB Keyboard device pointer */
+	dev = stdio_get_by_name("usbkbd");
+	usb_kbd_dev = (struct usb_device *)dev->priv;
+	iface = &usb_kbd_dev->config.if_desc[0];
+	ep = &iface->ep_desc[0];
+	pipe = usb_rcvintpipe(usb_kbd_dev, ep->bEndpointAddress);
+
+	/* Submit a interrupt transfer request */
+	maxp = usb_maxpacket(usb_kbd_dev, pipe);
+	usb_submit_int_msg(usb_kbd_dev, pipe, &new[0],
+			maxp > 8 ? 8 : maxp, ep->bInterval);
 }
+#endif /* CONFIG_SYS_USB_EVENT_POLL */