Skip to contentSkip to conversation

arm: ls1021atwr: program the regulator for deep sleep

PATCH New Chenhui Zhao 3 participants 3 messages May 15, 2015 – Aug 4, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm: ls1021atwr: program the regulator for deep sleep

Program the external regulator to switch off voltage in deep sleep.

---
 board/freescale/ls1021atwr/ls1021atwr.c | 34 +++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
board/freescale/ls1021atwr/ls1021atwr.c +34 -0
index 2c8d6d1..37ec0ba 100644
@@ -578,6 +578,37 @@ struct smmu_stream_id dev_stream_id[] = {
 	{ 0x18c, 0x0e, "DEBUG" },
 };
 
+#ifdef CONFIG_DEEP_SLEEP
+/* program the regulator (MC34VR500) to support deep sleep */
+void ls1twr_program_regulator(void)
+{
+	unsigned int i2c_bus;
+	u8 i2c_device_id;
+
+#define LS1TWR_I2C_BUS_MC34VR500	1
+#define MC34VR500_ADDR			0x8
+#define MC34VR500_DEVICEID		0x4
+#define MC34VR500_DEVICEID_MASK		0x0f
+
+	i2c_bus = i2c_get_bus_num();
+	i2c_set_bus_num(LS1TWR_I2C_BUS_MC34VR500);
+	i2c_device_id = i2c_reg_read(MC34VR500_ADDR, 0x0) &
+					MC34VR500_DEVICEID_MASK;
+	if (i2c_device_id != MC34VR500_DEVICEID) {
+		printf("The regulator (MC34VR500) does not exist. The device does not support deep sleep.\n");
+		return;
+	}
+
+	i2c_reg_write(MC34VR500_ADDR, 0x31, 0x4);
+	i2c_reg_write(MC34VR500_ADDR, 0x4d, 0x4);
+	i2c_reg_write(MC34VR500_ADDR, 0x6d, 0x38);
+	i2c_reg_write(MC34VR500_ADDR, 0x6f, 0x37);
+	i2c_reg_write(MC34VR500_ADDR, 0x71, 0x30);
+
+	i2c_set_bus_num(i2c_bus);
+}
+#endif
+
 int board_init(void)
 {
 #ifndef CONFIG_SYS_FSL_NO_SERDES
@@ -600,6 +631,9 @@ int board_init(void)
 	u_qe_init();
 #endif
 
+#ifdef CONFIG_DEEP_SLEEP
+	ls1twr_program_regulator();
+#endif
 	return 0;
 }
 
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 arm: ls1021atwr: program the regulator for deep sleep

Zhao Chenhui-3 wrote

Quoted 75 lines

Program the external regulator to switch off voltage in deep sleep.

Signed-off-by Chenhui Zhao <

chenhui.zhao@

>

---
 board/freescale/ls1021atwr/ls1021atwr.c | 34
+++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
board/freescale/ls1021atwr/ls1021atwr.c +31 -0
index 2c8d6d1..37ec0ba 100644
@@ -578,6 +578,37 @@ struct smmu_stream_id dev_stream_id[] = {
 	{ 0x18c, 0x0e, "DEBUG" },
 };
 
+#ifdef CONFIG_DEEP_SLEEP
+/* program the regulator (MC34VR500) to support deep sleep */
+void ls1twr_program_regulator(void)
+{
+	unsigned int i2c_bus;
+	u8 i2c_device_id;
+
+#define LS1TWR_I2C_BUS_MC34VR500	1
+#define MC34VR500_ADDR			0x8
+#define MC34VR500_DEVICEID		0x4
+#define MC34VR500_DEVICEID_MASK		0x0f
+
+	i2c_bus = i2c_get_bus_num();
+	i2c_set_bus_num(LS1TWR_I2C_BUS_MC34VR500);
+	i2c_device_id = i2c_reg_read(MC34VR500_ADDR, 0x0) &
+					MC34VR500_DEVICEID_MASK;
+	if (i2c_device_id != MC34VR500_DEVICEID) {
+		printf("The regulator (MC34VR500) does not exist. The device does not
 support deep sleep.\n");
+		return;
+	}
+
+	i2c_reg_write(MC34VR500_ADDR, 0x31, 0x4);
+	i2c_reg_write(MC34VR500_ADDR, 0x4d, 0x4);
+	i2c_reg_write(MC34VR500_ADDR, 0x6d, 0x38);
+	i2c_reg_write(MC34VR500_ADDR, 0x6f, 0x37);
+	i2c_reg_write(MC34VR500_ADDR, 0x71, 0x30);
+
+	i2c_set_bus_num(i2c_bus);
+}
+#endif
+
 int board_init(void)
 {

#ifndef CONFIG_SYS_FSL_NO_SERDES

board/freescale/ls1021atwr/ls1021atwr.c +3 -0
@@ -600,6 +631,9 @@ int board_init(void)
 	u_qe_init();
 #endif
 
+#ifdef CONFIG_DEEP_SLEEP
+	ls1twr_program_regulator();
+#endif
 	return 0;
 }
 
Signature · 8 lines
1.9.1

_______________________________________________
U-Boot mailing list

U-Boot at .denx

http://lists.denx.de/mailman/listinfo/u-boot

--
View this message in context: http://u-boot.10912.n7.nabble.com/PATCH-arm-ls1021atwr-program-the-regulator-for-deep-sleep-tp214798p219807.html
Sent from the U-Boot mailing list archive at Nabble.com.