From dbfa9d5e8db75490669330301bd1661571f24cfc Mon Sep 17 00:00:00 2001 From: Julius Werner Date: Fri, 5 Dec 2014 17:29:42 -0800 Subject: veyron: Turn off SD card power in romstage The only way to reliably reset an SD card in an unknown state is by power-cycling. Since a kernel may crash and reboot at any point, SD cards may be left in one of them fancy high-throughput modes that depthcharge (or, in fact, a newly booting kernel without prior knowledge) doesn't support, so we need to reset the card on every boot. This patch adds support to turn off an RK808 regulator completely and uses that to turn off SD card power rails in early romstage. The time until configure_sdmmc() in ramstage turns them back on should be more than enough to drain the power rail for an effective power-cycle. BRANCH=None BUG=chrome-os-partner:34289 TEST=Booted a Pinky from SD card, noticed that it works before and after this patch. Change-Id: Iaa5f7adaa59da69a964785c5e369ad73c6620224 Signed-off-by: Stefan Reinauer Original-Commit-Id: 95fba21907f1f3f686cb5a95b993736247db8f96 Original-Change-Id: I904b2d23ca35f765c000f9bee7637044f674eff9 Original-Signed-off-by: Julius Werner Original-Reviewed-on: https://chromium-review.googlesource.com/233713 Original-Reviewed-by: Alexandru Stan Original-Tested-by: Alexandru Stan Original-Reviewed-by: David Hendricks Reviewed-on: http://review.coreboot.org/9626 Tested-by: build bot (Jenkins) Reviewed-by: Julius Werner Reviewed-by: Marc Jones --- src/soc/rockchip/rk3288/Makefile.inc | 1 + src/soc/rockchip/rk3288/rk808.c | 5 +++++ 2 files changed, 6 insertions(+) (limited to 'src/soc/rockchip/rk3288') diff --git a/src/soc/rockchip/rk3288/Makefile.inc b/src/soc/rockchip/rk3288/Makefile.inc index 01ed81b5c9..680bdb5429 100644 --- a/src/soc/rockchip/rk3288/Makefile.inc +++ b/src/soc/rockchip/rk3288/Makefile.inc @@ -49,6 +49,7 @@ romstage-y += gpio.c romstage-y += spi.c romstage-y += media.c romstage-y += sdram.c +romstage-y += rk808.c romstage-y += pwm.c romstage-y += tsadc.c diff --git a/src/soc/rockchip/rk3288/rk808.c b/src/soc/rockchip/rk3288/rk808.c index fffef8907e..9713a9292f 100644 --- a/src/soc/rockchip/rk3288/rk808.c +++ b/src/soc/rockchip/rk3288/rk808.c @@ -53,6 +53,11 @@ void rk808_configure_ldo(uint8_t bus, int ldo, int millivolts) { uint8_t vsel; + if (!millivolts) { + rk808_clrsetbits(bus, LDO_EN, 1 << (ldo - 1), 0); + return; + } + switch (ldo) { case 1: case 2: -- cgit v1.2.3