summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMary Ruthven <mruthven@chromium.org>2021-01-05 16:07:44 -0800
committerCommit Bot <commit-bot@chromium.org>2021-01-06 23:06:30 +0000
commit88b0316d684b31ef7983d2bc06f7e1b919112779 (patch)
tree7f96b27cb76505a54c0cd3c8ec530278b7cbcebd
parentdeb429c0832cb11bfe372dc87716e92c75031f0d (diff)
downloadchrome-ec-88b0316d684b31ef7983d2bc06f7e1b919112779.tar.gz
coil: remove ioexpander
This code uses coil terms we're removing, but we don't use it in platform/cr50. Remove the code instead of replacing the terms. BUG=b:175244613 TEST=make buildall -j Change-Id: Ia5c02c4ba1f81f68a6ab03b9b380143ad8e85330 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2613446 Reviewed-by: Namyoon Woo <namyoon@chromium.org>
-rw-r--r--common/build.mk1
-rw-r--r--common/gpio.c23
-rw-r--r--common/ioexpander.c286
-rw-r--r--include/gpio.h28
-rw-r--r--include/gpio_list.h65
-rw-r--r--include/gpio_signal.h16
-rw-r--r--include/ioexpander.h160
-rw-r--r--power/build.mk1
-rw-r--r--power/icelake.c248
-rw-r--r--power/icelake.h43
10 files changed, 0 insertions, 871 deletions
diff --git a/common/build.mk b/common/build.mk
index b6ca29ff4c..1cf6d31eb0 100644
--- a/common/build.mk
+++ b/common/build.mk
@@ -43,7 +43,6 @@ common-$(CONFIG_CROS_BOARD_INFO)+=cbi.o
common-$(CONFIG_CMD_CHARGEN) += chargen.o
common-$(CONFIG_CMD_I2CWEDGE)+=i2c_wedge.o
common-$(CONFIG_COMMON_GPIO)+=gpio.o gpio_commands.o
-common-$(CONFIG_IO_EXPANDER)+=ioexpander.o
common-$(CONFIG_COMMON_PANIC_OUTPUT)+=panic_output.o
common-$(CONFIG_COMMON_RUNTIME)+=hooks.o main.o system.o peripheral.o
common-$(CONFIG_COMMON_TIMER)+=timer.o
diff --git a/common/gpio.c b/common/gpio.c
index c59065a60c..9d0933665e 100644
--- a/common/gpio.c
+++ b/common/gpio.c
@@ -7,7 +7,6 @@
#include "common.h"
#include "gpio.h"
-#include "ioexpander.h"
#include "registers.h"
#include "timer.h"
#include "util.h"
@@ -196,28 +195,6 @@ int gpio_power_down_module(enum module_id id)
}
#endif /* #ifdef CONFIG_GPIO_POWER_DOWN */
-void gpio_set_level_verbose(enum console_channel channel,
- enum gpio_signal signal, int value)
-{
- ASSERT(signal_is_gpio(signal));
- cprints(channel, "Set %s: %d", gpio_get_name(signal), value);
- gpio_set_level(signal, value);
-}
-
-void gpio_or_ioex_set_level(int signal, int value)
-{
- if (IS_ENABLED(CONFIG_IO_EXPANDER) && signal_is_ioex(signal))
- ioex_set_level(signal, value);
- else
- gpio_set_level(signal, value);
-}
-
-int signal_is_gpio(int signal)
-{
- return ((signal >= GPIO_SIGNAL_START)
- && (signal < GPIO_SIGNAL_START + GPIO_COUNT));
-}
-
__attribute__((weak)) void gpio_set_wakepin(enum gpio_signal signal,
uint32_t flags)
{
diff --git a/common/ioexpander.c b/common/ioexpander.c
deleted file mode 100644
index 6b54fd635e..0000000000
--- a/common/ioexpander.c
+++ /dev/null
@@ -1,286 +0,0 @@
-/* Copyright 2019 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.
- */
-
-/* IO Expander Controller Common Code */
-
-#include "console.h"
-#include "gpio.h"
-#include "hooks.h"
-#include "ioexpander.h"
-#include "util.h"
-
-#define CPRINTF(format, args...) cprintf(CC_GPIO, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_GPIO, format, ## args)
-
-static uint8_t last_val[(IOEX_COUNT + 7) / 8];
-
-static int last_val_changed(int i, int v)
-{
- if (v && !(last_val[i / 8] & (BIT(i % 8)))) {
- last_val[i / 8] |= BIT(i % 8);
- return 1;
- } else if (!v && last_val[i / 8] & (BIT(i % 8))) {
- last_val[i / 8] &= ~(BIT(i % 8));
- return 1;
- } else {
- return 0;
- }
-}
-
-int signal_is_ioex(int signal)
-{
- return ((signal >= IOEX_SIGNAL_START) && (signal < IOEX_SIGNAL_END));
-}
-
-static const struct ioex_info *ioex_get_signal_info(enum ioex_signal signal)
-{
- ASSERT(signal_is_ioex(signal));
-
- return ioex_list + signal - IOEX_SIGNAL_START;
-}
-
-static int ioex_is_valid_interrupt_signal(enum ioex_signal signal)
-{
- const struct ioexpander_drv *drv;
- const struct ioex_info *g = ioex_get_signal_info(signal);
-
- /* Fail if no interrupt handler */
- if (signal >= ioex_ih_count)
- return EC_ERROR_PARAM1;
-
- drv = ioex_config[g->ioex].drv;
- /*
- * Not every IOEX chip can support interrupt, check it before enabling
- * the interrupt function
- */
- if (drv->enable_interrupt == NULL) {
- CPRINTS("IOEX chip port %d doesn't support INT", g->ioex);
- return EC_ERROR_UNIMPLEMENTED;
- }
-
- return EC_SUCCESS;
-}
-int ioex_enable_interrupt(enum ioex_signal signal)
-{
- int rv;
- const struct ioex_info *g = ioex_get_signal_info(signal);
- const struct ioexpander_drv *drv;
-
- rv = ioex_is_valid_interrupt_signal(signal);
- if (rv != EC_SUCCESS)
- return rv;
-
- drv = ioex_config[g->ioex].drv;
- return drv->enable_interrupt(g->ioex, g->port, g->mask, 1);
-}
-
-int ioex_disable_interrupt(enum ioex_signal signal)
-{
- int rv;
- const struct ioexpander_drv *drv;
- const struct ioex_info *g = ioex_get_signal_info(signal);
-
- rv = ioex_is_valid_interrupt_signal(signal);
- if (rv != EC_SUCCESS)
- return rv;
-
- drv = ioex_config[g->ioex].drv;
- return drv->enable_interrupt(g->ioex, g->port, g->mask, 0);
-}
-
-int ioex_get_flags_by_mask(int ioex, int port, int mask, int *flags)
-{
- return ioex_config[ioex].drv->get_flags_by_mask(ioex, port, mask,
- flags);
-}
-
-int ioex_set_flags_by_mask(int ioex, int port, int mask, int flags)
-{
- return ioex_config[ioex].drv->set_flags_by_mask(ioex, port, mask,
- flags);
-}
-
-int ioex_get_flags(enum ioex_signal signal, int *flags)
-{
- const struct ioex_info *g = ioex_get_signal_info(signal);
-
- return ioex_config[g->ioex].drv->get_flags_by_mask(g->ioex,
- g->port, g->mask, flags);
-}
-
-int ioex_set_flags(enum ioex_signal signal, int flags)
-{
- const struct ioex_info *g = ioex_get_signal_info(signal);
-
- return ioex_config[g->ioex].drv->set_flags_by_mask(g->ioex,
- g->port, g->mask, flags);
-}
-
-int ioex_get_level(enum ioex_signal signal, int *val)
-{
- const struct ioex_info *g = ioex_get_signal_info(signal);
-
- return ioex_config[g->ioex].drv->get_level(g->ioex, g->port,
- g->mask, val);
-}
-
-int ioex_set_level(enum ioex_signal signal, int value)
-{
- const struct ioex_info *g = ioex_get_signal_info(signal);
-
- return ioex_config[g->ioex].drv->set_level(g->ioex, g->port,
- g->mask, value);
-}
-
-int ioex_init(int ioex)
-{
- const struct ioexpander_drv *drv = ioex_config[ioex].drv;
-
- if (drv->init == NULL)
- return EC_SUCCESS;
-
- return drv->init(ioex);
-}
-
-static void ioex_init_default(void)
-{
- const struct ioex_info *g = ioex_list;
- int i;
-
- for (i = 0; i < CONFIG_IO_EXPANDER_PORT_COUNT; i++)
- ioex_init(i);
- /*
- * Set all IO expander GPIOs to default flags according to the setting
- * in gpio.inc
- */
- for (i = 0; i < IOEX_COUNT; i++, g++) {
- if (g->mask && !(g->flags & GPIO_DEFAULT)) {
- ioex_set_flags_by_mask(g->ioex, g->port,
- g->mask, g->flags);
- }
- }
-
-}
-DECLARE_HOOK(HOOK_INIT, ioex_init_default, HOOK_PRIO_INIT_I2C + 1);
-
-const char *ioex_get_name(enum ioex_signal signal)
-{
- const struct ioex_info *g = ioex_get_signal_info(signal);
-
- return g->name;
-}
-
-static void print_ioex_info(int io)
-{
- int changed, v, val;
- int flags = 0;
-
- v = ioex_get_level(io, &val);
- if (v) {
- ccprintf("Fail to get %s level\n", ioex_get_name(io));
- return;
- }
- v = ioex_get_flags(io, &flags);
- if (v) {
- ccprintf("Fail to get %s flags\n", ioex_get_name(io));
- return;
- }
-
- changed = last_val_changed(io, val);
-
- ccprintf(" %d%c %s%s%s%s%s%s\n", val,
- (changed ? '*' : ' '),
- (flags & GPIO_INPUT ? "I " : ""),
- (flags & GPIO_OUTPUT ? "O " : ""),
- (flags & GPIO_LOW ? "L " : ""),
- (flags & GPIO_HIGH ? "H " : ""),
- (flags & GPIO_OPEN_DRAIN ? "ODR " : ""),
- ioex_get_name(io));
-
- /* Flush console to avoid truncating output */
- cflush();
-}
-
-int ioex_get_default_flags(enum ioex_signal signal)
-{
- const struct ioex_info *g = ioex_get_signal_info(signal);
-
- return g->flags;
-}
-
-/* IO expander commands */
-static enum ioex_signal find_ioex_by_name(const char *name)
-{
- int i;
-
- if (!name)
- return -1;
-
- for (i = IOEX_SIGNAL_START; i < IOEX_SIGNAL_END; i++) {
- if (!strcasecmp(name, ioex_get_name(i)))
- return i;
- }
-
- return -1;
-}
-
-static enum ec_error_list ioex_set(const char *name, int value)
-{
- enum ioex_signal signal = find_ioex_by_name(name);
-
- if (signal == -1)
- return EC_ERROR_INVAL;
-
- if (!(ioex_get_default_flags(signal) & GPIO_OUTPUT))
- return EC_ERROR_INVAL;
-
- return ioex_set_level(signal, value);
-}
-
-static int command_ioex_set(int argc, char **argv)
-{
- char *e;
- int v;
-
- if (argc < 3)
- return EC_ERROR_PARAM_COUNT;
-
- v = strtoi(argv[2], &e, 0);
- if (*e)
- return EC_ERROR_PARAM2;
-
- if (ioex_set(argv[1], v) != EC_SUCCESS)
- return EC_ERROR_PARAM1;
-
- return EC_SUCCESS;
-}
-DECLARE_CONSOLE_COMMAND(ioexset, command_ioex_set,
- "name <0 | 1>",
- "Set level of a IO expander IO");
-
-static int command_ioex_get(int argc, char **argv)
-{
- int i;
-
- /* If a signal is specified, print only that one */
- if (argc == 2) {
- i = find_ioex_by_name(argv[1]);
- if (i == -1)
- return EC_ERROR_PARAM1;
- print_ioex_info(i);
-
- return EC_SUCCESS;
- }
-
- /* Otherwise print them all */
- for (i = IOEX_SIGNAL_START; i < IOEX_SIGNAL_END; i++)
- print_ioex_info(i);
-
- return EC_SUCCESS;
-}
-DECLARE_SAFE_CONSOLE_COMMAND(ioexget, command_ioex_get,
- "[name]",
- "Read level of IO expander pin(s)");
-
diff --git a/include/gpio.h b/include/gpio.h
index e1957813e0..d6fc76cec7 100644
--- a/include/gpio.h
+++ b/include/gpio.h
@@ -235,25 +235,6 @@ int gpio_get_default_flags(enum gpio_signal signal);
void gpio_set_level(enum gpio_signal signal, int value);
/**
- * Set the value of a signal and log to the console.
- *
- * @param channel Output channel
- * @param signal Signal to set
- * @param value New value for signal (0 = low, 1 = high)
- */
-void gpio_set_level_verbose(enum console_channel channel,
- enum gpio_signal signal, int value);
-
-/**
- * Set the value of a signal that could be either a local GPIO or an IO
- * expander GPIO.
- *
- * @param signal GPIO_* or IOEX_* signal to set
- * @param value New value for signal (0 = low, 1 = high)
- */
-void gpio_or_ioex_set_level(int signal, int value);
-
-/**
* Reset the GPIO flags and alternate function state
*
* This returns the GPIO to it's default state of being a GPIO (not
@@ -339,15 +320,6 @@ void gpio_set_alternate_function(uint32_t port, uint32_t mask,
int gpio_power_down_module(enum module_id id);
#endif
-/*
- * Check if signal is a valid GPIO signal, and not IO expander (enum
- * ioex_signal) or eSPI virtual wire (enum espi_vw_signal).
- *
- * @param signal GPIO or IOEX or VW signal
- * @return 1 if signal is GPIO else return 0
- */
-int signal_is_gpio(int signal);
-
/**
* Configure a GPIO as wake source on a given condition and enable it, or
* disable it.
diff --git a/include/gpio_list.h b/include/gpio_list.h
index 37d49a6f97..581310f646 100644
--- a/include/gpio_list.h
+++ b/include/gpio_list.h
@@ -63,68 +63,3 @@ const int gpio_ih_count = ARRAY_SIZE(gpio_irq_handlers);
__attribute__((unused, section(".unused"))) = __LINE__;
#include "gpio.wrap"
-#include "ioexpander.h"
-#define IOEX_EXPIN(ioex, port, index) (ioex), (port), BIT(index)
-
-/*
- * Define the IO expander IO in gpio.inc by the format:
- * IOEX(name, EXPIN(ioex_port, port, offset), flags)
- * - name: the name of this IO pin
- * - EXPIN(ioex, port, offset)
- * - ioex: the IO expander port (defined in board.c) this IO
- * pin belongs to.
- * - port: the port number in the IO expander chip.
- * - offset: the bit offset in the port above.
- * - flags: the same as the flags of GPIO.
- *
- */
-#define IOEX(name, expin, flags) {#name, IOEX_##expin, flags},
-/*
- * Define the IO expander IO which supports interrupt in gpio.inc by
- * the format:
- * IOEX_INT(name, EXPIN(ioex_port, port, offset), flags, handler)
- * - name: the name of this IO pin
- * - EXPIN(ioex, port, offset)
- * - ioex: the IO expander port (defined in board.c) this IO
- * pin belongs to.
- * - port: the port number in the IO expander chip.
- * - offset: the bit offset in the port above.
- * - flags: the same as the flags of GPIO.
- * - handler: the IOEX IO's interrupt handler.
- */
-#define IOEX_INT(name, expin, flags, handler) IOEX(name, expin, flags)
-
-/* IO expander signal list. */
-const struct ioex_info ioex_list[] = {
- #include "gpio.wrap"
-};
-BUILD_ASSERT(ARRAY_SIZE(ioex_list) == IOEX_COUNT);
-
-/* IO Expander Interrupt Handlers */
-#define IOEX_INT(name, expin, flags, handler) handler,
-void (* const ioex_irq_handlers[])(enum ioex_signal signal) = {
- #include "gpio.wrap"
-};
-const int ioex_ih_count = ARRAY_SIZE(ioex_irq_handlers);
-/*
- * All IOEX IOs with interrupt handlers must be declared at the top of the
- * IOEX's declaration in the gpio.inc
- * file.
- */
-#define IOEX_INT(name, expin, flags, handler) \
- BUILD_ASSERT(IOEX_##name < ARRAY_SIZE(ioex_irq_handlers));
-#include "gpio.wrap"
-
-#define IOEX(name, expin, flags) expin
-#define IOEX_INT(name, expin, flags, handler) expin
-
-/* The compiler will complain if we use the same name twice or the controller
- * number declared is greater or equal to CONFIG_IO_EXPANDER_PORT_COUNT.
- * The linker ignores anything that gets by.
- */
-#define EXPIN(a, b, c...) \
- static const int _expin_ ## a ## _ ## b ## _ ## c \
- __attribute__((unused, section(".unused"))) = __LINE__; \
- BUILD_ASSERT(a < CONFIG_IO_EXPANDER_PORT_COUNT);
-
-#include "gpio.wrap"
diff --git a/include/gpio_signal.h b/include/gpio_signal.h
index 478e83dca5..5d629640c9 100644
--- a/include/gpio_signal.h
+++ b/include/gpio_signal.h
@@ -30,20 +30,4 @@ enum gpio_signal {
};
BUILD_ASSERT(GPIO_COUNT < GPIO_LIMIT);
-#define IOEX(name, expin, flags) IOEX_##name,
-#define IOEX_INT(name, expin, flags, signal) IOEX_##name,
-
-enum ioex_signal {
- /* The first valid IOEX signal is 0x1000 */
- IOEX_SIGNAL_START = GPIO_LIMIT + 1,
- /* Used to ensure that the first IOEX signal is same as start */
- __IOEX_PLACEHOLDER = GPIO_LIMIT,
- #include "gpio.wrap"
- IOEX_SIGNAL_END,
- IOEX_LIMIT = 0x1FFF
-};
-BUILD_ASSERT(IOEX_SIGNAL_END < IOEX_LIMIT);
-
-#define IOEX_COUNT (IOEX_SIGNAL_END - IOEX_SIGNAL_START)
-
#endif /* __CROS_EC_GPIO_SIGNAL_H */
diff --git a/include/ioexpander.h b/include/ioexpander.h
deleted file mode 100644
index 206b0a390c..0000000000
--- a/include/ioexpander.h
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright 2019 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_IOEXPANDER_H
-#define __CROS_EC_IOEXPANDER_H
-
-/* IO expander signal definition structure */
-struct ioex_info {
- /* Signal name */
- const char *name;
-
- /* IO expander port number */
- uint16_t ioex;
-
- /* IO port number in IO expander */
- uint16_t port;
-
- /* Bitmask on that port (1 << N) */
- uint32_t mask;
-
- /* Flags - the same as the GPIO flags */
- uint32_t flags;
-};
-
-/* Signal information from board.c. Must match order from enum ioex_signal. */
-extern const struct ioex_info ioex_list[];
-extern void (* const ioex_irq_handlers[])(enum ioex_signal signal);
-extern const int ioex_ih_count;
-
-struct ioexpander_drv {
- /* Initialize IO expander chip/driver */
- int (*init)(int ioex);
- /* Get the current level of the IOEX pin */
- int (*get_level)(int ioex, int port, int mask, int *val);
- /* Set the level of the IOEX pin */
- int (*set_level)(int ioex, int port, int mask, int val);
- /* Get flags for the IOEX pin */
- int (*get_flags_by_mask)(int ioex, int port, int mask, int *flags);
- /* Set flags for the IOEX pin */
- int (*set_flags_by_mask)(int ioex, int port, int mask, int flags);
- /* Enable/disable interrupt for the IOEX pin */
- int (*enable_interrupt)(int ioex, int port, int mask, int enable);
-};
-
-struct ioexpander_config_t {
- /* Physical I2C port connects to the IO expander chip. */
- int i2c_host_port;
- /* I2C slave address */
- int i2c_slave_addr;
- /*
- * Pointer to the specific IO expander chip's ops defined in
- * the struct ioexpander_drv.
- */
- const struct ioexpander_drv *drv;
-};
-
-extern struct ioexpander_config_t ioex_config[];
-
-/*
- * Enable the interrupt for the IOEX signal
- *
- * @param signal IOEX signal to enable the interrupt
- * @return EC_SUCCESS if successful, non-zero if error.
- */
-int ioex_enable_interrupt(enum ioex_signal signal);
-
-/*
- * Disable the interrupt for the IOEX signal
- *
- * @param signal IOEX signal to disable the interrupt
- * @return EC_SUCCESS if successful, non-zero if error.
- */
-int ioex_disable_interrupt(enum ioex_signal signal);
-
-/*
- * Get flags for the IOEX pin by mask
- *
- * @param ioex IO expander chip's port number
- * @param port IO port in the IO expander chip
- * @param mask Bitmask of the pin on the port above
- * @param flags Pointer to the keep the flags read
- * @return EC_SUCCESS if successful, non-zero if error.
- */
-int ioex_get_flags_by_mask(int ioex, int port, int mask, int *flags);
-
-/*
- * Set flags for the IOEX pin by mask
- *
- * @param ioex IO expander chip's port number
- * @param port IO port in the IO expander chip
- * @param mask Bitmask of the pin on the port above
- * @param flags flags to set
- * @return EC_SUCCESS if successful, non-zero if error.
- */
-int ioex_set_flags_by_mask(int ioex, int port, int mask, int flags);
-
-/*
- * Get flags for the IOEX signal
- *
- * @param signal IOEX signal to get flags for
- * @param flags Pointer to the keep the flags read
- * @return EC_SUCCESS if successful, non-zero if error.
- */
-int ioex_get_flags(enum ioex_signal signal, int *flags);
-
-/*
- * Set flags for the IOEX signal
- *
- * @param signal IOEX signal to set flags for
- * @param flags New flags for the IOEX signal
- * @return EC_SUCCESS if successful, non-zero if error.
- */
-int ioex_set_flags(enum ioex_signal signal, int flags);
-
-/*
- * Get the current level of the IOEX signal
- *
- * @param signal IOEX signal to get the level
- * @param val Pointer to the keep the level read
- * @return EC_SUCCESS if successful, non-zero if error.
- */
-int ioex_get_level(enum ioex_signal signal, int *val);
-
-/*
- * Set the level of the IOEX signal
- *
- * @param signal IOEX signal to set the level
- * @param value New level for the IOEX signal
- * @return EC_SUCCESS if successful, non-zero if error.
- */
-int ioex_set_level(enum ioex_signal signal, int value);
-
-/*
- * Initialize IO expander chip/driver
- *
- * @param ioex IO expander chip's port number
- * @return EC_SUCCESS if successful, non-zero if error.
- */
-int ioex_init(int ioex);
-
-/*
- * Get the name for the IOEX signal
- *
- * @param signal IOEX signal to get the name
- * @returns name of the given IOEX signal
- */
-const char *ioex_get_name(enum ioex_signal signal);
-
-/*
- * Check if signal is an IO expander signal or GPIO signal.
- *
- * @param signal GPIO or IOEX signal
- * @return 1 if signal is IOEX else return 0
- */
-int signal_is_ioex(int signal);
-
-#endif /* __CROS_EC_IOEXPANDER_H */
diff --git a/power/build.mk b/power/build.mk
index 2a22057982..dead138af9 100644
--- a/power/build.mk
+++ b/power/build.mk
@@ -12,7 +12,6 @@ power-$(CONFIG_CHIPSET_CANNONLAKE)+=cannonlake.o intel_x86.o
power-$(CONFIG_CHIPSET_COMETLAKE)+=cometlake.o intel_x86.o
power-$(CONFIG_CHIPSET_COMETLAKE_DISCRETE)+=cometlake-discrete.o intel_x86.o
power-$(CONFIG_CHIPSET_ECDRIVEN)+=ec_driven.o
-power-$(CONFIG_CHIPSET_ICL_TGL)+=icelake.o intel_x86.o
power-$(CONFIG_CHIPSET_MT817X)+=mt817x.o
power-$(CONFIG_CHIPSET_MT8183)+=mt8183.o
power-$(CONFIG_CHIPSET_RK3288)+=rk3288.o
diff --git a/power/icelake.c b/power/icelake.c
deleted file mode 100644
index 99981e32a4..0000000000
--- a/power/icelake.c
+++ /dev/null
@@ -1,248 +0,0 @@
-/* Copyright 2018 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.
- */
-
-/* Icelake chipset power control module for Chrome EC */
-
-#include "chipset.h"
-#include "console.h"
-#include "gpio.h"
-#include "intel_x86.h"
-#include "power.h"
-#include "power_button.h"
-#include "task.h"
-#include "timer.h"
-
-/* Console output macros */
-#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args)
-
-#ifdef CONFIG_BRINGUP
-#define GPIO_SET_LEVEL(signal, value) \
- gpio_set_level_verbose(CC_CHIPSET, signal, value)
-#else
-#define GPIO_SET_LEVEL(signal, value) \
- gpio_set_level(signal, value)
-#endif
-
-/* The wait time is ~150 msec, allow for safety margin. */
-#define IN_PCH_SLP_SUS_WAIT_TIME_USEC (250 * MSEC)
-
-static int forcing_shutdown; /* Forced shutdown in progress? */
-
-/* Power signals list. Must match order of enum power_signal. */
-const struct power_signal_info power_signal_list[] = {
- [X86_SLP_S0_DEASSERTED] = {
- .gpio = GPIO_PCH_SLP_S0_L,
- .flags = POWER_SIGNAL_ACTIVE_HIGH |
- POWER_SIGNAL_DISABLE_AT_BOOT,
- .name = "SLP_S0_DEASSERTED",
- },
- [X86_SLP_S3_DEASSERTED] = {
- .gpio = SLP_S3_SIGNAL_L,
- .flags = POWER_SIGNAL_ACTIVE_HIGH,
- .name = "SLP_S3_DEASSERTED",
- },
- [X86_SLP_S4_DEASSERTED] = {
- .gpio = SLP_S4_SIGNAL_L,
- .flags = POWER_SIGNAL_ACTIVE_HIGH,
- .name = "SLP_S4_DEASSERTED",
- },
- [X86_SLP_SUS_DEASSERTED] = {
- .gpio = GPIO_SLP_SUS_L,
- .flags = POWER_SIGNAL_ACTIVE_HIGH,
- .name = "SLP_SUS_DEASSERTED",
- },
- [X86_RSMRST_L_PGOOD] = {
- .gpio = GPIO_PG_EC_RSMRST_ODL,
- .flags = POWER_SIGNAL_ACTIVE_HIGH,
- .name = "RSMRST_L_PGOOD",
- },
- [X86_DSW_DPWROK] = {
- .gpio = GPIO_PG_EC_DSW_PWROK,
- .flags = POWER_SIGNAL_ACTIVE_HIGH,
- .name = "DSW_DPWROK",
- },
- [X86_ALL_SYS_PGOOD] = {
- .gpio = GPIO_PG_EC_ALL_SYS_PWRGD,
- .flags = POWER_SIGNAL_ACTIVE_HIGH,
- .name = "ALL_SYS_PWRGD",
- },
-};
-BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
-
-void chipset_force_shutdown(enum chipset_shutdown_reason reason)
-{
- int timeout_ms = 50;
-
- CPRINTS("%s() %d", __func__, reason);
- report_ap_reset(reason);
-
- /* Turn off RMSRST_L to meet tPCH12 */
- GPIO_SET_LEVEL(GPIO_PCH_RSMRST_L, 0);
-
- /* Turn off DSW_PWROK to meet tPCH14 */
- GPIO_SET_LEVEL(GPIO_PCH_DSW_PWROK, 0);
-
- /* Turn off DSW load switch. */
- GPIO_SET_LEVEL(GPIO_EN_PP3300_A, 0);
-
- /* Turn off PP5000 rail */
- if (IS_ENABLED(CONFIG_POWER_PP5000_CONTROL))
- power_5v_enable(task_get_current(), 0);
- else
- GPIO_SET_LEVEL(GPIO_EN_PP5000, 0);
-
- /*
- * TODO(b/111810925): Replace this wait with
- * power_wait_signals_timeout()
- */
- /* Now wait for DSW_PWROK and RSMRST_ODL to go away. */
- while (gpio_get_level(GPIO_PG_EC_DSW_PWROK) &&
- gpio_get_level(GPIO_PG_EC_RSMRST_ODL) && (timeout_ms > 0)) {
- msleep(1);
- timeout_ms--;
- };
-
- if (!timeout_ms)
- CPRINTS("DSW_PWROK or RSMRST_ODL didn't go low! Assuming G3.");
-}
-
-void chipset_handle_espi_reset_assert(void)
-{
- /*
- * If eSPI_Reset# pin is asserted without SLP_SUS# being asserted, then
- * it means that there is an unexpected power loss (global reset
- * event). In this case, check if shutdown was being forced by pressing
- * power button. If yes, release power button.
- */
- if ((power_get_signals() & IN_PCH_SLP_SUS_DEASSERTED) &&
- forcing_shutdown) {
- power_button_pch_release();
- forcing_shutdown = 0;
- }
-}
-
-enum power_state chipset_force_g3(void)
-{
- chipset_force_shutdown(CHIPSET_SHUTDOWN_G3);
-
- return POWER_G3;
-}
-
-/*
- * Ice Lake and Tiger Lake permit PCH_PWROK and SYS_PWROK signals coming
- * up in any order. If the platform needs extra time for peripherals to come
- * up, the board can override this function.
- */
-__overridable void board_icl_tgl_all_sys_pwrgood(void)
-{
-
-}
-
-static void enable_pp5000_rail(void)
-{
- if (IS_ENABLED(CONFIG_POWER_PP5000_CONTROL))
- power_5v_enable(task_get_current(), 1);
- else
- GPIO_SET_LEVEL(GPIO_EN_PP5000, 1);
-
-}
-
-enum power_state power_handle_state(enum power_state state)
-{
- int dswpwrok_in = gpio_get_level(GPIO_PG_EC_DSW_PWROK);
- static int dswpwrok_out = -1;
- int all_sys_pwrgd_in;
- int all_sys_pwrgd_out;
-
- /* Pass-through DSW_PWROK to ICL. */
- if (dswpwrok_in != dswpwrok_out) {
- CPRINTS("Pass thru GPIO_DSW_PWROK: %d", dswpwrok_in);
- /*
- * A minimum 10 msec delay is required between PP3300_A being
- * stable and the DSW_PWROK signal being passed to the PCH.
- */
- msleep(10);
- GPIO_SET_LEVEL(GPIO_PCH_DSW_PWROK, dswpwrok_in);
- dswpwrok_out = dswpwrok_in;
- }
-
- common_intel_x86_handle_rsmrst(state);
-
- switch (state) {
-
- case POWER_G3S5:
- /* Default behavior - turn on PP5000 rail first */
- if (!IS_ENABLED(CONFIG_CHIPSET_PP3300_RAIL_FIRST))
- enable_pp5000_rail();
-
- /*
- * TODO(b/111121615): Should modify this to wait until the
- * common power state machine indicates that it's ok to try an
- * boot the AP prior to turning on the 3300_A rail. This could
- * be done using chipset_pre_init_callback()
- */
- /* Turn on the PP3300_DSW rail. */
- GPIO_SET_LEVEL(GPIO_EN_PP3300_A, 1);
- if (power_wait_signals(IN_PGOOD_ALL_CORE))
- break;
-
- /* Pass thru DSWPWROK again since we changed it. */
- dswpwrok_in = gpio_get_level(GPIO_PG_EC_DSW_PWROK);
- /*
- * A minimum 10 msec delay is required between PP3300_A being
- * stable and the DSW_PWROK signal being passed to the PCH.
- */
- msleep(10);
- GPIO_SET_LEVEL(GPIO_PCH_DSW_PWROK, dswpwrok_in);
- CPRINTS("Pass thru GPIO_DSW_PWROK: %d", dswpwrok_in);
- dswpwrok_out = dswpwrok_in;
-
- /* Turn on PP5000 after PP3300 and DSW PWROK when enabled */
- if (IS_ENABLED(CONFIG_CHIPSET_PP3300_RAIL_FIRST))
- enable_pp5000_rail();
-
- /*
- * Now wait for SLP_SUS_L to go high based on tPCH32. If this
- * signal doesn't go high within 250 msec then go back to G3.
- */
- if (power_wait_signals_timeout(IN_PCH_SLP_SUS_DEASSERTED,
- IN_PCH_SLP_SUS_WAIT_TIME_USEC) != EC_SUCCESS) {
- CPRINTS("SLP_SUS_L didn't go high! Assuming G3.");
- return POWER_G3;
- }
- break;
-
- case POWER_S5:
- if (forcing_shutdown) {
- power_button_pch_release();
- forcing_shutdown = 0;
- }
- /* If SLP_SUS_L is asserted, we're no longer in S5. */
- if (!power_has_signals(IN_PCH_SLP_SUS_DEASSERTED))
- return POWER_S5G3;
- break;
-
- case POWER_S0:
- /*
- * Check value of PG_EC_ALL_SYS_PWRGD to see if PCH_SYS_PWROK
- * needs to be changed. If it's low->high transition, call board
- * specific handling if provided.
- */
- all_sys_pwrgd_in = gpio_get_level(GPIO_PG_EC_ALL_SYS_PWRGD);
- all_sys_pwrgd_out = gpio_get_level(GPIO_PCH_SYS_PWROK);
-
- if (all_sys_pwrgd_in != all_sys_pwrgd_out) {
- if (all_sys_pwrgd_in)
- board_icl_tgl_all_sys_pwrgood();
- GPIO_SET_LEVEL(GPIO_PCH_SYS_PWROK, all_sys_pwrgd_in);
- }
- break;
-
- default:
- break;
- }
-
- return common_intel_x86_power_handle_state(state);
-}
diff --git a/power/icelake.h b/power/icelake.h
deleted file mode 100644
index c051a2516a..0000000000
--- a/power/icelake.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright 2018 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.
- */
-
-/* Icelake chipset power control module for Chrome EC */
-
-#ifndef __CROS_EC_ICELAKE_H
-#define __CROS_EC_ICELAKE_H
-
-/* Input state flags. */
-#define IN_PCH_SLP_S3_DEASSERTED POWER_SIGNAL_MASK(X86_SLP_S3_DEASSERTED)
-#define IN_PCH_SLP_S4_DEASSERTED POWER_SIGNAL_MASK(X86_SLP_S4_DEASSERTED)
-#define IN_PCH_SLP_SUS_DEASSERTED POWER_SIGNAL_MASK(X86_SLP_SUS_DEASSERTED)
-
-#define IN_ALL_PM_SLP_DEASSERTED (IN_PCH_SLP_S3_DEASSERTED | \
- IN_PCH_SLP_S4_DEASSERTED | \
- IN_PCH_SLP_SUS_DEASSERTED)
-
-#define IN_PGOOD_ALL_CORE POWER_SIGNAL_MASK(X86_DSW_DPWROK)
-
-#define IN_ALL_S0 (IN_PGOOD_ALL_CORE | IN_ALL_PM_SLP_DEASSERTED)
-
-#define CHIPSET_G3S5_POWERUP_SIGNAL IN_PCH_SLP_SUS_DEASSERTED
-
-#define CHARGER_INITIALIZED_DELAY_MS 100
-#define CHARGER_INITIALIZED_TRIES 40
-
-/* Power signals list */
-enum power_signal {
- X86_SLP_S0_DEASSERTED,
- X86_SLP_S3_DEASSERTED,
- X86_SLP_S4_DEASSERTED,
- X86_SLP_SUS_DEASSERTED,
- X86_RSMRST_L_PGOOD,
- X86_DSW_DPWROK,
- X86_ALL_SYS_PGOOD,
-
- /* Number of X86 signals */
- POWER_SIGNAL_COUNT
-};
-
-#endif /* __CROS_EC_ICELAKE_H */