mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-13 08:27:23 +00:00
83d290c56f
When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
107 lines
2.1 KiB
C
107 lines
2.1 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* dwc3-of-simple.c - OF glue layer for simple integrations
|
|
*
|
|
* Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
|
|
*
|
|
* Author: Felipe Balbi <balbi@ti.com>
|
|
*
|
|
* Copyright (C) 2018 BayLibre, SAS
|
|
* Author: Neil Armstrong <narmstron@baylibre.com>
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <dm.h>
|
|
#include <fdtdec.h>
|
|
#include <reset.h>
|
|
#include <clk.h>
|
|
|
|
struct dwc3_of_simple {
|
|
struct clk_bulk clks;
|
|
struct reset_ctl_bulk resets;
|
|
};
|
|
|
|
static int dwc3_of_simple_reset_init(struct udevice *dev,
|
|
struct dwc3_of_simple *simple)
|
|
{
|
|
int ret;
|
|
|
|
ret = reset_get_bulk(dev, &simple->resets);
|
|
if (ret == -ENOTSUPP)
|
|
return 0;
|
|
else if (ret)
|
|
return ret;
|
|
|
|
ret = reset_deassert_bulk(&simple->resets);
|
|
if (ret) {
|
|
reset_release_bulk(&simple->resets);
|
|
return ret;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int dwc3_of_simple_clk_init(struct udevice *dev,
|
|
struct dwc3_of_simple *simple)
|
|
{
|
|
int ret;
|
|
|
|
ret = clk_get_bulk(dev, &simple->clks);
|
|
if (ret == -ENOSYS)
|
|
return 0;
|
|
if (ret)
|
|
return ret;
|
|
|
|
#if CONFIG_IS_ENABLED(CLK)
|
|
ret = clk_enable_bulk(&simple->clks);
|
|
if (ret) {
|
|
clk_release_bulk(&simple->clks);
|
|
return ret;
|
|
}
|
|
#endif
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int dwc3_of_simple_probe(struct udevice *dev)
|
|
{
|
|
struct dwc3_of_simple *simple = dev_get_platdata(dev);
|
|
int ret;
|
|
|
|
ret = dwc3_of_simple_clk_init(dev, simple);
|
|
if (ret)
|
|
return ret;
|
|
|
|
ret = dwc3_of_simple_reset_init(dev, simple);
|
|
if (ret)
|
|
return ret;
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int dwc3_of_simple_remove(struct udevice *dev)
|
|
{
|
|
struct dwc3_of_simple *simple = dev_get_platdata(dev);
|
|
|
|
reset_release_bulk(&simple->resets);
|
|
|
|
clk_release_bulk(&simple->clks);
|
|
|
|
return dm_scan_fdt_dev(dev);
|
|
}
|
|
|
|
static const struct udevice_id dwc3_of_simple_ids[] = {
|
|
{ .compatible = "amlogic,meson-gxl-dwc3" },
|
|
{ .compatible = "ti,dwc3" },
|
|
{ }
|
|
};
|
|
|
|
U_BOOT_DRIVER(dwc3_of_simple) = {
|
|
.name = "dwc3-of-simple",
|
|
.id = UCLASS_SIMPLE_BUS,
|
|
.of_match = dwc3_of_simple_ids,
|
|
.probe = dwc3_of_simple_probe,
|
|
.remove = dwc3_of_simple_remove,
|
|
.platdata_auto_alloc_size = sizeof(struct dwc3_of_simple),
|
|
.flags = DM_FLAG_ALLOC_PRIV_DMA,
|
|
};
|