// 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 <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>

/* USBH Swap Control register */
#define USBH_SWAP_REG		0x00
#define USBH_SWAP_OHCI_DATA	BIT(0)
#define USBH_SWAP_OHCI_ENDIAN	BIT(1)
#define USBH_SWAP_EHCI_DATA	BIT(3)
#define USBH_SWAP_EHCI_ENDIAN	BIT(4)

/* USBH Test register */
#define USBH_TEST_REG		0x24
#define USBH_TEST_PORT_CTL	0x1c0020

struct bcm6358_usbh_priv {
	void __iomem *regs;
};

static int bcm6358_usbh_init(struct phy *phy)
{
	struct bcm6358_usbh_priv *priv = dev_get_priv(phy->dev);

	/* configure to work in native cpu endian */
	clrsetbits_be32(priv->regs + USBH_SWAP_REG,
			USBH_SWAP_EHCI_ENDIAN | USBH_SWAP_OHCI_ENDIAN,
			USBH_SWAP_EHCI_DATA | USBH_SWAP_OHCI_DATA);

	/* test port control */
	writel_be(USBH_TEST_PORT_CTL, priv->regs + USBH_TEST_REG);

	return 0;
}

static struct phy_ops bcm6358_usbh_ops = {
	.init = bcm6358_usbh_init,
};

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

static int bcm6358_usbh_probe(struct udevice *dev)
{
	struct bcm6358_usbh_priv *priv = dev_get_priv(dev);
	struct reset_ctl rst_ctl;
	int ret;

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

	/* 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(bcm6358_usbh) = {
	.name = "bcm6358-usbh",
	.id = UCLASS_PHY,
	.of_match = bcm6358_usbh_ids,
	.ops = &bcm6358_usbh_ops,
	.priv_auto	= sizeof(struct bcm6358_usbh_priv),
	.probe = bcm6358_usbh_probe,
};
