mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-10-23 14:34:49 +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>
55 lines
1.2 KiB
C
55 lines
1.2 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* Copyright (C) 2016 Atmel Corporation
|
|
* Wenyou.Yang <wenyou.yang@atmel.com>
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <clk-uclass.h>
|
|
#include <dm.h>
|
|
#include <dm/util.h>
|
|
#include <linux/io.h>
|
|
#include <mach/at91_pmc.h>
|
|
#include "pmc.h"
|
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
#define H32MX_MAX_FREQ 90000000
|
|
|
|
static ulong sama5d4_h32mx_clk_get_rate(struct clk *clk)
|
|
{
|
|
struct pmc_platdata *plat = dev_get_platdata(clk->dev);
|
|
struct at91_pmc *pmc = plat->reg_base;
|
|
ulong rate = gd->arch.mck_rate_hz;
|
|
|
|
if (readl(&pmc->mckr) & AT91_PMC_MCKR_H32MXDIV)
|
|
rate /= 2;
|
|
|
|
if (rate > H32MX_MAX_FREQ)
|
|
dm_warn("H32MX clock is too fast\n");
|
|
|
|
return rate;
|
|
}
|
|
|
|
static struct clk_ops sama5d4_h32mx_clk_ops = {
|
|
.get_rate = sama5d4_h32mx_clk_get_rate,
|
|
};
|
|
|
|
static int sama5d4_h32mx_clk_probe(struct udevice *dev)
|
|
{
|
|
return at91_pmc_core_probe(dev);
|
|
}
|
|
|
|
static const struct udevice_id sama5d4_h32mx_clk_match[] = {
|
|
{ .compatible = "atmel,sama5d4-clk-h32mx" },
|
|
{}
|
|
};
|
|
|
|
U_BOOT_DRIVER(sama5d4_h32mx_clk) = {
|
|
.name = "sama5d4-h32mx-clk",
|
|
.id = UCLASS_CLK,
|
|
.of_match = sama5d4_h32mx_clk_match,
|
|
.probe = sama5d4_h32mx_clk_probe,
|
|
.platdata_auto_alloc_size = sizeof(struct pmc_platdata),
|
|
.ops = &sama5d4_h32mx_clk_ops,
|
|
};
|