]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
sh: r0p7734: Add support I2C controller
authorNobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Fri, 2 Mar 2012 03:58:33 +0000 (12:58 +0900)
committerNobuhiro Iwamatsu <iwamatsu@nigauri.org>
Mon, 28 May 2012 00:12:53 +0000 (09:12 +0900)
This read MAC address from Serial EEPROM and set.

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
board/renesas/r0p7734/r0p7734.c
include/configs/r0p7734.h

index 80f4329e00cf4715931f0781e7c60ad8b4e75134..c1bde549ae897c9cb60e5281325de0f9b81fb5e0 100644 (file)
@@ -25,6 +25,7 @@
 #include <asm/io.h>
 #include <asm/processor.h>
 #include <netdev.h>
+#include <i2c.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -55,6 +56,24 @@ int board_init(void)
        if (r & MSTPSR1_GETHER)
                writel((r & ~MSTPSR1_GETHER), MSTPCR1);
 #endif
+
+       return 0;
+}
+
+int board_late_init(void)
+{
+       u8 mac[6];
+
+       /* Read Mac Address and set*/
+       i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+       i2c_set_bus_num(CONFIG_SYS_I2C_MODULE);
+
+       /* Read MAC address */
+       i2c_read(0x50, 0x10, 0, mac, 6);
+
+       if (is_valid_ether_addr(mac))
+               eth_setenv_enetaddr("ethaddr", mac);
+
        return 0;
 }
 
@@ -75,4 +94,3 @@ int board_eth_init(bd_t *bis)
        return rc;
 }
 #endif
-
index d73cc4d3ca7dbd286f3e73c8d35a3f3e758026ff..aa3193da724d94e94cb2bc26cb86db054c834cba 100644 (file)
@@ -34,6 +34,7 @@
 #define CONFIG_400MHZ_MODE     1
 /* #define CONFIG_533MHZ_MODE  1 */
 
+#define CONFIG_BOARD_LATE_INIT
 #define CONFIG_SYS_TEXT_BASE 0x8FFC0000
 
 #define CONFIG_CMD_FLASH
 # define CONFIG_SMC911X_BASE (0x84000000)
 #endif
 
+
+/* I2C */
+#define CONFIG_CMD_I2C
+#define CONFIG_SH_SH7734_I2C   1
+#define CONFIG_HARD_I2C                        1
+#define CONFIG_I2C_MULTI_BUS   1
+#define CONFIG_SYS_MAX_I2C_BUS 2
+#define CONFIG_SYS_I2C_MODULE  0
+#define CONFIG_SYS_I2C_SPEED   100000 /* 100 kHz */
+#define CONFIG_SYS_I2C_SLAVE   0x50
+#define CONFIG_SH_I2C_DATA_HIGH        4
+#define CONFIG_SH_I2C_DATA_LOW 5
+#define CONFIG_SH_I2C_CLOCK            500000000
+#define CONFIG_SH_I2C_BASE0            0xFFC70000
+#define CONFIG_SH_I2C_BASE1            0xFFC7100
+
 /* undef to save memory        */
 #define CONFIG_SYS_LONGHELP
 /* Monitor Command Prompt */