Browse Source

spl: input: Allow input in SPL and TPL

In some cases it is necessary to read the keyboard in early phases of
U-Boot. Update the config to allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass 6 years ago
parent
commit
985ca3945f
3 changed files with 59 additions and 5 deletions
  1. 48 0
      drivers/input/Kconfig
  2. 7 4
      drivers/input/Makefile
  3. 4 1
      drivers/input/input.c

+ 48 - 0
drivers/input/Kconfig

@@ -1,3 +1,16 @@
+config INPUT
+	bool "Enable input subsystem"
+	depends on DM
+	default y
+
+config SPL_INPUT
+	bool "Enable input subsystem for SPL"
+	depends on SPL_DM
+
+config TPL_INPUT
+	bool "Enable input subsystem for TPL"
+	depends on TPL_DM
+
 config DM_KEYBOARD
 config DM_KEYBOARD
 	bool "Enable driver model keyboard support"
 	bool "Enable driver model keyboard support"
 	depends on DM
 	depends on DM
@@ -7,8 +20,43 @@ config DM_KEYBOARD
 	  includes methods to start/stop the device, check for available
 	  includes methods to start/stop the device, check for available
 	  input and update LEDs if the keyboard has them.
 	  input and update LEDs if the keyboard has them.
 
 
+config SPL_DM_KEYBOARD
+	bool "Enable driver model keyboard support"
+	depends on SPL_DM
+	help
+	  This adds a uclass for keyboards and implements keyboard support
+	  using driver model. The API is implemented by keyboard.h and
+	  includes methods to start/stop the device, check for available
+	  input and update LEDs if the keyboard has them.
+
+config TPL_DM_KEYBOARD
+	bool "Enable driver model keyboard support"
+	depends on TPL_DM
+	help
+	  This adds a uclass for keyboards and implements keyboard support
+	  using driver model. The API is implemented by keyboard.h and
+	  includes methods to start/stop the device, check for available
+	  input and update LEDs if the keyboard has them.
+
 config CROS_EC_KEYB
 config CROS_EC_KEYB
 	bool "Enable Chrome OS EC keyboard support"
 	bool "Enable Chrome OS EC keyboard support"
+	depends on INPUT
+	help
+	  Most ARM Chromebooks use an EC to provide access to the keyboard.
+	  Messages are used to request key scans from the EC and these are
+	  then decoded into keys by this driver.
+
+config SPL_CROS_EC_KEYB
+	bool "Enable Chrome OS EC keyboard support in SPL"
+	depends on SPL_INPUT
+	help
+	  Most ARM Chromebooks use an EC to provide access to the keyboard.
+	  Messages are used to request key scans from the EC and these are
+	  then decoded into keys by this driver.
+
+config TPL_CROS_EC_KEYB
+	bool "Enable Chrome OS EC keyboard support in TPL"
+	depends on TPL_INPUT
 	help
 	help
 	  Most ARM Chromebooks use an EC to provide access to the keyboard.
 	  Most ARM Chromebooks use an EC to provide access to the keyboard.
 	  Messages are used to request key scans from the EC and these are
 	  Messages are used to request key scans from the EC and these are

+ 7 - 4
drivers/input/Makefile

@@ -3,12 +3,15 @@
 # (C) Copyright 2000-2007
 # (C) Copyright 2000-2007
 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
 
 
-obj-$(CONFIG_DM_KEYBOARD) += keyboard-uclass.o
+obj-y += input.o
+obj-$(CONFIG_$(SPL_TPL_)CROS_EC_KEYB) += cros_ec_keyb.o
+obj-$(CONFIG_$(SPL_TPL_)OF_CONTROL) += key_matrix.o
+obj-$(CONFIG_$(SPL_TPL_)DM_KEYBOARD) += keyboard-uclass.o
+
+ifndef CONFIG_SPL_BUILD
 
 
 obj-$(CONFIG_I8042_KEYB) += i8042.o
 obj-$(CONFIG_I8042_KEYB) += i8042.o
 obj-$(CONFIG_TEGRA_KEYBOARD) += tegra-kbc.o
 obj-$(CONFIG_TEGRA_KEYBOARD) += tegra-kbc.o
 obj-$(CONFIG_TWL4030_INPUT) += twl4030.o
 obj-$(CONFIG_TWL4030_INPUT) += twl4030.o
 obj-$(CONFIG_TWL6030_INPUT) += twl6030.o
 obj-$(CONFIG_TWL6030_INPUT) += twl6030.o
-obj-$(CONFIG_CROS_EC_KEYB) += cros_ec_keyb.o
-obj-y += input.o
-obj-$(CONFIG_$(SPL_)OF_CONTROL) += key_matrix.o
+endif

+ 4 - 1
drivers/input/input.c

@@ -652,7 +652,7 @@ int input_stdio_register(struct stdio_dev *dev)
 	int error;
 	int error;
 
 
 	error = stdio_register(dev);
 	error = stdio_register(dev);
-
+#if !defined(CONFIG_SPL_BUILD) || CONFIG_IS_ENABLED(ENV_SUPPORT)
 	/* check if this is the standard input device */
 	/* check if this is the standard input device */
 	if (!error && strcmp(env_get("stdin"), dev->name) == 0) {
 	if (!error && strcmp(env_get("stdin"), dev->name) == 0) {
 		/* reassign the console */
 		/* reassign the console */
@@ -660,6 +660,9 @@ int input_stdio_register(struct stdio_dev *dev)
 				console_assign(stdin, dev->name))
 				console_assign(stdin, dev->name))
 			return -1;
 			return -1;
 	}
 	}
+#else
+	error = error;
+#endif
 
 
 	return 0;
 	return 0;
 }
 }