# Copyright 2020 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. if ZTEST config HAS_TEST_TASKS bool "Whether or not this test includes custom tasks." help This enables custom tasks for tests. When set to 'y', the file "shimmed_test_tasks.h" will be included and is expected to set CROS_EC_TASK_LIST. endif # ZTEST menuconfig PLATFORM_EC bool "Chromium OS EC shim" imply PRINTK imply SHELL help The platform/ec Zephyr module allows some code from the existing Chromium OS EC project to be "shimmed" into Zephyr. With this it is possible to use the existing code base within Zephyr. Once we manage to get a platform fully running with Zephyr we will progressively upstream components and turn off the shim for each one until eventually all code is on the Zephyr side. if PLATFORM_EC rsource "Kconfig.battery" rsource "Kconfig.powerseq" rsource "Kconfig.tasks" rsource "Kconfig.usbc" # Below is a hack to use CONFIG_ZEPHYR in platform/ec code before # config.h has been included. There is some tricky ordering in some # header files that we cannot use config.h (e.g., common.h and # compile_time_macros.h), as many board.h and config_chip.h files # use these macros, and thus would be included by an include of # config.h. We work around this by initially defining CONFIG_ZEPHYR # in Kconfig as an invisible symbol (it should always be enabled). # Then, once config.h gets included, it subsequently gets undef'ed by # config.h, and then redefined by config_chip.h in the Zephyr shim. config ZEPHYR bool default y help 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 #defines 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 help Enable shimming the extpower_gpio module, which provides GPIO-based external power presence detection features. The project should define a GPIO pin named GPIO_AC_PRESENT, with extpower_interrupt configured as the handler in gpio_map.h. config PLATFORM_EC_FLASH bool "Enable flash support" default y help Enables access to the device's flash through a simple API. With this is it possible for the EC to update its flash while running, e.g. to support auto-update. Various write-protection features are also provided. if PLATFORM_EC_FLASH config PLATFORM_EC_CONSOLE_CMD_FLASH bool "Enable the flash commands" default y help Enables various console commands: flashread - read from flash to memory flasherase - erase flash region flashwrite - write memory to flash flashwp - change write-protection settings config PLATFORM_EC_EXTERNAL_STORAGE bool "Flash is stored external to the EC" default y if SOC_FAMILY_NPCX help This indicates that the EC's flash is stored separately and is it not possible execute directly from it. Code must be loaded from the flash into internal SRAM before it can be executed. It is still possible to read and write the flash. config PLATFORM_EC_MAPPED_STORAGE bool "Flash is mapped into the EC's address space" default y if SOC_FAMILY_NPCX help This indicates that the EC's flash is directly mapped into its address space. This makes it easier to read and write the flash. If this is not defined, the flash driver must implement flash_physical_read(). endif # PLATFORM_EC_FLASH menuconfig PLATFORM_EC_KEYBOARD bool "Enable keyboard support" default y help Enable compilation of support for scanning a keyboard and providing the resulting input to the AP over the host interface. This consists of a keyboard-scanning task which provides key scans via it calling keyboard_state_changed() (for i8042) or its client calling keyboard_scan_get_state() (for MKBP). This implies HAS_TASK_KEYSCAN. if PLATFORM_EC_KEYBOARD config TASK_KEYSCAN_STACK_SIZE hex "keyscan task stack size" default 0x200 help The size of the keyboard scan task stack. choice "Protocol select" prompt "Select the keyboard protocol to use" config PLATFORM_EC_KEYBOARD_PROTOCOL_8042 bool "i8042" help Use the i8042 protocol to communicate with the AP. This dates from the Intel 8042 keyboard controller chip released in 1976. It uses two-way communication via a few 8-bit registers, allowing key codes to be sent to the AP when keys are pressed and released. See here for docs: https://wiki.osdev.org/%228042%22_PS/2_Controller endchoice # PLATFORM_EC_KEYBOARD config PLATFORM_EC_KEYBOARD_COL2_INVERTED bool "A mechanism for passing KSO2 to H1 which inverts the signal." help This option enables a mechanism for passing the column 2 to H1 which inverts the signal. The signal passing through H1 adds more delay. Need a larger delay value. Otherwise, pressing Refresh key will also trigger T key, which is in the next scanning column line. See http://b/156007029. config PLATFORM_EC_CONSOLE_CMD_KEYBOARD_8042 bool "Enable the keyboard commands" default y if PLATFORM_EC_KEYBOARD_PROTOCOL_8042 help Enable the '8042' command, which includes the following subcommands: codeset - Get/set keyboard codeset ctrlram - Get/set keyboard controller RAM internal - Show internal information kbd - Print or toggle keyboard info kblog - Print or toggle keyboard event log (current disabled) typematic - Get/set typematic delays endif # PLATFORM_EC_KEYBOARD config PLATFORM_EC_HOOKS bool "Enable hooks and deferred compatibility shim" default y help Enable translation of DECLARE_DEFERRED and 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. menuconfig PLATFORM_EC_HOSTCMD bool "Enable host commands shim" default y if AP help Enable the host commands shim in platform/ec. if PLATFORM_EC_HOSTCMD config TASK_HOSTCMD_STACK_SIZE hex "hostcmd task stack size" default 0x200 help The size of the host command task stack. endif # PLATFORM_EC_HOSTCMD config PLATFORM_EC_LID_SWITCH bool "Enable the lid switch module" help Enable shimming the lid switch implementation and related commands in platform/ec. This requires a GPIO named GPIO_LID_OPEN to be defined in gpio_map.h. config PLATFORM_EC_PORT80 bool "Enable the port80 module" default y if AP_X86 && PLATFORM_EC_POWERSEQ help Enable the port80 module, which will buffer calls to port_80_write and occasionally print when there's new writes. config PLATFORM_EC_POWER_BUTTON bool "Enable the power button module" depends on PLATFORM_EC_HOSTCMD help Enable shimming the power button implementation and related commands in platform/ec. This requires a GPIO named GPIO_POWER_BUTTON_L in gpio_map.h. config PLATFORM_EC_CONSOLE_CMD_SHMEM bool "Enable the 'shmem' command" default y help This command prints basic information about the EC shared memory, located at the top of RAM, above all RAM symbols: total size, bytes used and the maximum number of bytes that have been used since the EC started running. 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 endif # PLATFORM_EC