define UART_CONSOLE_INDEX using Kconfig
Use Kconfig to define this variable and remove its
previous definitions from board.h. This will simplify
creation of different variants from a single platform.
Change-Id: I0aaa5aa81dedf096c6d8c1ea2d509c71817336d3
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
diff --git a/arch/arc/defconfig b/arch/arc/defconfig
index 77dd180..5af6a6e 100644
--- a/arch/arc/defconfig
+++ b/arch/arc/defconfig
@@ -80,6 +80,7 @@
#
# CONFIG_UART_SIMPLE is not set
# CONFIG_CONSOLE_HANDLER is not set
+CONFIG_UART_CONSOLE_INDEX=0
#
# Serial Drivers
diff --git a/arch/arm/configs/micro_fsl_frdm_k64f_defconfig b/arch/arm/configs/micro_fsl_frdm_k64f_defconfig
index f71c115..a25c82a 100644
--- a/arch/arm/configs/micro_fsl_frdm_k64f_defconfig
+++ b/arch/arm/configs/micro_fsl_frdm_k64f_defconfig
@@ -121,6 +121,7 @@
#
# CONFIG_UART_SIMPLE is not set
# CONFIG_CONSOLE_HANDLER is not set
+CONFIG_UART_CONSOLE_INDEX=0
#
# Serial Drivers
diff --git a/arch/arm/configs/micro_ti_lm3s6965_defconfig b/arch/arm/configs/micro_ti_lm3s6965_defconfig
index 6d2c1eb..34bad8e 100644
--- a/arch/arm/configs/micro_ti_lm3s6965_defconfig
+++ b/arch/arm/configs/micro_ti_lm3s6965_defconfig
@@ -121,6 +121,7 @@
#
# CONFIG_UART_SIMPLE is not set
# CONFIG_CONSOLE_HANDLER is not set
+CONFIG_UART_CONSOLE_INDEX=0
#
# Serial Drivers
diff --git a/arch/arm/configs/nano_fsl_frdm_k64f_defconfig b/arch/arm/configs/nano_fsl_frdm_k64f_defconfig
index a35c73f..81420da 100644
--- a/arch/arm/configs/nano_fsl_frdm_k64f_defconfig
+++ b/arch/arm/configs/nano_fsl_frdm_k64f_defconfig
@@ -100,6 +100,7 @@
#
# CONFIG_UART_SIMPLE is not set
# CONFIG_CONSOLE_HANDLER is not set
+CONFIG_UART_CONSOLE_INDEX=0
#
# Serial Drivers
diff --git a/arch/arm/configs/nano_ti_lm3s6965_defconfig b/arch/arm/configs/nano_ti_lm3s6965_defconfig
index 73c68e8..232b09a 100644
--- a/arch/arm/configs/nano_ti_lm3s6965_defconfig
+++ b/arch/arm/configs/nano_ti_lm3s6965_defconfig
@@ -100,6 +100,7 @@
#
# CONFIG_UART_SIMPLE is not set
# CONFIG_CONSOLE_HANDLER is not set
+CONFIG_UART_CONSOLE_INDEX=0
#
# Serial Drivers
diff --git a/arch/arm/defconfig b/arch/arm/defconfig
index f71c115..a25c82a 100644
--- a/arch/arm/defconfig
+++ b/arch/arm/defconfig
@@ -121,6 +121,7 @@
#
# CONFIG_UART_SIMPLE is not set
# CONFIG_CONSOLE_HANDLER is not set
+CONFIG_UART_CONSOLE_INDEX=0
#
# Serial Drivers
diff --git a/arch/arm/fsl_frdm_k64f/board.h b/arch/arm/fsl_frdm_k64f/board.h
index dacd73c..8457910 100644
--- a/arch/arm/fsl_frdm_k64f/board.h
+++ b/arch/arm/fsl_frdm_k64f/board.h
@@ -213,7 +213,6 @@
/* Uart console settings */
-#define CONFIG_UART_CONSOLE_INDEX 0
#define CONFIG_UART_CONSOLE_PORT PCR_PORT_B
#define CONFIG_UART_CONSOLE_PORT_RX_PIN 16
#define CONFIG_UART_CONSOLE_PORT_TX_PIN 17
diff --git a/arch/arm/ti_lm3s6965/board.h b/arch/arm/ti_lm3s6965/board.h
index 708aa34..b3f198f 100644
--- a/arch/arm/ti_lm3s6965/board.h
+++ b/arch/arm/ti_lm3s6965/board.h
@@ -136,7 +136,6 @@
/* Uart console configuration */
-#define CONFIG_UART_CONSOLE_INDEX 0
#define CONFIG_UART_CONSOLE_BAUDRATE 115200
#define CONFIG_UART_CONSOLE_IRQ IRQ_UART0
#define CONFIG_UART_CONSOLE_INT_PRI 3
diff --git a/arch/x86/configs/micro_generic_pc_atom_n28xx_defconfig b/arch/x86/configs/micro_generic_pc_atom_n28xx_defconfig
index 0eeebed..5f26f40 100644
--- a/arch/x86/configs/micro_generic_pc_atom_n28xx_defconfig
+++ b/arch/x86/configs/micro_generic_pc_atom_n28xx_defconfig
@@ -141,6 +141,7 @@
# CONFIG_PCI is not set
CONFIG_PLATFORM="generic_pc"
CONFIG_LOAPIC_TIMER_FREQ=150000000
+CONFIG_UART_CONSOLE_INDEX=0
#
# Device Drivers
diff --git a/arch/x86/configs/micro_generic_pc_defconfig b/arch/x86/configs/micro_generic_pc_defconfig
index cca4287..ca8ae1b 100644
--- a/arch/x86/configs/micro_generic_pc_defconfig
+++ b/arch/x86/configs/micro_generic_pc_defconfig
@@ -139,6 +139,7 @@
#
# CONFIG_PCI is not set
CONFIG_PLATFORM="generic_pc"
+CONFIG_UART_CONSOLE_INDEX=0
#
# Device Drivers
diff --git a/arch/x86/configs/micro_generic_pc_minuteia_defconfig b/arch/x86/configs/micro_generic_pc_minuteia_defconfig
index 67f276c..5f783d3 100644
--- a/arch/x86/configs/micro_generic_pc_minuteia_defconfig
+++ b/arch/x86/configs/micro_generic_pc_minuteia_defconfig
@@ -136,6 +136,7 @@
#
# CONFIG_PCI is not set
CONFIG_PLATFORM="generic_pc"
+CONFIG_UART_CONSOLE_INDEX=0
#
# Device Drivers
diff --git a/arch/x86/configs/micro_generic_pc_pentium4_defconfig b/arch/x86/configs/micro_generic_pc_pentium4_defconfig
index cca4287..ca8ae1b 100644
--- a/arch/x86/configs/micro_generic_pc_pentium4_defconfig
+++ b/arch/x86/configs/micro_generic_pc_pentium4_defconfig
@@ -139,6 +139,7 @@
#
# CONFIG_PCI is not set
CONFIG_PLATFORM="generic_pc"
+CONFIG_UART_CONSOLE_INDEX=0
#
# Device Drivers
diff --git a/arch/x86/configs/micro_quark_defconfig b/arch/x86/configs/micro_quark_defconfig
index 3a35e73..9f3a29b 100644
--- a/arch/x86/configs/micro_quark_defconfig
+++ b/arch/x86/configs/micro_quark_defconfig
@@ -138,6 +138,7 @@
CONFIG_PCI=y
# CONFIG_PCI_DEBUG is not set
CONFIG_PLATFORM="quark"
+CONFIG_UART_CONSOLE_INDEX=1
#
# Device Drivers
diff --git a/arch/x86/configs/nano_generic_pc_atom_n28xx_defconfig b/arch/x86/configs/nano_generic_pc_atom_n28xx_defconfig
index 9b706d4..f1e2f66 100644
--- a/arch/x86/configs/nano_generic_pc_atom_n28xx_defconfig
+++ b/arch/x86/configs/nano_generic_pc_atom_n28xx_defconfig
@@ -120,6 +120,7 @@
# CONFIG_PCI is not set
CONFIG_PLATFORM="generic_pc"
CONFIG_LOAPIC_TIMER_FREQ=150000000
+CONFIG_UART_CONSOLE_INDEX=0
#
# Device Drivers
diff --git a/arch/x86/configs/nano_generic_pc_defconfig b/arch/x86/configs/nano_generic_pc_defconfig
index 50f8b64..2a5eb1c 100644
--- a/arch/x86/configs/nano_generic_pc_defconfig
+++ b/arch/x86/configs/nano_generic_pc_defconfig
@@ -118,6 +118,7 @@
#
# CONFIG_PCI is not set
CONFIG_PLATFORM="generic_pc"
+CONFIG_UART_CONSOLE_INDEX=0
#
# Device Drivers
diff --git a/arch/x86/configs/nano_generic_pc_minuteia_defconfig b/arch/x86/configs/nano_generic_pc_minuteia_defconfig
index c854e6c..545eb11 100644
--- a/arch/x86/configs/nano_generic_pc_minuteia_defconfig
+++ b/arch/x86/configs/nano_generic_pc_minuteia_defconfig
@@ -115,6 +115,7 @@
#
# CONFIG_PCI is not set
CONFIG_PLATFORM="generic_pc"
+CONFIG_UART_CONSOLE_INDEX=0
#
# Device Drivers
diff --git a/arch/x86/configs/nano_generic_pc_pentium4_defconfig b/arch/x86/configs/nano_generic_pc_pentium4_defconfig
index 50f8b64..2a5eb1c 100644
--- a/arch/x86/configs/nano_generic_pc_pentium4_defconfig
+++ b/arch/x86/configs/nano_generic_pc_pentium4_defconfig
@@ -118,6 +118,7 @@
#
# CONFIG_PCI is not set
CONFIG_PLATFORM="generic_pc"
+CONFIG_UART_CONSOLE_INDEX=0
#
# Device Drivers
diff --git a/arch/x86/configs/nano_quark_defconfig b/arch/x86/configs/nano_quark_defconfig
index a613b3c..1f46baa 100644
--- a/arch/x86/configs/nano_quark_defconfig
+++ b/arch/x86/configs/nano_quark_defconfig
@@ -117,6 +117,7 @@
CONFIG_PCI=y
# CONFIG_PCI_DEBUG is not set
CONFIG_PLATFORM="quark"
+CONFIG_UART_CONSOLE_INDEX=1
#
# Device Drivers
diff --git a/arch/x86/defconfig b/arch/x86/defconfig
index 3a35e73..9f3a29b 100644
--- a/arch/x86/defconfig
+++ b/arch/x86/defconfig
@@ -138,6 +138,7 @@
CONFIG_PCI=y
# CONFIG_PCI_DEBUG is not set
CONFIG_PLATFORM="quark"
+CONFIG_UART_CONSOLE_INDEX=1
#
# Device Drivers
diff --git a/arch/x86/generic_pc/board.h b/arch/x86/generic_pc/board.h
index c7a9822..c24648d 100644
--- a/arch/x86/generic_pc/board.h
+++ b/arch/x86/generic_pc/board.h
@@ -142,7 +142,6 @@
}
/* Console definitions */
-#define CONFIG_UART_CONSOLE_INDEX 0
#define CONFIG_UART_CONSOLE_IRQ COM1_INT_LVL
#define CONFIG_UART_CONSOLE_INT_PRI COM1_INT_PRI
diff --git a/arch/x86/quark/Kconfig b/arch/x86/quark/Kconfig
index b7e5e38..4fb9173 100644
--- a/arch/x86/quark/Kconfig
+++ b/arch/x86/quark/Kconfig
@@ -45,3 +45,5 @@
config SYS_CLOCK_HW_CYCLES_PER_SEC
default 25000000
+config UART_CONSOLE_INDEX
+ default 1
diff --git a/arch/x86/quark/board.h b/arch/x86/quark/board.h
index 0034eea..9589461 100644
--- a/arch/x86/quark/board.h
+++ b/arch/x86/quark/board.h
@@ -105,7 +105,6 @@
(CONFIG_UART_NUM_SYSTEM_PORTS + CONFIG_UART_NUM_EXTRA_PORTS)
/* Console definitions */
-#define CONFIG_UART_CONSOLE_INDEX 1
#define CONFIG_UART_CONSOLE_PCI_IDX COM1_PCI_IDX
/*
diff --git a/drivers/console/Kconfig b/drivers/console/Kconfig
index 03f072d..4e6ba97 100644
--- a/drivers/console/Kconfig
+++ b/drivers/console/Kconfig
@@ -38,3 +38,9 @@
help
This option enables console input handler allowing to write simple
interaction between serial console and the OS.
+
+config UART_CONSOLE_INDEX
+ int "UART Console Index"
+ default 0
+ help
+ This option specifies index for the console uart port.