diff options
author | Doug Anderson <dianders@chromium.org> | 2011-10-18 18:13:22 -0700 |
---|---|---|
committer | Doug Anderson <dianders@chromium.org> | 2011-10-19 16:41:55 -0700 |
commit | b166ce8bdde0a2b7c506a93d4d60f92e932c64d4 (patch) | |
tree | 5f82a8d17e84f0d35fd5b02d1485acb82cfbf075 /common | |
parent | 547a6442998ecf52fcccfe923a64ac81e1f374f2 (diff) |
CHROMIUM: tegra3: i2c: Move DVC semantics choice to device tree
On the tegra30, it appears that the "DVC" i2c controller has been
normalized and no longer requires special semantics for accessing it
(it has also just been renamed to "i2c5"). This change makes it so
that we don't pick DVC semantics based on the periperal ID, but
instead allow the device tree to specify.
BUG=chromium-os:21540
TEST=Compiled / booted on Kaen
Change-Id: Idfd96d1193b5ac267c61416544c63cc03dab396d
Signed-off-by: Doug Anderson <dianders@chromium.org>
Reviewed-on: http://gerrit.chromium.org/gerrit/10279
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/fdt_decode.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/common/fdt_decode.c b/common/fdt_decode.c index 9c56bcf1d39..c9bb28f6d61 100644 --- a/common/fdt_decode.c +++ b/common/fdt_decode.c @@ -114,6 +114,27 @@ static s32 get_int(const void *blob, int node, const char *prop_name, } /** + * Look up a boolean property in a node and return it. + * + * A boolean properly is true if present in the device tree and false if not + * present. + * + * @param blob FDT blob + * @param node node to examine + * @param prop_name name of property to find + * @return 1 if the properly is present; 0 if it isn't present + */ +static int get_bool(const void *blob, int node, const char *prop_name) +{ + const s32 *cell; + int len; + + debug("%s: %s\n", __func__, prop_name); + cell = fdt_getprop(blob, node, prop_name, &len); + return (cell) ? 1 : 0; +} + +/** * Look up a property in a node and check that it has a minimum length. * * @param blob FDT blob @@ -641,6 +662,7 @@ int fdt_decode_i2c(const void *blob, int node, struct fdt_i2c *config) config->pinmux = get_int(blob, node, "pinmux", 0); config->speed = get_int(blob, node, "speed", 0); config->periph_id = get_int(blob, node, "periph-id", -1); + config->use_dvc_ctlr = get_bool(blob, node, "use-dvc-ctlr"); if (config->periph_id == -1) return -FDT_ERR_MISSING; |