From patchwork Wed Sep 9 04:32:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 515675 X-Patchwork-Delegate: sjg@chromium.org 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 B7EA7140134 for ; Wed, 9 Sep 2015 14:34:05 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b=KSN1dizA; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 040894B7CC; Wed, 9 Sep 2015 06:34:02 +0200 (CEST) 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 8RYf92c1NqdE; Wed, 9 Sep 2015 06:34:01 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DD0A84B7DF; Wed, 9 Sep 2015 06:33:37 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E63984B796 for ; Wed, 9 Sep 2015 06:33:25 +0200 (CEST) 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 MDU3F7XvXafM for ; Wed, 9 Sep 2015 06:33:25 +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-ig0-f182.google.com (mail-ig0-f182.google.com [209.85.213.182]) by theia.denx.de (Postfix) with ESMTPS id 5967C4B795 for ; Wed, 9 Sep 2015 06:33:23 +0200 (CEST) Received: by igcpb10 with SMTP id pb10so95697465igc.1 for ; Tue, 08 Sep 2015 21:33:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=fbDobhG8jofAC7+YCfszyp9WXopDyFUf7TMdPXECUwU=; b=KSN1dizA/T0A+lynHY7M+uaYuZ2JtrkFEhbNjZwTPLb2+TC3kmBtDbn/4KRQ7ppJC8 /jy8feINTTDzVstgjg1j5/rKIygXPLiMTXzZxfCno/vzL43AZFUA8fRh1/llIZYlGE1Q pR9FdfAeeWCUwQ01Us/gxq7JNGFEdXKVqTVAs168xmejK13mIXQHCYnJzMCBed5IVcFl zGu7XO9GwYBu6zbByRp7v5XVXHbBqg9pl5feM0e+JXTzoWH8I9mIoyvh8Nrhkr/Dja2Q 34Q5SRDkwC7gNCqKnQi2aP1xpZ6a+1Uzi52mUrd02oZMmzDojihmqcEbbT1uOnrUIJ+w w97w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=fbDobhG8jofAC7+YCfszyp9WXopDyFUf7TMdPXECUwU=; b=F83d3LTG1HgA85CfIA2CUkxKfRES4jZjGS7tCTTfcLNmZSUgpbmbMmCAMfxOzZYC48 3TzepIkaiv25QErfZfC2t8d2tYLjldPrcyfd9dQfAKecV5xSFqqkjQTeOoWcOfkMCkzL XP6NimjkDlndRhF7yATrRQE0T/dS9wqWNhaQfEtJcpg8rY/hJWwAzntt/UwbhLu9ShfN 7Wa0mzqRT387Ev5PKek4unFnm04djwWntfGrjV/OtVKVHOOD5UlTYhnzUN0OoNN3UtAF ybTqno5bQuKCaICWkdxL6J8ou4xSaJs7n48IOoFo1mPmHQatb1Bv8WXpPsbsv2eeptuG CWpw== X-Gm-Message-State: ALoCoQmUOJr4HedtUbZFRGtku77EfJVSauzj107H1oA5gUi7Ctuhdvex2chwMmk0gQZoSNy3eUug X-Received: by 10.50.79.196 with SMTP id l4mr46051874igx.48.1441773201985; Tue, 08 Sep 2015 21:33:21 -0700 (PDT) Received: from kaki.bld.corp.google.com ([172.29.216.32]) by smtp.gmail.com with ESMTPSA id qh9sm935453igb.20.2015.09.08.21.33.19 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Sep 2015 21:33:21 -0700 (PDT) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 9E48A220E2F; Tue, 8 Sep 2015 22:33:18 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 8 Sep 2015 22:32:29 -0600 Message-Id: <1441773171-4575-7-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.6.0.rc0.131.gf624c3d In-Reply-To: <1441773171-4575-1-git-send-email-sjg@chromium.org> References: <1441773171-4575-1-git-send-email-sjg@chromium.org> Cc: Tom Rini , Jeroen Hofstee Subject: [U-Boot] [PATCH 06/28] dm: stdio: Plumb in the new keyboard uclass X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" When driver model is used for keyboards we must scan the available keyboards and register them with stdio. Add code to do this. At some point (once LCD/video is converted) we should be able to convert stdio to driver model and avoid these dual data structures. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- common/stdio.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/common/stdio.c b/common/stdio.c index adbfc89..71cc32e 100644 --- a/common/stdio.c +++ b/common/stdio.c @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -24,6 +25,8 @@ #include #endif +#include + DECLARE_GLOBAL_DATA_PTR; static struct stdio_dev devs; @@ -245,6 +248,32 @@ int stdio_init_tables(void) int stdio_add_devices(void) { +#ifdef CONFIG_DM_KEYBOARD + struct udevice *dev; + struct uclass *uc; + int ret; + + /* + * For now we probe all the devices here. At some point this should be + * done only when the devices are required - e.g. we have a list of + * input devices to start up in the stdin environment variable. That + * work probably makes more sense when stdio itself is converted to + * driver model. + * + * TODO(sjg@chromium.org): Convert changing uclass_first_device() etc. + * to return the device even on error. Then we could use that here. + */ + ret = uclass_get(UCLASS_KEYBOARD, &uc); + if (ret) + return ret; + + /* Don't report errors to the caller - assume that they are non-fatal */ + uclass_foreach_dev(dev, uc) { + ret = device_probe(dev); + if (ret) + printf("Failed to probe keyboard '%s'\n", dev->name); + } +#endif #ifdef CONFIG_SYS_I2C i2c_init_all(); #else @@ -258,7 +287,7 @@ int stdio_add_devices(void) #if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE) drv_video_init (); #endif -#ifdef CONFIG_KEYBOARD +#if defined(CONFIG_KEYBOARD) && !defined(CONFIG_DM_KEYBOARD) drv_keyboard_init (); #endif #ifdef CONFIG_LOGBUFFER