blob: 9869813978c285602267ecb14adba21fee264ab6 [file] [log] [blame]
Mateusz Kulikowski08592132016-03-31 23:12:32 +02001/*
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 Warren11636252016-05-12 12:03:35 -060012#include <sysreset.h>
Mateusz Kulikowski08592132016-03-31 23:12:32 +020013#include <asm/io.h>
14
15DECLARE_GLOBAL_DATA_PTR;
16
Stephen Warren11636252016-05-12 12:03:35 -060017static int msm_sysreset_request(struct udevice *dev, enum sysreset_t type)
Mateusz Kulikowski08592132016-03-31 23:12:32 +020018{
Simon Glassa821c4a2017-05-17 17:18:05 -060019 phys_addr_t addr = devfdt_get_addr(dev);
Mateusz Kulikowski08592132016-03-31 23:12:32 +020020 if (!addr)
21 return -EINVAL;
22 writel(0, addr);
23 return -EINPROGRESS;
24}
25
Stephen Warren11636252016-05-12 12:03:35 -060026static struct sysreset_ops msm_sysreset_ops = {
27 .request = msm_sysreset_request,
Mateusz Kulikowski08592132016-03-31 23:12:32 +020028};
29
Stephen Warren11636252016-05-12 12:03:35 -060030static const struct udevice_id msm_sysreset_ids[] = {
Mateusz Kulikowski08592132016-03-31 23:12:32 +020031 { .compatible = "qcom,pshold" },
32 { }
33};
34
35U_BOOT_DRIVER(msm_reset) = {
Stephen Warren11636252016-05-12 12:03:35 -060036 .name = "msm_sysreset",
37 .id = UCLASS_SYSRESET,
38 .of_match = msm_sysreset_ids,
39 .ops = &msm_sysreset_ops,
Mateusz Kulikowski08592132016-03-31 23:12:32 +020040};