u-boot-brain/drivers/power/domain/bcm6328-power-domain.c
Tom Rini 83d290c56f SPDX: Convert all of our single license tags to Linux Kernel style
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>
2018-05-07 09:34:12 -04:00

83 lines
1.8 KiB
C

// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2017 Álvaro Fernández Rojas <noltari@gmail.com>
*/
#include <common.h>
#include <dm.h>
#include <power-domain-uclass.h>
#include <asm/io.h>
#define MAX_DOMAINS 32
struct bcm6328_power_domain {
void __iomem *regs;
};
static int bcm6328_power_domain_request(struct power_domain *power_domain)
{
if (power_domain->id >= MAX_DOMAINS)
return -EINVAL;
return 0;
}
static int bcm6328_power_domain_free(struct power_domain *power_domain)
{
return 0;
}
static int bcm6328_power_domain_on(struct power_domain *power_domain)
{
struct bcm6328_power_domain *priv = dev_get_priv(power_domain->dev);
clrbits_be32(priv->regs, BIT(power_domain->id));
return 0;
}
static int bcm6328_power_domain_off(struct power_domain *power_domain)
{
struct bcm6328_power_domain *priv = dev_get_priv(power_domain->dev);
setbits_be32(priv->regs, BIT(power_domain->id));
return 0;
}
static int bcm6328_power_domain_probe(struct udevice *dev)
{
struct bcm6328_power_domain *priv = dev_get_priv(dev);
fdt_addr_t addr;
fdt_size_t size;
addr = devfdt_get_addr_size_index(dev, 0, &size);
if (addr == FDT_ADDR_T_NONE)
return -EINVAL;
priv->regs = ioremap(addr, size);
return 0;
}
static const struct udevice_id bcm6328_power_domain_ids[] = {
{ .compatible = "brcm,bcm6328-power-domain" },
{ /* sentinel */ }
};
struct power_domain_ops bcm6328_power_domain_ops = {
.free = bcm6328_power_domain_free,
.off = bcm6328_power_domain_off,
.on = bcm6328_power_domain_on,
.request = bcm6328_power_domain_request,
};
U_BOOT_DRIVER(bcm6328_power_domain) = {
.name = "bcm6328_power_domain",
.id = UCLASS_POWER_DOMAIN,
.of_match = bcm6328_power_domain_ids,
.ops = &bcm6328_power_domain_ops,
.priv_auto_alloc_size = sizeof(struct bcm6328_power_domain),
.probe = bcm6328_power_domain_probe,
};