summaryrefslogtreecommitdiff
path: root/zephyr/include/drivers
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2021-11-04 12:11:58 -0600
committerCommit Bot <commit-bot@chromium.org>2021-11-05 04:22:34 +0000
commit252457d4b21f46889eebad61d4c0a65331919cec (patch)
tree01856c4d31d710b20e85a74c8d7b5836e35c3b98 /zephyr/include/drivers
parent08f5a1e6fc2c9467230444ac9b582dcf4d9f0068 (diff)
downloadchrome-ec-252457d4b21f46889eebad61d4c0a65331919cec.tar.gz
In the interest of making long-term branch maintenance incur as little technical debt on us as possible, we should not maintain any files on the branch we are not actually using. This has the added effect of making it extremely clear when merging CLs from the main branch when changes have the possibility to affect us. The follow-on CL adds a convenience script to actually pull updates from the main branch and generate a CL for the update. BUG=b:204206272 BRANCH=ish TEST=make BOARD=arcada_ish && make BOARD=drallion_ish Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I17e4694c38219b5a0823e0a3e55a28d1348f4b18 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3262038 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Diffstat (limited to 'zephyr/include/drivers')
-rw-r--r--zephyr/include/drivers/cros_cbi.h102
-rw-r--r--zephyr/include/drivers/cros_flash.h288
-rw-r--r--zephyr/include/drivers/cros_kb_raw.h169
-rw-r--r--zephyr/include/drivers/cros_rtc.h224
-rw-r--r--zephyr/include/drivers/cros_shi.h89
-rw-r--r--zephyr/include/drivers/cros_system.h302
6 files changed, 0 insertions, 1174 deletions
diff --git a/zephyr/include/drivers/cros_cbi.h b/zephyr/include/drivers/cros_cbi.h
deleted file mode 100644
index aa55e03b77..0000000000
--- a/zephyr/include/drivers/cros_cbi.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* Copyright 2021 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.
- */
-
-/**
- * @file
- * @brief Chrome OS-specific API for access to Cros Board Info(CBI)
- */
-
-#ifndef ZEPHYR_INCLUDE_DRIVERS_CROS_CBI_H_
-#define ZEPHYR_INCLUDE_DRIVERS_CROS_CBI_H_
-
-#include <kernel.h>
-#include <device.h>
-#include <devicetree.h>
-
-#define CBI_SSFC_VALUE_COMPAT named_cbi_ssfc_value
-#define CBI_SSFC_VALUE_ID(id) DT_CAT(CBI_SSFC_VALUE_, id)
-#define CBI_SSFC_VALUE_ID_WITH_COMMA(id) CBI_SSFC_VALUE_ID(id),
-#define CBI_SSFC_VALUE_INST_ENUM(inst, _) \
- CBI_SSFC_VALUE_ID_WITH_COMMA(DT_INST(inst, CBI_SSFC_VALUE_COMPAT))
-#define CROS_CBI_LABEL "cros_cbi"
-
-enum cbi_ssfc_value_id {
- UTIL_LISTIFY(DT_NUM_INST_STATUS_OKAY(CBI_SSFC_VALUE_COMPAT),
- CBI_SSFC_VALUE_INST_ENUM)
- CBI_SSFC_VALUE_COUNT
-};
-
-/**
- * @cond INTERNAL_HIDDEN
- *
- * cros cbi raw driver API definition and system call entry points
- *
- * (Internal use only.)
- */
-typedef int (*cros_cbi_api_init)(const struct device *dev);
-typedef int (*cros_cbi_api_ssfc_check_match)(const struct device *dev,
- enum cbi_ssfc_value_id value_id);
-
-__subsystem struct cros_cbi_driver_api {
- cros_cbi_api_init init;
- cros_cbi_api_ssfc_check_match ssfc_check_match;
-};
-
-/**
- * @endcond
- */
-
-/**
- * @brief Initialize CBI.
- *
- * @param dev Pointer to the device structure for the CBI instance.
- *
- * @return 0 If successful.
- * @retval -ENOTSUP Not supported api function.
- */
-__syscall int cros_cbi_init(const struct device *dev);
-
-static inline int z_impl_cros_cbi_init(const struct device *dev)
-{
- const struct cros_cbi_driver_api *api =
- (const struct cros_cbi_driver_api *)dev->api;
-
- if (!api->init) {
- return -ENOTSUP;
- }
-
- return api->init(dev);
-}
-
-/**
- * @brief Check if the CBI SSFC value matches the one in the EEPROM
- *
- * @param dev Pointer to the device.
- *
- * @return 1 If matches, 0 if not.
- * @retval -ENOTSUP Not supported api function.
- */
-__syscall int cros_cbi_ssfc_check_match(const struct device *dev,
- enum cbi_ssfc_value_id value_id);
-
-static inline int
-z_impl_cros_cbi_ssfc_check_match(const struct device *dev,
- enum cbi_ssfc_value_id value_id)
-{
- const struct cros_cbi_driver_api *api =
- (const struct cros_cbi_driver_api *)dev->api;
-
- if (!api->ssfc_check_match) {
- return -ENOTSUP;
- }
-
- return api->ssfc_check_match(dev, value_id);
-}
-
-/**
- * @}
- */
-#include <syscalls/cros_cbi.h>
-#endif /* ZEPHYR_INCLUDE_DRIVERS_CROS_CBI_H_ */
diff --git a/zephyr/include/drivers/cros_flash.h b/zephyr/include/drivers/cros_flash.h
deleted file mode 100644
index 7f48cf7285..0000000000
--- a/zephyr/include/drivers/cros_flash.h
+++ /dev/null
@@ -1,288 +0,0 @@
-/*
- * Copyright 2020 Google LLC
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-/**
- * @file
- * @brief Chrome OS-specific API for flash memory access
- * This exists only support the interface expected by the Chrome OS EC. It seems
- * better to implement this so we can make use of most of the existing code in
- * its keyboard_scan.c file and thus make sure we operate the same way.
- *
- * It provides raw access to flash memory module.
- */
-
-#ifndef ZEPHYR_INCLUDE_DRIVERS_CROS_FLASH_H_
-#define ZEPHYR_INCLUDE_DRIVERS_CROS_FLASH_H_
-
-#include <kernel.h>
-#include <device.h>
-
-/**
- * @brief CROS Flash Driver APIs
- * @defgroup cros_flash_interface CROS Flash Driver APIs
- * @ingroup io_interfaces
- * @{
- */
-
-/**
- * @cond INTERNAL_HIDDEN
- *
- * cros keyboard raw driver API definition and system call entry points
- *
- * (Internal use only.)
- */
-typedef int (*cros_flash_api_init)(const struct device *dev);
-
-typedef int (*cros_flash_api_physical_read)(const struct device *dev,
- int offset, int size, char *data);
-
-typedef int (*cros_flash_api_physical_write)(const struct device *dev,
- int offset, int size,
- const char *data);
-
-typedef int (*cros_flash_api_physical_erase)(const struct device *dev,
- int offset, int size);
-
-typedef int (*cros_flash_api_physical_get_protect)(const struct device *dev,
- int bank);
-
-typedef uint32_t
-(*cros_flash_api_physical_get_protect_flags)(const struct device *dev);
-
-typedef int (*cros_flash_api_physical_protect_at_boot)(const struct device *dev,
- uint32_t new_flags);
-
-typedef int (*cros_flash_api_physical_protect_now)(const struct device *dev,
- int all);
-
-__subsystem struct cros_flash_driver_api {
- cros_flash_api_init init;
- cros_flash_api_physical_read physical_read;
- cros_flash_api_physical_write physical_write;
- cros_flash_api_physical_erase physical_erase;
- cros_flash_api_physical_get_protect physical_get_protect;
- cros_flash_api_physical_get_protect_flags physical_get_protect_flags;
- cros_flash_api_physical_protect_at_boot physical_protect_at_boot;
- cros_flash_api_physical_protect_now physical_protect_now;
-};
-
-/**
- * @endcond
- */
-
-/**
- * @brief Initialize physical flash.
- *
- * @param dev Pointer to the device structure for the flash driver instance.
- *
- * @return 0 If successful.
- * @retval -ENOTSUP Not supported api function.
- */
-__syscall int cros_flash_init(const struct device *dev);
-
-static inline int z_impl_cros_flash_init(const struct device *dev)
-{
- const struct cros_flash_driver_api *api =
- (const struct cros_flash_driver_api *)dev->api;
-
- if (!api->init) {
- return -ENOTSUP;
- }
-
- return api->init(dev);
-}
-
-/**
- * @brief Read from physical flash.
- *
- * @param dev Pointer to the device structure for the flash driver instance.
- * @param offset Flash offset to read.
- * @param size Number of bytes to read.
- * @param data Destination buffer for data. Must be 32-bit aligned.
- *
- * @return 0 If successful.
- * @retval -ENOTSUP Not supported api function.
- */
-__syscall int cros_flash_physical_read(const struct device *dev, int offset,
- int size, char *data);
-
-static inline int z_impl_cros_flash_physical_read(const struct device *dev,
- int offset, int size,
- char *data)
-{
- const struct cros_flash_driver_api *api =
- (const struct cros_flash_driver_api *)dev->api;
-
- if (!api->physical_read) {
- return -ENOTSUP;
- }
-
- return api->physical_read(dev, offset, size, data);
-}
-
-/**
- * @brief Write to physical flash.
- *
- * Offset and size must be a multiple of CONFIG_FLASH_WRITE_SIZE.
- *
- * @param dev Pointer to the device structure for the flash driver instance.
- * @param offset Flash offset to write.
- * @param size Number of bytes to write.
- * @param data Destination buffer for data. Must be 32-bit aligned.
- *
- * @return 0 If successful.
- * @retval -ENOTSUP Not supported api function.
- */
-__syscall int cros_flash_physical_write(const struct device *dev, int offset,
- int size, const char *data);
-
-static inline int z_impl_cros_flash_physical_write(const struct device *dev,
- int offset, int size,
- const char *data)
-{
- const struct cros_flash_driver_api *api =
- (const struct cros_flash_driver_api *)dev->api;
-
- if (!api->physical_write) {
- return -ENOTSUP;
- }
-
- return api->physical_write(dev, offset, size, data);
-}
-
-/**
- * @brief Erase physical flash.
- *
- * Offset and size must be a multiple of CONFIG_FLASH_ERASE_SIZE.
- *
- * @param dev Pointer to the device structure for the flash driver instance.
- * @param offset Flash offset to erase.
- * @param size Number of bytes to erase.
- *
- * @return 0 If successful.
- * @retval -ENOTSUP Not supported api function.
- */
-__syscall int cros_flash_physical_erase(const struct device *dev, int offset,
- int size);
-
-static inline int z_impl_cros_flash_physical_erase(const struct device *dev,
- int offset, int size)
-{
- const struct cros_flash_driver_api *api =
- (const struct cros_flash_driver_api *)dev->api;
-
- if (!api->physical_erase) {
- return -ENOTSUP;
- }
-
- return api->physical_erase(dev, offset, size);
-}
-
-/**
- * @brief Read physical write protect setting for a flash bank.
- *
- * @param dev Pointer to the device structure for the flash driver instance.
- * @param bank Bank index to check.
- *
- * @return non-zero if bank is protected until reboot.
- * @retval -ENOTSUP Not supported api function.
- */
-__syscall int cros_flash_physical_get_protect(const struct device *dev,
- int bank);
-
-static inline int
-z_impl_cros_flash_physical_get_protect(const struct device *dev, int bank)
-{
- const struct cros_flash_driver_api *api =
- (const struct cros_flash_driver_api *)dev->api;
-
- if (!api->physical_get_protect) {
- return -ENOTSUP;
- }
-
- return api->physical_get_protect(dev, bank);
-}
-
-/**
- * @brief Return flash protect state flags from the physical layer.
- *
- * @param dev Pointer to the device structure for the flash driver instance.
- *
- * @retval -ENOTSUP Not supported api function.
- */
-__syscall
-uint32_t cros_flash_physical_get_protect_flags(const struct device *dev);
-
-static inline uint32_t
-z_impl_cros_flash_physical_get_protect_flags(const struct device *dev)
-{
- const struct cros_flash_driver_api *api =
- (const struct cros_flash_driver_api *)dev->api;
-
- if (!api->physical_get_protect_flags) {
- return -ENOTSUP;
- }
-
- return api->physical_get_protect_flags(dev);
-}
-
-/**
- * @brief Enable/disable protecting firmware/pstate at boot.
- *
- * @param dev Pointer to the device structure for the flash driver instance.
- * @param new_flags to protect (only EC_FLASH_PROTECT_*_AT_BOOT are
- * taken care of)
- *
- * @return 0 If successful.
- * @retval -ENOTSUP Not supported api function.
- */
-__syscall int cros_flash_physical_protect_at_boot(const struct device *dev,
- uint32_t new_flags);
-
-static inline int
-z_impl_cros_flash_physical_protect_at_boot(const struct device *dev,
- uint32_t new_flags)
-{
- const struct cros_flash_driver_api *api =
- (const struct cros_flash_driver_api *)dev->api;
-
- if (!api->physical_protect_at_boot) {
- return -ENOTSUP;
- }
-
- return api->physical_protect_at_boot(dev, new_flags);
-}
-
-/**
- * @brief Protect now physical flash.
- *
- * @param dev Pointer to the device structure for the flash driver instance.
- * @param all Protect all (=1) or just read-only and pstate (=0).
- *
- * @return 0 If successful.
- * @retval -ENOTSUP Not supported api function.
- */
-__syscall int cros_flash_physical_protect_now(const struct device *dev,
- int all);
-
-static inline int
-z_impl_cros_flash_physical_protect_now(const struct device *dev, int all)
-{
- const struct cros_flash_driver_api *api =
- (const struct cros_flash_driver_api *)dev->api;
-
- if (!api->physical_protect_now) {
- return -ENOTSUP;
- }
-
- return api->physical_protect_now(dev, all);
-}
-
-/**
- * @}
- */
-#include <syscalls/cros_flash.h>
-#endif /* ZEPHYR_INCLUDE_DRIVERS_CROS_FLASH_H_ */
diff --git a/zephyr/include/drivers/cros_kb_raw.h b/zephyr/include/drivers/cros_kb_raw.h
deleted file mode 100644
index 1724f59d95..0000000000
--- a/zephyr/include/drivers/cros_kb_raw.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Copyright 2020 Google LLC
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-/**
- * @file
- * @brief Chrome OS-specific API for raw keyboard access
- * This exists only support the interface expected by the Chrome OS EC. It seems
- * better to implement this so we can make use of most of the existing code in
- * its keyboard_scan.c file and thus make sure we operate the same way.
- *
- * It provides raw access to keyboard GPIOs.
- *
- * The keyboard matrix is read (by the caller, keyboard_scan.c in ECOS) by
- * driving output signals on the column lines and reading the row lines.
- *
- * This API and any drivers should be removed once we can safely move to using
- * the Zephyr kscan API.
- */
-
-#ifndef ZEPHYR_INCLUDE_DRIVERS_CROS_KB_RAW_H_
-#define ZEPHYR_INCLUDE_DRIVERS_CROS_KB_RAW_H_
-
-#include <kernel.h>
-#include <device.h>
-
-/**
- * @brief CROS Keyboard Raw Driver APIs
- * @defgroup cros_kb_raw_interface CROS Keyboard Raw Driver APIs
- * @ingroup io_interfaces
- * @{
- */
-
-/**
- * @cond INTERNAL_HIDDEN
- *
- * cros keyboard raw driver API definition and system call entry points
- *
- * (Internal use only.)
- */
-typedef int (*cros_kb_raw_api_init)(const struct device *dev);
-
-typedef int (*cros_kb_raw_api_drive_column)(const struct device *dev, int col);
-
-typedef int (*cros_kb_raw_api_read_rows)(const struct device *dev);
-
-typedef int (*cros_kb_raw_api_enable_interrupt)(const struct device *dev,
- int enable);
-
-__subsystem struct cros_kb_raw_driver_api {
- cros_kb_raw_api_init init;
- cros_kb_raw_api_drive_column drive_colum;
- cros_kb_raw_api_read_rows read_rows;
- cros_kb_raw_api_enable_interrupt enable_interrupt;
-};
-
-/**
- * @endcond
- */
-
-/**
- * @brief Initialize the raw keyboard interface.
- *
- * Must be called before any other functions in this interface.
- *
- * @param dev Pointer to the device structure for the keyboard driver instance.
- *
- * @return 0 If successful.
- * @retval -ENOTSUP Not supported api function.
- */
-__syscall int cros_kb_raw_init(const struct device *dev);
-
-static inline int z_impl_cros_kb_raw_init(const struct device *dev)
-{
- const struct cros_kb_raw_driver_api *api =
- (const struct cros_kb_raw_driver_api *)dev->api;
-
- if (!api->init) {
- return -ENOTSUP;
- }
-
- return api->init(dev);
-}
-
-/**
- * @brief Drive the specified column low.
- *
- * Other columns are tristated. See enum keyboard_column_index for special
- * values for <col>.
- *
- * @param dev Pointer to the device structure for the keyboard driver instance.
- * @param col Specified column is driven to low.
- *
- * @return 0 If successful.
- * @retval -ENOTSUP Not supported api function.
- */
-__syscall int cros_kb_raw_drive_column(const struct device *dev, int col);
-static inline int z_impl_cros_kb_raw_drive_column(const struct device *dev,
- int col)
-{
- const struct cros_kb_raw_driver_api *api =
- (const struct cros_kb_raw_driver_api *)dev->api;
-
- if (!api->drive_colum) {
- return -ENOTSUP;
- }
-
- return api->drive_colum(dev, col);
-}
-
-/**
- * @brief Read raw row state.
- *
- * Bits are 1 if signal is present, 0 if not present.
- *
- * @param dev Pointer to the device structure for the keyboard driver instance.
- *
- * @return current raw row state value.
- */
-__syscall int cros_kb_raw_read_rows(const struct device *dev);
-static inline int z_impl_cros_kb_raw_read_rows(const struct device *dev)
-{
- const struct cros_kb_raw_driver_api *api =
- (const struct cros_kb_raw_driver_api *)dev->api;
-
- if (!api->read_rows) {
- return 0;
- }
-
- return api->read_rows(dev);
-}
-
-/**
- * @brief Enable or disable keyboard interrupts.
- *
- * Enabling interrupts will clear any pending interrupt bits. To avoid missing
- * any interrupts that occur between the end of scanning and then, you should
- * call cros_kb_raw_read_rows() after this. If it returns non-zero, disable
- * interrupts and go back to polling mode instead of waiting for an interrupt.
- *
- * @param dev Pointer to the device structure for the keyboard driver instance.
- * @param enable If 1, enable keyboard interrupt. Otherwise, disable it.
- *
- * @return 0 If successful.
- * @retval -ENOTSUP Not supported api function.
- */
-__syscall int cros_kb_raw_enable_interrupt(const struct device *dev,
- int enable);
-
-static inline int z_impl_cros_kb_raw_enable_interrupt(const struct device *dev,
- int enable)
-{
- const struct cros_kb_raw_driver_api *api =
- (const struct cros_kb_raw_driver_api *)dev->api;
-
- if (!api->enable_interrupt) {
- return -ENOTSUP;
- }
-
- return api->enable_interrupt(dev, enable);
-}
-
-/**
- * @}
- */
-#include <syscalls/cros_kb_raw.h>
-#endif /* ZEPHYR_INCLUDE_DRIVERS_CROS_KB_RAW_H_ */
diff --git a/zephyr/include/drivers/cros_rtc.h b/zephyr/include/drivers/cros_rtc.h
deleted file mode 100644
index 695aabef73..0000000000
--- a/zephyr/include/drivers/cros_rtc.h
+++ /dev/null
@@ -1,224 +0,0 @@
-/* Copyright 2021 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.
- */
-
-/**
- * @file
- * @brief Chrome OS-specific API for real-time clock (RTC).
- * This exists only support the interface expected by the Chrome OS EC. It
- * provides raw access to RTC module.
- *
- * This API and any drivers should be removed once we can safely move to using
- * the Zephyr rtc API.
- */
-
-#ifndef ZEPHYR_INCLUDE_DRIVERS_CROS_RTC_H_
-#define ZEPHYR_INCLUDE_DRIVERS_CROS_RTC_H_
-
-#include <kernel.h>
-#include <device.h>
-
-/**
- * @brief CROS Real-Time Clock (RTC) Driver APIs
- * @defgroup cros_rtc_interface CROS RTC Driver APIs
- * @ingroup io_interfaces
- * @{
- */
-
-/**
- * @brief RTC alarm callback
- *
- * @param dev Pointer to the device structure for the RTC driver instance.
- */
-typedef void (*cros_rtc_alarm_callback_t)(const struct device *dev);
-
-/**
- * @cond INTERNAL_HIDDEN
- *
- * cros real-time clock driver API definition and system call entry points
- *
- * (Internal use only.)
- */
-typedef int (*cros_rtc_api_configure)(const struct device *dev,
- cros_rtc_alarm_callback_t callback);
-
-typedef int (*cros_rtc_api_get_value)(const struct device *dev,
- uint32_t *value);
-
-typedef int (*cros_rtc_api_set_value)(const struct device *dev, uint32_t value);
-
-typedef int (*cros_rtc_api_get_alarm)(const struct device *dev,
- uint32_t *seconds,
- uint32_t *microseconds);
-
-typedef int (*cros_rtc_api_set_alarm)(const struct device *dev,
- uint32_t seconds, uint32_t microseconds);
-
-typedef int (*cros_rtc_api_reset_alarm)(const struct device *dev);
-
-__subsystem struct cros_rtc_driver_api {
- cros_rtc_api_configure configure;
- cros_rtc_api_get_value get_value;
- cros_rtc_api_set_value set_value;
- cros_rtc_api_get_alarm get_alarm;
- cros_rtc_api_set_alarm set_alarm;
- cros_rtc_api_reset_alarm reset_alarm;
-};
-
-/**
- * @endcond
- */
-
-/**
- * @brief Configure real-time clock callback func.
- *
- * @param dev Pointer to the device structure for the RTC driver instance.
- * @param callback Callback func when RTC alarm issued.
- *
- * @return 0 If successful.
- * @retval -ENOTSUP Not supported api function.
- * @retval -EINVAL Not valid callback func.
- */
-__syscall int cros_rtc_configure(const struct device *dev,
- cros_rtc_alarm_callback_t callback);
-static inline int z_impl_cros_rtc_configure(const struct device *dev,
- cros_rtc_alarm_callback_t callback)
-{
- const struct cros_rtc_driver_api *api =
- (const struct cros_rtc_driver_api *)dev->api;
-
- if (!api->configure) {
- return -ENOTSUP;
- }
-
- return api->configure(dev, callback);
-}
-
-/**
- * @brief Get the current real-time clock value.
- *
- * @param dev Pointer to the device structure for the RTC driver instance.
- * @param value Pointer to the number of current real-time clock value.
- *
- * @return 0 If successful.
- * @retval -ENOTSUP Not supported api function.
- */
-__syscall int cros_rtc_get_value(const struct device *dev, uint32_t *value);
-static inline int z_impl_cros_rtc_get_value(const struct device *dev,
- uint32_t *value)
-{
- const struct cros_rtc_driver_api *api =
- (const struct cros_rtc_driver_api *)dev->api;
-
- if (!api->get_value) {
- return -ENOTSUP;
- }
-
- return api->get_value(dev, value);
-}
-
-/**
- * @brief Set a desired value to real-time clock.
- *
- * @param dev Pointer to the device structure for the RTC driver instance.
- * @param value Number of desired real-time clock value.
- *
- * @return 0 If successful.
- * @retval -ENOTSUP Not supported api function.
- */
-__syscall int cros_rtc_set_value(const struct device *dev, uint32_t value);
-static inline int z_impl_cros_rtc_set_value(const struct device *dev,
- uint32_t value)
-{
- const struct cros_rtc_driver_api *api =
- (const struct cros_rtc_driver_api *)dev->api;
-
- if (!api->set_value) {
- return -ENOTSUP;
- }
-
- return api->set_value(dev, value);
-}
-
-/**
- * @brief Get a given time when an RTC alarm interrupt issued.
- *
- * @param dev Pointer to the device structure for the RTC driver instance.
- * @param seconds Pointer to number of seconds before RTC alarm issued.
- * @param microseconds Pointer to number of micro-secs before RTC alarm issued.
- *
- * @return 0 If successful.
- * @retval -ENOTSUP Not supported api function.
- */
-__syscall int cros_rtc_get_alarm(const struct device *dev, uint32_t *seconds,
- uint32_t *microseconds);
-
-static inline int z_impl_cros_rtc_get_alarm(const struct device *dev,
- uint32_t *seconds,
- uint32_t *microseconds)
-{
- const struct cros_rtc_driver_api *api =
- (const struct cros_rtc_driver_api *)dev->api;
-
- if (!api->get_alarm) {
- return 0;
- }
-
- return api->get_alarm(dev, seconds, microseconds);
-}
-
-/**
- * @brief Set up an RTC alarm interrupt at a given time from now
- *
- * @param dev Pointer to the device structure for the RTC driver instance.
- * @param seconds Number of seconds before RTC alarm issued.
- * @param microseconds Number of microseconds before alarm RTC issued.
- *
- * @return 0 If successful.
- * @retval -ENOTSUP Not supported api function.
- */
-__syscall int cros_rtc_set_alarm(const struct device *dev, uint32_t seconds,
- uint32_t microseconds);
-
-static inline int z_impl_cros_rtc_set_alarm(const struct device *dev,
- uint32_t seconds,
- uint32_t microseconds)
-{
- const struct cros_rtc_driver_api *api =
- (const struct cros_rtc_driver_api *)dev->api;
-
- if (!api->set_alarm) {
- return 0;
- }
-
- return api->set_alarm(dev, seconds, microseconds);
-}
-
-/**
- * @brief Disable and clear the RTC alarm interrupt.
- *
- * @param dev Pointer to the device structure for the RTC driver instance.
- *
- * @return 0 If successful.
- * @retval -ENOTSUP Not supported api function.
- */
-__syscall int cros_rtc_reset_alarm(const struct device *dev);
-
-static inline int z_impl_cros_rtc_reset_alarm(const struct device *dev)
-{
- const struct cros_rtc_driver_api *api =
- (const struct cros_rtc_driver_api *)dev->api;
-
- if (!api->reset_alarm) {
- return -ENOTSUP;
- }
-
- return api->reset_alarm(dev);
-}
-
-/**
- * @}
- */
-#include <syscalls/cros_rtc.h>
-#endif /* ZEPHYR_INCLUDE_DRIVERS_CROS_RTC_H_ */
diff --git a/zephyr/include/drivers/cros_shi.h b/zephyr/include/drivers/cros_shi.h
deleted file mode 100644
index aab3507dd3..0000000000
--- a/zephyr/include/drivers/cros_shi.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/* Copyright 2021 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.
- */
-
-/**
- * @file
- * @brief Chrome OS-specific API for Serial Host Interface (SHI)
- */
-
-#ifndef ZEPHYR_INCLUDE_DRIVERS_CROS_SHI_H_
-#define ZEPHYR_INCLUDE_DRIVERS_CROS_SHI_H_
-
-/**
- * @brief CROS Serial Host Interface Driver APIs
- * @defgroup cros_shi_interface CROS Serial Host Interface Driver APIs
- * @ingroup io_interfaces
- * @{
- */
-
-#include <kernel.h>
-#include <device.h>
-
-/**
- * @cond INTERNAL_HIDDEN
- *
- * cros Serial Host Interface driver API definition and system call entry points
- *
- * (Internal use only.)
- */
-typedef int (*cros_shi_api_enable)(const struct device *dev);
-
-typedef int (*cros_shi_api_disable)(const struct device *dev);
-
-/** @brief Driver API structure. */
-__subsystem struct cros_shi_driver_api {
- cros_shi_api_enable enable;
- cros_shi_api_disable disable;
-};
-
-/**
- * @brief Enable SHI module.
- *
- * @param dev Pointer to the device structure for the driver instance.
- *
- * @retval non-negative if successful.
- * @retval Negative errno code if failure.
- */
-__syscall int cros_shi_enable(const struct device *dev);
-
-static inline int z_impl_cros_shi_enable(const struct device *dev)
-{
- const struct cros_shi_driver_api *api =
- (const struct cros_shi_driver_api *)dev->api;
-
- if (!api->enable) {
- return -ENOTSUP;
- }
-
- return api->enable(dev);
-}
-
-/**
- * @brief Disable SHI module.
- *
- * @param dev Pointer to the device structure for the driver instance.
- *
- * @retval no return if successful.
- * @retval Negative errno code if failure.
- */
-__syscall int cros_shi_disable(const struct device *dev);
-
-static inline int z_impl_cros_shi_disable(const struct device *dev)
-{
- const struct cros_shi_driver_api *api =
- (const struct cros_shi_driver_api *)dev->api;
-
- if (!api->disable) {
- return -ENOTSUP;
- }
-
- return api->disable(dev);
-}
-
-/**
- * @}
- */
-#include <syscalls/cros_shi.h>
-#endif /* ZEPHYR_INCLUDE_DRIVERS_CROS_SHI_H_ */
diff --git a/zephyr/include/drivers/cros_system.h b/zephyr/include/drivers/cros_system.h
deleted file mode 100644
index b0e06f1b59..0000000000
--- a/zephyr/include/drivers/cros_system.h
+++ /dev/null
@@ -1,302 +0,0 @@
-/* Copyright 2021 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.
- */
-
-/**
- * @file
- * @brief Public API for cros system drivers
- */
-
-#ifndef ZEPHYR_INCLUDE_DRIVERS_CROS_SYSTEM_H_
-#define ZEPHYR_INCLUDE_DRIVERS_CROS_SYSTEM_H_
-
-/**
- * @brief cros system Interface
- * @defgroup cros_system_interface cros system Interface
- * @ingroup io_interfaces
- * @{
- */
-
-#include <kernel.h>
-#include <device.h>
-
-/**
- * @brief system_reset_cause enum
- * Identify the reset cause.
- */
-enum system_reset_cause {
- /* the reset is triggered by VCC power-up */
- POWERUP = 0,
- /* the reset is triggered by external VCC1 reset pin */
- VCC1_RST_PIN = 1,
- /* the reset is triggered by ICE debug reset request */
- DEBUG_RST = 2,
- /* the reset is triggered by watchdog */
- WATCHDOG_RST = 3,
- /* unknown reset type */
- UNKNOWN_RST,
-};
-
-/**
- * @brief Get a node from path '/hibernate_wakeup_pins' which has a property
- * 'wakeup-pins' contains GPIO list for hibernate wake-up
- *
- * @return node identifier with that path.
- */
-#define SYSTEM_DT_NODE_HIBERNATE_CONFIG DT_INST(0, cros_ec_hibernate_wake_pins)
-
-/**
- * @brief Get the length of 'wakeup-pins' property
- *
- * @return length of 'wakeup-pins' prop which type is 'phandles'
- */
-#define SYSTEM_DT_NODE_WAKEUP_PIN_LEN \
- DT_PROP_LEN(SYSTEM_DT_NODE_HIBERNATE_CONFIG, wakeup_pins)
-
-/**
- * @brief Get a node identifier from a phandle in property 'wakeup-pins' at
- * index i.
- *
- * @param i index of 'wakeup-pins' prop which type is 'phandles'
- * @return node identifier with that path.
- */
-#define SYSTEM_DT_NODE_WAKEUP_PIN_BY_IDX(i) \
- DT_PHANDLE_BY_IDX(SYSTEM_DT_NODE_HIBERNATE_CONFIG, wakeup_pins, i)
-
-/**
- * @brief Get the enum using in chromium system by index i in 'wakeup-pins'
- * list.
- *
- * @param i index of 'wakeup-pins' prop which type is 'phandles'
- * @return GPIO enumeration
- */
-#define SYSTEM_DT_WAKEUP_GPIO_ENUM_BY_IDX(i, _) \
- COND_CODE_1(DT_NODE_HAS_PROP(SYSTEM_DT_NODE_WAKEUP_PIN_BY_IDX(i), \
- enum_name), \
- (GPIO_SIGNAL(SYSTEM_DT_NODE_WAKEUP_PIN_BY_IDX(i)), ), ())
-
-/**
- * @typedef cros_system_get_reset_cause_api
- * @brief Callback API for getting reset cause instance.
- * See cros_system_get_reset_cause() for argument descriptions
- */
-typedef int (*cros_system_get_reset_cause_api)(const struct device *dev);
-
-/**
- * @typedef cros_system_soc_reset_api
- * @brief Callback API for soc-reset instance.
- * See cros_system_soc_reset() for argument descriptions
- */
-typedef int (*cros_system_soc_reset_api)(const struct device *dev);
-
-/**
- * @typedef cros_system_hibernate_api
- * @brief Callback API for entering hibernate state (lowest EC power state).
- * See cros_system_hibernate() for argument descriptions
- */
-typedef int (*cros_system_hibernate_api)(const struct device *dev,
- uint32_t seconds,
- uint32_t microseconds);
-
-/**
- * @typedef cros_system_chip_vendor_api
- * @brief Callback API for getting the chip vendor.
- * See cros_system_chip_vendor() for argument descriptions
- */
-typedef const char *(*cros_system_chip_vendor_api)(const struct device *dev);
-
-/**
- * @typedef cros_system_chip_name_api
- * @brief Callback API for getting the chip name.
- * See cros_system_chip_name() for argument descriptions
- */
-typedef const char *(*cros_system_chip_name_api)(const struct device *dev);
-
-/**
- * @typedef cros_system_chip_revision_api
- * @brief Callback API for getting the chip revision.
- * See cros_system_chip_revision() for argument descriptions
- */
-typedef const char *(*cros_system_chip_revision_api)(const struct device *dev);
-
-/**
- * @typedef cros_system_get_deep_sleep_ticks_api
- * @brief Callback API for getting number of ticks spent in deep sleep.
- * See cros_system_deep_sleep_ticks() for argument descriptions
- */
-typedef uint64_t (*cros_system_deep_sleep_ticks_api)(const struct device *dev);
-
-/** @brief Driver API structure. */
-__subsystem struct cros_system_driver_api {
- cros_system_get_reset_cause_api get_reset_cause;
- cros_system_soc_reset_api soc_reset;
- cros_system_hibernate_api hibernate;
- cros_system_chip_vendor_api chip_vendor;
- cros_system_chip_name_api chip_name;
- cros_system_chip_revision_api chip_revision;
- cros_system_deep_sleep_ticks_api deep_sleep_ticks;
-};
-
-/**
- * @brief Get the chip-reset cause
- *
- * @param dev Pointer to the device structure for the driver instance.
- *
- * @retval non-negative if successful.
- * @retval Negative errno code if failure.
- */
-__syscall int cros_system_get_reset_cause(const struct device *dev);
-
-static inline int z_impl_cros_system_get_reset_cause(const struct device *dev)
-{
- const struct cros_system_driver_api *api =
- (const struct cros_system_driver_api *)dev->api;
-
- if (!api->get_reset_cause) {
- return -ENOTSUP;
- }
-
- return api->get_reset_cause(dev);
-}
-
-/**
- * @brief reset the soc
- *
- * @param dev Pointer to the device structure for the driver instance.
- *
- * @retval no return if successful.
- * @retval Negative errno code if failure.
- */
-__syscall int cros_system_soc_reset(const struct device *dev);
-
-static inline int z_impl_cros_system_soc_reset(const struct device *dev)
-{
- const struct cros_system_driver_api *api =
- (const struct cros_system_driver_api *)dev->api;
-
- if (!api->soc_reset) {
- return -ENOTSUP;
- }
-
- return api->soc_reset(dev);
-}
-
-/**
- * @brief put the EC in hibernate (lowest EC power state).
- *
- * @param dev Pointer to the device structure for the driver instance.
- * @param seconds Number of seconds before EC enters hibernate state.
- * @param microseconds Number of micro-secs before EC enters hibernate state.
-
- * @retval no return if successful.
- * @retval Negative errno code if failure.
- */
-__syscall int cros_system_hibernate(const struct device *dev, uint32_t seconds,
- uint32_t microseconds);
-
-static inline int z_impl_cros_system_hibernate(const struct device *dev,
- uint32_t seconds,
- uint32_t microseconds)
-{
- const struct cros_system_driver_api *api =
- (const struct cros_system_driver_api *)dev->api;
-
- if (!api->hibernate) {
- return -ENOTSUP;
- }
-
- return api->hibernate(dev, seconds, microseconds);
-}
-
-/**
- * @brief Get the chip vendor.
- *
- * @param dev Pointer to the device structure for the driver instance.
- * @retval Chip vendor string if successful.
- * @retval Null string if failure.
- */
-__syscall const char *cros_system_chip_vendor(const struct device *dev);
-
-static inline const char *
-z_impl_cros_system_chip_vendor(const struct device *dev)
-{
- const struct cros_system_driver_api *api =
- (const struct cros_system_driver_api *)dev->api;
-
- if (!api->chip_vendor) {
- return "";
- }
-
- return api->chip_vendor(dev);
-}
-
-/**
- * @brief Get the chip name.
- *
- * @param dev Pointer to the device structure for the driver instance.
- * @retval Chip name string if successful.
- * @retval Null string if failure.
- */
-__syscall const char *cros_system_chip_name(const struct device *dev);
-
-static inline const char *z_impl_cros_system_chip_name(const struct device *dev)
-{
- const struct cros_system_driver_api *api =
- (const struct cros_system_driver_api *)dev->api;
-
- if (!api->chip_name) {
- return "";
- }
-
- return api->chip_name(dev);
-}
-
-/**
- * @brief Get the chip revision.
- *
- * @param dev Pointer to the device structure for the driver instance.
- * @retval Chip revision string if successful.
- * @retval Null string if failure.
- */
-__syscall const char *cros_system_chip_revision(const struct device *dev);
-
-static inline const char *
-z_impl_cros_system_chip_revision(const struct device *dev)
-{
- const struct cros_system_driver_api *api =
- (const struct cros_system_driver_api *)dev->api;
-
- if (!api->chip_revision) {
- return "";
- }
-
- return api->chip_revision(dev);
-}
-
-/**
- * @brief Get total number of ticks spent in deep sleep.
- *
- * @param dev Pointer to the device structure for the driver instance.
- * @retval Number of ticks spent in deep sleep.
- */
-__syscall uint64_t cros_system_deep_sleep_ticks(const struct device *dev);
-
-static inline uint64_t
-z_impl_cros_system_deep_sleep_ticks(const struct device *dev)
-{
- const struct cros_system_driver_api *api =
- (const struct cros_system_driver_api *)dev->api;
-
- if (!api->deep_sleep_ticks) {
- return 0;
- }
-
- return api->deep_sleep_ticks(dev);
-}
-
-/**
- * @}
- */
-#include <syscalls/cros_system.h>
-#endif /* ZEPHYR_INCLUDE_DRIVERS_CROS_SYSTEM_H_ */