From: Jaehoon Chung <jh80.chung@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] arm: trats: add the sd-card power control function.
Date: Thu, 31 Oct 2013 22:37:45 +0900 [thread overview]
Message-ID: <52725D29.4080106@samsung.com> (raw)
To use the sd-card, VTF_2.8V will be enabled.
Before this patch, VTF_2.8V is always disabled.(card can't initialize.)
When card is detected, SD-card power will enable with sd_ldo_control().
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
board/samsung/trats/trats.c | 38 ++++++++++++++++++++++++++++++++------
1 file changed, 32 insertions(+), 6 deletions(-)
diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index 7f61d17..9b6dd12 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -408,11 +408,31 @@ int checkboard(void)
#endif
#ifdef CONFIG_GENERIC_MMC
+static int sd_ldo_control(int on)
+{
+ struct pmic *p = pmic_get("MAX8997_PMIC");
+ u32 val = 0;
+ int ret = 0;
+ if (pmic_probe(p))
+ return -1;
+
+ /* LDO17 VTF: 2.8V */
+ val = max8997_reg_ldo(2800000) | (on? EN_LDO : DIS_LDO);
+ ret |= pmic_reg_write(p, MAX8997_REG_LDO17CTRL, val);
+
+ if (ret) {
+ puts("MAX8997 SD setting error!\n");
+ return -1;
+ }
+
+ return 0;
+}
+
int board_mmc_init(bd_t *bis)
{
struct exynos4_gpio_part2 *gpio =
(struct exynos4_gpio_part2 *)samsung_get_base_gpio_part2();
- int err;
+ int err, err_sd = 0;
/* eMMC_EN: SD_0_CDn: GPK0[2] Output High */
s5p_gpio_direction_output(&gpio->k0, 2, 1);
@@ -438,14 +458,20 @@ int board_mmc_init(bd_t *bis)
* GPX3[4] T-flash detect pin
*/
if (!s5p_gpio_get_value(&gpio->x3, 4)) {
- err = exynos_pinmux_config(PERIPH_ID_SDMMC2, PINMUX_FLAG_NONE);
- if (err)
+ err_sd = exynos_pinmux_config(PERIPH_ID_SDMMC2, PINMUX_FLAG_NONE);
+ if (err_sd)
debug("SDMMC2 not configured\n");
- else
- err = s5p_mmc_init(2, 4);
+ else {
+ if (!sd_ldo_control(1)) {
+ err_sd = s5p_mmc_init(2, 4);
+ if (err_sd) {
+ sd_ldo_control(0);
+ }
+ }
+ }
}
- return err;
+ return err & err_sd;
}
#endif
--
1.7.9.5
next reply other threads:[~2013-10-31 13:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-31 13:37 Jaehoon Chung [this message]
2013-10-31 17:03 ` [U-Boot] [PATCH] arm: trats: add the sd-card power control function Lukasz Majewski
2013-11-01 1:02 ` Jaehoon Chung
2013-11-03 22:24 ` Lukasz Majewski
2013-11-04 1:28 ` Jaehoon Chung
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=52725D29.4080106@samsung.com \
--to=jh80.chung@samsung.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