Skip to contentSkip to conversation

powerpc/t208xqds: VID support

PATCH New ying.zhang at freescale.com 2 participants 2 messages Oct 31, 2014 – Dec 5, 2014

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 powerpc/t208xqds: VID support

From: Ying Zhang <[email protected]>

The fuse status register provides the values from on-chip voltage ID efuses programmed at the factory. These values define the voltage requirements for the chip. u-boot reads FUSESR and translates the values into the appropriate commands to set the voltage output value of an external voltage regulator.

---
Change from v1:
- Set the core voltage according to the VID on startup.

 board/freescale/common/Makefile     |   1 +
 board/freescale/common/vid.c        | 491 ++++++++++++++++++++++++++++++++++++
 board/freescale/common/vid.h        |  20 ++
 board/freescale/t208xqds/t208xqds.c |  13 +
 include/configs/T208xQDS.h          |  17 ++
 5 files changed, 542 insertions(+)
 create mode 100644 board/freescale/common/vid.c
 create mode 100644 board/freescale/common/vid.h
board/freescale/common/Makefile +1 -0
index 32b5a3b..1556433 100644
@@ -23,6 +23,7 @@ obj-$(CONFIG_FMAN_ENET)	+= fman.o
 obj-$(CONFIG_FSL_PIXIS)	+= pixis.o
 ifndef CONFIG_SPL_BUILD
 obj-$(CONFIG_FSL_NGPIXIS)	+= ngpixis.o
+obj-$(CONFIG_VID)		+= vid.o
 endif
 obj-$(CONFIG_FSL_QIXIS)	+= qixis.o
 obj-$(CONFIG_PQ_MDS_PIB)	+= pq-mds-pib.o
board/freescale/common/vid.c new file +491 -0

491 lines not on this page · raw message

board/freescale/common/vid.h new file +20 -0
new file mode 100644
index 0000000..a9c7bb4
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2014 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#ifndef __VID_H_
+#define __VID_H_
+
+#define IR36021_LOOP1_MANUAL_ID_OFFSET	0x6A
+#define IR36021_LOOP1_VOUT_OFFSET	0x9A
+#define IR36021_MFR_ID_OFFSET		0x92
+#define IR36021_MFR_ID			0x43
+
+/* step the IR regulator in 5mV increments */
+#define IR_VDD_STEP_DOWN		5
+#define IR_VDD_STEP_UP			5
+int adjust_vdd(ulong vdd_override);
+
+#endif  /* __VID_H_ */
board/freescale/t208xqds/t208xqds.c +13 -0
index fc6d256..bd37df3 100644
@@ -20,6 +20,7 @@
 
 #include "../common/qixis.h"
 #include "../common/vsc3316_3308.h"
+#include "../common/vid.h"
 #include "t208xqds.h"
 #include "t208xqds_qixis.h"
 
@@ -86,6 +87,11 @@ int select_i2c_ch_pca9547(u8 ch)
 	return 0;
 }
 
+int i2c_multiplexer_select_vid_channel(u8 channel)
+{
+	return select_i2c_ch_pca9547(channel);
+}
+
 int brd_mux_lane_to_slot(void)
 {
 	ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
@@ -358,6 +364,13 @@ int board_early_init_r(void)
 	/* Disable remote I2C connection to qixis fpga */
 	QIXIS_WRITE(brdcfg[5], QIXIS_READ(brdcfg[5]) & ~BRDCFG5_IRE);
 
+	/*
+	 * Adjust core voltage according to voltage ID
+	 * This function changes I2C mux to channel 2.
+	 */
+	if (adjust_vdd(0))
+		printf("Warning: Adjusting core voltage failed.\n");
+
 	brd_mux_lane_to_slot();
 	select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT);
 
include/configs/T208xQDS.h +17 -0
index 2733358..62cdab0 100644
@@ -494,6 +494,23 @@ unsigned long get_board_ddr_clk(void);
 #define I2C_MUX_PCA_ADDR_SEC2	0x76 /* I2C bus multiplexer,secondary 2 */
 #define I2C_MUX_CH_DEFAULT	0x8
 
+#define I2C_MUX_CH_VOL_MONITOR 0xa
+
+/* Voltage monitor on channel 2*/
+#define I2C_VOL_MONITOR_ADDR           0x40
+#define I2C_VOL_MONITOR_BUS_V_OFFSET   0x2
+#define I2C_VOL_MONITOR_BUS_V_OVF      0x1
+#define I2C_VOL_MONITOR_BUS_V_SHIFT    3
+
+#define CONFIG_VID_FLS_ENV		"t208xqds_vdd_mv"
+#ifndef CONFIG_SPL_BUILD
+#define CONFIG_VID
+#endif
+#define CONFIG_VOL_MONITOR_IR36021_SET
+#define CONFIG_VOL_MONITOR_IR36021_READ
+/* The lowest and highest voltage allowed for T208xQDS */
+#define VDD_MV_MIN			819
+#define VDD_MV_MAX			1212
 
 /*
  * RapidIO
Signature · 1 line
1.8.4.1
#1 lore raw

PATCH v2 1/1 powerpc/t208xqds: VID support

Quoted 9 lines · ying.zhang at freescale.com

From: Ying Zhang <[email protected]>

The fuse status register provides the values from on-chip voltage ID efuses programmed at the factory. These values define the voltage requirements for the chip. u-boot reads FUSESR and translates the values into the appropriate commands to set the voltage output value of an external voltage regulator.

Quoted 5 lines

---
Change from v1:
- Set the core voltage according to the VID on startup.

Applied to u-boot-mpc85xx, awaiting upstream.

York