Browse Source

SPL: starfive: jh7110: add i2c init in SPL

Add basic init before used by other modules in SPL.

Signed-off-by: Yanhong Wang <yanhong.wang@linux.starfivetech.com>
Yanhong Wang 1 year ago
parent
commit
0cb0bb697c
2 changed files with 17 additions and 0 deletions
  1. 13 0
      arch/riscv/cpu/jh7110/spl.c
  2. 4 0
      board/starfive/visionfive2/spl.c

+ 13 - 0
arch/riscv/cpu/jh7110/spl.c

@@ -8,6 +8,7 @@
 #include <dm.h>
 #include <log.h>
 #include <asm/csr.h>
+#include <init.h>
 
 #define CSR_U74_FEATURE_DISABLE	0x7c1
 
@@ -16,6 +17,18 @@ int spl_soc_init(void)
 	int ret;
 	struct udevice *dev;
 
+	/* I2C init */
+	ret = uclass_get_device(UCLASS_I2C, 0, &dev);
+	if (ret) {
+		debug("I2C init failed: %d\n", ret);
+		return ret;
+	}
+
+	/*read memory size info from eeprom and
+	 *init gd->ram_size variable
+	 */
+	dram_init();
+
 	/* DDR init */
 	ret = uclass_get_device(UCLASS_RAM, 0, &dev);
 	if (ret) {

+ 4 - 0
board/starfive/visionfive2/spl.c

@@ -134,6 +134,10 @@ void board_init_f(ulong dummy)
 	SYS_IOMUX_COMPLEX(8, 48, 61, 23);
 	SYS_IOMUX_SET_DS(8, 3);
 
+	/*i2c5*/
+	SYS_IOMUX_COMPLEX(19, 79, 0, 42);//scl
+	SYS_IOMUX_COMPLEX(20, 80, 0, 43);//sda
+
 	ret = spl_early_init();
 	if (ret)
 		panic("spl_early_init() failed: %d\n", ret);