Bin Meng | ed0efdf | 2018-07-19 03:07:30 -0700 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * Copyright (C) 2018, Bin Meng <bmeng.cn@gmail.com> |
| 4 | * |
| 5 | * Reset driver for tangier processor |
| 6 | */ |
| 7 | |
Bin Meng | ed0efdf | 2018-07-19 03:07:30 -0700 | [diff] [blame] | 8 | #include <dm.h> |
| 9 | #include <sysreset.h> |
| 10 | #include <asm/scu.h> |
| 11 | |
| 12 | static int tangier_sysreset_request(struct udevice *dev, enum sysreset_t type) |
| 13 | { |
| 14 | int value; |
| 15 | |
| 16 | switch (type) { |
| 17 | case SYSRESET_WARM: |
| 18 | value = IPCMSG_WARM_RESET; |
| 19 | break; |
| 20 | case SYSRESET_COLD: |
| 21 | value = IPCMSG_COLD_RESET; |
| 22 | break; |
| 23 | default: |
| 24 | return -ENOSYS; |
| 25 | } |
| 26 | |
| 27 | scu_ipc_simple_command(value, 0); |
| 28 | |
| 29 | return -EINPROGRESS; |
| 30 | } |
| 31 | |
| 32 | static const struct udevice_id tangier_sysreset_ids[] = { |
| 33 | { .compatible = "intel,reset-tangier" }, |
| 34 | { } |
| 35 | }; |
| 36 | |
| 37 | static struct sysreset_ops tangier_sysreset_ops = { |
| 38 | .request = tangier_sysreset_request, |
| 39 | }; |
| 40 | |
| 41 | U_BOOT_DRIVER(tangier_sysreset) = { |
| 42 | .name = "tangier-sysreset", |
| 43 | .id = UCLASS_SYSRESET, |
| 44 | .of_match = tangier_sysreset_ids, |
| 45 | .ops = &tangier_sysreset_ops, |
Bin Meng | ed0efdf | 2018-07-19 03:07:30 -0700 | [diff] [blame] | 46 | }; |