]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
arm: socfpga: Add I2C support to SoCFPGA
authorStefan Roese <sr@denx.de>
Thu, 30 Oct 2014 08:33:13 +0000 (09:33 +0100)
committerMarek Vasut <marex@denx.de>
Thu, 30 Oct 2014 09:17:47 +0000 (10:17 +0100)
This patch adds I2C support for the SoCFPGA. Using the designware I2C
controller driver. It supports all 4 I2C busses on the SoCFPGA.

The designware I2C driver has now been converted to the
CONFIG_SYS_I2C framework. So lets enable it on SoCFPGA.

Tested on SoCrates.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Chin Liang See <clsee@altera.com>
Cc: Dinh Nguyen <dinguyen@altera.com>
Cc: Vince Bridgers <vbridger@altera.com>
Cc: Pavel Machek <pavel@denx.de>
Cc: Heiko Schocher <hs@denx.de>
include/configs/socfpga_common.h

index 83a1bcdfbe34354980713f7e1c01e2c2ec788c7e..f7b314d3ca42307baaf9b8a9c747baca2a3ab706 100644 (file)
 #define CONFIG_SYS_MMC_MAX_BLK_COUNT   256     /* FIXME -- SPL only? */
 #endif
 
+ /*
+ * I2C support
+ */
+#define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_DW
+#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
+#define CONFIG_SYS_I2C_SPEED1          100000
+#define CONFIG_SYS_I2C_SPEED2          100000
+#define CONFIG_SYS_I2C_SPEED3          100000
+/* Address of device when used as slave */
+#define CONFIG_SYS_I2C_SLAVE           0x02
+#define CONFIG_SYS_I2C_SLAVE1          0x02
+#define CONFIG_SYS_I2C_SLAVE2          0x02
+#define CONFIG_SYS_I2C_SLAVE3          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
+
 /*
  * Serial Driver
  */