summaryrefslogtreecommitdiff
path: root/common/fdt_decode.c
diff options
context:
space:
mode:
authorAnton Staaf <robotboy@chromium.org>2011-07-06 13:19:44 -0700
committerSimon Glass <sjg@chromium.org>2011-08-29 10:58:57 -0700
commite8dec207c28ddd16877d2c04ad725b9f3d944854 (patch)
tree8fae67ef3265c2cb9353873f88aea2a3727dbdac /common/fdt_decode.c
parent95a1fba652775984d27fe8ec632147f588b556b6 (diff)
i2c: Add FDT support
BUG=chromium-os:17064 TEST=Build U-Boot Run "i2c probe" for each i2c bus on Seaboard, Kaen and Aebl Change-Id: I1528a6c08d500c001a1210f9947c494b7ffc81f6 Reviewed-on: http://gerrit.chromium.org/gerrit/4049 Tested-by: Anton Staaf <robotboy@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common/fdt_decode.c')
-rw-r--r--common/fdt_decode.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/common/fdt_decode.c b/common/fdt_decode.c
index 95124f13c6..da2c6ff7c8 100644
--- a/common/fdt_decode.c
+++ b/common/fdt_decode.c
@@ -40,6 +40,7 @@ static const char *compat_names[COMPAT_COUNT] = {
COMPAT(NVIDIA_TEGRA250_USB, "nvidia,tegra250-usb"),
COMPAT(NVIDIA_TEGRA250_SDHCI, "nvidia,tegra250-sdhci"),
COMPAT(NVIDIA_TEGRA250_KBC, "nvidia,tegra250-kbc"),
+ COMPAT(NVIDIA_TEGRA250_I2C, "nvidia,tegra250-i2c"),
};
/**
@@ -603,3 +604,16 @@ int fdt_decode_kbc(const void *blob, int node, struct fdt_kbc *config)
config->ctrl_keycode, FDT_KBC_KEY_COUNT);
return err;
}
+
+int fdt_decode_i2c(const void *blob, int node, struct fdt_i2c *config)
+{
+ config->reg = (struct i2c_ctlr *)get_addr(blob, node, "reg");
+ 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);
+
+ if (config->periph_id == -1)
+ return -FDT_ERR_MISSING;
+
+ return 0;
+}