<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Oct 27, 2017 at 7:08 PM, Kevin O'Connor <span dir="ltr"><<a href="mailto:kevin@koconnor.net" target="_blank">kevin@koconnor.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Can you try the two patches below? (Go back to master, apply the<br>
first, gather the log, go back to master, apply the second, gather the<br>
log.)<br>
<br>
-Kevin<br></blockquote><div><br></div><div>w/patch 1 only: <a href="https://paste.ubuntu.com/25833503/" target="_blank">https://paste.ubuntu.<wbr>com/25833503/</a></div><div><br></div><div>w/patch 2 only: <a href="https://paste.ubuntu.com/25833542/">https://paste.ubuntu.com/25833542/</a></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
<br>
====================== patch 1 =========================<br>
<br>
--- a/src/hw/sdcard.c<br>
+++ b/src/hw/sdcard.c<br>
@@ -181,7 +181,7 @@ static int<br>
sdcard_pio(struct sdhci_s *regs, int cmd, u32 *param)<br>
{<br>
u32 state = readl(®s->present_state);<br>
- dprintf(9, "sdcard_pio cmd %x %x %x\n", cmd, *param, state);<br>
+ dprintf(1, "sdcard_pio cmd %x %x %x\n", cmd, *param, state);<br>
if ((state & SP_CMD_INHIBIT)<br>
|| ((cmd & 0x03) == 0x03 && state & SP_DAT_INHIBIT)) {<br>
dprintf(1, "sdcard_pio not ready %x\n", state);<br>
@@ -203,7 +203,7 @@ sdcard_pio(struct sdhci_s *regs, int cmd, u32 *param)<br>
writew(®s->irq_status, SI_CMD_COMPLETE);<br>
// Read response<br>
memcpy(param, regs->response, sizeof(regs->response));<br>
- dprintf(9, "sdcard cmd %x response %x %x %x %x\n"<br>
+ dprintf(1, "sdcard cmd %x response %x %x %x %x\n"<br>
, cmd, param[0], param[1], param[2], param[3]);<br>
return 0;<br>
}<br>
@@ -403,7 +403,7 @@ sdcard_card_setup(struct sddrive_s *drive, int volt, int prio)<br>
param[0] = vrange;<br>
<span class="gmail-m_-4768708182540026130gmail-"> ret = sdcard_pio(regs, SC_SEND_IF_COND, param);<br>
if (!ret && param[0] == vrange)<br>
</span><span class="gmail-m_-4768708182540026130gmail-">- hcs = (1<<30);<br>
</span>+ hcs = (1<<30) | (1<<28);<br>
<span class="gmail-m_-4768708182540026130gmail-"> // Verify SD card (instead of MMC or SDIO)<br>
</span> param[0] = 0x00;<br>
<span class="gmail-m_-4768708182540026130gmail-"> ret = sdcard_pio_app(regs, SC_APP_SEND_OP_COND, param);<br>
<br>
<br>
</span>====================== patch 2 =========================<br>
<br>
--- a/src/hw/sdcard.c<br>
+++ b/src/hw/sdcard.c<br>
@@ -123,6 +123,7 @@ struct sdhci_s {<br>
#define SRF_DATA 0x04<br>
<br>
// SDHCI result flags<br>
+#define SR_OCR_S18R (1<<24)<br>
#define SR_OCR_CCS (1<<30)<br>
#define SR_OCR_NOTBUSY (1<<31)<br>
<br>
@@ -181,7 +182,7 @@ static int<br>
sdcard_pio(struct sdhci_s *regs, int cmd, u32 *param)<br>
{<br>
u32 state = readl(®s->present_state);<br>
- dprintf(9, "sdcard_pio cmd %x %x %x\n", cmd, *param, state);<br>
+ dprintf(1, "sdcard_pio cmd %x %x %x\n", cmd, *param, state);<br>
if ((state & SP_CMD_INHIBIT)<br>
|| ((cmd & 0x03) == 0x03 && state & SP_DAT_INHIBIT)) {<br>
dprintf(1, "sdcard_pio not ready %x\n", state);<br>
@@ -203,7 +204,7 @@ sdcard_pio(struct sdhci_s *regs, int cmd, u32 *param)<br>
writew(®s->irq_status, SI_CMD_COMPLETE);<br>
// Read response<br>
memcpy(param, regs->response, sizeof(regs->response));<br>
- dprintf(9, "sdcard cmd %x response %x %x %x %x\n"<br>
+ dprintf(1, "sdcard cmd %x response %x %x %x %x\n"<br>
, cmd, param[0], param[1], param[2], param[3]);<br>
return 0;<br>
}<br>
@@ -416,6 +417,9 @@ sdcard_card_setup(struct sddrive_s *drive, int volt, int prio)<br>
drive->card_type |= SF_MMC;<br>
hcs = (1<<30);<br>
}<br>
+ // XXX<br>
+ if (volt == (1<<20) && hcs && readl(®s->cap_lo) & SD_CAPLO_V18)<br>
+ hcs |= SR_OCR_S18R;<br>
// Init card<br>
<span class="gmail-m_-4768708182540026130gmail-"> u32 end = timer_calc(SDHCI_POWERUP_TIMEO<wbr>UT);<br>
for (;;) {<br>
</span>@@ -434,6 +438,10 @@ sdcard_card_setup(struct sddrive_s *drive, int volt, int prio)<br>
}<br>
msleep(5); // Avoid flooding log when debugging<br>
}<br>
+ if (param[0] & SR_OCR_S18R) {<br>
+ dprintf(1, "Card requests 1.8 volt\n");<br>
+ return -1;<br>
+ }<br>
drive->card_type |= (param[0] & SR_OCR_CCS) ? SF_HIGHCAPACITY : 0;<br>
// Select card (get cid, set rca, get csd, select card)<br>
param[0] = 0x00;<br>
</blockquote></div><br></div></div>