summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-12-04 11:13:42 -0700
committerCommit Bot <commit-bot@chromium.org>2020-12-05 02:48:13 +0000
commit8483283989e7d6080b1d757cf5309a97efd2950d (patch)
tree9b268c8f22fe8df8f02800580b64267a6e7ec273
parentb06ad2df42bd9c3c48e06df0645b526a1fc454e7 (diff)
downloadchrome-ec-8483283989e7d6080b1d757cf5309a97efd2950d.tar.gz
zephyr: Sort the options a bit
We have quite a few options already and plan to add more. Sort them to make it easier to see what is there. The I2C enum isn't really connected with the basic CONFIG munging done in config_chip.h so move it to i2c.h instead. Fix the 'keybaord' typo while we are here. BRANCH=none BUG=none TEST=build and boot on volteer Change-Id: Id03fe44ff859736f1e2f86231ca1e8d9dc4c50af Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2575198 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
-rw-r--r--zephyr/Kconfig144
-rw-r--r--zephyr/shim/include/config_chip.h72
-rw-r--r--zephyr/shim/include/i2c/i2c.h17
3 files changed, 121 insertions, 112 deletions
diff --git a/zephyr/Kconfig b/zephyr/Kconfig
index 1d5dd67fe3..d120530391 100644
--- a/zephyr/Kconfig
+++ b/zephyr/Kconfig
@@ -30,6 +30,43 @@ config ZEPHYR
This should always be enabled. It's a workaround for
config.h not being available in some headers.
+# Define PLATFORM_EC_... options to enable EC features. Each Kconfig should be
+# matched by a line in zephyr/shim/include/config_chip.h which #edefines the
+# corresponding EC CONFIG if this Kconfig is enabled.
+#
+# Please keep these in alphabetical order
+
+config PLATFORM_EC_CBI
+ bool "Enable the CBI EEPROM module"
+ depends on PLATFORM_EC_I2C
+ help
+ Enables various CBI accessors and host and console commands. One must
+ specify both I2C_PORT_EEPROM and I2C_ADDR_EEPROM_FLAGS to the CBI
+ EEPROM's i2c port and 7-bit i2c address.
+
+menuconfig PLATFORM_EC_ESPI
+ bool "Enable eSPI compatibility in platform/ec"
+ depends on ESPI && AP
+ default y
+ help
+ Enable eSPI shim layer.
+
+if PLATFORM_EC_ESPI
+
+config PLATFORM_EC_ESPI_VW_SLP_S3
+ bool "SLP_S3 is an eSPI virtual wire instead of a GPIO"
+ help
+ For power sequencing, use an eSPI virtual wire instead of
+ defining GPIO_PCH_SLP_S3 in gpio_map.h.
+
+config PLATFORM_EC_ESPI_VW_SLP_S4
+ bool "SLP_S4 is an eSPI virtual wire instead of a GPIO"
+ help
+ For power sequencing, use an eSPI virtual wire instead of
+ defining GPIO_PCH_SLP_S4 in gpio_map.h.
+
+endif # PLATFORM_EC_ESPI
+
config PLATFORM_EC_EXTPOWER_GPIO
bool "Enable the GPIO-based external power detection module"
depends on PLATFORM_EC_HOOKS && PLATFORM_EC_HOSTCMD
@@ -40,7 +77,7 @@ config PLATFORM_EC_EXTPOWER_GPIO
extpower_interrupt configured as the handler in gpio_map.h.
menuconfig PLATFORM_EC_KEYBOARD
- bool "Enable keybaord support"
+ bool "Enable keyboard support"
default y
help
Enable compilation of support for scanning a keyboard and providing
@@ -75,8 +112,6 @@ config PLATFORM_EC_KEYBOARD_COL2_INVERTED
Refresh key will also trigger T key, which is in the next scanning
column line. See http://b/156007029.
-endif # PLATFORM_EC_KEYBOARD
-
config PLATFORM_EC_CONSOLE_CMD_KEYBOARD_8042
bool "Enable the keyboard commands"
default y if PLATFORM_EC_KEYBOARD_PROTOCOL_8042
@@ -90,56 +125,7 @@ config PLATFORM_EC_CONSOLE_CMD_KEYBOARD_8042
kblog - Print or toggle keyboard event log (current disabled)
typematic - Get/set typematic delays
-menuconfig PLATFORM_EC_TIMER
- bool "Enable the EC timer module"
- default y
- help
- Enable compilation of the EC timer module
-
-if PLATFORM_EC_TIMER
-
-config PLATFORM_EC_TIMER_CMD_GETTIME
- bool "Enable the gettime command"
- default y
- help
- Enable the "gettime" command
-
-config PLATFORM_EC_TIMER_CMD_TIMERINFO
- bool "Enable the timerinfo command"
- default y
- help
- Enable the "timerinfo" command
-
-config PLATFORM_EC_TIMER_CMD_WAITMS
- bool "Enable the waitms command"
- default y
- help
- Enable the "waitms" command
-
-endif # PLATFORM_EC_TIMER
-
-menuconfig PLATFORM_EC_ESPI
- bool "Enable eSPI compatibility in platform/ec"
- depends on ESPI && AP
- default y
- help
- Enable eSPI shim layer.
-
-if PLATFORM_EC_ESPI
-
-config PLATFORM_EC_ESPI_VW_SLP_S3
- bool "SLP_S3 is an eSPI virtual wire instead of a GPIO"
- help
- For power sequencing, use an eSPI virtual wire instead of
- defining GPIO_PCH_SLP_S3 in gpio_map.h.
-
-config PLATFORM_EC_ESPI_VW_SLP_S4
- bool "SLP_S4 is an eSPI virtual wire instead of a GPIO"
- help
- For power sequencing, use an eSPI virtual wire instead of
- defining GPIO_PCH_SLP_S4 in gpio_map.h.
-
-endif # PLATFORM_EC_ESPI
+endif # PLATFORM_EC_KEYBOARD
config PLATFORM_EC_HOOKS
bool "Enable hooks and deferred compatibility shim"
@@ -149,6 +135,16 @@ config PLATFORM_EC_HOOKS
hook_call_deferred to Zephyr's work queues, and a compatible
DECLARE_HOOK implementation.
+config PLATFORM_EC_I2C
+ bool "Enable the EC i2c module"
+ default y
+ help
+ Enable compilation of the EC i2c module. Once enabled, it will be
+ possible to make calls using the old platform/ec i2c APIs defined
+ in include/i2c.h and implemented in common/i2c_master.c. Doing so
+ should make shimming other platform/ec modules which rely on i2c
+ communication "just work" without requiring any further code changes.
+
config PLATFORM_EC_HOSTCMD
bool "Enable host commands shim"
default y if AP
@@ -162,16 +158,6 @@ config PLATFORM_EC_LID_SWITCH
commands in platform/ec. This requires a GPIO named
GPIO_LID_OPEN to be defined in gpio_map.h.
-config PLATFORM_EC_I2C
- bool "Enable the EC i2c module"
- default y
- help
- Enable compilation of the EC i2c module. Once enabled, it will be
- possible to make calls using the old platform/ec i2c APIs defined
- in include/i2c.h and implemented in common/i2c_master.c. Doing so
- should make shimming other platform/ec modules which rely on i2c
- communication "just work" without requiring any further code changes.
-
config PLATFORM_EC_PORT80
bool "Enable the port80 module"
default y if AP_X86 && PLATFORM_EC_POWERSEQ
@@ -187,12 +173,32 @@ config PLATFORM_EC_POWER_BUTTON
commands in platform/ec. This requires a GPIO named
GPIO_POWER_BUTTON_L in gpio_map.h.
-config PLATFORM_EC_CBI
- bool "Enable the CBI EEPROM module"
- depends on PLATFORM_EC_I2C
+menuconfig PLATFORM_EC_TIMER
+ bool "Enable the EC timer module"
+ default y
help
- Enables various CBI accessors and host and console commands. One must
- specify both I2C_PORT_EEPROM and I2C_ADDR_EEPROM_FLAGS to the CBI
- EEPROM's i2c port and 7-bit i2c address.
+ Enable compilation of the EC timer module
+
+if PLATFORM_EC_TIMER
+
+config PLATFORM_EC_TIMER_CMD_GETTIME
+ bool "Enable the gettime command"
+ default y
+ help
+ Enable the "gettime" command
+
+config PLATFORM_EC_TIMER_CMD_TIMERINFO
+ bool "Enable the timerinfo command"
+ default y
+ help
+ Enable the "timerinfo" command
+
+config PLATFORM_EC_TIMER_CMD_WAITMS
+ bool "Enable the waitms command"
+ default y
+ help
+ Enable the "waitms" command
+
+endif # PLATFORM_EC_TIMER
endif # PLATFORM_EC
diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h
index 2c1a588fc6..5fbefc7125 100644
--- a/zephyr/shim/include/config_chip.h
+++ b/zephyr/shim/include/config_chip.h
@@ -26,6 +26,35 @@
#define CONFIG_CHIPSET_TIGERLAKE
#endif
+/* eSPI signals */
+#ifdef CONFIG_PLATFORM_EC_ESPI_VW_SLP_S3
+#define CONFIG_HOSTCMD_ESPI_VW_SLP_S3
+#endif
+
+#ifdef CONFIG_PLATFORM_EC_ESPI_VW_SLP_S4
+#define CONFIG_HOSTCMD_ESPI_VW_SLP_S4
+#endif
+
+#ifdef CONFIG_PLATFORM_EC_I2C
+/* Also see shim/include/i2c/i2c.h which defines the ports enum */
+#define CONFIG_I2C
+#endif
+
+#undef CONFIG_KEYBOARD_PROTOCOL_8042
+#ifdef CONFIG_PLATFORM_EC_KEYBOARD_PROTOCOL_8042
+#define CONFIG_KEYBOARD_PROTOCOL_8042
+#endif /* CONFIG_PLATFORM_EC_KEYBOARD_PROTOCOL_8042 */
+
+#undef CONFIG_CMD_KEYBOARD
+#ifdef CONFIG_PLATFORM_EC_CONSOLE_CMD_KEYBOARD_8042
+#define CONFIG_CMD_KEYBOARD
+#endif
+
+#undef CONFIG_KEYBOARD_COL2_INVERTED
+#ifdef CONFIG_PLATFORM_EC_KEYBOARD_COL2_INVERTED
+#define CONFIG_KEYBOARD_COL2_INVERTED
+#endif /* CONFIG_PLATFORM_EC_KEYBOARD_COL2_INVERTED */
+
#ifdef CONFIG_PLATFORM_EC_POWERSEQ_CPU_PROCHOT_ACTIVE_LOW
#define CONFIG_CHIPSET_CPU_PROCHOT_ACTIVE_LOW
#endif
@@ -60,16 +89,6 @@
#define CONFIG_CMD_GETTIME
#endif /* CONFIG_PLATFORM_EC_TIMER_CMD_GETTIME */
-#undef CONFIG_CMD_KEYBOARD
-#ifdef CONFIG_PLATFORM_EC_CONSOLE_CMD_KEYBOARD_8042
-#define CONFIG_CMD_KEYBOARD
-#endif
-
-#undef CONFIG_KEYBOARD_PROTOCOL_8042
-#ifdef CONFIG_PLATFORM_EC_KEYBOARD_PROTOCOL_8042
-#define CONFIG_KEYBOARD_PROTOCOL_8042
-#endif /* CONFIG_PLATFORM_EC_KEYBOARD_PROTOCOL_8042 */
-
#undef CONFIG_CMD_TIMERINFO
#ifdef CONFIG_PLATFORM_EC_TIMER_CMD_TIMERINFO
#define CONFIG_CMD_TIMERINFO
@@ -82,20 +101,6 @@
#endif /* CONFIG_PLATFORM_EC_TIMER */
-/* eSPI signals */
-#ifdef CONFIG_PLATFORM_EC_ESPI_VW_SLP_S3
-#define CONFIG_HOSTCMD_ESPI_VW_SLP_S3
-#endif
-
-#ifdef CONFIG_PLATFORM_EC_ESPI_VW_SLP_S4
-#define CONFIG_HOSTCMD_ESPI_VW_SLP_S4
-#endif
-
-#undef CONFIG_KEYBOARD_COL2_INVERTED
-#ifdef CONFIG_PLATFORM_EC_KEYBOARD_COL2_INVERTED
-#define CONFIG_KEYBOARD_COL2_INVERTED
-#endif /* CONFIG_PLATFORM_EC_KEYBOARD_COL2_INVERTED */
-
/*
* Load the chip family specific header. Normally for npcx, this would be done
* by chip/npcx/config_chip.h but since this file is replacing that header
@@ -107,23 +112,4 @@
#include "config_chip-npcx7.h"
#endif /* CHIP_FAMILY_NPCX7 */
-#ifdef CONFIG_PLATFORM_EC_I2C
-#define CONFIG_I2C
-
-/*
- * Define the i2c_ports enum for Ztests only right now. In full builds this
- * will clash with the definitions in config_chip-npcx7.h. Once we've migrated
- * away from platform/ec/chip/... files we can remove this guard.
- */
-#if defined(CONFIG_ZTEST) && DT_NODE_EXISTS(DT_PATH(named_i2c_ports))
-#define I2C_PORT(id) DT_CAT(I2C_, id)
-#define I2C_PORT_WITH_COMMA(id) I2C_PORT(id),
-enum i2c_ports {
-DT_FOREACH_CHILD(DT_PATH(named_i2c_ports), I2C_PORT_WITH_COMMA)
-I2C_PORT_COUNT
-};
-#define NAMED_I2C(name) I2C_PORT(DT_PATH(named_i2c_ports, name))
-#endif /* CONFIG_ZTEST && named_i2c_ports */
-#endif /* CONFIG_PLATFORM_EC_I2C */
-
#endif /* __CROS_EC_CONFIG_CHIP_H */
diff --git a/zephyr/shim/include/i2c/i2c.h b/zephyr/shim/include/i2c/i2c.h
index 289f8b753e..2ac31c06bf 100644
--- a/zephyr/shim/include/i2c/i2c.h
+++ b/zephyr/shim/include/i2c/i2c.h
@@ -9,6 +9,23 @@
#include <device.h>
#include <devicetree.h>
+#ifdef CONFIG_PLATFORM_EC_I2C
+/*
+ * Define the i2c_ports enum for Ztests only right now. In full builds this
+ * will clash with the definitions in config_chip-npcx7.h. Once we've migrated
+ * away from platform/ec/chip/... files we can remove this guard.
+ */
+#if defined(CONFIG_ZTEST) && DT_NODE_EXISTS(DT_PATH(named_i2c_ports))
+#define I2C_PORT(id) DT_CAT(I2C_, id)
+#define I2C_PORT_WITH_COMMA(id) I2C_PORT(id),
+enum i2c_ports {
+DT_FOREACH_CHILD(DT_PATH(named_i2c_ports), I2C_PORT_WITH_COMMA)
+I2C_PORT_COUNT
+};
+#define NAMED_I2C(name) I2C_PORT(DT_PATH(named_i2c_ports, name))
+#endif /* CONFIG_ZTEST && named_i2c_ports */
+#endif /* CONFIG_PLATFORM_EC_I2C */
+
/**
* @brief Adaptation of platform/ec's port IDs which map a port/bus to a device.
*