mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-08-17 07:28:51 +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>
103 lines
2.3 KiB
C
103 lines
2.3 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* Copyright (c) 2016, NVIDIA CORPORATION.
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <clk-uclass.h>
|
|
#include <dm.h>
|
|
#include <asm/arch/clock.h>
|
|
#include <asm/arch-tegra/clk_rst.h>
|
|
|
|
static int tegra_car_clk_request(struct clk *clk)
|
|
{
|
|
debug("%s(clk=%p) (dev=%p, id=%lu)\n", __func__, clk, clk->dev,
|
|
clk->id);
|
|
|
|
/*
|
|
* Note that the first PERIPH_ID_COUNT clock IDs (where the value
|
|
* varies per SoC) are the peripheral clocks, which use a numbering
|
|
* scheme that matches HW registers 1:1. There are other clock IDs
|
|
* beyond this that are assigned arbitrarily by the Tegra CAR DT
|
|
* binding. Due to the implementation of this driver, it currently
|
|
* only supports the peripheral IDs.
|
|
*/
|
|
if (clk->id >= PERIPH_ID_COUNT)
|
|
return -EINVAL;
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int tegra_car_clk_free(struct clk *clk)
|
|
{
|
|
debug("%s(clk=%p) (dev=%p, id=%lu)\n", __func__, clk, clk->dev,
|
|
clk->id);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static ulong tegra_car_clk_get_rate(struct clk *clk)
|
|
{
|
|
enum clock_id parent;
|
|
|
|
debug("%s(clk=%p) (dev=%p, id=%lu)\n", __func__, clk, clk->dev,
|
|
clk->id);
|
|
|
|
parent = clock_get_periph_parent(clk->id);
|
|
return clock_get_periph_rate(clk->id, parent);
|
|
}
|
|
|
|
static ulong tegra_car_clk_set_rate(struct clk *clk, ulong rate)
|
|
{
|
|
enum clock_id parent;
|
|
|
|
debug("%s(clk=%p, rate=%lu) (dev=%p, id=%lu)\n", __func__, clk, rate,
|
|
clk->dev, clk->id);
|
|
|
|
parent = clock_get_periph_parent(clk->id);
|
|
return clock_adjust_periph_pll_div(clk->id, parent, rate, NULL);
|
|
}
|
|
|
|
static int tegra_car_clk_enable(struct clk *clk)
|
|
{
|
|
debug("%s(clk=%p) (dev=%p, id=%lu)\n", __func__, clk, clk->dev,
|
|
clk->id);
|
|
|
|
clock_enable(clk->id);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int tegra_car_clk_disable(struct clk *clk)
|
|
{
|
|
debug("%s(clk=%p) (dev=%p, id=%lu)\n", __func__, clk, clk->dev,
|
|
clk->id);
|
|
|
|
clock_disable(clk->id);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static struct clk_ops tegra_car_clk_ops = {
|
|
.request = tegra_car_clk_request,
|
|
.free = tegra_car_clk_free,
|
|
.get_rate = tegra_car_clk_get_rate,
|
|
.set_rate = tegra_car_clk_set_rate,
|
|
.enable = tegra_car_clk_enable,
|
|
.disable = tegra_car_clk_disable,
|
|
};
|
|
|
|
static int tegra_car_clk_probe(struct udevice *dev)
|
|
{
|
|
debug("%s(dev=%p)\n", __func__, dev);
|
|
|
|
return 0;
|
|
}
|
|
|
|
U_BOOT_DRIVER(tegra_car_clk) = {
|
|
.name = "tegra_car_clk",
|
|
.id = UCLASS_CLK,
|
|
.probe = tegra_car_clk_probe,
|
|
.ops = &tegra_car_clk_ops,
|
|
};
|