blob: 51dc9b206fd6b73d28336fe3d26f65a2c9291e26 (
plain)
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
|
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2020 Sean Anderson <seanga2@gmail.com>
*/
#include <common.h>
#include <clk.h>
#include <dm.h>
/*
* Power domains are taken care of by driver_probe, so we just have to enable
* clocks
*/
static int simple_pm_bus_probe(struct udevice *dev)
{
int ret;
struct clk_bulk *bulk = dev_get_priv(dev);
ret = clk_get_bulk(dev, bulk);
if (ret)
return ret;
ret = clk_enable_bulk(bulk);
if (ret && ret != -ENOSYS && ret != -ENOTSUPP) {
clk_release_bulk(bulk);
return ret;
}
return 0;
}
static int simple_pm_bus_remove(struct udevice *dev)
{
int ret;
struct clk_bulk *bulk = dev_get_priv(dev);
ret = clk_release_bulk(bulk);
if (ret && ret != -ENOSYS && ret != -ENOTSUPP)
return ret;
else
return 0;
}
static const struct udevice_id simple_pm_bus_ids[] = {
{ .compatible = "simple-pm-bus" },
{ }
};
U_BOOT_DRIVER(simple_pm_bus_drv) = {
.name = "simple_pm_bus",
.id = UCLASS_SIMPLE_BUS,
.of_match = simple_pm_bus_ids,
.probe = simple_pm_bus_probe,
.remove = simple_pm_bus_remove,
.priv_auto_alloc_size = sizeof(struct clk_bulk),
.flags = DM_FLAG_PRE_RELOC,
};
|