diff options
Diffstat (limited to 'zephyr/shim/chip/it8xxx2')
-rw-r--r-- | zephyr/shim/chip/it8xxx2/CMakeLists.txt | 10 | ||||
-rw-r--r-- | zephyr/shim/chip/it8xxx2/clock.c | 41 | ||||
-rw-r--r-- | zephyr/shim/chip/it8xxx2/include/flash_chip.h | 41 | ||||
-rw-r--r-- | zephyr/shim/chip/it8xxx2/keyboard_raw.c | 26 | ||||
-rw-r--r-- | zephyr/shim/chip/it8xxx2/pinmux.c | 112 | ||||
-rw-r--r-- | zephyr/shim/chip/it8xxx2/system.c | 16 |
6 files changed, 0 insertions, 246 deletions
diff --git a/zephyr/shim/chip/it8xxx2/CMakeLists.txt b/zephyr/shim/chip/it8xxx2/CMakeLists.txt deleted file mode 100644 index 7a92a3cfb6..0000000000 --- a/zephyr/shim/chip/it8xxx2/CMakeLists.txt +++ /dev/null @@ -1,10 +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. - -zephyr_library_include_directories(include) - -zephyr_library_sources(clock.c) -zephyr_library_sources_ifdef(CONFIG_CROS_EC system.c) -zephyr_library_sources_ifdef(CONFIG_CROS_EC pinmux.c) -zephyr_library_sources_ifdef(CONFIG_CROS_KB_RAW_ITE keyboard_raw.c) diff --git a/zephyr/shim/chip/it8xxx2/clock.c b/zephyr/shim/chip/it8xxx2/clock.c deleted file mode 100644 index 2bcf9e2899..0000000000 --- a/zephyr/shim/chip/it8xxx2/clock.c +++ /dev/null @@ -1,41 +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. - */ - -#include <device.h> -#include <drivers/clock_control.h> -#include <kernel.h> -#include <logging/log.h> -#include <soc.h> -#include <zephyr.h> -#include <soc/ite_it8xxx2/reg_def_cros.h> -#include <sys/util.h> - -#include "module_id.h" - -LOG_MODULE_REGISTER(shim_clock, LOG_LEVEL_ERR); - -#define ECPM_NODE DT_INST(0, ite_it8xxx2_ecpm) -#define HAL_ECPM_REG_BASE_ADDR \ - ((struct ecpm_reg *)DT_REG_ADDR_BY_IDX(ECPM_NODE, 0)) -#define PLLFREQ_MASK 0xf - -static const int pll_reg_to_freq[8] = { - MHZ(8), - MHZ(16), - MHZ(24), - MHZ(32), - MHZ(48), - MHZ(64), - MHZ(72), - MHZ(96) -}; - -int clock_get_freq(void) -{ - struct ecpm_reg *const ecpm_base = HAL_ECPM_REG_BASE_ADDR; - int reg_val = ecpm_base->ECPM_PLLFREQ & PLLFREQ_MASK; - - return pll_reg_to_freq[reg_val]; -} diff --git a/zephyr/shim/chip/it8xxx2/include/flash_chip.h b/zephyr/shim/chip/it8xxx2/include/flash_chip.h deleted file mode 100644 index e45a08296f..0000000000 --- a/zephyr/shim/chip/it8xxx2/include/flash_chip.h +++ /dev/null @@ -1,41 +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. - */ - -#ifndef __CROS_EC_FLASH_CHIP_H -#define __CROS_EC_FLASH_CHIP_H - -/* - * Flash size of IT81202 is 1MB. - * We use only half space of flash to save time of erasing RW image from flash. - */ -#define CONFIG_FLASH_SIZE_BYTES (DT_REG_SIZE(DT_NODELABEL(flash0)) / 2) -/* Program is run directly from storage */ -#define CONFIG_MAPPED_STORAGE_BASE DT_REG_ADDR(DT_NODELABEL(flash0)) -/* - * One page program instruction allows maximum 256 bytes (a page) of data - * to be programmed. - */ -#define CONFIG_FLASH_WRITE_IDEAL_SIZE 256 -/* Minimum write size */ -#define CONFIG_FLASH_WRITE_SIZE DT_PROP(DT_INST(0, soc_nv_flash), \ - write_block_size) -/* Erase bank size */ -#define CONFIG_FLASH_ERASE_SIZE DT_PROP(DT_INST(0, soc_nv_flash), \ - erase_block_size) -/* Protect bank size */ -#define CONFIG_FLASH_BANK_SIZE CONFIG_FLASH_ERASE_SIZE - -#define CONFIG_RO_STORAGE_OFF 0x0 -#define CONFIG_RW_STORAGE_OFF 0x0 - -/* - * The EC uses the one bank of flash to emulate a SPI-like write protect - * register with persistent state. - */ -#define CONFIG_FW_PSTATE_SIZE CONFIG_FLASH_BANK_SIZE -#define CONFIG_FW_PSTATE_OFF (CONFIG_FLASH_SIZE_BYTES / 2 - \ - CONFIG_FW_PSTATE_SIZE) - -#endif /* __CROS_EC_FLASH_CHIP_H */ diff --git a/zephyr/shim/chip/it8xxx2/keyboard_raw.c b/zephyr/shim/chip/it8xxx2/keyboard_raw.c deleted file mode 100644 index 0096798915..0000000000 --- a/zephyr/shim/chip/it8xxx2/keyboard_raw.c +++ /dev/null @@ -1,26 +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. - */ - -/* Functions needed by keyboard scanner module for Chrome EC */ - -#include <device.h> -#include <logging/log.h> -#include <soc.h> -#include <zephyr.h> - -#include "drivers/cros_kb_raw.h" -#include "keyboard_raw.h" - -/** - * Return true if the current value of the given input GPIO port is zero - */ -int keyboard_raw_is_input_low(int port, int id) -{ - /* - * TODO: implement for factory testing KSI and KSO pin as GPIO - * function. - */ - return 0; -} diff --git a/zephyr/shim/chip/it8xxx2/pinmux.c b/zephyr/shim/chip/it8xxx2/pinmux.c deleted file mode 100644 index fd8dc7fc8e..0000000000 --- a/zephyr/shim/chip/it8xxx2/pinmux.c +++ /dev/null @@ -1,112 +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. - */ - -#include <init.h> -#include <drivers/pinmux.h> -#include <dt-bindings/pinctrl/it8xxx2-pinctrl.h> -#include <soc.h> - -static int it8xxx2_pinmux_init(const struct device *dev) -{ - ARG_UNUSED(dev); - -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pinmuxb), okay) && \ - DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay) - const struct device *portb = DEVICE_DT_GET(DT_NODELABEL(pinmuxb)); - - /* SIN0 */ - pinmux_pin_set(portb, 0, IT8XXX2_PINMUX_FUNC_3); - /* SOUT0 */ - pinmux_pin_set(portb, 1, IT8XXX2_PINMUX_FUNC_3); -#endif - - return 0; -} -SYS_INIT(it8xxx2_pinmux_init, PRE_KERNEL_1, CONFIG_PINMUX_INIT_PRIORITY); - -/* - * Init priority is behind CONFIG_PLATFORM_EC_GPIO_INIT_PRIORITY to overwrite - * GPIO_INPUT setting of i2c ports. - */ -static int it8xxx2_pinmux_init_latr(const struct device *dev) -{ - ARG_UNUSED(dev); - -#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c0), okay) && \ - DT_NODE_HAS_STATUS(DT_NODELABEL(pinmuxb), okay) - { - const struct device *portb = - DEVICE_DT_GET(DT_NODELABEL(pinmuxb)); - - /* I2C0 CLK */ - pinmux_pin_set(portb, 3, IT8XXX2_PINMUX_FUNC_1); - /* I2C0 DAT */ - pinmux_pin_set(portb, 4, IT8XXX2_PINMUX_FUNC_1); - } -#endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c1), okay) && \ - DT_NODE_HAS_STATUS(DT_NODELABEL(pinmuxc), okay) - { - const struct device *portc = - DEVICE_DT_GET(DT_NODELABEL(pinmuxc)); - - /* I2C1 CLK */ - pinmux_pin_set(portc, 1, IT8XXX2_PINMUX_FUNC_1); - /* I2C1 DAT */ - pinmux_pin_set(portc, 2, IT8XXX2_PINMUX_FUNC_1); - } -#endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c2), okay) && \ - DT_NODE_HAS_STATUS(DT_NODELABEL(pinmuxf), okay) - { - const struct device *portf = - DEVICE_DT_GET(DT_NODELABEL(pinmuxf)); - - /* I2C2 CLK */ - pinmux_pin_set(portf, 6, IT8XXX2_PINMUX_FUNC_1); - /* I2C2 DAT */ - pinmux_pin_set(portf, 7, IT8XXX2_PINMUX_FUNC_1); - } -#endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c3), okay) && \ - DT_NODE_HAS_STATUS(DT_NODELABEL(pinmuxh), okay) - { - const struct device *porth = - DEVICE_DT_GET(DT_NODELABEL(pinmuxh)); - - /* I2C3 CLK */ - pinmux_pin_set(porth, 1, IT8XXX2_PINMUX_FUNC_3); - /* I2C3 DAT */ - pinmux_pin_set(porth, 2, IT8XXX2_PINMUX_FUNC_3); - } -#endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c4), okay) && \ - DT_NODE_HAS_STATUS(DT_NODELABEL(pinmuxe), okay) - { - const struct device *porte = - DEVICE_DT_GET(DT_NODELABEL(pinmuxe)); - - /* I2C4 CLK */ - pinmux_pin_set(porte, 0, IT8XXX2_PINMUX_FUNC_3); - /* I2C4 DAT */ - pinmux_pin_set(porte, 7, IT8XXX2_PINMUX_FUNC_3); - } -#endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c5), okay) && \ - DT_NODE_HAS_STATUS(DT_NODELABEL(pinmuxa), okay) - { - const struct device *porta = - DEVICE_DT_GET(DT_NODELABEL(pinmuxa)); - - /* I2C5 CLK */ - pinmux_pin_set(porta, 4, IT8XXX2_PINMUX_FUNC_3); - /* I2C5 DAT */ - pinmux_pin_set(porta, 5, IT8XXX2_PINMUX_FUNC_3); - } -#endif - - return 0; -} -SYS_INIT(it8xxx2_pinmux_init_latr, POST_KERNEL, 52); diff --git a/zephyr/shim/chip/it8xxx2/system.c b/zephyr/shim/chip/it8xxx2/system.c deleted file mode 100644 index d9dcd7ccfb..0000000000 --- a/zephyr/shim/chip/it8xxx2/system.c +++ /dev/null @@ -1,16 +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. - */ - -#include "system.h" - -uintptr_t system_get_fw_reset_vector(uintptr_t base) -{ - /* - * Because our reset vector is at the beginning of image copy - * (see init.S). So I just need to return 'base' here and EC will jump - * to the reset vector. - */ - return base; -} |