From: York Sun <yorksun@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 05/31] powerpc/t4240qds: Add VDD override
Date: Fri, 22 Mar 2013 10:29:03 -0700 [thread overview]
Message-ID: <1363973369-26110-5-git-send-email-yorksun@freescale.com> (raw)
In-Reply-To: <1363973369-26110-1-git-send-email-yorksun@freescale.com>
Allow VDD voltage overriding with a command. This is an add-on feasture of
VID. To override VDD, use command vdd_override with the value of voltage
in mV, for example
vdd_override <voltage in mV, eg. 1050>
The above example will set the VDD to 1.050 volt. Any wrong value out of
range of 0.8188 to 1.2125 volt or invalid string is ignored.
In addition to the command, if overriding VDD is needed earlier in booting
process, save an variable and reboot:
setenv t4240qds_vdd_mv <voltage in mV>
saveenv
Signed-off-by: York Sun <yorksun@freescale.com>
---
board/freescale/t4qds/t4qds.c | 39 +++++++++++++++++++++++++++++++++++++--
doc/README.t4240qds | 24 ++++++++++++++++++++++++
2 files changed, 61 insertions(+), 2 deletions(-)
diff --git a/board/freescale/t4qds/t4qds.c b/board/freescale/t4qds/t4qds.c
index 2f4575b..3eec601 100644
--- a/board/freescale/t4qds/t4qds.c
+++ b/board/freescale/t4qds/t4qds.c
@@ -234,7 +234,7 @@ static inline int set_voltage(u8 vid)
}
-static int adjust_vdd(void)
+static int adjust_vdd(ulong vdd_override)
{
int re_enable = disable_interrupts();
ccsr_gur_t __iomem *gur =
@@ -243,6 +243,8 @@ static int adjust_vdd(void)
u8 vid, vid_current;
int vdd_target, vdd_current, vdd_last;
int ret;
+ unsigned long vdd_string_override;
+ char *vdd_string;
static const uint16_t vdd[32] = {
0, /* unused */
9875, /* 0.9875V */
@@ -292,6 +294,19 @@ static int adjust_vdd(void)
FSL_CORENET_DCFG_FUSESR_ALTVID_MASK;
}
vdd_target = vdd[vid];
+
+ /* check override variable for overriding VDD */
+ vdd_string = getenv("t4240qds_vdd_mv");
+ if (vdd_override == 0 && vdd_string &&
+ !strict_strtoul(vdd_string, 10, &vdd_string_override))
+ vdd_override = vdd_string_override;
+ if (vdd_override >= 819 && vdd_override <= 1212) {
+ vdd_target = vdd_override * 10; /* convert to 1/10 mV */
+ debug("VDD override is %lu\n", vdd_override);
+ } else if (vdd_override != 0) {
+ printf("Invalid value.\n");
+ }
+
if (vdd_target == 0) {
debug("VID: VID not used\n");
ret = 0;
@@ -512,7 +527,7 @@ int board_early_init_r(void)
* Adjust core voltage according to voltage ID
* This function changes I2C mux to channel 2.
*/
- if (adjust_vdd())
+ if (adjust_vdd(0))
printf("Warning: Adjusting core voltage failed.\n");
/* Configure board SERDES ports crossbar */
@@ -802,3 +817,23 @@ void qixis_dump_switch(void)
i + 1, byte_to_binary_mask(sw[i], mask[i], buf), sw[i]);
}
}
+
+static int do_vdd_adjust(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+ ulong override;
+
+ if (argc < 2)
+ return CMD_RET_USAGE;
+ if (!strict_strtoul(argv[1], 10, &override))
+ adjust_vdd(override); /* the value is checked by callee */
+ else
+ return CMD_RET_USAGE;
+
+ return 0;
+}
+
+U_BOOT_CMD(
+ vdd_override, 2, 0, do_vdd_adjust,
+ "Override VDD",
+ "- override with the voltage specified in mV, eg. 1050"
+);
diff --git a/doc/README.t4240qds b/doc/README.t4240qds
index 677d120..19e8a8a 100644
--- a/doc/README.t4240qds
+++ b/doc/README.t4240qds
@@ -96,3 +96,27 @@ The addresses in brackets are physical addresses.
0x0_ffff_f000 (0x0_7fff_fff0) - 0x0_ffff_ffff 4KB Boot page translation for secondary cores
The physical address of the last (boot page translation) varies with the actual DDR size.
+
+Voltage ID and VDD override
+--------------------
+T4240 has a VID feature. U-boot reads the VID efuses and adjust the voltage
+accordingly. The voltage can also be override by command vdd_override. The
+syntax is
+
+vdd_override <voltage in mV>, eg. 1050 is for 1.050v.
+
+Upon success, the actual voltage will be read back. The value is checked
+for safety and any invalid value will not adjust the voltage.
+
+Another way to override VDD is to use environmental variable, in case of using
+command is too late for some debugging. The syntax is
+
+setenv t4240qds_vdd_mv <voltage in mV>
+saveenv
+reset
+
+The override voltage takes effect when booting.
+
+Note: voltage adjustment needs to be done step by step. Changing voltage too
+rapidly may cause current surge. The voltage stepping is done by software.
+Users can set the final voltage directly.
--
1.7.9.5
next prev parent reply other threads:[~2013-03-22 17:29 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-22 17:28 [U-Boot] [PATCH 01/31] 83xx/pcie: fix build error for 83xx pcie York Sun
2013-03-22 17:29 ` [U-Boot] [PATCH 02/31] Enable L2 cache parity/ECC error checking York Sun
2013-03-22 17:29 ` [U-Boot] [PATCH 03/31] net/phy: fix select line for TN80xx York Sun
2013-03-22 20:59 ` Wolfgang Denk
2013-03-22 17:29 ` [U-Boot] [PATCH 04/31] powerpc/mpc85xx: check if core is disabled for showing status York Sun
2013-03-22 17:29 ` York Sun [this message]
2013-03-22 21:00 ` [U-Boot] [PATCH 05/31] powerpc/t4240qds: Add VDD override Wolfgang Denk
2013-03-22 17:29 ` [U-Boot] [PATCH 06/31] T4240/ramboot: enable PBL tool for T4240 York Sun
2013-03-22 17:29 ` [U-Boot] [PATCH 07/31] Add e6500 L2 replacement policy selection York Sun
2013-03-22 21:00 ` Wolfgang Denk
2013-03-22 17:29 ` [U-Boot] [PATCH 08/31] powerpc/p5040: enable NAND, SD, SPI boot support York Sun
2013-03-22 17:29 ` [U-Boot] [PATCH 09/31] powerpc/T4160: Merge T4160 and T4240 in config_mpc85xx.h York Sun
2013-03-22 17:29 ` [U-Boot] [PATCH 10/31] powerpc/mpc8xxx: Add T1040 and variant SoCs York Sun
2013-03-22 21:00 ` Wolfgang Denk
2013-03-22 17:29 ` [U-Boot] [PATCH 11/31] powerpc/chassis2: Change core numbering scheme York Sun
2013-03-22 17:29 ` [U-Boot] [PATCH 12/31] powerpc/mpc8xxx: Allow DDR overclock York Sun
2013-03-22 17:29 ` [U-Boot] [PATCH 13/31] powerpc/qixis: add clock measurement registers York Sun
2013-03-22 17:29 ` [U-Boot] [PATCH 14/31] powerpc/t4qds: use clock measurement for sysclk and ddr clock York Sun
2013-03-22 21:01 ` Wolfgang Denk
2013-03-22 17:29 ` [U-Boot] [PATCH 15/31] powerpc/p5040: enable PBL tool support York Sun
2013-03-22 17:29 ` [U-Boot] [PATCH 16/31] board/t4240qds, b4860qds: LAW/TLB for DCSR set to size 32M York Sun
2013-03-22 17:29 ` [U-Boot] [PATCH 17/31] Enable XAUI interface for B4860QDS York Sun
2013-03-22 21:02 ` Wolfgang Denk
2013-03-22 17:29 ` [U-Boot] [PATCH 18/31] powerpc/t4qds: Add SW7[4] in the DIP switch display York Sun
2013-03-22 21:02 ` Wolfgang Denk
2013-03-22 17:29 ` [U-Boot] [PATCH 19/31] powerpc/t4qds: Enable master module for Boot from SRIO and PCIE York Sun
2013-03-22 17:29 ` [U-Boot] [PATCH 20/31] powerpc/t4qds: Slave module for boot " York Sun
2013-03-22 21:02 ` Wolfgang Denk
2013-03-22 17:29 ` [U-Boot] [PATCH 21/31] powerpc/t4240qds: fix PHY reset timeout issue York Sun
2013-03-22 17:29 ` [U-Boot] [PATCH 22/31] powerpc/doc: Fix the misalignment of document README.srio-pcie-boot-corenet York Sun
2013-03-22 17:29 ` [U-Boot] [PATCH 23/31] powerpc/b4860: fix for Serdes connectivity to SFP's York Sun
2013-03-22 17:29 ` [U-Boot] [PATCH 24/31] powerpc/mpc85xx: add setting of clock-frequency for mpic node York Sun
2013-03-22 21:03 ` Wolfgang Denk
2013-03-22 17:29 ` [U-Boot] [PATCH 25/31] powerpc/p2041: fix serdes reference clock frequency display for PC board York Sun
2013-03-22 21:03 ` Wolfgang Denk
2013-03-22 17:29 ` [U-Boot] [PATCH 26/31] sf: spansion: Add support for S25FL128S York Sun
2013-03-22 17:29 ` [U-Boot] [PATCH 27/31] powerpc/B4: Merge B4420 and B4860 in config_mpc85xx.h York Sun
2013-03-22 17:29 ` [U-Boot] [PATCH 28/31] powerpc/p5040: fix mdio mux for 10G port York Sun
2013-03-22 17:29 ` [U-Boot] [PATCH 29/31] powerpc/usb: Fix usb device-tree fix-up York Sun
2013-03-22 21:04 ` Wolfgang Denk
2013-03-22 17:29 ` [U-Boot] [PATCH 30/31] fman/mEMAC: set SETSP bit in IF_MODE regisgter for RGMII speed York Sun
2013-03-22 17:29 ` [U-Boot] [PATCH 31/31] powerpc/b4860qds: Add LAW Target ID and Create LAW entry for Maple York Sun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1363973369-26110-5-git-send-email-yorksun@freescale.com \
--to=yorksun@freescale.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox