// SPDX-License-Identifier: GPL-2.0+
/*
 * Copyright (C) 2018 Álvaro Fernández Rojas <noltari@gmail.com>
 *
 * Derived from linux/arch/mips/bcm63xx/usb-common.c:
 *	Copyright 2008 Maxime Bizon <mbizon@freebox.fr>
 *	Copyright 2013 Florian Fainelli <florian@openwrt.org>
 */

#include <clk.h>
#include <dm.h>
#include <generic-phy.h>
#include <log.h>
#include <malloc.h>
#include <reset.h>
#include <asm/io.h>
#include <dm/device.h>
#include <linux/bitops.h>

#define USBH_SETUP_PORT1_EN	BIT(0)

struct bcm6348_usbh_priv {
	void __iomem *regs;
};

static int bcm6348_usbh_init(struct phy *phy)
{
	struct bcm6348_usbh_priv *priv = dev_get_priv(phy->dev);

	writel_be(USBH_SETUP_PORT1_EN, priv->regs);

	return 0;
}

static struct phy_ops bcm6348_usbh_ops = {
	.init = bcm6348_usbh_init,
};

static const struct udevice_id bcm6348_usbh_ids[] = {
	{ .compatible = "brcm,bcm6348-usbh" },
	{ /* sentinel */ }
};

static int bcm6348_usbh_probe(struct udevice *dev)
{
	struct bcm6348_usbh_priv *priv = dev_get_priv(dev);
	struct reset_ctl rst_ctl;
	struct clk clk;
	int ret;

	priv->regs = dev_remap_addr(dev);
	if (!priv->regs)
		return -EINVAL;

	/* enable usbh clock */
	ret = clk_get_by_name(dev, "usbh", &clk);
	if (ret < 0)
		return ret;

	ret = clk_enable(&clk);
	if (ret < 0)
		return ret;

	/* perform reset */
	ret = reset_get_by_index(dev, 0, &rst_ctl);
	if (ret < 0)
		return ret;

	ret = reset_deassert(&rst_ctl);
	if (ret < 0)
		return ret;

	ret = reset_free(&rst_ctl);
	if (ret < 0)
		return ret;

	return 0;
}

U_BOOT_DRIVER(bcm6348_usbh) = {
	.name = "bcm6348-usbh",
	.id = UCLASS_PHY,
	.of_match = bcm6348_usbh_ids,
	.ops = &bcm6348_usbh_ops,
	.priv_auto	= sizeof(struct bcm6348_usbh_priv),
	.probe = bcm6348_usbh_probe,
};
