Commit 5692ccfacae05175ffa5a8e9c12ef7bda3631433

Authored by Simon Glass
1 parent 892ff8e972

x86: video: Allow keyboard presence to be controlled by device tree

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 <sjg@chromium.org>

Showing 2 changed files with 37 additions and 8 deletions Side-by-side Diff

doc/README.fdt-control
... ... @@ -171,6 +171,22 @@
171 171 $ make DEVICE_TREE=<dts-file-name>
172 172  
173 173  
  174 +Configuration Options
  175 +---------------------
  176 +
  177 +A number of run-time configuration options are provided in the /config node
  178 +of the control device tree. You can access these using fdtdec_get_config_int(),
  179 +fdtdec_get_config_bool() and fdtdec_get_config_string().
  180 +
  181 +Available options are:
  182 +
  183 +silent-console
  184 + If present and non-zero, the console is silenced by default on boot.
  185 +
  186 +no-keyboard
  187 + Tells U-Boot not to expect an attached keyboard with a VGA console
  188 +
  189 +
174 190 Limitations
175 191 -----------
176 192  
drivers/video/cfb_console.c
... ... @@ -87,6 +87,7 @@
87 87 */
88 88  
89 89 #include <common.h>
  90 +#include <fdtdec.h>
90 91 #include <version.h>
91 92 #include <malloc.h>
92 93 #include <linux/compiler.h>
... ... @@ -2251,6 +2252,7 @@
2251 2252 {
2252 2253 int skip_dev_init;
2253 2254 struct stdio_dev console_dev;
  2255 + bool have_keyboard;
2254 2256  
2255 2257 /* Check if video initialization should be skipped */
2256 2258 if (board_video_skip())
2257 2259  
2258 2260  
... ... @@ -2262,11 +2264,20 @@
2262 2264 if (board_cfb_skip())
2263 2265 return 0;
2264 2266  
  2267 +#if defined(CONFIG_VGA_AS_SINGLE_DEVICE)
  2268 + have_keyboard = false;
  2269 +#elif defined(CONFIG_OF_CONTROL)
  2270 + have_keyboard = !fdtdec_get_config_bool(gd->fdt_blob,
  2271 + "u-boot,no-keyboard");
  2272 +#else
  2273 + have_keyboard = true;
  2274 +#endif
  2275 + if (have_keyboard) {
  2276 + debug("KBD: Keyboard init ...\n");
2265 2277 #if !defined(CONFIG_VGA_AS_SINGLE_DEVICE)
2266   - debug("KBD: Keyboard init ...\n");
2267   - skip_dev_init |= (VIDEO_KBD_INIT_FCT == -1);
  2278 + skip_dev_init |= (VIDEO_KBD_INIT_FCT == -1);
2268 2279 #endif
2269   -
  2280 + }
2270 2281 if (skip_dev_init)
2271 2282 return 0;
2272 2283  
... ... @@ -2279,11 +2290,13 @@
2279 2290 console_dev.puts = video_puts; /* 'puts' function */
2280 2291  
2281 2292 #if !defined(CONFIG_VGA_AS_SINGLE_DEVICE)
2282   - /* Also init console device */
2283   - console_dev.flags |= DEV_FLAGS_INPUT;
2284   - console_dev.tstc = VIDEO_TSTC_FCT; /* 'tstc' function */
2285   - console_dev.getc = VIDEO_GETC_FCT; /* 'getc' function */
2286   -#endif /* CONFIG_VGA_AS_SINGLE_DEVICE */
  2293 + if (have_keyboard) {
  2294 + /* Also init console device */
  2295 + console_dev.flags |= DEV_FLAGS_INPUT;
  2296 + console_dev.tstc = VIDEO_TSTC_FCT; /* 'tstc' function */
  2297 + console_dev.getc = VIDEO_GETC_FCT; /* 'getc' function */
  2298 + }
  2299 +#endif
2287 2300  
2288 2301 if (stdio_register(&console_dev) != 0)
2289 2302 return 0;