Skip to contentSkip to conversation

USB: Add usb_event_poll() to get keyboards working with EHCI

PATCH New Marek Vasut 3 participants 11 messages Sep 23, 2011 – Oct 8, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 USB: Add usb_event_poll() to get keyboards working with EHCI

---
 drivers/usb/host/ehci-hcd.c |   33 ++++++++++++++++++++++++++++++++-
 1 files changed, 32 insertions(+), 1 deletions(-)
drivers/usb/host/ehci-hcd.c +32 -1
index 52b98c2..5b53b3a 100644
@@ -27,6 +27,10 @@
 #include <malloc.h>
 #include <watchdog.h>
 #include <usb/ehci-fsl.h>
+#ifdef CONFIG_USB_KEYBOARD
+#include <stdio_dev.h>
+extern unsigned char new[];
+#endif
 
 #include "ehci.h"
 
@@ -914,5 +918,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 */
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH 1/1 USB: Add usb_event_poll() to get keyboards working with EHCI

Hi,

2011/9/23 Marek Vasut <[email protected]>:

Quoted 22 lines

---
?drivers/usb/host/ehci-hcd.c | ? 33 ++++++++++++++++++++++++++++++++- ?1 files changed, 32 insertions(+), 1 deletions(-)

drivers/usb/host/ehci-hcd.c +0 -0
index 52b98c2..5b53b3a 100644
@@ -27,6 +27,10 @@

?#include <malloc.h>
?#include <watchdog.h>
?#include <usb/ehci-fsl.h>

drivers/usb/host/ehci-hcd.c +4 -0
+#ifdef CONFIG_USB_KEYBOARD
+#include <stdio_dev.h>
+extern unsigned char new[];
+#endif

?#include "ehci.h"

drivers/usb/host/ehci-hcd.c submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer, · line 921

Quoted 5 lines
drivers/usb/host/ehci-hcd.c +1 -1
@@ -914,5 +918,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);

Why is changing this line needed?

Quoted 18 lines
drivers/usb/host/ehci-hcd.c +18 -0
+}
+
+#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;

drivers/usb/host/ehci-hcd.c submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer, · line 949

Quoted 10 lines
drivers/usb/host/ehci-hcd.c +9 -0
+ ? ? ? 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 */

Patch does not apply to u-boot-usb master.
Please rebase this patch.

Kind regards,

Remy

#2 lore raw

PATCH 1/1 USB: Add usb_event_poll() to get keyboards working with EHCI

Quoted 27 lines · Remy Bohmer

Hi,

2011/9/23 Marek Vasut <[email protected]>:

Quoted 24 lines
---
 drivers/usb/host/ehci-hcd.c |   33 ++++++++++++++++++++++++++++++++-
 1 files changed, 32 insertions(+), 1 deletions(-)
drivers/usb/host/ehci-hcd.c +4 -0
index 52b98c2..5b53b3a 100644
@@ -27,6 +27,10 @@
 #include <malloc.h>
 #include <watchdog.h>
 #include <usb/ehci-fsl.h>
+#ifdef CONFIG_USB_KEYBOARD
+#include <stdio_dev.h>
+extern unsigned char new[];
+#endif
 
 #include "ehci.h"
 
@@ -914,5 +918,32 @@ submit_int_msg(struct usb_device *dev, unsigned long
 pipe, void *buffer,
 
Quoted 6 lines

drivers/usb/host/ehci-hcd.c submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer, · line 921

Quoted 4 lines
drivers/usb/host/ehci-hcd.c +1 -1
       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);

Why is changing this line needed?

To actually submit the interrupt request ?

Quoted 24 lines
Quoted 24 lines
drivers/usb/host/ehci-hcd.c +23 -0
+}
+
+#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 */
Quoted 8 lines

drivers/usb/host/ehci-hcd.c submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer, · line 949

Quoted 5 lines
drivers/usb/host/ehci-hcd.c +4 -0
+       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 */

Patch does not apply to u-boot-usb master.
Please rebase this patch.

Ah right ... there must be some changes in my repo or u-boot-imx/next ... will do in my next submission round.

Cheers

Quoted 4 lines

Kind regards,

Remy

#3 lore raw

PATCH 1/1 USB: Add usb_event_poll() to get keyboards working with EHCI

Hi,

2011/9/24 Marek Vasut <[email protected]>:

Quoted 28 lines · Remy Bohmer
Quoted 27 lines

Hi,

2011/9/23 Marek Vasut <[email protected]>:

