mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-08-17 23:48:52 +09:00
![Tom Rini](/assets/img/avatar_default.png)
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>
92 lines
2.3 KiB
C
92 lines
2.3 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* Copyright (c) 2016, NVIDIA CORPORATION.
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <dm.h>
|
|
#include <misc.h>
|
|
#include <power-domain-uclass.h>
|
|
#include <asm/arch-tegra/bpmp_abi.h>
|
|
|
|
#define UPDATE BIT(0)
|
|
#define ON BIT(1)
|
|
|
|
static int tegra186_power_domain_request(struct power_domain *power_domain)
|
|
{
|
|
debug("%s(power_domain=%p) (dev=%p, id=%lu)\n", __func__,
|
|
power_domain, power_domain->dev, power_domain->id);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int tegra186_power_domain_free(struct power_domain *power_domain)
|
|
{
|
|
debug("%s(power_domain=%p) (dev=%p, id=%lu)\n", __func__,
|
|
power_domain, power_domain->dev, power_domain->id);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int tegra186_power_domain_common(struct power_domain *power_domain,
|
|
bool on)
|
|
{
|
|
struct mrq_pg_update_state_request req;
|
|
int on_state = on ? ON : 0;
|
|
int ret;
|
|
|
|
req.partition_id = power_domain->id;
|
|
req.logic_state = UPDATE | on_state;
|
|
req.sram_state = UPDATE | on_state;
|
|
/*
|
|
* Drivers manage their own clocks so they don't get out of sync, and
|
|
* since some power domains have many clocks, only a subset of which
|
|
* are actually needed depending on use-case.
|
|
*/
|
|
req.clock_state = UPDATE;
|
|
|
|
ret = misc_call(power_domain->dev->parent, MRQ_PG_UPDATE_STATE, &req,
|
|
sizeof(req), NULL, 0);
|
|
if (ret < 0)
|
|
return ret;
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int tegra186_power_domain_on(struct power_domain *power_domain)
|
|
{
|
|
debug("%s(power_domain=%p) (dev=%p, id=%lu)\n", __func__,
|
|
power_domain, power_domain->dev, power_domain->id);
|
|
|
|
return tegra186_power_domain_common(power_domain, true);
|
|
}
|
|
|
|
static int tegra186_power_domain_off(struct power_domain *power_domain)
|
|
{
|
|
debug("%s(power_domain=%p) (dev=%p, id=%lu)\n", __func__,
|
|
power_domain, power_domain->dev, power_domain->id);
|
|
|
|
return tegra186_power_domain_common(power_domain, false);
|
|
}
|
|
|
|
struct power_domain_ops tegra186_power_domain_ops = {
|
|
.request = tegra186_power_domain_request,
|
|
.free = tegra186_power_domain_free,
|
|
.on = tegra186_power_domain_on,
|
|
.off = tegra186_power_domain_off,
|
|
};
|
|
|
|
static int tegra186_power_domain_probe(struct udevice *dev)
|
|
{
|
|
debug("%s(dev=%p)\n", __func__, dev);
|
|
|
|
return 0;
|
|
}
|
|
|
|
U_BOOT_DRIVER(tegra186_power_domain) = {
|
|
.name = "tegra186_power_domain",
|
|
.id = UCLASS_POWER_DOMAIN,
|
|
.probe = tegra186_power_domain_probe,
|
|
.ops = &tegra186_power_domain_ops,
|
|
};
|