// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (C) 2019 MediaTek Inc. All Rights Reserved.
 *
 * Author: Weijie Gao <weijie.gao@mediatek.com>
 */

#include <common.h>
#include <dm.h>
#include <errno.h>
#include <malloc.h>
#include <reset-uclass.h>
#include <linux/io.h>

struct mtmips_reset_priv {
	void __iomem *base;
};

static int mtmips_reset_request(struct reset_ctl *reset_ctl)
{
	return 0;
}

static int mtmips_reset_free(struct reset_ctl *reset_ctl)
{
	return 0;
}

static int mtmips_reset_assert(struct reset_ctl *reset_ctl)
{
	struct mtmips_reset_priv *priv = dev_get_priv(reset_ctl->dev);

	setbits_32(priv->base, BIT(reset_ctl->id));

	return 0;
}

static int mtmips_reset_deassert(struct reset_ctl *reset_ctl)
{
	struct mtmips_reset_priv *priv = dev_get_priv(reset_ctl->dev);

	clrbits_32(priv->base, BIT(reset_ctl->id));

	return 0;
}

static const struct reset_ops mtmips_reset_ops = {
	.request	= mtmips_reset_request,
	.rfree		= mtmips_reset_free,
	.rst_assert	= mtmips_reset_assert,
	.rst_deassert	= mtmips_reset_deassert,
};

static int mtmips_reset_probe(struct udevice *dev)
{
	return 0;
}

static int mtmips_reset_ofdata_to_platdata(struct udevice *dev)
{
	struct mtmips_reset_priv *priv = dev_get_priv(dev);

	priv->base = (void __iomem *)dev_remap_addr_index(dev, 0);
	if (!priv->base)
		return -EINVAL;

	return 0;
}

static const struct udevice_id mtmips_reset_ids[] = {
	{ .compatible = "mediatek,mtmips-reset" },
	{ }
};

U_BOOT_DRIVER(mtmips_reset) = {
	.name = "mtmips-reset",
	.id = UCLASS_RESET,
	.of_match = mtmips_reset_ids,
	.ofdata_to_platdata = mtmips_reset_ofdata_to_platdata,
	.probe = mtmips_reset_probe,
	.priv_auto_alloc_size = sizeof(struct mtmips_reset_priv),
	.ops = &mtmips_reset_ops,
};