Quoted 24 lines

---
?drivers/usb/host/ehci-hcd.c | ? 33 ++++++++++++++++++++++++++++++++- ?1 files changed, 32 insertions(+), 1 deletions(-)

drivers/usb/host/ehci-hcd.c +0 -0
index 52b98c2..5b53b3a 100644
@@ -27,6 +27,10 @@

?#include <malloc.h>
?#include <watchdog.h>
?#include <usb/ehci-fsl.h>

drivers/usb/host/ehci-hcd.c +4 -0
+#ifdef CONFIG_USB_KEYBOARD
+#include <stdio_dev.h>
+extern unsigned char new[];
+#endif

?#include "ehci.h"

drivers/usb/host/ehci-hcd.c +0 -0
@@ -914,5 +918,32 @@ submit_int_msg(struct usb_device *dev, unsigned long
 pipe, void *buffer,
 
Quoted 8 lines
Quoted 6 lines

drivers/usb/host/ehci-hcd.c submit_int_msg(struct usb_device *dev, unsigned long · line 922

Quoted 4 lines
drivers/usb/host/ehci-hcd.c +1 -1
 ? ? ? ?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);

Why is changing this line needed?

To actually submit the interrupt request ?

Was just checking... at first impression it appeared to be some unrelated change. While looking at it in its context it seems indeed logical.

Quoted 2 lines

Ah right ... there must be some changes in my repo or u-boot-imx/next ... will do in my next submission round.

OK. I will pull it in then.

Kind regards,

Remy

#4 lore raw

PATCH v2 1/1 USB: Add usb_event_poll() to get keyboards working with EHCI

In reply to Marek Vasut
---
 drivers/usb/host/ehci-hcd.c |   33 ++++++++++++++++++++++++++++++++-
 1 files changed, 32 insertions(+), 1 deletions(-)

V2: Drop redundant bogus header.

drivers/usb/host/ehci-hcd.c +32 -1
index 83ac8b1..41928a2 100644
@@ -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 */
Signature · 1 line
1.7.5.4
#5 lore raw

PATCH v2 1/1 USB: Add usb_event_poll() to get keyboards working with EHCI

Dear Marek Vasut,

Quoted 7 lines · In message <[email protected]> you wrote:
---
 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

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"The pathology is to want control, not that you ever get it,  because
of course you never do."                            - Gregory Bateson
#6 lore raw

PATCH v2 1/1 USB: Add usb_event_poll() to get keyboards working with EHCI

Dear Wolfgang Denk,

Quoted 3 lines

Dear Marek Vasut,

In message <[email protected]> you

Quoted 11 lines · wrote:
Quoted 8 lines

---

 drivers/usb/host/ehci-hcd.c |   33 ++++++++++++++++++++++++++++++++-
 1 files changed, 32 insertions(+), 1 deletions(-)

V2: Drop redundant bogus header.

Checkpatch says:

Quoted 7 lines

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

#7 lore raw

PATCH v2 1/1 USB: Add usb_event_poll() to get keyboards working with EHCI

Dear Marek Vasut,

Quoted 6 lines · In message <[email protected]> you wrote:
Quoted 6 lines

Checkpatch says:

total: 0 errors, 1 warnings, 43 lines checked

Please clean up and resubmit. Thanks.

...

Quoted 5 lines

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

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
When it is incorrect, it is, at least *authoritatively* incorrect.
                                    - Hitchiker's Guide To The Galaxy
#8 lore raw

PATCH v2 1/1 USB: Add usb_event_poll() to get keyboards working with EHCI

Quoted 15 lines · Wolfgang Denk

Dear Marek Vasut,

Quoted 5 lines · In message <[email protected]> you wrote:
Quoted 5 lines

Checkpatch says:

total: 0 errors, 1 warnings, 43 lines checked

Please clean up and resubmit. Thanks.

...

Quoted 4 lines

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.

Quoted 5 lines
Quoted 3 lines

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.

#9 lore raw

PATCH v2 1/1 USB: Add usb_event_poll() to get keyboards working with EHCI

Hi Marek,

2011/10/7 Marek Vasut <[email protected]>:

Quoted 16 lines · Wolfgang Denk
Quoted 15 lines

Dear Marek Vasut,

Quoted 5 lines · In message <[email protected]> you wrote:
Quoted 5 lines

Checkpatch says:

total: 0 errors, 1 warnings, 43 lines checked

Please clean up and resubmit. ?Thanks.

...

Quoted 4 lines

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.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

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