summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra/clock.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2023-02-24 01:32:22 +0300
committerTom Rini <trini@konsulko.com>2023-02-24 01:40:18 +0300
commit0024e7f72b689f8c2df731a69e20f47b6f8dc5a7 (patch)
tree03da9b68c29df4ffa5c181acca8ce6176636a410 /arch/arm/mach-tegra/clock.c
parent0b58258a33280a536c5b1e5e90dfdf0b5b5852cc (diff)
parent5a8fe1ee818e0f8a74fa088f6a3d705a01b6afbe (diff)
downloadu-boot-0024e7f72b689f8c2df731a69e20f47b6f8dc5a7.tar.xz
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-tegra
Diffstat (limited to 'arch/arm/mach-tegra/clock.c')
-rw-r--r--arch/arm/mach-tegra/clock.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/clock.c b/arch/arm/mach-tegra/clock.c
index 11bffc1701..966009f375 100644
--- a/arch/arm/mach-tegra/clock.c
+++ b/arch/arm/mach-tegra/clock.c
@@ -678,6 +678,29 @@ int clock_decode_periph_id(struct udevice *dev)
assert(clock_periph_id_isvalid(id));
return id;
}
+
+/*
+ * Get periph clock id and its parent from device tree.
+ *
+ * @param dev udevice associated with FDT node
+ * @param clk_id pointer to u32 array of 2 values
+ * first is periph clock, second is
+ * its PLL parent according to FDT.
+ */
+int clock_decode_pair(struct udevice *dev, int *clk_id)
+{
+ u32 cell[4];
+ int err;
+
+ err = dev_read_u32_array(dev, "clocks", cell, ARRAY_SIZE(cell));
+ if (err)
+ return -EINVAL;
+
+ clk_id[0] = clk_id_to_periph_id(cell[1]);
+ clk_id[1] = clk_id_to_pll_id(cell[3]);
+
+ return 0;
+}
#endif /* CONFIG_IS_ENABLED(OF_CONTROL) */
int clock_verify(void)