[U-Boot] [PATCH] arm: socfpga: Add I2C support to SoCFPGA

Stefan Roese sr at denx.de
Mon Oct 20 08:45:48 CEST 2014


This patch adds I2C support for the SoCFPGA. Using the designware I2C
controller driver. It supports all 4 I2C busses on the SoCFPGA.

Signed-off-by: Stefan Roese <sr at denx.de>
Cc: Marek Vasut <marex at denx.de>
Cc: Vince Briders <vbridger at altera.com>
Cc: Chin Liang See <clsee at altera.com>
Cc: Dinh Nguyen <dinguyen at altera.com>
---
 include/configs/socfpga_common.h | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h
index 49504dc..ba1e072 100644
--- a/include/configs/socfpga_common.h
+++ b/include/configs/socfpga_common.h
@@ -157,6 +157,28 @@
 #define CONFIG_BAUDRATE			115200
 
 /*
+ * I2C support
+ */
+#define CONFIG_HARD_I2C
+#define CONFIG_DW_I2C
+#define CONFIG_I2C_MULTI_BUS
+#define CONFIG_SYS_I2C_BUS_MAX		4
+#define CONFIG_SYS_I2C_BASE		SOCFPGA_I2C0_ADDRESS
+#define CONFIG_SYS_I2C_BASE1		SOCFPGA_I2C1_ADDRESS
+#define CONFIG_SYS_I2C_BASE2		SOCFPGA_I2C2_ADDRESS
+#define CONFIG_SYS_I2C_BASE3		SOCFPGA_I2C3_ADDRESS
+/* using standard mode which the speed up to 100Kb/s */
+#define CONFIG_SYS_I2C_SPEED		100000
+/* address of device when used as slave */
+#define CONFIG_SYS_I2C_SLAVE		0x02
+#ifndef __ASSEMBLY__
+/* clock supplied to I2C controller in unit of MHz */
+unsigned int cm_get_l4_sp_clk_hz(void);
+#define IC_CLK				(cm_get_l4_sp_clk_hz() / 1000000)
+#endif
+#define CONFIG_CMD_I2C
+
+/*
  * U-Boot environment
  */
 #define CONFIG_SYS_CONSOLE_IS_IN_ENV
-- 
2.1.2



More information about the U-Boot mailing list