summaryrefslogtreecommitdiff
path: root/include
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 /include
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 'include')
-rw-r--r--include/configs/seaboard.h12
-rw-r--r--include/fdt_decode.h28
2 files changed, 34 insertions, 6 deletions
diff --git a/include/configs/seaboard.h b/include/configs/seaboard.h
index 09d0b616b44..9440b123ab9 100644
--- a/include/configs/seaboard.h
+++ b/include/configs/seaboard.h
@@ -118,6 +118,12 @@
0, 0, 0, 0, '?', 0, 0, 0 \
}
+/* pin-mux settings for seaboard */
+#define CONFIG_I2CP_PIN_MUX 1
+#define CONFIG_I2C1_PIN_MUX 1
+#define CONFIG_I2C2_PIN_MUX 2
+#define CONFIG_I2C3_PIN_MUX 1
+
#endif /* CONFIG_OF_CONTROL not defined ^^^^^^^ */
#define CONFIG_TEGRA2_KEYBOARD
@@ -158,12 +164,6 @@
#define CONFIG_TPM_SLB9635_I2C
#define CONFIG_TPM_I2C_BURST_LIMITATION 3
-/* pin-mux settings for seaboard */
-#define CONFIG_I2CP_PIN_MUX 1
-#define CONFIG_I2C1_PIN_MUX 1
-#define CONFIG_I2C2_PIN_MUX 2
-#define CONFIG_I2C3_PIN_MUX 1
-
/* SD/MMC */
#define CONFIG_MMC
#define CONFIG_GENERIC_MMC
diff --git a/include/fdt_decode.h b/include/fdt_decode.h
index 15236156f84..45072df9bc7 100644
--- a/include/fdt_decode.h
+++ b/include/fdt_decode.h
@@ -54,6 +54,7 @@ enum fdt_compat_id {
COMPAT_NVIDIA_TEGRA250_USB, /* Tegra 250 USB port */
COMPAT_NVIDIA_TEGRA250_SDMMC, /* Tegra 250 SDMMC port */
COMPAT_NVIDIA_TEGRA250_KBC, /* Tegra 250 Keyboard */
+ COMPAT_NVIDIA_TEGRA250_I2C, /* Tegra 250 i2c */
COMPAT_COUNT,
};
@@ -190,6 +191,14 @@ struct fdt_kbc {
u8 ctrl_keycode[FDT_KBC_KEY_COUNT];
};
+/* Information about i2c controller */
+struct fdt_i2c {
+ struct i2c_ctlr *reg;
+ int pinmux;
+ u32 speed;
+ enum periph_id periph_id;
+};
+
/**
* Return information from the FDT about the console UART. This looks for
* an alias node called 'console' which must point to a UART. It then reads
@@ -398,6 +407,25 @@ int fdt_decode_get_config_int(const void *blob, const char *prop_name,
int default_val);
/**
+ * Returns information from the FDT about an i2c controler. This function reads
+ * out the following attributes:
+ *
+ * reg
+ * pinmux
+ * speed
+ * periph-id
+ *
+ * @param blob FDT blob to use
+ * @param node Node to read from
+ * @param config structure to use to return information
+ * @returns 0 on success, -ve on error, in which case config may or may not be
+ * unchanged. If the node is present but expected data is
+ * missing then this will generally return
+ * -FDT_ERR_MISSING.
+ */
+int fdt_decode_i2c(const void *blob, int node, struct fdt_i2c *config);
+
+/**
* Returns information from the FDT about the keboard controler. This function
* reads out the following attributes:
*