diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2015-08-11 11:56:51 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2015-08-17 12:11:24 -0400 |
commit | ad0c9eae4e4c2461a39588597384ce298caa2314 (patch) | |
tree | bed1172101a509b600a93a288324650ee3777cdf /src | |
parent | 4b99922f9a1d765c1bc69f5731e85756195b53c3 (diff) | |
download | seabios-ad0c9eae4e4c2461a39588597384ce298caa2314.tar.gz |
sdcard: Power controller up to maximum voltage supported
Don't error out if the controller does not support 3.3V - instead
supply the most voltage the controller supports.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/hw/sdcard.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/hw/sdcard.c b/src/hw/sdcard.c index 45f19a7c..7474c320 100644 --- a/src/hw/sdcard.c +++ b/src/hw/sdcard.c @@ -93,6 +93,8 @@ struct sdhci_s { // SDHCI capabilities flags #define SD_CAPLO_V33 (1<<24) +#define SD_CAPLO_V30 (1<<25) +#define SD_CAPLO_V18 (1<<26) #define SD_CAPLO_BASECLOCK_SHIFT 8 #define SD_CAPLO_BASECLOCK_MASK 0xff @@ -107,6 +109,8 @@ struct sdhci_s { // SDHCI power control flags #define SPC_POWER_ON (1<<0) +#define SPC_V18 0x0a +#define SPC_V30 0x0c #define SPC_V33 0x0e // SDHCI result flags @@ -323,15 +327,25 @@ static int sdcard_set_power(struct sdhci_s *regs) { u32 cap = readl(®s->cap_lo); - if (!(cap & SD_CAPLO_V33)) { - dprintf(1, "SD controller does not support 3.3V power\n"); + u32 volt, vbits; + if (cap & SD_CAPLO_V33) { + volt = 1<<20; + vbits = SPC_V33; + } else if (cap & SD_CAPLO_V30) { + volt = 1<<18; + vbits = SPC_V30; + } else if (cap & SD_CAPLO_V18) { + volt = 1<<7; + vbits = SPC_V18; + } else { + dprintf(1, "SD controller unsupported volt range (%x)\n", cap); return -1; } writeb(®s->power_control, 0); msleep(SDHCI_POWER_OFF_TIME); - writeb(®s->power_control, SPC_V33 | SPC_POWER_ON); + writeb(®s->power_control, vbits | SPC_POWER_ON); msleep(SDHCI_POWER_ON_TIME); - return 1<<20; + return volt; } static int |