diff options
author | Simon Glass <sjg@chromium.org> | 2012-03-06 17:10:27 +0000 |
---|---|---|
committer | Albert ARIBAUD <albert.u.boot@aribaud.net> | 2012-03-29 08:12:48 +0200 |
commit | ed2974493e838399eacd4bf88f38b215955688a8 (patch) | |
tree | 8eccb7124c36adb71f53ccdb5ec44bf30a787790 /arch/arm/include | |
parent | 9ab4ce223c1d991e92e15c9aa0f522d61072155d (diff) | |
download | u-boot-imx-ed2974493e838399eacd4bf88f38b215955688a8.zip u-boot-imx-ed2974493e838399eacd4bf88f38b215955688a8.tar.gz u-boot-imx-ed2974493e838399eacd4bf88f38b215955688a8.tar.bz2 |
tegra: fdt: Add function to return peripheral/clock ID
A common requirement is to find the clock ID for a peripheral. This is the
second cell of the 'clocks' property (the first being the phandle itself).
Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>
Diffstat (limited to 'arch/arm/include')
-rw-r--r-- | arch/arm/include/asm/arch-tegra2/clock.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/arch/arm/include/asm/arch-tegra2/clock.h b/arch/arm/include/asm/arch-tegra2/clock.h index 080ef18..6b12c76 100644 --- a/arch/arm/include/asm/arch-tegra2/clock.h +++ b/arch/arm/include/asm/arch-tegra2/clock.h @@ -177,6 +177,7 @@ enum periph_id { PERIPH_ID_CRAM2, PERIPH_ID_COUNT, + PERIPH_ID_NONE = -1, }; /* Converts a clock number to a clock register: 0=L, 1=H, 2=U */ @@ -355,6 +356,18 @@ unsigned clock_get_rate(enum clock_id clkid); */ void clock_ll_start_uart(enum periph_id periph_id); +/** + * Decode a peripheral ID from a device tree node. + * + * This works by looking up the peripheral's 'clocks' node and reading out + * the second cell, which is the clock number / peripheral ID. + * + * @param blob FDT blob to use + * @param node Node to look at + * @return peripheral ID, or PERIPH_ID_NONE if none + */ +enum periph_id clock_decode_periph_id(const void *blob, int node); + /* * Checks that clocks are valid and prints a warning if not * |