summaryrefslogtreecommitdiff
path: root/src/mainboard/google/veyron_danger/sdmmc.c
diff options
context:
space:
mode:
authorDavid Hendricks <dhendrix@chromium.org>2015-06-03 15:27:07 -0700
committerPatrick Georgi <pgeorgi@google.com>2015-06-30 08:09:13 +0200
commit14610ec20ae086570434114fa262a9fb84dae6d9 (patch)
treeda14c3fcd114bfeb0ed19a0697e73f12b338c5c0 /src/mainboard/google/veyron_danger/sdmmc.c
parent4039822dc43fdcc301f416ea589c0c43d1e09244 (diff)
downloadcoreboot-14610ec20ae086570434114fa262a9fb84dae6d9.tar.xz
veyron_danger: Update SDMMC power on/off code for v2
This re-factors SDMMC power on/off to make corrections and take differences between board versions into account. To avoid similar- but-different case switch statements in romstage.c and mainboard.c, power on/off functions for SDMMC are split into their own .c file. BUG=none BRANCH=none TEST=built and booted of micro-SD card on Danger v2 Change-Id: Ib3069c35ceff1ff98b49579a6298681c1390beee Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: eecfee4a5dd39073b5f966a25991a594b3c4b519 Original-Change-Id: Id86ae7f40687e843ffc4e7769309d4678ad54f49 Original-Signed-off-by: David Hendricks <dhendrix@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/280853 Original-Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-on: http://review.coreboot.org/10685 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/mainboard/google/veyron_danger/sdmmc.c')
-rw-r--r--src/mainboard/google/veyron_danger/sdmmc.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/mainboard/google/veyron_danger/sdmmc.c b/src/mainboard/google/veyron_danger/sdmmc.c
new file mode 100644
index 0000000000..b60f2e6a73
--- /dev/null
+++ b/src/mainboard/google/veyron_danger/sdmmc.c
@@ -0,0 +1,45 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2015 Google Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "board.h"
+
+#include <soc/rk808.h>
+
+static void sdmmc_power(int enable)
+{
+ switch (board_id()) {
+ case 0:
+ /* VCC33_SD is tied to VCC33_SYS and is always on */
+ break;
+ default:
+ rk808_configure_ldo(4, enable ? 3300 : 0); /* VCC33_SD_LDO */
+ rk808_configure_ldo(5, enable ? 3300 : 0); /* VCCIO_SD */
+ break;
+ }
+}
+
+void sdmmc_power_off(void)
+{
+ sdmmc_power(0);
+}
+
+void sdmmc_power_on(void)
+{
+ sdmmc_power(1);
+}