diff options
author | Max Filippov <jcmvbkbc@gmail.com> | 2016-08-07 08:53:00 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2016-08-12 09:22:17 -0400 |
commit | b25732c22beccb5a2ce3ec4174ea084ba0e176ab (patch) | |
tree | 914152963986e5b9295b89ac63cef90cf0ec6255 /drivers/misc | |
parent | da91cfed54ec44d88f93af2adfbdeada8ab4403e (diff) | |
download | u-boot-b25732c22beccb5a2ce3ec4174ea084ba0e176ab.tar.gz |
drivers/sysreset: group sysreset drivers
Create drivers/sysreset and move sysreset-uclass and all sysreset
drivers there.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/Kconfig | 9 | ||||
-rw-r--r-- | drivers/misc/Makefile | 2 | ||||
-rw-r--r-- | drivers/misc/sysreset-uclass.c | 81 | ||||
-rw-r--r-- | drivers/misc/sysreset_sandbox.c | 101 |
4 files changed, 0 insertions, 193 deletions
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index b84e351da7..80c15581b9 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -121,15 +121,6 @@ config PCA9551_I2C_ADDR help The I2C address of the PCA9551 LED controller. -config SYSRESET - bool "Enable support for system reset drivers" - depends on DM - help - Enable system reset drivers which can be used to reset the CPU or - board. Each driver can provide a reset method which will be called - to effect a reset. The uclass will try all available drivers when - reset_walk() is called. - config WINBOND_W83627 bool "Enable Winbond Super I/O driver" help diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index fff6f0cdf9..af541c6784 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -27,7 +27,6 @@ obj-$(CONFIG_MXS_OCOTP) += mxs_ocotp.o obj-$(CONFIG_NS87308) += ns87308.o obj-$(CONFIG_PDSP188x) += pdsp188x.o obj-$(CONFIG_$(SPL_)PWRSEQ) += pwrseq-uclass.o -obj-$(CONFIG_SANDBOX) += sysreset_sandbox.o ifdef CONFIG_DM_I2C ifndef CONFIG_SPL_BUILD obj-$(CONFIG_SANDBOX) += i2c_eeprom_emul.o @@ -47,7 +46,6 @@ obj-$(CONFIG_TWL4030_LED) += twl4030_led.o obj-$(CONFIG_FSL_IFC) += fsl_ifc.o obj-$(CONFIG_FSL_SEC_MON) += fsl_sec_mon.o obj-$(CONFIG_PCA9551_LED) += pca9551_led.o -obj-$(CONFIG_SYSRESET) += sysreset-uclass.o obj-$(CONFIG_FSL_DEVICE_DISABLE) += fsl_devdis.o obj-$(CONFIG_WINBOND_W83627) += winbond_w83627.o obj-$(CONFIG_QFW) += qfw.o diff --git a/drivers/misc/sysreset-uclass.c b/drivers/misc/sysreset-uclass.c deleted file mode 100644 index 3566d17fb1..0000000000 --- a/drivers/misc/sysreset-uclass.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (C) 2015 Google, Inc - * Written by Simon Glass <sjg@chromium.org> - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -#include <common.h> -#include <sysreset.h> -#include <dm.h> -#include <errno.h> -#include <regmap.h> -#include <dm/device-internal.h> -#include <dm/lists.h> -#include <dm/root.h> -#include <linux/err.h> - -int sysreset_request(struct udevice *dev, enum sysreset_t type) -{ - struct sysreset_ops *ops = sysreset_get_ops(dev); - - if (!ops->request) - return -ENOSYS; - - return ops->request(dev, type); -} - -int sysreset_walk(enum sysreset_t type) -{ - struct udevice *dev; - int ret = -ENOSYS; - - while (ret != -EINPROGRESS && type < SYSRESET_COUNT) { - for (uclass_first_device(UCLASS_SYSRESET, &dev); - dev; - uclass_next_device(&dev)) { - ret = sysreset_request(dev, type); - if (ret == -EINPROGRESS) - break; - } - type++; - } - - return ret; -} - -void sysreset_walk_halt(enum sysreset_t type) -{ - int ret; - - ret = sysreset_walk(type); - - /* Wait for the reset to take effect */ - if (ret == -EINPROGRESS) - mdelay(100); - - /* Still no reset? Give up */ - debug("System reset not supported on this platform\n"); - hang(); -} - -/** - * reset_cpu() - calls sysreset_walk(SYSRESET_WARM) - */ -void reset_cpu(ulong addr) -{ - sysreset_walk_halt(SYSRESET_WARM); -} - - -int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) -{ - sysreset_walk_halt(SYSRESET_WARM); - - return 0; -} - -UCLASS_DRIVER(sysreset) = { - .id = UCLASS_SYSRESET, - .name = "sysreset", -}; diff --git a/drivers/misc/sysreset_sandbox.c b/drivers/misc/sysreset_sandbox.c deleted file mode 100644 index 7ae7f386ee..0000000000 --- a/drivers/misc/sysreset_sandbox.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2015 Google, Inc - * Written by Simon Glass <sjg@chromium.org> - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -#include <common.h> -#include <dm.h> -#include <errno.h> -#include <sysreset.h> -#include <asm/state.h> -#include <asm/test.h> - -DECLARE_GLOBAL_DATA_PTR; - -static int sandbox_warm_sysreset_request(struct udevice *dev, - enum sysreset_t type) -{ - struct sandbox_state *state = state_get_current(); - - switch (type) { - case SYSRESET_WARM: - state->last_sysreset = type; - break; - default: - return -ENOSYS; - } - if (!state->sysreset_allowed[type]) - return -EACCES; - - return -EINPROGRESS; -} - -static int sandbox_sysreset_request(struct udevice *dev, enum sysreset_t type) -{ - struct sandbox_state *state = state_get_current(); - - /* - * If we have a device tree, the device we created from platform data - * (see the U_BOOT_DEVICE() declaration below) should not do anything. - * If we are that device, return an error. - */ - if (state->fdt_fname && dev->of_offset == -1) - return -ENODEV; - - switch (type) { - case SYSRESET_COLD: - state->last_sysreset = type; - break; - case SYSRESET_POWER: - state->last_sysreset = type; - if (!state->sysreset_allowed[type]) - return -EACCES; - sandbox_exit(); - break; - default: - return -ENOSYS; - } - if (!state->sysreset_allowed[type]) - return -EACCES; - - return -EINPROGRESS; -} - -static struct sysreset_ops sandbox_sysreset_ops = { - .request = sandbox_sysreset_request, -}; - -static const struct udevice_id sandbox_sysreset_ids[] = { - { .compatible = "sandbox,reset" }, - { } -}; - -U_BOOT_DRIVER(sysreset_sandbox) = { - .name = "sysreset_sandbox", - .id = UCLASS_SYSRESET, - .of_match = sandbox_sysreset_ids, - .ops = &sandbox_sysreset_ops, -}; - -static struct sysreset_ops sandbox_warm_sysreset_ops = { - .request = sandbox_warm_sysreset_request, -}; - -static const struct udevice_id sandbox_warm_sysreset_ids[] = { - { .compatible = "sandbox,warm-reset" }, - { } -}; - -U_BOOT_DRIVER(warm_sysreset_sandbox) = { - .name = "warm_sysreset_sandbox", - .id = UCLASS_SYSRESET, - .of_match = sandbox_warm_sysreset_ids, - .ops = &sandbox_warm_sysreset_ops, -}; - -/* This is here in case we don't have a device tree */ -U_BOOT_DEVICE(sysreset_sandbox_non_fdt) = { - .name = "sysreset_sandbox", -}; |