mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-09-04 21:41:29 +02:00
When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"' I failed to notice that b4 noticed it was based on next and so took that as the base commit and merged that part of next to master. This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35. Reported-by: Jonas Karlman <jonas@kwiboo.se> Signed-off-by: Tom Rini <trini@konsulko.com>
79 lines
1.6 KiB
C
79 lines
1.6 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* Copyright (C) 2020-2021 Intel Corporation <www.intel.com>
|
|
*
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <asm/arch/clock_manager.h>
|
|
#include <asm/arch/system_manager.h>
|
|
#include <asm/global_data.h>
|
|
#include <asm/io.h>
|
|
#include <clk.h>
|
|
#include <dm.h>
|
|
#include <dt-bindings/clock/n5x-clock.h>
|
|
#include <malloc.h>
|
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
static ulong cm_get_rate_dm(u32 id)
|
|
{
|
|
struct udevice *dev;
|
|
struct clk clk;
|
|
ulong rate;
|
|
int ret;
|
|
|
|
ret = uclass_get_device_by_driver(UCLASS_CLK,
|
|
DM_DRIVER_GET(socfpga_n5x_clk),
|
|
&dev);
|
|
if (ret)
|
|
return 0;
|
|
|
|
clk.id = id;
|
|
ret = clk_request(dev, &clk);
|
|
if (ret < 0)
|
|
return 0;
|
|
|
|
rate = clk_get_rate(&clk);
|
|
|
|
if ((rate == (unsigned long)-ENXIO) ||
|
|
(rate == (unsigned long)-EIO)) {
|
|
debug("%s id %u: clk_get_rate err: %ld\n",
|
|
__func__, id, rate);
|
|
return 0;
|
|
}
|
|
|
|
return rate;
|
|
}
|
|
|
|
static u32 cm_get_rate_dm_khz(u32 id)
|
|
{
|
|
return cm_get_rate_dm(id) / 1000;
|
|
}
|
|
|
|
unsigned long cm_get_mpu_clk_hz(void)
|
|
{
|
|
return cm_get_rate_dm(N5X_MPU_CLK);
|
|
}
|
|
|
|
unsigned int cm_get_l4_sys_free_clk_hz(void)
|
|
{
|
|
return cm_get_rate_dm(N5X_L4_SYS_FREE_CLK);
|
|
}
|
|
|
|
void cm_print_clock_quick_summary(void)
|
|
{
|
|
printf("MPU %10d kHz\n",
|
|
cm_get_rate_dm_khz(N5X_MPU_CLK));
|
|
printf("L4 Main %8d kHz\n",
|
|
cm_get_rate_dm_khz(N5X_L4_MAIN_CLK));
|
|
printf("L4 sys free %8d kHz\n",
|
|
cm_get_rate_dm_khz(N5X_L4_SYS_FREE_CLK));
|
|
printf("L4 MP %8d kHz\n",
|
|
cm_get_rate_dm_khz(N5X_L4_MP_CLK));
|
|
printf("L4 SP %8d kHz\n",
|
|
cm_get_rate_dm_khz(N5X_L4_SP_CLK));
|
|
printf("SDMMC %8d kHz\n",
|
|
cm_get_rate_dm_khz(N5X_SDMMC_CLK));
|
|
}
|