1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
// SPDX-License-Identifier: GPL-2.0
/**
* cdns-starfive.c - Cadence USB Controller
*
* Copyright (C) 2022-2023 StarFive Technology Co., Ltd.
* 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),
};
|