mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-12-28 22:13:08 +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>
103 lines
2.2 KiB
C
103 lines
2.2 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* Copyright (c) 2016, NVIDIA CORPORATION.
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <dm.h>
|
|
#include <power-domain-uclass.h>
|
|
#include <asm/io.h>
|
|
#include <asm/power-domain.h>
|
|
|
|
#define SANDBOX_POWER_DOMAINS 3
|
|
|
|
struct sandbox_power_domain {
|
|
bool on[SANDBOX_POWER_DOMAINS];
|
|
};
|
|
|
|
static int sandbox_power_domain_request(struct power_domain *power_domain)
|
|
{
|
|
debug("%s(power_domain=%p)\n", __func__, power_domain);
|
|
|
|
if (power_domain->id >= SANDBOX_POWER_DOMAINS)
|
|
return -EINVAL;
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int sandbox_power_domain_free(struct power_domain *power_domain)
|
|
{
|
|
debug("%s(power_domain=%p)\n", __func__, power_domain);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int sandbox_power_domain_on(struct power_domain *power_domain)
|
|
{
|
|
struct sandbox_power_domain *sbr = dev_get_priv(power_domain->dev);
|
|
|
|
debug("%s(power_domain=%p)\n", __func__, power_domain);
|
|
|
|
sbr->on[power_domain->id] = true;
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int sandbox_power_domain_off(struct power_domain *power_domain)
|
|
{
|
|
struct sandbox_power_domain *sbr = dev_get_priv(power_domain->dev);
|
|
|
|
debug("%s(power_domain=%p)\n", __func__, power_domain);
|
|
|
|
sbr->on[power_domain->id] = false;
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int sandbox_power_domain_bind(struct udevice *dev)
|
|
{
|
|
debug("%s(dev=%p)\n", __func__, dev);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int sandbox_power_domain_probe(struct udevice *dev)
|
|
{
|
|
debug("%s(dev=%p)\n", __func__, dev);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static const struct udevice_id sandbox_power_domain_ids[] = {
|
|
{ .compatible = "sandbox,power-domain" },
|
|
{ }
|
|
};
|
|
|
|
struct power_domain_ops sandbox_power_domain_ops = {
|
|
.request = sandbox_power_domain_request,
|
|
.free = sandbox_power_domain_free,
|
|
.on = sandbox_power_domain_on,
|
|
.off = sandbox_power_domain_off,
|
|
};
|
|
|
|
U_BOOT_DRIVER(sandbox_power_domain) = {
|
|
.name = "sandbox_power_domain",
|
|
.id = UCLASS_POWER_DOMAIN,
|
|
.of_match = sandbox_power_domain_ids,
|
|
.bind = sandbox_power_domain_bind,
|
|
.probe = sandbox_power_domain_probe,
|
|
.priv_auto_alloc_size = sizeof(struct sandbox_power_domain),
|
|
.ops = &sandbox_power_domain_ops,
|
|
};
|
|
|
|
int sandbox_power_domain_query(struct udevice *dev, unsigned long id)
|
|
{
|
|
struct sandbox_power_domain *sbr = dev_get_priv(dev);
|
|
|
|
debug("%s(dev=%p, id=%ld)\n", __func__, dev, id);
|
|
|
|
if (id >= SANDBOX_POWER_DOMAINS)
|
|
return -EINVAL;
|
|
|
|
return sbr->on[id];
|
|
}
|