1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2018 Álvaro Fernández Rojas <noltari@gmail.com>
5 * Derived from linux/arch/mips/bcm63xx/usb-common.c:
6 * Copyright 2008 Maxime Bizon <mbizon@freebox.fr>
7 * Copyright 2013 Florian Fainelli <florian@openwrt.org>
13 #include <generic-phy.h>
18 #include <dm/device.h>
19 #include <linux/bitops.h>
21 #define USBH_SETUP_PORT1_EN BIT(0)
23 struct bcm6348_usbh_priv {
27 static int bcm6348_usbh_init(struct phy *phy)
29 struct bcm6348_usbh_priv *priv = dev_get_priv(phy->dev);
31 writel_be(USBH_SETUP_PORT1_EN, priv->regs);
36 static struct phy_ops bcm6348_usbh_ops = {
37 .init = bcm6348_usbh_init,
40 static const struct udevice_id bcm6348_usbh_ids[] = {
41 { .compatible = "brcm,bcm6348-usbh" },
45 static int bcm6348_usbh_probe(struct udevice *dev)
47 struct bcm6348_usbh_priv *priv = dev_get_priv(dev);
48 struct reset_ctl rst_ctl;
52 priv->regs = dev_remap_addr(dev);
56 /* enable usbh clock */
57 ret = clk_get_by_name(dev, "usbh", &clk);
61 ret = clk_enable(&clk);
68 ret = reset_get_by_index(dev, 0, &rst_ctl);
72 ret = reset_deassert(&rst_ctl);
76 ret = reset_free(&rst_ctl);
83 U_BOOT_DRIVER(bcm6348_usbh) = {
84 .name = "bcm6348-usbh",
86 .of_match = bcm6348_usbh_ids,
87 .ops = &bcm6348_usbh_ops,
88 .priv_auto = sizeof(struct bcm6348_usbh_priv),
89 .probe = bcm6348_usbh_probe,