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>
16 #include <dm/device.h>
18 #define USBH_SETUP_PORT1_EN BIT(0)
20 struct bcm6348_usbh_priv {
24 static int bcm6348_usbh_init(struct phy *phy)
26 struct bcm6348_usbh_priv *priv = dev_get_priv(phy->dev);
28 writel_be(USBH_SETUP_PORT1_EN, priv->regs);
33 static struct phy_ops bcm6348_usbh_ops = {
34 .init = bcm6348_usbh_init,
37 static const struct udevice_id bcm6348_usbh_ids[] = {
38 { .compatible = "brcm,bcm6348-usbh" },
42 static int bcm6348_usbh_probe(struct udevice *dev)
44 struct bcm6348_usbh_priv *priv = dev_get_priv(dev);
45 struct reset_ctl rst_ctl;
49 priv->regs = dev_remap_addr(dev);
53 /* enable usbh clock */
54 ret = clk_get_by_name(dev, "usbh", &clk);
58 ret = clk_enable(&clk);
67 ret = reset_get_by_index(dev, 0, &rst_ctl);
71 ret = reset_deassert(&rst_ctl);
75 ret = reset_free(&rst_ctl);
82 U_BOOT_DRIVER(bcm6348_usbh) = {
83 .name = "bcm6348-usbh",
85 .of_match = bcm6348_usbh_ids,
86 .ops = &bcm6348_usbh_ops,
87 .priv_auto_alloc_size = sizeof(struct bcm6348_usbh_priv),
88 .probe = bcm6348_usbh_probe,