Mateusz Kulikowski | 0859213 | 2016-03-31 23:12:32 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Qualcomm APQ8016 reset controller driver |
| 3 | * |
| 4 | * (C) Copyright 2015 Mateusz Kulikowski <mateusz.kulikowski@gmail.com> |
| 5 | * |
| 6 | * SPDX-License-Identifier: GPL-2.0+ |
| 7 | */ |
| 8 | |
| 9 | #include <common.h> |
| 10 | #include <dm.h> |
| 11 | #include <errno.h> |
Stephen Warren | 1163625 | 2016-05-12 12:03:35 -0600 | [diff] [blame] | 12 | #include <sysreset.h> |
Mateusz Kulikowski | 0859213 | 2016-03-31 23:12:32 +0200 | [diff] [blame] | 13 | #include <asm/io.h> |
| 14 | |
| 15 | DECLARE_GLOBAL_DATA_PTR; |
| 16 | |
Stephen Warren | 1163625 | 2016-05-12 12:03:35 -0600 | [diff] [blame] | 17 | static int msm_sysreset_request(struct udevice *dev, enum sysreset_t type) |
Mateusz Kulikowski | 0859213 | 2016-03-31 23:12:32 +0200 | [diff] [blame] | 18 | { |
Simon Glass | a821c4a | 2017-05-17 17:18:05 -0600 | [diff] [blame^] | 19 | phys_addr_t addr = devfdt_get_addr(dev); |
Mateusz Kulikowski | 0859213 | 2016-03-31 23:12:32 +0200 | [diff] [blame] | 20 | if (!addr) |
| 21 | return -EINVAL; |
| 22 | writel(0, addr); |
| 23 | return -EINPROGRESS; |
| 24 | } |
| 25 | |
Stephen Warren | 1163625 | 2016-05-12 12:03:35 -0600 | [diff] [blame] | 26 | static struct sysreset_ops msm_sysreset_ops = { |
| 27 | .request = msm_sysreset_request, |
Mateusz Kulikowski | 0859213 | 2016-03-31 23:12:32 +0200 | [diff] [blame] | 28 | }; |
| 29 | |
Stephen Warren | 1163625 | 2016-05-12 12:03:35 -0600 | [diff] [blame] | 30 | static const struct udevice_id msm_sysreset_ids[] = { |
Mateusz Kulikowski | 0859213 | 2016-03-31 23:12:32 +0200 | [diff] [blame] | 31 | { .compatible = "qcom,pshold" }, |
| 32 | { } |
| 33 | }; |
| 34 | |
| 35 | U_BOOT_DRIVER(msm_reset) = { |
Stephen Warren | 1163625 | 2016-05-12 12:03:35 -0600 | [diff] [blame] | 36 | .name = "msm_sysreset", |
| 37 | .id = UCLASS_SYSRESET, |
| 38 | .of_match = msm_sysreset_ids, |
| 39 | .ops = &msm_sysreset_ops, |
Mateusz Kulikowski | 0859213 | 2016-03-31 23:12:32 +0200 | [diff] [blame] | 40 | }; |