Convert all of CONFIG_CONS_INDEX to Kconfig
This converts the following to Kconfig:
CONFIG_CONS_INDEX
We have existing entries for this option in a number of places, with
different guards on them. They're also sometimes used for things not
directly inside of the serial driver. First, introduce a new symbol to
guard the use of CONFIG_CONS_INDEX, so that in the case where we don't
need this for the serial driver, but for some other use, we can still do
it. Next, consolidate all of these into the single entry in
drivers/serial/Kconfig. Finally, introduce CONS_INDEX_[023456] so that
we can imply a correct value here to make the defconfig side of this
smaller.
Signed-off-by: Adam Ford <aford173@gmail.com>
[trini: Rework a lot of the logic here, such that I took authorship from
Adam, but kept his S-o-B line]
Signed-off-by: Tom Rini <trini@konsulko.com>
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 93e602e..76d5e99 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -24,6 +24,15 @@
during serial port initialization (default y). Set this to n on
boards which have no debug serial port whatsoever.
+config SPECIFY_CONSOLE_INDEX
+ bool "Specify the port number used for console"
+ default y if !DM_SERIAL || (SPL && !SPL_DM_SERIAL) || \
+ (TPL && !TPL_DM_SERIAL)
+ help
+ In various cases, we need to specify which of the UART devices that
+ a board or SoC has available are to be used for the console device
+ in U-Boot.
+
config SERIAL_PRESENT
bool "Provide a serial driver"
depends on DM_SERIAL
@@ -44,16 +53,39 @@
This option enables the full UART in SPL, so if is it disabled,
the full UART driver will be omitted, thus saving space.
+# Logic to allow us to use the imply keyword to set what the default port
+# should be. The default is otherwise 1.
+config CONS_INDEX_0
+ bool
+
+config CONS_INDEX_2
+ bool
+
+config CONS_INDEX_3
+ bool
+
+config CONS_INDEX_4
+ bool
+
+config CONS_INDEX_5
+ bool
+
+config CONS_INDEX_6
+ bool
+
config CONS_INDEX
int "UART used for console"
- depends on ARCH_SUNXI
- default 2 if MACH_SUN5I
- default 5 if MACH_SUN8I_A23 || MACH_SUN8I_A33
+ depends on SPECIFY_CONSOLE_INDEX
+ range 0 6
+ default 0 if CONS_INDEX_0
+ default 2 if CONS_INDEX_2
+ default 3 if CONS_INDEX_3
+ default 4 if CONS_INDEX_4
+ default 5 if CONS_INDEX_5
+ default 6 if CONS_INDEX_6
default 1
help
- Configures the console index.
- For Allwinner SoC., default values are 2 for SUN5I and 5 for A23/A33.
- Otherwise, the index equals 1.
+ Set this to match the UART number of the serial console.
config DM_SERIAL
bool "Enable Driver Model for serial drivers"
@@ -93,8 +125,8 @@
config SPL_DM_SERIAL
bool "Enable Driver Model for serial drivers in SPL"
- depends on DM_SERIAL
- default y if SPL && DM_SERIAL
+ depends on DM_SERIAL && SPL_DM
+ default y
help
Enable driver model for serial in SPL. This replaces
drivers/serial/serial.c with the serial uclass, which