diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/cdns3/Kconfig | 8 | ||||
-rw-r--r-- | drivers/usb/cdns3/Makefile | 1 | ||||
-rw-r--r-- | drivers/usb/cdns3/cdns3-starfive.c | 79 |
3 files changed, 88 insertions, 0 deletions
diff --git a/drivers/usb/cdns3/Kconfig b/drivers/usb/cdns3/Kconfig index 35b61497d9..a4535e2126 100644 --- a/drivers/usb/cdns3/Kconfig +++ b/drivers/usb/cdns3/Kconfig @@ -55,4 +55,12 @@ config USB_CDNS3_TI help Say 'Y' here if you are building for Texas Instruments platforms that contain Cadence USB3 controller core. E.g.: J721e. + +config USB_CDNS3_STARFIVE + tristate "Cadence USB3 support on StarFive SoC" + depends on USB_CDNS3 + help + Say 'Y' here if you are building for StarFive SoCs + that contain Cadence USB3 controller core. E.g.: JH7110. + endif diff --git a/drivers/usb/cdns3/Makefile b/drivers/usb/cdns3/Makefile index 18d7190755..7f55acd8d0 100644 --- a/drivers/usb/cdns3/Makefile +++ b/drivers/usb/cdns3/Makefile @@ -9,3 +9,4 @@ cdns3-$(CONFIG_$(SPL_)USB_CDNS3_GADGET) += gadget.o ep0.o cdns3-$(CONFIG_$(SPL_)USB_CDNS3_HOST) += host.o obj-$(CONFIG_USB_CDNS3_TI) += cdns3-ti.o +obj-$(CONFIG_USB_CDNS3_STARFIVE) += cdns3-starfive.o diff --git a/drivers/usb/cdns3/cdns3-starfive.c b/drivers/usb/cdns3/cdns3-starfive.c new file mode 100644 index 0000000000..eb184394cd --- /dev/null +++ b/drivers/usb/cdns3/cdns3-starfive.c @@ -0,0 +1,79 @@ +// SPDX-License-Identifier: GPL-2.0 +/** + * cdns-starfive.c - Cadence USB Controller + * + * Copyright (C) 2022 Starfive, Inc. + * Author: yanhong <yanhong.wang@starfivetech.com> + */ + +#include <common.h> +#include <clk.h> +#include <dm.h> +#include <dm/device_compat.h> +#include <linux/usb/otg.h> +#include <reset.h> + +#include "core.h" + +struct cdns_starfive { + struct udevice *dev; + struct clk_bulk clks; + struct reset_ctl_bulk resets; +}; + +static int cdns_starfive_probe(struct udevice *dev) +{ + struct cdns_starfive *data = dev_get_plat(dev); + int ret; + + data->dev = dev; + + ret = clk_get_bulk(dev, &data->clks); + if (ret) + goto err; + + ret = reset_get_bulk(dev, &data->resets); + if (ret) + goto err_clk; + + ret = clk_enable_bulk(&data->clks); + if (ret) + goto err_reset; + + ret = reset_deassert_bulk(&data->resets); + if (ret) + goto err_reset; + + return 0; +err_reset: + reset_release_bulk(&data->resets); +err_clk: + clk_release_bulk(&data->clks); +err: + return ret; +} + +static int cdns_starfive_remove(struct udevice *dev) +{ + struct cdns_starfive *data = dev_get_plat(dev); + + clk_release_bulk(&data->clks); +// reset_assert_bulk(&data->resets); + + return 0; +} + +static const struct udevice_id cdns_starfive_of_match[] = { + { .compatible = "starfive,jh7110-cdns3", }, + {}, +}; + +U_BOOT_DRIVER(cdns_starfive) = { + .name = "cdns-starfive", + .id = UCLASS_NOP, + .of_match = cdns_starfive_of_match, + .bind = cdns3_bind, + .probe = cdns_starfive_probe, + .remove = cdns_starfive_remove, + .plat_auto = sizeof(struct cdns_starfive), +}; |