From patchwork Sun Sep 25 19:07:56 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 116318 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 28824B6F68 for ; Mon, 26 Sep 2011 05:08:08 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B84BB28286; Sun, 25 Sep 2011 21:08:06 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cN495NWoMvQ7; Sun, 25 Sep 2011 21:08:06 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8E83D2827E; Sun, 25 Sep 2011 21:08:04 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 378E62827E for ; Sun, 25 Sep 2011 21:08:02 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fvNSGUwAxgf1 for ; Sun, 25 Sep 2011 21:08:01 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-bw0-f44.google.com (mail-bw0-f44.google.com [209.85.214.44]) by theia.denx.de (Postfix) with ESMTPS id 85A142827B for ; Sun, 25 Sep 2011 21:07:59 +0200 (CEST) Received: by bkaq10 with SMTP id q10so4679387bka.3 for ; Sun, 25 Sep 2011 12:07:59 -0700 (PDT) Received: by 10.204.142.146 with SMTP id q18mr3712697bku.384.1316977679606; Sun, 25 Sep 2011 12:07:59 -0700 (PDT) Received: from mashiro.ms.mff.cuni.cz (eduroam32.ms.mff.cuni.cz. [195.113.21.32]) by mx.google.com with ESMTPS id t18sm18238062bkb.9.2011.09.25.12.07.58 (version=SSLv3 cipher=OTHER); Sun, 25 Sep 2011 12:07:59 -0700 (PDT) From: Marek Vasut To: u-boot@lists.denx.de Date: Sun, 25 Sep 2011 21:07:56 +0200 Message-Id: <1316977676-10284-1-git-send-email-marek.vasut@gmail.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1316792213-18385-1-git-send-email-marek.vasut@gmail.com> References: <1316792213-18385-1-git-send-email-marek.vasut@gmail.com> Subject: [U-Boot] [PATCH V2] USB: Add usb_event_poll() to get keyboards working with EHCI X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Signed-off-by: Marek Vasut Cc: Remy Bohmer --- drivers/usb/host/ehci-hcd.c | 33 ++++++++++++++++++++++++++++++++- 1 files changed, 32 insertions(+), 1 deletions(-) V2: Drop redundant bogus header. 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 #include #include +#ifdef CONFIG_USB_KEYBOARD +#include +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 */