From: Hans de Goede <hdegoede@redhat.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 6/7] usb: kbd: Cache pipe, interval and packetsize
Date: Sun, 21 Sep 2014 19:54:33 +0200 [thread overview]
Message-ID: <541F10D9.3010906@redhat.com> (raw)
In-Reply-To: <CAOf5uw=JCA0KzfmWM5L0fYEHtC5doYA5XXryyct6VosBkE0jLw@mail.gmail.com>
Hi,
On 09/20/2014 07:53 PM, Michael Trimarchi wrote:
> Hi
>
> On Sat, Sep 20, 2014 at 5:01 PM, Hans de Goede <hdegoede@redhat.com> wrote:
>> Instead of looking them up every time we need them.
>>
>
> split subject and patch description
>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> ---
>> common/usb_kbd.c | 34 +++++++++++++---------------------
>> 1 file changed, 13 insertions(+), 21 deletions(-)
>>
>> diff --git a/common/usb_kbd.c b/common/usb_kbd.c
>> index cb869ac..85ee1c8 100644
>> --- a/common/usb_kbd.c
>> +++ b/common/usb_kbd.c
>> @@ -99,6 +99,10 @@ static const unsigned char usb_kbd_arrow[] = {
>> #define USB_KBD_BOOT_REPORT_SIZE 8
>>
>> struct usb_kbd_pdata {
>> + unsigned long intpipe;
>
> unsigned int intpipe ??
usb "pipe"-s are unsigned long everywhere in u-boot.
Regards,
Hans
>
> Michael
>
>> + int intpktsize;
>> + int intinterval;
>> +
>> uint32_t repeat_delay;
>>
>> uint32_t usb_in_pointer;
>> @@ -305,23 +309,11 @@ static int usb_kbd_irq(struct usb_device *dev)
>> static inline void usb_kbd_poll_for_event(struct usb_device *dev)
>> {
>> #if defined(CONFIG_SYS_USB_EVENT_POLL)
>> - struct usb_interface *iface;
>> - struct usb_endpoint_descriptor *ep;
>> - struct usb_kbd_pdata *data;
>> - int pipe;
>> - int maxp;
>> -
>> - /* Get the pointer to USB Keyboard device pointer */
>> - data = dev->privptr;
>> - iface = &dev->config.if_desc[0];
>> - ep = &iface->ep_desc[0];
>> - pipe = usb_rcvintpipe(dev, ep->bEndpointAddress);
>> + struct usb_kbd_pdata *data = dev->privptr;
>>
>> /* Submit a interrupt transfer request */
>> - maxp = usb_maxpacket(dev, pipe);
>> - usb_submit_int_msg(dev, pipe, &data->new[0],
>> - min(maxp, USB_KBD_BOOT_REPORT_SIZE),
>> - ep->bInterval);
>> + usb_submit_int_msg(dev, data->intpipe, &data->new[0], data->intpktsize,
>> + data->intinterval);
>>
>> usb_kbd_irq_worker(dev);
>> #elif defined(CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP)
>> @@ -389,7 +381,6 @@ static int usb_kbd_probe(struct usb_device *dev, unsigned int ifnum)
>> struct usb_interface *iface;
>> struct usb_endpoint_descriptor *ep;
>> struct usb_kbd_pdata *data;
>> - int pipe, maxp;
>>
>> if (dev->descriptor.bNumConfigurations != 1)
>> return 0;
>> @@ -438,8 +429,10 @@ static int usb_kbd_probe(struct usb_device *dev, unsigned int ifnum)
>> /* Set IRQ handler */
>> dev->irq_handle = usb_kbd_irq;
>>
>> - pipe = usb_rcvintpipe(dev, ep->bEndpointAddress);
>> - maxp = usb_maxpacket(dev, pipe);
>> + data->intpipe = usb_rcvintpipe(dev, ep->bEndpointAddress);
>> + data->intpktsize = min(usb_maxpacket(dev, data->intpipe),
>> + USB_KBD_BOOT_REPORT_SIZE);
>> + data->intinterval = ep->bInterval;
>>
>> /* We found a USB Keyboard, install it. */
>> usb_set_protocol(dev, iface->desc.bInterfaceNumber, 0);
>> @@ -448,9 +441,8 @@ static int usb_kbd_probe(struct usb_device *dev, unsigned int ifnum)
>> usb_set_idle(dev, iface->desc.bInterfaceNumber, REPEAT_RATE, 0);
>>
>> debug("USB KBD: enable interrupt pipe...\n");
>> - if (usb_submit_int_msg(dev, pipe, data->new,
>> - min(maxp, USB_KBD_BOOT_REPORT_SIZE),
>> - ep->bInterval) < 0) {
>> + if (usb_submit_int_msg(dev, data->intpipe, data->new, data->intpktsize,
>> + data->intinterval) < 0) {
>> printf("Failed to get keyboard state from device %04x:%04x\n",
>> dev->descriptor.idVendor, dev->descriptor.idProduct);
>> /* Abort, we don't want to use that non-functional keyboard. */
>> --
>> 2.1.0
>>
>> _______________________________________________
>> U-Boot mailing list
>> U-Boot at lists.denx.de
>> http://lists.denx.de/mailman/listinfo/u-boot
>
>
>
next prev parent reply other threads:[~2014-09-21 17:54 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-20 15:01 [U-Boot] [PATCH 0/7] Add a better USB keyboard polling method Hans de Goede
2014-09-20 15:01 ` [U-Boot] [PATCH 1/7] usb: ehci: Do not disable an already disabled periodic schedule Hans de Goede
2014-09-20 15:01 ` [U-Boot] [PATCH 2/7] usb: ehci: Move interrupt packet length check to create_int_queue Hans de Goede
2014-09-20 17:42 ` Michael Trimarchi
2014-09-21 17:53 ` Hans de Goede
2014-09-21 19:36 ` Marek Vasut
2014-09-21 20:00 ` Michael Trimarchi
2014-09-21 20:01 ` Marek Vasut
2014-09-20 15:01 ` [U-Boot] [PATCH 3/7] usb: ehci: Move cache invalidation to poll_int_queue Hans de Goede
2014-09-20 15:01 ` [U-Boot] [PATCH 4/7] usb: Make pollable int support available outside of ehci-hcd.c Hans de Goede
2014-09-20 15:01 ` [U-Boot] [PATCH 5/7] usb: kbd: Remove unused usb_kbd_generic_poll function Hans de Goede
2014-09-20 15:01 ` [U-Boot] [PATCH 6/7] usb: kbd: Cache pipe, interval and packetsize Hans de Goede
2014-09-20 17:53 ` Michael Trimarchi
2014-09-21 17:54 ` Hans de Goede [this message]
2014-09-20 15:01 ` [U-Boot] [PATCH 7/7] usb: kbd: Add (optional) support for using an interrupt queue for polling Hans de Goede
2014-09-20 15:18 ` Hans de Goede
2014-09-21 10:45 ` [U-Boot] [PATCH 0/7] Add a better USB keyboard polling method Marek Vasut
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=541F10D9.3010906@redhat.com \
--to=hdegoede@redhat.com \
--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 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.