2 * Copyright (C) 2018 Ã
\81lvaro Fernández Rojas <noltari@gmail.com>
4 * Derived from linux/arch/mips/bcm63xx/usb-common.c:
5 * Copyright 2008 Maxime Bizon <mbizon@freebox.fr>
6 * Copyright 2013 Florian Fainelli <florian@openwrt.org>
8 * SPDX-License-Identifier: GPL-2.0+
14 #include <generic-phy.h>
17 #include <dm/device.h>
19 #define USBH_SETUP_PORT1_EN BIT(0)
21 struct bcm6348_usbh_priv {
25 static int bcm6348_usbh_init(struct phy *phy)
27 struct bcm6348_usbh_priv *priv = dev_get_priv(phy->dev);
29 writel_be(USBH_SETUP_PORT1_EN, priv->regs);
34 static struct phy_ops bcm6348_usbh_ops = {
35 .init = bcm6348_usbh_init,
38 static const struct udevice_id bcm6348_usbh_ids[] = {
39 { .compatible = "brcm,bcm6348-usbh" },
43 static int bcm6348_usbh_probe(struct udevice *dev)
45 struct bcm6348_usbh_priv *priv = dev_get_priv(dev);
46 struct reset_ctl rst_ctl;
52 addr = devfdt_get_addr_size_index(dev, 0, &size);
53 if (addr == FDT_ADDR_T_NONE)
56 priv->regs = ioremap(addr, size);
58 /* enable usbh clock */
59 ret = clk_get_by_name(dev, "usbh", &clk);
63 ret = clk_enable(&clk);
72 ret = reset_get_by_index(dev, 0, &rst_ctl);
76 ret = reset_deassert(&rst_ctl);
80 ret = reset_free(&rst_ctl);
87 U_BOOT_DRIVER(bcm6348_usbh) = {
88 .name = "bcm6348-usbh",
90 .of_match = bcm6348_usbh_ids,
91 .ops = &bcm6348_usbh_ops,
92 .priv_auto_alloc_size = sizeof(struct bcm6348_usbh_priv),
93 .probe = bcm6348_usbh_probe,