blob: a6cabfb8b012ab18e15fe87da71b3a0eb76120cd [file] [log] [blame]
Mateusz Kulikowski2507d822016-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 Warren859f2562016-05-12 12:03:35 -060012#include <sysreset.h>
Mateusz Kulikowski2507d822016-03-31 23:12:32 +020013#include <asm/io.h>
14
15DECLARE_GLOBAL_DATA_PTR;
16
Stephen Warren859f2562016-05-12 12:03:35 -060017static int msm_sysreset_request(struct udevice *dev, enum sysreset_t type)
Mateusz Kulikowski2507d822016-03-31 23:12:32 +020018{
19 phys_addr_t addr = dev_get_addr(dev);
20 if (!addr)
21 return -EINVAL;
22 writel(0, addr);
23 return -EINPROGRESS;
24}
25
Stephen Warren859f2562016-05-12 12:03:35 -060026static struct sysreset_ops msm_sysreset_ops = {
27 .request = msm_sysreset_request,
Mateusz Kulikowski2507d822016-03-31 23:12:32 +020028};
29
Stephen Warren859f2562016-05-12 12:03:35 -060030static const struct udevice_id msm_sysreset_ids[] = {
Mateusz Kulikowski2507d822016-03-31 23:12:32 +020031 { .compatible = "qcom,pshold" },
32 { }
33};
34
35U_BOOT_DRIVER(msm_reset) = {
Stephen Warren859f2562016-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 Kulikowski2507d822016-03-31 23:12:32 +020040};