diff options
author | Simon Glass <sjg@chromium.org> | 2011-11-29 16:27:17 -0800 |
---|---|---|
committer | Gerrit <chrome-bot@google.com> | 2011-11-30 13:01:47 -0800 |
commit | e48f5d4d14f2e84593d262063b05797bc328dc83 (patch) | |
tree | bd83fa56dd618e920c9d6164d9e9783cee754821 /include | |
parent | 4a466bf48a887e3a2eba3e971a3a459b5cbc80be (diff) |
fdt: Add function to read a clock rate from fdt
This reads the frequency of a named clock from the fdt.
BUG=chromium-os:23496
TEST=build and boot on Seaboard, T33, Kaen
Change-Id: Ib35bf7ef749f51862644218b1015057ca4e25203
Reviewed-on: https://gerrit.chromium.org/gerrit/12243
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Commit-Ready: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/fdt_decode.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/fdt_decode.h b/include/fdt_decode.h index 6087c218617..68d31653b58 100644 --- a/include/fdt_decode.h +++ b/include/fdt_decode.h @@ -614,3 +614,18 @@ int fdt_decode_nand(const void *blob, int node, struct fdt_nand *config); */ int fdt_decode_region(const void *blob, int node, const char *prop_name, void **ptrp, size_t *size); + +/** + * Look up the required rate of a particular clock in the FDT. + * + * These are expected to be in a board-clocks compatible node, with a + * property pointing to the phandle of each clock. The clock-frequency + * property in that phandle is returned. + * + * @param blob FDT blob + * @param clock_name Name of clock to look up (must name a phandle) + * @param default_rate Default clock rate to return if property not found + * @return clock rate as found in FDT, or default_rate if not found + */ +int fdt_decode_clock_rate(const void *blob, const char *clock_name, + ulong default_rate); |