From patchwork Mon Mar 2 19:40:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 445414 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 16CE1140140 for ; Tue, 3 Mar 2015 06:42:33 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7ED0CA743A; Mon, 2 Mar 2015 20:42:27 +0100 (CET) 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 hFEDCLqNvbb3; Mon, 2 Mar 2015 20:42:27 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 69DBBA7439; Mon, 2 Mar 2015 20:42:17 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AB28D4B6E2 for ; Mon, 2 Mar 2015 20:42:11 +0100 (CET) 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 tt8Frrf4QWsQ for ; Mon, 2 Mar 2015 20:42:11 +0100 (CET) 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-pd0-f202.google.com (mail-pd0-f202.google.com [209.85.192.202]) by theia.denx.de (Postfix) with ESMTPS id 258E04B6D5 for ; Mon, 2 Mar 2015 20:42:08 +0100 (CET) Received: by pdbfl12 with SMTP id fl12so2802686pdb.0 for ; Mon, 02 Mar 2015 11:42:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=RPcVXUNmDvwRnfY1eWfGi/HO/K5kHZgSCY4cKC9T76M=; b=KtqafifWteBYpzyfj2ew1oDVdR8nfUdo4SYlrSrM7C0SCEqNUWtEpUHl/F9+O0OpXD SUY5FAonlN1Db9jmdsS7SBhxjlmeWKPx3uAJNKhPdW0eizRQuOX2zYwWv6+16+nrCDrT Q4vHqQxoLsmciFAzUcWKgYwAdvnz648++R+qPk3u+jLN0ibo4JeF3Dh0T7PyURX2GpD6 /sJduIAX0dB3TOPF9bk5dh4XCVYJkA/YY6MyAQgSr+G6/uP0jyfvI7JfG5jPTn8ZhnYI sOYFUnz7Uya4RIBxYg6cADMFZm9qqkDKQ97FWNGm0lj9tucEMKAiUeY1yZT7U1AXeBy2 AcQw== X-Gm-Message-State: ALoCoQkWuzQnlKfq0893ptEniSIb0KK2hhuEQhbBzyG93iPb9xQHY1+xXxOHWKHLVlT5vG0VJ6f0 X-Received: by 10.66.100.198 with SMTP id fa6mr28021210pab.31.1425325326365; Mon, 02 Mar 2015 11:42:06 -0800 (PST) Received: from corpmail-nozzle1-2.hot.corp.google.com ([100.108.1.103]) by gmr-mx.google.com with ESMTPS id l42si511859yhq.1.2015.03.02.11.42.05 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Mar 2015 11:42:06 -0800 (PST) Received: from kaki.bld.corp.google.com ([172.29.216.32]) by corpmail-nozzle1-2.hot.corp.google.com with ESMTP id jFZSCUuD.1; Mon, 02 Mar 2015 11:42:06 -0800 Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id B1AFE22092A; Mon, 2 Mar 2015 12:42:05 -0700 (MST) From: Simon Glass To: U-Boot Mailing List Date: Mon, 2 Mar 2015 12:40:50 -0700 Message-Id: <1425325255-6267-2-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.2.0.rc0.207.ga3a616c In-Reply-To: <1425325255-6267-1-git-send-email-sjg@chromium.org> References: <1425325255-6267-1-git-send-email-sjg@chromium.org> Cc: Graeme Russ , Jon Loeliger Subject: [U-Boot] [PATCH v2 2/6] x86: video: Allow keyboard presence to be controlled by device tree 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" At present a VGA console assumes a keyboard unless a CONFIG option is set. This difference can be dealt with by a device tree option, allowing boards that are otherwise the same to use the same configuration. Signed-off-by: Simon Glass --- Changes in v2: - Correct #ifdef setup to avoid build errors on non-x86 boards doc/README.fdt-control | 16 ++++++++++++++++ drivers/video/cfb_console.c | 29 +++++++++++++++++++++-------- 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/doc/README.fdt-control b/doc/README.fdt-control index d8fe4a8..e6d5ed0 100644 --- a/doc/README.fdt-control +++ b/doc/README.fdt-control @@ -171,6 +171,22 @@ After board configuration is done, fdt supported u-boot can be build in two ways $ make DEVICE_TREE= +Configuration Options +--------------------- + +A number of run-time configuration options are provided in the /config node +of the control device tree. You can access these using fdtdec_get_config_int(), +fdtdec_get_config_bool() and fdtdec_get_config_string(). + +Available options are: + +silent-console + If present and non-zero, the console is silenced by default on boot. + +no-keyboard + Tells U-Boot not to expect an attached keyboard with a VGA console + + Limitations ----------- diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index a81affa..f4231b8 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -87,6 +87,7 @@ */ #include +#include #include #include #include @@ -2251,6 +2252,7 @@ int drv_video_init(void) { int skip_dev_init; struct stdio_dev console_dev; + bool have_keyboard; /* Check if video initialization should be skipped */ if (board_video_skip()) @@ -2262,11 +2264,20 @@ int drv_video_init(void) if (board_cfb_skip()) return 0; +#if defined(CONFIG_VGA_AS_SINGLE_DEVICE) + have_keyboard = false; +#elif defined(CONFIG_OF_CONTROL) + have_keyboard = !fdtdec_get_config_bool(gd->fdt_blob, + "u-boot,no-keyboard"); +#else + have_keyboard = true; +#endif + if (have_keyboard) { + debug("KBD: Keyboard init ...\n"); #if !defined(CONFIG_VGA_AS_SINGLE_DEVICE) - debug("KBD: Keyboard init ...\n"); - skip_dev_init |= (VIDEO_KBD_INIT_FCT == -1); + skip_dev_init |= (VIDEO_KBD_INIT_FCT == -1); #endif - + } if (skip_dev_init) return 0; @@ -2279,11 +2290,13 @@ int drv_video_init(void) console_dev.puts = video_puts; /* 'puts' function */ #if !defined(CONFIG_VGA_AS_SINGLE_DEVICE) - /* Also init console device */ - console_dev.flags |= DEV_FLAGS_INPUT; - console_dev.tstc = VIDEO_TSTC_FCT; /* 'tstc' function */ - console_dev.getc = VIDEO_GETC_FCT; /* 'getc' function */ -#endif /* CONFIG_VGA_AS_SINGLE_DEVICE */ + if (have_keyboard) { + /* Also init console device */ + console_dev.flags |= DEV_FLAGS_INPUT; + console_dev.tstc = VIDEO_TSTC_FCT; /* 'tstc' function */ + console_dev.getc = VIDEO_GETC_FCT; /* 'getc' function */ + } +#endif if (stdio_register(&console_dev) != 0) return 0;